Revision b38f008e libavcodec/avcodec.h

View differences:

libavcodec/avcodec.h
32 32
#include "libavutil/cpu.h"
33 33

  
34 34
#define LIBAVCODEC_VERSION_MAJOR 52
35
#define LIBAVCODEC_VERSION_MINOR 110
35
#define LIBAVCODEC_VERSION_MINOR 111
36 36
#define LIBAVCODEC_VERSION_MICRO  0
37 37

  
38 38
#define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
728 728
 * Codec is able to deal with negative linesizes
729 729
 */
730 730
#define CODEC_CAP_NEG_LINESIZES    0x0800
731
/**
732
 * Codec supports frame-level multithreading.
733
 */
734
#define CODEC_CAP_FRAME_THREADS    0x1000
731 735

  
732 736
//The following defines may change, don't expect compatibility if you use them.
733 737
#define MB_TYPE_INTRA4x4   0x0001
......
1029 1033
    int64_t pkt_dts;\
1030 1034
\
1031 1035
    /**\
1036
     * the AVCodecContext which ff_thread_get_buffer() was last called on\
1037
     * - encoding: Set by libavcodec.\
1038
     * - decoding: Set by libavcodec.\
1039
     */\
1040
    struct AVCodecContext *owner;\
1041
\
1042
    /**\
1043
     * used by multithreading to store frame-specific info\
1044
     * - encoding: Set by libavcodec.\
1045
     * - decoding: Set by libavcodec.\
1046
     */\
1047
    void *thread_opaque;\
1048
\
1049
    /**\
1032 1050
     * frame timestamp estimated using various heuristics, in stream time base\
1033 1051
     * - encoding: unused\
1034 1052
     * - decoding: set by libavcodec, read by user.\
......
1246 1264
     * decoder to draw a horizontal band. It improves cache usage. Not
1247 1265
     * all codecs can do that. You must check the codec capabilities
1248 1266
     * beforehand.
1267
     * When multithreading is used, it may be called from multiple threads
1268
     * at the same time; threads might draw different parts of the same AVFrame,
1269
     * or multiple AVFrames, and there is no guarantee that slices will be drawn
1270
     * in order.
1249 1271
     * The function is also used by hardware acceleration APIs.
1250 1272
     * It is called at least once during frame decoding to pass
1251 1273
     * the data needed for hardware render.
......
1499 1521
     * if CODEC_CAP_DR1 is not set then get_buffer() must call
1500 1522
     * avcodec_default_get_buffer() instead of providing buffers allocated by
1501 1523
     * some other means.
1524
     * If frame multithreading is used and thread_safe_callbacks is set,
1525
     * it may be called from a different thread, but not from more than one at once.
1526
     * Does not need to be reentrant.
1502 1527
     * - encoding: unused
1503 1528
     * - decoding: Set by libavcodec, user can override.
1504 1529
     */
......
1508 1533
     * Called to release buffers which were allocated with get_buffer.
1509 1534
     * A released buffer can be reused in get_buffer().
1510 1535
     * pic.data[*] must be set to NULL.
1536
     * May be called from a different thread if frame multithreading is used,
1537
     * but not by more than one thread at once, so does not need to be reentrant.
1511 1538
     * - encoding: unused
1512 1539
     * - decoding: Set by libavcodec, user can override.
1513 1540
     */
......
1811 1838
#define FF_DEBUG_VIS_QP      0x00002000
1812 1839
#define FF_DEBUG_VIS_MB_TYPE 0x00004000
1813 1840
#define FF_DEBUG_BUFFERS     0x00008000
1841
#define FF_DEBUG_THREADS     0x00010000
1814 1842

  
1815 1843
    /**
1816 1844
     * debug
......
2836 2864
    AVPacket *pkt;
2837 2865

  
2838 2866
    /**
2867
     * Whether this is a copy of the context which had init() called on it.
2868
     * This is used by multithreading - shared tables and picture pointers
2869
     * should be freed from the original context only.
2870
     * - encoding: Set by libavcodec.
2871
     * - decoding: Set by libavcodec.
2872
     */
2873
    int is_copy;
2874

  
2875
    /**
2876
     * Which multithreading methods to use.
2877
     * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread,
2878
     * so clients which cannot provide future frames should not use it.
2879
     *
2880
     * - encoding: Set by user, otherwise the default is used.
2881
     * - decoding: Set by user, otherwise the default is used.
2882
     */
2883
    int thread_type;
2884
#define FF_THREAD_FRAME   1 //< Decode more than one frame at once
2885
#define FF_THREAD_SLICE   2 //< Decode more than one part of a single frame at once
2886

  
2887
    /**
2888
     * Which multithreading methods are in use by the codec.
2889
     * - encoding: Set by libavcodec.
2890
     * - decoding: Set by libavcodec.
2891
     */
2892
    int active_thread_type;
2893

  
2894
    /**
2895
     * Set by the client if its custom get_buffer() callback can be called
2896
     * from another thread, which allows faster multithreaded decoding.
2897
     * draw_horiz_band() will be called from other threads regardless of this setting.
2898
     * Ignored if the default get_buffer() is used.
2899
     * - encoding: Set by user.
2900
     * - decoding: Set by user.
2901
     */
2902
    int thread_safe_callbacks;
2903

  
2904
    /**
2839 2905
     * Current statistics for PTS correction.
2840 2906
     * - decoding: maintained and used by libavcodec
2841 2907
     * - encoding: unused
......
2897 2963
    uint8_t max_lowres;                     ///< maximum value for lowres supported by the decoder
2898 2964
    AVClass *priv_class;                    ///< AVClass for the private context
2899 2965
    const AVProfile *profiles;              ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
2966

  
2967
    /**
2968
     * @defgroup framethreading Frame-level threading support functions.
2969
     * @{
2970
     */
2971
    /**
2972
     * If defined, called on thread contexts when they are created.
2973
     * If the codec allocates writable tables in init(), re-allocate them here.
2974
     * priv_data will be set to a copy of the original.
2975
     */
2976
    int (*init_thread_copy)(AVCodecContext *);
2977
    /**
2978
     * Copy necessary context variables from a previous thread context to the current one.
2979
     * If not defined, the next thread will start automatically; otherwise, the codec
2980
     * must call ff_thread_finish_setup().
2981
     *
2982
     * dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
2983
     */
2984
    int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src);
2985
    /** @} */
2900 2986
} AVCodec;
2901 2987

  
2902 2988
/**

Also available in: Unified diff