MythTV  master
mythcodecid.h
Go to the documentation of this file.
1 #ifndef _MYTH_CODEC_ID_H_
2 #define _MYTH_CODEC_ID_H_
3 
4 #include <QString>
5 extern "C"
6 {
7 #include "libavcodec/avcodec.h"
8 }
9 
10 typedef enum
11 {
12 // if you add anything to this list please update
13 // myth2av_codecid and get_encoding_type
15 
17 
20 
31 
33 
35 
46 
48 
50 
61 
63 
65 
76 
78 
80 
91 
93 
95 
106 
108 
110 
121 
123 
124 } MythCodecID;
125 
126 // MythCodecID convenience functions
127 #define codec_is_std(id) (id < kCodec_NORMAL_END)
128 #define codec_is_std_mpeg(id) (id == kCodec_MPEG1 || id == kCodec_MPEG2)
129 #define codec_is_vdpau(id) ((id > kCodec_VDPAU_BEGIN) && \
130  (id < kCodec_VDPAU_END))
131 #define codec_is_vdpau_hw(id) ((codec_is_vdpau(id) && \
132  (id != kCodec_H263_VDPAU) && \
133  (id != kCodec_VP8_VDPAU)))
134 #define codec_is_vaapi(id) ((id > kCodec_VAAPI_BEGIN) && \
135  (id < kCodec_VAAPI_END))
136 #define codec_is_vaapi_hw(id) (codec_is_vaapi(id) && \
137  (id != kCodec_VP8_VAAPI))
138 #define codec_is_dxva2(id) ((id > kCodec_DXVA2_BEGIN) && \
139  (id < kCodec_DXVA2_END))
140 #define codec_is_dxva2_hw(id) (codec_is_dxva2(id) &&\
141  ((id == kCodec_H264_DXVA2) || \
142  (id == kCodec_MPEG2_DXVA2) || \
143  (id == kCodec_VC1_DXVA2)))
144 #define codec_is_mediacodec(id) ((id > kCodec_MEDIACODEC_BEGIN) && \
145  (id < kCodec_MEDIACODEC_END))
146 #define codec_is_vaapi2(id) ((id > kCodec_VAAPI2_BEGIN) && \
147  (id < kCodec_VAAPI2_END))
148 #define codec_is_nvdec(id) ((id > kCodec_NVDEC_BEGIN) && \
149  (id < kCodec_NVDEC_END))
150 
151 #define codec_sw_copy(id) (codec_is_std(id) || codec_is_mediacodec(id) \
152  || codec_is_vaapi2(id) || codec_is_nvdec(id))
153 
154 QString get_encoding_type(MythCodecID codecid);
155 QString get_decoder_name(MythCodecID codec_id);
156 QString toString(MythCodecID codecid);
157 AVCodecID myth2av_codecid(MythCodecID codec_id, bool &vdpau);
158 inline AVCodecID myth2av_codecid(MythCodecID codec_id)
159 {
160  bool vdpau;
161  return myth2av_codecid(codec_id, vdpau);
162 }
163 
164 // AV codec id convenience functions
165 int mpeg_version(int codec_id);
166 #define CODEC_IS_H264(id) (mpeg_version(id) == 5)
167 #define CODEC_IS_MPEG(id) (mpeg_version(id) && mpeg_version(id) <= 2)
168 #define CODEC_IS_FFMPEG_MPEG(id) (CODEC_IS_MPEG(id))
169 #ifdef USING_VDPAU
170 #define CODEC_IS_VDPAU(codec) (codec &&\
171  codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
172 #else
173 #define CODEC_IS_VDPAU(codec) (0)
174 #endif
175 
176 #ifdef USING_VAAPI
177 #define CODEC_IS_VAAPI(codec, enc) (codec && IS_VAAPI_PIX_FMT(enc->pix_fmt))
178 #else
179 #define CODEC_IS_VAAPI(codec, enc) (0)
180 #endif
181 
182 #ifdef USING_DXVA2
183 #define CODEC_IS_DXVA2(codec, enc) (codec && (enc->pix_fmt == AV_PIX_FMT_DXVA2_VLD))
184 #else
185 #define CODEC_IS_DXVA2(codec, enc) (0)
186 #endif
187 
188 #ifdef USING_MEDIACODEC
189 #define CODEC_IS_MEDIACODEC(codec) (codec && (QString("mediacodec") == codec->wrapper_name))
190 #else
191 #define CODEC_IS_MEDIACODEC(codec) (0)
192 #endif
193 
194 #endif // _MYTH_CODEC_ID_H_
QString get_decoder_name(MythCodecID codec_id)
QString get_encoding_type(MythCodecID codecid)
MythCodecID
Definition: mythcodecid.h:10
QString toString(MythCodecID codecid)
Definition: mythcodecid.cpp:9
AVCodecID myth2av_codecid(MythCodecID codec_id, bool &vdpau)
int mpeg_version(int codec_id)