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 /libavformat/jacosubdec.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 'libavformat/jacosubdec.c')
-rw-r--r-- | libavformat/jacosubdec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 1c58e3bf25..153da4247a 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -28,6 +28,7 @@ #include "avformat.h" #include "internal.h" #include "subtitles.h" +#include "libavcodec/internal.h" #include "libavcodec/jacosub.h" #include "libavutil/avstring.h" #include "libavutil/bprint.h" @@ -159,7 +160,7 @@ static int jacosub_read_header(AVFormatContext *s) JACOsubContext *jacosub = s->priv_data; int shift_set = 0; // only the first shift matters int merge_line = 0; - int i; + int i, ret; AVStream *st = avformat_new_stream(s, NULL); if (!st) @@ -228,8 +229,9 @@ static int jacosub_read_header(AVFormatContext *s) } /* general/essential directives in the extradata */ - av_bprint_finalize(&header, (char **)&st->codec->extradata); - st->codec->extradata_size = header.len + 1; + ret = ff_bprint_to_extradata(st->codec, &header); + if (ret < 0) + return ret; /* SHIFT and TIMERES affect the whole script so packet timing can only be * done in a second pass */ |