aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Kern <kernrj@gmail.com>2019-05-12 16:01:50 -0400
committerRick Kern <rick@8birdsvideo.com>2019-05-12 16:22:51 -0400
commit247bda442f51ee5c330bab1489c5a1edd875b53d (patch)
tree8f3de2a1e98d76d8827fc48cd895b7be754f5fa2
parentbd6942b4c031fabcc82e9487f0af41f278da429a (diff)
downloadffmpeg-247bda442f51ee5c330bab1489c5a1edd875b53d.tar.gz
lavc/videotoolboxenc: add require_sw option to force software encoding.
Signed-off-by: Rick Kern <kernrj@gmail.com>
-rw-r--r--libavcodec/videotoolboxenc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 50aba2d87f..9e82f700f0 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -210,6 +210,7 @@ typedef struct VTEncContext {
int64_t frames_after;
int64_t allow_sw;
+ int64_t require_sw;
bool flushing;
bool has_b_frames;
@@ -1314,7 +1315,11 @@ static int vtenc_configure_encoder(AVCodecContext *avctx)
if (!enc_info) return AVERROR(ENOMEM);
#if !TARGET_OS_IPHONE
- if (!vtctx->allow_sw) {
+ if(vtctx->require_sw) {
+ CFDictionarySetValue(enc_info,
+ compat_keys.kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,
+ kCFBooleanFalse);
+ } else if (!vtctx->allow_sw) {
CFDictionarySetValue(enc_info,
compat_keys.kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder,
kCFBooleanTrue);
@@ -2543,6 +2548,8 @@ static const enum AVPixelFormat pix_fmts[] = {
#define COMMON_OPTIONS \
{ "allow_sw", "Allow software encoding", OFFSET(allow_sw), AV_OPT_TYPE_BOOL, \
{ .i64 = 0 }, 0, 1, VE }, \
+ { "require_sw", "Require software encoding", OFFSET(require_sw), AV_OPT_TYPE_BOOL, \
+ { .i64 = 0 }, 0, 1, VE }, \
{ "realtime", "Hint that encoding should happen in real-time if not faster (e.g. capturing from camera).", \
OFFSET(realtime), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \
{ "frames_before", "Other frames will come before the frames in this session. This helps smooth concatenation issues.", \