[FFmpeg-devel] [PATCH] segment: fix remuxing and copy metadata
Michael Niedermayer
michaelni at gmx.at
Tue Sep 2 12:32:33 CEST 2014
On Mon, Sep 01, 2014 at 08:05:44PM +0300, Mika Raento wrote:
> To get mpegts metadata copied when segmenting.
> ---
> libavformat/segment.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 1cb6454..0be77da 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -139,6 +139,15 @@ static int segment_mux_init(AVFormatContext *s)
> return AVERROR(ENOMEM);
>
> oc->oformat = seg->oformat;
> + if (oc->oformat->priv_data_size > 0) {
> + oc->priv_data = av_mallocz(oc->oformat->priv_data_size);
> + if (!oc->priv_data)
> + return AVERROR(ENOMEM);
> + if (oc->oformat->priv_class) {
> + *(const AVClass **) oc->priv_data = oc->oformat->priv_class;
> + av_opt_set_defaults(oc->priv_data);
> + }
> + }
implemented simpler & applied
> oc->interrupt_callback = s->interrupt_callback;
> av_dict_copy(&oc->metadata, s->metadata, 0);
>
> @@ -159,6 +168,9 @@ static int segment_mux_init(AVFormatContext *s)
> ocodec->codec_tag = 0;
> }
> st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
> + if (s->streams[i]->metadata) {
> + av_dict_copy(&st->metadata, s->streams[i]->metadata, 0);
> + }
> }
>
> return 0;
applied without the null check, which should be unneeded
> @@ -220,8 +232,10 @@ static int segment_start(AVFormatContext *s, int write_header)
> return err;
> }
>
> - if (oc->oformat->priv_class && oc->priv_data)
> - av_opt_set(oc->priv_data, "resend_headers", "1", 0); /* mpegts specific */
> + if (oc->oformat->priv_class && oc->priv_data) {
> + av_log(s, AV_LOG_VERBOSE, "setting mpegts resend_headers\n");
> + av_opt_set(oc->priv_data, "mpegts_flags", "resend_headers", 0);
> + }
applied without the av_log, as it would be printed even if the format
isnt mpegts and the option wouldnt be successfully set in that case
also not sure how usefull the av_log is for mpegts
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140902/68db2782/attachment.asc>
More information about the ffmpeg-devel
mailing list