[FFmpeg-devel] [PATCH] tests: add some ASS/SSA/MKS remux and transcode tests
--- http://b.pkh.me/1ededcbd7b.ass http://b.pkh.me/a9-misc.ssa 825502bec102d064edcb3a76301bc438 fate-samples/sub/1ededcbd7b.ass e39d15a63e914b5e683331e098dc fate-samples/sub/a9-misc.ssa --- tests/fate/subtitles.mak| 9 tests/ref/fate/binsub-mksenc| 1 + tests/ref/fate/sub-ass-to-ass-transcode | 62 tests/ref/fate/sub-ssa-to-ass-remux | 84 + 4 files changed, 156 insertions(+) create mode 100644 tests/ref/fate/binsub-mksenc create mode 100644 tests/ref/fate/sub-ass-to-ass-transcode create mode 100644 tests/ref/fate/sub-ssa-to-ass-remux diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak index 07d886a..746ffbe 100644 --- a/tests/fate/subtitles.mak +++ b/tests/fate/subtitles.mak @@ -1,6 +1,15 @@ FATE_SUBTITLES_ASS-$(call ALLYES, AQTITLE_DEMUXER TEXT_DECODER ICONV) += fate-sub-aqtitle fate-sub-aqtitle: CMD = fmtstdout ass -sub_charenc windows-1250 -i $(TARGET_SAMPLES)/sub/AQTitle_capability_tester.aqt +FATE_SUBTITLES_ASS-$(call DEMDEC, ASS, ASS) += fate-sub-ass-to-ass-transcode +fate-sub-ass-to-ass-transcode: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/1ededcbd7b.ass + +FATE_SUBTITLES_ASS-$(CONFIG_ASS_DEMUXER) += fate-sub-ssa-to-ass-remux +fate-sub-ssa-to-ass-remux: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/a9-misc.ssa -c copy + +FATE_SUBTITLES_ASS-$(call ALLYES, ASS_DEMUXER, MATROSKA_MUXER) += fate-binsub-mksenc +fate-binsub-mksenc: CMD = md5 -i $(TARGET_SAMPLES)/sub/1ededcbd7b.ass -c copy -f matroska -flags +bitexact + FATE_SUBTITLES_ASS-$(call DEMDEC, JACOSUB, JACOSUB) += fate-sub-jacosub fate-sub-jacosub: CMD = fmtstdout ass -i $(TARGET_SAMPLES)/sub/JACOsub_capability_tester.jss diff --git a/tests/ref/fate/binsub-mksenc b/tests/ref/fate/binsub-mksenc new file mode 100644 index 000..c473497 --- /dev/null +++ b/tests/ref/fate/binsub-mksenc @@ -0,0 +1 @@ +2dad5f63688ec613a04e94c8d4d167db diff --git a/tests/ref/fate/sub-ass-to-ass-transcode b/tests/ref/fate/sub-ass-to-ass-transcode new file mode 100644 index 000..bfc4e95 --- /dev/null +++ b/tests/ref/fate/sub-ass-to-ass-transcode @@ -0,0 +1,62 @@ +[Script Info] +; Script generated by Aegisub 3.2.2 +; http://www.aegisub.org/ +Title: Default Aegisub file +ScriptType: v4.00+ +WrapStyle: 0 +PlayResX: 1280 +PlayResY: 720 +ScaledBorderAndShadow: yes +Video Zoom: 4 +Video Colorspace: BT.601 +Video Aspect Ratio: c1.8 +YCbCr Matrix: TV.709 + +[Aegisub Project Garbage] +Automation Scripts: ~../../../../Aegisub autoload folder/New Folder/cmconv.lua +Last Style Storage: Default1 +Audio File: kamisama05-premux.mkv +Video File: kamisama05-premux.mkv +Keyframes File: ../Desktop/Keyframe Raws/kamisama05-wr.keyframes.txt +Video AR Mode: 4 +Video AR Value: 1.78 +Video Zoom Percent: 0.875000 +Video Position: 306 + +[V4+ Styles] +Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding +Style: Default,Luxi Sub Sans,48,&H00F9FDFB,&H3FFF,&H0A093346,&HDC0A0E10,-1,0,0,0,99,100,0,0,1,2.5,1,2,110,110,40,0 +Style: Default2,Luxi Sub Sans,48,&H00F9FDFB,&H3FFF,&H0A093346,&HDC0A0E10,-1,0,0,0,99,100,0,0,1,2.5,1,2,60,60,40,0 +Style: Default - Alt,Luxi Sub Sans,48,&H00F9FDFB,&H3FFF,&H0A673308,&HDC0A0E10,-1,0,0,0,99,100,0,0,1,2.5,1,8,110,110,40,0 +Style: OP2-Romaji-furigana,Chinacat,21,&H003B1A9A,&H00CBCB9F,&H00FF,&H,0,0,0,0,96,114,0,0,1,2.5,0,8,40,40,30,1 +Style: OP1-Eng-furigana,Chinacat,20,&H003B1A9A,&H19FF,&H00FF,&H007857D5,0,0,0,0,96,114,0.5,0,1,2.5,0.05,2,40,40,30,1 +Style: OP1-Romaji-furigana,Chinacat,21,&H003B1A9A,&H00CBCB9F,&H00FF,&H,0,0,0,0,96,114,0,0,1,2.5,0,8,40,40,30,1 +Style: OP1-Romaji,Chinacat,42,&H003B1A9A,&H00CBCB9F,&H00FF,&H,0,0,0,0,96,114,0,0,1,5,0,8,40,40,30,1 +Style: OP1-Eng,Chinacat,39,&H003B1A9A,&H19FF,&H00FF,&H007857D5,0,0,0,0,96,114,0.5,0,1,5,0.1,2,40,40,30,1 +Style: OP2-Romaji,Chinacat,42,&H003B1A9A,&H00CBCB9F,&H00FF,&H,0,0,0,0,96,114,0,0,1,5,0,8,40,40,30,1 +Style: ED1-Romaji,Agency FB,44,&H,&H00EBDCCD,&H00FF,&H,0,0,0,0,98,115,0,0,1,3,0,7,40,40,30,1 +Style: ED1-Eng,ClaudeSansPlain,40,&H,&H00EBDCCD,&H00FF,&H007857D5,0,0,0,0,90,115,0,0,1,4,0,3,40,40,30,1 +Style: ED1-Eng-furigana,ClaudeSansPlain,20,&H,&H00EBDCCD,&H00FF,&H007857D5,0,0,0,0,90,115,0,0,1,2,0,3,40,40,30,1 +Style: ED1-Romaji-furigana,Agency FB,22,&H,&H00EBDCCD,&H00FF,&H,0,0,0,0,98,115,0,0,1,1.5,0,7,40,40,30,1 +Style: Signs,Arial,46,&H00FF,&H00FF,&H,&H,0,0,0,0,100,100,0,0,1,0,0,5,10,10,10,1 + +[Events] +Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text +Dialogue: 3,0:00:12.74,0:00:13.49,OP1-Romaji,,0,0,0,fx,{\an5\pos(352,54)\move(352,-101,352,54,0,400)\bord3\blur2\2c&HD4
Re: [FFmpeg-devel] [PATCH] libshine: fix support for shine 3.0
On 24.05.2015 18:56, Michael Niedermayer wrote: > On Sun, May 24, 2015 at 03:52:21PM +0200, Andreas Cadhalpun wrote: >> shine_encode_buffer expects written to be an int pointer, while the >> previous shine_encode_frame expected it to be a long pointer. >> >> Thus encoding with libshine currently always fails with >> "internal buffer too small", because a negative return value of >> shine_encode_buffer is interpreted as a very large long value. >> >> Signed-off-by: Andreas Cadhalpun >> --- >> libavcodec/libshine.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > LGTM, assuming that the type matches all libshine versions our > code can be built with It does, because configure checks for shine_encode_buffer, which is only present since 3.0 and always expected it to be an int pointer. So pushed. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On 24.05.2015 19:23, Michael Niedermayer wrote: > On Sun, May 24, 2015 at 03:21:25PM +0200, Andreas Cadhalpun wrote: >> mov.c |5 + >> 1 file changed, 5 insertions(+) >> 199a14800f0d79aa85b8dc01c2c1dc2743c3fb0d >> 0001-mov-check-for-negative-stsc-count.patch >> From 1d66ce9f96ccd4e130837a5e38885109f26bb4f6 Mon Sep 17 00:00:00 2001 >> From: Andreas Cadhalpun >> Date: Sun, 24 May 2015 15:14:23 +0200 >> Subject: [PATCH] mov: check for negative stsc count >> >> A negative stsc count can cause the mov demuxer to return a large >> number of empty packets. > > ISO/IEC 14496-12:2012(E) says the field is unsigned so it cannot be > negative > > 8.7.4.2 Syntax > aligned(8) class SampleToChunkBox > extends FullBox("stsc", version = 0, 0) { > unsigned int(32) entry_count; > for (i=1; i <= entry_count; i++) { > unsigned int(32) first_chunk; > unsigned int(32) samples_per_chunk; > unsigned int(32) sample_description_index; > } > } OK, but then the types of the members of MOVStsc and likely also MOVStts are incorrectly int. The first attached patch changes that. The second patch is another attempt at fixing the original problem. Surely zero bytes_per_frame with non-zero samples_per_frame must be invalid, or is it also allowed by the spec? Best regards, Andreas >From 098f9f4a4f21e98236b2708810d2fa5d997301df Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 25 May 2015 16:26:33 +0200 Subject: [PATCH 1/2] isom: use uint32_t instead of int for members of MOVStts and MOVStsc This is specified in ISO/IEC 14496-12:2012(E) and they are used as unsigned already. Signed-off-by: Andreas Cadhalpun --- libavformat/isom.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 5d48989..7daba56 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -43,14 +43,14 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]); */ typedef struct MOVStts { -int count; -int duration; +uint32_t count; +uint32_t duration; } MOVStts; typedef struct MOVStsc { -int first; -int count; -int id; +uint32_t first; +uint32_t count; +uint32_t id; } MOVStsc; typedef struct MOVElst { -- 2.1.4 >From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 25 May 2015 17:17:39 +0200 Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero samples_per_frame In this case the mov demuxer can return a large number of empty packets. Signed-off-by: Andreas Cadhalpun --- libavformat/mov.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index e32f7f4..0d50353 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2587,6 +2587,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st) AVIndexEntry *e; unsigned size, samples; +if (sc->samples_per_frame > 1 && !sc->bytes_per_frame) { +av_log(mov->fc, AV_LOG_ERROR, + "samples per frame %d, but zero bytes per frame\n", + sc->samples_per_frame); +return; +} + if (sc->samples_per_frame >= 160) { // gsm samples = sc->samples_per_frame; size = sc->bytes_per_frame; -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Improve upon dynamic arrays- movtext subtitles
On Mon, 25 May 2015 00:37:03 +0530 Niklesh Lalwani wrote: > From: Niklesh > > Signed-off-by: Niklesh > --- > libavcodec/movtextdec.c | 32 > 1 file changed, 16 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c > index 04e1c8a..11934f9 100644 > --- a/libavcodec/movtextdec.c > +++ b/libavcodec/movtextdec.c > @@ -32,14 +32,13 @@ > #define STYLE_FLAG_UNDERLINE4 > > static int text_to_ass(AVBPrint *buf, const char *text, const char > *text_end, > -int **style_start, int **style_end, > -int **style_flags, int style_entries) > +char **style_start, char **style_end, > +uint8_t **style_flags, int style_entries) > { > int i = 0; > -int style_pos = 0; > while (text < text_end) { > for (i = 0; i < style_entries; i++) { > -if (*style_flags[i] && style_pos == *style_start[i]) { > +if (*style_flags[i] && text == style_start[i]) { > if (*style_flags[i] & STYLE_FLAG_BOLD) > av_bprintf(buf, "{\\b1}"); > if (*style_flags[i] & STYLE_FLAG_ITALIC) > @@ -61,7 +60,7 @@ static int text_to_ass(AVBPrint *buf, const char > *text, const char *text_end, } > > for (i = 0; i < style_entries; i++) { > -if (*style_flags[i] && style_pos == *style_end[i]) { > +if (*style_flags[i] && text == style_end[i]) { > if (*style_flags[i] & STYLE_FLAG_BOLD) > av_bprintf(buf, "{\\b0}"); > if (*style_flags[i] & STYLE_FLAG_ITALIC) > @@ -71,7 +70,6 @@ static int text_to_ass(AVBPrint *buf, const char > *text, const char *text_end, } > } > text++; > -style_pos++; > } > > return 0; > @@ -98,13 +96,13 @@ static int mov_text_decode_frame(AVCodecContext > *avctx, //char *ptr_temp; > int text_length, tsmb_type, style_entries; > uint64_t tsmb_size, tracksize; > -int **style_start = {0,}; > -int **style_end = {0,}; > -int **style_flags = {0,}; > +char **style_start = { 0, }; > +char **style_end = { 0, }; > +uint8_t **style_flags = { 0, }; > const uint8_t *tsmb; > int index, i, size_var; > -int *flag; > -int *style_pos; > +uint8_t *flag; > +char *style_pos; > > if (!ptr || avpkt->size < 2) > return AVERROR_INVALIDDATA; > @@ -172,19 +170,17 @@ static int mov_text_decode_frame(AVCodecContext > *avctx, break; > > for(i = 0; i < style_entries; i++) { > -style_pos = av_malloc(4); > -*style_pos = AV_RB16(tsmb); > +style_pos = ptr + AV_RB16(tsmb); > index = i; > av_dynarray_add(&style_start, &index, style_pos); > tsmb += 2; > -style_pos = av_malloc(4); > -*style_pos = AV_RB16(tsmb); > +style_pos = ptr + AV_RB16(tsmb); > index = i; > av_dynarray_add(&style_end, &index, style_pos); > tsmb += 2; > // fontID = AV_RB16(tsmb); > tsmb += 2; > -flag = av_malloc(4); > +flag = av_malloc(1); You need to check for malloc failure and return an error. > *flag = AV_RB8(tsmb); > index = i; > av_dynarray_add(&style_flags, &index, flag); > @@ -194,6 +190,10 @@ static int mov_text_decode_frame(AVCodecContext > *avctx, tsmb += 4; > } > text_to_ass(&buf, ptr, end, style_start, style_end, > style_flags, style_entries); + > +for(i = 0; i < style_entries; i++) { > +av_freep(&style_flags[i]); > +} > av_freep(&style_start); > av_freep(&style_end); > av_freep(&style_flags); --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] tests: add some ASS/SSA/MKS remux and transcode tests
On Mon, May 25, 2015 at 02:33:49PM +0200, Clément Bœsch wrote: > --- > > http://b.pkh.me/1ededcbd7b.ass > http://b.pkh.me/a9-misc.ssa samples uploaded patch should be ok in 24h [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Improve upon dynamic arrays- movtext subtitles
Updated Patch. Thanks, Niklesh On Mon, May 25, 2015 at 9:10 PM, Philip Langdale wrote: > On Mon, 25 May 2015 00:37:03 +0530 > Niklesh Lalwani wrote: > > > From: Niklesh > > > > Signed-off-by: Niklesh > > --- > > libavcodec/movtextdec.c | 32 > > 1 file changed, 16 insertions(+), 16 deletions(-) > > > > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c > > index 04e1c8a..11934f9 100644 > > --- a/libavcodec/movtextdec.c > > +++ b/libavcodec/movtextdec.c > > @@ -32,14 +32,13 @@ > > #define STYLE_FLAG_UNDERLINE4 > > > > static int text_to_ass(AVBPrint *buf, const char *text, const char > > *text_end, > > -int **style_start, int **style_end, > > -int **style_flags, int style_entries) > > +char **style_start, char **style_end, > > +uint8_t **style_flags, int style_entries) > > { > > int i = 0; > > -int style_pos = 0; > > while (text < text_end) { > > for (i = 0; i < style_entries; i++) { > > -if (*style_flags[i] && style_pos == *style_start[i]) { > > +if (*style_flags[i] && text == style_start[i]) { > > if (*style_flags[i] & STYLE_FLAG_BOLD) > > av_bprintf(buf, "{\\b1}"); > > if (*style_flags[i] & STYLE_FLAG_ITALIC) > > @@ -61,7 +60,7 @@ static int text_to_ass(AVBPrint *buf, const char > > *text, const char *text_end, } > > > > for (i = 0; i < style_entries; i++) { > > -if (*style_flags[i] && style_pos == *style_end[i]) { > > +if (*style_flags[i] && text == style_end[i]) { > > if (*style_flags[i] & STYLE_FLAG_BOLD) > > av_bprintf(buf, "{\\b0}"); > > if (*style_flags[i] & STYLE_FLAG_ITALIC) > > @@ -71,7 +70,6 @@ static int text_to_ass(AVBPrint *buf, const char > > *text, const char *text_end, } > > } > > text++; > > -style_pos++; > > } > > > > return 0; > > @@ -98,13 +96,13 @@ static int mov_text_decode_frame(AVCodecContext > > *avctx, //char *ptr_temp; > > int text_length, tsmb_type, style_entries; > > uint64_t tsmb_size, tracksize; > > -int **style_start = {0,}; > > -int **style_end = {0,}; > > -int **style_flags = {0,}; > > +char **style_start = { 0, }; > > +char **style_end = { 0, }; > > +uint8_t **style_flags = { 0, }; > > const uint8_t *tsmb; > > int index, i, size_var; > > -int *flag; > > -int *style_pos; > > +uint8_t *flag; > > +char *style_pos; > > > > if (!ptr || avpkt->size < 2) > > return AVERROR_INVALIDDATA; > > @@ -172,19 +170,17 @@ static int mov_text_decode_frame(AVCodecContext > > *avctx, break; > > > > for(i = 0; i < style_entries; i++) { > > -style_pos = av_malloc(4); > > -*style_pos = AV_RB16(tsmb); > > +style_pos = ptr + AV_RB16(tsmb); > > index = i; > > av_dynarray_add(&style_start, &index, style_pos); > > tsmb += 2; > > -style_pos = av_malloc(4); > > -*style_pos = AV_RB16(tsmb); > > +style_pos = ptr + AV_RB16(tsmb); > > index = i; > > av_dynarray_add(&style_end, &index, style_pos); > > tsmb += 2; > > // fontID = AV_RB16(tsmb); > > tsmb += 2; > > -flag = av_malloc(4); > > +flag = av_malloc(1); > > You need to check for malloc failure and return an error. > > > *flag = AV_RB8(tsmb); > > index = i; > > av_dynarray_add(&style_flags, &index, flag); > > @@ -194,6 +190,10 @@ static int mov_text_decode_frame(AVCodecContext > > *avctx, tsmb += 4; > > } > > text_to_ass(&buf, ptr, end, style_start, style_end, > > style_flags, style_entries); + > > +for(i = 0; i < style_entries; i++) { > > +av_freep(&style_flags[i]); > > +} > > av_freep(&style_start); > > av_freep(&style_end); > > av_freep(&style_flags); > > > > > --phil > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > From e0f0972d48f25f09fb850b229a0a23ab688809b5 Mon Sep 17 00:00:00 2001 From: Niklesh Date: Mon, 25 May 2015 21:43:34 +0530 Subject: [PATCH] Improve upon dynamic arrays- movtext subtitles Signed-off-by: Niklesh --- libavcodec/movtextdec.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index 04e1c8a..2ecbc6f 100644 --- a/libavcodec/movtextde
Re: [FFmpeg-devel] [PATCH] Improve upon dynamic arrays- movtext subtitles
On Mon, 25 May 2015 21:51:36 +0530 Niklesh Lalwani wrote: > Updated Patch. > > Thanks, > > Niklesh use "return AVERROR(ENOMEM);" > On Mon, May 25, 2015 at 9:10 PM, Philip Langdale > wrote: > > > On Mon, 25 May 2015 00:37:03 +0530 > > Niklesh Lalwani wrote: > > > > > From: Niklesh > > > > > > Signed-off-by: Niklesh > > > --- > > > libavcodec/movtextdec.c | 32 > > > 1 file changed, 16 insertions(+), 16 deletions(-) > > > > > > diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c > > > index 04e1c8a..11934f9 100644 > > > --- a/libavcodec/movtextdec.c > > > +++ b/libavcodec/movtextdec.c > > > @@ -32,14 +32,13 @@ > > > #define STYLE_FLAG_UNDERLINE4 > > > > > > static int text_to_ass(AVBPrint *buf, const char *text, const > > > char *text_end, > > > -int **style_start, int **style_end, > > > -int **style_flags, int style_entries) > > > +char **style_start, char **style_end, > > > +uint8_t **style_flags, int style_entries) > > > { > > > int i = 0; > > > -int style_pos = 0; > > > while (text < text_end) { > > > for (i = 0; i < style_entries; i++) { > > > -if (*style_flags[i] && style_pos == *style_start[i]) > > > { > > > +if (*style_flags[i] && text == style_start[i]) { > > > if (*style_flags[i] & STYLE_FLAG_BOLD) > > > av_bprintf(buf, "{\\b1}"); > > > if (*style_flags[i] & STYLE_FLAG_ITALIC) > > > @@ -61,7 +60,7 @@ static int text_to_ass(AVBPrint *buf, const char > > > *text, const char *text_end, } > > > > > > for (i = 0; i < style_entries; i++) { > > > -if (*style_flags[i] && style_pos == *style_end[i]) { > > > +if (*style_flags[i] && text == style_end[i]) { > > > if (*style_flags[i] & STYLE_FLAG_BOLD) > > > av_bprintf(buf, "{\\b0}"); > > > if (*style_flags[i] & STYLE_FLAG_ITALIC) > > > @@ -71,7 +70,6 @@ static int text_to_ass(AVBPrint *buf, const char > > > *text, const char *text_end, } > > > } > > > text++; > > > -style_pos++; > > > } > > > > > > return 0; > > > @@ -98,13 +96,13 @@ static int > > > mov_text_decode_frame(AVCodecContext *avctx, //char *ptr_temp; > > > int text_length, tsmb_type, style_entries; > > > uint64_t tsmb_size, tracksize; > > > -int **style_start = {0,}; > > > -int **style_end = {0,}; > > > -int **style_flags = {0,}; > > > +char **style_start = { 0, }; > > > +char **style_end = { 0, }; > > > +uint8_t **style_flags = { 0, }; > > > const uint8_t *tsmb; > > > int index, i, size_var; > > > -int *flag; > > > -int *style_pos; > > > +uint8_t *flag; > > > +char *style_pos; > > > > > > if (!ptr || avpkt->size < 2) > > > return AVERROR_INVALIDDATA; > > > @@ -172,19 +170,17 @@ static int > > > mov_text_decode_frame(AVCodecContext *avctx, break; > > > > > > for(i = 0; i < style_entries; i++) { > > > -style_pos = av_malloc(4); > > > -*style_pos = AV_RB16(tsmb); > > > +style_pos = ptr + AV_RB16(tsmb); > > > index = i; > > > av_dynarray_add(&style_start, &index, > > > style_pos); tsmb += 2; > > > -style_pos = av_malloc(4); > > > -*style_pos = AV_RB16(tsmb); > > > +style_pos = ptr + AV_RB16(tsmb); > > > index = i; > > > av_dynarray_add(&style_end, &index, > > > style_pos); tsmb += 2; > > > // fontID = AV_RB16(tsmb); > > > tsmb += 2; > > > -flag = av_malloc(4); > > > +flag = av_malloc(1); > > > > You need to check for malloc failure and return an error. > > > > > *flag = AV_RB8(tsmb); > > > index = i; > > > av_dynarray_add(&style_flags, &index, flag); > > > @@ -194,6 +190,10 @@ static int > > > mov_text_decode_frame(AVCodecContext *avctx, tsmb += 4; > > > } > > > text_to_ass(&buf, ptr, end, style_start, > > > style_end, style_flags, style_entries); + > > > +for(i = 0; i < style_entries; i++) { > > > +av_freep(&style_flags[i]); > > > +} > > > av_freep(&style_start); > > > av_freep(&style_end); > > > av_freep(&style_flags); > > > > > > > > > > --phil > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-dev
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: > On 24.05.2015 19:23, Michael Niedermayer wrote: > > On Sun, May 24, 2015 at 03:21:25PM +0200, Andreas Cadhalpun wrote: > >> mov.c |5 + > >> 1 file changed, 5 insertions(+) > >> 199a14800f0d79aa85b8dc01c2c1dc2743c3fb0d > >> 0001-mov-check-for-negative-stsc-count.patch > >> From 1d66ce9f96ccd4e130837a5e38885109f26bb4f6 Mon Sep 17 00:00:00 2001 > >> From: Andreas Cadhalpun > >> Date: Sun, 24 May 2015 15:14:23 +0200 > >> Subject: [PATCH] mov: check for negative stsc count > >> > >> A negative stsc count can cause the mov demuxer to return a large > >> number of empty packets. > > > > ISO/IEC 14496-12:2012(E) says the field is unsigned so it cannot be > > negative > > > > 8.7.4.2 Syntax > > aligned(8) class SampleToChunkBox > > extends FullBox("stsc", version = 0, 0) { > > unsigned int(32) entry_count; > > for (i=1; i <= entry_count; i++) { > > unsigned int(32) first_chunk; > > unsigned int(32) samples_per_chunk; > > unsigned int(32) sample_description_index; > > } > > } > > OK, but then the types of the members of MOVStsc and likely also MOVStts > are incorrectly int. The first attached patch changes that. MOVStts needs to stay signed, its used for ctts and that is signed per spec aligned(8) class CompositionOffsetBox extends FullBox("ctts", version = 0, 0) { unsigned int(32) entry_count; int i; if (version==0) { for (i=0; i < entry_count; i++) { unsigned int(32) sample_count; unsigned int(32) sample_offset; } } else if (version == 1) { for (i=0; i < entry_count; i++) { unsigned int(32) sample_count; signed int(32) sample_offset; } } } also above is just the ISO side, theres also a quicktime spec that is seperate and while similar enough so our demuxer supports both they are seperate file formats https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/qtff.pdf [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/vdpau: Don't leak h264.h into all VDPAU codecs
h264.h and hevc.h are mutually exclusive due to defining some of the same names. As such, we need to avoid forcing h264.h to be included if we want hevc decode acceleration to be possible. Signed-off-by: Philip Langdale --- libavcodec/vc1dec.c | 1 + libavcodec/vdpau_internal.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index d39f344..d6cef3f 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "blockdsp.h" #include "get_bits.h" +#include "h264.h" #include "internal.h" #include "mpeg_er.h" #include "mpegvideo.h" diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index cc49db8..fd94b52 100644 --- a/libavcodec/vdpau_internal.h +++ b/libavcodec/vdpau_internal.h @@ -29,13 +29,14 @@ #if CONFIG_VDPAU #include #endif -#include "h264.h" #include "libavutil/frame.h" #include "avcodec.h" #include "mpeg4video.h" +typedef struct H264Context H264Context; + /** Extract VdpVideoSurface from an AVFrame */ static inline uintptr_t ff_vdpau_get_surface_id(AVFrame *pic) { -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] fft: x86: Clear __SECT__ before declaring a structure
This commit reverts 599888a48. This silences the following warning: libavcodec/x86/fft.asm:54: warning: section flags ignored on section redeclaration The cause of this warning is that because `struc` and `endstruc` attempts to revert to the previous section state [1]. The section state is stored in the macro __SECT__ [2], which after 599888a48 is `.rodata`. `.rodata` is therefore declared twice: once in `SECTION_RODATA`, once during `endstruc`, causing the warning. This commit redefines `__SECT__` as empty, working around this problem while reducing differences to Libav. [1]: http://www.nasm.us/doc/nasmdoc6.html#section-6.4 [2]: http://www.nasm.us/doc/nasmdoc6.html#section-6.3 --- libavcodec/x86/fft.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/x86/fft.asm b/libavcodec/x86/fft.asm index 877997e..2771439 100644 --- a/libavcodec/x86/fft.asm +++ b/libavcodec/x86/fft.asm @@ -36,7 +36,7 @@ %define pointer resd %endif -SECTION_RODATA 32 +%define __SECT__ struc FFTContext .nbits:resd 1 @@ -53,6 +53,8 @@ struc FFTContext .imdcthalf:pointer 1 endstruc +SECTION_RODATA 32 + %define M_SQRT1_2 0.70710678118654752440 %define M_COS_PI_1_8 0.923879532511287 %define M_COS_PI_3_8 0.38268343236509 -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] resample: x86: Clear __SECT__ before declaring a structure
Silences a warning: libswresample/x86/resample.asm:48: warning: section flags ignored on section redeclaration --- libswresample/x86/resample.asm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libswresample/x86/resample.asm b/libswresample/x86/resample.asm index a57ff37..10f29b0 100644 --- a/libswresample/x86/resample.asm +++ b/libswresample/x86/resample.asm @@ -28,6 +28,8 @@ %define pointer resd %endif +%define __SECT__ + struc ResampleContext .av_class: pointer 1 .filter_bank: pointer 1 -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Improve upon dynamic arrays- movtext subtitles
Updated. Thanks, Niklesh From 00647a47883b0b547da77d3101f3f890634a85b4 Mon Sep 17 00:00:00 2001 From: Niklesh Date: Mon, 25 May 2015 22:46:04 +0530 Subject: [PATCH] Improve upon dynamic arrays- movtext subtitles Signed-off-by: Niklesh --- libavcodec/movtextdec.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c index 04e1c8a..8dda5ce 100644 --- a/libavcodec/movtextdec.c +++ b/libavcodec/movtextdec.c @@ -32,14 +32,13 @@ #define STYLE_FLAG_UNDERLINE4 static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, -int **style_start, int **style_end, -int **style_flags, int style_entries) +char **style_start, char **style_end, +uint8_t **style_flags, int style_entries) { int i = 0; -int style_pos = 0; while (text < text_end) { for (i = 0; i < style_entries; i++) { -if (*style_flags[i] && style_pos == *style_start[i]) { +if (*style_flags[i] && text == style_start[i]) { if (*style_flags[i] & STYLE_FLAG_BOLD) av_bprintf(buf, "{\\b1}"); if (*style_flags[i] & STYLE_FLAG_ITALIC) @@ -61,7 +60,7 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, } for (i = 0; i < style_entries; i++) { -if (*style_flags[i] && style_pos == *style_end[i]) { +if (*style_flags[i] && text == style_end[i]) { if (*style_flags[i] & STYLE_FLAG_BOLD) av_bprintf(buf, "{\\b0}"); if (*style_flags[i] & STYLE_FLAG_ITALIC) @@ -71,7 +70,6 @@ static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end, } } text++; -style_pos++; } return 0; @@ -98,13 +96,13 @@ static int mov_text_decode_frame(AVCodecContext *avctx, //char *ptr_temp; int text_length, tsmb_type, style_entries; uint64_t tsmb_size, tracksize; -int **style_start = {0,}; -int **style_end = {0,}; -int **style_flags = {0,}; +char **style_start = { 0, }; +char **style_end = { 0, }; +uint8_t **style_flags = { 0, }; const uint8_t *tsmb; int index, i, size_var; -int *flag; -int *style_pos; +uint8_t *flag; +char *style_pos; if (!ptr || avpkt->size < 2) return AVERROR_INVALIDDATA; @@ -172,19 +170,19 @@ static int mov_text_decode_frame(AVCodecContext *avctx, break; for(i = 0; i < style_entries; i++) { -style_pos = av_malloc(4); -*style_pos = AV_RB16(tsmb); +style_pos = ptr + AV_RB16(tsmb); index = i; av_dynarray_add(&style_start, &index, style_pos); tsmb += 2; -style_pos = av_malloc(4); -*style_pos = AV_RB16(tsmb); +style_pos = ptr + AV_RB16(tsmb); index = i; av_dynarray_add(&style_end, &index, style_pos); tsmb += 2; // fontID = AV_RB16(tsmb); tsmb += 2; -flag = av_malloc(4); +flag = av_malloc(1); +if (!flag) +return AVERROR(ENOMEM); *flag = AV_RB8(tsmb); index = i; av_dynarray_add(&style_flags, &index, flag); @@ -194,6 +192,10 @@ static int mov_text_decode_frame(AVCodecContext *avctx, tsmb += 4; } text_to_ass(&buf, ptr, end, style_start, style_end, style_flags, style_entries); + +for(i = 0; i < style_entries; i++) { +av_freep(&style_flags[i]); +} av_freep(&style_start); av_freep(&style_end); av_freep(&style_flags); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On 25.05.2015 18:31, Michael Niedermayer wrote: > On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: >> On 24.05.2015 19:23, Michael Niedermayer wrote: >>> ISO/IEC 14496-12:2012(E) says the field is unsigned so it cannot be >>> negative >>> >>> 8.7.4.2 Syntax >>> aligned(8) class SampleToChunkBox >>> extends FullBox("stsc", version = 0, 0) { >>> unsigned int(32) entry_count; >>> for (i=1; i <= entry_count; i++) { >>> unsigned int(32) first_chunk; >>> unsigned int(32) samples_per_chunk; >>> unsigned int(32) sample_description_index; >>> } >>> } >> >> OK, but then the types of the members of MOVStsc and likely also MOVStts >> are incorrectly int. The first attached patch changes that. > > MOVStts needs to stay signed, its used for ctts and that is signed > per spec > aligned(8) class CompositionOffsetBox >extends FullBox("ctts", version = 0, 0) { >unsigned int(32) entry_count; > int i; >if (version==0) { > for (i=0; i < entry_count; i++) { > unsigned int(32) sample_count; > unsigned int(32) sample_offset; > } >} >else if (version == 1) { > for (i=0; i < entry_count; i++) { > unsigned int(32) sample_count; > signed int(32) sample_offset; > } >} > } > > also above is just the ISO side, theres also a quicktime spec > that is seperate and while similar enough so our demuxer supports both > they are seperate file formats > https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/qtff.pdf That one says about ctts/stts: ctts: * sampleCount A 32-bit unsigned integer that provides the number of consecutive samples with the calculated composition offset in the field. * compositionOffset A 32-bit signed integer indicating the value of the calculated compositionOffset. stts: * Sample count A 32-bit integer that specifies the number of consecutive samples that have the same duration. * Sample duration A 32-bit integer that specifies the duration of each sample. So it can be signed or unsigned. For stsc it doesn't even mention the sign: * First chunk The first chunk number using this table entry. * Samples per chunk The number of samples in each chunk. * Sample description ID The identification number associated with the sample description for the sample. For details on sample description atoms, see Sample Description Atoms (page 99). So if you don't like the first patch changing the types, consider it dropped. It shouldn't change the behavior anyway. I'm more interested in the second patch validating the bytes_per_frame/samples_per_frame combination. The quicktime spec says about these: * Samples per packet (sc->samples_per_frame) The number of uncompressed frames generated by a compressed frame (an uncompressed frame is one sample from each channel). This is also the frame duration, expressed in the media's timescale, where the timescale is equal to the sample rate. For uncompressed formats, this field is always 1. * Bytes per packet (ignored) For uncompressed audio, the number of bytes in a sample for a single channel. This replaces the older sampleSize field, which is set to 16. This value is calculated by dividing the frame size by the number of channels. The same calculation is performed to calculate the value of this field for compressed audio, but the result of the calculation is not generally meaningful for compressed audio. * Bytes per frame (sc->bytes_per_frame) The number of bytes in a frame: for uncompressed audio, an uncompressed frame; for compressed audio, a compressed frame. This can be calculated by multiplying the bytes per packet field by the number of channels. * Bytes per sample (ignored) The size of an uncompressed sample in bytes. This is set to 1 for 8-bit audio, 2 for all other cases, even if the sample size is greater than 2 bytes. [...] If these fields are not used, they are set to 0. File readers only need to check to see if samplesPerPacket is 0. This suggests that if the field is 0, it should not be used. That's the check my last patch implemented, so I think it should be fine. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/vdpau: Don't leak h264.h into all VDPAU codecs
On Mon, May 25, 2015 at 09:46:14AM -0700, Philip Langdale wrote: > h264.h and hevc.h are mutually exclusive due to defining some of the same > names. As such, we need to avoid forcing h264.h to be included if we want > hevc decode acceleration to be possible. > > Signed-off-by: Philip Langdale > --- > libavcodec/vc1dec.c | 1 + > libavcodec/vdpau_internal.h | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) this breaks build (with clang at least) CC libavcodec/h264.o In file included from ffmpeg/libavcodec/h264.c:1: In file included from ffmpeg/libavcodec/h264.c:52: ffmpeg/libavcodec/vdpau_internal.h:38:28: error: redefinition of typedef 'H264Context' is invalid in C [-Wtypedef-redefinition] typedef struct H264Context H264Context; ^ ffmpeg/libavcodec/h264.h:799:3: note: previous definition is here } H264Context; ^ 1 error generated. make: *** [libavcodec/h264.o] Error 1 -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: [...] > mov.c |7 +++ > 1 file changed, 7 insertions(+) > 7ff306f094f2ecd47b720deb20ea318c24efaf4d > 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch > From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 > From: Andreas Cadhalpun > Date: Mon, 25 May 2015 17:17:39 +0200 > Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero > samples_per_frame > > In this case the mov demuxer can return a large number of empty packets. patch should be ok, maybe add avpriv_request_sample() thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/vdpau: Don't leak h264.h into all VDPAU codecs
On Mon, 25 May 2015 20:34:34 +0200 Michael Niedermayer wrote: > On Mon, May 25, 2015 at 09:46:14AM -0700, Philip Langdale wrote: > > h264.h and hevc.h are mutually exclusive due to defining some of > > the same names. As such, we need to avoid forcing h264.h to be > > included if we want hevc decode acceleration to be possible. > > > > Signed-off-by: Philip Langdale > > --- > > libavcodec/vc1dec.c | 1 + > > libavcodec/vdpau_internal.h | 3 ++- > > 2 files changed, 3 insertions(+), 1 deletion(-) > > this breaks build (with clang at least) > > CC libavcodec/h264.o > In file included from ffmpeg/libavcodec/h264.c:1: > In file included from ffmpeg/libavcodec/h264.c:52: > ffmpeg/libavcodec/vdpau_internal.h:38:28: error: redefinition of > typedef 'H264Context' is invalid in C [-Wtypedef-redefinition] > typedef struct H264Context H264Context; ^ > ffmpeg/libavcodec/h264.h:799:3: note: previous definition is here > } H264Context; > ^ > 1 error generated. > make: *** [libavcodec/h264.o] Error 1 > Huh. No warnings with gcc 4.9 here. I should be able to tweak it to work. --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On 25.05.2015 21:38, Michael Niedermayer wrote: > On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: > [...] > >> mov.c |7 +++ >> 1 file changed, 7 insertions(+) >> 7ff306f094f2ecd47b720deb20ea318c24efaf4d >> 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch >> From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 >> From: Andreas Cadhalpun >> Date: Mon, 25 May 2015 17:17:39 +0200 >> Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero >> samples_per_frame >> >> In this case the mov demuxer can return a large number of empty packets. > > patch should be ok, maybe add avpriv_request_sample() OK, attached is variant with av_log replaced with avpriv_request_sample. Best regards, Andreas >From 9897fdaf2a714656dbadba6c9f7a813c39aa568e Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 25 May 2015 17:17:39 +0200 Subject: [PATCH] mov: reject zero bytes_per_frame with non-zero samples_per_frame In this case the mov demuxer can return a large number of empty packets. Signed-off-by: Andreas Cadhalpun --- libavformat/mov.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index e32f7f4..51cdd21 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2587,6 +2587,13 @@ static void mov_build_index(MOVContext *mov, AVStream *st) AVIndexEntry *e; unsigned size, samples; +if (sc->samples_per_frame > 1 && !sc->bytes_per_frame) { +avpriv_request_sample(mov->fc, + "Zero bytes per frame, but %d samples per frame", + sc->samples_per_frame); +return; +} + if (sc->samples_per_frame >= 160) { // gsm samples = sc->samples_per_frame; size = sc->bytes_per_frame; -- 2.1.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On Mon, May 25, 2015 at 11:22:32PM +0200, Andreas Cadhalpun wrote: > On 25.05.2015 21:38, Michael Niedermayer wrote: > > On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: > > [...] > > > >> mov.c |7 +++ > >> 1 file changed, 7 insertions(+) > >> 7ff306f094f2ecd47b720deb20ea318c24efaf4d > >> 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch > >> From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 > >> From: Andreas Cadhalpun > >> Date: Mon, 25 May 2015 17:17:39 +0200 > >> Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero > >> samples_per_frame > >> > >> In this case the mov demuxer can return a large number of empty packets. > > > > patch should be ok, maybe add avpriv_request_sample() > > OK, attached is variant with av_log replaced with avpriv_request_sample. > > Best regards, > Andreas > > mov.c |7 +++ > 1 file changed, 7 insertions(+) > c185b2df006a58a43895518f090520799aaa6965 > 0001-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch > From 9897fdaf2a714656dbadba6c9f7a813c39aa568e Mon Sep 17 00:00:00 2001 > From: Andreas Cadhalpun > Date: Mon, 25 May 2015 17:17:39 +0200 > Subject: [PATCH] mov: reject zero bytes_per_frame with non-zero > samples_per_frame > > In this case the mov demuxer can return a large number of empty packets. LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] configure: Check if ID3D11VideoDecoder exists, not just the header to enable d3d11va
Fixes build with "mingw-w64-x86-64-dev 3.2.0-2" Signed-off-by: Michael Niedermayer --- configure |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 52448af..c21d475 100755 --- a/configure +++ b/configure @@ -1815,6 +1815,7 @@ TOOLCHAIN_FEATURES=" TYPES_LIST=" CONDITION_VARIABLE_Ptr DXVA_PicParams_HEVC +ID3D11VideoDecoder socklen_t struct_addrinfo struct_group_source_req @@ -2319,7 +2320,7 @@ zmbv_encoder_select="zlib" # hardware accelerators crystalhd_deps="libcrystalhd_libcrystalhd_if_h" -d3d11va_deps="d3d11_h dxva_h" +d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder" dxva2_deps="dxva2api_h" vaapi_deps="va_va_h" vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" @@ -4992,6 +4993,7 @@ check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" +check_type "windows.h d3d11.h" "ID3D11VideoDecoder" if ! disabled w32threads && ! enabled pthreads; then check_func_headers "windows.h process.h" _beginthreadex && -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [libav-devel] [PATCH 2/4] mov: check for positive sample->size
On 25.05.2015 23:41, Luca Barbato wrote: > On 25/05/15 23:22, Andreas Cadhalpun wrote: >> On 25.05.2015 21:38, Michael Niedermayer wrote: >>> On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: >>> [...] >>> mov.c |7 +++ 1 file changed, 7 insertions(+) 7ff306f094f2ecd47b720deb20ea318c24efaf4d 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 25 May 2015 17:17:39 +0200 Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero samples_per_frame In this case the mov demuxer can return a large number of empty packets. >>> >>> patch should be ok, maybe add avpriv_request_sample() > > The patch seems to silently stop indexing at the first packet not matching > some sanity check. > > That whole function is kind of bad to begin with since it silently stops > even if it does because it is out of memory... > > I do iterate my request to just mark the packets as corrupted and return > them and/or provide an explode option to just stop there assuming the user > is this concerned since this patch doesn't look exactly great to me. This check happens beneath mov_read_header, not mov_read_packet. If the condition is true, the index created by mov_build_index consists only of entries with size zero, which seems rather useless, because it causes mov_read_packet to always return empty packets. Thus I don't understand what you don't like about discarding such an index. > I'm not sure if I have time to write to write one myself soon, but I would > appreciate if you get me a sample if you are happy with what you have here > already. Unfortunately I can't, because all the samples I have take a different branch in Libav, because commit 1892052f8 is not present. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/4] mov: check for positive sample->size
On 25.05.2015 23:44, Michael Niedermayer wrote: > On Mon, May 25, 2015 at 11:22:32PM +0200, Andreas Cadhalpun wrote: >> On 25.05.2015 21:38, Michael Niedermayer wrote: >>> On Mon, May 25, 2015 at 05:25:18PM +0200, Andreas Cadhalpun wrote: >>> [...] >>> mov.c |7 +++ 1 file changed, 7 insertions(+) 7ff306f094f2ecd47b720deb20ea318c24efaf4d 0002-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch From 42c8b0c216b39fd2cb8b329669737ce771ecdd20 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Mon, 25 May 2015 17:17:39 +0200 Subject: [PATCH 2/2] mov: reject zero bytes_per_frame with non-zero samples_per_frame In this case the mov demuxer can return a large number of empty packets. >>> >>> patch should be ok, maybe add avpriv_request_sample() >> >> OK, attached is variant with av_log replaced with avpriv_request_sample. >> >> Best regards, >> Andreas >> > >> mov.c |7 +++ >> 1 file changed, 7 insertions(+) >> c185b2df006a58a43895518f090520799aaa6965 >> 0001-mov-reject-zero-bytes_per_frame-with-non-zero-sample.patch >> From 9897fdaf2a714656dbadba6c9f7a813c39aa568e Mon Sep 17 00:00:00 2001 >> From: Andreas Cadhalpun >> Date: Mon, 25 May 2015 17:17:39 +0200 >> Subject: [PATCH] mov: reject zero bytes_per_frame with non-zero >> samples_per_frame >> >> In this case the mov demuxer can return a large number of empty packets. > > LGTM Pushed. Best regards, Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] Revert "Move struc FFTContext below SECTION_RODATA"
This reverts commit 599888a48040f4086c9086aae958b7231b37afcc. The commit does not silence the warning on ELF-based systems, and will be fixed in the subsequent commit. Conflicts: libavcodec/x86/fft_mmx.asm --- libavcodec/x86/fft.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/x86/fft.asm b/libavcodec/x86/fft.asm index 877997e..f233774 100644 --- a/libavcodec/x86/fft.asm +++ b/libavcodec/x86/fft.asm @@ -36,8 +36,6 @@ %define pointer resd %endif -SECTION_RODATA 32 - struc FFTContext .nbits:resd 1 .reverse: resd 1 @@ -53,6 +51,8 @@ struc FFTContext .imdcthalf:pointer 1 endstruc +SECTION_RODATA 32 + %define M_SQRT1_2 0.70710678118654752440 %define M_COS_PI_1_8 0.923879532511287 %define M_COS_PI_3_8 0.38268343236509 -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] x86inc: Clear __SECT__
This commit silences warning(s) like: libavcodec/x86/fft.asm:93: warning: section flags ignored on section redeclaration The cause of this warning is that because `struc` and `endstruc` attempts to revert to the previous section state [1]. The section state is stored in the macro __SECT__, defined by x86inc.asm to be `.note.GNU-stack ...`, through the `SECTION` directive [2]. Thus, the `.note.GNU-stack` section is defined twice (once in x86inc.asm, once during `endstruc`), causing the warning. That is the first part of the commit: using the primitive `[section]` format for .note.GNU-stack etc., which does not update `__SECT__` [2]. That fixes only half of the problem. Even without any `SECTION` directives, `__SECT__` is predefined as `.text`, which conflicting with the later `SECTION_TEXT` (which expands to `.text align=16`). [1]: http://www.nasm.us/doc/nasmdoc6.html#section-6.4 [2]: http://www.nasm.us/doc/nasmdoc6.html#section-6.3 --- Better patch as suggested by Ronald. --- libavutil/x86/x86inc.asm | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm index f1b4b85..12779f5 100644 --- a/libavutil/x86/x86inc.asm +++ b/libavutil/x86/x86inc.asm @@ -722,9 +722,13 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae, ; This is needed for ELF, otherwise the GNU linker assumes the stack is ; executable by default. %ifidn __OUTPUT_FORMAT__,elf -SECTION .note.GNU-stack noalloc noexec nowrite progbits +[section .note.GNU-stack noalloc noexec nowrite progbits] %endif +; Overrides the default .text section. +; Silences warnings when defining structures. +%define __SECT__ + ; cpuflags %assign cpuflags_mmx (1<<0) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/vdpau: Re-factor pre-hwaccel helper functions into separate header
h264.h and hevc.h are mutually exclusive due to defining some of the same names. As such, we need to avoid forcing h264.h to be included if we want hevc decode acceleration to be possible. However, some of the pre-hwaccel helper functions need h264.h. To avoid messy collisions, let's move the declaration of all those helpers to a separate header which we will exclude for the hevc support (which will be hwaccel-only). Signed-off-by: Philip Langdale --- libavcodec/h263dec.c| 2 +- libavcodec/h264.c | 2 +- libavcodec/h264_picture.c | 2 +- libavcodec/mpeg12dec.c | 2 +- libavcodec/vc1dec.c | 2 +- libavcodec/vdpau.c | 1 + libavcodec/vdpau_compat.h | 48 + libavcodec/vdpau_internal.h | 19 -- 8 files changed, 54 insertions(+), 24 deletions(-) create mode 100644 libavcodec/vdpau_compat.h diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 89362d2..d14e232 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -40,7 +40,7 @@ #include "mpegvideo.h" #include "msmpeg4.h" #include "qpeldsp.h" -#include "vdpau_internal.h" +#include "vdpau_compat.h" #include "thread.h" static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 1ba0e95..9a00214 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -49,7 +49,7 @@ #include "rectangle.h" #include "svq3.h" #include "thread.h" -#include "vdpau_internal.h" +#include "vdpau_compat.h" const uint16_t ff_h264_mb_sizes[4] = { 256, 384, 512, 768 }; diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c index 14d8f19..bf1471d 100644 --- a/libavcodec/h264_picture.c +++ b/libavcodec/h264_picture.c @@ -42,7 +42,7 @@ #include "mpegutils.h" #include "rectangle.h" #include "thread.h" -#include "vdpau_internal.h" +#include "vdpau_compat.h" void ff_h264_unref_picture(H264Context *h, H264Picture *pic) { diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index f180c3d..f321abc 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -45,7 +45,7 @@ #include "mpegvideo.h" #include "thread.h" #include "version.h" -#include "vdpau_internal.h" +#include "vdpau_compat.h" #include "xvmc_internal.h" typedef struct Mpeg1Context { diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index eab6792..0db7d02 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -35,7 +35,7 @@ #include "msmpeg4data.h" #include "vc1.h" #include "vc1data.h" -#include "vdpau_internal.h" +#include "vdpau_compat.h" #include "libavutil/avassert.h" diff --git a/libavcodec/vdpau.c b/libavcodec/vdpau.c index 0c38935..62d9960 100644 --- a/libavcodec/vdpau.c +++ b/libavcodec/vdpau.c @@ -32,6 +32,7 @@ #include #include "vdpau.h" +#include "vdpau_compat.h" #include "vdpau_internal.h" /** diff --git a/libavcodec/vdpau_compat.h b/libavcodec/vdpau_compat.h new file mode 100644 index 000..6b4b086 --- /dev/null +++ b/libavcodec/vdpau_compat.h @@ -0,0 +1,48 @@ +/* + * Video Decode and Presentation API for UNIX (VDPAU) is used for + * HW decode acceleration for MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_COMPAT_H +#define AVCODEC_VDPAU_COMPAT_H + +#include + +#include "h264.h" +#include "mpeg4video.h" + +void ff_vdpau_add_data_chunk(uint8_t *data, const uint8_t *buf, + int buf_size); + +void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, +int buf_size, int slice_count); + +void ff_vdpau_h264_picture_start(H264Context *h); +void ff_vdpau_h264_set_reference_frames(H264Context *h); +void ff_vdpau_h264_picture_complete(H264Context *h); + +void ff_vdpau_vc1_decode_picture(MpegEncContext *s, const uint8_t *buf, + int buf_size); + +void ff_vdpau_mpeg4_decode_picture(Mpeg4DecContext *s, const uint8_t *buf, + int buf_size); + +#endif /* AVCODEC_VDPAU_COMPAT_H */ diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h index cc49db8..6f762e4 100644 --- a/libavcodec/vdpau_internal.h +++ b/l
Re: [FFmpeg-devel] [PATCH] avcodec/vdpau: Don't leak h264.h into all VDPAU codecs
On Mon, 25 May 2015 13:14:05 -0700 Philip Langdale wrote: > On Mon, 25 May 2015 20:34:34 +0200 > Michael Niedermayer wrote: > > > On Mon, May 25, 2015 at 09:46:14AM -0700, Philip Langdale wrote: > > > h264.h and hevc.h are mutually exclusive due to defining some of > > > the same names. As such, we need to avoid forcing h264.h to be > > > included if we want hevc decode acceleration to be possible. > > > > > > Signed-off-by: Philip Langdale > > > --- > > > libavcodec/vc1dec.c | 1 + > > > libavcodec/vdpau_internal.h | 3 ++- > > > 2 files changed, 3 insertions(+), 1 deletion(-) > > > > this breaks build (with clang at least) > > > > CC libavcodec/h264.o > > In file included from ffmpeg/libavcodec/h264.c:1: > > In file included from ffmpeg/libavcodec/h264.c:52: > > ffmpeg/libavcodec/vdpau_internal.h:38:28: error: redefinition of > > typedef 'H264Context' is invalid in C [-Wtypedef-redefinition] > > typedef struct H264Context H264Context; ^ > > ffmpeg/libavcodec/h264.h:799:3: note: previous definition is here > > } H264Context; > > ^ > > 1 error generated. > > make: *** [libavcodec/h264.o] Error 1 > > > > Huh. No warnings with gcc 4.9 here. I should be able to tweak it to > work. So, gcc only triggers this warning with pedantic turned on. Anyway, I didn't bother trying to see how clever I could be, and I've refactored the old pre-hwaccel functions into a separate header to fix this comprehensively. --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: Check if ID3D11VideoDecoder exists, not just the header to enable d3d11va
On Tue, May 26, 2015 at 12:24:44AM +0200, Michael Niedermayer wrote: > Fixes build with "mingw-w64-x86-64-dev 3.2.0-2" > > Signed-off-by: Michael Niedermayer > --- > configure |4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/vdpau: Re-factor pre-hwaccel helper functions into separate header
On Mon, May 25, 2015 at 04:29:12PM -0700, Philip Langdale wrote: > h264.h and hevc.h are mutually exclusive due to defining some of the same > names. As such, we need to avoid forcing h264.h to be included if we want > hevc decode acceleration to be possible. > > However, some of the pre-hwaccel helper functions need h264.h. To avoid > messy collisions, let's move the declaration of all those helpers to > a separate header which we will exclude for the hevc support (which will > be hwaccel-only). > > Signed-off-by: Philip Langdale > --- > libavcodec/h263dec.c| 2 +- > libavcodec/h264.c | 2 +- > libavcodec/h264_picture.c | 2 +- > libavcodec/mpeg12dec.c | 2 +- > libavcodec/vc1dec.c | 2 +- > libavcodec/vdpau.c | 1 + > libavcodec/vdpau_compat.h | 48 > + > libavcodec/vdpau_internal.h | 19 -- > 8 files changed, 54 insertions(+), 24 deletions(-) > create mode 100644 libavcodec/vdpau_compat.h seems building fine here [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB DNS cache poisoning attacks, popular search engine, Google internet authority dont be evil, please signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffprobe: add stream_index to frame data
> On May 14, 2015, at 3:53 AM, Stefano Sabatini wrote: > > [...] >> From c655acffb8d9acc97e19553c2e464c0d78586063 Mon Sep 17 00:00:00 2001 >> From: Dave Rice >> Date: Wed, 13 May 2015 13:38:29 -0400 >> Subject: [PATCH] ffprobe: print stream_index with frame data >> >> otherwise the frame data can't be associated back to its stream. This >> makes it easier to work with data from multi-track outputs such as: >> ffprobe -f lavfi >> movie=1video_3audio.mov:s=v+a+a+a[out0][out1][out2][out3] -show_streams >> -show_frames >> --- >> doc/ffprobe.xsd | 1 + >> ffprobe.c | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd >> index d473c9b..5e0f9a9 100644 >> --- a/doc/ffprobe.xsd >> +++ b/doc/ffprobe.xsd >> @@ -86,6 +86,7 @@ >> > type="ffprobe:frameSideDataListType" minOccurs="0" maxOccurs="1" /> >> >> >> + >> >> >> >> diff --git a/ffprobe.c b/ffprobe.c >> index fadcd93..8ee97f5 100644 >> --- a/ffprobe.c >> +++ b/ffprobe.c >> @@ -1822,6 +1822,7 @@ static void show_frame(WriterContext *w, AVFrame >> *frame, AVStream *stream, >> writer_print_section_header(w, SECTION_ID_FRAME); >> >> s = av_get_media_type_string(stream->codec->codec_type); >> +print_int ("stream_index", stream->index); >> if (s) print_str("media_type", s); >> else print_str_opt("media_type", "unknown"); > > Nit: maybe you should print this after the media_type, as in the case > of packet. Fixed. > Note: you also need to update the fate ffprobe references, see the > script in attachment (which I should probably commit). Fixed. New patch is attached. Dave Rice 0001-print-stream_index-with-frame-data.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/vdpau: Re-factor pre-hwaccel helper functions into separate header
On Tue, 26 May 2015 02:21:43 +0200 Michael Niedermayer wrote: > On Mon, May 25, 2015 at 04:29:12PM -0700, Philip Langdale wrote: > > h264.h and hevc.h are mutually exclusive due to defining some of > > the same names. As such, we need to avoid forcing h264.h to be > > included if we want hevc decode acceleration to be possible. > > > > However, some of the pre-hwaccel helper functions need h264.h. To > > avoid messy collisions, let's move the declaration of all those > > helpers to a separate header which we will exclude for the hevc > > support (which will be hwaccel-only). > > > > Signed-off-by: Philip Langdale > > --- > > libavcodec/h263dec.c| 2 +- > > libavcodec/h264.c | 2 +- > > libavcodec/h264_picture.c | 2 +- > > libavcodec/mpeg12dec.c | 2 +- > > libavcodec/vc1dec.c | 2 +- > > libavcodec/vdpau.c | 1 + > > libavcodec/vdpau_compat.h | 48 > > + > > libavcodec/vdpau_internal.h | 19 -- 8 files > > changed, 54 insertions(+), 24 deletions(-) create mode 100644 > > libavcodec/vdpau_compat.h > > seems building fine here > > [...] Pushed. Thanks! --phil ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel