Lines 1-26
Link Here
|
1 |
--- src/FFmpegWriter.cpp.orig 2019-05-08 19:16:50 UTC |
1 |
--- src/FFmpegWriter.cpp.orig 2019-11-04 12:14:04 UTC |
2 |
+++ src/FFmpegWriter.cpp |
2 |
+++ src/FFmpegWriter.cpp |
3 |
@@ -166,7 +166,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, str |
3 |
@@ -172,7 +172,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, str |
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 IS_FFMPEG_3_2 |
7 |
- #if defined(__linux__) |
7 |
-#if defined(__linux__) |
8 |
+#if defined(__unix__) |
8 |
+#if defined(__unix__) |
9 |
if ( (strcmp(codec.c_str(),"h264_vaapi") == 0)) { |
9 |
if (strstr(codec.c_str(), "_vaapi") != NULL) { |
10 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
10 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
11 |
hw_en_on = 1; |
11 |
hw_en_on = 1; |
12 |
@@ -225,7 +225,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, str |
12 |
@@ -220,9 +220,9 @@ void FFmpegWriter::SetVideoOptions(bool has_video, str |
|
|
13 |
hw_en_on = 0; |
14 |
hw_en_supported = 0; |
13 |
} |
15 |
} |
14 |
#else // is FFmpeg 3 but not linux |
16 |
- #else // is FFmpeg 3 but not linux |
|
|
17 |
+#else // is FFmpeg 3 but not linux |
15 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
18 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
16 |
-#endif //__linux__ |
19 |
- #endif //__linux__ |
17 |
+#endif //__unix__ |
20 |
+#endif //__unix__ |
18 |
#else // not ffmpeg 3 |
21 |
#else // not ffmpeg 3 |
19 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
22 |
new_codec = avcodec_find_encoder_by_name(codec.c_str()); |
20 |
#endif //IS_FFMPEG_3_2 |
23 |
#endif //IS_FFMPEG_3_2 |
21 |
@@ -888,7 +888,7 @@ void FFmpegWriter::close_video(AVFormatContext *oc, AV |
24 |
@@ -956,7 +956,7 @@ void FFmpegWriter::flush_encoders() { |
22 |
AV_FREE_CONTEXT(video_codec); |
25 |
void FFmpegWriter::close_video(AVFormatContext *oc, AVStream *st) |
23 |
video_codec = NULL; |
26 |
{ |
24 |
#if IS_FFMPEG_3_2 |
27 |
#if IS_FFMPEG_3_2 |
25 |
- // #if defined(__linux__) |
28 |
- // #if defined(__linux__) |
26 |
+ // #if defined(__unix__) |
29 |
+ // #if defined(__unix__) |
Lines 27-33
Link Here
|
27 |
if (hw_en_on && hw_en_supported) { |
30 |
if (hw_en_on && hw_en_supported) { |
28 |
if (hw_device_ctx) { |
31 |
if (hw_device_ctx) { |
29 |
av_buffer_unref(&hw_device_ctx); |
32 |
av_buffer_unref(&hw_device_ctx); |
30 |
@@ -1290,7 +1290,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
33 |
@@ -1351,7 +1351,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
31 |
adapter_num = openshot::Settings::Instance()->HW_EN_DEVICE_SET; |
34 |
adapter_num = openshot::Settings::Instance()->HW_EN_DEVICE_SET; |
32 |
fprintf(stderr, "\n\nEncodiing Device Nr: %d\n", adapter_num); |
35 |
fprintf(stderr, "\n\nEncodiing Device Nr: %d\n", adapter_num); |
33 |
if (adapter_num < 3 && adapter_num >=0) { |
36 |
if (adapter_num < 3 && adapter_num >=0) { |
Lines 36-42
Link Here
|
36 |
snprintf(adapter,sizeof(adapter),"/dev/dri/renderD%d", adapter_num+128); |
39 |
snprintf(adapter,sizeof(adapter),"/dev/dri/renderD%d", adapter_num+128); |
37 |
// Maybe 127 is better because the first card would be 1?! |
40 |
// Maybe 127 is better because the first card would be 1?! |
38 |
adapter_ptr = adapter; |
41 |
adapter_ptr = adapter; |
39 |
@@ -1298,17 +1298,21 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
42 |
@@ -1359,17 +1359,21 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS |
40 |
adapter_ptr = NULL; |
43 |
adapter_ptr = NULL; |
41 |
#elif defined(__APPLE__) |
44 |
#elif defined(__APPLE__) |
42 |
adapter_ptr = NULL; |
45 |
adapter_ptr = NULL; |
Lines 58-61
Link Here
|
58 |
+#else |
61 |
+#else |
59 |
if( adapter_ptr != NULL ) { |
62 |
if( adapter_ptr != NULL ) { |
60 |
#endif |
63 |
#endif |
61 |
ZmqLogger::Instance()->AppendDebugMethod("Encode Device present using device", "", -1, "", -1, "", -1, "", -1, "", -1, "", -1); |
64 |
ZmqLogger::Instance()->AppendDebugMethod("Encode Device present using device", "adapter", adapter_num); |