mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Do not automatically map subtitles if the decoder and encoder properties are different.
Fixes ticket #3819.
This commit is contained in:
parent
0ab00a75e4
commit
7d585bc94c
19
ffmpeg_opt.c
19
ffmpeg_opt.c
@ -1870,10 +1870,29 @@ static int open_output_file(OptionsContext *o, const char *filename)
|
|||||||
if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
|
if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) {
|
||||||
for (i = 0; i < nb_input_streams; i++)
|
for (i = 0; i < nb_input_streams; i++)
|
||||||
if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
|
||||||
|
AVCodecDescriptor const *input_descriptor =
|
||||||
|
avcodec_descriptor_get(input_streams[i]->st->codec->codec_id);
|
||||||
|
AVCodecDescriptor const *output_descriptor = NULL;
|
||||||
|
AVCodec const *output_codec =
|
||||||
|
avcodec_find_encoder(oc->oformat->subtitle_codec);
|
||||||
|
int input_props = 0, output_props = 0;
|
||||||
|
if (output_codec)
|
||||||
|
output_descriptor = avcodec_descriptor_get(output_codec->id);
|
||||||
|
if (input_descriptor)
|
||||||
|
input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
|
||||||
|
if (output_descriptor)
|
||||||
|
output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
|
||||||
|
if (subtitle_codec_name ||
|
||||||
|
input_props & output_props ||
|
||||||
|
// Map dvb teletext which has neither property to any output subtitle encoder
|
||||||
|
input_descriptor && output_descriptor &&
|
||||||
|
(!input_descriptor->props ||
|
||||||
|
!output_descriptor->props)) {
|
||||||
new_subtitle_stream(o, oc, i);
|
new_subtitle_stream(o, oc, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* do something with data? */
|
/* do something with data? */
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < o->nb_stream_maps; i++) {
|
for (i = 0; i < o->nb_stream_maps; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user