Re: [FFmpeg-devel] [PATCH] avcodec/librav1e: free the RaPacket after using it
On 11/10/2019 10:21 PM, Derek Buitenhuis wrote: > On 11/11/2019 01:19, James Almer wrote: >> Fixes leaks. >> >> Signed-off-by: James Almer >> --- >> Missed this detail when reviewing. It's a remnant of the version where the >> RaPacket was attached to the AVPacket. > > Woops, yeah. I remember /thinking/ I needed too and then forgot. > > LGTM. > > - Derek Pushed, thanks. ___ 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/librav1e: free the RaPacket after using it
On 11/11/2019 01:19, James Almer wrote: > Fixes leaks. > > Signed-off-by: James Almer > --- > Missed this detail when reviewing. It's a remnant of the version where the > RaPacket was attached to the AVPacket. Woops, yeah. I remember /thinking/ I needed too and then forgot. LGTM. - Derek ___ 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/librav1e: free the RaPacket after using it
Fixes leaks. Signed-off-by: James Almer --- Missed this detail when reviewing. It's a remnant of the version where the RaPacket was attached to the AVPacket. libavcodec/librav1e.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index f65d784127..5052cac896 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -508,12 +508,12 @@ retry: pkt->flags |= AV_PKT_FLAG_KEY; pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; +rav1e_packet_unref(rpkt); if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { int ret = av_bsf_send_packet(ctx->bsf, pkt); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "extradata extraction send failed.\n"); -rav1e_packet_unref(rpkt); av_packet_unref(pkt); return ret; } @@ -521,7 +521,6 @@ retry: ret = av_bsf_receive_packet(ctx->bsf, pkt); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "extradata extraction receive failed.\n"); -rav1e_packet_unref(rpkt); av_packet_unref(pkt); return ret; } -- 2.23.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 11/11] avformat/mpegts: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
This will likely also fix CID 1452589 and 1452460, false positives resulting from Coverity thinking that av_dict_set() automatically frees its key and value parameters (even without the AV_DICT_DONT_STRDUP_* flags). Signed-off-by: Andreas Rheinhardt --- libavformat/mpegts.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 587ed33327..e0f3a5eab9 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2611,6 +2611,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len desc_tag, desc_len); switch (desc_tag) { +AVProgram *program; case 0x48: service_type = get8(&p, p_end); if (service_type < 0) @@ -2619,16 +2620,15 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (!provider_name) break; name = getstr8(&p, p_end); -if (name) { -AVProgram *program = av_new_program(ts->stream, sid); -if (program) { -av_dict_set(&program->metadata, "service_name", name, 0); -av_dict_set(&program->metadata, "service_provider", -provider_name, 0); -} +if (name && (program = av_new_program(ts->stream, sid))) { +av_dict_set(&program->metadata, "service_name", +name, AV_DICT_DONT_STRDUP_VAL); +av_dict_set(&program->metadata, "service_provider", +provider_name, AV_DICT_DONT_STRDUP_VAL); +} else { +av_free(name); +av_free(provider_name); } -av_free(name); -av_free(provider_name); break; default: break; -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 10/11] avformat/oggparsevorbis: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
This will likely also fix CID 1452427, a false positive resulting from Coverity thinking that av_dict_set() automatically frees its key and value parameters (even without the AV_DICT_DONT_STRDUP_* flags). (AV_DICT_APPEND and AV_DICT_DONT_STRDUP_VAL are compatible with each other since a8c5b455, so we can reset this flag here. It has originally been removed in 0dc66553 when appending was added.) Signed-off-by: Andreas Rheinhardt --- libavformat/oggparsevorbis.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 43f05f928a..8dd27e7770 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -177,9 +177,8 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, av_dict_set(m, tt, ";", AV_DICT_APPEND); } av_dict_set(m, tt, ct, -AV_DICT_DONT_STRDUP_KEY | +AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL | AV_DICT_APPEND); -av_freep(&ct); } } } -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 09/11] avutil/dict: Fix memleak when using AV_DICT_APPEND
If a key already exists in an AVDictionary and the AV_DICT_APPEND flag is set, the old entry is at first discarded from the dictionary, but a pointer to the value is kept. Lateron enough memory to store the appended string is allocated; should this allocation fail, the old string is not freed and hence leaks. This commit changes this. Signed-off-by: Andreas Rheinhardt --- libavutil/dict.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/dict.c b/libavutil/dict.c index 0ea71386e5..190ef196be 100644 --- a/libavutil/dict.c +++ b/libavutil/dict.c @@ -115,8 +115,10 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, if (oldval && flags & AV_DICT_APPEND) { size_t len = strlen(oldval) + strlen(copy_value) + 1; char *newval = av_mallocz(len); -if (!newval) +if (!newval) { +av_free(oldval); goto err_out; +} av_strlcat(newval, oldval, len); av_freep(&oldval); av_strlcat(newval, copy_value, len); -- 2.20.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 1/2] avformat/mp3dec: cosmetics
From: Limin Wang Signed-off-by: Limin Wang --- Note, the patchset are changed after applied mp3 probe fix patchset: https://patchwork.ffmpeg.org/patch/16158/ libavformat/mp3dec.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index eb40362..a047878 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -77,16 +77,16 @@ static int mp3_read_probe(const AVProbeData *p) buf0 = p->buf; end = p->buf + p->buf_size - sizeof(uint32_t); -while(buf0 < end && !*buf0) +while (buf0 < end && !*buf0) buf0++; max_frames = 0; max_framesizes = 0; buf = buf0; -for(; buf < end; buf= buf2+1) { +for (; buf < end; buf = buf2+1) { buf2 = buf; -for(framesizes = frames = 0; buf2 < end; frames++) { +for (framesizes = frames = 0; buf2 < end; frames++) { MPADecodeHeader h; int header_emu = 0; @@ -106,7 +106,7 @@ static int mp3_read_probe(const AVProbeData *p) } max_frames = FFMAX(max_frames, frames); max_framesizes = FFMAX(max_framesizes, framesizes); -if(buf == buf0) { +if (buf == buf0) { first_frames= frames; if (buf2 == end + sizeof(uint32_t)) whole_used = 1; @@ -115,14 +115,14 @@ static int mp3_read_probe(const AVProbeData *p) // keep this in sync with ac3 probe, both need to avoid // issues with MPEG-files! if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1; -else if(max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION; -else if(max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2; -else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) +else if (max_frames>200 && p->buf_size < 2*max_framesizes)return AVPROBE_SCORE_EXTENSION; +else if (max_frames>=4 && p->buf_size < 2*max_framesizes) return AVPROBE_SCORE_EXTENSION / 2; +else if (ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) return p->buf_size < PROBE_BUF_MAX ? AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2; -else if(first_frames > 1 && whole_used) return 5; -else if(max_frames>=1 && p->buf_size < 10*max_framesizes) return 1; +else if (first_frames > 1 && whole_used) return 5; +else if (max_frames>=1 && p->buf_size < 10*max_framesizes) return 1; else return 0; -//mpegps_mp3_unrecognized_format.mpg has max_frames=3 +//mpegps_mp3_unrecognized_format.mpg has max_frames=3 } static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration) @@ -243,8 +243,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, avio_r8(s->pb); /* Encoder delays */ -v= avio_rb24(s->pb); -if(AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E') +v = avio_rb24(s->pb); +if (AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E') || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'f') || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'c') ) { @@ -327,7 +327,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return ret; else if (ret == 0) vbrtag_size = c.frame_size; -if(c.layer != 3) +if (c.layer != 3) return -1; spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ @@ -382,7 +382,7 @@ static int mp3_read_header(AVFormatContext *s) if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) ff_id3v1_read(s); -if(s->pb->seekable & AVIO_SEEKABLE_NORMAL) +if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) mp3->filesize = avio_size(s->pb); if (mp3_parse_vbr_tags(s, st, off) < 0) @@ -442,12 +442,12 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) int ret, size; int64_t pos; -size= MP3_PACKET_SIZE; +size = MP3_PACKET_SIZE; pos = avio_tell(s->pb); -if(mp3->filesize > ID3v1_TAG_SIZE && pos < mp3->filesize) +if (mp3->filesize > ID3v1_TAG_SIZE && pos < mp3->filesize) size= FFMIN(size, mp3->filesize - pos); -ret= av_get_packet(s->pb, pkt, size); +ret = av_get_packet(s->pb, pkt, size); if (ret <= 0) { if(ret<0) return ret; @@ -502,7 +502,7 @@ static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) #define MIN_VALID 3 best_pos = target_pos; best_score = 999; -for(i=0; i 0 ? i - SEEK_WINDOW/4 : -i); int64_t candidate = -1; int score = 999; @@ -510,9 +510,9 @@ static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) if (pos < 0) continue; -for(j=0; jpb, pos, NULL); -if(ret < 0) { +if (ret < 0) { if (ret == CHECK_WRONG_HEADER) {
[FFmpeg-devel] [PATCH v1 2/2] avformat/mp3dec: replace SAME_HEADER_MASK with MP3_MASK
From: Limin Wang mp3 header bitstream syntax: header() { syncword 12bits bslsf id 1bitbslsf layer 2bitbslsf protection_bit 1bit bslsf bitrate_index 4bits bslsf sampling_frequency 2bits bslsf padding_bit 1bit bslsf private_bit 1bit bslsf mode 2bits bslsf mode_extension 2bits bslsf copyright 1bit bslsf original/home 1bit bslsf emphasis 2bits bslsf } if the header is masking with MP3_MASK(0xFFFE0CCF), below fields will be cleared: protection_bit, bitrate_index, sampling_freqency, mode with SAME_HEADER_MASK(0xFFFE0C00), extra below fields will be cleared which didn't make sense: mode_extension, copyright, original/home, emphasis As the MP3_MASK is good for same mp3 header masking and is defined in the header, so it's preferable to remove SAME_HEADER_MASK to keep the masking same. Signed-off-by: Limin Wang --- libavformat/mp3dec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index a047878..71a4ed7 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -42,8 +42,6 @@ #define XING_TOC_COUNT 100 -#define SAME_HEADER_MASK \ - (0xffe0 | (3 << 17) | (3 << 10) | (3 << 19)) typedef struct { AVClass *class; @@ -406,7 +404,7 @@ static int mp3_read_header(AVFormatContext *s) ffio_ensure_seekback(s->pb, i + 1024 + frame_size + 4); ret = check(s->pb, off + i + frame_size, &header2); if (ret >= 0 && -(header & SAME_HEADER_MASK) == (header2 & SAME_HEADER_MASK)) +(header & MP3_MASK) == (header2 & MP3_MASK)) { av_log(s, i > 0 ? AV_LOG_INFO : AV_LOG_VERBOSE, "Skipping %d bytes of junk at %"PRId64".\n", i, off); ret = avio_seek(s->pb, off + i, SEEK_SET); -- 2.6.4 ___ 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/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device
> Am 11.11.2019 um 04:42 schrieb Andriy Gelman : > > +/* check configured pix_fmt matches avctx->pix_fmt */ Is this comment really useful? > +pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, > AV_CODEC_ID_RAWVIDEO); > +if (pix_fmt_output != avctx->pix_fmt) { > +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt_output); > +av_log(priv, AV_LOG_ERROR, "Pixel format not configured. Encoder > requires %s " > + " pixel format. On command line add > setting:" > + " -pix_fmt %s to force correct pixel > format.\n", This should be rarely printed by a library, I don’t think this is a good exception. Thank you for looking into this issue, 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 v6 1/3] hevc_mp4toannexb: Insert correct parameter sets before IRAP
On Tue, 05. Nov 09:25, Andriy Gelman wrote: > On Wed, 30. Oct 09:45, Andriy Gelman wrote: > > On Thu, 24. Oct 20:50, Andriy Gelman wrote: > > > On Tue, 15. Oct 22:50, Andriy Gelman wrote: > > > > From: Andriy Gelman > > > > > > > > Fixes #7799 > > > > > > > > Currently, the mp4toannexb filter always inserts the same extradata at > > > > the start of the first IRAP unit. As in ticket #7799, this can lead to > > > > decoding errors if modified parameter sets are signalled in-band. > > > > > > > > Decoding errors/visual artifacts are also present in the following > > > > fate-suite/hevc-conformance datasets for hevc->mp4->hevc conversion: > > > > -RAP_B_Bossen_1.bit > > > > -RPS_C_ericsson_5.bit > > > > -SLIST_A_Sony_4.bit > > > > -SLIST_B_Sony_8.bit > > > > -SLIST_C_Sony_3.bit > > > > -SLIST_D_Sony_9.bit > > > > -TSKIP_A_MS_2.bit > > > > > > > > This commit solves these errors by keeping track of VPS/SPS/PPS > > > > parameter sets > > > > during the conversion. The correct combination is inserted at the start > > > > of the first IRAP. SEIs from extradata are inserted before each IRAP. > > > > > > > > This commit also makes an update to the hevc-bsf-mp4toannexb fate test > > > > since the result before this patch contained duplicate parameter sets > > > > in-band. > > > > --- > > > > libavcodec/hevc_mp4toannexb_bsf.c | 503 -- > > > > tests/fate/hevc.mak | 2 +- > > > > 2 files changed, 472 insertions(+), 33 deletions(-) > > > > > > > > diff --git a/libavcodec/hevc_mp4toannexb_bsf.c > > > > b/libavcodec/hevc_mp4toannexb_bsf.c > > > > index 09bce5b34c..1ca5f13807 100644 > > > > --- a/libavcodec/hevc_mp4toannexb_bsf.c > > > > +++ b/libavcodec/hevc_mp4toannexb_bsf.c > > > > @@ -23,19 +23,224 @@ > > > > > > > > #include "libavutil/intreadwrite.h" > > > > #include "libavutil/mem.h" > > > > +#include "libavutil/avassert.h" > > > > > > > > #include "avcodec.h" > > > > #include "bsf.h" > > > > #include "bytestream.h" > > > > #include "hevc.h" > > > > +#include "h2645_parse.h" > > > > +#include "hevc_ps.h" > > > > +#include "golomb.h" > > > > > > > > #define MIN_HEVCC_LENGTH 23 > > > > +#define PROFILE_WITHOUT_IDC_BITS88 > > > > +#define IS_IRAP(s) ((s)->type >= 16 && (s)->type <= > > > > 23) > > > > +#define IS_PARAMSET(s) ((s)->type >= 32 && (s)->type <= > > > > 34) > > > > + > > > > +/*reserved VCLs not included*/ > > > > +#define IS_VCL(s) ((s)->type <= 9 || ((s)->type >= > > > > 16 && (s)->type <= 21)) > > > > +#define HEVC_NAL_HEADER_BITS16 > > > > + > > > > +/* > > > > + * Copies data from input buffer to output buffer. Appends annexb > > > > startcode. > > > > + * out must be allocated at least out_len + in_len + write_startcode * > > > > 4. > > > > + */ > > > > +#define WRITE_NAL(out, out_len, in, in_len, write_startcode) do { > > > > \ > > > > +if ((write_startcode)) { > > > > \ > > > > +AV_WB32((out) + (out_len), 1); > > > > \ > > > > +(out_len) += 4; > > > > \ > > > > +} > > > > \ > > > > +memcpy((out) + (out_len), (in), (in_len)); > > > > \ > > > > +(out_len) += (in_len); > > > > \ > > > > +} while (0) > > > > + > > > > +typedef struct Param { > > > > +uint8_t *raw_data; /* raw data to store param set > > > > payload*/ > > > > +int raw_size; /* size of raw_data*/ > > > > +size_t allocated_size;/* allocated size of raw_data*/ > > > > +int ref; /* stores the ref of the higher level > > > > parameter set*/ > > > > +int is_signalled; /* indicates whether this param has > > > > already been signalled in the cvs*/ > > > > +} Param; > > > > + > > > > +/* modified version of HEVCParamSets to store bytestream and reference > > > > to previous level*/ > > > > +typedef struct ParamSets { > > > > +Param vps_list[HEVC_MAX_VPS_COUNT]; > > > > +Param sps_list[HEVC_MAX_SPS_COUNT]; > > > > +Param pps_list[HEVC_MAX_PPS_COUNT]; > > > > + > > > > +Param sei; /* cached SEIs from extradatat*/ > > > > +} ParamSets; > > > > > > > > typedef struct HEVCBSFContext { > > > > uint8_t length_size; > > > > int extradata_parsed; > > > > +ParamSets ps; /* cached VPS/SPS/PPS parameter sets + SEI from > > > > extradata*/ > > > > } HEVCBSFContext; > > > > > > > > +static int update_cached_paramset(AVBSFContext *ctx, Param > > > > *cached_param, > > > > + H2645NAL *nal, int ref) > > > > +{ > > > > +int ret; > > > > + > > > > +if (cached_param->raw_data && cached_param->raw_size == > > > > nal->raw_size
[FFmpeg-devel] [PATCH] avcodec/v4l2_m2m_enc: Check encoder pix_fmt matches pix_fmt on device
From: Andriy Gelman Fixes #8079 During initialization of a v4l2m2m device, the configured pix_fmt can be different to the pix_fmt of the encoder (i.e. avctx->pix_fmt). For example on the Odroid XU4: ./ffmpeg -f lavfi -i yuvtestsrc -codec:v h264_v4l2m2m out.h264 will configure the v4l2 encoder to pix_fmt nv21, whereas the input frames will be yuv444p. This commit checks that the configured v4l2 pix_fmt on device is the same as avctx->pix_fmt. If they are different it returns an error and suggests a cli input that will fix the problem. This has been tested on RPI4 and Odroid XU4. Signed-off-by: Andriy Gelman --- libavcodec/v4l2_m2m_enc.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/v4l2_m2m_enc.c b/libavcodec/v4l2_m2m_enc.c index 474e6bef89..5c8d49bd2c 100644 --- a/libavcodec/v4l2_m2m_enc.c +++ b/libavcodec/v4l2_m2m_enc.c @@ -30,6 +30,7 @@ #include "libavutil/opt.h" #include "v4l2_context.h" #include "v4l2_m2m.h" +#include "v4l2_fmt.h" #define MPEG_CID(x) V4L2_CID_MPEG_VIDEO_##x #define MPEG_VIDEO(x) V4L2_MPEG_VIDEO_##x @@ -288,6 +289,8 @@ static av_cold int v4l2_encode_init(AVCodecContext *avctx) V4L2Context *capture, *output; V4L2m2mContext *s; V4L2m2mPriv *priv = avctx->priv_data; +enum AVPixelFormat pix_fmt_output; +uint32_t v4l2_fmt_output; int ret; ret = ff_v4l2_m2m_create_context(priv, &s); @@ -316,6 +319,22 @@ static av_cold int v4l2_encode_init(AVCodecContext *avctx) } s->avctx = avctx; +if (V4L2_TYPE_IS_MULTIPLANAR(output->type)) +v4l2_fmt_output = output->format.fmt.pix_mp.pixelformat; +else +v4l2_fmt_output = output->format.fmt.pix.pixelformat; + +/* check configured pix_fmt matches avctx->pix_fmt */ +pix_fmt_output = ff_v4l2_format_v4l2_to_avfmt(v4l2_fmt_output, AV_CODEC_ID_RAWVIDEO); +if (pix_fmt_output != avctx->pix_fmt) { +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt_output); +av_log(priv, AV_LOG_ERROR, "Pixel format not configured. Encoder requires %s " + " pixel format. On command line add setting:" + " -pix_fmt %s to force correct pixel format.\n", + av_fourcc2str(v4l2_fmt_output), desc->name); +return AVERROR(EINVAL); +} + return v4l2_prepare_encoder(s); } -- 2.23.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] [RFC PATCH v2] avutil/frame: fix remove_side_data
On Sun, 3 Nov 2019, Zhao Zhili wrote: remove_side_data is supposed to remove a single instance by design. Since new_side_data() doesn't forbid add multiple instances of the same type, remove_side_data should deal with that. --- I'm afraid this patch makes it harder to enforce single entry per type. libavutil/frame.c | 2 +- libavutil/frame.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) Thanks, I will apply this soon. Regards, Marton diff --git a/libavutil/frame.c b/libavutil/frame.c index dcf1fc3d17..e4038096c2 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -806,7 +806,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { int i; -for (i = 0; i < frame->nb_side_data; i++) { +for (i = frame->nb_side_data - 1; i >= 0; i--) { AVFrameSideData *sd = frame->side_data[i]; if (sd->type == type) { free_side_data(&frame->side_data[i]); diff --git a/libavutil/frame.h b/libavutil/frame.h index 5d3231e7bb..b5afb58634 100644 --- a/libavutil/frame.h +++ b/libavutil/frame.h @@ -920,8 +920,7 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); /** - * If side data of the supplied type exists in the frame, free it and remove it - * from the frame. + * Remove and free all side data instances of the given type. */ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); -- 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".
[FFmpeg-devel] [PATCH] avformat/id3v2: Avoid av_strdup for key and value of dict
Signed-off-by: Andreas Rheinhardt --- libavformat/id3v2.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index e9843eef9a..abe073dcc1 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -361,8 +361,8 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen, { uint8_t lang[4]; uint8_t *descriptor = NULL; // 'Content descriptor' -uint8_t *text = NULL; -char *key = NULL; +uint8_t *text; +char *key; int encoding; int ok = 0; @@ -387,18 +387,19 @@ static void read_uslt(AVFormatContext *s, AVIOContext *pb, int taglen, key = av_asprintf("lyrics-%s%s%s", descriptor[0] ? (char *)descriptor : "", descriptor[0] ? "-" : "", lang); -if (!key) +if (!key) { +av_free(text); goto error; +} -av_dict_set(metadata, key, text, 0); +av_dict_set(metadata, key, text, +AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); ok = 1; error: if (!ok) av_log(s, AV_LOG_ERROR, "Error reading lyrics, skipped\n"); av_free(descriptor); -av_free(text); -av_free(key); } /** -- 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 v6.1] avcodec: Add librav1e encoder
On 09/11/2019 22:32, James Almer wrote: > LGTM. Don't forget to add a line to Changelog and bump lavc minor before > pushing. Done and pushed. Thanks! - Derek ___ 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] Add a new channel layout API
On 11/10/19, Vittorio Giovara wrote: > On Mon, Oct 28, 2019 at 10:48 PM Paul B Mahol wrote: > >> The new API is more extensible and allows for custom layouts. >> More accurate information is exported, eg for decoders that do not >> set a channel layout, lavc will not make one up for them. >> >> Deprecate the old API working with just uint64_t bitmasks. >> >> Original commit by Anton Khirnov . >> Expanded and completed by Vittorio Giovara . >> Adapted for FFmpeg by Paul B Mahol . >> >> Signed-off-by: Anton Khirnov >> Signed-off-by: Vittorio Giovara >> Signed-off-by: Paul B Mahol >> --- >> > > Hello, > this seems to coming from an outdated branch. > > Please use https://git.khirnov.net/libav.git/log/?h=ambisonic2 as > reference: it contains several improvements from the last iteration, such > as a fully functional backward compatibility layer, and a reworked > implementation of ambisonics, and contains a fully rebased tree with all > ffmpeg formats and codecs. > > Really looking forward to getting this merged, thanks for your help in the > process. Only way to get this approved is sending it to this mailing list. > -- > Vittorio > ___ > 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] Add a new channel layout API
On Mon, Oct 28, 2019 at 10:48 PM Paul B Mahol wrote: > The new API is more extensible and allows for custom layouts. > More accurate information is exported, eg for decoders that do not > set a channel layout, lavc will not make one up for them. > > Deprecate the old API working with just uint64_t bitmasks. > > Original commit by Anton Khirnov . > Expanded and completed by Vittorio Giovara . > Adapted for FFmpeg by Paul B Mahol . > > Signed-off-by: Anton Khirnov > Signed-off-by: Vittorio Giovara > Signed-off-by: Paul B Mahol > --- > Hello, this seems to coming from an outdated branch. Please use https://git.khirnov.net/libav.git/log/?h=ambisonic2 as reference: it contains several improvements from the last iteration, such as a fully functional backward compatibility layer, and a reworked implementation of ambisonics, and contains a fully rebased tree with all ffmpeg formats and codecs. Really looking forward to getting this merged, thanks for your help in the process. -- Vittorio ___ 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".