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
30bcd6a9
Commit
30bcd6a9
authored
Aug 25, 2011
by
Joseph Wecker
Committed by
Michael Niedermayer
Sep 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flv: Ammon's changes migrated from 0.6.0 - I believe for the android broadcaster.
parent
b5d4c0e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
7 deletions
+16
-7
flv.h
libavformat/flv.h
+2
-0
flvdec.c
libavformat/flvdec.c
+7
-2
flvenc.c
libavformat/flvenc.c
+7
-5
No files found.
libavformat/flv.h
View file @
30bcd6a9
...
...
@@ -98,6 +98,8 @@ enum {
FLV_CODECID_VP6A
=
5
,
FLV_CODECID_SCREEN2
=
6
,
FLV_CODECID_H264
=
7
,
FLV_CODECID_REALH263
=
8
,
FLV_CODECID_MPEG4
=
9
,
};
enum
{
...
...
libavformat/flvdec.c
View file @
30bcd6a9
...
...
@@ -91,6 +91,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
AVCodecContext
*
vcodec
=
vstream
->
codec
;
switch
(
flv_codecid
)
{
case
FLV_CODECID_H263
:
vcodec
->
codec_id
=
CODEC_ID_FLV1
;
break
;
case
FLV_CODECID_REALH263
:
vcodec
->
codec_id
=
CODEC_ID_H263
;
break
;
// Really mean it this time
case
FLV_CODECID_SCREEN
:
vcodec
->
codec_id
=
CODEC_ID_FLASHSV
;
break
;
case
FLV_CODECID_SCREEN2
:
vcodec
->
codec_id
=
CODEC_ID_FLASHSV2
;
break
;
case
FLV_CODECID_VP6
:
vcodec
->
codec_id
=
CODEC_ID_VP6F
;
...
...
@@ -106,6 +107,9 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
case
FLV_CODECID_H264
:
vcodec
->
codec_id
=
CODEC_ID_H264
;
return
3
;
// not 4, reading packet type will consume one byte
case
FLV_CODECID_MPEG4
:
vcodec
->
codec_id
=
CODEC_ID_MPEG4
;
return
3
;
default:
av_log
(
s
,
AV_LOG_INFO
,
"Unsupported video codec (%x)
\n
"
,
flv_codecid
);
vcodec
->
codec_tag
=
flv_codecid
;
...
...
@@ -467,10 +471,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
}
if
(
st
->
codec
->
codec_id
==
CODEC_ID_AAC
||
st
->
codec
->
codec_id
==
CODEC_ID_H264
)
{
st
->
codec
->
codec_id
==
CODEC_ID_H264
||
st
->
codec
->
codec_id
==
CODEC_ID_MPEG4
)
{
int
type
=
avio_r8
(
s
->
pb
);
size
--
;
if
(
st
->
codec
->
codec_id
==
CODEC_ID_H264
)
{
if
(
st
->
codec
->
codec_id
==
CODEC_ID_H264
||
st
->
codec
->
codec_id
==
CODEC_ID_MPEG4
)
{
int32_t
cts
=
(
avio_rb24
(
s
->
pb
)
+
0xff800000
)
^
0xff800000
;
// sign extension
pts
=
dts
+
cts
;
if
(
cts
<
0
)
{
// dts are wrong
...
...
libavformat/flvenc.c
View file @
30bcd6a9
...
...
@@ -33,6 +33,8 @@
static
const
AVCodecTag
flv_video_codec_ids
[]
=
{
{
CODEC_ID_FLV1
,
FLV_CODECID_H263
},
{
CODEC_ID_H263
,
FLV_CODECID_REALH263
},
{
CODEC_ID_MPEG4
,
FLV_CODECID_MPEG4
},
{
CODEC_ID_FLASHSV
,
FLV_CODECID_SCREEN
},
{
CODEC_ID_FLASHSV2
,
FLV_CODECID_SCREEN2
},
{
CODEC_ID_VP6F
,
FLV_CODECID_VP6
},
...
...
@@ -300,7 +302,7 @@ static int flv_write_header(AVFormatContext *s)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVCodecContext
*
enc
=
s
->
streams
[
i
]
->
codec
;
if
(
enc
->
codec_id
==
CODEC_ID_AAC
||
enc
->
codec_id
==
CODEC_ID_H264
)
{
if
(
enc
->
codec_id
==
CODEC_ID_AAC
||
enc
->
codec_id
==
CODEC_ID_H264
||
enc
->
codec_id
==
CODEC_ID_MPEG4
)
{
int64_t
pos
;
avio_w8
(
pb
,
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
?
FLV_TAG_TYPE_VIDEO
:
FLV_TAG_TYPE_AUDIO
);
...
...
@@ -342,7 +344,7 @@ static int flv_write_trailer(AVFormatContext *s)
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
{
AVCodecContext
*
enc
=
s
->
streams
[
i
]
->
codec
;
if
(
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
&&
enc
->
codec_id
==
CODEC_ID_H264
)
{
(
enc
->
codec_id
==
CODEC_ID_H264
||
enc
->
codec_id
==
CODEC_ID_MPEG4
)
)
{
put_avc_eos_tag
(
pb
,
flv
->
last_video_ts
);
}
}
...
...
@@ -374,7 +376,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
if
(
enc
->
codec_id
==
CODEC_ID_VP6
||
enc
->
codec_id
==
CODEC_ID_VP6F
||
enc
->
codec_id
==
CODEC_ID_AAC
)
flags_size
=
2
;
else
if
(
enc
->
codec_id
==
CODEC_ID_H264
)
else
if
(
enc
->
codec_id
==
CODEC_ID_H264
||
enc
->
codec_id
==
CODEC_ID_MPEG4
)
flags_size
=
5
;
else
flags_size
=
1
;
...
...
@@ -398,7 +400,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_w8
(
pb
,
FLV_TAG_TYPE_AUDIO
);
}
if
(
enc
->
codec_id
==
CODEC_ID_H264
)
{
if
(
enc
->
codec_id
==
CODEC_ID_H264
||
enc
->
codec_id
==
CODEC_ID_MPEG4
)
{
/* check if extradata looks like mp4 formated */
if
(
enc
->
extradata_size
>
0
&&
*
(
uint8_t
*
)
enc
->
extradata
!=
1
)
{
if
(
ff_avc_parse_nal_units_buf
(
pkt
->
data
,
&
data
,
&
size
)
<
0
)
...
...
@@ -428,7 +430,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_w8
(
pb
,
enc
->
extradata_size
?
enc
->
extradata
[
0
]
:
0
);
else
if
(
enc
->
codec_id
==
CODEC_ID_AAC
)
avio_w8
(
pb
,
1
);
// AAC raw
else
if
(
enc
->
codec_id
==
CODEC_ID_H264
)
{
else
if
(
enc
->
codec_id
==
CODEC_ID_H264
||
enc
->
codec_id
==
CODEC_ID_MPEG4
)
{
avio_w8
(
pb
,
1
);
// AVC NALU
avio_wb24
(
pb
,
pkt
->
pts
-
pkt
->
dts
);
}
...
...
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