mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
lavf: probe PGS subtitles definition.
The resolution is in the packets, so decoding must happen. Since most other formats do not set the dimension, make it a special case for PGS. If other codecs were to have the same requirement, using a CODEC_CAP would be preferred.
This commit is contained in:
parent
2dedd8f496
commit
b1511e00f6
@ -2309,6 +2309,10 @@ static int has_codec_parameters(AVStream *st, const char **errmsg_ptr)
|
|||||||
if (st->info->found_decoder >= 0 && avctx->pix_fmt == PIX_FMT_NONE)
|
if (st->info->found_decoder >= 0 && avctx->pix_fmt == PIX_FMT_NONE)
|
||||||
FAIL("unspecified pixel format");
|
FAIL("unspecified pixel format");
|
||||||
break;
|
break;
|
||||||
|
case AVMEDIA_TYPE_SUBTITLE:
|
||||||
|
if (avctx->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE && !avctx->width)
|
||||||
|
FAIL("unspecified size");
|
||||||
|
break;
|
||||||
case AVMEDIA_TYPE_DATA:
|
case AVMEDIA_TYPE_DATA:
|
||||||
if(avctx->codec_id == AV_CODEC_ID_NONE) return 1;
|
if(avctx->codec_id == AV_CODEC_ID_NONE) return 1;
|
||||||
}
|
}
|
||||||
@ -2324,6 +2328,7 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
|
|||||||
AVCodec *codec;
|
AVCodec *codec;
|
||||||
int got_picture = 1, ret = 0;
|
int got_picture = 1, ret = 0;
|
||||||
AVFrame picture;
|
AVFrame picture;
|
||||||
|
AVSubtitle subtitle;
|
||||||
AVPacket pkt = *avpkt;
|
AVPacket pkt = *avpkt;
|
||||||
|
|
||||||
if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
|
if (!avcodec_is_open(st->codec) && !st->info->found_decoder) {
|
||||||
@ -2369,6 +2374,11 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
|
|||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
ret = avcodec_decode_audio4(st->codec, &picture, &got_picture, &pkt);
|
ret = avcodec_decode_audio4(st->codec, &picture, &got_picture, &pkt);
|
||||||
break;
|
break;
|
||||||
|
case AVMEDIA_TYPE_SUBTITLE:
|
||||||
|
ret = avcodec_decode_subtitle2(st->codec, &subtitle,
|
||||||
|
&got_picture, &pkt);
|
||||||
|
ret = pkt.size;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user