From: Pierre-Anthony Lemieux <pal@sandflow.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v4 1/2] avformat: refactor ff_stream_encode_params_copy() to ff_stream_params_copy() Date: Sun, 31 Jul 2022 14:53:24 -0700 Message-ID: <CAF_7JxCN_UyZzQ9AyYNNMU-3Gvtns3HRs+LOfid4imBtAt94uA@mail.gmail.com> (raw) In-Reply-To: <ef48d32a-8515-00e4-8130-e77e0c37a6aa@gmail.com> On Sun, Jul 31, 2022 at 2:02 PM James Almer <jamrial@gmail.com> wrote: > > On 7/31/2022 5:37 PM, pal@sandflow.com wrote: > > diff --git a/libavformat/avformat.c b/libavformat/avformat.c > > index 30d6ea6a49..1d0ac5ab7e 100644 > > --- a/libavformat/avformat.c > > +++ b/libavformat/avformat.c > > @@ -235,6 +235,47 @@ int ff_stream_side_data_copy(AVStream *dst, const AVStream *src) > > return 0; > > } > > > > +int ff_stream_params_copy(AVStream *dst, const AVStream *src) > > +{ > > + int ret; > > + > > + dst->id = src->id; > > + dst->time_base = src->time_base; > > + dst->start_time = src->start_time; > > + dst->duration = src->duration; > > + dst->nb_frames = src->nb_frames; > > + dst->disposition = src->disposition; > > + dst->discard = src->discard; > > + dst->sample_aspect_ratio = src->sample_aspect_ratio; > > + dst->avg_frame_rate = src->avg_frame_rate; > > + dst->event_flags = src->event_flags; > > + dst->r_frame_rate = src->r_frame_rate; > > + dst->pts_wrap_bits = src->pts_wrap_bits; > > + > > + av_dict_free(&dst->metadata); > > + ret = av_dict_copy(&dst->metadata, src->metadata, 0); > > + if (ret < 0) > > + return ret; > > + > > + ret = avcodec_parameters_copy(dst->codecpar, src->codecpar); > > + if (ret < 0) > > + return ret; > > + > > + ret = ff_stream_side_data_copy(dst, src); > > + if (ret < 0) > > + return ret; > > + > > + if (src->attached_pic.size > 0) { > > + ret = av_packet_ref(&dst->attached_pic, &src->attached_pic); > > + if (ret < 0) > > + return ret; > > + } else { > > + av_packet_unref(&dst->attached_pic); > > This would need to be called unconditionally, like you did for > dst->metadata, and just if src->attached_pic is empty. Thanks. I had incorrectly assumed that av_packet_ref() first unref'ed the destination. Addressed at v5: http://ffmpeg.org/pipermail/ffmpeg-devel/2022-August/299515.html > > > + } > > + > > + return 0; > > +} > > + > > AVProgram *av_new_program(AVFormatContext *ac, int id) > > { > > AVProgram *program = NULL; > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@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-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-07-31 21:53 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-31 20:37 pal 2022-07-31 20:37 ` [FFmpeg-devel] [PATCH v4 2/2] avformat/imfdec: preserve stream information pal 2022-07-31 21:02 ` [FFmpeg-devel] [PATCH v4 1/2] avformat: refactor ff_stream_encode_params_copy() to ff_stream_params_copy() James Almer 2022-07-31 21:53 ` Pierre-Anthony Lemieux [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAF_7JxCN_UyZzQ9AyYNNMU-3Gvtns3HRs+LOfid4imBtAt94uA@mail.gmail.com \ --to=pal@sandflow.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git