diff options
author | Neel Chauhan <nc@FreeBSD.org> | 2021-02-25 18:57:40 +0000 |
---|---|---|
committer | Neel Chauhan <nc@FreeBSD.org> | 2021-02-25 18:57:40 +0000 |
commit | 6ec4389082d476005751f2139c1d5e0189db89ba (patch) | |
tree | 6cc8d5e96f1351e91e0e3846011f3819eb804971 /multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp | |
parent | Update a few openshot ports: (diff) |
Add the openshot updates I somehow missed.
PR: 253643, 253645
Diffstat (limited to 'multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp')
-rw-r--r-- | multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp b/multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp index 562e9494befb..01518bb07ea0 100644 --- a/multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp +++ b/multimedia/libopenshot/files/patch-src_FFmpegWriter.cpp @@ -1,6 +1,6 @@ ---- src/FFmpegWriter.cpp.orig 2020-09-11 02:37:02 UTC +--- src/FFmpegWriter.cpp.orig 2021-02-18 07:59:16 UTC +++ src/FFmpegWriter.cpp -@@ -172,7 +172,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std +@@ -181,7 +181,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std AVCodec *new_codec; // Check if the codec selected is a hardware accelerated codec #if HAVE_HW_ACCEL @@ -9,19 +9,16 @@ if (strstr(codec.c_str(), "_vaapi") != NULL) { new_codec = avcodec_find_encoder_by_name(codec.c_str()); hw_en_on = 1; -@@ -220,9 +220,9 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std - hw_en_on = 0; - hw_en_supported = 0; +@@ -231,7 +231,7 @@ void FFmpegWriter::SetVideoOptions(bool has_video, std } -- #else // is FFmpeg 3 but not linux -+#else // is FFmpeg 3 but not unix + #else // unknown OS new_codec = avcodec_find_encoder_by_name(codec.c_str()); -- #endif //__linux__ -+#endif //__unix__ - #else // not ffmpeg 3 +-#endif //__linux__/_WIN32/__APPLE__ ++#endif //__unix__/_WIN32/__APPLE__ + #else // HAVE_HW_ACCEL new_codec = avcodec_find_encoder_by_name(codec.c_str()); #endif // HAVE_HW_ACCEL -@@ -556,6 +556,7 @@ void FFmpegWriter::SetOption(StreamType stream, std::s +@@ -580,6 +580,7 @@ void FFmpegWriter::SetOption(StreamType stream, std::s else { av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0); } @@ -29,27 +26,25 @@ case AV_CODEC_ID_HEVC : c->bit_rate = 0; if (strstr(info.vcodec.c_str(), "svt_hevc") != NULL) { -@@ -564,6 +565,8 @@ void FFmpegWriter::SetOption(StreamType stream, std::s +@@ -588,6 +589,8 @@ void FFmpegWriter::SetOption(StreamType stream, std::s av_opt_set_int(c->priv_data, "forced-idr",1,0); } break; + default: + break; } - #endif + #endif // FFmpeg 4.0+ } else { -@@ -1456,7 +1459,7 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS +@@ -1438,21 +1441,25 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS adapter_num = openshot::Settings::Instance()->HW_EN_DEVICE_SET; - fprintf(stderr, "\n\nEncodiing Device Nr: %d\n", adapter_num); + std::clog << "Encoding Device Nr: " << adapter_num << "\n"; if (adapter_num < 3 && adapter_num >=0) { -#if defined(__linux__) +#if defined(__unix__) snprintf(adapter,sizeof(adapter),"/dev/dri/renderD%d", adapter_num+128); // Maybe 127 is better because the first card would be 1?! adapter_ptr = adapter; -@@ -1464,17 +1467,21 @@ void FFmpegWriter::open_video(AVFormatContext *oc, AVS - adapter_ptr = NULL; - #elif defined(__APPLE__) + #elif defined(_WIN32) || defined(__APPLE__) adapter_ptr = NULL; +#else + adapter_ptr = NULL; @@ -62,9 +57,7 @@ -#if defined(__linux__) +#if defined(__unix__) if( adapter_ptr != NULL && access( adapter_ptr, W_OK ) == 0 ) { - #elif defined(_WIN32) - if( adapter_ptr != NULL ) { - #elif defined(__APPLE__) + #elif defined(_WIN32) || defined(__APPLE__) + if( adapter_ptr != NULL ) { +#else if( adapter_ptr != NULL ) { |