summaryrefslogtreecommitdiff
path: root/libavcodec/avcodec.c
Commit message (Collapse)AuthorAge
* avcodec: add a Film Grain codec property flagJames Almer2021-08-24
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including bsf.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include bsf.h directly wherever it is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Don't free options on failure in avcodec_open2()Andreas Rheinhardt2021-06-08
| | | | | | | | | | Instead return the dictionary in the state it is at the time the error occurred. This is more in line with the description of this parameter and allows to notify the user of unrecognized options if an error happens lateron (which might very well be due to e.g. misspelled options). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Avoid redundant copies of options in avcodec_open2Andreas Rheinhardt2021-06-08
| | | | | | | It is no longer necessary now that ff_frame_thread_encoder_init() no longer receives an options dictionary. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/frame_thread_encoder: Avoid dictionariesAndreas Rheinhardt2021-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | avcodec_open2() allows to provide options via an AVDictionary; but it is also allowed to set options by simply setting the value of the AVCodecContext or via the AVOptions API if the codec has a private class. Any options provided via an AVDictionary have already been applied before ff_frame_thread_init(), so in order to copy all the options from the main AVCodecContext and its private context, it is enough to av_opt_copy() these options. The current code does this, but it does more: It also copies the user-provided AVDictionary and uses it for the initialization of each of the worker-AVCodecContexts. This is completely unnecessary, because said options have already been copied from the main context. Furthermore, these options were also examined to decide if frame threading should be used for huffman encoding in case this would incur nondeterminism. This is wrong, because options not set via an AVDictionary are ignored. Instead inspect the values stored in the contexts directly. (In order to maintain the current behaviour, the default value of the "non_deterministic" option has been changed to false, because the absence of an entry with said key in the AVDictionary had the consequence of disallowing nondeterminism.) Finally, the AVDictionary has been removed from the signature of ff_frame_thread_encoder_init(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Use avcodec_close() on avcodec_open2() failureAndreas Rheinhardt2021-04-28
| | | | | | | | | | | | | | | | | | | | | | Compared to the earlier behaviour the following changes: a) AVCodecInternal.byte_buffer is freed. b) The last_pkt_props FIFO is emptied before freeing it. c) If set AVCodecContext.hwaccel is uninitialized and its private data is freed; hw_frames_ctx and hw_device_ctx are also unreferenced. d) coded_side_data is freed. e) active_thread_type is reset. a), b), d) should be no-ops as the buffer/fifo should be empty and no coded_side_data should exist at any point of avcodec_open2(). e) is obviously not bad. c) is in accordance with the documentation of hw_(frames|device)_ctx which states that libacodec takes over ownership of these references. At least in the case of VC-1 it is possible for the hw acceleration to be set during init and in this case freeing it actually fixes a memleak. avcodec_close() needed only minor adjustments to make it work with a potentially not fully initialized codec. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Store whether AVCodec->close needs to be calledAndreas Rheinhardt2021-04-28
| | | | | | | | | | | | | | | Right now all AVCodecContexts except those using frame-threaded decoding call the codec's init function and expect its close function to be called. In order to make sure that the close function is not called for frame-threaded decoding ff_frame_thread_free() resets AVCodecContext.codec (and because of this it has to free the private AVOptions of the main AVCodecContext itself). This is not obvious and potentially fragile. Instead add a field to AVCodecInternal that indicates whether close should be called for this AVCodecContext. It is always zero when using frame-threaded decoding, so that resetting the codec is no longer necessary and has been removed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Free frame_thread_encoder on avcodec_open2() errorAndreas Rheinhardt2021-04-28
| | | | | | | | The frame_thread_encoder has so far not been freed in case an error happened in avcodec_open2() after ff_frame_thread_encoder_init(). This commit changes this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Remove deprecated old encode/decode APIsAndreas Rheinhardt2021-04-27
| | | | | | | | Deprecated in commits 7fc329e2dd6226dfecaa4a1d7adf353bf2773726 and 31f6a4b4b83aca1d73f3cfc99ce2b39331970bf3. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated AVCodecContext.coded_frameAndreas Rheinhardt2021-04-27
| | | | | | | | | | Deprecated in 40cf1bbacc6220a0aa6bed5c331871d43f9ce370. (The currently disabled filter vf_mcdeint and vf_uspp were users of this field; they have not been changed, so that whoever wants to fix them can see the state of these filters when they were disabled.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove lock manager APIAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in a04c2c707de2ce850f79870e84ac9d7ec7aa9143. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avcodec: Actually honour the documentation of subtitle_headerAndreas Rheinhardt2021-04-24
| | | | | | | | | | It is only supposed to be freed by libavcodec for decoders, yet avcodec_open2() always frees it on failure. Furthermore, avcodec_close() doesn't free it for decoders. Both of this has been changed. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Use AVBPrint in avcodec_string()Andreas Rheinhardt2021-03-24
| | | | | | | | It automatically records the current length of the string, whereas the current code contains lots of instances of snprintf(buf + strlen(buf), buf_size - strlen(buf), ...). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Update check for identical colorspace/primaries/trc namesAndreas Rheinhardt2021-03-24
| | | | | | | | | | | | | | | | | If the numerical constants for colorspace, transfer characteristics and color primaries coincide, the current code presumes the corresponding names to be identical and prints only one of them obtained via av_get_colorspace_name(). There are two issues with this: The first is that the underlying assumption is wrong: The names only coincide in the 0-7 range, they differ for more recent additions. The second is that av_get_colorspace_name() is outdated itself; it has not been updated with the names of the newly defined colorspaces. Fix both of this by using the names from av_color_(space|primaries|transfer)_name() and comparing them via strcmp; don't use av_get_colorspace_name() at all. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Don't use NULL for %s printf specifierAndreas Rheinhardt2021-03-24
| | | | | | | Our "get name" functions can return NULL for invalid/unknown arguments. So check for this. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Use dedicated pointer to access AVCodecInternalAndreas Rheinhardt2021-03-24
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Move decoder channel count check to ff_decode_preinitAndreas Rheinhardt2021-03-20
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Sanitize options before using themAndreas Rheinhardt2021-03-20
| | | | | | | | | This is how it is supposed to happen, yet when using frame threading, the codec's init function has been called before preinit. This can lead to crashes when e.g. using unsupported lowres values for decoders together with frame threading. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Perform sub_charenc/iconv checks before AVCodec.init()Andreas Rheinhardt2021-03-20
| | | | | | Also move them to ff_decode_preinit(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/avcodec: Check earlier for codec id/type mismatchAndreas Rheinhardt2021-03-20
| | | | | | | These fields can't be set via AVOptions, ergo one can check them before having allocated anything. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: move core AVCodecContext functions from util.c to a new fileJames Almer2021-03-19
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* broken mess removialMichael Niedermayer2004-09-29
| | | | Originally committed as revision 3539 to svn://svn.ffmpeg.org/ffmpeg/trunk
* libdts support by (Benjamin Zores <ben at geexbox dot org>)Michael Niedermayer2004-07-14
| | | | Originally committed as revision 3310 to svn://svn.ffmpeg.org/ffmpeg/trunk
* flash video (flv) support patch by (Garrick Meeker <gmeeker at theoryllc dot ↵Garrick Meeker2003-07-09
| | | | | | com>) Originally committed as revision 2024 to svn://svn.ffmpeg.org/ffmpeg/trunk
* per file doxyMichael Niedermayer2003-03-06
| | | | Originally committed as revision 1634 to svn://svn.ffmpeg.org/ffmpeg/trunk
* * still unfinished code for OptionsZdenek Kabelac2003-02-10
| | | | | | * demo code - awating more comments Originally committed as revision 1569 to svn://svn.ffmpeg.org/ffmpeg/trunk
* * useless commit - ignoreZdenek Kabelac2002-11-11
| | | | Originally committed as revision 1193 to svn://svn.ffmpeg.org/ffmpeg/trunk
* * first shot for the new avcodec APIZdenek Kabelac2002-05-14
- comments, critics, improvements on the ffmpeg list are welcomed Originally committed as revision 494 to svn://svn.ffmpeg.org/ffmpeg/trunk