Changes between Version 1 and Version 2 of Ticket #13186, comment 5


Ignore:
Timestamp:
Dec 13, 2017, 10:56:35 PM (6 years ago)
Author:
Peter Bennett
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13186, comment 5

    v1 v2  
    11Patch 005 - deprecated AVStream::codec and avcodec_close
    22
    3 '''There are some problems with this patch. It is trying to use AVCodecContext is some places where there is no codec and thus no AVCodecContext. I am reworking the patch. Check back for updates.'''
     3'''This patch has been updated. The original patch crashed on some streams that do not have codecs (e.g. MHEG). It is now changed to use stream->codecpar wherever possible, and to check whether an AVCodecContext exists in cases where it may have failed to be created. There is still a problem that stream->codec is used by some MythTV modifications to FFMPEG code. As of this patch it is still using stream->codec in those cases.'''
    44
    55In the old method, ffmpeg automatically creates an AVCodecContext for every AVStream. The context can be opened and closed again any number of times. This is deprecated and the application code is now responsible for creating and freeing an  AVCodecContext when needed. The  AVCodecContext that the application creates may not be opened and closed more than once. The deprecated function avcodec_close must not be called on an AVCodecContext that you create, instead you have to free the AVCodecContext (using avcodec_free_context) and allocate a new one if you want to read the stream again.
     6
     7In many cases, reference fields in AVStream::codec are now available in AVStream::codecpar. Where possible the code now uses those fields, to avoid having to create an AVCodecContext.
    68
    79"codec" no longer shows in the online documentation for AVStream. It is only defined in ffmpeg if you define FF_API_LAVF_AVCTX when compiling ffmpeg. See external/FFmpeg/libavformat/version.h, which has a list of defines that will be set in future to disable this and others. For more information google FF_API_LAVF_AVCTX. Instead of AVStream::codec, the AVStream::codecpar structure contains the information you need to allocate your own AVStream.