Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3727cd54
Commit
3727cd54
authored
Mar 13, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/flvdec: add support for OnCaption
parent
1df64d6c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
flvdec.c
libavformat/flvdec.c
+14
-3
No files found.
libavformat/flvdec.c
View file @
3727cd54
...
...
@@ -546,7 +546,8 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream,
}
#define TYPE_ONTEXTDATA 1
#define TYPE_UNKNOWN 2
#define TYPE_ONCAPTION 2
#define TYPE_UNKNOWN 9
static
int
flv_read_metabody
(
AVFormatContext
*
s
,
int64_t
next_pos
)
{
...
...
@@ -573,6 +574,9 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos)
if
(
!
strcmp
(
buffer
,
"onTextData"
))
return
TYPE_ONTEXTDATA
;
if
(
!
strcmp
(
buffer
,
"onCaption"
))
return
TYPE_ONCAPTION
;
if
(
strcmp
(
buffer
,
"onMetaData"
)
&&
strcmp
(
buffer
,
"onCuePoint"
))
return
TYPE_UNKNOWN
;
...
...
@@ -717,8 +721,11 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
char
buf
[
20
];
int
ret
=
AVERROR_INVALIDDATA
;
int
i
,
length
=
-
1
;
int
array
=
0
;
switch
(
avio_r8
(
pb
))
{
case
AMF_DATA_TYPE_ARRAY
:
array
=
1
;
case
AMF_DATA_TYPE_MIXEDARRAY
:
avio_seek
(
pb
,
4
,
SEEK_CUR
);
case
AMF_DATA_TYPE_OBJECT
:
...
...
@@ -727,9 +734,9 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt,
goto
skip
;
}
while
((
ret
=
amf_get_string
(
pb
,
buf
,
sizeof
(
buf
)))
>
0
)
{
while
(
array
||
(
ret
=
amf_get_string
(
pb
,
buf
,
sizeof
(
buf
)))
>
0
)
{
AMFDataType
type
=
avio_r8
(
pb
);
if
(
type
==
AMF_DATA_TYPE_STRING
&&
!
strcmp
(
buf
,
"text"
))
{
if
(
type
==
AMF_DATA_TYPE_STRING
&&
(
array
||
!
strcmp
(
buf
,
"text"
)
))
{
length
=
avio_rb16
(
pb
);
ret
=
av_get_packet
(
pb
,
pkt
,
length
);
if
(
ret
<
0
)
...
...
@@ -839,6 +846,8 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
else
if
(
type
==
TYPE_ONTEXTDATA
)
{
avpriv_request_sample
(
s
,
"OnTextData packet"
);
return
flv_data_packet
(
s
,
pkt
,
dts
,
next
);
}
else
if
(
type
==
TYPE_ONCAPTION
)
{
return
flv_data_packet
(
s
,
pkt
,
dts
,
next
);
}
avio_seek
(
s
->
pb
,
meta_pos
,
SEEK_SET
);
}
...
...
@@ -955,6 +964,8 @@ retry_duration:
}
}
else
if
(
stream_type
==
FLV_STREAM_TYPE_VIDEO
)
{
size
-=
flv_set_video_codec
(
s
,
st
,
flags
&
FLV_VIDEO_CODECID_MASK
,
1
);
}
else
if
(
stream_type
==
FLV_STREAM_TYPE_DATA
)
{
st
->
codec
->
codec_id
=
AV_CODEC_ID_TEXT
;
}
if
(
st
->
codec
->
codec_id
==
AV_CODEC_ID_AAC
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment