| @@ -35,6 +35,7 @@ · 34 unmodified lines |
| 35 | #include "libavutil/cpu.h" | 35 | #include "libavutil/cpu.h" |
| 36 | #include "libavutil/dict.h" | 36 | #include "libavutil/dict.h" |
| 37 | #include "libavutil/frame.h" | 37 | #include "libavutil/frame.h" |
| | 38 | #include "libavutil/hwcontext.h" |
| 38 | #include "libavutil/log.h" | 39 | #include "libavutil/log.h" |
| 39 | #include "libavutil/pixfmt.h" | 40 | #include "libavutil/pixfmt.h" |
| 40 | #include "libavutil/rational.h" | 41 | #include "libavutil/rational.h" |
| @@ -2748,6 +2749,61 @@ typedef struct AVProfile { · 2707 unmodified lines |
| 2748 | const char *name; ///< short name for the profile | 2749 | const char *name; ///< short name for the profile |
| 2749 | } AVProfile; | 2750 | } AVProfile; |
| 2750 | | 2751 | |
| | 2752 | enum { |
| | 2753 | /** |
| | 2754 | * The codec supports this format via the hw_device_ctx interface. |
| | 2755 | * |
| | 2756 | * When selecting this format, AVCodecContext.hw_device_ctx should |
| | 2757 | * have been set to a device of the specified type before calling |
| | 2758 | * avcodec_open2(). |
| | 2759 | */ |
| | 2760 | AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01, |
| | 2761 | /** |
| | 2762 | * The codec supports this format via the hw_frames_ctx interface. |
| | 2763 | * |
| | 2764 | * When selecting this format for a decoder, |
| | 2765 | * AVCodecContext.hw_frames_ctx should be set to a suitable frames |
| | 2766 | * context inside the get_format() callback. The frames context |
| | 2767 | * must have been created on a device of the specified type. |
| | 2768 | */ |
| | 2769 | AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02, |
| | 2770 | /** |
| | 2771 | * The codec supports this format by some internal method. |
| | 2772 | * |
| | 2773 | * This format can be selected without any additional configuration - |
| | 2774 | * no device or frames context is required. |
| | 2775 | */ |
| | 2776 | AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04, |
| | 2777 | /** |
| | 2778 | * The codec supports this format by some ad-hoc method. |
| | 2779 | * |
| | 2780 | * Additional settings and/or function calls are required. See the |
| | 2781 | * codec-specific documentation for details. (Methods requiring |
| | 2782 | * this sort of configuration are deprecated and others should be |
| | 2783 | * used in preference.) |
| | 2784 | */ |
| | 2785 | AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08, |
| | 2786 | }; |
| | 2787 | |
| | 2788 | typedef struct AVCodecHWConfig { |
| | 2789 | /** |
| | 2790 | * A hardware pixel format which the codec can use. |
| | 2791 | */ |
| | 2792 | enum AVPixelFormat pix_fmt; |
| | 2793 | /** |
| | 2794 | * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible |
| | 2795 | * setup methods which can be used with this configuration. |
| | 2796 | */ |
| | 2797 | int methods; |
| | 2798 | /** |
| | 2799 | * The device type associated with the configuration. |
| | 2800 | * |
| | 2801 | * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and |
| | 2802 | * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused. |
| | 2803 | */ |
| | 2804 | enum AVHWDeviceType device_type; |
| | 2805 | } AVCodecHWConfig; |
| | 2806 | |
| 2751 | typedef struct AVCodecDefault AVCodecDefault; | 2807 | typedef struct AVCodecDefault AVCodecDefault; |
| 2752 | | 2808 | |
| 2753 | struct AVSubtitle; | 2809 | struct AVSubtitle; |
| @@ -2884,8 +2940,26 @@ typedef struct AVCodec { · 130 unmodified lines |
| 2884 | * packets before decoding. | 2940 | * packets before decoding. |
| 2885 | */ | 2941 | */ |
| 2886 | const char *bsfs; | 2942 | const char *bsfs; |
| | 2943 | |
| | 2944 | /** |
| | 2945 | * Array of pointers to hardware configurations supported by the codec, |
| | 2946 | * or NULL if no hardware supported. The array is terminated by a NULL |
| | 2947 | * pointer. |
| | 2948 | * |
| | 2949 | * The user can only access this field via avcodec_get_hw_config(). |
| | 2950 | */ |
| | 2951 | const struct AVCodecHWConfigInternal **hw_configs; |
| 2887 | } AVCodec; | 2952 | } AVCodec; |
| 2888 | | 2953 | |
| | 2954 | /** |
| | 2955 | * Retrieve supported hardware configurations for a codec. |
| | 2956 | * |
| | 2957 | * Values of index from zero to some maximum return the indexed configuration |
| | 2958 | * descriptor; all other values return NULL. If the codec does not support |
| | 2959 | * any hardware configurations then it will always return NULL. |
| | 2960 | */ |
| | 2961 | const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index); |
| | 2962 | |
| 2889 | /** | 2963 | /** |
| 2890 | * @defgroup lavc_hwaccel AVHWAccel | 2964 | * @defgroup lavc_hwaccel AVHWAccel |
| 2891 | * @{ | 2965 | * @{ |