Skip to content

Commit 2a80cca

Browse files
committed
Let hw_de_on be visible to all versions of ffmpeg
1 parent d6f52ea commit 2a80cca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/FFmpegReader.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
using namespace openshot;
3434

35-
#if IS_FFMPEG_3_2
3635
int hw_de_on = 1; // Is set in UI
3736
int hw_de_supported = 0; // Is set by FFmpegReader
37+
#if IS_FFMPEG_3_2
3838
AVPixelFormat hw_de_av_pix_fmt = AV_PIX_FMT_NONE;
3939
AVHWDeviceType hw_de_av_device_type = AV_HWDEVICE_TYPE_VAAPI;
4040
#endif
@@ -147,11 +147,11 @@ static enum AVPixelFormat get_dx_format(AVCodecContext *ctx, const enum AVPixelF
147147
hw_de_av_device_type = AV_HWDEVICE_TYPE_DXVA2;
148148
return *p;
149149
}
150-
/* if (*p == AV_PIX_FMT_D3D11) {
150+
if (*p == AV_PIX_FMT_D3D11) {
151151
hw_de_av_pix_fmt = AV_PIX_FMT_D3D11;
152152
hw_de_av_device_type = AV_HWDEVICE_TYPE_D3D11VA;
153153
return *p;
154-
}*/
154+
}
155155
}
156156
ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::ReadStream (Unable to decode this file using DXVA2.)", "", -1, "", -1, "", -1, "", -1, "", -1, "", -1);
157157
hw_de_supported = 0;
@@ -291,7 +291,9 @@ void FFmpegReader::Open()
291291
AVCodec *pCodec = avcodec_find_decoder(codecId);
292292
pCodecCtx = AV_GET_CODEC_CONTEXT(pStream, pCodec);
293293
#if IS_FFMPEG_3_2
294-
hw_de_supported = is_hardware_decode_supported(pCodecCtx->codec_id);
294+
if (hw_de_on) {
295+
hw_de_supported = is_hardware_decode_supported(pCodecCtx->codec_id);
296+
}
295297
#endif
296298
// Set number of threads equal to number of processors (not to exceed 16)
297299
pCodecCtx->thread_count = min(FF_NUM_PROCESSORS, 16);
@@ -309,13 +311,11 @@ void FFmpegReader::Open()
309311
// Open Hardware Acceleration
310312
// Use the hw device given in the environment variable HW_DE_DEVICE_SET or the default if not set
311313
char *dev_hw = NULL;
312-
#if defined(__linux__)
313314
dev_hw = getenv( "HW_DE_DEVICE_SET" );
314315
// Check if it is there and writable
315316
if( dev_hw != NULL && access( dev_hw, W_OK ) == -1 ) {
316317
dev_hw = NULL; // use default
317318
}
318-
#endif
319319
hw_device_ctx = NULL;
320320
#if defined(__linux__)
321321
pCodecCtx->get_format = get_vaapi_format;

0 commit comments

Comments
 (0)