Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
274335e7
Commit
274335e7
authored
Aug 26, 2008
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vertical align
Originally committed as revision 14972 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
977327c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
mpeg.c
libavformat/mpeg.c
+5
-5
mpegenc.c
libavformat/mpegenc.c
+13
-13
No files found.
libavformat/mpeg.c
View file @
274335e7
...
@@ -67,8 +67,8 @@ static int mpegps_probe(AVProbeData *p)
...
@@ -67,8 +67,8 @@ static int mpegps_probe(AVProbeData *p)
if
(
code
==
SYSTEM_HEADER_START_CODE
)
sys
++
;
if
(
code
==
SYSTEM_HEADER_START_CODE
)
sys
++
;
else
if
(
code
==
PRIVATE_STREAM_1
)
priv1
++
;
else
if
(
code
==
PRIVATE_STREAM_1
)
priv1
++
;
else
if
(
code
==
PACK_START_CODE
)
pspack
++
;
else
if
(
code
==
PACK_START_CODE
)
pspack
++
;
else
if
((
code
&
0xf0
)
==
VIDEO_ID
&&
pes
)
vid
++
;
else
if
((
code
&
0xf0
)
==
VIDEO_ID
&&
pes
)
vid
++
;
else
if
((
code
&
0xe0
)
==
AUDIO_ID
&&
pes
)
audio
++
;
else
if
((
code
&
0xe0
)
==
AUDIO_ID
&&
pes
)
audio
++
;
else
if
((
code
&
0xf0
)
==
VIDEO_ID
&&
!
pes
)
invalid
++
;
else
if
((
code
&
0xf0
)
==
VIDEO_ID
&&
!
pes
)
invalid
++
;
else
if
((
code
&
0xe0
)
==
AUDIO_ID
&&
!
pes
)
invalid
++
;
else
if
((
code
&
0xe0
)
==
AUDIO_ID
&&
!
pes
)
invalid
++
;
...
@@ -211,8 +211,8 @@ static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
...
@@ -211,8 +211,8 @@ static long mpegps_psm_parse(MpegDemuxContext *m, ByteIOContext *pb)
/* at least one es available? */
/* at least one es available? */
while
(
es_map_length
>=
4
){
while
(
es_map_length
>=
4
){
unsigned
char
type
=
get_byte
(
pb
);
unsigned
char
type
=
get_byte
(
pb
);
unsigned
char
es_id
=
get_byte
(
pb
);
unsigned
char
es_id
=
get_byte
(
pb
);
uint16_t
es_info_length
=
get_be16
(
pb
);
uint16_t
es_info_length
=
get_be16
(
pb
);
/* remember mapping from stream id to stream type */
/* remember mapping from stream id to stream type */
m
->
psm_es_type
[
es_id
]
=
type
;
m
->
psm_es_type
[
es_id
]
=
type
;
...
@@ -467,7 +467,7 @@ static int mpegps_read_packet(AVFormatContext *s,
...
@@ -467,7 +467,7 @@ static int mpegps_read_packet(AVFormatContext *s,
}
else
if
(
startcode
>=
0x80
&&
startcode
<=
0x87
)
{
}
else
if
(
startcode
>=
0x80
&&
startcode
<=
0x87
)
{
type
=
CODEC_TYPE_AUDIO
;
type
=
CODEC_TYPE_AUDIO
;
codec_id
=
CODEC_ID_AC3
;
codec_id
=
CODEC_ID_AC3
;
}
else
if
(
(
startcode
>=
0x88
&&
startcode
<=
0x8f
)
}
else
if
(
(
startcode
>=
0x88
&&
startcode
<=
0x8f
)
||
(
startcode
>=
0x98
&&
startcode
<=
0x9f
))
{
||
(
startcode
>=
0x98
&&
startcode
<=
0x9f
))
{
/* 0x90 - 0x97 is reserved for SDDS in DVD specs */
/* 0x90 - 0x97 is reserved for SDDS in DVD specs */
type
=
CODEC_TYPE_AUDIO
;
type
=
CODEC_TYPE_AUDIO
;
...
...
libavformat/mpegenc.c
View file @
274335e7
...
@@ -95,11 +95,11 @@ static int put_pack_header(AVFormatContext *ctx,
...
@@ -95,11 +95,11 @@ static int put_pack_header(AVFormatContext *ctx,
}
else
{
}
else
{
put_bits
(
&
pb
,
4
,
0x2
);
put_bits
(
&
pb
,
4
,
0x2
);
}
}
put_bits
(
&
pb
,
3
,
(
uint32_t
)((
timestamp
>>
30
)
&
0x07
));
put_bits
(
&
pb
,
3
,
(
uint32_t
)((
timestamp
>>
30
)
&
0x07
));
put_bits
(
&
pb
,
1
,
1
);
put_bits
(
&
pb
,
1
,
1
);
put_bits
(
&
pb
,
15
,
(
uint32_t
)((
timestamp
>>
15
)
&
0x7fff
));
put_bits
(
&
pb
,
15
,
(
uint32_t
)((
timestamp
>>
15
)
&
0x7fff
));
put_bits
(
&
pb
,
1
,
1
);
put_bits
(
&
pb
,
1
,
1
);
put_bits
(
&
pb
,
15
,
(
uint32_t
)((
timestamp
)
&
0x7fff
));
put_bits
(
&
pb
,
15
,
(
uint32_t
)((
timestamp
)
&
0x7fff
));
put_bits
(
&
pb
,
1
,
1
);
put_bits
(
&
pb
,
1
,
1
);
if
(
s
->
is_mpeg2
)
{
if
(
s
->
is_mpeg2
)
{
/* clock extension */
/* clock extension */
...
@@ -297,12 +297,12 @@ static int mpeg_mux_init(AVFormatContext *ctx)
...
@@ -297,12 +297,12 @@ static int mpeg_mux_init(AVFormatContext *ctx)
int
video_bitrate
;
int
video_bitrate
;
s
->
packet_number
=
0
;
s
->
packet_number
=
0
;
s
->
is_vcd
=
(
ENABLE_MPEG1VCD_MUXER
&&
ctx
->
oformat
==
&
mpeg1vcd_muxer
);
s
->
is_vcd
=
(
ENABLE_MPEG1VCD_MUXER
&&
ctx
->
oformat
==
&
mpeg1vcd_muxer
);
s
->
is_svcd
=
(
ENABLE_MPEG2SVCD_MUXER
&&
ctx
->
oformat
==
&
mpeg2svcd_muxer
);
s
->
is_svcd
=
(
ENABLE_MPEG2SVCD_MUXER
&&
ctx
->
oformat
==
&
mpeg2svcd_muxer
);
s
->
is_mpeg2
=
((
ENABLE_MPEG2VOB_MUXER
&&
ctx
->
oformat
==
&
mpeg2vob_muxer
)
||
s
->
is_mpeg2
=
((
ENABLE_MPEG2VOB_MUXER
&&
ctx
->
oformat
==
&
mpeg2vob_muxer
)
||
(
ENABLE_MPEG2DVD_MUXER
&&
ctx
->
oformat
==
&
mpeg2dvd_muxer
)
||
(
ENABLE_MPEG2DVD_MUXER
&&
ctx
->
oformat
==
&
mpeg2dvd_muxer
)
||
(
ENABLE_MPEG2SVCD_MUXER
&&
ctx
->
oformat
==
&
mpeg2svcd_muxer
));
(
ENABLE_MPEG2SVCD_MUXER
&&
ctx
->
oformat
==
&
mpeg2svcd_muxer
));
s
->
is_dvd
=
(
ENABLE_MPEG2DVD_MUXER
&&
ctx
->
oformat
==
&
mpeg2dvd_muxer
);
s
->
is_dvd
=
(
ENABLE_MPEG2DVD_MUXER
&&
ctx
->
oformat
==
&
mpeg2dvd_muxer
);
if
(
ctx
->
packet_size
)
if
(
ctx
->
packet_size
)
s
->
packet_size
=
ctx
->
packet_size
;
s
->
packet_size
=
ctx
->
packet_size
;
...
@@ -331,7 +331,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
...
@@ -331,7 +331,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
switch
(
st
->
codec
->
codec_type
)
{
switch
(
st
->
codec
->
codec_type
)
{
case
CODEC_TYPE_AUDIO
:
case
CODEC_TYPE_AUDIO
:
if
(
st
->
codec
->
codec_id
==
CODEC_ID_AC3
)
{
if
(
st
->
codec
->
codec_id
==
CODEC_ID_AC3
)
{
stream
->
id
=
ac3_id
++
;
stream
->
id
=
ac3_id
++
;
}
else
if
(
st
->
codec
->
codec_id
==
CODEC_ID_DTS
)
{
}
else
if
(
st
->
codec
->
codec_id
==
CODEC_ID_DTS
)
{
stream
->
id
=
dts_id
++
;
stream
->
id
=
dts_id
++
;
...
@@ -438,7 +438,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
...
@@ -438,7 +438,7 @@ static int mpeg_mux_init(AVFormatContext *ctx)
/* Add the header overhead to the data rate.
/* Add the header overhead to the data rate.
2279 data bytes per audio pack, 2294 data bytes per video pack*/
2279 data bytes per audio pack, 2294 data bytes per video pack*/
overhead_rate
=
((
audio_bitrate
/
8
.
0
)
/
2279
)
*
(
2324
-
2279
);
overhead_rate
=
((
audio_bitrate
/
8
.
0
)
/
2279
)
*
(
2324
-
2279
);
overhead_rate
+=
((
video_bitrate
/
8
.
0
)
/
2294
)
*
(
2324
-
2294
);
overhead_rate
+=
((
video_bitrate
/
8
.
0
)
/
2294
)
*
(
2324
-
2294
);
overhead_rate
*=
8
;
overhead_rate
*=
8
;
...
@@ -489,7 +489,7 @@ static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp)
...
@@ -489,7 +489,7 @@ static inline void put_timestamp(ByteIOContext *pb, int id, int64_t timestamp)
(((
timestamp
>>
30
)
&
0x07
)
<<
1
)
|
(((
timestamp
>>
30
)
&
0x07
)
<<
1
)
|
1
);
1
);
put_be16
(
pb
,
(
uint16_t
)((((
timestamp
>>
15
)
&
0x7fff
)
<<
1
)
|
1
));
put_be16
(
pb
,
(
uint16_t
)((((
timestamp
>>
15
)
&
0x7fff
)
<<
1
)
|
1
));
put_be16
(
pb
,
(
uint16_t
)((((
timestamp
)
&
0x7fff
)
<<
1
)
|
1
));
put_be16
(
pb
,
(
uint16_t
)((((
timestamp
)
&
0x7fff
)
<<
1
)
|
1
));
}
}
...
@@ -799,7 +799,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
...
@@ -799,7 +799,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
header_len
-=
timestamp_len
;
header_len
-=
timestamp_len
;
if
(
s
->
is_dvd
&&
stream
->
align_iframe
)
{
if
(
s
->
is_dvd
&&
stream
->
align_iframe
)
{
pad_packet_bytes
+=
timestamp_len
;
pad_packet_bytes
+=
timestamp_len
;
packet_size
-=
timestamp_len
;
packet_size
-=
timestamp_len
;
}
else
{
}
else
{
payload_size
+=
timestamp_len
;
payload_size
+=
timestamp_len
;
}
}
...
@@ -812,7 +812,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
...
@@ -812,7 +812,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
packet_size
+=
pad_packet_bytes
;
packet_size
+=
pad_packet_bytes
;
payload_size
+=
pad_packet_bytes
;
// undo the previous adjustment
payload_size
+=
pad_packet_bytes
;
// undo the previous adjustment
if
(
stuffing_size
<
0
)
{
if
(
stuffing_size
<
0
)
{
stuffing_size
=
pad_packet_bytes
;
stuffing_size
=
pad_packet_bytes
;
}
else
{
}
else
{
stuffing_size
+=
pad_packet_bytes
;
stuffing_size
+=
pad_packet_bytes
;
}
}
...
@@ -823,8 +823,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
...
@@ -823,8 +823,8 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
stuffing_size
=
0
;
stuffing_size
=
0
;
if
(
stuffing_size
>
16
)
{
/*<=16 for MPEG-1, <=32 for MPEG-2*/
if
(
stuffing_size
>
16
)
{
/*<=16 for MPEG-1, <=32 for MPEG-2*/
pad_packet_bytes
+=
stuffing_size
;
pad_packet_bytes
+=
stuffing_size
;
packet_size
-=
stuffing_size
;
packet_size
-=
stuffing_size
;
payload_size
-=
stuffing_size
;
payload_size
-=
stuffing_size
;
stuffing_size
=
0
;
stuffing_size
=
0
;
}
}
...
@@ -869,7 +869,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
...
@@ -869,7 +869,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index,
/* P-STD buffer info */
/* P-STD buffer info */
if
(
id
==
AUDIO_ID
)
if
(
id
==
AUDIO_ID
)
put_be16
(
ctx
->
pb
,
0x4000
|
stream
->
max_buffer_size
/
128
);
put_be16
(
ctx
->
pb
,
0x4000
|
stream
->
max_buffer_size
/
128
);
else
else
put_be16
(
ctx
->
pb
,
0x6000
|
stream
->
max_buffer_size
/
1024
);
put_be16
(
ctx
->
pb
,
0x6000
|
stream
->
max_buffer_size
/
1024
);
}
}
...
...
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