On Tue, Nov 11, 2014 at 11:57:40PM +0100, Lukasz Marek wrote: > On 11.11.2014 18:03, Michael Niedermayer wrote: > >On Tue, Nov 11, 2014 at 04:41:17PM +0100, Lukasz Marek wrote: > >>On 11.11.2014 08:31, Lukasz Marek wrote: > >>>Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> > >>>--- > >>> ffmpeg_opt.c | 48 ++++++++++++++++++++++++++++++++---------------- > >>> 1 file changed, 32 insertions(+), 16 deletions(-) > >> > >>Thanks for the hint with opt_target() > >>It is indeed simpler and cleaner. > >>Updated patch attached. > >> > >>Following patch dropped: > >>[PATCH 4/9] ffmpeg_opt: allow to force codec in new_output_stream > > > >> ffmpeg_opt.c | 50 +++++++++++++++++++++++++++++++++++--------------- > >> 1 file changed, 35 insertions(+), 15 deletions(-) > >>99c8226c4dc0258ebe2a4e223fae49c87c8f8d33 > >>0001-ffmpeg_opt-use-codec-private-context-in-ffserver-str.patch > >> From 042e92b4f4b0d25e3d133c5dac92e483c425becf Mon Sep 17 00:00:00 2001 > >>From: Lukasz Marek <lukasz.m.lu...@gmail.com> > >>Date: Tue, 11 Nov 2014 05:19:27 +0100 > >>Subject: [PATCH] ffmpeg_opt: use codec private context in ffserver streams > >> > >>Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> > >>--- > >> ffmpeg_opt.c | 50 +++++++++++++++++++++++++++++++++++--------------- > >> 1 file changed, 35 insertions(+), 15 deletions(-) > >> > >>diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c > >>index 77ef0c4..ed84d73 100644 > >>--- a/ffmpeg_opt.c > >>+++ b/ffmpeg_opt.c > >>@@ -1617,6 +1617,35 @@ static int copy_chapters(InputFile *ifile, > >>OutputFile *ofile, int copy_metadata) > >> return 0; > >> } > >> > >>+static int ffserver_streams_copy_context(AVCodecContext *dest, const > >>AVCodecContext *src) > >>+{ > >>+ int ret; > >>+ if ((ret = avcodec_copy_context(dest, src)) < 0) > >>+ return ret; > >>+ if (src->priv_data) { > >>+ if (dest->priv_data && *(const AVClass**)src->priv_data != *(const > >>AVClass**)dest->priv_data) { > > > >>+ av_opt_free(dest->priv_data); > > > >that assumes that theres a AVClass as first element of priv_data, > >that does not have to be so. > >AVCodec.priv_class has to be checked at least > > > > > >>+ av_freep(&dest->priv_data); > >>+ } > >>+ if (!dest->priv_data) { > >>+ if (!src->codec) { > >>+ av_log(NULL, AV_LOG_WARNING, "Cannot copy codec private > >>options. They won't get applied.\n"); > >>+ return 0; > >>+ } > >>+ dest->priv_data = av_mallocz(src->codec->priv_data_size); > >>+ if (!dest->priv_data) > >>+ return AVERROR(ENOMEM); > >>+ *(const AVClass**)dest->priv_data = src->codec->priv_class; > > > >priv_data_size could be 0 > > > >except these the code is ugly* but probably ok > > New version seems to be cleaner, hopely ok. > I changed according to your solution to keep recommended configuration. > Not sure it is possible case, but setting encoder priv context in > decoder may be danger if someone really used it as decoder with > mismatched private data. >
> ffmpeg_opt.c | 48 +++++++++++++++++++++++++++++++++--------------- > 1 file changed, 33 insertions(+), 15 deletions(-) > ee0d90f169fc6445a8e4051b52151f72231e1dbb > 0002-ffmpeg_opt-use-codec-private-context-in-ffserver-str.patch > From b4533ffaa62a94e5ca8d350bd76bd32ea44986f2 Mon Sep 17 00:00:00 2001 > From: Lukasz Marek <lukasz.m.lu...@gmail.com> > Date: Tue, 11 Nov 2014 05:19:27 +0100 > Subject: [PATCH 2/2] ffmpeg_opt: use codec private context in ffserver streams > > Signed-off-by: Lukasz Marek <lukasz.m.lu...@gmail.com> probably ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are best at talking, realize last or never when they are wrong.
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel