I am using that. It's pretty old code; idea was to configure codec context in its own C++ wrapper and then either just use it and get raw bitstream out, or to attach codec wrapper to avformat wrapper (which would create its own codec context attached to muxer, copy all the configuration from original codec context and open this new context). It worked fine for few years until I tried to add HW accel support and it blew up. Anyway, it is going to be deprecated, and AVCodecParameters API gives me a much nicer alternative; definitely gonna migrate over when I have the time. Only remaining link from avformat to avcodec would be the "global header" setting; I wonder if it is be eliminated somehow too (I imagine a bitstream filter could be written to get extradata and put it in-band in a codec-specific manner).
2016-05-25 15:10 GMT+03:00 Anton Khirnov <[email protected]>: > Quoting Andrey Turkin (2016-05-25 13:16:14) > > avcodec_copy_context didn't handle hw_frames_ctx references > > correctly which could cause crashes. > > > > In v2: applied comments from ML > > --- > > libavcodec/options.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/libavcodec/options.c b/libavcodec/options.c > > index 117ae5e..18613ac 100644 > > --- a/libavcodec/options.c > > +++ b/libavcodec/options.c > > @@ -190,6 +190,7 @@ int avcodec_copy_context(AVCodecContext *dest, const > AVCodecContext *src) > > dest->inter_matrix = NULL; > > dest->rc_override = NULL; > > dest->subtitle_header = NULL; > > + dest->hw_frames_ctx = NULL; > > #if FF_API_MPV_OPT > > FF_DISABLE_DEPRECATION_WARNINGS > > dest->rc_eq = NULL; > > @@ -219,13 +220,21 @@ int avcodec_copy_context(AVCodecContext *dest, > const AVCodecContext *src) > > dest->subtitle_header_size = src->subtitle_header_size; > > #undef alloc_and_copy_or_fail > > > > + if (src->hw_frames_ctx) { > > + dest->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx); > > + if (!dest->hw_frames_ctx) > > + goto fail; > > + } > > + > > return 0; > > > > fail: > > + av_freep(&dest->subtitle_header); > > av_freep(&dest->rc_override); > > av_freep(&dest->intra_matrix); > > av_freep(&dest->inter_matrix); > > av_freep(&dest->extradata); > > + av_buffer_unref(&dest->hw_frames_ctx); > > #if FF_API_MPV_OPT > > FF_DISABLE_DEPRECATION_WARNINGS > > av_freep(&dest->rc_eq); > > -- > > 2.7.3 > > Thanks, queueing. > > Out of interest - are you using avcodec_copy_context() in your own code > in combination with hw_frames_ctx? What's the use case? > > -- > Anton Khirnov > _______________________________________________ > libav-devel mailing list > [email protected] > https://lists.libav.org/mailman/listinfo/libav-devel > _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
