diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-12-29 22:09:59 +0100 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-12-30 22:19:04 +0100 |
commit | 36e61e24e7ac737b38c4382d439329352d9e0c29 (patch) | |
tree | a3a478a143dcbb3d4d386fabfa1513487543c438 /libavcodec/dvdsubenc.c | |
parent | e911f4ae720afe4a090ded2b165647734f0320ef (diff) | |
download | ffmpeg-36e61e24e7ac737b38c4382d439329352d9e0c29.tar.gz |
lavc: add ff_bprint_to_extradata() helper and use it.
This commit also makes sure the extradata and subtitle_header are NUL
terminated, without taking into account the trailing '\0' in account in
the size.
At the same time, it should fix 'warning: dereferencing type-punned
pointer will break strict-aliasing rules' warning for compilers who
don't consider uint8_t** and char** compatibles.
Diffstat (limited to 'libavcodec/dvdsubenc.c')
-rw-r--r-- | libavcodec/dvdsubenc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c index 2e0c37da4d..352272d311 100644 --- a/libavcodec/dvdsubenc.c +++ b/libavcodec/dvdsubenc.c @@ -20,6 +20,7 @@ */ #include "avcodec.h" #include "bytestream.h" +#include "internal.h" #include "libavutil/avassert.h" #include "libavutil/bprint.h" #include "libavutil/imgutils.h" @@ -408,9 +409,9 @@ static int dvdsub_init(AVCodecContext *avctx) av_bprintf(&extradata, " %06"PRIx32"%c", dvdc->global_palette[i] & 0xFFFFFF, i < 15 ? ',' : '\n'); - if ((ret = av_bprint_finalize(&extradata, (char **)&avctx->extradata)) < 0) + ret = ff_bprint_to_extradata(avctx, &extradata); + if (ret < 0) return ret; - avctx->extradata_size = extradata.len; return 0; } |