Re: [FFmpeg-devel] [PATCH] Ticket #8750 Add inline function for the vec_xl intrinsic in non-VSX environments
On Fri, 09. Oct 20:17, Andriy Gelman wrote: > From: Chip Kerchner > > --- > libswscale/ppc/yuv2rgb_altivec.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/libswscale/ppc/yuv2rgb_altivec.c > b/libswscale/ppc/yuv2rgb_altivec.c > index 536545293d..930ef6b98f 100644 > --- a/libswscale/ppc/yuv2rgb_altivec.c > +++ b/libswscale/ppc/yuv2rgb_altivec.c > @@ -283,6 +283,16 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector > signed short Y, > * > -- > */ > > +#if !HAVE_VSX > +static inline vector unsigned char vec_xl(signed long long offset, const > ubyte *addr) > +{ > +const vector unsigned char *v_addr = (const vector unsigned char *) > (addr + offset); > +vector unsigned char align_perm = vec_lvsl(offset, addr); > + > +return (vector unsigned char) vec_perm(v_addr[0], v_addr[1], align_perm); > +} > +#endif /* !HAVE_VSX */ > + > #define DEFCSP420_CVT(name, out_pixels) > \ > static int altivec_ ## name(SwsContext *c, const unsigned char **in, > \ > int *instrides, int srcSliceY, int srcSliceH, > \ Ping. This patch fixes PPC64 build on patchwork. -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1] lavf/url: fix rel path’s query string contains :/
Thanks for your reply. Scheme can't contain ?. RFC3986 definition of Scheme (https://tools.ietf.org/html/rfc3986#section-3.1) scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) Delimiters is lavf "schemes" can contain options, and ? should not be part of schemes. So it is not suitable to add ? to the list of delimiters, although it can reduce one search. Thans Alex Cai Marton Balint 于2020年10月16日周五 上午3:15写道: > > > On Thu, 15 Oct 2020, caihaonin...@gmail.com wrote: > > > From: "ruiquan.crq" > > > > Signed-off-by: ruiquan.crq > > --- > > libavformat/tests/url.c | 1 + > > libavformat/url.c | 10 +++--- > > tests/ref/fate/url | 4 > > 3 files changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c > > index 2440ae08bc..c294795fa2 100644 > > --- a/libavformat/tests/url.c > > +++ b/libavformat/tests/url.c > > @@ -90,6 +90,7 @@ int main(void) > > test_decompose("http://[::1]/dev/null;); > > test_decompose("http://[::1]:8080/dev/null;); > > test_decompose("//ffmpeg/dev/null"); > > +test_decompose("test?url=http://server/path;); > > > > printf("Testing ff_make_absolute_url:\n"); > > test(NULL, "baz"); > > diff --git a/libavformat/url.c b/libavformat/url.c > > index 3c858f0257..2f7aa37e78 100644 > > --- a/libavformat/url.c > > +++ b/libavformat/url.c > > @@ -88,7 +88,7 @@ static const char *find_delim(const char *delim, const > char *cur, const char *en > > > > int ff_url_decompose(URLComponents *uc, const char *url, const char *end) > > { > > -const char *cur, *aend, *p; > > +const char *cur, *aend, *p, *tq; > > > > av_assert0(url); > > if (!end) > > @@ -98,8 +98,12 @@ int ff_url_decompose(URLComponents *uc, const char > *url, const char *end) > > /* scheme */ > > uc->scheme = cur; > > p = find_delim(":/", cur, end); /* lavf "schemes" can contain > options */ > > Why not simply add ? and # to the list of delimiters instead? > > Nevertheless that would disallow ? and # in lavf specific scheme options. > Is it an acceptable tradeoff? > > Thanks, > Marton > > > -if (*p == ':') > > -cur = p + 1; > > +if (*p == ':') { > > +tq = find_delim("?", cur, end); > > +if (*tq != '?' || p < tq) { /* not contain "?", or ":/" before > "?" */ > > +cur = p + 1; > > +} > > +} > > > > /* authority */ > > uc->authority = cur; > > diff --git a/tests/ref/fate/url b/tests/ref/fate/url > > index 7e6395c47b..a9db0251f1 100644 > > --- a/tests/ref/fate/url > > +++ b/tests/ref/fate/url > > @@ -43,6 +43,10 @@ http://[::1]:8080/dev/null => > > host: ffmpeg > > path: /dev/null > > > > +test?url=http://server/path => > > + path: test > > + query: ?url=http://server/path > > + > > Testing ff_make_absolute_url: > > (null) baz > => baz > > /foo/bar baz > => /foo/baz > > -- > > 2.24.1 (Apple Git-126) > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > To unsubscribe, visit link above, or email > > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/3] avcodec/movtextenc: Remove redundant function parameters
It makes no sense to call the functions to write styl, hlit or hclr boxes with a different box name than "styl", "hlit" or "hclr". Therefore this commit inlines these values in the functions, removes the function parameter containing the box's name and removes the (non obsolete) box names from the list of boxes. Signed-off-by: Andreas Rheinhardt --- libavcodec/movtextenc.c | 23 +++ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 3d0328d332..67d29a09ca 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -91,8 +91,7 @@ typedef struct { } MovTextContext; typedef struct { -uint32_t type; -void (*encode)(MovTextContext *s, uint32_t tsmb_type); +void (*encode)(MovTextContext *s); } Box; static void mov_text_cleanup(MovTextContext *s) @@ -109,7 +108,7 @@ static void mov_text_cleanup(MovTextContext *s) } } -static void encode_styl(MovTextContext *s, uint32_t tsmb_type) +static void encode_styl(MovTextContext *s) { int j; @@ -117,7 +116,7 @@ static void encode_styl(MovTextContext *s, uint32_t tsmb_type) uint8_t buf[12], *p = buf; bytestream_put_be32(, s->count * STYLE_RECORD_SIZE + SIZE_ADD); -bytestream_put_be32(, tsmb_type); +bytestream_put_be32(, MKBETAG('s','t','y','l')); bytestream_put_be16(, s->count); /*The above three attributes are hard coded for now but will come from ASS style in the future*/ @@ -139,13 +138,13 @@ static void encode_styl(MovTextContext *s, uint32_t tsmb_type) mov_text_cleanup(s); } -static void encode_hlit(MovTextContext *s, uint32_t tsmb_type) +static void encode_hlit(MovTextContext *s) { if (s->box_flags & HLIT_BOX) { uint8_t buf[12], *p = buf; bytestream_put_be32(, 12); -bytestream_put_be32(, tsmb_type); +bytestream_put_be32(, MKBETAG('h','l','i','t')); bytestream_put_be16(, s->hlit.start); bytestream_put_be16(, s->hlit.end); @@ -153,13 +152,13 @@ static void encode_hlit(MovTextContext *s, uint32_t tsmb_type) } } -static void encode_hclr(MovTextContext *s, uint32_t tsmb_type) +static void encode_hclr(MovTextContext *s) { if (s->box_flags & HCLR_BOX) { uint8_t buf[12], *p = buf; bytestream_put_be32(, 12); -bytestream_put_be32(, tsmb_type); +bytestream_put_be32(, MKBETAG('h','c','l','r')); bytestream_put_be32(, s->hclr.color); av_bprint_append_any(>buffer, buf, 12); @@ -167,9 +166,9 @@ static void encode_hclr(MovTextContext *s, uint32_t tsmb_type) } static const Box box_types[] = { -{ MKBETAG('s','t','y','l'), encode_styl }, -{ MKBETAG('h','l','i','t'), encode_hlit }, -{ MKBETAG('h','c','l','r'), encode_hclr }, +{ encode_styl }, +{ encode_hlit }, +{ encode_hclr }, }; const static size_t box_count = FF_ARRAY_ELEMS(box_types); @@ -702,7 +701,7 @@ static int mov_text_encode_frame(AVCodecContext *avctx, unsigned char *buf, #endif for (j = 0; j < box_count; j++) { -box_types[j].encode(s, box_types[j].type); +box_types[j].encode(s); } } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 2/3] avcodec/movtextenc: Simplify writing to AVBPrint
The mov_text encoder uses an AVBPrint to assemble the subtitles; yet mov_text subtitles are not pure text; they also have a binary portion that was mostly handled as follows: uint32_t size = /* calculation */; size = AV_RB32(); av_bprint_append_data(bprint, (const char*), 4); Here AV_RB32() is a no-op on big-endian systems and a LE-BE swap on little-endian systems, making the output endian-independent. Yet this is ugly and unclean: On LE systems, the variable size from the snippet above won't contain the correct value any more. Furthermore, using this pattern leads to lots of small writes to the AVBPrint. This commit therefore changes this to using a temporary buffer instead: uint8_t buf[4]; AV_WB32(buf, /* size calculation */); av_bprint_append_data(bprint, buf, 4); This method also allows to use bigger buffers holding more than one element, saving calls to av_bprint_append_data() and reducing codesize. Signed-off-by: Andreas Rheinhardt --- libavcodec/movtextenc.c | 154 +--- 1 file changed, 67 insertions(+), 87 deletions(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 11db240ab7..3d0328d332 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -29,6 +29,7 @@ #include "libavutil/common.h" #include "ass_split.h" #include "ass.h" +#include "bytestream.h" #define STYLE_FLAG_BOLD (1<<0) #define STYLE_FLAG_ITALIC (1<<1) @@ -111,33 +112,28 @@ static void mov_text_cleanup(MovTextContext *s) static void encode_styl(MovTextContext *s, uint32_t tsmb_type) { int j; -uint32_t tsmb_size; -uint16_t style_entries; + if ((s->box_flags & STYL_BOX) && s->count) { -tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD; -tsmb_size = AV_RB32(_size); -tsmb_type = AV_RB32(_type); -style_entries = AV_RB16(>count); +uint8_t buf[12], *p = buf; + +bytestream_put_be32(, s->count * STYLE_RECORD_SIZE + SIZE_ADD); +bytestream_put_be32(, tsmb_type); +bytestream_put_be16(, s->count); /*The above three attributes are hard coded for now but will come from ASS style in the future*/ -av_bprint_append_any(>buffer, _size, 4); -av_bprint_append_any(>buffer, _type, 4); -av_bprint_append_any(>buffer, _entries, 2); +av_bprint_append_any(>buffer, buf, 10); for (j = 0; j < s->count; j++) { -uint16_t style_start, style_end, style_fontID; -uint32_t style_color; - -style_start = AV_RB16(>style_attributes[j]->style_start); -style_end= AV_RB16(>style_attributes[j]->style_end); -style_color = AV_RB32(>style_attributes[j]->style_color); -style_fontID = AV_RB16(>style_attributes[j]->style_fontID); - -av_bprint_append_any(>buffer, _start, 2); -av_bprint_append_any(>buffer, _end, 2); -av_bprint_append_any(>buffer, _fontID, 2); -av_bprint_append_any(>buffer, >style_attributes[j]->style_flag, 1); -av_bprint_append_any(>buffer, >style_attributes[j]->style_fontsize, 1); -av_bprint_append_any(>buffer, _color, 4); +const StyleBox *style = s->style_attributes[j]; + +p = buf; +bytestream_put_be16(, style->style_start); +bytestream_put_be16(, style->style_end); +bytestream_put_be16(, style->style_fontID); +bytestream_put_byte(, style->style_flag); +bytestream_put_byte(, style->style_fontsize); +bytestream_put_be32(, style->style_color); + +av_bprint_append_any(>buffer, buf, 12); } } mov_text_cleanup(s); @@ -145,32 +141,28 @@ static void encode_styl(MovTextContext *s, uint32_t tsmb_type) static void encode_hlit(MovTextContext *s, uint32_t tsmb_type) { -uint32_t tsmb_size; -uint16_t start, end; if (s->box_flags & HLIT_BOX) { -tsmb_size = 12; -tsmb_size = AV_RB32(_size); -tsmb_type = AV_RB32(_type); -start = AV_RB16(>hlit.start); -end = AV_RB16(>hlit.end); -av_bprint_append_any(>buffer, _size, 4); -av_bprint_append_any(>buffer, _type, 4); -av_bprint_append_any(>buffer, , 2); -av_bprint_append_any(>buffer, , 2); +uint8_t buf[12], *p = buf; + +bytestream_put_be32(, 12); +bytestream_put_be32(, tsmb_type); +bytestream_put_be16(, s->hlit.start); +bytestream_put_be16(, s->hlit.end); + +av_bprint_append_any(>buffer, buf, 12); } } static void encode_hclr(MovTextContext *s, uint32_t tsmb_type) { -uint32_t tsmb_size, color; if (s->box_flags & HCLR_BOX) { -tsmb_size = 12; -tsmb_size = AV_RB32(_size); -tsmb_type = AV_RB32(_type); -color = AV_RB32(>hclr.color); -av_bprint_append_any(>buffer, _size, 4); -
[FFmpeg-devel] [PATCH v2 1/3] avcodec/movtextenc: Fix potential use of uninitialized value
Background colour was never initialized if no style was available. Use a sane default of zero (i.e. completely transparent). Fixes Coverity issue #1461471. Signed-off-by: Andreas Rheinhardt --- Commit message updated to include Coverity issue. libavcodec/movtextenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index 5f60b8db61..11db240ab7 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -205,7 +205,7 @@ static int encode_sample_description(AVCodecContext *avctx) ASS *ass; ASSStyle *style; int i, j; -uint32_t tsmb_size, tsmb_type, back_color, style_color; +uint32_t tsmb_size, tsmb_type, back_color = 0, style_color; uint16_t style_start, style_end, fontID, count; int font_names_total_len = 0; MovTextContext *s = avctx->priv_data; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: fix writing to bytestream on BE arches
On Thu, 15. Oct 23:55, Andreas Rheinhardt wrote: > Andriy Gelman: > > On Thu, 15. Oct 16:06, Andreas Rheinhardt wrote: > >> Andriy Gelman: > >>> From: Andriy Gelman > >>> > >>> Fixes fate-binsub-movtextenc on PPC64 > >>> > >>> Currently tags are written in reverse order on BE arches. This is fixed > >>> by using MKBETAG() and AV_RB32() to be arch agnostics. > >>> > >>> Also s->font_count is of type int. On BE arches with 32bit int, > >>> count = AV_RB16(>font_count) will read two most significant bytes > >>> instead of the least signifcant bytes. This is fixed by assiging > >>> s->font_count to count first. > >>> > >>> The final change is modyfying the type of len. On BE arches > >>> the most signifanct byte of the int was written instead of the least > >>> significant byte. > >>> > >>> Signed-off-by: Andriy Gelman > >>> --- > >>> libavcodec/movtextenc.c | 17 +++-- > >>> 1 file changed, 11 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c > >>> index b2368b641b..f38cd9cba2 100644 > >>> --- a/libavcodec/movtextenc.c > >>> +++ b/libavcodec/movtextenc.c > >>> @@ -116,6 +116,7 @@ static void encode_styl(MovTextContext *s, uint32_t > >>> tsmb_type) > >>> if ((s->box_flags & STYL_BOX) && s->count) { > >>> tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD; > >>> tsmb_size = AV_RB32(_size); > >>> +tsmb_type = AV_RB32(_type); > >>> style_entries = AV_RB16(>count); > >>> /*The above three attributes are hard coded for now > >>> but will come from ASS style in the future*/ > >>> @@ -149,6 +150,7 @@ static void encode_hlit(MovTextContext *s, uint32_t > >>> tsmb_type) > >>> if (s->box_flags & HLIT_BOX) { > >>> tsmb_size = 12; > >>> tsmb_size = AV_RB32(_size); > >>> +tsmb_type = AV_RB32(_type); > >>> start = AV_RB16(>hlit.start); > >>> end = AV_RB16(>hlit.end); > >>> av_bprint_append_any(>buffer, _size, 4); > >>> @@ -164,6 +166,7 @@ static void encode_hclr(MovTextContext *s, uint32_t > >>> tsmb_type) > >>> if (s->box_flags & HCLR_BOX) { > >>> tsmb_size = 12; > >>> tsmb_size = AV_RB32(_size); > >>> +tsmb_type = AV_RB32(_type); > >>> color = AV_RB32(>hclr.color); > >>> av_bprint_append_any(>buffer, _size, 4); > >>> av_bprint_append_any(>buffer, _type, 4); > >>> @@ -172,9 +175,9 @@ static void encode_hclr(MovTextContext *s, uint32_t > >>> tsmb_type) > >>> } > >>> > >>> static const Box box_types[] = { > >>> -{ MKTAG('s','t','y','l'), encode_styl }, > >>> -{ MKTAG('h','l','i','t'), encode_hlit }, > >>> -{ MKTAG('h','c','l','r'), encode_hclr }, > >>> +{ MKBETAG('s','t','y','l'), encode_styl }, > >>> +{ MKBETAG('h','l','i','t'), encode_hlit }, > >>> +{ MKBETAG('h','c','l','r'), encode_hclr }, > >>> }; > >>> > >>> const static size_t box_count = FF_ARRAY_ELEMS(box_types); > >>> @@ -316,14 +319,16 @@ static int encode_sample_description(AVCodecContext > >>> *avctx) > >>> // FontTableBox { > >>> tsmb_size = SIZE_ADD + 3 * s->font_count + font_names_total_len; > >>> tsmb_size = AV_RB32(_size); > >>> -tsmb_type = MKTAG('f','t','a','b'); > >>> -count = AV_RB16(>font_count); > >>> +tsmb_type = MKBETAG('f','t','a','b'); > >>> +tsmb_type = AV_RB32(_type); > >>> +count = s->font_count; > >>> +count = AV_RB16(); > >>> av_bprint_append_any(>buffer, _size, 4); > >>> av_bprint_append_any(>buffer, _type, 4); > >>> av_bprint_append_any(>buffer, , 2); > >>> // FontRecord { > >>> for (i = 0; i < s->font_count; i++) { > >>> -int len; > >>> +uint8_t len; > >>> fontID = i + 1; > >>> fontID = AV_RB16(); > >>> av_bprint_append_any(>buffer, , 2); > >>> > > > >> I have sent an alternative version that avoids this horrible way of > >> writing output independent of endianness by instead using small buffers > >> and writing the values into it via AV_WBx(). This also allows to combine > >> several av_bprint_append_any() calls into one. Said patch is patch #2 of > >> this patchset: > >> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-October/271057.html (The > >> second email has not yet come through due to the mailing list's random > >> delay.) > > > > My patch is a smaller diff and is consistent with the style of the code. > >> Up to maintainer but I'd suggest your changes are a separate patch. > > > This encoder has no maintainer listed, so I suggest you apply your patch > to fix the endianness issue and I rebase my patches on top of yours. > Btw: Your commit message has typos: signifcant, assiging, modyfying, > signifanct. Sounds good. Fixed the typos and pushed. thanks, -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To
[FFmpeg-devel] [PATCH] avcodec/av1dec: always update frame loop filter deltas using bitstream values
Frames with primary_ref_frame == AV1_PRIMARY_REF_NONE can also have values for loop_filter_ref_deltas and loop_filter_mode_deltas coded in the bitstream that must overwrite the initial values if present. Signed-off-by: James Almer --- libavcodec/av1dec.c | 44 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index 6d00754fcb..67ae02a1f8 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -26,8 +26,25 @@ #include "internal.h" #include "profiles.h" -static void setup_past_independence(AV1Frame *f) +static void loop_filter_delta_update(AV1DecContext *s) { +for (int i = 0; i < AV1_TOTAL_REFS_PER_FRAME; i++) { +if (s->raw_frame_header->update_ref_delta[i]) +s->cur_frame.loop_filter_ref_deltas[i] = +s->raw_frame_header->loop_filter_ref_deltas[i]; +} + +for (int i = 0; i < 2; i++) { +if (s->raw_frame_header->update_mode_delta[i]) +s->cur_frame.loop_filter_mode_deltas[i] = +s->raw_frame_header->loop_filter_mode_deltas[i]; +} +} + +static void setup_past_independence_and_update(AV1DecContext *s) +{ +AV1Frame *f = >cur_frame; + f->loop_filter_delta_enabled = 1; f->loop_filter_ref_deltas[AV1_REF_FRAME_INTRA] = 1; @@ -41,6 +58,12 @@ static void setup_past_independence(AV1Frame *f) f->loop_filter_mode_deltas[0] = 0; f->loop_filter_mode_deltas[1] = 0; + +f->loop_filter_delta_enabled = +s->raw_frame_header->loop_filter_delta_enabled; + +if (s->raw_frame_header->loop_filter_delta_update) +loop_filter_delta_update(s); } static void load_previous_and_update(AV1DecContext *s) @@ -56,22 +79,11 @@ static void load_previous_and_update(AV1DecContext *s) s->ref[prev_frame].loop_filter_mode_deltas, 2 * sizeof(int8_t)); -if (s->raw_frame_header->loop_filter_delta_update) { -for (int i = 0; i < AV1_NUM_REF_FRAMES; i++) { -if (s->raw_frame_header->update_ref_delta[i]) -s->cur_frame.loop_filter_ref_deltas[i] = -s->raw_frame_header->loop_filter_ref_deltas[i]; -} - -for (int i = 0; i < 2; i++) { -if (s->raw_frame_header->update_mode_delta[i]) -s->cur_frame.loop_filter_mode_deltas[i] = -s->raw_frame_header->loop_filter_mode_deltas[i]; -} -} - s->cur_frame.loop_filter_delta_enabled = s->raw_frame_header->loop_filter_delta_enabled; + +if (s->raw_frame_header->loop_filter_delta_update) +loop_filter_delta_update(s); } static uint32_t inverse_recenter(int r, uint32_t v) @@ -643,7 +655,7 @@ static int get_current_frame(AVCodecContext *avctx) } if (s->raw_frame_header->primary_ref_frame == AV1_PRIMARY_REF_NONE) -setup_past_independence(>cur_frame); +setup_past_independence_and_update(s); else load_previous_and_update(s); -- 2.28.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] Unbreak av_malloc_max(0) API/ABI
Joakim Tjernlund: > From https://bugs.chromium.org/p/chromium/issues/detail?id=1095962 > > This seems to be caused by the custom handling of "av_max_alloc(0)" in > Chromium's ffmpeg fork to mean unlimited (added in [1]). > > Upstream ffmpeg doesn't treat 0 as a special value; versions before 4.3 > seemingly worked > because 32 was subtracted from max_alloc_size (set to 0 by Chromium) > resulting in an > integer underflow, making the effective limit be SIZE_MAX - 31. > > Now that the above underflow doesn't happen, the tab just crashes. The > upstream change > for no longer subtracting 32 from max_alloc_size was included in ffmpeg 4.3. > [2] > > [1] > https://chromium-review.googlesource.com/c/chromium/third_party/ffmpeg/+/73563 > [2] https://github.com/FFmpeg/FFmpeg/commit/731c77589841 > --- > > Restore av_malloc_max(0) to MAX_INT fixing MS Teams, Discord older chromium > etc. > > Signed-off-by: Joakim Tjernlund > --- > > v2: Cover the full API range 0-31 > > v3: Closer compat with < 4.3 ffmpeg > > libavutil/mem.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavutil/mem.c b/libavutil/mem.c > index cfb6d8a..bd1fb85 100644 > --- a/libavutil/mem.c > +++ b/libavutil/mem.c > @@ -71,6 +71,8 @@ void free(void *ptr); > static size_t max_alloc_size= INT_MAX; > > void av_max_alloc(size_t max){ > +if (max < 32) > +max = SIZE_MAX - max; /* be compatible to older(< 4.3) versions */ > max_alloc_size = max; > } > > For full compatibility it should be SIZE_MAX - 32 + max. But why don't you go the way of fixing the broken apps? - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: Fix potential use of unitialized value
Moritz Barsnick: > On Thu, Oct 15, 2020 at 16:00:50 +0200, Andreas Rheinhardt wrote: > > Nit: >> Subject: avcodec/movtextenc: Fix potential use of unitialized value > uninitialized > Thanks, fixed locally. Also added a reference to Coverity ticket #1461471 (which this commit fixes). - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/5] libdc1394: Enable listing sources
IIDC camera sources can now be listed by using the following command: ffmpeg -sources libdc1394 The basic structure of this function was borrowed from libavdevice/alsa.c:ff_alsa_get_device_list. Signed-off-by: Forest Crossman --- libavdevice/libdc1394.c | 73 + 1 file changed, 73 insertions(+) diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 003335fdd8..ec74cea87a 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -22,6 +22,8 @@ #include +#include "avdevice.h" + #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/log.h" @@ -288,6 +290,76 @@ static int dc1394_close(AVFormatContext * context) return 0; } +static int dc1394_get_device_list(AVFormatContext *c, AVDeviceInfoList *device_list) +{ +int ret = 0; +uint32_t i; +dc1394_t *d; +dc1394camera_t *camera; +dc1394camera_list_t *list; +AVDeviceInfo *new_device = NULL; + +d = dc1394_new(); +if (dc1394_camera_enumerate(d, ) != DC1394_SUCCESS || !list) { +av_log(c, AV_LOG_ERROR, "Unable to look for an IIDC camera.\n"); +ret = -1; +goto out; +} + +device_list->nb_devices = 0; +device_list->default_device = -1; + +if (list->num > 0) { +device_list->default_device = 0; +} + +for (i = 0; i < list->num; i++) { +new_device = av_mallocz(sizeof(AVDeviceInfo)); +if (!new_device) { +ret = AVERROR(ENOMEM); +break; +} + +camera = dc1394_camera_new_unit(d, list->ids[i].guid, list->ids[i].unit); +if (!camera) { +av_log(c, AV_LOG_ERROR, "Unable to open camera 0x%016"PRIx64":%"PRIu16"\n", + list->ids[i].guid, list->ids[i].unit); +ret = -1; +break; +} + +new_device->device_name = av_asprintf("0x%016"PRIx64":%"PRIu16, + list->ids[i].guid, list->ids[i].unit); +new_device->device_description = av_asprintf("%s %s", + camera->vendor, camera->model); +dc1394_camera_free(camera); + +if (!new_device->device_description || !new_device->device_name) { +ret = AVERROR(ENOMEM); +break; +} + +if ((ret = av_dynarray_add_nofree(_list->devices, + _list->nb_devices, new_device)) < 0) { +break; +} + +new_device = NULL; +} +if (new_device) { +av_free(new_device->device_description); +av_free(new_device->device_name); +av_free(new_device); +} + +/* Freeing list of cameras */ +dc1394_camera_free_list(list); + +out: +dc1394_free(d); +return ret; +} + AVInputFormat ff_libdc1394_demuxer = { .name = "libdc1394", .long_name = NULL_IF_CONFIG_SMALL("dc1394 v.2 A/V grab"), @@ -295,6 +367,7 @@ AVInputFormat ff_libdc1394_demuxer = { .read_header= dc1394_read_header, .read_packet= dc1394_read_packet, .read_close = dc1394_close, +.get_device_list = dc1394_get_device_list, .flags = AVFMT_NOFILE, .priv_class = _class, }; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: fix writing to bytestream on BE arches
Andriy Gelman: > On Thu, 15. Oct 16:06, Andreas Rheinhardt wrote: >> Andriy Gelman: >>> From: Andriy Gelman >>> >>> Fixes fate-binsub-movtextenc on PPC64 >>> >>> Currently tags are written in reverse order on BE arches. This is fixed >>> by using MKBETAG() and AV_RB32() to be arch agnostics. >>> >>> Also s->font_count is of type int. On BE arches with 32bit int, >>> count = AV_RB16(>font_count) will read two most significant bytes >>> instead of the least signifcant bytes. This is fixed by assiging >>> s->font_count to count first. >>> >>> The final change is modyfying the type of len. On BE arches >>> the most signifanct byte of the int was written instead of the least >>> significant byte. >>> >>> Signed-off-by: Andriy Gelman >>> --- >>> libavcodec/movtextenc.c | 17 +++-- >>> 1 file changed, 11 insertions(+), 6 deletions(-) >>> >>> diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c >>> index b2368b641b..f38cd9cba2 100644 >>> --- a/libavcodec/movtextenc.c >>> +++ b/libavcodec/movtextenc.c >>> @@ -116,6 +116,7 @@ static void encode_styl(MovTextContext *s, uint32_t >>> tsmb_type) >>> if ((s->box_flags & STYL_BOX) && s->count) { >>> tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD; >>> tsmb_size = AV_RB32(_size); >>> +tsmb_type = AV_RB32(_type); >>> style_entries = AV_RB16(>count); >>> /*The above three attributes are hard coded for now >>> but will come from ASS style in the future*/ >>> @@ -149,6 +150,7 @@ static void encode_hlit(MovTextContext *s, uint32_t >>> tsmb_type) >>> if (s->box_flags & HLIT_BOX) { >>> tsmb_size = 12; >>> tsmb_size = AV_RB32(_size); >>> +tsmb_type = AV_RB32(_type); >>> start = AV_RB16(>hlit.start); >>> end = AV_RB16(>hlit.end); >>> av_bprint_append_any(>buffer, _size, 4); >>> @@ -164,6 +166,7 @@ static void encode_hclr(MovTextContext *s, uint32_t >>> tsmb_type) >>> if (s->box_flags & HCLR_BOX) { >>> tsmb_size = 12; >>> tsmb_size = AV_RB32(_size); >>> +tsmb_type = AV_RB32(_type); >>> color = AV_RB32(>hclr.color); >>> av_bprint_append_any(>buffer, _size, 4); >>> av_bprint_append_any(>buffer, _type, 4); >>> @@ -172,9 +175,9 @@ static void encode_hclr(MovTextContext *s, uint32_t >>> tsmb_type) >>> } >>> >>> static const Box box_types[] = { >>> -{ MKTAG('s','t','y','l'), encode_styl }, >>> -{ MKTAG('h','l','i','t'), encode_hlit }, >>> -{ MKTAG('h','c','l','r'), encode_hclr }, >>> +{ MKBETAG('s','t','y','l'), encode_styl }, >>> +{ MKBETAG('h','l','i','t'), encode_hlit }, >>> +{ MKBETAG('h','c','l','r'), encode_hclr }, >>> }; >>> >>> const static size_t box_count = FF_ARRAY_ELEMS(box_types); >>> @@ -316,14 +319,16 @@ static int encode_sample_description(AVCodecContext >>> *avctx) >>> // FontTableBox { >>> tsmb_size = SIZE_ADD + 3 * s->font_count + font_names_total_len; >>> tsmb_size = AV_RB32(_size); >>> -tsmb_type = MKTAG('f','t','a','b'); >>> -count = AV_RB16(>font_count); >>> +tsmb_type = MKBETAG('f','t','a','b'); >>> +tsmb_type = AV_RB32(_type); >>> +count = s->font_count; >>> +count = AV_RB16(); >>> av_bprint_append_any(>buffer, _size, 4); >>> av_bprint_append_any(>buffer, _type, 4); >>> av_bprint_append_any(>buffer, , 2); >>> // FontRecord { >>> for (i = 0; i < s->font_count; i++) { >>> -int len; >>> +uint8_t len; >>> fontID = i + 1; >>> fontID = AV_RB16(); >>> av_bprint_append_any(>buffer, , 2); >>> > >> I have sent an alternative version that avoids this horrible way of >> writing output independent of endianness by instead using small buffers >> and writing the values into it via AV_WBx(). This also allows to combine >> several av_bprint_append_any() calls into one. Said patch is patch #2 of >> this patchset: >> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-October/271057.html (The >> second email has not yet come through due to the mailing list's random >> delay.) > > My patch is a smaller diff and is consistent with the style of the code. >> Up to maintainer but I'd suggest your changes are a separate patch. > This encoder has no maintainer listed, so I suggest you apply your patch to fix the endianness issue and I rebase my patches on top of yours. Btw: Your commit message has typos: signifcant, assiging, modyfying, signifanct. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 0/5] libdc1394 enhancements
I was having trouble using libdc1394 the first time I tried it (e.g., setting unsupported video modes/framerates on cameras, trying to use multiple cameras, tring to figure out how to set the arguments so the command would actually work, etc.) so I thought I'd go ahead and add some ease-of-use enhancements to the module and some examples to the documentation to help others get started. I also wound up finding a bug with some early PTS wrapping, and I guess some encoders masked the issue because when I tried dumping the raw video to an MKV file the matroska encoder complained _very loudly_ about the non-monotonic PTS/DTS values. I had some trouble determining the best way to write the mode/framerate support checks and how to present the information to the user (errors are obvious, but I didn't know when would be a good time to list the supported modes and how best to print them), so if anyone has any suggestions on how to make that more "elegant" I'd be happy to hear them! I also had some trouble with the camera GUID:unit parsing--it works, but if the input is slightly incorrect the parsing will fail in strange ways. It will also successfully parse incorrect specifiers like 0xabcdef001122334455.0 (the period should be a colon) and 0x0xabcdef001122334455 (there's an extra "0x" prefix) and I'd really prefer it if it would error out and alert the user instead of fail-succeeding silently, but I'm not very well versed in C's string parsing so I'm not sure how I can improve that without significantly increasing the code complexity. Changes from v1: - Made recommended changes to "doc/indevs: Add examples for libdc1394". - Reworded some commit messages for clarity. Forest Crossman (5): libdc1394: Enable listing sources libdc1394: Verify the camera supports the selected mode and framerate libdc1394: Enable specifying a camera by GUID[:unit] doc/indevs: Add examples for libdc1394 libdc1394: Fix PTS wrapping doc/indevs.texi | 35 +++ libavdevice/libdc1394.c | 217 ++-- 2 files changed, 221 insertions(+), 31 deletions(-) -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/5] doc/indevs: Add examples for libdc1394
Signed-off-by: Forest Crossman --- doc/indevs.texi | 32 1 file changed, 32 insertions(+) diff --git a/doc/indevs.texi b/doc/indevs.texi index 46203833e9..ca584f1d8e 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -1114,6 +1114,38 @@ Set the video size given as a string such as @code{640x480} or @code{hd720}. Default is @code{qvga}. @end table +@subsection Examples + +@itemize + +@item +List all the connected IIDC cameras. +@example +ffmpeg -sources libdc1394 +@end example + +@item +Grab and record the input of an Apple iSight. +@example +ffmpeg -f libdc1394 -pixel_format uyvy422 -video_size 320x240 -framerate 30 -i auto out.mkv +@end example + +@item +Grab and record the input of a specific Apple iSight, specified by its +GUID. +@example +ffmpeg -f libdc1394 -pixel_format uyvy422 -video_size 640x480 -framerate 15 -i 0x000a270004106ea3 out.mkv +@end example + +@item +Grab and record the second stream from a specific camera that has +multiple units. +@example +ffmpeg -f libdc1394 -pixel_format uyvy422 -video_size 640x480 -framerate 15 -i 0xfacade02bc394f15:1 out.mkv +@end example + +@end itemize + @section openal The OpenAL input device provides audio capture on all systems with a -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 5/5] libdc1394: Fix PTS wrapping
Without this, the timestamp will unexpectedly wrap around after approximately 2146 frames (on a 64-bit system, at least), which is about 19 minutes at the lowest framerate supported by the IIDC standard and about 9 seconds at the highest supported framerate. To fix this, we use av_rescale() to do the PTS calculation, then we change both the current_frame and frame_rate variables to int64_t (for consistency) and keep the PTS wraparound bits set to 64. For all intents and purposes, however, the PTS will never wrap around, because even at 240 fps--the highest framerate supported by the IIDC standard--it would take over 292 million years of continuous recording before an overflow would occur. Signed-off-by: Forest Crossman --- libavdevice/libdc1394.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index 90252f7c4a..1e138edac2 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -40,8 +40,8 @@ typedef struct dc1394_data { dc1394_t *d; dc1394camera_t *camera; dc1394video_frame_t *frame; -int current_frame; -int frame_rate;/**< frames per 1000 seconds (fps * 1000) */ +int64_t current_frame; +int64_t frame_rate; /**< frames per 1000 seconds (fps * 1000) */ char *video_size; /**< String describing video size, set by a private option. */ char *pixel_format; /**< Set by a private option. */ char *framerate;/**< Set by a private option. */ @@ -133,8 +133,8 @@ static inline int dc1394_read_common(AVFormatContext *c, break; if (!fps->frame_rate || !fmt->width) { -av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s, %dx%d@%d:1000fps\n", av_get_pix_fmt_name(pix_fmt), - width, height, dc1394->frame_rate); +av_log(c, AV_LOG_ERROR, "Can't find matching camera format for %s, %dx%d@%"PRId64":1000fps\n", + av_get_pix_fmt_name(pix_fmt), width, height, dc1394->frame_rate); ret = AVERROR(EINVAL); goto out; } @@ -342,14 +342,14 @@ static int dc1394_read_packet(AVFormatContext *c, AVPacket *pkt) /* discard stale frame */ if (dc1394->current_frame++) { if (dc1394_capture_enqueue(dc1394->camera, dc1394->frame) != DC1394_SUCCESS) -av_log(c, AV_LOG_ERROR, "failed to release %d frame\n", dc1394->current_frame); +av_log(c, AV_LOG_ERROR, "failed to release %"PRId64" frame\n", dc1394->current_frame); } res = dc1394_capture_dequeue(dc1394->camera, DC1394_CAPTURE_POLICY_WAIT, >frame); if (res == DC1394_SUCCESS) { pkt->data = (uint8_t *)dc1394->frame->image; pkt->size = dc1394->frame->image_bytes; -pkt->pts = dc1394->current_frame * 100 / dc1394->frame_rate; +pkt->pts = av_rescale(dc1394->current_frame, 100, dc1394->frame_rate); pkt->flags |= AV_PKT_FLAG_KEY; pkt->stream_index = dc1394->stream_index; } else { -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/exr: Fix overflow with many blocks
On Mon, Sep 28, 2020 at 04:13:00PM +0200, Michael Niedermayer wrote: > On Sun, Sep 27, 2020 at 10:21:25AM +0200, Andreas Rheinhardt wrote: > > Michael Niedermayer: > > > Fixes: signed integer overflow: 1073741827 * 8 cannot be represented in > > > type 'int' > > > Fixes: > > > 25621/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-6304841641754624 > > > > > > Found-by: continuous fuzzing process > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/exr.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavcodec/exr.c b/libavcodec/exr.c > > > index c80e8eb5e0..8621a8cfe4 100644 > > > --- a/libavcodec/exr.c > > > +++ b/libavcodec/exr.c > > > @@ -1783,7 +1783,7 @@ static int decode_frame(AVCodecContext *avctx, void > > > *data, > > > if ((ret = ff_thread_get_buffer(avctx, , 0)) < 0) > > > return ret; > > > > > > -if (bytestream2_get_bytes_left(>gb) < nb_blocks * 8) > > > +if (bytestream2_get_bytes_left(>gb) < nb_blocks * 8L) > > > > Does this have an advantage over dividing by 8? > > probably not anything thats relevant in this case will apply with a division [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/5] avcodec/h264idct_template: Fix integer overflow in ff_h264_chroma422_dc_dequant_idct()
Fixes: signed integer overflow: 241173056 + 1953511200 cannot be represented in type 'int' Fixes: 26086/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5068366420901888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h264idct_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c index 5993ae2e6e..f19579a47c 100644 --- a/libavcodec/h264idct_template.c +++ b/libavcodec/h264idct_template.c @@ -278,7 +278,7 @@ void FUNCC(ff_h264_chroma422_dc_dequant_idct)(int16_t *_block, int qmul){ const int stride= 16*2; const int xStride= 16; int i; -int temp[8]; +unsigned temp[8]; static const uint8_t x_offset[2]={0, 16}; dctcoef *block = (dctcoef*)_block; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/mobiclip: set the bitstream size to the input
On Sat, Sep 12, 2020 at 04:51:04PM +0200, Paul B Mahol wrote: > On Sat, Sep 12, 2020 at 04:35:55PM +0200, Michael Niedermayer wrote: > > Fixes: out of array read > > Fixes: > > 25453/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5163575973511168 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/mobiclip.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c > > index 3ede370bef..08a35218cc 100644 > > --- a/libavcodec/mobiclip.c > > +++ b/libavcodec/mobiclip.c > > @@ -1306,7 +1306,7 @@ static int mobiclip_decode(AVCodecContext *avctx, > > void *data, > > (uint16_t *)pkt->data, > > (pkt->size + 1) >> 1); > > > > -ret = init_get_bits8(gb, s->bitstream, s->bitstream_size); > > +ret = init_get_bits8(gb, s->bitstream, FFALIGN(pkt->size, 2)); > > if (ret < 0) > > return ret; > > ok. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/5] avcodec/notchlc: Check uncompressed size against input for LZ4
Fixes: OOM Fixes: 26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064 Equation is based on LZ4_COMPRESSBOUND from lz4.h Suggested-by: Paul Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/notchlc.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index 3f7079da70..d13ce3193c 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -490,6 +490,11 @@ static int decode_frame(AVCodecContext *avctx, bytestream2_init(gb, s->lzf_buffer, uncompressed_size); } else if (s->format == 1) { +unsigned remaining = bytestream2_get_bytes_left(gb); + +if (remaining > 0x7E00U || remaining + remaining/255 + 16 < uncompressed_size) +return AVERROR_INVALIDDATA; + av_fast_padded_malloc(>uncompressed_buffer, >uncompressed_size, uncompressed_size); if (!s->uncompressed_buffer) -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/5] avformat/au: Check for EOF in au_read_annotation()
Fixes: Timeout (too looong -> 1 ms) Fixes: 26366/clusterfuzz-testcase-minimized-ffmpeg_dem_SDX_fuzzer-5655584843759616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/au.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/au.c b/libavformat/au.c index c09f4da4c9..b4eb4f8477 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -84,6 +84,8 @@ static int au_read_annotation(AVFormatContext *s, int size) av_bprint_init(, 64, AV_BPRINT_SIZE_UNLIMITED); while (size-- > 0) { +if (avio_feof(pb)) +return AVERROR_EOF; c = avio_r8(pb); switch(state) { case PARSE_KEY: -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/5] avformat/asfdec_f: Check name_len for overflow
Fixes: signed integer overflow: -1172299744 * 2 cannot be represented in type 'int' Fixes: 26258/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5672758488596480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/asfdec_f.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 103155e9e7..ff9107d73f 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -769,6 +769,8 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) avio_rl32(pb); // send time avio_rl32(pb); // flags name_len = avio_rl32(pb); // name length +if ((unsigned)name_len > INT_MAX / 2) +return AVERROR_INVALIDDATA; if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) avio_skip(pb, name_len - ret); -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Revert "aviobuf: Discard old buffered, previously read data in ffio_read_partial"
On Fri, 9 Oct 2020, Marton Balint wrote: This is unneeded after 2ca48e466675a8a3630061cd2c15325eab8eda97 and it breaks ffio_ensure_seekback(). This reverts commit 53c25ee0736497b46bb76064cc2c84c976b2d295. --- libavformat/aviobuf.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index a77517d712..b55b206be2 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -719,13 +719,6 @@ int avio_read_partial(AVIOContext *s, unsigned char *buf, int size) len = s->buf_end - s->buf_ptr; if (len == 0) { -/* Reset the buf_end pointer to the start of the buffer, to make sure - * the fill_buffer call tries to read as much data as fits into the - * full buffer, instead of just what space is left after buf_end. - * This avoids returning partial packets at the end of the buffer, - * for packet based inputs. - */ -s->buf_end = s->buf_ptr = s->buffer; fill_buffer(s); len = s->buf_end - s->buf_ptr; } Ping, will apply soon. Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1] lavf/url: fix rel path’s query string contains :/
On Thu, 15 Oct 2020, caihaonin...@gmail.com wrote: From: "ruiquan.crq" Signed-off-by: ruiquan.crq --- libavformat/tests/url.c | 1 + libavformat/url.c | 10 +++--- tests/ref/fate/url | 4 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c index 2440ae08bc..c294795fa2 100644 --- a/libavformat/tests/url.c +++ b/libavformat/tests/url.c @@ -90,6 +90,7 @@ int main(void) test_decompose("http://[::1]/dev/null;); test_decompose("http://[::1]:8080/dev/null;); test_decompose("//ffmpeg/dev/null"); +test_decompose("test?url=http://server/path;); printf("Testing ff_make_absolute_url:\n"); test(NULL, "baz"); diff --git a/libavformat/url.c b/libavformat/url.c index 3c858f0257..2f7aa37e78 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -88,7 +88,7 @@ static const char *find_delim(const char *delim, const char *cur, const char *en int ff_url_decompose(URLComponents *uc, const char *url, const char *end) { -const char *cur, *aend, *p; +const char *cur, *aend, *p, *tq; av_assert0(url); if (!end) @@ -98,8 +98,12 @@ int ff_url_decompose(URLComponents *uc, const char *url, const char *end) /* scheme */ uc->scheme = cur; p = find_delim(":/", cur, end); /* lavf "schemes" can contain options */ Why not simply add ? and # to the list of delimiters instead? Nevertheless that would disallow ? and # in lavf specific scheme options. Is it an acceptable tradeoff? Thanks, Marton -if (*p == ':') -cur = p + 1; +if (*p == ':') { +tq = find_delim("?", cur, end); +if (*tq != '?' || p < tq) { /* not contain "?", or ":/" before "?" */ +cur = p + 1; +} +} /* authority */ uc->authority = cur; diff --git a/tests/ref/fate/url b/tests/ref/fate/url index 7e6395c47b..a9db0251f1 100644 --- a/tests/ref/fate/url +++ b/tests/ref/fate/url @@ -43,6 +43,10 @@ http://[::1]:8080/dev/null => host: ffmpeg path: /dev/null +test?url=http://server/path => + path: test + query: ?url=http://server/path + Testing ff_make_absolute_url: (null) baz => baz /foo/bar baz => /foo/baz -- 2.24.1 (Apple Git-126) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavcodec/cuviddec AV1 decoding support for Ampere cards
Hello, This patch adds AV1 decoding support for av1_cuvid stand-alone decoder. It requires Ampere GPU. -- BR, Roman Arzumanyan 0001-AV1-nvcuvid-support.patch Description: 0001-AV1-nvcuvid-support.patch ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] libavformat/hls: add support for SAMPLE-AES decryption in HLS demuxer
On Thu, Oct 15, 2020 at 10:15:13PM +0530, Nachiket Tarate wrote: > Apple HTTP Live Streaming Sample Encryption: > > https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption > > Signed-off-by: Nachiket Tarate > --- > libavformat/Makefile | 2 +- > libavformat/hls.c| 93 ++- > libavformat/hls_sample_aes.c | 497 +++ > libavformat/hls_sample_aes.h | 64 + > libavformat/mpegts.c | 15 ++ > 5 files changed, 657 insertions(+), 14 deletions(-) > create mode 100644 libavformat/hls_sample_aes.c > create mode 100644 libavformat/hls_sample_aes.h This seems to break fate (segfault) I guess patchwork will notice it too but as i already tested and noticed ... --- ./tests/ref/fate/segment-mp4-to-ts 2020-10-10 18:08:06.500253003 +0200 +++ tests/data/fate/segment-mp4-to-ts 2020-10-15 20:03:24.586303460 +0200 @@ -128,5 +128,3 @@ 0, 428400, 435600, 3600, 156, 0xd2c3406c, F=0x0, S=1, 1, 0x00e000e0 0, 432000, 439200, 3600, 330, 0x150d9b60, F=0x0, S=1, 1, 0x00e000e0 0, 435600, 446400, 3600, 324, 0x558194ee, F=0x0, S=1, 1, 0x00e000e0 -0, 439200, 442800, 3600, 191, 0x108e54d1, F=0x0, S=1, 1, 0x00e000e0 -0, 442800, 45, 3600, 233, 0xac5b6486, F=0x0 Test segment-mp4-to-ts failed. Look at tests/data/fate/segment-mp4-to-ts.err for details. tests/Makefile:255: recipe for target 'fate-segment-mp4-to-ts' failed make: *** [fate-segment-mp4-to-ts] Error 139 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavformat/hls: add support for SAMPLE-AES decryption in HLS demuxer
Apple HTTP Live Streaming Sample Encryption: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption Signed-off-by: Nachiket Tarate --- libavformat/Makefile | 2 +- libavformat/hls.c| 93 ++- libavformat/hls_sample_aes.c | 497 +++ libavformat/hls_sample_aes.h | 64 + libavformat/mpegts.c | 15 ++ 5 files changed, 657 insertions(+), 14 deletions(-) create mode 100644 libavformat/hls_sample_aes.c create mode 100644 libavformat/hls_sample_aes.h diff --git a/libavformat/Makefile b/libavformat/Makefile index a5e8bddb87..0ccec2d281 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -235,7 +235,7 @@ OBJS-$(CONFIG_HCOM_DEMUXER) += hcom.o pcm.o OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o OBJS-$(CONFIG_HEVC_DEMUXER) += hevcdec.o rawdec.o OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o -OBJS-$(CONFIG_HLS_DEMUXER) += hls.o +OBJS-$(CONFIG_HLS_DEMUXER) += hls.o hls_sample_aes.o OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o diff --git a/libavformat/hls.c b/libavformat/hls.c index 72e28ab94f..63683e4742 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -2,6 +2,7 @@ * Apple HTTP Live Streaming demuxer * Copyright (c) 2010 Martin Storsjo * Copyright (c) 2013 Anssi Hannula + * Copyright (c) 2020 Nachiket Tarate * * This file is part of FFmpeg. * @@ -39,6 +40,8 @@ #include "avio_internal.h" #include "id3v2.h" +#include "hls_sample_aes.h" + #define INITIAL_BUFFER_SIZE 32768 #define MAX_FIELD_LEN 64 @@ -145,6 +148,8 @@ struct playlist { int id3_changed; /* ID3 tag data has changed at some point */ ID3v2ExtraMeta *id3_deferred_extra; /* stored here until subdemuxer is opened */ +HLSAudioSetupInfo audio_setup_info; + int64_t seek_timestamp; int seek_flags; int seek_stream_index; /* into subdemuxer stream array */ @@ -1015,10 +1020,11 @@ static int read_from_url(struct playlist *pls, struct segment *seg, /* Parse the raw ID3 data and pass contents to caller */ static void parse_id3(AVFormatContext *s, AVIOContext *pb, - AVDictionary **metadata, int64_t *dts, + AVDictionary **metadata, int64_t *dts, HLSAudioSetupInfo *audio_setup_info, ID3v2ExtraMetaAPIC **apic, ID3v2ExtraMeta **extra_meta) { static const char id3_priv_owner_ts[] = "com.apple.streaming.transportStreamTimestamp"; +static const char id3_priv_owner_audio_setup[] = "com.apple.streaming.audioDescription"; ID3v2ExtraMeta *meta; ff_id3v2_read_dict(pb, metadata, ID3v2_DEFAULT_MAGIC, extra_meta); @@ -1034,6 +1040,9 @@ static void parse_id3(AVFormatContext *s, AVIOContext *pb, else av_log(s, AV_LOG_ERROR, "Invalid HLS ID3 audio timestamp %"PRId64"\n", ts); } +else if (priv->datasize >= 8 && !strcmp(priv->owner, id3_priv_owner_audio_setup)) { +ff_hls_read_audio_setup_info(audio_setup_info, priv->data, priv->datasize); +} } else if (!strcmp(meta->tag, "APIC") && apic) *apic = >data.apic; } @@ -1076,7 +1085,7 @@ static void handle_id3(AVIOContext *pb, struct playlist *pls) ID3v2ExtraMeta *extra_meta = NULL; int64_t timestamp = AV_NOPTS_VALUE; -parse_id3(pls->ctx, pb, , , , _meta); +parse_id3(pls->ctx, pb, , , >audio_setup_info, , _meta); if (timestamp != AV_NOPTS_VALUE) { pls->id3_mpegts_timestamp = timestamp; @@ -1230,10 +1239,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, av_log(pls->parent, AV_LOG_VERBOSE, "HLS request for url '%s', offset %"PRId64", playlist %d\n", seg->url, seg->url_offset, pls->index); -if (seg->key_type == KEY_NONE) { -ret = open_url(pls->parent, in, seg->url, >avio_opts, opts, _http); -} else if (seg->key_type == KEY_AES_128) { -char iv[33], key[33], url[MAX_URL_SIZE]; +if (seg->key_type == KEY_AES_128 || seg->key_type == KEY_SAMPLE_AES) { if (strcmp(seg->key, pls->key_url)) { AVIOContext *pb = NULL; if (open_url(pls->parent, , seg->key, >avio_opts, opts, NULL) == 0) { @@ -1249,6 +1255,10 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, } av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url)); } +} + +if (seg->key_type == KEY_AES_128) { +char iv[33], key[33], url[MAX_URL_SIZE]; ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0); ff_data_to_hex(key, pls->key, sizeof(pls->key), 0); iv[32] = key[32] = '\0'; @@ -1265,14 +1275,9 @@ static int open_input(HLSContext *c, struct playlist *pls,
Re: [FFmpeg-devel] [PATCH] libavformat/avidec: check memory allocation
On Tue, Oct 13, 2020 at 02:22:25PM +1100, Chris Miceli wrote: > Memory allocation for AVIOContext should be checked. In this code, > all error conditions are sent to the "goto error". > --- > libavformat/avidec.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many that live deserve death. And some that die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the very wise cannot see all ends. -- Gandalf signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avcodec/cri: Check for end of image in unpack_10bit()
Fixes: out of array write Fixes: 26242/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CRI_fuzzer-5161495882891264 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/cri.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/libavcodec/cri.c b/libavcodec/cri.c index 3aad76a008..dafbc1f1be 100644 --- a/libavcodec/cri.c +++ b/libavcodec/cri.c @@ -87,54 +87,72 @@ static void unpack_10bit(GetByteContext *gb, uint16_t *dst, int shift, dst[pos] = (((a0 >> 1) & 0xE00) | (a0 & 0x1FF)) << shift; pos++; if (pos >= w) { +if (count == 1) +break; dst += stride; pos = 0; } dst[pos] = (((a0 >> 13) & 0x3F) | ((a0 >> 14) & 0xFC0)) << shift; pos++; if (pos >= w) { +if (count == 2) +break; dst += stride; pos = 0; } dst[pos] = (((a0 >> 26) & 7) | ((a1 & 0x1FF) << 3)) << shift; pos++; if (pos >= w) { +if (count == 3) +break; dst += stride; pos = 0; } dst[pos] = (((a1 >> 10) & 0x1FF) | ((a1 >> 11) & 0xE00)) << shift; pos++; if (pos >= w) { +if (count == 4) +break; dst += stride; pos = 0; } dst[pos] = (((a1 >> 23) & 0x3F) | ((a2 & 0x3F) << 6)) << shift; pos++; if (pos >= w) { +if (count == 5) +break; dst += stride; pos = 0; } dst[pos] = (((a2 >> 7) & 0xFF8) | ((a2 >> 6) & 7)) << shift; pos++; if (pos >= w) { +if (count == 6) +break; dst += stride; pos = 0; } dst[pos] = (((a3 & 7) << 9) | ((a2 >> 20) & 0x1FF)) << shift; pos++; if (pos >= w) { +if (count == 7) +break; dst += stride; pos = 0; } dst[pos] = (((a3 >> 4) & 0xFC0) | ((a3 >> 3) & 0x3F)) << shift; pos++; if (pos >= w) { +if (count == 8) +break; dst += stride; pos = 0; } dst[pos] = (((a3 >> 16) & 7) | ((a3 >> 17) & 0xFF8)) << shift; pos++; if (pos >= w) { +if (count == 9) +break; dst += stride; pos = 0; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: fix writing to bytestream on BE arches
On Thu, 15. Oct 16:06, Andreas Rheinhardt wrote: > Andriy Gelman: > > From: Andriy Gelman > > > > Fixes fate-binsub-movtextenc on PPC64 > > > > Currently tags are written in reverse order on BE arches. This is fixed > > by using MKBETAG() and AV_RB32() to be arch agnostics. > > > > Also s->font_count is of type int. On BE arches with 32bit int, > > count = AV_RB16(>font_count) will read two most significant bytes > > instead of the least signifcant bytes. This is fixed by assiging > > s->font_count to count first. > > > > The final change is modyfying the type of len. On BE arches > > the most signifanct byte of the int was written instead of the least > > significant byte. > > > > Signed-off-by: Andriy Gelman > > --- > > libavcodec/movtextenc.c | 17 +++-- > > 1 file changed, 11 insertions(+), 6 deletions(-) > > > > diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c > > index b2368b641b..f38cd9cba2 100644 > > --- a/libavcodec/movtextenc.c > > +++ b/libavcodec/movtextenc.c > > @@ -116,6 +116,7 @@ static void encode_styl(MovTextContext *s, uint32_t > > tsmb_type) > > if ((s->box_flags & STYL_BOX) && s->count) { > > tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD; > > tsmb_size = AV_RB32(_size); > > +tsmb_type = AV_RB32(_type); > > style_entries = AV_RB16(>count); > > /*The above three attributes are hard coded for now > > but will come from ASS style in the future*/ > > @@ -149,6 +150,7 @@ static void encode_hlit(MovTextContext *s, uint32_t > > tsmb_type) > > if (s->box_flags & HLIT_BOX) { > > tsmb_size = 12; > > tsmb_size = AV_RB32(_size); > > +tsmb_type = AV_RB32(_type); > > start = AV_RB16(>hlit.start); > > end = AV_RB16(>hlit.end); > > av_bprint_append_any(>buffer, _size, 4); > > @@ -164,6 +166,7 @@ static void encode_hclr(MovTextContext *s, uint32_t > > tsmb_type) > > if (s->box_flags & HCLR_BOX) { > > tsmb_size = 12; > > tsmb_size = AV_RB32(_size); > > +tsmb_type = AV_RB32(_type); > > color = AV_RB32(>hclr.color); > > av_bprint_append_any(>buffer, _size, 4); > > av_bprint_append_any(>buffer, _type, 4); > > @@ -172,9 +175,9 @@ static void encode_hclr(MovTextContext *s, uint32_t > > tsmb_type) > > } > > > > static const Box box_types[] = { > > -{ MKTAG('s','t','y','l'), encode_styl }, > > -{ MKTAG('h','l','i','t'), encode_hlit }, > > -{ MKTAG('h','c','l','r'), encode_hclr }, > > +{ MKBETAG('s','t','y','l'), encode_styl }, > > +{ MKBETAG('h','l','i','t'), encode_hlit }, > > +{ MKBETAG('h','c','l','r'), encode_hclr }, > > }; > > > > const static size_t box_count = FF_ARRAY_ELEMS(box_types); > > @@ -316,14 +319,16 @@ static int encode_sample_description(AVCodecContext > > *avctx) > > // FontTableBox { > > tsmb_size = SIZE_ADD + 3 * s->font_count + font_names_total_len; > > tsmb_size = AV_RB32(_size); > > -tsmb_type = MKTAG('f','t','a','b'); > > -count = AV_RB16(>font_count); > > +tsmb_type = MKBETAG('f','t','a','b'); > > +tsmb_type = AV_RB32(_type); > > +count = s->font_count; > > +count = AV_RB16(); > > av_bprint_append_any(>buffer, _size, 4); > > av_bprint_append_any(>buffer, _type, 4); > > av_bprint_append_any(>buffer, , 2); > > // FontRecord { > > for (i = 0; i < s->font_count; i++) { > > -int len; > > +uint8_t len; > > fontID = i + 1; > > fontID = AV_RB16(); > > av_bprint_append_any(>buffer, , 2); > > > I have sent an alternative version that avoids this horrible way of > writing output independent of endianness by instead using small buffers > and writing the values into it via AV_WBx(). This also allows to combine > several av_bprint_append_any() calls into one. Said patch is patch #2 of > this patchset: > https://ffmpeg.org/pipermail/ffmpeg-devel/2020-October/271057.html (The > second email has not yet come through due to the mailing list's random > delay.) My patch is a smaller diff and is consistent with the style of the code. Up to maintainer but I'd suggest your changes are a separate patch. -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1] lavf/url: fix rel path’s query string contains :/
From: "ruiquan.crq" Signed-off-by: ruiquan.crq --- libavformat/tests/url.c | 1 + libavformat/url.c | 10 +++--- tests/ref/fate/url | 4 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c index 2440ae08bc..c294795fa2 100644 --- a/libavformat/tests/url.c +++ b/libavformat/tests/url.c @@ -90,6 +90,7 @@ int main(void) test_decompose("http://[::1]/dev/null;); test_decompose("http://[::1]:8080/dev/null;); test_decompose("//ffmpeg/dev/null"); +test_decompose("test?url=http://server/path;); printf("Testing ff_make_absolute_url:\n"); test(NULL, "baz"); diff --git a/libavformat/url.c b/libavformat/url.c index 3c858f0257..2f7aa37e78 100644 --- a/libavformat/url.c +++ b/libavformat/url.c @@ -88,7 +88,7 @@ static const char *find_delim(const char *delim, const char *cur, const char *en int ff_url_decompose(URLComponents *uc, const char *url, const char *end) { -const char *cur, *aend, *p; +const char *cur, *aend, *p, *tq; av_assert0(url); if (!end) @@ -98,8 +98,12 @@ int ff_url_decompose(URLComponents *uc, const char *url, const char *end) /* scheme */ uc->scheme = cur; p = find_delim(":/", cur, end); /* lavf "schemes" can contain options */ -if (*p == ':') -cur = p + 1; +if (*p == ':') { +tq = find_delim("?", cur, end); +if (*tq != '?' || p < tq) { /* not contain "?", or ":/" before "?" */ +cur = p + 1; +} +} /* authority */ uc->authority = cur; diff --git a/tests/ref/fate/url b/tests/ref/fate/url index 7e6395c47b..a9db0251f1 100644 --- a/tests/ref/fate/url +++ b/tests/ref/fate/url @@ -43,6 +43,10 @@ http://[::1]:8080/dev/null => host: ffmpeg path: /dev/null +test?url=http://server/path => + path: test + query: ?url=http://server/path + Testing ff_make_absolute_url: (null) baz => baz /foo/bar baz => /foo/baz -- 2.24.1 (Apple Git-126) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: fix writing to bytestream on BE arches
Andriy Gelman: > From: Andriy Gelman > > Fixes fate-binsub-movtextenc on PPC64 > > Currently tags are written in reverse order on BE arches. This is fixed > by using MKBETAG() and AV_RB32() to be arch agnostics. > > Also s->font_count is of type int. On BE arches with 32bit int, > count = AV_RB16(>font_count) will read two most significant bytes > instead of the least signifcant bytes. This is fixed by assiging > s->font_count to count first. > > The final change is modyfying the type of len. On BE arches > the most signifanct byte of the int was written instead of the least > significant byte. > > Signed-off-by: Andriy Gelman > --- > libavcodec/movtextenc.c | 17 +++-- > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c > index b2368b641b..f38cd9cba2 100644 > --- a/libavcodec/movtextenc.c > +++ b/libavcodec/movtextenc.c > @@ -116,6 +116,7 @@ static void encode_styl(MovTextContext *s, uint32_t > tsmb_type) > if ((s->box_flags & STYL_BOX) && s->count) { > tsmb_size = s->count * STYLE_RECORD_SIZE + SIZE_ADD; > tsmb_size = AV_RB32(_size); > +tsmb_type = AV_RB32(_type); > style_entries = AV_RB16(>count); > /*The above three attributes are hard coded for now > but will come from ASS style in the future*/ > @@ -149,6 +150,7 @@ static void encode_hlit(MovTextContext *s, uint32_t > tsmb_type) > if (s->box_flags & HLIT_BOX) { > tsmb_size = 12; > tsmb_size = AV_RB32(_size); > +tsmb_type = AV_RB32(_type); > start = AV_RB16(>hlit.start); > end = AV_RB16(>hlit.end); > av_bprint_append_any(>buffer, _size, 4); > @@ -164,6 +166,7 @@ static void encode_hclr(MovTextContext *s, uint32_t > tsmb_type) > if (s->box_flags & HCLR_BOX) { > tsmb_size = 12; > tsmb_size = AV_RB32(_size); > +tsmb_type = AV_RB32(_type); > color = AV_RB32(>hclr.color); > av_bprint_append_any(>buffer, _size, 4); > av_bprint_append_any(>buffer, _type, 4); > @@ -172,9 +175,9 @@ static void encode_hclr(MovTextContext *s, uint32_t > tsmb_type) > } > > static const Box box_types[] = { > -{ MKTAG('s','t','y','l'), encode_styl }, > -{ MKTAG('h','l','i','t'), encode_hlit }, > -{ MKTAG('h','c','l','r'), encode_hclr }, > +{ MKBETAG('s','t','y','l'), encode_styl }, > +{ MKBETAG('h','l','i','t'), encode_hlit }, > +{ MKBETAG('h','c','l','r'), encode_hclr }, > }; > > const static size_t box_count = FF_ARRAY_ELEMS(box_types); > @@ -316,14 +319,16 @@ static int encode_sample_description(AVCodecContext > *avctx) > // FontTableBox { > tsmb_size = SIZE_ADD + 3 * s->font_count + font_names_total_len; > tsmb_size = AV_RB32(_size); > -tsmb_type = MKTAG('f','t','a','b'); > -count = AV_RB16(>font_count); > +tsmb_type = MKBETAG('f','t','a','b'); > +tsmb_type = AV_RB32(_type); > +count = s->font_count; > +count = AV_RB16(); > av_bprint_append_any(>buffer, _size, 4); > av_bprint_append_any(>buffer, _type, 4); > av_bprint_append_any(>buffer, , 2); > // FontRecord { > for (i = 0; i < s->font_count; i++) { > -int len; > +uint8_t len; > fontID = i + 1; > fontID = AV_RB16(); > av_bprint_append_any(>buffer, , 2); > I have sent an alternative version that avoids this horrible way of writing output independent of endianness by instead using small buffers and writing the values into it via AV_WBx(). This also allows to combine several av_bprint_append_any() calls into one. Said patch is patch #2 of this patchset: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-October/271057.html (The second email has not yet come through due to the mailing list's random delay.) - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avcodec/movtextenc: Fix potential use of unitialized value
Background colour was never initialized if no style was available. Use a sane default of zero (i.e. completely transparent). Signed-off-by: Andreas Rheinhardt --- libavcodec/movtextenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/movtextenc.c b/libavcodec/movtextenc.c index b2368b641b..00ebca2e56 100644 --- a/libavcodec/movtextenc.c +++ b/libavcodec/movtextenc.c @@ -202,7 +202,7 @@ static int encode_sample_description(AVCodecContext *avctx) ASS * ass; ASSStyle * style; int i, j; -uint32_t tsmb_size, tsmb_type, back_color, style_color; +uint32_t tsmb_size, tsmb_type, back_color = 0, style_color; uint16_t style_start, style_end, fontID, count; int font_names_total_len = 0; MovTextContext *s = avctx->priv_data; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".