From: James Almer <jamrial@gmail.com> To: 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 18:02:32 -0300 Message-ID: <ef48d32a-8515-00e4-8130-e77e0c37a6aa@gmail.com> (raw) In-Reply-To: <20220731203758.15667-1-pal@sandflow.com> 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. > + } > + > + 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".
next prev parent reply other threads:[~2022-07-31 21:02 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 ` James Almer [this message] 2022-07-31 21:53 ` [FFmpeg-devel] [PATCH v4 1/2] avformat: refactor ff_stream_encode_params_copy() to ff_stream_params_copy() Pierre-Anthony Lemieux
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=ef48d32a-8515-00e4-8130-e77e0c37a6aa@gmail.com \ --to=jamrial@gmail.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