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
04fd3e81
Commit
04fd3e81
authored
May 26, 2008
by
Baptiste Coudurier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aac and h264 in flv demuxing
Originally committed as revision 13439 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
f23496b5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
flvdec.c
libavformat/flvdec.c
+32
-0
No files found.
libavformat/flvdec.c
View file @
04fd3e81
...
...
@@ -51,6 +51,7 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, int flv_c
break
;
case
FLV_CODECID_PCM_LE
:
acodec
->
codec_id
=
acodec
->
bits_per_sample
==
8
?
CODEC_ID_PCM_S8
:
CODEC_ID_PCM_S16LE
;
break
;
case
FLV_CODECID_AAC
:
acodec
->
codec_id
=
CODEC_ID_AAC
;
break
;
case
FLV_CODECID_ADPCM
:
acodec
->
codec_id
=
CODEC_ID_ADPCM_SWF
;
break
;
case
FLV_CODECID_MP3
:
acodec
->
codec_id
=
CODEC_ID_MP3
;
astream
->
need_parsing
=
AVSTREAM_PARSE_FULL
;
break
;
case
FLV_CODECID_NELLYMOSER_8HZ_MONO
:
...
...
@@ -79,6 +80,9 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
}
vcodec
->
extradata
[
0
]
=
get_byte
(
s
->
pb
);
return
1
;
// 1 byte body size adjustment for flv_read_packet()
case
FLV_CODECID_H264
:
vcodec
->
codec_id
=
CODEC_ID_H264
;
return
3
;
// not 4, reading packet type will consume one byte
default:
av_log
(
s
,
AV_LOG_INFO
,
"Unsupported video codec (%x)
\n
"
,
flv_codecid
);
vcodec
->
codec_tag
=
flv_codecid
;
...
...
@@ -278,12 +282,24 @@ static int flv_read_header(AVFormatContext *s,
return
0
;
}
static
int
flv_get_extradata
(
AVFormatContext
*
s
,
AVStream
*
st
,
int
size
)
{
av_free
(
st
->
codec
->
extradata
);
st
->
codec
->
extradata
=
av_mallocz
(
size
+
FF_INPUT_BUFFER_PADDING_SIZE
);
if
(
!
st
->
codec
->
extradata
)
return
AVERROR
(
ENOMEM
);
st
->
codec
->
extradata_size
=
size
;
get_buffer
(
s
->
pb
,
st
->
codec
->
extradata
,
st
->
codec
->
extradata_size
);
return
0
;
}
static
int
flv_read_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
int
ret
,
i
,
type
,
size
,
flags
,
is_audio
,
next
,
pos
;
unsigned
dts
;
AVStream
*
st
=
NULL
;
retry
:
for
(;;){
pos
=
url_ftell
(
s
->
pb
);
url_fskip
(
s
->
pb
,
4
);
/* size of previous packet */
...
...
@@ -369,6 +385,22 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
size
-=
flv_set_video_codec
(
s
,
st
,
flags
&
FLV_VIDEO_CODECID_MASK
);
}
if
(
st
->
codec
->
codec_id
==
CODEC_ID_AAC
||
st
->
codec
->
codec_id
==
CODEC_ID_H264
)
{
int
type
=
get_byte
(
s
->
pb
);
size
--
;
if
(
st
->
codec
->
codec_id
==
CODEC_ID_H264
)
{
// cts offset ignored because it might to be signed
// and would cause pts < dts
get_be24
(
s
->
pb
);
}
if
(
type
==
0
)
{
if
((
ret
=
flv_get_extradata
(
s
,
st
,
size
-
1
))
<
0
)
return
ret
;
goto
retry
;
}
}
ret
=
av_get_packet
(
s
->
pb
,
pkt
,
size
-
1
);
if
(
ret
<=
0
)
{
return
AVERROR
(
EIO
);
...
...
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