mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
Merge commit '4e9e6fa99f3ff83cedbf6c378d62065ae419a3b9'
* commit '4e9e6fa99f3ff83cedbf6c378d62065ae419a3b9': mpeg: Write H264 streams at offset 2 Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
cf0e8e7ad4
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#define AUDIO_ID 0xc0
|
#define AUDIO_ID 0xc0
|
||||||
#define VIDEO_ID 0xe0
|
#define VIDEO_ID 0xe0
|
||||||
|
#define H264_ID 0xe2
|
||||||
#define AC3_ID 0x80
|
#define AC3_ID 0x80
|
||||||
#define DTS_ID 0x88
|
#define DTS_ID 0x88
|
||||||
#define LPCM_ID 0xa0
|
#define LPCM_ID 0xa0
|
||||||
|
@ -301,7 +301,7 @@ static int get_system_header_size(AVFormatContext *ctx)
|
|||||||
static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
||||||
{
|
{
|
||||||
MpegMuxContext *s = ctx->priv_data;
|
MpegMuxContext *s = ctx->priv_data;
|
||||||
int bitrate, i, mpa_id, mpv_id, mps_id, ac3_id, dts_id, lpcm_id, j;
|
int bitrate, i, mpa_id, mpv_id, h264_id, mps_id, ac3_id, dts_id, lpcm_id, j;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
StreamInfo *stream;
|
StreamInfo *stream;
|
||||||
int audio_bitrate;
|
int audio_bitrate;
|
||||||
@ -337,6 +337,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
|||||||
ac3_id = AC3_ID;
|
ac3_id = AC3_ID;
|
||||||
dts_id = DTS_ID;
|
dts_id = DTS_ID;
|
||||||
mpv_id = VIDEO_ID;
|
mpv_id = VIDEO_ID;
|
||||||
|
h264_id = H264_ID;
|
||||||
mps_id = SUB_ID;
|
mps_id = SUB_ID;
|
||||||
lpcm_id = LPCM_ID;
|
lpcm_id = LPCM_ID;
|
||||||
|
|
||||||
@ -388,6 +389,9 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
|||||||
s->audio_bound++;
|
s->audio_bound++;
|
||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
|
if (st->codec->codec_id == AV_CODEC_ID_H264)
|
||||||
|
stream->id = h264_id++;
|
||||||
|
else
|
||||||
stream->id = mpv_id++;
|
stream->id = mpv_id++;
|
||||||
if (st->codec->rc_buffer_size)
|
if (st->codec->rc_buffer_size)
|
||||||
stream->max_buffer_size = 6 * 1024 + st->codec->rc_buffer_size / 8;
|
stream->max_buffer_size = 6 * 1024 + st->codec->rc_buffer_size / 8;
|
||||||
@ -424,7 +428,8 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
|||||||
st = ctx->streams[i];
|
st = ctx->streams[i];
|
||||||
stream = (StreamInfo *)st->priv_data;
|
stream = (StreamInfo *)st->priv_data;
|
||||||
|
|
||||||
if (st->codec->rc_max_rate || stream->id == VIDEO_ID)
|
if (st->codec->rc_max_rate ||
|
||||||
|
st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||||
codec_rate = st->codec->rc_max_rate;
|
codec_rate = st->codec->rc_max_rate;
|
||||||
else
|
else
|
||||||
codec_rate = st->codec->bit_rate;
|
codec_rate = st->codec->bit_rate;
|
||||||
@ -436,7 +441,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx)
|
|||||||
|
|
||||||
if ((stream->id & 0xe0) == AUDIO_ID)
|
if ((stream->id & 0xe0) == AUDIO_ID)
|
||||||
audio_bitrate += codec_rate;
|
audio_bitrate += codec_rate;
|
||||||
else if (stream->id == VIDEO_ID)
|
else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
|
||||||
video_bitrate += codec_rate;
|
video_bitrate += codec_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user