Lines 178-194
MediaRet MediaRecorder::setup_video_stre
Link Here
|
178 |
// make sure RGB is supported (mostly not) |
178 |
// make sure RGB is supported (mostly not) |
179 |
if(codec->pix_fmts) { |
179 |
if(codec->pix_fmts) { |
180 |
const enum PixelFormat *p; |
180 |
const enum PixelFormat *p; |
|
|
181 |
#if LIBAVCODEC_VERSION_MAJOR < 55 |
181 |
int64_t mask = 0; |
182 |
int64_t mask = 0; |
|
|
183 |
#endif |
182 |
for(p = codec->pix_fmts; *p != -1; p++) { |
184 |
for(p = codec->pix_fmts; *p != -1; p++) { |
183 |
// may get complaints about 1LL; thus the cast |
185 |
// may get complaints about 1LL; thus the cast |
|
|
186 |
#if LIBAVCODEC_VERSION_MAJOR < 55 |
184 |
mask |= ((int64_t)1) << *p; |
187 |
mask |= ((int64_t)1) << *p; |
|
|
188 |
#endif |
185 |
if(*p == pixfmt) |
189 |
if(*p == pixfmt) |
186 |
break; |
190 |
break; |
187 |
} |
191 |
} |
188 |
if(*p == -1) { |
192 |
if(*p == -1) { |
189 |
// if not supported, use a converter to the next best format |
193 |
// if not supported, use a converter to the next best format |
190 |
// this is swscale, the converter used by the output demo |
194 |
// this is swscale, the converter used by the output demo |
|
|
195 |
#if LIBAVCODEC_VERSION_MAJOR < 55 |
191 |
enum PixelFormat dp = (PixelFormat)avcodec_find_best_pix_fmt(mask, pixfmt, 0, NULL); |
196 |
enum PixelFormat dp = (PixelFormat)avcodec_find_best_pix_fmt(mask, pixfmt, 0, NULL); |
|
|
197 |
#else |
198 |
#if LIBAVCODEC_VERSION_MICRO >= 100 |
199 |
// FFmpeg |
200 |
enum AVPixelFormat dp = avcodec_find_best_pix_fmt_of_list(codec->pix_fmts, pixfmt, 0, NULL); |
201 |
#else |
202 |
// Libav |
203 |
enum AVPixelFormat dp = avcodec_find_best_pix_fmt2(codec->pix_fmts, pixfmt, 0, NULL); |
204 |
#endif |
205 |
#endif |
192 |
if(dp == -1) |
206 |
if(dp == -1) |
193 |
dp = codec->pix_fmts[0]; |
207 |
dp = codec->pix_fmts[0]; |
194 |
if(!(convpic = avcodec_alloc_frame()) || |
208 |
if(!(convpic = avcodec_alloc_frame()) || |