Re: [FFmpeg-devel] [PATCH 02/14] avformat/matroska: clean the structure formatting
On Sun, Mar 22, 2020 at 09:59:21 +0100, Steve Lhomme wrote: > Always use a comma at the end, order elements by value. IIUC, this is strictly a C99(+) "feature", so should probably be mentioned here: https://ffmpeg.org/developer.html#C-language-features in case "all compilers we care about" support this. (Yes, I am aware that many other enums in said file already are formatted thus.) Deeply into nitpick country, ;-) Moritz ___ 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/wavpack: Prevent frame format from being wrong
Quoting Michael Niedermayer (2020-03-24 01:41:24) > On Mon, Mar 23, 2020 at 05:49:06PM +0100, Anton Khirnov wrote: > > Quoting Michael Niedermayer (2020-03-20 21:50:18) > > > On Fri, Mar 20, 2020 at 10:18:49AM +0100, Anton Khirnov wrote: > > > > Quoting Michael Niedermayer (2020-03-20 01:03:36) > > > > > Fixes: out of array access > > > > > Fixes: > > > > > 21193/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5125168956702720 > > > > > > > > > > Found-by: continuous fuzzing process > > > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > > > > Signed-off-by: Michael Niedermayer > > > > > --- > > > > > libavcodec/wavpack.c | 1 + > > > > > 1 file changed, 1 insertion(+) > > > > > > > > > > diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c > > > > > index b27262b94e..e9c870e41e 100644 > > > > > --- a/libavcodec/wavpack.c > > > > > +++ b/libavcodec/wavpack.c > > > > > @@ -1488,6 +1488,7 @@ static int wavpack_decode_block(AVCodecContext > > > > > *avctx, int block_no, > > > > > > > > > > /* get output buffer */ > > > > > wc->curr_frame.f->nb_samples = s->samples; > > > > > +wc->curr_frame.f->format = avctx->sample_fmt; > > > > > > > > How does this have any effect? curr_frame.f should now be clean and get > > > > initialized from avctx->sample_fmt. > > > > > > IIRC > > > The format changes between frames, so the struct is still set to the one > > > from the previous frame and that overrides the use of the avctx value > > > > > > setting it to NONE (here or somewhere else) should work too. > > > > ff_thread_release_buffer() is called on that frame immediately before, > > which should reset it to defaults (setting format to FMT_NONE). > > ff_thread_release_buffer() does not reset it in all cases Then I would say that is the bug that should be fixed. ff_thread_release_buffer() should have the same semantics as av_frame_unref() and always reset the frame to a clean state. -- Anton Khirnov ___ 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 13/18] h264_sei: parse the picture timing SEIs correctly
Quoting Kieran Kunhya (2020-03-23 22:34:59) > > > > I don't think you read that section carefully enough. What it says (in > > my interpretation) is that an SPS can be activated only by: > > - buffering period SEI > > - a PPS (which is itself activated by picture data) > > Picture timing SEI is neither of those. > > > > The contents of pic-struct do not affect activation but have dependent > syntax elements. > So for example a Buffering Period SEI could activate an SPS and then > followed by pic-struct and pic struct would then have a dependency on the > activated SPS. > This SPS could be different to the one the VCL data refers to. I think > there are other corner cases as well. I don't think it could be different. The active SPS must not change in a sequence and the SEI messages are all a part of the same sequence as the coded pictures the belong to. So even if there was an buffering period SEI that activates some SPS, it has to be the same SPS that will be used for decoding the slices. -- Anton Khirnov ___ 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 14/18] h264_ps: make the PPS hold a reference to its SPS
Quoting Andreas Rheinhardt (2020-03-23 23:08:14) > Anton Khirnov: > > Quoting James Almer (2020-03-18 17:05:38) > >> On 3/13/2020 7:28 AM, Anton Khirnov wrote: > >>> It represents the relationship between them more naturally and will be > >>> useful in the following commits. > >>> > >>> Allows significantly more frames in fate-h264-attachment-631 to be > >>> decoded. > >> > >> That sample is odd. It has an SPS/PPS pair in extradata that's wrong for > >> the Buffering Period and Picture Timing SEI messages in-band, but > >> seemingly correct to actually decode all these frames revealed by this > >> patch. > >> The SPS that makes the aforementioned SEI messages parseable, but the > >> frames seemingly undecodeable, is in-band in the second RAP (Which fwiw > >> reports a different bitstream level). So this patch prevents the > >> extradata PPS from using the in-band SPS after it replaced the extradata > >> one in sps_list. There's no PPS in-band. > >> > >> Is this really intended? Is the active PPS' sps_id meant to reference > >> the SPS with that id that's currently "valid" and in sps_list, or the > >> whichever one was valid at the time the PPS was first parsed?. If the > >> latter, then why replace the SPS in-band but never the PPS? > >> The in-band SPS is virtually unused after this change. > > > > My guess would be that someone (or some/thing/, dun dun dun) did some > > botched/misunderstood processing on that sample, so trying to figure out > > what was intended is futile. > > > > According to the spec, SPS contents must not change within a sequence > > (they can change on sequence boundaries), so this sample is invalid. > > While this sample is invalid, isn't it possible to have a sample as > follows: First a SPS and a PPS referencing the SPS, then a coded video > sequence for which these SPS and PPS are active, then another IDR access > unit with a new SPS that overwrites the old one, but with no new PPS. > This is valid if I am not mistaken. With your patch, the second SPS > would never be used. Hmm, this sounds pretty crazy, but I don't see anything in the spec forbidding this. But then again, we currently parse the PPS using values from the SPS. If the SPS changed, we'd have to re-parse the PPS again using new values. Since we are not doing that, we do not support this use case anyway. -- Anton Khirnov ___ 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] avcodec/decode: Clear format on ff_get_buffer() failure
Quoting Michael Niedermayer (2020-03-24 01:41:43) > Fixes: out of array access > Fixes: > 21193/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5125168956702720 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/decode.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index af6bb3f952..fb22ef0ef3 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -1972,6 +1972,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame > *frame, int flags) > if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); > frame->width = frame->height = 0; > +frame->format = -1; This looks ad-hoc. And also unnecessary, since get_buffer_internal() is already calling av_frame_unref() on failure. Seems it's just missing the cleanup goto on ff_decode_frame_props() failure. -- Anton Khirnov ___ 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 2/4] avcodec/pgssubdec: replace data_size with got_sub_ptr for better readability
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/pgssubdec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c index 7fadcb8b4b..9c59a2297f 100644 --- a/libavcodec/pgssubdec.c +++ b/libavcodec/pgssubdec.c @@ -614,7 +614,7 @@ FF_ENABLE_DEPRECATION_WARNINGS return 1; } -static int decode(AVCodecContext *avctx, void *data, int *data_size, +static int decode(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; @@ -636,7 +636,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, if (i & 15) ff_dlog(avctx, "\n"); -*data_size = 0; +*got_sub_ptr = 0; /* Ensure that we have received at a least a segment code and segment length */ if (buf_size < 3) @@ -676,14 +676,14 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, */ break; case DISPLAY_SEGMENT: -if (*data_size) { +if (*got_sub_ptr) { av_log(avctx, AV_LOG_ERROR, "Duplicate display segment\n"); ret = AVERROR_INVALIDDATA; break; } ret = display_end_segment(avctx, data, buf, segment_length); if (ret >= 0) -*data_size = ret; +*got_sub_ptr = ret; break; default: av_log(avctx, AV_LOG_ERROR, "Unknown subtitle segment type 0x%x, length %d\n", @@ -693,7 +693,7 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, } if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) { avsubtitle_free(data); -*data_size = 0; +*got_sub_ptr = 0; return ret; } -- 2.21.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".
[FFmpeg-devel] [PATCH v1 3/4] avcodec/libzvbi-teletextdec: replace data_size with got_sub_ptr for better readability
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/libzvbi-teletextdec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libzvbi-teletextdec.c b/libavcodec/libzvbi-teletextdec.c index fe6504ff8a..8031b02286 100644 --- a/libavcodec/libzvbi-teletextdec.c +++ b/libavcodec/libzvbi-teletextdec.c @@ -636,7 +636,7 @@ static int slice_to_vbi_lines(TeletextContext *ctx, uint8_t* buf, int size) return lines; } -static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *pkt) +static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *pkt) { TeletextContext *ctx = avctx->priv_data; AVSubtitle *sub = data; @@ -724,9 +724,9 @@ FF_ENABLE_DEPRECATION_WARNINGS ctx->nb_pages--; if (ret >= 0) -*data_size = 1; +*got_sub_ptr = 1; } else -*data_size = 0; +*got_sub_ptr = 0; return ret; } -- 2.21.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".
[FFmpeg-devel] [PATCH v1 4/4] avcodec/dvbsubdec: replace data_size with got_sub_ptr for better readability
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/dvbsubdec.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 6e7e13b6eb..f63a1f3bf6 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1610,7 +1610,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf, } static int dvbsub_decode(AVCodecContext *avctx, - void *data, int *data_size, + void *data, int *got_sub_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; @@ -1668,7 +1668,7 @@ static int dvbsub_decode(AVCodecContext *avctx, int ret = 0; switch (segment_type) { case DVBSUB_PAGE_SEGMENT: -ret = dvbsub_parse_page_segment(avctx, p, segment_length, sub, data_size); +ret = dvbsub_parse_page_segment(avctx, p, segment_length, sub, got_sub_ptr); got_segment |= 1; break; case DVBSUB_REGION_SEGMENT: @@ -1690,7 +1690,7 @@ static int dvbsub_decode(AVCodecContext *avctx, got_dds = 1; break; case DVBSUB_DISPLAY_SEGMENT: -ret = dvbsub_display_end_segment(avctx, p, segment_length, sub, data_size); +ret = dvbsub_display_end_segment(avctx, p, segment_length, sub, got_sub_ptr); if (got_segment == 15 && !got_dds && !avctx->width && !avctx->height) { // Default from ETSI EN 300 743 V1.3.1 (7.2.1) avctx->width = 720; @@ -1713,12 +1713,12 @@ static int dvbsub_decode(AVCodecContext *avctx, // segments then we need no further data. if (got_segment == 15) { av_log(avctx, AV_LOG_DEBUG, "Missing display_end_segment, emulating\n"); -dvbsub_display_end_segment(avctx, p, 0, sub, data_size); +dvbsub_display_end_segment(avctx, p, 0, sub, got_sub_ptr); } end: if(ret < 0) { -*data_size = 0; +*got_sub_ptr = 0; avsubtitle_free(sub); return ret; } else { -- 2.21.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".
[FFmpeg-devel] [PATCH v1 1/4] avcodec/xsubdec: replace data_size with got_sub_ptr for better readability
From: Limin Wang Signed-off-by: Limin Wang --- libavcodec/xsubdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c index 05c4a64ee5..c1c6e11dc3 100644 --- a/libavcodec/xsubdec.c +++ b/libavcodec/xsubdec.c @@ -46,7 +46,7 @@ static int64_t parse_timecode(const uint8_t *buf, int64_t packet_time) { return ms - packet_time; } -static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, +static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; @@ -169,7 +169,7 @@ FF_ENABLE_DEPRECATION_WARNINGS bitmap += w; align_get_bits(&gb); } -*data_size = 1; +*got_sub_ptr = 1; return buf_size; } -- 2.21.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 1/2] avcodec: add support for Cunning Developments' ADPCM
On Mon, 23 Mar 2020 19:24:27 +0100 "Michael Niedermayer" wrote: > > + > > +const int16_t ff_adpcm_ima_cunning_index_table[8] = { > > +-1, -1, -1, -1, 1, 2, 3, 4, > > +}; > > this could be int8_t > Thanks, fixed. Will send a follow-up patch shortly. > 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 v4 2/2] avformat: add demuxer for Pro Pinball Series' Soundbanks
Signed-off-by: Zane van Iperen --- Changelog| 1 + libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/pp_bnk.c | 229 +++ libavformat/version.h| 2 +- 5 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 libavformat/pp_bnk.c diff --git a/Changelog b/Changelog index 927dc89c51..0970bfb11e 100644 --- a/Changelog +++ b/Changelog @@ -55,6 +55,7 @@ version : - CRI HCA decoder - CRI HCA demuxer - Cunning Developments ADPCM decoder +- Pro Pinball Series Soundbank demuxer version 4.2: diff --git a/libavformat/Makefile b/libavformat/Makefile index 8fd0d43721..9df99133fa 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -428,6 +428,7 @@ OBJS-$(CONFIG_PCM_VIDC_DEMUXER) += pcmdec.o pcm.o OBJS-$(CONFIG_PCM_VIDC_MUXER)+= pcmenc.o rawenc.o OBJS-$(CONFIG_PJS_DEMUXER) += pjsdec.o subtitles.o OBJS-$(CONFIG_PMP_DEMUXER) += pmpdec.o +OBJS-$(CONFIG_PP_BNK_DEMUXER)+= pp_bnk.o OBJS-$(CONFIG_PVA_DEMUXER) += pva.o OBJS-$(CONFIG_PVF_DEMUXER) += pvfdec.o pcm.o OBJS-$(CONFIG_QCP_DEMUXER) += qcp.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 39d2c352f5..3919c9e4c1 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -341,6 +341,7 @@ extern AVInputFormat ff_pcm_u8_demuxer; extern AVOutputFormat ff_pcm_u8_muxer; extern AVInputFormat ff_pjs_demuxer; extern AVInputFormat ff_pmp_demuxer; +extern AVInputFormat ff_pp_bnk_demuxer; extern AVOutputFormat ff_psp_muxer; extern AVInputFormat ff_pva_demuxer; extern AVInputFormat ff_pvf_demuxer; diff --git a/libavformat/pp_bnk.c b/libavformat/pp_bnk.c new file mode 100644 index 00..8ff3c7b7c0 --- /dev/null +++ b/libavformat/pp_bnk.c @@ -0,0 +1,229 @@ +/* + * Pro Pinball Series Soundbank (44c, 22c, 11c, 5c) demuxer. + * + * Copyright (C) 2020 Zane van Iperen (z...@zanevaniperen.com) + * + * 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 + */ +#include "avformat.h" +#include "internal.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/avassert.h" +#include "libavutil/internal.h" + +#define PP_BNK_MAX_READ_SIZE4096 +#define PP_BNK_FILE_HEADER_SIZE 20 +#define PP_BNK_TRACK_SIZE 20 + +typedef struct PPBnkHeader { +uint32_tbank_id;/*< Bank ID, useless for our purposes. */ +uint32_tsample_rate;/*< Sample rate of the contained tracks. */ +uint32_talways1;/*< Unknown, always seems to be 1. */ +uint32_ttrack_count;/*< Number of tracks in the file. */ +uint32_tunknown;/*< Possibly flags. 2 == music, 0 == sfx? */ +} PPBnkHeader; + +typedef struct PPBnkTrack { +uint32_tid; /*< Track ID. Usually track[i].id == track[i-1].id + 1, but not always */ +uint32_tsize; /*< Size of the data in bytes. */ +uint32_tsample_rate;/*< Sample rate. */ +uint32_talways1_1; /*< Unknown, always seems to be 1. */ +uint32_talways1_2; /*< Unknown, always seems to be 1. */ +} PPBnkTrack; + +typedef struct PPBnkCtxTrack { +int64_t data_offset; +uint32_tdata_size; +} PPBnkCtxTrack; + +typedef struct PPBnkCtx { +int track_count; +PPBnkCtxTrack *tracks; +uint32_tcurrent_track; +uint32_tbytes_read; +} PPBnkCtx; + +static void pp_bnk_parse_header(PPBnkHeader *hdr, const uint8_t *buf) +{ +hdr->bank_id= AV_RL32(buf + 0); +hdr->sample_rate= AV_RL32(buf + 4); +hdr->always1= AV_RL32(buf + 8); +hdr->track_count= AV_RL32(buf + 12); +hdr->unknown= AV_RL32(buf + 16); +} + +static void pp_bnk_parse_track(PPBnkTrack *trk, const uint8_t *buf) +{ +trk->id = AV_RL32(buf + 0); +trk->size = AV_RL32(buf + 4); +trk->sample_rate= AV_RL32(buf + 8); +trk->always1_1 = AV_RL32(buf + 12); +trk->always1_2 = AV_RL32(buf + 16); +} + +static int pp_bnk_read_header(AVFormatContext *s) +{ +int ret; +AVStream *st; +AVCodecParameters *par; +PPBnkCtx *ctx = s->priv
[FFmpeg-devel] [PATCH v4 1/2] avcodec: add support for Cunning Developments' ADPCM
Signed-off-by: Zane van Iperen --- Changelog | 1 + doc/general.texi| 1 + libavcodec/Makefile | 1 + libavcodec/adpcm.c | 33 + libavcodec/adpcm_data.c | 13 + libavcodec/adpcm_data.h | 2 ++ libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h| 1 + libavcodec/codec_desc.c | 7 +++ libavcodec/version.h| 2 +- 10 files changed, 61 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 711861bda9..927dc89c51 100644 --- a/Changelog +++ b/Changelog @@ -54,6 +54,7 @@ version : - DERF demuxer - CRI HCA decoder - CRI HCA demuxer +- Cunning Developments ADPCM decoder version 4.2: diff --git a/doc/general.texi b/doc/general.texi index 752618a00b..dc847c577c 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -1099,6 +1099,7 @@ following image formats are supported: @item ADPCM G.726@tab X @tab X @item ADPCM IMA AMV @tab @tab X @tab Used in AMV files +@item ADPCM IMA Cunning Developments @tab @tab X @item ADPCM IMA Electronic Arts EACS @tab @tab X @item ADPCM IMA Electronic Arts SEAD @tab @tab X @item ADPCM IMA Funcom @tab @tab X diff --git a/libavcodec/Makefile b/libavcodec/Makefile index c1c9a44f2b..e799077f09 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -839,6 +839,7 @@ OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_ALP_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_APM_DECODER) += adpcm.o adpcm_data.o +OBJS-$(CONFIG_ADPCM_IMA_CUNNING_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DAT4_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DK3_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DK4_DECODER) += adpcm.o adpcm_data.o diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index e9abddc43c..89c4572538 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -16,6 +16,7 @@ * Simon & Schuster Interactive ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com) * Ubisoft ADPCM decoder by Zane van Iperen (z...@zanevaniperen.com) * High Voltage Software ALP decoder by Zane van Iperen (z...@zanevaniperen.com) + * Cunning Developments decoder by Zane van Iperen (z...@zanevaniperen.com) * * This file is part of FFmpeg. * @@ -109,6 +110,9 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) unsigned int max_channels = 2; switch(avctx->codec->id) { +case AV_CODEC_ID_ADPCM_IMA_CUNNING: +max_channels = 1; +break; case AV_CODEC_ID_ADPCM_DTK: case AV_CODEC_ID_ADPCM_EA: min_channels = 2; @@ -325,6 +329,26 @@ static inline int16_t adpcm_ima_mtf_expand_nibble(ADPCMChannelStatus *c, int nib return (int16_t)c->predictor; } +static inline int16_t adpcm_ima_cunning_expand_nibble(ADPCMChannelStatus *c, int8_t nibble) +{ +int step_index; +int predictor; +int step; + +nibble = sign_extend(nibble & 0xF, 4); + +step = ff_adpcm_ima_cunning_step_table[c->step_index]; +step_index = c->step_index + ff_adpcm_ima_cunning_index_table[abs(nibble)]; +step_index = av_clip(step_index, 0, 60); + +predictor = c->predictor + (step * nibble); + +c->predictor = av_clip_int16(predictor); +c->step_index = step_index; + +return (int16_t)c->predictor; +} + static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitContext *gb, int bps) { int nibble, step_index, predictor, sign, delta, diff, step, shift; @@ -713,6 +737,7 @@ static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, /* simple 4-bit adpcm */ case AV_CODEC_ID_ADPCM_CT: case AV_CODEC_ID_ADPCM_IMA_APC: +case AV_CODEC_ID_ADPCM_IMA_CUNNING: case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: case AV_CODEC_ID_ADPCM_IMA_OKI: case AV_CODEC_ID_ADPCM_IMA_WS: @@ -1304,6 +1329,13 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, samples += avctx->channels; } break; +case AV_CODEC_ID_ADPCM_IMA_CUNNING: +while (bytestream2_get_bytes_left(&gb) > 0) { +int v = bytestream2_get_byteu(&gb); +*samples++ = adpcm_ima_cunning_expand_nibble(&c->status[0], v & 0x0F); +*samples++ = adpcm_ima_cunning_expand_nibble(&c->status[0], v >> 4); +} +break; case AV_CODEC_ID_ADPCM_IMA_OKI: while (bytestream2_get_bytes_left(&gb) > 0) { int v = bytestream2_get_byteu(&gb); @@ -2053,6 +2085,7 @@ ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_XAS, sample_fmts_s16p, adpcm_ea_xas, ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_AMV, sample_fmts_s16, adpcm_ima_amv, "ADPCM IMA AMV"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APC, sample_fmts_s16, adpcm_ima_apc, "ADPCM IMA CRYO APC"); ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APM, sam
[FFmpeg-devel] [PATCH v4 0/2] [PATCH v3 0/2] Pro Pinball Series Soundbank demuxer + decoder.
Adds support for the soundbank files used by the Pro Pinball series of games. v4: - fix adpcm index table type v3: - fix potential memory leak if read_header() fails - fix a buffer overread - attempt seek before updating state - remove unneeded check - naming fixes v2: - Add sanity checks in header fields - Formatting and comment fixes - Change the struct names to match the files Zane van Iperen (2): avcodec: add support for Cunning Developments' ADPCM avformat: add demuxer for Pro Pinball Series' Soundbanks Changelog| 2 + doc/general.texi | 1 + libavcodec/Makefile | 1 + libavcodec/adpcm.c | 33 ++ libavcodec/adpcm_data.c | 13 +++ libavcodec/adpcm_data.h | 2 + libavcodec/allcodecs.c | 1 + libavcodec/avcodec.h | 1 + libavcodec/codec_desc.c | 7 ++ libavcodec/version.h | 2 +- libavformat/Makefile | 1 + libavformat/allformats.c | 1 + libavformat/pp_bnk.c | 229 +++ libavformat/version.h| 2 +- 14 files changed, 294 insertions(+), 2 deletions(-) create mode 100644 libavformat/pp_bnk.c -- 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] doc/general.texi: AviSynth+ works on Linux now, AvxSynth is gone.
Related to this are the following changes: * Mention the two methods that AviSynth+ provides for installing just the headers. * Expand on users installing AviSynth on their system a little more. --- This is the only patch that needed changes. I'll just ping the other three. doc/general.texi | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/general.texi b/doc/general.texi index 3684847ac1..5f0f1b2ad1 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -50,16 +50,18 @@ This driver can be installed using amdgpu-pro-install script in official amd dri @section AviSynth FFmpeg can read AviSynth scripts as input. To enable support, pass -@code{--enable-avisynth} to configure. The correct headers are -included in compat/avisynth/, which allows the user to enable support -without needing to search for these headers themselves. +@code{--enable-avisynth} to configure after installing the headers +provided by @url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}. +AviSynth+ can be configured to install only the headers by either +passing `-DHEADERS_ONLY:bool=on` to the normal CMake-based build +system, or by using the supplied @code{GNUmakefile}. For Windows, supported AviSynth variants are @url{http://avisynth.nl, AviSynth 2.6 RC1 or higher} for 32-bit builds and @url{http://avisynth.nl/index.php/AviSynth+, AviSynth+ r1718 or higher} for 32-bit and 64-bit builds. -For Linux and OS X, the supported AviSynth variant is -@url{https://github.com/avxsynth/avxsynth, AvxSynth}. +For Linux, macOS, and BSD, the only supported AviSynth variant is +@url{https://github.com/AviSynth/AviSynthPlus, AviSynth+}, starting with version 3.5. @float NOTE In 2016, AviSynth+ added support for building with GCC. However, due to @@ -77,10 +79,11 @@ GCC builds of AviSynth+ without any special flags. @end float @float NOTE -AviSynth and AvxSynth are loaded dynamically. Distributors can build FFmpeg -with @code{--enable-avisynth}, and the binaries will work regardless of the -end user having AviSynth or AvxSynth installed - they'll only need to be -installed to use AviSynth scripts (obviously). +AviSynth(+) is loaded dynamically. Distributors can build FFmpeg +with @code{--enable-avisynth}, and the binaries will work regardless +of the end user having AviSynth installed. If/when an end user +would like to use AviSynth scripts, then they can install AviSynth(+) +and FFmpeg will be able to find and use it to open scripts. @end float @section Chromaprint -- 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/4] avisynth: switch to AviSynth+ on Linux
On 3/12/20 7:38 PM, Stephen Hutchinson wrote: AviSynth+ now supports non-Windows OSes, making AvxSynth obsolete. Since we no longer support AviSynth 2.5 (which is essentially what AvxSynth is), remove AvxSynth support and replace it with AviSynth+. As a result, the USING_AVISYNTH defines can be switched back to generic _WIN32. --- libavformat/avisynth.c | 56 +++--- 1 file changed, 15 insertions(+), 41 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 55a2efd884..43b65badc9 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -1,5 +1,5 @@ /* - * AviSynth/AvxSynth support + * AviSynth(+) support * Copyright (c) 2012 AvxSynth Team * * This file is part of FFmpeg @@ -31,20 +31,19 @@ /* Enable function pointer definitions for runtime loading. */ #define AVSC_NO_DECLSPEC -/* Platform-specific directives for AviSynth vs AvxSynth. */ +/* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" #undef EXTERN_C - #include "compat/avisynth/avisynth_c.h" #define AVISYNTH_LIB "avisynth" - #define USING_AVISYNTH #else #include - #include "compat/avisynth/avxsynth_c.h" - #define AVISYNTH_NAME "libavxsynth" + #define AVISYNTH_NAME "libavisynth" #define AVISYNTH_LIB AVISYNTH_NAME SLIBSUF #endif +#include + typedef struct AviSynthLibrary { void *library; #define AVSC_DECLARE_FUNC(name) name ## _func name @@ -62,7 +61,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); AVSC_DECLARE_FUNC(avs_take_clip); -#ifdef USING_AVISYNTH AVSC_DECLARE_FUNC(avs_bits_per_pixel); AVSC_DECLARE_FUNC(avs_get_height_p); AVSC_DECLARE_FUNC(avs_get_pitch_p); @@ -70,7 +68,6 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_row_size_p); AVSC_DECLARE_FUNC(avs_is_planar_rgb); AVSC_DECLARE_FUNC(avs_is_planar_rgba); -#endif #undef AVSC_DECLARE_FUNC } AviSynthLibrary; @@ -97,14 +94,12 @@ static const int avs_planes_packed[1] = { 0 }; static const int avs_planes_grey[1] = { AVS_PLANAR_Y }; static const int avs_planes_yuv[3]= { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V }; -#ifdef USING_AVISYNTH static const int avs_planes_rgb[3]= { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R }; static const int avs_planes_yuva[4] = { AVS_PLANAR_Y, AVS_PLANAR_U, AVS_PLANAR_V, AVS_PLANAR_A }; static const int avs_planes_rgba[4] = { AVS_PLANAR_G, AVS_PLANAR_B, AVS_PLANAR_R, AVS_PLANAR_A }; -#endif /* A conflict between C++ global objects, atexit, and dynamic loading requires * us to register our own atexit handler to prevent double freeing. */ @@ -142,7 +137,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); LOAD_AVS_FUNC(avs_take_clip, 0); -#ifdef USING_AVISYNTH LOAD_AVS_FUNC(avs_bits_per_pixel, 1); LOAD_AVS_FUNC(avs_get_height_p, 1); LOAD_AVS_FUNC(avs_get_pitch_p, 1); @@ -150,7 +144,6 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_row_size_p, 1); LOAD_AVS_FUNC(avs_is_planar_rgb, 1); LOAD_AVS_FUNC(avs_is_planar_rgba, 1); -#endif #undef LOAD_AVS_FUNC atexit(avisynth_atexit_handler); @@ -249,7 +242,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { -#ifdef USING_AVISYNTH /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: st->codecpar->format = AV_PIX_FMT_YUV444P10; @@ -434,8 +426,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) case AVS_CS_BGR64: st->codecpar->format = AV_PIX_FMT_BGRA64; break; -#endif -/* AviSynth 2.5 and AvxSynth pix_fmts */ +/* AviSynth 2.5 pix_fmts */ case AVS_CS_BGR24: st->codecpar->format = AV_PIX_FMT_BGR24; break; @@ -461,7 +452,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) } switch (planar) { -#ifdef USING_AVISYNTH case 5: // Planar RGB + Alpha avs->n_planes = 4; avs->planes = avs_planes_rgba; @@ -474,7 +464,6 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) avs->n_planes = 3; avs->planes = avs_planes_rgb; break; -#endif case 2: // Y8 avs->n_planes = 1; avs->planes = avs_planes_grey; @@ -556,7 +545,7 @@ static int avisynth_open_file(AVFormatContext *s) AviSynthContext *avs = s->priv_data; AVS_Value arg, val; int re
Re: [FFmpeg-devel] [PATCH 1/4] compat: remove avisynth headers
On 3/12/20 7:37 PM, Stephen Hutchinson wrote: --- compat/avisynth/avisynth_c.h | 1264 - compat/avisynth/avs/capi.h| 94 -- compat/avisynth/avs/config.h | 70 - compat/avisynth/avs/types.h | 57 - compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 -- compat/avisynth/windowsPorts/windows2linux.h | 77 - configure |1 + tests/ref/fate/source |9 - 9 files changed, 1 insertion(+), 2384 deletions(-) delete mode 100644 compat/avisynth/avisynth_c.h delete mode 100644 compat/avisynth/avs/capi.h delete mode 100644 compat/avisynth/avs/config.h delete mode 100644 compat/avisynth/avs/types.h delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h deleted file mode 100644 index 9ff9321552..00 --- a/compat/avisynth/avisynth_c.h +++ /dev/null @@ -1,1264 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -// MA 02110-1301 USA, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -// NOTE: this is a partial update of the Avisynth C interface to recognize -// new color spaces added in Avisynth 2.60. By no means is this document -// completely Avisynth 2.60 compliant. -// 170103: added new CPU constants (FMA4, AVX512xx) -// 171102: define SIZETMOD. do not use yet, experimental. Offsets are size_t instead of int. Affects x64. -// 171106: avs_get_row_size calls into avs_get_row_size_p, instead of direct field access -// 171106: avs_get_height calls into avs_get_row_size_p, instead of direct field access -// 180524: AVSC_EXPORT to dllexport in capi.h for avisynth_c_plugin_init -// 180524: avs_is_same_colorspace VideoInfo parameters to const -// 181230: Readability: functions regrouped to mix less AVSC_API and AVSC_INLINE, put together Avisynth+ specific stuff -// 181230: use #ifndef AVSC_NO_DECLSPEC for AVSC_INLINE functions which are calling API functions -// 181230: comments on avs_load_library (helper for loading API entries dynamically into a struct using AVSC_NO_DECLSPEC define) -// 181230: define alias AVS_FRAME_ALIGN as FRAME_ALIGN -// 181230: remove unused form of avs_get_rowsize and avs_get_height (kept earlier for reference) -// 190104: avs_load_library: smart fallback mechanism for Avisynth+ specific functions: -// if they are not loadable, they will work in a classic Avisynth compatible mode -// Example#1: e.g. avs_is_444 will call the existing avs_is_yv24 instead -// Example#2: avs_bits_per_component will return 8 for all colorspaces (Classic Avisynth supports only 8 bits/pixel) -// Thus the Avisynth+ specific API functions are safely callable even when connected to classic Avisynth DLL - -#ifndef __AVISYNTH_C__ -#define __AVISYNTH_C__ - -#include "avs/config.h" -#include "avs/capi.h" -#include "avs/types.h" - -#define AVS_FRAME_ALIGN FRAME_ALIGN -/ -// -// Constants -// - -#ifndef __AVISYNTH_6_H__ -enum { AVISYNTH_INTERFACE_VERSION = 6 }; -#endif -
Re: [FFmpeg-devel] [PATCH 4/4] avisynth: fix deprecation warning
On 3/12/20 7:38 PM, Stephen Hutchinson wrote: --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 43b65badc9..2c08ace8db 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -555,12 +555,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ -MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4); +MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL); arg = avs_new_value_string(filename_ansi); #else -arg = avs_new_value_string(s->filename); +arg = avs_new_value_string(s->url); #endif val = avs_library.avs_invoke(avs->env, "Import", arg, 0); if (avs_is_error(val)) { Ping. ___ 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/jpeg2000dec: error check when processing tlm marker
From: Gautam Ramakrishnan Validate the value of ST field in the TLM marker of JPEG2000. Throw an error when ST takes value of 0x11. --- libavcodec/jpeg2000dec.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 019dc81f56..74d70b686f 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); ST = (Stlm >> 4) & 0x03; -// TODO: Manage case of ST = 0b11 --> raise error +if (ST == 0x11) { +av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n"); +return AVERROR_INVALIDDATA; +} + SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { -- 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] avcodec/decode: Clear format on ff_get_buffer() failure
On Tue, Mar 24, 2020 at 10:59:21AM +0100, Anton Khirnov wrote: > Quoting Michael Niedermayer (2020-03-24 01:41:43) > > Fixes: out of array access > > Fixes: > > 21193/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5125168956702720 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/decode.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > > index af6bb3f952..fb22ef0ef3 100644 > > --- a/libavcodec/decode.c > > +++ b/libavcodec/decode.c > > @@ -1972,6 +1972,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame > > *frame, int flags) > > if (ret < 0) { > > av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); > > frame->width = frame->height = 0; > > +frame->format = -1; > > This looks ad-hoc. And also unnecessary, since get_buffer_internal() is > already calling av_frame_unref() on failure. > Seems it's just missing the cleanup goto on ff_decode_frame_props() > failure. will post a patch to fix that cleanup but i have to say that i feel a bit uneasy that a fix to out of array access is "not forgetting cleanup on any path" Ill add a assert so if another path leads to this, it at least gets stoped/clearly caught. Thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates 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".
Re: [FFmpeg-devel] [PATCH 2/2] avformat/hls: Don't strdup non-null-terminated string
Steven Liu: > > >> 2020年3月22日 上午7:28,Andreas Rheinhardt 写道: >> >> Andreas Rheinhardt: >>> If an URI indicated that the data protocol was in use, it would be >>> copied into a temporary buffer via strncpy(dst, src, strlen(src)), >>> thereby ensuring that the trailing \0 would not be copied, despite dst >>> being uninitialized. dst would then be av_strdup'ed, leading to >>> potential segfaults. >>> >>> The solution to this is simple: Don't copy the URI in the temporary >>> buffer at all, instead av_strdup it directly. >>> >>> This fixes a -Wstringop-truncation warning emitted by GCC 9.2. >>> >>> Signed-off-by: Andreas Rheinhardt >>> --- >>> This is honestly untested, as this is not covered by FATE. >>> >>> libavformat/hls.c | 7 +++ >>> 1 file changed, 3 insertions(+), 4 deletions(-) >>> >>> diff --git a/libavformat/hls.c b/libavformat/hls.c >>> index 1f58e745a7..fc45719d1c 100644 >>> --- a/libavformat/hls.c >>> +++ b/libavformat/hls.c >>> @@ -403,8 +403,7 @@ static struct segment *new_init_section(struct playlist >>> *pls, >>> const char *url_base) >>> { >>> struct segment *sec; >>> -char *ptr; >>> -char tmp_str[MAX_URL_SIZE]; >>> +char tmp_str[MAX_URL_SIZE], *ptr = tmp_str; >>> >>> if (!info->uri[0]) >>> return NULL; >>> @@ -414,11 +413,11 @@ static struct segment *new_init_section(struct >>> playlist *pls, >>> return NULL; >>> >>> if (!av_strncasecmp(info->uri, "data:", 5)) { >>> -strncpy(tmp_str, info->uri, strlen(info->uri)); >>> +ptr = info->uri; >>> } else { >>> ff_make_absolute_url(tmp_str, sizeof(tmp_str), url_base, info->uri); >>> } >>> -sec->url = av_strdup(tmp_str); >>> +sec->url = av_strdup(ptr); >>> if (!sec->url) { >>> av_free(sec); >>> return NULL; >>> >> Ping. > Looks ok. >> >> - 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". > > Thanks > > Steven Liu > Applied, thanks. - 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] JPEG2000 Decoder/Encoder Enhancements
On Tue, Mar 24, 2020 at 09:42:07AM +0530, Gautam Ramakrishnan wrote: > Hi Michael, > > I do not mind spending most of the time myself. I just need a person > to go to when I have doubts. I really do not mind doing it without it > being through GSoC either. Just wanted to try contributing to the > organization. If you want to do it through gsoc and are eligible you can of course submit a proposal to google. Of course that doesnt mean that it would be selected as one of the projects. > I was thinking about starting by fixing tickets #4601 or > #4610. Would that be a good way to start? sure, also if you succeed doing one of these, that should work as qualification task. (for FFmpeg-gsoc) Or you can do all this outside gsoc and avoid any stress with qualification tasks, deadlines and evaluations and all this ... Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better. 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".
Re: [FFmpeg-devel] [PATCH 4/4] avfilter/vf_paletteuse: Forward error codes
Paul B Mahol: > lgtm > > On 1/27/20, Andreas Rheinhardt wrote: >> Signed-off-by: Andreas Rheinhardt >> --- >> libavfilter/vf_paletteuse.c | 8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c >> index 255c9d79e3..408cff786e 100644 >> --- a/libavfilter/vf_paletteuse.c >> +++ b/libavfilter/vf_paletteuse.c >> @@ -912,12 +912,12 @@ static int apply_palette(AVFilterLink *inlink, AVFrame >> *in, AVFrame **outf) >>s->last_out, out, &x, &y, &w, &h); >> av_frame_unref(s->last_in); >> av_frame_unref(s->last_out); >> -if (av_frame_ref(s->last_in, in) < 0 || >> -av_frame_ref(s->last_out, out) < 0 || >> -av_frame_make_writable(s->last_in) < 0) { >> +if ((ret = av_frame_ref(s->last_in, in)) < 0 || >> +(ret = av_frame_ref(s->last_out, out)) < 0 || >> +(ret = av_frame_make_writable(s->last_in)) < 0) { >> av_frame_free(&out); >> *outf = NULL; >> -return AVERROR(ENOMEM); >> +return ret; >> } >> >> ff_dlog(ctx, "%dx%d rect: (%d;%d) -> (%d,%d) [area:%dx%d]\n", >> -- >> 2.20.1 >> Applied, thanks. - 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] avcodec/dfa: Use array of fixed-sized strings for fixed-sized strings
Paul B Mahol: > LGTM > > On 3/18/20, Andreas Rheinhardt wrote: >> Surprisingly neither GCC nor Clang did this transformation on their own. >> >> Signed-off-by: Andreas Rheinhardt >> --- >> libavcodec/dfa.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c >> index c6106b9397..31c6c39089 100644 >> --- a/libavcodec/dfa.c >> +++ b/libavcodec/dfa.c >> @@ -332,7 +332,7 @@ static const chunk_decoder decoder[8] = { >> decode_tdlt, decode_dsw1, decode_blck, decode_dds1, >> }; >> >> -static const char * const chunk_name[8] = { >> +static const char chunk_name[8][5] = { >> "COPY", "TSW1", "BDLT", "WDLT", "TDLT", "DSW1", "BLCK", "DDS1" >> }; >> >> -- >> 2.20.1 >> Applied, thanks. - 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] avcodec/jpeg2000dec: error check when processing tlm marker
On 3/24/20, gautamr...@gmail.com wrote: > From: Gautam Ramakrishnan > > Validate the value of ST field in the TLM marker of JPEG2000. > Throw an error when ST takes value of 0x11. > --- > libavcodec/jpeg2000dec.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > index 019dc81f56..74d70b686f 100644 > --- a/libavcodec/jpeg2000dec.c > +++ b/libavcodec/jpeg2000dec.c > @@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int > n) > > // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); > ST = (Stlm >> 4) & 0x03; > -// TODO: Manage case of ST = 0b11 --> raise error > +if (ST == 0x11) { 0x11 is hex representation of 17 decimal number above is &0x03 which is 3 in decimal, this ST can never be 0x11. So patch in pointless. IF you check for 3 instead does it break any existing files? > +av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n"); > +return AVERROR_INVALIDDATA; > +} > + > SP = (Stlm >> 6) & 0x01; > tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); > for (i = 0; i < tile_tlm; i++) { > -- > 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 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/7] avformat/dss: Use AV_DICT_DONT_STRDUP_VAL to save a malloc+memcpy
Paul B Mahol: > lgtm > > On 11/10/19, Andreas Rheinhardt wrote: >> Signed-off-by: Andreas Rheinhardt >> --- >> libavformat/dss.c | 10 +++--- >> 1 file changed, 3 insertions(+), 7 deletions(-) >> >> diff --git a/libavformat/dss.c b/libavformat/dss.c >> index d7f9cafe47..8bc6af134e 100644 >> --- a/libavformat/dss.c >> +++ b/libavformat/dss.c >> @@ -103,15 +103,11 @@ static int dss_read_metadata_string(AVFormatContext >> *s, unsigned int offset, >> >> ret = avio_read(s->pb, value, size); >> if (ret < size) { >> -ret = ret < 0 ? ret : AVERROR_EOF; >> -goto exit; >> +av_free(value); >> +return ret < 0 ? ret : AVERROR_EOF; >> } >> >> -ret = av_dict_set(&s->metadata, key, value, 0); >> - >> -exit: >> -av_free(value); >> -return ret; >> +return av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); >> } >> >> static int dss_read_header(AVFormatContext *s) >> -- >> 2.20.1 >> Applied, thanks. - 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] [PATCH] POWER8 VSX vectorization libswscale/input.c Track ticket 5570
Am Di., 24. März 2020 um 14:28 Uhr schrieb Pestov Vyacheslav : > > yuy2ToY_c: 10157 > yuy2ToY_c_vsx: 2353 > > yuy2ToUV_c: 4907 > yuy2ToUV_c_vsx: 1357 > > rgb24ToY_c: 21172 > rgb24ToY_c_vsx: 9191 > > rgb24ToUV_c: 33568 > rgb24ToUV_c_vsx: 12746 > > bgr24ToY_c: 20983 > bgr24ToY_c_vsx: 9381 > > bgr24ToUV_c: 34513 > bgr24ToUV_c_vsx: 12708 > > monowhite2Y_c: 5247 > monowhite2Y_c_vsx: 2099 > > monoblack2Y_c: 5584 > monoblack2Y_c_vsx: 1993 > > uyvyToY_c: 10111 > uyvyToY_c_vsx: 1780 > > uyvyToUV_c: 4872 > uyvyToUV_c_vsx: 1284 > > nvXXtoUV_c: 5128 > nvXXtoUV_c_vsx: 1456 > > rgbaToA_c: 9930 > rgbaToA_c_vsx: 2599 > > bswap16Y_c: 10399 > bswap16Y_c_vsx: 2451 > > rgb16_32ToUV_half_c_template: 42350 > rgb16_32ToUV_half_c_template_vsx: 18583 > > bswap16UV_c: 11784 > bswap16UV_c_vsx: 2873 > > planar_rgb_to_y: 24602 > planar_rgb_to_y_vsx: 10792 > > planar_rgb_to_uv: 35601 > planar_rgb_to_uv_vsx: 14112 > > planar_rgb16_to_y: 25686 > planar_rgb16_to_y_vsx: 10293 > > planar_rgb16_to_uv: 36367 > planar_rgb16_to_uv_vsx: 13575 > > yvy2ToUV_c: 4879 > yvy2ToUV_c_vsx: 1239 > > read_ya16be_gray_c: 9591 > read_ya16be_gray_c_vsx: 4164 > > read_ya16be_alpha_c: 9390 > read_ya16be_alpha_c_vsx: 1874 > > read_ya16le_gray_c: 9884 > read_ya16le_gray_c_vsx: 4224 > > read_ya16le_alpha_c: 9403 > read_ya16le_alpha_c_vsx: 2026 > > planar_rgb_to_a: 10262 > planar_rgb_to_a_vsx: 9361 > > planar_rgb16_to_a: 9554 > planar_rgb16_to_a_vsx: 9393 > > read_ayuv64le_Y_c: 10457 > read_ayuv64le_Y_c_vsx: 7703 > > read_ayuv64le_A_c: 9404 > read_ayuv64le_A_c_vsx: 2797 > > read_ayuv64le_UV_c: 9464 > read_ayuv64le_UV_c_vsx: 3781 > > p010LEToY_c: 9546 > p010LEToY_c_vsx: 2422 > > p010LEToUV_c: 6390 > p010LEToUV_c_vsx: 2681 > > p010BEToY_c: 9836 > p010BEToY_c_vsx: 2572 > > p010BEToUV_c: 7022 > p010BEToUV_c_vsx: 2660 > > p016LEToUV_c: 5022 > p016LEToUV_c_vsx: 2447 > > p016BEToUV_c: 5293 > p016BEToUV_c_vsx: 2307 To make our lives a little easier, could you tell us what you tested and how we can reproduce your results? Also: Is your patch expected to be bit-exact? If yes, do you have a script that allows to compare C and vsx code? If not, how did you test your code? (Or does fate cover these conversions? I wouldn't expect so.) Thank you, Carl Eugen ___ 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] JPEG2000 Decoder/Encoder Enhancements
Am Di., 24. März 2020 um 21:37 Uhr schrieb Michael Niedermayer : > > On Tue, Mar 24, 2020 at 09:42:07AM +0530, Gautam Ramakrishnan wrote: > > Hi Michael, > > > > I do not mind spending most of the time myself. I just need a person > > to go to when I have doubts. I really do not mind doing it without it > > being through GSoC either. Just wanted to try contributing to the > > organization. > > If you want to do it through gsoc and are eligible you can of course > submit a proposal to google. Of course that doesnt mean that it > would be selected as one of the projects. I guess this means: not necessarily. Carl Eugen ___ 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] avformat/webmdashenc: Don't use custom option for bitexactness
Andreas Rheinhardt: > The WebM DASH Manifest muxer can write manifests for live streams and > these contain an entry that depends on the time the manifest is written; > an AVOption to make the output reproducible has been added for tests. > But this is unnecessary, as there already is a method for reproducible > output: The AVFMT_FLAG_BITEXACT-flag of the AVFormatContext. Therefore > this commit removes the custom option. > > Given that the description of said option contained "private option - > users should never set this" and that it was not documented in > muxers.texi, no deprecation period for this option seemed necessary. > > The commands of the FATE-tests for this muxer have been changed to no > longer use this option. > > Signed-off-by: Andreas Rheinhardt > --- > libavformat/webmdashenc.c | 4 +--- > tests/fate/vpx.mak| 4 ++-- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c > index d2f0e0ec4d..0e7bfba34c 100644 > --- a/libavformat/webmdashenc.c > +++ b/libavformat/webmdashenc.c > @@ -57,7 +57,6 @@ typedef struct WebMDashMuxContext { > char *utc_timing_url; > double time_shift_buffer_depth; > int minimum_update_period; > -int debug_mode; > } WebMDashMuxContext; > > static const char *get_codec_name(int codec_id) > @@ -114,7 +113,7 @@ static int write_header(AVFormatContext *s) > if (!strftime(gmt_iso, 21, "%Y-%m-%dT%H:%M:%SZ", gmt)) { > return AVERROR_UNKNOWN; > } > -if (w->debug_mode) { > +if (s->flags & AVFMT_FLAG_BITEXACT) { > av_strlcpy(gmt_iso, "", 1); > } > avio_printf(s->pb, " availabilityStartTime=\"%s\"\n", gmt_iso); > @@ -553,7 +552,6 @@ static int > webm_dash_manifest_write_packet(AVFormatContext *s, AVPacket *pkt) > #define OFFSET(x) offsetof(WebMDashMuxContext, x) > static const AVOption options[] = { > { "adaptation_sets", "Adaptation sets. Syntax: id=0,streams=0,1,2 > id=1,streams=3,4 and so on", OFFSET(adaptation_sets), AV_OPT_TYPE_STRING, { 0 > }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, > -{ "debug_mode", "[private option - users should never set this]. Create > deterministic output", OFFSET(debug_mode), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, > 1, AV_OPT_FLAG_ENCODING_PARAM }, > { "live", "create a live stream manifest", OFFSET(is_live), > AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, > { "chunk_start_index", "start index of the chunk", > OFFSET(chunk_start_index), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, > AV_OPT_FLAG_ENCODING_PARAM }, > { "chunk_duration_ms", "duration of each chunk (in milliseconds)", > OFFSET(chunk_duration), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, > AV_OPT_FLAG_ENCODING_PARAM }, > diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak > index 3b3da18feb..c65959f133 100644 > --- a/tests/fate/vpx.mak > +++ b/tests/fate/vpx.mak > @@ -71,10 +71,10 @@ FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += > fate-webm-dash-manifest-represe > fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -nostdin -f > webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f > webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 > -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - > > FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-live > -fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f > webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr > -f webm_dash_manifest -live 1 -i > $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f > webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" > -chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 > -minimum_update_period 60 -debug_mode 1 - > +fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f > webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr > -f webm_dash_manifest -live 1 -i > $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -fflags > +bitexact -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 > id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 > -time_shift_buffer_depth 7200 -minimum_update_period 60 - > > FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += > fate-webm-dash-manifest-live-bandwidth > -fate-webm-dash-manifest-live-bandwidth: CMD = run $(FFMPEG) -nostdin -f > webm_dash_manifest -live 1 -bandwidth 100 -i > $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 > -bandwidth 200 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map > 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 > id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 > -time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 - > +fate-webm-dash-manifest-live-bandwidth: CMD
Re: [FFmpeg-devel] [PATCH] avformat/rtp: Pass sources and block filter addresses via sdp file for rtp
This patch will correctly pass any sources or block filters from the URL via SDP to the underlying protocol. Example URL: rtp://232.0.10.234:1?sources=87.141.215.251 Prior to this patch the sources params would be ignored and the stream reading would fail. > On 4 Mar 2020, at 23:47, phunkyfish wrote: > > --- > libavformat/rtsp.c | 48 ++ > 1 file changed, 40 insertions(+), 8 deletions(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index cd6fc32a29..f6d66526b0 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -2447,8 +2447,8 @@ static int rtp_probe(const AVProbeData *p) > static int rtp_read_header(AVFormatContext *s) > { > uint8_t recvbuf[RTP_MAX_PACKET_LENGTH]; > -char host[500], sdp[500]; > -int ret, port; > +char host[500], sdp[1000], filters_buf[1000]; > +int ret, port, sdp_length, nc; > URLContext* in = NULL; > int payload_type; > AVCodecParameters *par = NULL; > @@ -2456,6 +2456,7 @@ static int rtp_read_header(AVFormatContext *s) > AVIOContext pb; > socklen_t addrlen = sizeof(addr); > RTSPState *rt = s->priv_data; > +const char *p; > > if (!ff_network_init()) > return AVERROR(EIO); > @@ -2513,12 +2514,40 @@ static int rtp_read_header(AVFormatContext *s) > av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port, > NULL, 0, s->url); > > -snprintf(sdp, sizeof(sdp), > - "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n", > - addr.ss_family == AF_INET ? 4 : 6, host, > - par->codec_type == AVMEDIA_TYPE_DATA ? "application" : > - par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio", > - port, payload_type); > +sdp_length = snprintf(sdp, sizeof(sdp), > + "v=0\r\nc=IN IP%d %s\r\n", > + addr.ss_family == AF_INET ? 4 : 6, host); > + > +p = strchr(s->url, '?'); > +if (p) { > +static const char *filters[][2] = {{"sources", "incl"}, {"block", > "excl"}, {NULL, NULL}}; > +int i; > +char *q; > +for (i = 0; filters[i][0]; i++) { > +if (av_find_info_tag(filters_buf, sizeof(filters_buf), > filters[i][0], p)) { > +/* av_log(s, AV_LOG_VERBOSE, "rtp_read_header() found %s > %s\n", filters[i][0], filters_buf); */ > +q = filters_buf; > +while ((q = strchr(q, ',')) != NULL) > +*q = ' '; > +nc = snprintf(sdp + sdp_length, sizeof(sdp) - sdp_length, > + "a=source-filter:%s IN IP%d %s %s\r\n", > + filters[i][1], > + addr.ss_family == AF_INET ? 4 : 6, host, > + filters_buf); > +if (nc < 0 || nc + sdp_length >= sizeof(sdp)) > +goto fail_nobuf; > +sdp_length += nc; > +} > +} > +} > + > +nc = snprintf(sdp + sdp_length, sizeof(sdp) - sdp_length, > + "m=%s %d RTP/AVP %d\r\n", > + par->codec_type == AVMEDIA_TYPE_DATA ? "application" : > + par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio", > + port, payload_type); > +if (nc < 0 || nc + sdp_length >= sizeof(sdp)) > +goto fail_nobuf; > av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp); > avcodec_parameters_free(&par); > > @@ -2534,6 +2563,9 @@ static int rtp_read_header(AVFormatContext *s) > s->pb = NULL; > return ret; > > +fail_nobuf: > +ret = AVERROR(ENOBUFS); > +av_log(s, AV_LOG_ERROR, "rtp_read_header(): not enough buffer space for > sdp-headers\n"); > fail: > avcodec_parameters_free(&par); > if (in) > -- > 2.20.1 (Apple Git-117) > ___ 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] avcodec/hevc, h2645_parse: Fix HEVC NAL unit names and constants
Anton Khirnov: > Quoting Andreas Rheinhardt (2020-03-18 14:41:23) >> This commit fixes the names and constants of the reserved NAL units >> with nal_unit_type 22 resp. 23. They were "IRAP_IRAP_VLC2x", but are >> actually "RSV_IRAP_VLC2x". >> >> This also required a change to cbs_h265_syntax_template.c. >> >> Signed-off-by: Andreas Rheinhardt >> --- > > Looks ok. > >> Should I realign the enum? > > Sure > Applied together with a cosmetic patch for the realignment. Thanks. - 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] avformat/movenc: move the AVProducerReferenceTime struct to MOVTrack
We only care about the prft timestamp of the first sample in each chunk, so no need to store every single one within each MOVIentry. Should reduce memory usage. Signed-off-by: James Almer --- libavformat/movenc.c | 23 +-- libavformat/movenc.h | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 85df5d1374..b748b92314 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4675,11 +4675,11 @@ static int mov_write_prft_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks) } if (mov->write_prft == MOV_PRFT_SRC_WALLCLOCK) { -if (first_track->cluster[0].prft.wallclock) { +if (first_track->prft.wallclock) { /* Round the NTP time to whole milliseconds. */ -ntp_ts = ff_get_formatted_ntp_time((first_track->cluster[0].prft.wallclock / 1000) * 1000 + +ntp_ts = ff_get_formatted_ntp_time((first_track->prft.wallclock / 1000) * 1000 + NTP_OFFSET_US); -flags = first_track->cluster[0].prft.flags; +flags = first_track->prft.flags; } else ntp_ts = ff_get_formatted_ntp_time(ff_ntp_time()); } else if (mov->write_prft == MOV_PRFT_SRC_PTS) { @@ -5391,10 +5391,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) AVIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecParameters *par = trk->par; -AVProducerReferenceTime *prft; unsigned int samples_in_chunk = 0; int size = pkt->size, ret = 0, offset = 0; -int prft_size; uint8_t *reformatted_data = NULL; ret = check_pkt(s, pkt); @@ -5675,11 +5673,16 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) trk->has_disposable++; } -prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &prft_size); -if (prft && prft_size == sizeof(AVProducerReferenceTime)) -memcpy(&trk->cluster[trk->entry].prft, prft, prft_size); -else -memset(&trk->cluster[trk->entry].prft, 0, sizeof(AVProducerReferenceTime)); +if (!trk->entry) { +/* We only want the prft for the first sample in a chunk */ +int prft_size; +AVProducerReferenceTime *prft = +(AVProducerReferenceTime *)av_packet_get_side_data(pkt, AV_PKT_DATA_PRFT, &prft_size); +if (prft && prft_size == sizeof(trk->prft)) +memcpy(&trk->prft, prft, prft_size); +else +memset(&trk->prft, 0, sizeof(trk->prft)); +} trk->entry++; trk->sample_count += samples_in_chunk; diff --git a/libavformat/movenc.h b/libavformat/movenc.h index 997b2d61c0..d394bf757f 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -56,7 +56,6 @@ typedef struct MOVIentry { #define MOV_PARTIAL_SYNC_SAMPLE 0x0002 #define MOV_DISPOSABLE_SAMPLE 0x0004 uint32_t flags; -AVProducerReferenceTime prft; } MOVIentry; typedef struct HintSample { @@ -160,6 +159,8 @@ typedef struct MOVTrack { MOVMuxCencContext cenc; +AVProducerReferenceTime prft; + uint32_t palette[AVPALETTE_COUNT]; int pal_done; -- 2.25.2 ___ 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] avformat/movenc: move the AVProducerReferenceTime struct to MOVTrack
James Almer: > We only care about the prft timestamp of the first sample in each chunk, so > no need to store every single one within each MOVIentry. > > Should reduce memory usage. > > Signed-off-by: James Almer > --- > libavformat/movenc.c | 23 +-- > libavformat/movenc.h | 3 ++- > 2 files changed, 15 insertions(+), 11 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 85df5d1374..b748b92314 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -4675,11 +4675,11 @@ static int mov_write_prft_tag(AVIOContext *pb, > MOVMuxContext *mov, int tracks) > } > > if (mov->write_prft == MOV_PRFT_SRC_WALLCLOCK) { > -if (first_track->cluster[0].prft.wallclock) { > +if (first_track->prft.wallclock) { > /* Round the NTP time to whole milliseconds. */ > -ntp_ts = > ff_get_formatted_ntp_time((first_track->cluster[0].prft.wallclock / 1000) * > 1000 + > +ntp_ts = ff_get_formatted_ntp_time((first_track->prft.wallclock > / 1000) * 1000 + > NTP_OFFSET_US); > -flags = first_track->cluster[0].prft.flags; > +flags = first_track->prft.flags; > } else > ntp_ts = ff_get_formatted_ntp_time(ff_ntp_time()); > } else if (mov->write_prft == MOV_PRFT_SRC_PTS) { > @@ -5391,10 +5391,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket > *pkt) > AVIOContext *pb = s->pb; > MOVTrack *trk = &mov->tracks[pkt->stream_index]; > AVCodecParameters *par = trk->par; > -AVProducerReferenceTime *prft; > unsigned int samples_in_chunk = 0; > int size = pkt->size, ret = 0, offset = 0; > -int prft_size; > uint8_t *reformatted_data = NULL; > > ret = check_pkt(s, pkt); > @@ -5675,11 +5673,16 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket > *pkt) > trk->has_disposable++; > } > > -prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, > AV_PKT_DATA_PRFT, &prft_size); > -if (prft && prft_size == sizeof(AVProducerReferenceTime)) > -memcpy(&trk->cluster[trk->entry].prft, prft, prft_size); > -else > -memset(&trk->cluster[trk->entry].prft, 0, > sizeof(AVProducerReferenceTime)); > +if (!trk->entry) { > +/* We only want the prft for the first sample in a chunk */ > +int prft_size; > +AVProducerReferenceTime *prft = > +(AVProducerReferenceTime *)av_packet_get_side_data(pkt, > AV_PKT_DATA_PRFT, &prft_size); > +if (prft && prft_size == sizeof(trk->prft)) > +memcpy(&trk->prft, prft, prft_size); > +else > +memset(&trk->prft, 0, sizeof(trk->prft)); > +} > > trk->entry++; > trk->sample_count += samples_in_chunk; > diff --git a/libavformat/movenc.h b/libavformat/movenc.h > index 997b2d61c0..d394bf757f 100644 > --- a/libavformat/movenc.h > +++ b/libavformat/movenc.h > @@ -56,7 +56,6 @@ typedef struct MOVIentry { > #define MOV_PARTIAL_SYNC_SAMPLE 0x0002 > #define MOV_DISPOSABLE_SAMPLE 0x0004 > uint32_t flags; > -AVProducerReferenceTime prft; > } MOVIentry; 5717cd80dcb825efcbcb0b936a02b755cd2d5f62 added the pts field to MOVIentry for writing the prtf box and it seems that only the very first pts are ever needed (just like for the AVProducerReferenceTime). So can this field be moved to MOVTrack, too? - Andreas > > typedef struct HintSample { > @@ -160,6 +159,8 @@ typedef struct MOVTrack { > > MOVMuxCencContext cenc; > > +AVProducerReferenceTime prft; > + > uint32_t palette[AVPALETTE_COUNT]; > int pal_done; > > ___ 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] avformat/movenc: move the AVProducerReferenceTime struct to MOVTrack
On 3/24/2020 9:01 PM, Andreas Rheinhardt wrote: > James Almer: >> We only care about the prft timestamp of the first sample in each chunk, so >> no need to store every single one within each MOVIentry. >> >> Should reduce memory usage. >> >> Signed-off-by: James Almer >> --- >> libavformat/movenc.c | 23 +-- >> libavformat/movenc.h | 3 ++- >> 2 files changed, 15 insertions(+), 11 deletions(-) >> >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c >> index 85df5d1374..b748b92314 100644 >> --- a/libavformat/movenc.c >> +++ b/libavformat/movenc.c >> @@ -4675,11 +4675,11 @@ static int mov_write_prft_tag(AVIOContext *pb, >> MOVMuxContext *mov, int tracks) >> } >> >> if (mov->write_prft == MOV_PRFT_SRC_WALLCLOCK) { >> -if (first_track->cluster[0].prft.wallclock) { >> +if (first_track->prft.wallclock) { >> /* Round the NTP time to whole milliseconds. */ >> -ntp_ts = >> ff_get_formatted_ntp_time((first_track->cluster[0].prft.wallclock / 1000) * >> 1000 + >> +ntp_ts = ff_get_formatted_ntp_time((first_track->prft.wallclock >> / 1000) * 1000 + >> NTP_OFFSET_US); >> -flags = first_track->cluster[0].prft.flags; >> +flags = first_track->prft.flags; >> } else >> ntp_ts = ff_get_formatted_ntp_time(ff_ntp_time()); >> } else if (mov->write_prft == MOV_PRFT_SRC_PTS) { >> @@ -5391,10 +5391,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket >> *pkt) >> AVIOContext *pb = s->pb; >> MOVTrack *trk = &mov->tracks[pkt->stream_index]; >> AVCodecParameters *par = trk->par; >> -AVProducerReferenceTime *prft; >> unsigned int samples_in_chunk = 0; >> int size = pkt->size, ret = 0, offset = 0; >> -int prft_size; >> uint8_t *reformatted_data = NULL; >> >> ret = check_pkt(s, pkt); >> @@ -5675,11 +5673,16 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket >> *pkt) >> trk->has_disposable++; >> } >> >> -prft = (AVProducerReferenceTime *)av_packet_get_side_data(pkt, >> AV_PKT_DATA_PRFT, &prft_size); >> -if (prft && prft_size == sizeof(AVProducerReferenceTime)) >> -memcpy(&trk->cluster[trk->entry].prft, prft, prft_size); >> -else >> -memset(&trk->cluster[trk->entry].prft, 0, >> sizeof(AVProducerReferenceTime)); >> +if (!trk->entry) { >> +/* We only want the prft for the first sample in a chunk */ >> +int prft_size; >> +AVProducerReferenceTime *prft = >> +(AVProducerReferenceTime *)av_packet_get_side_data(pkt, >> AV_PKT_DATA_PRFT, &prft_size); >> +if (prft && prft_size == sizeof(trk->prft)) >> +memcpy(&trk->prft, prft, prft_size); >> +else >> +memset(&trk->prft, 0, sizeof(trk->prft)); >> +} >> >> trk->entry++; >> trk->sample_count += samples_in_chunk; >> diff --git a/libavformat/movenc.h b/libavformat/movenc.h >> index 997b2d61c0..d394bf757f 100644 >> --- a/libavformat/movenc.h >> +++ b/libavformat/movenc.h >> @@ -56,7 +56,6 @@ typedef struct MOVIentry { >> #define MOV_PARTIAL_SYNC_SAMPLE 0x0002 >> #define MOV_DISPOSABLE_SAMPLE 0x0004 >> uint32_t flags; >> -AVProducerReferenceTime prft; >> } MOVIentry; > > 5717cd80dcb825efcbcb0b936a02b755cd2d5f62 added the pts field to > MOVIentry for writing the prtf box and it seems that only the very first > pts are ever needed (just like for the AVProducerReferenceTime). So can > this field be moved to MOVTrack, too? It could, but i'd rather not. It will look weird in MOVTrack (like prft does after this patch, for that matter), and as is it could be used later for some other purpose. > > - Andreas > >> >> typedef struct HintSample { >> @@ -160,6 +159,8 @@ typedef struct MOVTrack { >> >> MOVMuxCencContext cenc; >> >> +AVProducerReferenceTime prft; >> + >> uint32_t palette[AVPALETTE_COUNT]; >> int pal_done; >> >> > > ___ > 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".
Re: [FFmpeg-devel] [PATCH] avcodec/jpeg2000dec: error check when processing tlm marker
On Wed, Mar 25, 2020 at 01:06:15AM +0530, gautamr...@gmail.com wrote: > From: Gautam Ramakrishnan > > Validate the value of ST field in the TLM marker of JPEG2000. > Throw an error when ST takes value of 0x11. > --- > libavcodec/jpeg2000dec.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > index 019dc81f56..74d70b686f 100644 > --- a/libavcodec/jpeg2000dec.c > +++ b/libavcodec/jpeg2000dec.c > @@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) > > // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); > ST = (Stlm >> 4) & 0x03; > -// TODO: Manage case of ST = 0b11 --> raise error > +if (ST == 0x11) { > +av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n"); > +return AVERROR_INVALIDDATA; in addition to what paul said, the return type of get_tlm() is unsigned 8bit the error code doesnt fit in 8bit [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The day soldiers stop bringing you their problems is the day you have stopped leading them. They have either lost confidence that you can help or concluded you do not care. Either case is a failure of leadership. - Colin Powell 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".
Re: [FFmpeg-devel] [PATCH] Check return value from avio_read() to verify data actually read
On Mon, Mar 23, 2020 at 05:52:01PM -0700, John Rummell wrote: > Chromium fuzzers have caught places where uninitialized data was used due > to calls to avio_read() not verifying that the number of bytes expected was > actually read. So updating the code to check the result from avio_read(). > mov.c| 26 ++ > oggdec.c |3 ++- > wavdec.c | 12 > 3 files changed, 28 insertions(+), 13 deletions(-) > 66938bc5adfc7d151b376f6d396c4a0dc7f97a4c > 0001-Check-return-value-from-avio_read-to-verify-data-act.patch > From 7f80d50711486a4b923bd8d1e26abc9649d570e3 Mon Sep 17 00:00:00 2001 > From: John Rummell > Date: Mon, 23 Mar 2020 15:48:33 -0700 > Subject: [PATCH] Check return value from avio_read() to verify data actually > read > > If the buffer doesn't contain enough bytes when reading a stream, > fail rather than continuing on with unitialized data. One attempt > caught by Chromium fuzzers (crbug.com/1054229), rest done by looking > for calls to avio_read() that don't check the result in Chromium > code search. > --- > libavformat/mov.c| 26 ++ > libavformat/oggdec.c | 3 ++- > libavformat/wavdec.c | 12 > 3 files changed, 28 insertions(+), 13 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index f280f360b6..a5b4d04e37 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -1012,10 +1012,16 @@ static int mov_read_adrm(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > } > > /* drm blob processing */ > -avio_read(pb, output, 8); // go to offset 8, absolute position 0x251 > -avio_read(pb, input, DRM_BLOB_SIZE); > -avio_read(pb, output, 4); // go to offset 4, absolute position 0x28d > -avio_read(pb, file_checksum, 20); > +/* go to offset 8, absolute position 0x251 */ > +if ((ret = avio_read(pb, output, 8)) != 8) > +goto fail; > +if ((ret = avio_read(pb, input, DRM_BLOB_SIZE)) != DRM_BLOB_SIZE) > +goto fail; > +/* go to offset 4, absolute position 0x28d */ > +if ((ret = avio_read(pb, output, 4)) != 4) > +goto fail; > +if ((ret = avio_read(pb, file_checksum, 20)) != 20) > +goto fail; These would cause mov_read_adrm() to fail but not neccessarily return an error code if any of these reads less. Is that intended ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact 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".
Re: [FFmpeg-devel] [PATCH 05/17] avformat/webm_chunk: Don't use child AVFormatContext for logging
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt > --- > libavformat/webm_chunk.c | 7 +++ > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/libavformat/webm_chunk.c b/libavformat/webm_chunk.c > index bc3d346a00..0d4e3598ed 100644 > --- a/libavformat/webm_chunk.c > +++ b/libavformat/webm_chunk.c > @@ -87,25 +87,24 @@ static int chunk_mux_init(AVFormatContext *s) > static int get_chunk_filename(AVFormatContext *s, int is_header, char > filename[MAX_FILENAME_SIZE]) > { > WebMChunkContext *wc = s->priv_data; > -AVFormatContext *oc = wc->avf; > if (!filename) { > return AVERROR(EINVAL); > } > if (is_header) { > int len; > if (!wc->header_filename) { > -av_log(oc, AV_LOG_ERROR, "No header filename provided\n"); > +av_log(s, AV_LOG_ERROR, "No header filename provided\n"); > return AVERROR(EINVAL); > } > len = av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE); > if (len >= MAX_FILENAME_SIZE) { > -av_log(oc, AV_LOG_ERROR, "Header filename too long\n"); > +av_log(s, AV_LOG_ERROR, "Header filename too long\n"); > return AVERROR(EINVAL); > } > } else { > if (av_get_frame_filename(filename, MAX_FILENAME_SIZE, >s->url, wc->chunk_index - 1) < 0) { > -av_log(oc, AV_LOG_ERROR, "Invalid chunk filename template > '%s'\n", s->url); > +av_log(s, AV_LOG_ERROR, "Invalid chunk filename template > '%s'\n", s->url); > return AVERROR(EINVAL); > } > } > Ping. If no one objects, I will merge the webm_chunk patches tomorrow. - 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 10/14] avformat/matroskadec: move the elements semantic in a separate file
Steve Lhomme: > From: Steve Lhomme > > So the file can be generated from the Matroska Schema. > > The EbmlSyntax structures are not shared between files. > matroska_segments and matroska_cluster_enter also have their size predefined. > > No functional changes. > --- > libavformat/Makefile | 2 +- > libavformat/matroskadec.c | 668 +- > libavformat/matroskasem.c | 384 ++ > libavformat/matroskasem.h | 362 + > 4 files changed, 748 insertions(+), 668 deletions(-) > create mode 100644 libavformat/matroskasem.c > create mode 100644 libavformat/matroskasem.h [...] > diff --git a/libavformat/matroskasem.h b/libavformat/matroskasem.h > new file mode 100644 > index 00..8171982abf > --- /dev/null > +++ b/libavformat/matroskasem.h > @@ -0,0 +1,362 @@ > +/* > + * Matroska file semantic definition > + * Copyright (c) 2003-2020 The FFmpeg project > + * > + * 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 > + */ > + > +/** > + * @file > + * Matroska file demuxer > + * @author Ronald Bultje > + * @author with a little help from Moritz Bunkus > + * @author totally reworked by Aurelien Jacobs > + * @see specs available on the Matroska project page: > http://www.matroska.org/ > + */ > + > +#ifndef AVFORMAT_MATROSKASEM_H > +#define AVFORMAT_MATROSKASEM_H > + > +#include > + > +#include "matroska.h" > +#include "avformat.h" > +#include "libavutil/frame.h" Is it possible that you just included this for AVBufferRef (which is defined in libavutil/buffer.h)? - 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] avcodec/jpeg2000dec: error check when processing tlm marker
That was an extremely careless error. Apologies for that. Shall fix that immediately. However, is changing the return type of get_tlm() the right way? On Wed, Mar 25, 2020 at 6:06 AM Michael Niedermayer wrote: > > On Wed, Mar 25, 2020 at 01:06:15AM +0530, gautamr...@gmail.com wrote: > > From: Gautam Ramakrishnan > > > > Validate the value of ST field in the TLM marker of JPEG2000. > > Throw an error when ST takes value of 0x11. > > --- > > libavcodec/jpeg2000dec.c | 6 +- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > > index 019dc81f56..74d70b686f 100644 > > --- a/libavcodec/jpeg2000dec.c > > +++ b/libavcodec/jpeg2000dec.c > > @@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int > > n) > > > > // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); > > ST = (Stlm >> 4) & 0x03; > > -// TODO: Manage case of ST = 0b11 --> raise error > > +if (ST == 0x11) { > > +av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n"); > > > +return AVERROR_INVALIDDATA; > > in addition to what paul said, > > the return type of get_tlm() is unsigned 8bit the error code doesnt fit in > 8bit > > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The day soldiers stop bringing you their problems is the day you have stopped > leading them. They have either lost confidence that you can help or concluded > you do not care. Either case is a failure of leadership. - Colin Powell > ___ > 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". -- - Gautam | ___ 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/jpeg2000dec: error check when processing tlm marker
From: Gautam Ramakrishnan Validate the value of ST field in the TLM marker of JPEG2000. Throw an error when ST takes value of 0x11. --- libavcodec/jpeg2000dec.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 019dc81f56..a233bcafc7 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -795,7 +795,7 @@ static int get_sot(Jpeg2000DecoderContext *s, int n) * markers. Parsing the TLM header is needed to increment the input header * buffer. * This marker is mandatory for DCI. */ -static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) +static int get_tlm(Jpeg2000DecoderContext *s, int n) { uint8_t Stlm, ST, SP, tile_tlm, i; bytestream2_get_byte(&s->g); /* Ztlm: skipped */ @@ -803,7 +803,11 @@ static uint8_t get_tlm(Jpeg2000DecoderContext *s, int n) // too complex ? ST = ((Stlm >> 4) & 0x01) + ((Stlm >> 4) & 0x02); ST = (Stlm >> 4) & 0x03; -// TODO: Manage case of ST = 0b11 --> raise error +if (ST == 0x03) { +av_log(s, AV_LOG_ERROR, "TLM marker contains invalid ST value.\n"); +return AVERROR_INVALIDDATA; +} + SP = (Stlm >> 6) & 0x01; tile_tlm = (n - 4) / ((SP + 1) * 2 + ST); for (i = 0; i < tile_tlm; i++) { -- 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 v2] avformat/matroskaenc: Write level 1 elements in one go
Up until now, writing level 1 elements proceeded as follows: First, the element id was written to the ordinary output AVIOContext and a dynamic buffer was opened for the content of the level 1 element in start_ebml_master_crc32(). Then this buffer was actually used and after it was closed (in end_ebml_master_crc32()), the size field corresponding to the buffer's size was written, after which the actual data was written. This commit changes this: Nothing is written to the main AVIOContext any more in start_ebml_master_crc32(). end_ebml_master_crc32() now writes both the id, the length field as well as the data. This implies that one can start a level 1 element in memory without outputting anything. This is done to enable to test whether enough space has been reserved for the Cues (if space has been reserved for them) before writing them. A large duration between outputting the header and outputting the rest could also break certain streaming usecases like the one from #8578 (which this commit fixes). Signed-off-by: Andreas Rheinhardt --- The commit message has been updated in light of ticket #8578; nothing else has changed. I'd like to apply this and everything until (but excluding) #18 [1] in the coming days to fix the aforementioned issue (I will also backport a fix to 4.2). [1] is the cutoff point because upon rereading I am not sure anymore whether it is good to write the cues at the end if the reserved space doesn't suffice and return normally afterwards, because the fact that the cues have not been written at the front won't be detectable from the return value of av_write_trailer() any more (one only gets a AV_LOG_WARNING logmessage). [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-January/255157.html libavformat/matroskaenc.c | 60 +-- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 66f1bc4255..501d68a8f7 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -325,26 +325,26 @@ static void end_ebml_master(AVIOContext *pb, ebml_master master) avio_seek(pb, pos, SEEK_SET); } -static int start_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, - uint32_t elementid) +static int start_ebml_master_crc32(AVIOContext **dyn_cp, MatroskaMuxContext *mkv) { int ret; if ((ret = avio_open_dyn_buf(dyn_cp)) < 0) return ret; -put_ebml_id(pb, elementid); if (mkv->write_crc) put_ebml_void(*dyn_cp, 6); /* Reserve space for CRC32 so position/size calculations using avio_tell() take it into account */ return 0; } -static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv) +static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, + MatroskaMuxContext *mkv, uint32_t id) { uint8_t *buf, crc[4]; int size, skip = 0; +put_ebml_id(pb, id); size = avio_close_dyn_buf(*dyn_cp, &buf); put_ebml_num(pb, size, 0); if (mkv->write_crc) { @@ -362,13 +362,14 @@ static void end_ebml_master_crc32(AVIOContext *pb, AVIOContext **dyn_cp, Matrosk * Complete ebml master without destroying the buffer, allowing for later updates */ static void end_ebml_master_crc32_preliminary(AVIOContext *pb, AVIOContext **dyn_cp, MatroskaMuxContext *mkv, - int64_t *pos) + uint32_t id, int64_t *pos) { uint8_t *buf; int size = avio_get_dyn_buf(*dyn_cp, &buf); *pos = avio_tell(pb); +put_ebml_id(pb, id); put_ebml_num(pb, size, 0); avio_write(pb, buf, size); } @@ -450,7 +451,7 @@ static int mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv, goto seek; } -ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, MATROSKA_ID_SEEKHEAD); +ret = start_ebml_master_crc32(&dyn_cp, mkv); if (ret < 0) return ret; @@ -466,7 +467,7 @@ static int mkv_write_seekhead(AVIOContext *pb, MatroskaMuxContext *mkv, put_ebml_uint(dyn_cp, MATROSKA_ID_SEEKPOSITION, entry->segmentpos); end_ebml_master(dyn_cp, seekentry); } -end_ebml_master_crc32(pb, &dyn_cp, mkv); +end_ebml_master_crc32(pb, &dyn_cp, mkv, MATROSKA_ID_SEEKHEAD); remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); put_ebml_void(pb, remaining); @@ -510,7 +511,7 @@ static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues *cues, mkv_track *tra int ret; currentpos = avio_tell(pb); -ret = start_ebml_master_crc32(pb, &dyn_cp, mkv, MATROSKA_ID_CUES); +ret = start_ebml_master_crc32(&dyn_cp, mkv); if (ret < 0) return ret; @@ -553,7 +554,7 @@ static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues *cues, mkv_track *tra ffio_reset_dyn_buf(cuepoint); } ffio_free_
Re: [FFmpeg-devel] [PATCH] avcodec/decode: Clear format on ff_get_buffer() failure
Quoting Michael Niedermayer (2020-03-24 21:23:58) > On Tue, Mar 24, 2020 at 10:59:21AM +0100, Anton Khirnov wrote: > > Quoting Michael Niedermayer (2020-03-24 01:41:43) > > > Fixes: out of array access > > > Fixes: > > > 21193/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-5125168956702720 > > > > > > Found-by: continuous fuzzing process > > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > > Signed-off-by: Michael Niedermayer > > > --- > > > libavcodec/decode.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > > > index af6bb3f952..fb22ef0ef3 100644 > > > --- a/libavcodec/decode.c > > > +++ b/libavcodec/decode.c > > > @@ -1972,6 +1972,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame > > > *frame, int flags) > > > if (ret < 0) { > > > av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); > > > frame->width = frame->height = 0; > > > +frame->format = -1; > > > > This looks ad-hoc. And also unnecessary, since get_buffer_internal() is > > already calling av_frame_unref() on failure. > > Seems it's just missing the cleanup goto on ff_decode_frame_props() > > failure. > > will post a patch to fix that cleanup but i have to say that i > feel a bit uneasy that a fix to out of array access is "not forgetting > cleanup on any path" As I see it, we should not be fixing a segfault/invalid access. That segfault is not in itself a bug, merely a symptom of one. The actual bug is that the program got into an invalid state, which we fix by making the code fail in a safe way. I believe that approach is better than sprinkling random checks in various places that only detect some limited instances of invalid state, but do not prevent it from happening in the first place. > Ill add a assert so if another path leads to this, it at least gets > stoped/clearly caught. I think it might be clearest to merge ff_get_buffer() and get_buffer_internal(). Since the purpose of separation is just to print an error message on failure and get_buffer_internal() already contains a cleanup block, we can just make all failed paths go through cleanup. That will make it obvious that the frame is always clean on failure and prevent not just this crash but any other crashes possibly arising from the frame not being clean. -- Anton Khirnov ___ 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".