mirror of https://git.ffmpeg.org/ffmpeg.git
lavf: factor codec id forcing out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
91141f2a13
commit
a7fbc7d7b7
|
@ -712,6 +712,21 @@ no_packet:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void force_codec_ids(AVFormatContext *s, AVStream *st)
|
||||||
|
{
|
||||||
|
switch(st->codec->codec_type){
|
||||||
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
|
if(s->video_codec_id) st->codec->codec_id= s->video_codec_id;
|
||||||
|
break;
|
||||||
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
|
if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id;
|
||||||
|
break;
|
||||||
|
case AVMEDIA_TYPE_SUBTITLE:
|
||||||
|
if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
@ -765,17 +780,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
|
|
||||||
st= s->streams[pkt->stream_index];
|
st= s->streams[pkt->stream_index];
|
||||||
|
|
||||||
switch(st->codec->codec_type){
|
force_codec_ids(s, st);
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
|
||||||
if(s->video_codec_id) st->codec->codec_id= s->video_codec_id;
|
|
||||||
break;
|
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
|
||||||
if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id;
|
|
||||||
break;
|
|
||||||
case AVMEDIA_TYPE_SUBTITLE:
|
|
||||||
if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* TODO: audio: time filter; video: frame reordering (pts != dts) */
|
/* TODO: audio: time filter; video: frame reordering (pts != dts) */
|
||||||
if (s->use_wallclock_as_timestamps)
|
if (s->use_wallclock_as_timestamps)
|
||||||
pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base);
|
pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base);
|
||||||
|
|
Loading…
Reference in New Issue