Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Carl Eugen Hoyos ag.or.at> writes: > Thilo Borgmann mail.de> writes: > > +#h264_videotoolbox_encoder_select="bzlib zlib iconv" > > If nobody beats me (or objects) I'll remove this line: > Compilation succeeds without zlib, bzlib and iconv. Done. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Am 21.03.16 um 11:44 schrieb Hendrik Leppkes: > On Mon, Mar 21, 2016 at 11:28 AM, Thilo Borgmann> wrote: >> >> Updated patches attached. >> > > Adding this as a global flag seems not ideal. Its a very specific > option for one hwaccel which for some reason happens to support this, > I don't like this being a global flag at all. Would it have been possible not to have a global flag for changing the behaviour? I did not find another when writing... However, if there will be an actual decoder for videotoolbox like wm4 says, this one should handle sw decoder and this whole thing becomes void anyway. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
On Mon, 21 Mar 2016 11:49:22 +0100 Thilo Borgmannwrote: > Am 21.03.16 um 11:41 schrieb wm4: > > On Mon, 21 Mar 2016 11:34:11 +0100 > > Thilo Borgmann wrote: > > > >> Am 21.03.16 um 08:23 schrieb wm4: > >>> On Sun, 20 Mar 2016 16:49:18 +0100 > >>> Thilo Borgmann wrote: > >>> > Hi, > > trying to handle software fallback more consistently for videotoolbox and > probably other hardware accelerations. > > Addresses ticket #5352 where software fallback is demanded which has been > removed on purpose before. With this patch the user can configure the > desired > behaviour. > > -Thilo > >>> > >>> Please explain how a hwaccel that uses no hardware decoding makes any > >>> sense at all. > >> > >> Checking compliance, comparing output/performance, work around a possible > >> bug in > >> an alternative decoder... of course it is no alternative if you need/want > >> the > >> benefits of hardware decoding but there are use cases that come to mind. > >> And maybe you don't have an alternative decoder at hand... > > > > But it's integrated as hwaccel, so most of these arguments don't make > > too much sense to me. Please don't touch the hwaccel thing, and wait > > until there's a separate videotolbox decoder. > > Indeed, if this decoder is actually coming it voids the need for this change. > > Have I missed it on -devel already? No, but it will exist. AFAIK Rodger Combs wanted to look into this. (If nobody else does, I'll do it.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Am 21.03.16 um 11:41 schrieb wm4: > On Mon, 21 Mar 2016 11:34:11 +0100 > Thilo Borgmannwrote: > >> Am 21.03.16 um 08:23 schrieb wm4: >>> On Sun, 20 Mar 2016 16:49:18 +0100 >>> Thilo Borgmann wrote: >>> Hi, trying to handle software fallback more consistently for videotoolbox and probably other hardware accelerations. Addresses ticket #5352 where software fallback is demanded which has been removed on purpose before. With this patch the user can configure the desired behaviour. -Thilo >>> >>> Please explain how a hwaccel that uses no hardware decoding makes any >>> sense at all. >> >> Checking compliance, comparing output/performance, work around a possible >> bug in >> an alternative decoder... of course it is no alternative if you need/want the >> benefits of hardware decoding but there are use cases that come to mind. >> And maybe you don't have an alternative decoder at hand... > > But it's integrated as hwaccel, so most of these arguments don't make > too much sense to me. Please don't touch the hwaccel thing, and wait > until there's a separate videotolbox decoder. Indeed, if this decoder is actually coming it voids the need for this change. Have I missed it on -devel already? -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
On Mon, Mar 21, 2016 at 11:28 AM, Thilo Borgmannwrote: > > Updated patches attached. > Adding this as a global flag seems not ideal. Its a very specific option for one hwaccel which for some reason happens to support this, I don't like this being a global flag at all. - Hendrik ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Am 21.03.16 um 08:23 schrieb wm4: > On Sun, 20 Mar 2016 16:49:18 +0100 > Thilo Borgmannwrote: > >> Hi, >> >> trying to handle software fallback more consistently for videotoolbox and >> probably other hardware accelerations. >> >> Addresses ticket #5352 where software fallback is demanded which has been >> removed on purpose before. With this patch the user can configure the desired >> behaviour. >> >> -Thilo > > Please explain how a hwaccel that uses no hardware decoding makes any > sense at all. Checking compliance, comparing output/performance, work around a possible bug in an alternative decoder... of course it is no alternative if you need/want the benefits of hardware decoding but there are use cases that come to mind. And maybe you don't have an alternative decoder at hand... -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Am 20.03.16 um 17:22 schrieb Richard Kern: > The encoder isn’t meant to be a hwaccel - it uses hardware encoding when > available, but I think it should fallback to software in the default case > when hardware isn’t available. > > One use case of this encoder is using a device-side H.264 encoder, so it > doesn’t matter if it’s software or hardware. Missed that - I agree. > How about a flag or option to require hardware? I think knowing about it should be sufficient. Added a warning. Updated patches attached. -Thilo From 2a4706cbe835c620ee7407c11f45f74aef6374cf Mon Sep 17 00:00:00 2001 From: Thilo BorgmannDate: Mon, 21 Mar 2016 11:23:30 +0100 Subject: [PATCH 1/2] lavc/videotoolbox: Fallback to external software decoding by codec flag. Fallback to external software decoding on user demand by specifying codec flag ext_sw_fallback. Fixes ticket #5352. --- libavcodec/avcodec.h | 4 libavcodec/options_table.h | 1 + libavcodec/videotoolbox.c | 8 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 637984b..c46400a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -744,6 +744,10 @@ typedef struct RcOverride{ */ #define AV_CODEC_FLAG_QPEL(1 << 4) /** + * Allow external software fallback for external hardware accellerators + */ +#define AV_CODEC_FLAG_EXT_SW_FALLBACK (1 << 5) +/** * Use internal 2pass ratecontrol in first pass mode. */ #define AV_CODEC_FLAG_PASS1 (1 << 9) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d29996f..04a1e4e 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -52,6 +52,7 @@ static const AVOption avcodec_options[] = { {"unaligned", "allow decoders to produce unaligned output", 0, AV_OPT_TYPE_CONST, { .i64 = AV_CODEC_FLAG_UNALIGNED }, INT_MIN, INT_MAX, V | D, "flags" }, {"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, {"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, +{"ext_sw_fallback", "allow external software fallback for external hardware accellerators", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_EXT_SW_FALLBACK }, INT_MIN, INT_MAX, V|E|D, "flags"}, {"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, {"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, #if FF_API_GMC diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 2f4d531..8554f02 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -32,6 +32,10 @@ #include "h264.h" #include "mpegvideo.h" +#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder +# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder") +#endif + #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder # define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") #endif @@ -412,7 +416,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec ); CFDictionarySetValue(config_info, - kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, + (avctx->flags & AV_CODEC_FLAG_EXT_SW_FALLBACK) ? + kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder : + kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, kCFBooleanTrue); if (avctx->extradata_size) { -- 2.5.4 (Apple Git-61) From c1f1fd4b60b5fdf13e6e64f999646ee94f9bf819 Mon Sep 17 00:00:00 2001 From: Thilo Borgmann Date: Mon, 21 Mar 2016 11:24:43 +0100 Subject: [PATCH 2/2] lavc/videotoolboxenc: Print warning if falling back to software encoder. --- libavcodec/videotoolboxenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 3ed1f64..c5e0463 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -511,6 +511,8 @@ static av_cold int vtenc_init(AVCodecContext *avctx) #if !TARGET_OS_IPHONE if (status != 0 || !vtctx->session) { +av_log(avctx, AV_LOG_WARNING, "Creating hardware encoder failed. Using software encoder.\n"); + CFDictionaryRemoveValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder); status = VTCompressionSessionCreate( -- 2.5.4 (Apple Git-61) ___
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
On Sun, 20 Mar 2016 16:49:18 +0100 Thilo Borgmannwrote: > Hi, > > trying to handle software fallback more consistently for videotoolbox and > probably other hardware accelerations. > > Addresses ticket #5352 where software fallback is demanded which has been > removed on purpose before. With this patch the user can configure the desired > behaviour. > > -Thilo Please explain how a hwaccel that uses no hardware decoding makes any sense at all. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
> On Mar 20, 2016, at 11:49 PM, Thilo Borgmannwrote: > > Hi, > > trying to handle software fallback more consistently for videotoolbox and > probably other hardware accelerations. > > Addresses ticket #5352 where software fallback is demanded which has been > removed on purpose before. With this patch the user can configure the desired > behaviour. > > -Thilo > <0001-lavc-videotoolbox-Consistent-fallback-to-external-so.patch>___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel The encoder isn’t meant to be a hwaccel - it uses hardware encoding when available, but I think it should fallback to software in the default case when hardware isn’t available. One use case of this encoder is using a device-side H.264 encoder, so it doesn’t matter if it’s software or hardware. How about a flag or option to require hardware? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Thilo Borgmann mail.de> writes: > h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads" > -h264_videotoolbox_encoder_select="bzlib zlib iconv" > +#h264_videotoolbox_encoder_select="bzlib zlib iconv" If nobody beats me (or objects) I'll remove this line: Compilation succeeds without zlib, bzlib and iconv. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Am 20.03.16 um 16:49 schrieb Thilo Borgmann: > Hi, > > trying to handle software fallback more consistently for videotoolbox and > probably other hardware accelerations. > > Addresses ticket #5352 where software fallback is demanded which has been > removed on purpose before. With this patch the user can configure the desired > behaviour. debugging cruft in configure removed... -Thilo From c672cdb1a5d1d92de2056ce7eb90cf08385566e3 Mon Sep 17 00:00:00 2001 From: Thilo BorgmannDate: Sun, 20 Mar 2016 16:53:28 +0100 Subject: [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding. Fallback to external software encoding or decoding only on user demand by specifying codec flag ext_sw_fallback. Fail otherwise. Fixes ticket #5352. --- libavcodec/avcodec.h | 4 libavcodec/options_table.h | 1 + libavcodec/videotoolbox.c| 8 +++- libavcodec/videotoolboxenc.c | 26 +- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 637984b..c46400a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -744,6 +744,10 @@ typedef struct RcOverride{ */ #define AV_CODEC_FLAG_QPEL(1 << 4) /** + * Allow external software fallback for external hardware accellerators + */ +#define AV_CODEC_FLAG_EXT_SW_FALLBACK (1 << 5) +/** * Use internal 2pass ratecontrol in first pass mode. */ #define AV_CODEC_FLAG_PASS1 (1 << 9) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d29996f..04a1e4e 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -52,6 +52,7 @@ static const AVOption avcodec_options[] = { {"unaligned", "allow decoders to produce unaligned output", 0, AV_OPT_TYPE_CONST, { .i64 = AV_CODEC_FLAG_UNALIGNED }, INT_MIN, INT_MAX, V | D, "flags" }, {"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, {"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, +{"ext_sw_fallback", "allow external software fallback for external hardware accellerators", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_EXT_SW_FALLBACK }, INT_MIN, INT_MAX, V|E|D, "flags"}, {"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, {"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, #if FF_API_GMC diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 2f4d531..8554f02 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -32,6 +32,10 @@ #include "h264.h" #include "mpegvideo.h" +#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder +# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder") +#endif + #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder # define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") #endif @@ -412,7 +416,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec ); CFDictionarySetValue(config_info, - kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, + (avctx->flags & AV_CODEC_FLAG_EXT_SW_FALLBACK) ? + kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder : + kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, kCFBooleanTrue); if (avctx->extradata_size) { diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 3ed1f64..68d46ce 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -492,8 +492,11 @@ static av_cold int vtenc_init(AVCodecContext *avctx) if (!enc_info) return AVERROR(ENOMEM); #if !TARGET_OS_IPHONE -CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kCFBooleanTrue); -CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue); +CFDictionarySetValue(enc_info, + (avctx->flags & AV_CODEC_FLAG_EXT_SW_FALLBACK) ? + kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder : + kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, + kCFBooleanTrue); #endif status = VTCompressionSessionCreate( @@ -509,25 +512,6 @@ static av_cold int vtenc_init(AVCodecContext
[FFmpeg-devel] [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding.
Hi, trying to handle software fallback more consistently for videotoolbox and probably other hardware accelerations. Addresses ticket #5352 where software fallback is demanded which has been removed on purpose before. With this patch the user can configure the desired behaviour. -Thilo From b7d6e9f40171e59c703d8a59c8097eb9f37c2e14 Mon Sep 17 00:00:00 2001 From: Thilo BorgmannDate: Sun, 20 Mar 2016 16:40:59 +0100 Subject: [PATCH] lavc/videotoolbox: Consistent fallback to external software encoding/decoding. Fallback to external software encoding or decoding only on user demand by specifying codec flag ext_sw_fallback. Fail otherwise. Fixes ticket #5352. --- configure| 2 +- libavcodec/avcodec.h | 4 libavcodec/options_table.h | 1 + libavcodec/videotoolbox.c| 8 +++- libavcodec/videotoolboxenc.c | 26 +- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/configure b/configure index 8a1ac38..a09f8e5 100755 --- a/configure +++ b/configure @@ -2673,7 +2673,7 @@ pcm_mulaw_at_encoder_deps="audiotoolbox" pcm_mulaw_at_encoder_select="audio_frame_queue" chromaprint_muxer_deps="chromaprint" h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads" -h264_videotoolbox_encoder_select="bzlib zlib iconv" +#h264_videotoolbox_encoder_select="bzlib zlib iconv" libcelt_decoder_deps="libcelt" libdcadec_decoder_deps="libdcadec" libfaac_encoder_deps="libfaac" diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 637984b..c46400a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -744,6 +744,10 @@ typedef struct RcOverride{ */ #define AV_CODEC_FLAG_QPEL(1 << 4) /** + * Allow external software fallback for external hardware accellerators + */ +#define AV_CODEC_FLAG_EXT_SW_FALLBACK (1 << 5) +/** * Use internal 2pass ratecontrol in first pass mode. */ #define AV_CODEC_FLAG_PASS1 (1 << 9) diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h index d29996f..04a1e4e 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -52,6 +52,7 @@ static const AVOption avcodec_options[] = { {"unaligned", "allow decoders to produce unaligned output", 0, AV_OPT_TYPE_CONST, { .i64 = AV_CODEC_FLAG_UNALIGNED }, INT_MIN, INT_MAX, V | D, "flags" }, {"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, {"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, +{"ext_sw_fallback", "allow external software fallback for external hardware accellerators", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_EXT_SW_FALLBACK }, INT_MIN, INT_MAX, V|E|D, "flags"}, {"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, {"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, #if FF_API_GMC diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 2f4d531..8554f02 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -32,6 +32,10 @@ #include "h264.h" #include "mpegvideo.h" +#ifndef kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder +# define kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder CFSTR("EnableHardwareAcceleratedVideoDecoder") +#endif + #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder # define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") #endif @@ -412,7 +416,9 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec ); CFDictionarySetValue(config_info, - kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, + (avctx->flags & AV_CODEC_FLAG_EXT_SW_FALLBACK) ? + kVTVideoDecoderSpecification_EnableHardwareAcceleratedVideoDecoder : + kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder, kCFBooleanTrue); if (avctx->extradata_size) { diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 3ed1f64..68d46ce 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -492,8 +492,11 @@ static av_cold int vtenc_init(AVCodecContext *avctx) if (!enc_info) return AVERROR(ENOMEM); #if !TARGET_OS_IPHONE -CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, kCFBooleanTrue); -CFDictionarySetValue(enc_info, kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder, kCFBooleanTrue); +