aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-08-07 18:53:00 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-08-14 11:17:45 +0200
commitb1511e00f6fefde6cb31b2e17f7812cfac1c8bd6 (patch)
treee67ea0b4faf3848066b31bb62763e88d6bb959f1 /libavformat
parent2dedd8f49622303f96c6f575af7f7a9b338b88ba (diff)
downloadffmpeg-b1511e00f6fefde6cb31b2e17f7812cfac1c8bd6.tar.gz
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.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7b45944948..8c2849dc21 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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)
FAIL("unspecified pixel format");
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:
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;
int got_picture = 1, ret = 0;
AVFrame picture;
+ AVSubtitle subtitle;
AVPacket pkt = *avpkt;
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:
ret = avcodec_decode_audio4(st->codec, &picture, &got_picture, &pkt);
break;
+ case AVMEDIA_TYPE_SUBTITLE:
+ ret = avcodec_decode_subtitle2(st->codec, &subtitle,
+ &got_picture, &pkt);
+ ret = pkt.size;
+ break;
default:
break;
}