Lines 1-9
Link Here
|
1 |
--- src/FFmpegWriter.cpp.orig 2019-12-19 13:04:31 UTC |
1 |
--- src/FFmpegWriter.cpp.orig 2020-03-03 09:00:23 UTC |
2 |
+++ src/FFmpegWriter.cpp |
2 |
+++ src/FFmpegWriter.cpp |
3 |
@@ -172,7 +172,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std |
3 |
@@ -172,7 +172,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std |
4 |
AVCodec *new_codec; |
4 |
AVCodec *new_codec; |
5 |
// Check if the codec selected is a hardware accelerated codec |
5 |
// Check if the codec selected is a hardware accelerated codec |
6 |
#if IS_FFMPEG_3_2 |
6 |
#if HAVE_HW_ACCEL |
7 |
-#if defined(__linux__) |
7 |
-#if defined(__linux__) |
8 |
+#if defined(__unix__) |
8 |
+#if defined(__unix__) |
9 |
if (strstr(codec.c_str(), "_vaapi") != NULL) { |
9 |
if (strstr(codec.c_str(), "_vaapi") != NULL) { |
Lines 14-36
Link Here
|
14 |
hw_en_supported = 0; |
14 |
hw_en_supported = 0; |
15 |
} |
15 |
} |
16 |
- #else // is FFmpeg 3 but not linux |
16 |
- #else // is FFmpeg 3 but not linux |
17 |
+#else // is FFmpeg 3 but not linux |
17 |
+#else // is FFmpeg 3 but not unix |
18 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
18 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
19 |
- #endif //__linux__ |
19 |
- #endif //__linux__ |
20 |
+#endif //__unix__ |
20 |
+#endif //__unix__ |
21 |
#else // not ffmpeg 3 |
21 |
#else // not ffmpeg 3 |
22 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
22 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
23 |
#endif //IS_FFMPEG_3_2 |
23 |
#endif // HAVE_HW_ACCEL |
24 |
@@ -956,7 +956,7 @@ void FFmpegWriter::flush_encoders() { |
24 |
@@ -1367,7 +1367,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
25 |
void FFmpegWriter::close_video(AVFormatContext *oc, AVStream *st) |
|
|
26 |
{ |
27 |
#if IS_FFMPEG_3_2 |
28 |
- // #if defined(__linux__) |
29 |
+ // #if defined(__unix__) |
30 |
if (hw_en_on && hw_en_supported) { |
31 |
if (hw_device_ctx) { |
32 |
av_buffer_unref(&hw_device_ctx); |
33 |
@@ -1352,7 +1352,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
34 |
adapter_num = openshot::Settings::Instance()->HW_EN_DEVICE_SET; |
25 |
adapter_num = openshot::Settings::Instance()->HW_EN_DEVICE_SET; |
35 |
fprintf(stderr, "\n\nEncodiing Device Nr: %d\n", adapter_num); |
26 |
fprintf(stderr, "\n\nEncodiing Device Nr: %d\n", adapter_num); |
36 |
if (adapter_num < 3 && adapter_num >=0) { |
27 |
if (adapter_num < 3 && adapter_num >=0) { |
Lines 39-45
Link Here
|
39 |
snprintf(adapter,sizeof(adapter),"/dev/dri/renderD%d", adapter_num+128); |
30 |
snprintf(adapter,sizeof(adapter),"/dev/dri/renderD%d", adapter_num+128); |
40 |
// Maybe 127 is better because the first card would be 1?! |
31 |
// Maybe 127 is better because the first card would be 1?! |
41 |
adapter_ptr = adapter; |
32 |
adapter_ptr = adapter; |
42 |
@@ -1360,17 +1360,21 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
33 |
@@ -1375,17 +1375,21 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
43 |
adapter_ptr = NULL; |
34 |
adapter_ptr = NULL; |
44 |
#elif defined(__APPLE__) |
35 |
#elif defined(__APPLE__) |
45 |
adapter_ptr = NULL; |
36 |
adapter_ptr = NULL; |