diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2011-04-05 09:04:48 +0200 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2011-04-11 23:27:50 +0200 |
commit | 3ee8ca9b0894df3aaf5086c643283cb58ef9763d (patch) | |
tree | 1c2d8e25bdd43f3c791199a74d0db297041147fb /libavcodec/utils.c | |
parent | c104a6e90226eaa253aeba471c8859e0da922da7 (diff) | |
download | ffmpeg-3ee8ca9b0894df3aaf5086c643283cb58ef9763d.tar.gz |
add avcodec_get_subtitle_defaults() to initialize AVSubtitle struct
Call this new function before decode() to replace the custom and
inconsistant initialization in various decoders.
This function is equivalent to avcodec_get_frame_defaults() for AVFrame.
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 3fa012dde4..bd5bdfd383 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -474,6 +474,12 @@ AVFrame *avcodec_alloc_frame(void){ return pic; } +static void avcodec_get_subtitle_defaults(AVSubtitle *sub) +{ + memset(sub, 0, sizeof(*sub)); + sub->pts = AV_NOPTS_VALUE; +} + int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) { int ret= -1; @@ -795,6 +801,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, avctx->pkt = avpkt; *got_sub_ptr = 0; + avcodec_get_subtitle_defaults(sub); ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt); if (*got_sub_ptr) avctx->frame_number++; |