Re: [FFmpeg-devel] [PATCH 1/2] lavc/videotoolboxenc: Dump the encoder

2023-09-05 Thread Richard Kern


> On Sep 3, 2023, at 11:53 PM, Jun Zhao  wrote:
> 
> Dump the encoder, it's will help debug some case
> 
> Signed-off-by: Jun Zhao 
> ---
> libavcodec/videotoolboxenc.c | 20 
> 1 file changed, 20 insertions(+)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index bfc03787a0..5633640a30 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -1110,6 +1110,26 @@ static int vtenc_create_encoder(AVCodecContext   
> *avctx,
> return AVERROR_EXTERNAL;
> }
> 
> +// Dump the init encoder
> +{
> +CFStringRef encoderID = NULL;
> +status = VTSessionCopyProperty(vtctx->session,
> +   kVTCompressionPropertyKey_EncoderID,
> +   kCFAllocatorDefault,
> +   );
> +if (status == noErr) {
> +char names[256] = { 0 };
> +
> +CFStringGetCString(encoderID,
> +   names,
> +   255,
Use sizeof(names) - 1 instead of 255. The hard coded value increases the chance 
of a bug if the size of names is changed. 

> +   kCFStringEncodingUTF8);
> +av_log(avctx, AV_LOG_INFO, "Init the encoder: %s\n", names);
This should be logged at the debug level since it doesn’t help users when 
encoding is successful. 

> +}
> +if (encoderID != NULL)
> +CFRelease(encoderID);
> +}
> +
> if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
> av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
> encoder. Use -b:v bitrate instead.\n");
> return AVERROR_EXTERNAL;
> -- 
> 2.25.1
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: enable low-latency mode for HEVC

2023-08-31 Thread Richard Kern


> On Sep 1, 2023, at 12:07 AM, myp...@gmail.com wrote:
> 
> On Fri, Sep 1, 2023 at 11:50 AM "zhilizhao(赵志立)"  
> wrote:
>> 
>> 
>> 
 On Sep 1, 2023, at 09:13, myp...@gmail.com wrote:
>>> 
>>> On Fri, Sep 1, 2023 at 2:13 AM Zhao Zhili  wrote:
 
 
> From: ffmpeg-devel  On Behalf Of Jun Zhao
> Sent: 2023年8月31日 22:50
> To: ffmpeg-devel@ffmpeg.org
> Cc: Jun Zhao ; Jun Zhao 
> Subject: [FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: enable 
> low-latency mode for HEVC
> 
> Enable the HEVC encoder that supports low-latency mode.
> 
> Signed-off-by: Jun Zhao 
> ---
> libavcodec/videotoolboxenc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 8e493c4f7a..bfc03787a0 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -1568,7 +1568,8 @@ static int vtenc_configure_encoder(AVCodecContext 
> *avctx)
> #endif
> 
>// low-latency mode: eliminate frame reordering, follow a 
> one-in-one-out encoding mode
> -if ((avctx->flags & AV_CODEC_FLAG_LOW_DELAY) && avctx->codec_id == 
> AV_CODEC_ID_H264) {
> +if ((avctx->flags & AV_CODEC_FLAG_LOW_DELAY) &&
> +(avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == 
> AV_CODEC_ID_HEVC)) {
 
 How about just remove the codec_id check?
 Is there any unwelcome side effects for encoders other than H264/HEVC?
>>> 
>>> 1. One reason is that there are now other encoders available, such as
>>> prores_videotoolbox.
>>> 
>>> 2. It may be more appropriate to use a strictly qualified check
>>> instead of an open condition.
>> 
>> Both HEVC and ProRes failed with low_latency on my machine (with or without 
>> -allow_sw 1)
>> 
>> [hevc_videotoolbox @ 0x6192a380] Error: cannot create compression 
>> session: -12902
>> [prores_videotoolbox @ 0x6192a380] Error: cannot create compression 
>> session: -12902
>> 
>>kVTParameterErr = 
>> -12902,
>> 
> I think you missed the other options, low delay in VT encoder need to
> co-work with some other options
> 
>> 1. FFmpeg users should have an idea whether or not to set 
>> AV_CODEC_FLAG_LOW_DELAY.
>> AV_CODEC_FLAG_LOW_DELAY doesn’t make sense for ProRes, but if user wants to 
>> try, let he/she
>> do.
>> 
>> 2. I can’t find API to query the capability. Only VideoToolBox framework 
>> itself know how
>> to handle the argument. There isn’t much protect to provide for users.
>> 
> Yes, now FFmpeg VT encoder didn't used the capability query, I think
> need to used the some API VTCopySupportedPropertyDictionaryForEncoder
> for capability query, this my next step
That’s a good idea. We don’t have to worry about codec checks or unexpected 
failures if the HEVC encoder on some devices doesn’t support it. Ideally we can 
print out a warn message and ignore the low-delay flag. 

>> Even with H.264, the results is unexpected: the input framerate is 25 but 
>> the output
>> framerate is 5, it dropped 80 percent frames silently.
>> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH] libavcodec/videotoolboxenc.c: add option to hevc encoder to prioritize speed.

2022-05-01 Thread Richard Kern


> On May 1, 2022, at 1:31 PM, Simone Karin Lehmann  wrote:
> 
> Hi,
> 
> may I kindly ask you to check, if this patch could now be applied? 
I’ll look at it today. 

> 
> Regards
> Simone
> 
> Von meinem iPad gesendet
> 
>> Am 25.04.2022 um 22:33 schrieb Simone Karin Lehmann :
>> 
>> 
>> 
> Am 25.04.2022 um 21:14 schrieb Rick Kern :
> 
> 
>  { "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc),
> AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, VE },
> +{ "prio_speed", "prioritize encoding speed", OFFSET(prio_speed),
> AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
> 
>>> It might be simpler to make the default value of prio_speed -1, and set
>>> this property on the encoder session only when it's non-negative. Then we
>>> won't need to worry about the default value changing for different codecs
>>> or different OS versions. It could also be moved into COMMON_OPTIONS in
>>> this case.
>> 
>> oh yes, that’s way better. I didn’t think of that in the first place. Thanks 
>> for the hint.
>> 
>> Here’s the modified patch
>> 
>> Simone
>> 


0001-add-options-to-h264-hevc-and-prores-encoders-to-prio.patch
Description: Binary data
>> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [FFmpeg-cvslog] Fix for bug #9231: B-frames parameter is ignored in videotoolboxenc

2021-08-13 Thread Richard Kern


> On Aug 13, 2021, at 9:12 AM, Nicolas George  wrote:
> 
> Anselm Busse (12021-08-13):
>> Fix for bug #9231: B-frames parameter is ignored in videotoolboxenc
> 
> To whoever pushed this: this is not a correct first line for a commit
> message. It should have been something like:
> 
> libavc/videotoolboxenc: do not override B-frames parameter.
Ok, I’ll pay more attention to this. 

> 
> i.e.: first a context before a colon, and then what the patch does, not
> what was wrong before.
> 
> And "Fix track ticket #9231" somewhere below.
> 
> It is not a grave mistake, but please be more careful next time.
> 
> Regards,
> 
> -- 
>  Nicolas George
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] Constant quality for videotoolboxenc on M1

2021-02-22 Thread Richard Kern


> On Feb 22, 2021, at 6:13 PM, Nomis101  wrote:
> 
> Hi,
> 
> back in January it was asked if it would be possible to add constant quality 
> encoding for videotoolbox on macOS to FFmpeg. Later, somebody provided a 
> patch.
> http://ffmpeg.org/pipermail/ffmpeg-devel/2021-January/274989.html
> 
> Would it be possible for somebody to take a look into this? Not only would it 
> be a great addition to videotoolbox video encoding, it would also help to 
> reduce the amount of patches from the internal FFmpeg patchset of HandBrake 
> (the one for b-frames and the one for constant quality).
Yes. I’ll review the patch, but will take about a week before I can carve out 
the time. 

> 
> Thank you very much.
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolboxenc: fix use after destroy

2020-09-17 Thread Richard Kern


> On Sep 10, 2020, at 11:13 AM, Zhao Zhili  wrote:
> 
> 
>> 在 2020年9月10日,下午10:21,Richard Kern  写道:
>> 
>> 
>> 
>>>> On Sep 10, 2020, at 8:57 AM, zhilizhao  wrote:
>>> 
>>> 
>>> 
>>>>> On Aug 28, 2020, at 8:55 AM, Steven Liu  wrote:
>>>> 
>>>>  于2020年8月27日周四 下午5:39写道:
>>>>> 
>>>>> From: Zhao Zhili 
>>>>> 
>>>>> The lock is used in clear_frame_queue().
>>>>> ---
>>>>> libavcodec/videotoolboxenc.c | 11 +++
>>>>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>>>> 
>>>>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>>>> index 988782f10d..758db9641f 100644
>>>>> --- a/libavcodec/videotoolboxenc.c
>>>>> +++ b/libavcodec/videotoolboxenc.c
>>>>> @@ -2496,14 +2496,17 @@ static av_cold int vtenc_close(AVCodecContext 
>>>>> *avctx)
>>>>> {
>>>>>  VTEncContext *vtctx = avctx->priv_data;
>>>>> 
>>>>> -pthread_cond_destroy(>cv_sample_sent);
>>>>> -pthread_mutex_destroy(>lock);
>>>>> -
>>>>> -if(!vtctx->session) return 0;
>>>>> +if(!vtctx->session) {
>>>>> +pthread_cond_destroy(>cv_sample_sent);
>>>>> +pthread_mutex_destroy(>lock);
>>>>> +return 0;
>>>>> +}
>>>>> 
>>>>>  VTCompressionSessionCompleteFrames(vtctx->session,
>>>>> kCMTimeIndefinite);
>>>>>  clear_frame_queue(vtctx);
>>>>> +pthread_cond_destroy(>cv_sample_sent);
>>>>> +pthread_mutex_destroy(>lock);
>>>>>  CFRelease(vtctx->session);
>>>>>  vtctx->session = NULL;
>>>>> 
>>>>> --
>>>>> 2.28.0
>>>>> 
>>>>> ___
>>>>> ffmpeg-devel mailing list
>>>>> ffmpeg-devel@ffmpeg.org
>>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>>> 
>>>>> To unsubscribe, visit link above, or email
>>>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>>> 
>>>> 
>>>> This patch look better than
>>>> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200827025327.28334-1...@chinaffmpeg.org/
>>>> 
>>> 
>>> Ping for the patch set.
>> Can you provide steps to reproduce the deadlock issue? I can get it pushed 
>> this weekend if so. 
> 
> I only try to fix a use after destroy issue as the commit message says.
> It may solved another issue unintentional. Liu, could you help by giving
> more information about the deadlock issue, please.
I’ll figure out a way to reproduce this in the next few days and get these 
patches pushed. 

> 
>>> 
>>>> 
>>>> Thanks
>>>> Steven
>>>> ___
>>>> ffmpeg-devel mailing list
>>>> ffmpeg-devel@ffmpeg.org
>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>> 
>>>> To unsubscribe, visit link above, or email
>>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>> 
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/videotoolboxenc: fix use after destroy

2020-09-10 Thread Richard Kern


> On Sep 10, 2020, at 8:57 AM, zhilizhao  wrote:
> 
> 
> 
>> On Aug 28, 2020, at 8:55 AM, Steven Liu  wrote:
>> 
>>  于2020年8月27日周四 下午5:39写道:
>>> 
>>> From: Zhao Zhili 
>>> 
>>> The lock is used in clear_frame_queue().
>>> ---
>>> libavcodec/videotoolboxenc.c | 11 +++
>>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>> 
>>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>> index 988782f10d..758db9641f 100644
>>> --- a/libavcodec/videotoolboxenc.c
>>> +++ b/libavcodec/videotoolboxenc.c
>>> @@ -2496,14 +2496,17 @@ static av_cold int vtenc_close(AVCodecContext 
>>> *avctx)
>>> {
>>>VTEncContext *vtctx = avctx->priv_data;
>>> 
>>> -pthread_cond_destroy(>cv_sample_sent);
>>> -pthread_mutex_destroy(>lock);
>>> -
>>> -if(!vtctx->session) return 0;
>>> +if(!vtctx->session) {
>>> +pthread_cond_destroy(>cv_sample_sent);
>>> +pthread_mutex_destroy(>lock);
>>> +return 0;
>>> +}
>>> 
>>>VTCompressionSessionCompleteFrames(vtctx->session,
>>>   kCMTimeIndefinite);
>>>clear_frame_queue(vtctx);
>>> +pthread_cond_destroy(>cv_sample_sent);
>>> +pthread_mutex_destroy(>lock);
>>>CFRelease(vtctx->session);
>>>vtctx->session = NULL;
>>> 
>>> --
>>> 2.28.0
>>> 
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> 
>> 
>> This patch look better than
>> https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200827025327.28334-1...@chinaffmpeg.org/
>> 
> 
> Ping for the patch set.
Can you provide steps to reproduce the deadlock issue? I can get it pushed this 
weekend if so. 
> 
>> 
>> Thanks
>> Steven
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] [PATCH] avcodec: Add more kCVImageBufferColorPrimaries to videotoolboxenc

2019-11-16 Thread Richard Kern


> On Nov 16, 2019, at 7:03 PM, Nomis101  wrote:
> 
> Thanks for reviewing. Would be nice, if somebody could push to master then. 
> I can't.
> 
> 
I’ll test it out tomorrow and push. 

> 
>> Am 15.11.19 um 15:58 schrieb Limin Wang:
>>> On Sun, Nov 03, 2019 at 01:20:38AM +0100, Nomis101 wrote:
>>> ---
>>> libavcodec/videotoolboxenc.c | 8 
>>> 1 file changed, 8 insertions(+)
>>> 
>>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>> index 40a7f643e0..cc08cf6a50 100644
>>> --- a/libavcodec/videotoolboxenc.c
>>> +++ b/libavcodec/videotoolboxenc.c
>>> @@ -894,6 +894,14 @@ static int get_cv_color_primaries(AVCodecContext 
>>> *avctx,
>>> *primaries = NULL;
>>> break;
>>> 
>>> +case AVCOL_PRI_BT470BG:
>>> +*primaries = kCVImageBufferColorPrimaries_EBU_3213;
>>> +break;
>>> +
>>> +case AVCOL_PRI_SMPTE170M:
>>> +*primaries = kCVImageBufferColorPrimaries_SMPTE_C;
>>> +break;
>>> +
>> lgtm
>> 
>>> case AVCOL_PRI_BT709:
>>> *primaries = kCVImageBufferColorPrimaries_ITU_R_709_2;
>>> break;
>>> --
>>> 2.21.0 (Apple Git-122)
>>> 
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v1 1/2] avcodec/videotoolboxenc: add H264 Extended profile and level

2019-08-27 Thread Richard Kern
I’ll look at it this weekend. 

> On Aug 27, 2019, at 10:40 AM, Limin Wang  wrote:
> 
> 
> ping the patchset.
> 
>> On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmw...@gmail.com wrote:
>> From: Limin Wang 
>> 
>> Signed-off-by: Limin Wang 
>> ---
>> libavcodec/videotoolboxenc.c | 14 ++
>> 1 file changed, 14 insertions(+)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index d76bb7f646..b16b056f6c 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -80,6 +80,8 @@ static struct{
>> CFStringRef kVTProfileLevel_H264_High_5_1;
>> CFStringRef kVTProfileLevel_H264_High_5_2;
>> CFStringRef kVTProfileLevel_H264_High_AutoLevel;
>> +CFStringRef kVTProfileLevel_H264_Extended_5_0;
>> +CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
>> 
>> CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
>> CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
>> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
>> GET_SYM(kVTProfileLevel_H264_High_5_1,   "H264_High_5_1");
>> GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
>> GET_SYM(kVTProfileLevel_H264_High_AutoLevel, "H264_High_AutoLevel");
>> +GET_SYM(kVTProfileLevel_H264_Extended_5_0,   "H264_Extended_5_0");
>> +GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, 
>> "H264_Extended_AutoLevel");
>> 
>> GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel, "HEVC_Main_AutoLevel");
>> GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,   
>> "HEVC_Main10_AutoLevel");
>> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
>> H264_PROF_BASELINE,
>> H264_PROF_MAIN,
>> H264_PROF_HIGH,
>> +H264_PROF_EXTENDED,
>> H264_PROF_COUNT
>> } VT_H264Profile;
>> 
>> @@ -704,6 +709,14 @@ static bool get_vt_h264_profile_level(AVCodecContext 
>> *avctx,
>>   compat_keys.kVTProfileLevel_H264_High_5_2; 
>>   break;
>> }
>> break;
>> +case H264_PROF_EXTENDED:
>> +switch (vtctx->level) {
>> +case  0: *profile_level_val =
>> +  
>> compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
>> +case 50: *profile_level_val =
>> +  
>> compat_keys.kVTProfileLevel_H264_Extended_5_0;   break;
>> +}
>> +break;
>> }
>> 
>> if (!*profile_level_val) {
>> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
>> { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 
>> H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
>> { "main", "Main Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 
>> H264_PROF_MAIN }, INT_MIN, INT_MAX, VE, "profile" },
>> { "high", "High Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 
>> H264_PROF_HIGH }, INT_MIN, INT_MAX, VE, "profile" },
>> +{ "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 = 
>> H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
>> 
>> { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, 
>> VE, "level" },
>> { "1.3", "Level 1.3, only available with Baseline Profile", 0, 
>> AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
>> -- 
>> 2.21.0
>> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH v2] libavcodec/videotoolboxenc: Fix compilation broken on macOS 10.12

2019-06-16 Thread Richard Kern

> On Jun 15, 2019, at 7:54 PM, Lance Wang  wrote:
> 
>> On Fri, Jun 7, 2019 at 11:13 PM  wrote:
>> 
>> From: Limin Wang 
>> 
>> Signed-off-by: Limin Wang 
>> ---
>> libavcodec/videotoolboxenc.c | 5 +
>> 1 file changed, 5 insertions(+)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index 3665581..f8ccdea 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -39,6 +39,11 @@
>> enum { kCMVideoCodecType_HEVC = 'hvc1' };
>> #endif
>> 
>> +#if !HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
>> +enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' };
>> +enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' };
>> +#endif
>> +
>> 
> 
> 
> Anybody can check the patch is OK or not,  I'm glad that the FFmpeg master
> will be build on my old Mac pro system without self patch.
> Or apply below patch if you prefer to.
> https://patchwork.ffmpeg.org/patch/13109/
> 

I’ll look at it tomorrow and push. 

> 
> 
>> typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef
>> videoDesc,
>>size_t parameterSetIndex,
>>const uint8_t
>> **parameterSetPointerOut,
>> --
>> 2.6.4
>> 
>> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] videotoolboxenc.c crash on iOS8

2017-06-23 Thread Richard Kern
On June 17, 2017 at 6:46:58 PM, Steven Liu (lingjiujia...@gmail.com) wrote:

2017-06-17 11:17 GMT+08:00 姜 文杰 :
> when use videotoolboxencoder in ffmpeg, some codes will lead to crash.
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

From ee465de23b27cbeaaa25fd3d8abf57680394a284 Mon Sep 17 00:00:00 2001
From: jerett 
Date: Mon, 16 Jan 2017 16:44:11 +0800
Subject: [PATCH 1/2] fix open videotoolbox bug on iOS8.4

---
libavcodec/videotoolboxenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index cb9e2fe6e8..dbc9031384 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1137,7 +1137,7 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
kCFAllocatorDefault,
_b_frames_cfbool);

- if (!status) {
+ if (!status && has_b_frames_cfbool) {
//Some devices don't output B-frames for main profile, even
if requested.
vtctx->has_b_frames = CFBooleanGetValue(has_b_frames_cfbool);
CFRelease(has_b_frames_cfbool);
-- 
2.11.0 (Apple Git-81)


From 8eaab291bee268b0ae7fe4ed7795b2af4c55a275 Mon Sep 17 00:00:00 2001
From: jerett 
Date: Sat, 17 Jun 2017 10:22:58 +0800
Subject: [PATCH 2/2] fix loadVTEncSymbols crash when symbol not found

---
libavcodec/videotoolboxenc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 37c7957394..96c5648818 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -73,11 +73,11 @@ static struct{

#define GET_SYM(symbol, defaultVal) \
do{ \
- CFStringRef cfstr = *(CFStringRef*)dlsym(RTLD_DEFAULT, #symbol); \
- if(!cfstr) \
+ CFStringRef* handle = (CFStringRef*)dlsym(RTLD_DEFAULT, #symbol);
\
+ if(!handle) \
compat_keys.symbol = CFSTR(defaultVal); \
else \
- compat_keys.symbol = cfstr; \
+ compat_keys.symbol = *handle; \
}while(0)

static pthread_once_t once_ctrl = PTHREAD_ONCE_INIT;
-- 
2.11.0 (Apple Git-81)




there are two patch, you should send two patch.

Pushed - in the future, patches can be sent separately or using git
send-email.


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] avcodec/videotoolbox: add rc_max_bitrate control into videotoolbox

2017-03-15 Thread Richard Kern
On March 14, 2017 at 10:54:47 AM, Steven Liu (l...@chinaffmpeg.org) wrote:

add kVTCompressionPropertyKey_DataRateLimits support by rc_max_bitrate

Reviewed-by: Rick Kern 
Signed-off-by: Steven Liu 
---
libavcodec/videotoolboxenc.c | 47

1 file changed, 47 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 005f5d6..0cba2c8 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -898,7 +898,14 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
{
VTEncContext *vtctx = avctx->priv_data;
SInt32 bit_rate = avctx->bit_rate;
+ SInt32 max_rate = avctx->rc_max_rate;
CFNumberRef bit_rate_num;
+ CFNumberRef bytes_per_second;
+ CFNumberRef one_second;
+ CFArrayRef data_rate_limits;
+ int64_t bytes_per_second_value = 0;
+ int64_t one_second_value = 0;
+ void *nums[2];

int status = VTCompressionSessionCreate(kCFAllocatorDefault,
avctx->width,
@@ -938,6 +945,46 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
return AVERROR_EXTERNAL;
}

+ bytes_per_second_value = max_rate >> 3;
+ bytes_per_second = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt64Type,
+ _per_second_value);
+ if (!bytes_per_second) {
+ return AVERROR(ENOMEM);
+ }
+ one_second_value = 1;
+ one_second = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt64Type,
+ _second_value);
+ if (!one_second) {
+ CFRelease(bytes_per_second);
+ return AVERROR(ENOMEM);
+ }
+ nums[0] = bytes_per_second;
+ nums[1] = one_second;
+ data_rate_limits = CFArrayCreate(kCFAllocatorDefault,
+ nums,
+ 2,
+ );
+
+ if (!data_rate_limits) {
+ CFRelease(bytes_per_second);
+ CFRelease(one_second);
+ return AVERROR(ENOMEM);
+ }
+ status = VTSessionSetProperty(vtctx->session,
+ kVTCompressionPropertyKey_DataRateLimits,
+ data_rate_limits);
+
+ CFRelease(bytes_per_second);
+ CFRelease(one_second);
+ CFRelease(data_rate_limits);
+
+ if (status) {
+ av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate property: %d\n",
status);
+ return AVERROR_EXTERNAL;
+ }
+
if (profile_level) {
status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_ProfileLevel,
-- 
2.10.1.382.ga23ca1b.dirty


Pushed - thanks.






___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/videotoolbox: add rc_max_bitrate control into videotoolbox

2017-03-14 Thread Richard Kern
On March 12, 2017 at 11:55:55 PM, Steven Liu (l...@chinaffmpeg.org) wrote:

add kVTCompressionPropertyKey_DataRateLimits support by rc_max_bitrate

Signed-off-by: Steven Liu 
---
libavcodec/videotoolboxenc.c | 27 +++
1 file changed, 27 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 005f5d6..9738152 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -898,6 +898,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
{
VTEncContext *vtctx = avctx->priv_data;
SInt32 bit_rate = avctx->bit_rate;
+ SInt32 max_rate = avctx->rc_max_rate;
CFNumberRef bit_rate_num;

int status = VTCompressionSessionCreate(kCFAllocatorDefault,
@@ -938,6 +939,32 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
return AVERROR_EXTERNAL;
}

+ int64_t bytes_per_second_value = max_rate >> 3;

Variables should be declared at the start of the function/scope in C.


+ CFNumberRef bytes_per_second = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt64Type,
+ _per_second_value);

The CFNumberCreate() and CFArrayCreate() functions can return NULL when
allocation fails.


+ int64_t two_second_value = 2;
+ CFNumberRef two_second = CFNumberCreate(kCFAllocatorDefault,
+ kCFNumberSInt64Type,
+ _second_value);
+ const void* nums[2] = { bytes_per_second, two_second };

Why two seconds?


+ CFArrayRef data_rate_limits = CFArrayCreate(kCFAllocatorDefault,
+ nums,
+ 2,
+ );
+
+ status = VTSessionSetProperty((VTCompressionSessionRef)(vtctx->session),

vtctx->session is already defined as a VTCompressionSessionRef - the cast
should be removed for better readability.


+ kVTCompressionPropertyKey_DataRateLimits,
+ data_rate_limits);
+ CFRelease(bytes_per_second);
+ CFRelease(two_second);
+ CFRelease(data_rate_limits);
+
+ if (status) {
+ av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate property: %d\n",
status);
+ return AVERROR_EXTERNAL;
+ }
+
if (profile_level) {
status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_ProfileLevel,
-- 
2.10.1.382.ga23ca1b.dirty



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] h264 bitstream corruption in videotoolbox encoder with a53cc=1

2017-02-08 Thread Richard Kern
On February 6, 2017 at 8:39:30 PM, Aman Gupta (ffm...@tmm1.net) wrote:

Last October, kernrj and I commited a series of patches to add a53cc
support to the videotoolbox encoder.

In using that feature over the past few months, I've discovered that the
generated streams can sometimes contain random/intermittent errors. This
only appears to occur on some Macs and not others.

These corrupted files cause errors when used with any of Apple's decoders,
including Safari, Quicktime, and mediastreamvalidator. The file can be
decoded with ffmpeg, although it prints out the following error when
encountering the corruption:

[NULL @ 0x7fbcce800600] sps_id 32 out of range
[h264 @ 0x7fbcd000] sps_id 32 out of range

Here are two sequential sample segments generated by the videotoolbox
encoder (when used with -f hls). They were generated one after the other
from the same source; the first is fine, but the second contains the
corruption.

https://s3.amazonaws.com/tmm1/stream57.ts
https://s3.amazonaws.com/tmm1/stream58.ts

I'd like to fix this bug, but have been stuck trying to narrow it down.
Hoping someone can point me in the right direction.

I’ll take a look this weekend.




Aman
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-10-18 Thread Richard Kern

> On Oct 18, 2016, at 2:30 PM, Aman Gupta <ffm...@tmm1.net> wrote:
> 
> 
> 
> On Mon, Oct 17, 2016 at 6:03 PM, Aman Gupta <ffm...@tmm1.net 
> <mailto:ffm...@tmm1.net>> wrote:
> 
> 
> On Mon, Oct 17, 2016 at 5:51 PM, Richard Kern <ker...@gmail.com 
> <mailto:ker...@gmail.com>> wrote:
> 
>> On Oct 17, 2016, at 8:47 PM, Aman Gupta <ffm...@tmm1.net 
>> <mailto:ffm...@tmm1.net>> wrote:
>> 
>> 
>> 
>> On Mon, Oct 17, 2016 at 6:35 AM, Richard Kern <ker...@gmail.com 
>> <mailto:ker...@gmail.com>> wrote:
>> 
>>> On Sep 19, 2016, at 10:30 AM, Aman Gupta <ffm...@tmm1.net 
>>> <mailto:ffm...@tmm1.net>> wrote:
>>> 
>>> 
>>> 
>>> On Monday, September 19, 2016, Richard Kern <ker...@gmail.com 
>>> <mailto:ker...@gmail.com>> wrote:
>>> 
>>>> On Sep 10, 2016, at 10:33 PM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>>>> 
>>>> 
>>>> 
>>>> On Sunday, September 11, 2016, Richard Kern <ker...@gmail.com <>> wrote:
>>>> 
>>>> > On Sep 8, 2016, at 4:19 AM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>>>> >
>>>> > From: Aman Gupta <a...@tmm1.net <>>
>>>> >
>>>> > ---
>>>> > libavcodec/videotoolboxenc.c | 76 
>>>> > ++--
>>>> > 1 file changed, 67 insertions(+), 9 deletions(-)
>>>> >
>>>> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>>> > index 4345ca3..859dde9 100644
>>>> > --- a/libavcodec/videotoolboxenc.c
>>>> > +++ b/libavcodec/videotoolboxenc.c
>>>> > @@ -32,6 +32,7 @@
>>>> > #include "libavutil/pixdesc.h"
>>>> > #include "internal.h"
>>>> > #include 
>>>> > +#include "h264.h"
>>>> >
>>>> > #if !CONFIG_VT_BT2020
>>>> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
>>>> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
>>>> >
>>>> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
>>>> >
>>>> > +typedef struct ExtraSEI {
>>>> > +  void *data;
>>>> > +  size_t size;
>>>> > +} ExtraSEI;
>>>> > +
>>>> > typedef struct BufNode {
>>>> > CMSampleBufferRef cm_buffer;
>>>> > +ExtraSEI *sei;
>>>> > struct BufNode* next;
>>>> > int error;
>>>> > } BufNode;
>>>> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
>>>> > bool flushing;
>>>> > bool has_b_frames;
>>>> > bool warned_color_range;
>>>> > +bool a53_cc;
>>>> > } VTEncContext;
>>>> >
>>>> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
>>>> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
>>>> > err)
>>>> > pthread_mutex_unlock(>lock);
>>>> > }
>>>> >
>>>> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
>>>> > CMSampleBufferRef *buf)
>>>> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
>>>> > CMSampleBufferRef *buf, ExtraSEI **sei)
>>>> > {
>>>> > BufNode *info;
>>>> >
>>>> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
>>>> > wait, CMSampleBufferRef *buf)
>>>> > pthread_mutex_unlock(>lock);
>>>> >
>>>> > *buf = info->cm_buffer;
>>>> > +if (sei && *buf) {
>>>> > +*sei = info->sei;
>>>> > +} else if (info->sei) {
>>>> > +if (info->sei->data) av_free(info->sei->data);
>>>> > +av_free(info->sei);
>>>> > +}
>>>> > av_free(info);
>>>> >
>>>> > vtctx->frame_ct_out++;
>>>> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
>>>> > wait, CMSampleBufferRef *buf)
>>>> > return 0;
>>>> > }
>>>> >
>>>> > -static void vtenc_q_push(VTEncContext *vtctx, CMSamp

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-10-17 Thread Richard Kern

> On Oct 17, 2016, at 8:47 PM, Aman Gupta <ffm...@tmm1.net> wrote:
> 
> 
> 
> On Mon, Oct 17, 2016 at 6:35 AM, Richard Kern <ker...@gmail.com 
> <mailto:ker...@gmail.com>> wrote:
> 
>> On Sep 19, 2016, at 10:30 AM, Aman Gupta <ffm...@tmm1.net 
>> <mailto:ffm...@tmm1.net>> wrote:
>> 
>> 
>> 
>> On Monday, September 19, 2016, Richard Kern <ker...@gmail.com 
>> <mailto:ker...@gmail.com>> wrote:
>> 
>>> On Sep 10, 2016, at 10:33 PM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>>> 
>>> 
>>> 
>>> On Sunday, September 11, 2016, Richard Kern <ker...@gmail.com <>> wrote:
>>> 
>>> > On Sep 8, 2016, at 4:19 AM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>>> >
>>> > From: Aman Gupta <a...@tmm1.net <>>
>>> >
>>> > ---
>>> > libavcodec/videotoolboxenc.c | 76 
>>> > ++--
>>> > 1 file changed, 67 insertions(+), 9 deletions(-)
>>> >
>>> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>> > index 4345ca3..859dde9 100644
>>> > --- a/libavcodec/videotoolboxenc.c
>>> > +++ b/libavcodec/videotoolboxenc.c
>>> > @@ -32,6 +32,7 @@
>>> > #include "libavutil/pixdesc.h"
>>> > #include "internal.h"
>>> > #include 
>>> > +#include "h264.h"
>>> >
>>> > #if !CONFIG_VT_BT2020
>>> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
>>> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
>>> >
>>> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
>>> >
>>> > +typedef struct ExtraSEI {
>>> > +  void *data;
>>> > +  size_t size;
>>> > +} ExtraSEI;
>>> > +
>>> > typedef struct BufNode {
>>> > CMSampleBufferRef cm_buffer;
>>> > +ExtraSEI *sei;
>>> > struct BufNode* next;
>>> > int error;
>>> > } BufNode;
>>> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
>>> > bool flushing;
>>> > bool has_b_frames;
>>> > bool warned_color_range;
>>> > +bool a53_cc;
>>> > } VTEncContext;
>>> >
>>> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
>>> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
>>> > err)
>>> > pthread_mutex_unlock(>lock);
>>> > }
>>> >
>>> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
>>> > *buf)
>>> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
>>> > *buf, ExtraSEI **sei)
>>> > {
>>> > BufNode *info;
>>> >
>>> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
>>> > wait, CMSampleBufferRef *buf)
>>> > pthread_mutex_unlock(>lock);
>>> >
>>> > *buf = info->cm_buffer;
>>> > +if (sei && *buf) {
>>> > +*sei = info->sei;
>>> > +} else if (info->sei) {
>>> > +if (info->sei->data) av_free(info->sei->data);
>>> > +av_free(info->sei);
>>> > +}
>>> > av_free(info);
>>> >
>>> > vtctx->frame_ct_out++;
>>> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
>>> > wait, CMSampleBufferRef *buf)
>>> > return 0;
>>> > }
>>> >
>>> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
>>> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
>>> > ExtraSEI *sei)
>>> > {
>>> > BufNode *info = av_malloc(sizeof(BufNode));
>>> > if (!info) {
>>> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
>>> > CMSampleBufferRef buffer)
>>> >
>>> > CFRetain(buffer);
>>> > info->cm_buffer = buffer;
>>> > +info->sei = sei;
>>> > info->next = NULL;
>>> >
>>> > pthread_mutex_lock(>lock);
>>> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
>>> > {
>>>

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-10-17 Thread Richard Kern

> On Sep 19, 2016, at 10:30 AM, Aman Gupta <ffm...@tmm1.net> wrote:
> 
> 
> 
> On Monday, September 19, 2016, Richard Kern <ker...@gmail.com 
> <mailto:ker...@gmail.com>> wrote:
> 
>> On Sep 10, 2016, at 10:33 PM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>> 
>> 
>> 
>> On Sunday, September 11, 2016, Richard Kern <ker...@gmail.com <>> wrote:
>> 
>> > On Sep 8, 2016, at 4:19 AM, Aman Gupta <ffm...@tmm1.net <>> wrote:
>> >
>> > From: Aman Gupta <a...@tmm1.net <>>
>> >
>> > ---
>> > libavcodec/videotoolboxenc.c | 76 
>> > ++--
>> > 1 file changed, 67 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> > index 4345ca3..859dde9 100644
>> > --- a/libavcodec/videotoolboxenc.c
>> > +++ b/libavcodec/videotoolboxenc.c
>> > @@ -32,6 +32,7 @@
>> > #include "libavutil/pixdesc.h"
>> > #include "internal.h"
>> > #include 
>> > +#include "h264.h"
>> >
>> > #if !CONFIG_VT_BT2020
>> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
>> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
>> >
>> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
>> >
>> > +typedef struct ExtraSEI {
>> > +  void *data;
>> > +  size_t size;
>> > +} ExtraSEI;
>> > +
>> > typedef struct BufNode {
>> > CMSampleBufferRef cm_buffer;
>> > +ExtraSEI *sei;
>> > struct BufNode* next;
>> > int error;
>> > } BufNode;
>> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
>> > bool flushing;
>> > bool has_b_frames;
>> > bool warned_color_range;
>> > +bool a53_cc;
>> > } VTEncContext;
>> >
>> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
>> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
>> > err)
>> > pthread_mutex_unlock(>lock);
>> > }
>> >
>> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
>> > *buf)
>> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
>> > *buf, ExtraSEI **sei)
>> > {
>> > BufNode *info;
>> >
>> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool 
>> > wait, CMSampleBufferRef *buf)
>> > pthread_mutex_unlock(>lock);
>> >
>> > *buf = info->cm_buffer;
>> > +if (sei && *buf) {
>> > +*sei = info->sei;
>> > +} else if (info->sei) {
>> > +if (info->sei->data) av_free(info->sei->data);
>> > +av_free(info->sei);
>> > +}
>> > av_free(info);
>> >
>> > vtctx->frame_ct_out++;
>> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
>> > CMSampleBufferRef *buf)
>> > return 0;
>> > }
>> >
>> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
>> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
>> > ExtraSEI *sei)
>> > {
>> > BufNode *info = av_malloc(sizeof(BufNode));
>> > if (!info) {
>> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
>> > CMSampleBufferRef buffer)
>> >
>> > CFRetain(buffer);
>> > info->cm_buffer = buffer;
>> > +info->sei = sei;
>> > info->next = NULL;
>> >
>> > pthread_mutex_lock(>lock);
>> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
>> > {
>> > AVCodecContext *avctx = ctx;
>> > VTEncContext   *vtctx = avctx->priv_data;
>> > +ExtraSEI *sei = sourceFrameCtx;
>> >
>> > if (vtctx->async_error) {
>> > if(sample_buffer) CFRelease(sample_buffer);
>> > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
>> > }
>> > }
>> >
>> > -vtenc_q_push(vtctx, sample_buffer);
>> > +vtenc_q_push(vtctx, sample_buffer, sei);
>> > }
>> >
>> > static int get_length_code_size(
>> > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
>>

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-09-19 Thread Richard Kern

> On Sep 10, 2016, at 10:33 PM, Aman Gupta <ffm...@tmm1.net> wrote:
> 
> 
> 
> On Sunday, September 11, 2016, Richard Kern <ker...@gmail.com 
> <mailto:ker...@gmail.com>> wrote:
> 
> > On Sep 8, 2016, at 4:19 AM, Aman Gupta <ffm...@tmm1.net <>> wrote:
> >
> > From: Aman Gupta <a...@tmm1.net <>>
> >
> > ---
> > libavcodec/videotoolboxenc.c | 76 
> > ++--
> > 1 file changed, 67 insertions(+), 9 deletions(-)
> >
> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> > index 4345ca3..859dde9 100644
> > --- a/libavcodec/videotoolboxenc.c
> > +++ b/libavcodec/videotoolboxenc.c
> > @@ -32,6 +32,7 @@
> > #include "libavutil/pixdesc.h"
> > #include "internal.h"
> > #include 
> > +#include "h264.h"
> >
> > #if !CONFIG_VT_BT2020
> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
> >
> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
> >
> > +typedef struct ExtraSEI {
> > +  void *data;
> > +  size_t size;
> > +} ExtraSEI;
> > +
> > typedef struct BufNode {
> > CMSampleBufferRef cm_buffer;
> > +ExtraSEI *sei;
> > struct BufNode* next;
> > int error;
> > } BufNode;
> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
> > bool flushing;
> > bool has_b_frames;
> > bool warned_color_range;
> > +bool a53_cc;
> > } VTEncContext;
> >
> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
> > err)
> > pthread_mutex_unlock(>lock);
> > }
> >
> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> > *buf)
> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> > *buf, ExtraSEI **sei)
> > {
> > BufNode *info;
> >
> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> > CMSampleBufferRef *buf)
> > pthread_mutex_unlock(>lock);
> >
> > *buf = info->cm_buffer;
> > +if (sei && *buf) {
> > +*sei = info->sei;
> > +} else if (info->sei) {
> > +if (info->sei->data) av_free(info->sei->data);
> > +av_free(info->sei);
> > +}
> > av_free(info);
> >
> > vtctx->frame_ct_out++;
> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> > CMSampleBufferRef *buf)
> > return 0;
> > }
> >
> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
> > ExtraSEI *sei)
> > {
> > BufNode *info = av_malloc(sizeof(BufNode));
> > if (!info) {
> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
> > CMSampleBufferRef buffer)
> >
> > CFRetain(buffer);
> > info->cm_buffer = buffer;
> > +info->sei = sei;
> > info->next = NULL;
> >
> > pthread_mutex_lock(>lock);
> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
> > {
> > AVCodecContext *avctx = ctx;
> > VTEncContext   *vtctx = avctx->priv_data;
> > +ExtraSEI *sei = sourceFrameCtx;
> >
> > if (vtctx->async_error) {
> > if(sample_buffer) CFRelease(sample_buffer);
> > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
> > }
> > }
> >
> > -vtenc_q_push(vtctx, sample_buffer);
> > +vtenc_q_push(vtctx, sample_buffer, sei);
> > }
> >
> > static int get_length_code_size(
> > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
> > static int vtenc_cm_to_avpacket(
> > AVCodecContext*avctx,
> > CMSampleBufferRef sample_buffer,
> > -AVPacket  *pkt)
> > +AVPacket  *pkt,
> > +ExtraSEI  *sei)
> > {
> > VTEncContext *vtctx = avctx->priv_data;
> >
> > @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
> > size_t  header_size = 0;
> > size_t  in_buf_size;
> > size_t  out_buf_size;
> > +size_t  sei_nalu_size = 0;
> > int64_t dts_delta;
> > int64_t time_base_num;
> > int nalu_count;
> > @@ -1298,9 +

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-09-10 Thread Richard Kern

> On Sep 8, 2016, at 4:19 AM, Aman Gupta  wrote:
> 
> From: Aman Gupta 
> 
> ---
> libavcodec/videotoolboxenc.c | 76 ++--
> 1 file changed, 67 insertions(+), 9 deletions(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 4345ca3..859dde9 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -32,6 +32,7 @@
> #include "libavutil/pixdesc.h"
> #include "internal.h"
> #include 
> +#include "h264.h"
> 
> #if !CONFIG_VT_BT2020
> # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
> @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
> 
> static const uint8_t start_code[] = { 0, 0, 0, 1 };
> 
> +typedef struct ExtraSEI {
> +  void *data;
> +  size_t size;
> +} ExtraSEI;
> +
> typedef struct BufNode {
> CMSampleBufferRef cm_buffer;
> +ExtraSEI *sei;
> struct BufNode* next;
> int error;
> } BufNode;
> @@ -94,6 +101,7 @@ typedef struct VTEncContext {
> bool flushing;
> bool has_b_frames;
> bool warned_color_range;
> +bool a53_cc;
> } VTEncContext;
> 
> static int vtenc_populate_extradata(AVCodecContext   *avctx,
> @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int err)
> pthread_mutex_unlock(>lock);
> }
> 
> -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> *buf)
> +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> *buf, ExtraSEI **sei)
> {
> BufNode *info;
> 
> @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> CMSampleBufferRef *buf)
> pthread_mutex_unlock(>lock);
> 
> *buf = info->cm_buffer;
> +if (sei && *buf) {
> +*sei = info->sei;
> +} else if (info->sei) {
> +if (info->sei->data) av_free(info->sei->data);
> +av_free(info->sei);
> +}
> av_free(info);
> 
> vtctx->frame_ct_out++;
> @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> CMSampleBufferRef *buf)
> return 0;
> }
> 
> -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
> +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
> ExtraSEI *sei)
> {
> BufNode *info = av_malloc(sizeof(BufNode));
> if (!info) {
> @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
> CMSampleBufferRef buffer)
> 
> CFRetain(buffer);
> info->cm_buffer = buffer;
> +info->sei = sei;
> info->next = NULL;
> 
> pthread_mutex_lock(>lock);
> @@ -420,6 +435,7 @@ static void vtenc_output_callback(
> {
> AVCodecContext *avctx = ctx;
> VTEncContext   *vtctx = avctx->priv_data;
> +ExtraSEI *sei = sourceFrameCtx;
> 
> if (vtctx->async_error) {
> if(sample_buffer) CFRelease(sample_buffer);
> @@ -440,7 +456,7 @@ static void vtenc_output_callback(
> }
> }
> 
> -vtenc_q_push(vtctx, sample_buffer);
> +vtenc_q_push(vtctx, sample_buffer, sei);
> }
> 
> static int get_length_code_size(
> @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
> static int vtenc_cm_to_avpacket(
> AVCodecContext*avctx,
> CMSampleBufferRef sample_buffer,
> -AVPacket  *pkt)
> +AVPacket  *pkt,
> +ExtraSEI  *sei)
> {
> VTEncContext *vtctx = avctx->priv_data;
> 
> @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
> size_t  header_size = 0;
> size_t  in_buf_size;
> size_t  out_buf_size;
> +size_t  sei_nalu_size = 0;
> int64_t dts_delta;
> int64_t time_base_num;
> int nalu_count;
> @@ -1298,9 +1316,14 @@ static int vtenc_cm_to_avpacket(
> if(status)
> return status;
> 
> +if (sei) {
> +sei_nalu_size = sizeof(start_code) + 3 + sei->size + 1;
> +}
> +
> in_buf_size = CMSampleBufferGetTotalSampleSize(sample_buffer);
> out_buf_size = header_size +
>in_buf_size +
> +   sei_nalu_size +
>nalu_count * ((int)sizeof(start_code) - 
> (int)length_code_size);
> 
> status = ff_alloc_packet2(avctx, pkt, out_buf_size, out_buf_size);
> @@ -1317,7 +1340,7 @@ static int vtenc_cm_to_avpacket(
> length_code_size,
> sample_buffer,
> pkt->data + header_size,
> -pkt->size - header_size
> +pkt->size - header_size - sei_nalu_size
> );
> 
> if (status) {
> @@ -1325,6 +1348,19 @@ static int vtenc_cm_to_avpacket(
> return status;
> }
> 
> +if (sei_nalu_size > 0) {
> +uint8_t *sei_nalu = pkt->data + pkt->size - sei_nalu_size;
> +memcpy(sei_nalu, start_code, sizeof(start_code));
> +sei_nalu += sizeof(start_code);
> +sei_nalu[0] = NAL_SEI;
> +sei_nalu[1] = SEI_TYPE_USER_DATA_REGISTERED;
> +sei_nalu[2] = sei->size;
> +sei_nalu += 3;
> +memcpy(sei_nalu, sei->data, sei->size);
> +sei_nalu += sei->size;
> +sei_nalu[0] = 1; // RBSP
> +

Re: [FFmpeg-devel] [PATCH] web/index: add 3.1

2016-06-27 Thread Richard Kern

> On Jun 27, 2016, at 11:18 AM, Michael Niedermayer <mich...@niedermayer.cc> 
> wrote:
> 
> On Mon, Jun 27, 2016 at 10:55:08AM -0400, Richard Kern wrote:
>> 
>>> On Jun 27, 2016, at 10:29 AM, Michael Niedermayer <mich...@niedermayer.cc> 
>>> wrote:
>>> 
>>> Some entries from the changelog are used
>>> ---
>>> src/index |   27 +++
>>> 1 file changed, 27 insertions(+)
>>> 
>>> diff --git a/src/index b/src/index
>>> index ff0caf2..79a71e8 100644
>>> --- a/src/index
>>> +++ b/src/index
>>> @@ -37,6 +37,33 @@
>>>News
>>>  
>>> 
>>> +  June 27th, 2016, FFmpeg 3.1 "Laplace"
>>> +  
>>> +FFmpeg 3.1 "Laplace", a new
>>> +major release, is now available! Some of the highlights:
>>> +  
>>> +  
>>> +DXVA2-accelerated HEVC Main10 decoding
>>> +Many new filters have been added
>>> +MediaCodec H264 decoding
>>> +AudioToolbox audio codec
>>> +VAAPI-accelerated format conversion and scaling
>>> +libnpp/CUDA-accelerated format conversion and scaling
>>> +VAAPI-accelerated H.264/HEVC/MJPEG encoding
>>> +DTS Express (LBR) decoder
>>> +Generic OpenMAX IL encoder with support for Raspberry Pi
>>> +IFF ANIM demuxer & decoder
>>> +Direct Stream Transfer (DST) decoder
>>> +CUDA CUVID H264/HEVC decoder
>>> +10-bit depth support in native utvideo decoder
>>> +YUY2 Lossless Codec decoder
>>> +See the >> href="https://git.videolan.org/?p=ffmpeg.git;a=blob_plain;f=Changelog;hb=n3.1;>Changelog
>>>  for a list of more updates
>>> +  
>>> +  
>>> +We strongly recommend users, distributors, and system integrators to
>>> +upgrade unless they use current git master.
>>> +  
>>> +
>>>  March 16th, 2016, Google Summer of Code
>>>  
>>>FFmpeg has been accepted as a >> href="https://summerofcode.withgoogle.com/;>Google Summer of Code open 
>>> source organization. If you wish to
>>> -- 
>>> 1.7.9.5
>>> 
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> 
>> Can you add the VideoToolbox H.264 encoder? It wasn’t in the changelog.
> 
> Please add it to the changelog to all affected branches
> 
> ill send a new patch for index

Changelog is updated in master and release/3.1.

> 
> thx
> 
> [...]
> 
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Many that live deserve death. And some that die deserve life. Can you give
> it to them? Then do not be too eager to deal out death in judgement. For
> even the very wise cannot see all ends. -- Gandalf
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] web/index: add 3.1

2016-06-27 Thread Richard Kern

> On Jun 27, 2016, at 10:29 AM, Michael Niedermayer  
> wrote:
> 
> Some entries from the changelog are used
> ---
> src/index |   27 +++
> 1 file changed, 27 insertions(+)
> 
> diff --git a/src/index b/src/index
> index ff0caf2..79a71e8 100644
> --- a/src/index
> +++ b/src/index
> @@ -37,6 +37,33 @@
> News
>   
> 
> +  June 27th, 2016, FFmpeg 3.1 "Laplace"
> +  
> +FFmpeg 3.1 "Laplace", a new
> +major release, is now available! Some of the highlights:
> +  
> +  
> +DXVA2-accelerated HEVC Main10 decoding
> +Many new filters have been added
> +MediaCodec H264 decoding
> +AudioToolbox audio codec
> +VAAPI-accelerated format conversion and scaling
> +libnpp/CUDA-accelerated format conversion and scaling
> +VAAPI-accelerated H.264/HEVC/MJPEG encoding
> +DTS Express (LBR) decoder
> +Generic OpenMAX IL encoder with support for Raspberry Pi
> +IFF ANIM demuxer & decoder
> +Direct Stream Transfer (DST) decoder
> +CUDA CUVID H264/HEVC decoder
> +10-bit depth support in native utvideo decoder
> +YUY2 Lossless Codec decoder
> +See the  href="https://git.videolan.org/?p=ffmpeg.git;a=blob_plain;f=Changelog;hb=n3.1;>Changelog
>  for a list of more updates
> +  
> +  
> +We strongly recommend users, distributors, and system integrators to
> +upgrade unless they use current git master.
> +  
> +
>   March 16th, 2016, Google Summer of Code
>   
> FFmpeg has been accepted as a  href="https://summerofcode.withgoogle.com/;>Google Summer of Code open 
> source organization. If you wish to
> -- 
> 1.7.9.5
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Can you add the VideoToolbox H.264 encoder? It wasn’t in the changelog.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] lavd/decklink_common: Fix error caused by -Werror=missing-prototypes

2016-06-27 Thread Richard Kern

> On Jun 27, 2016, at 4:58 AM, Michael Niedermayer  
> wrote:
> 
> On Sun, Jun 26, 2016 at 08:24:49PM -0400, Rick Kern wrote:
>> decklink_common.cpp includes a .cpp file from the DeckLink API which fails
>> to build because there are non-static functions in the included .cpp file.
>> This disables the missing-prototypes error so the file can be included.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> libavdevice/Makefile | 2 ++
>> 1 file changed, 2 insertions(+)
>> 
>> diff --git a/libavdevice/Makefile b/libavdevice/Makefile
>> index 585827b..e281825 100644
>> --- a/libavdevice/Makefile
>> +++ b/libavdevice/Makefile
>> @@ -19,6 +19,8 @@ OBJS-$(CONFIG_BKTR_INDEV)+= bktr.o
>> OBJS-$(CONFIG_CACA_OUTDEV)   += caca.o
>> OBJS-$(CONFIG_DECKLINK_OUTDEV)   += decklink_enc.o decklink_enc_c.o 
>> decklink_common.o
>> OBJS-$(CONFIG_DECKLINK_INDEV)+= decklink_dec.o decklink_dec_c.o 
>> decklink_common.o
> 
>> +$(SUBDIR)decklink_common.o: CXXFLAGS += -Wno-error=missing-prototypes
> 
> Is this portable ?
> is there some posix document or similar that says that this
> is supported by all compilers ?

configure adds the -Werror=missing-prototypes only if it’s supported by the 
compiler. Instead, I could add -Wno-error=… to CFLAGS only if it’s supported.

> 
> and in what directory are these system headers that cause the problem?
> is this directory a system header directory ?
> what compiler fails to suppress warnings from system headers ?

They’re not in a system header directory. It fails to build with clang when 
it’s added as a user include directory, but it does build with -isystem. I’ve 
seen this issue floating around the internet, so this would make building the 
decklink code a little easier.

> 
> also:
> http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-in-system-headers
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> The real ebay dictionary, page 1
> "Used only once"- "Some unspecified defect prevented a second use"
> "In good condition" - "Can be repaird by experienced expert"
> "As is" - "You wouldnt want it even if you were payed for it, if you knew ..."
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] lavd/decklink_common: Fix error caused by -Werror=missing-prototypes

2016-06-26 Thread Richard Kern

> On Jun 25, 2016, at 3:16 PM, Michael Niedermayer  
> wrote:
> 
> On Sat, Jun 25, 2016 at 05:29:56PM +, Carl Eugen Hoyos wrote:
>> Michael Niedermayer  niedermayer.cc> writes:
>> 
>>> why does this happen ?
>> 
>> I thought it happens because FFmpeg include third-party 
>> files that do not copmile with error=missing-prototypes.
> 
> but why should they build with random "warning are error" flags ?
> one cannot write headers that are guranteed to never trigger a warning
> on any compiler.
> and if one cannot and does not, -Werror* could not work unless it
> has an exception for system / 3rd party stuff

The error is being thrown when the location of the decklink headers being
pulled in as user includes with -I. Clang doesn’t support -i, and I couldn’t
find an equivalent option to include as system headers. Am I missing
something?

> 
> also see:
> 
> http://stackoverflow.com/questions/1867065/how-to-suppress-gcc-warnings-from-library-headers
> http://stackoverflow.com/questions/3308523/how-to-eliminate-external-lib-third-party-warnings-in-gcc
> 
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: use c++98 for c++ files

2016-06-26 Thread Richard Kern

> On Jun 26, 2016, at 6:20 PM, Michael Niedermayer <mich...@niedermayer.cc> 
> wrote:
> 
> On Sun, Jun 26, 2016 at 06:00:41PM -0400, Richard Kern wrote:
>> 
>>> On Jun 26, 2016, at 5:55 PM, Michael Niedermayer <mich...@niedermayer.cc> 
>>> wrote:
>>> 
>>> On Sun, Jun 26, 2016 at 05:44:11PM -0400, Richard Kern wrote:
>>>> 
>>>>> On Jun 26, 2016, at 5:26 PM, Michael Niedermayer <mich...@niedermayer.cc> 
>>>>> wrote:
>>>>> 
>>>>> On Sun, Jun 26, 2016 at 05:22:01PM -0400, Richard Kern wrote:
>>>>>> 
>>>>>>> On Jun 26, 2016, at 5:10 PM, Michael Niedermayer 
>>>>>>> <mich...@niedermayer.cc> wrote:
>>>>>>> 
>>>>>>> On Sun, Jun 26, 2016 at 04:44:40PM -0400, Rick Kern wrote:
>>>>>>>> Use c++98 standard instead of c++11.
>>>>>>>> 
>>>>>>>> Signed-off-by: Rick Kern <ker...@gmail.com>
>>>>>>>> ---
>>>>>>>> configure | 2 +-
>>>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>> 
>>>>>>>> diff --git a/configure b/configure
>>>>>>>> index 19aea61..76d2d27 100755
>>>>>>>> --- a/configure
>>>>>>>> +++ b/configure
>>>>>>>> @@ -4529,7 +4529,7 @@ fi
>>>>>>>> 
>>>>>>>> add_cppflags -D_ISOC99_SOURCE
>>>>>>>> add_cxxflags -D__STDC_CONSTANT_MACROS
>>>>>>>> -add_cxxflags -std=c++11
>>>>>>>> +add_cxxflags -std=c++98
>>>>>>> 
>>>>>>> should this not be check_cxxflags ?
>>>>>> 
>>>>>> Some c++ standard needs to be there to override the -std=c99 that gets 
>>>>>> pulled in from CFLAGS.
>>>>> 
>>>>> but does every compiler support -stc=... ?
>>>>> if one doesnt the c99 case would not have been added
>>>> 
>>>> What about filtering the -std=c99 out of CFLAGS in the CXXFLAGS assignment?
>>> 
>>> have you confirmed that -std=c99 is the problem ?
>> 
>> Yes, it dies at:
>> error: invalid argument '-std=c99' not allowed with 'C++/ObjC++'
>> make: *** [libavdevice/decklink_common.o] Error 1
> 
> why does this happen now and not before ?

It’s a warning on other compilers, but it’s been an issue on OS X for a while 
(was reported in late 2014).

> and what compiler is that ?

clang

> does it work when its filtered out ?

yes - I’ll submit a patch shortly.

> if so i guess, please do that
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Avoid a single point of failure, be that a person or equipment.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: use c++98 for c++ files

2016-06-26 Thread Richard Kern

> On Jun 26, 2016, at 5:55 PM, Michael Niedermayer <mich...@niedermayer.cc> 
> wrote:
> 
> On Sun, Jun 26, 2016 at 05:44:11PM -0400, Richard Kern wrote:
>> 
>>> On Jun 26, 2016, at 5:26 PM, Michael Niedermayer <mich...@niedermayer.cc> 
>>> wrote:
>>> 
>>> On Sun, Jun 26, 2016 at 05:22:01PM -0400, Richard Kern wrote:
>>>> 
>>>>> On Jun 26, 2016, at 5:10 PM, Michael Niedermayer <mich...@niedermayer.cc> 
>>>>> wrote:
>>>>> 
>>>>> On Sun, Jun 26, 2016 at 04:44:40PM -0400, Rick Kern wrote:
>>>>>> Use c++98 standard instead of c++11.
>>>>>> 
>>>>>> Signed-off-by: Rick Kern <ker...@gmail.com>
>>>>>> ---
>>>>>> configure | 2 +-
>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>> 
>>>>>> diff --git a/configure b/configure
>>>>>> index 19aea61..76d2d27 100755
>>>>>> --- a/configure
>>>>>> +++ b/configure
>>>>>> @@ -4529,7 +4529,7 @@ fi
>>>>>> 
>>>>>> add_cppflags -D_ISOC99_SOURCE
>>>>>> add_cxxflags -D__STDC_CONSTANT_MACROS
>>>>>> -add_cxxflags -std=c++11
>>>>>> +add_cxxflags -std=c++98
>>>>> 
>>>>> should this not be check_cxxflags ?
>>>> 
>>>> Some c++ standard needs to be there to override the -std=c99 that gets 
>>>> pulled in from CFLAGS.
>>> 
>>> but does every compiler support -stc=... ?
>>> if one doesnt the c99 case would not have been added
>> 
>> What about filtering the -std=c99 out of CFLAGS in the CXXFLAGS assignment?
> 
> have you confirmed that -std=c99 is the problem ?

Yes, it dies at:
error: invalid argument '-std=c99' not allowed with 'C++/ObjC++'
make: *** [libavdevice/decklink_common.o] Error 1

> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> No snowflake in an avalanche ever feels responsible. -- Voltaire
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: use c++98 for c++ files

2016-06-26 Thread Richard Kern

> On Jun 26, 2016, at 5:26 PM, Michael Niedermayer <mich...@niedermayer.cc> 
> wrote:
> 
> On Sun, Jun 26, 2016 at 05:22:01PM -0400, Richard Kern wrote:
>> 
>>> On Jun 26, 2016, at 5:10 PM, Michael Niedermayer <mich...@niedermayer.cc> 
>>> wrote:
>>> 
>>> On Sun, Jun 26, 2016 at 04:44:40PM -0400, Rick Kern wrote:
>>>> Use c++98 standard instead of c++11.
>>>> 
>>>> Signed-off-by: Rick Kern <ker...@gmail.com>
>>>> ---
>>>> configure | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>> 
>>>> diff --git a/configure b/configure
>>>> index 19aea61..76d2d27 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -4529,7 +4529,7 @@ fi
>>>> 
>>>> add_cppflags -D_ISOC99_SOURCE
>>>> add_cxxflags -D__STDC_CONSTANT_MACROS
>>>> -add_cxxflags -std=c++11
>>>> +add_cxxflags -std=c++98
>>> 
>>> should this not be check_cxxflags ?
>> 
>> Some c++ standard needs to be there to override the -std=c99 that gets 
>> pulled in from CFLAGS.
> 
> but does every compiler support -stc=... ?
> if one doesnt the c99 case would not have been added

What about filtering the -std=c99 out of CFLAGS in the CXXFLAGS assignment?

> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Dictatorship: All citizens are under surveillance, all their steps and
> actions recorded, for the politicians to enforce control.
> Democracy: All politicians are under surveillance, all their steps and
> actions recorded, for the citizens to enforce control.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: use c++98 for c++ files

2016-06-26 Thread Richard Kern

> On Jun 26, 2016, at 5:10 PM, Michael Niedermayer  
> wrote:
> 
> On Sun, Jun 26, 2016 at 04:44:40PM -0400, Rick Kern wrote:
>> Use c++98 standard instead of c++11.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> configure | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/configure b/configure
>> index 19aea61..76d2d27 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4529,7 +4529,7 @@ fi
>> 
>> add_cppflags -D_ISOC99_SOURCE
>> add_cxxflags -D__STDC_CONSTANT_MACROS
>> -add_cxxflags -std=c++11
>> +add_cxxflags -std=c++98
> 
> should this not be check_cxxflags ?

Some c++ standard needs to be there to override the -std=c99 that gets pulled 
in from CFLAGS.

> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Democracy is the form of government in which you can choose your dictator
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavd/decklink: Fix compile issue on OS X

2016-06-26 Thread Richard Kern

> On Jun 26, 2016, at 4:10 PM, James Almer  wrote:
> 
> On 6/23/2016 8:08 PM, Rick Kern wrote:
>> Fixes #4124: Invalid argument '-std=c99' not allowed with 'C++/ObjC++'
>> C++ files fail to compile. This adds '-std=c++11' to CXX_FLAGS to fix.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> common.mak | 2 +-
>> configure  | 1 +
>> 2 files changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/common.mak b/common.mak
>> index 59b039f..3f2096d 100644
>> --- a/common.mak
>> +++ b/common.mak
>> @@ -39,7 +39,7 @@ CCFLAGS = $(CPPFLAGS) $(CFLAGS)
>> OBJCFLAGS  += $(EOBJCFLAGS)
>> OBJCCFLAGS  = $(CPPFLAGS) $(CFLAGS) $(OBJCFLAGS)
>> ASFLAGS:= $(CPPFLAGS) $(ASFLAGS)
>> -CXXFLAGS   += $(CPPFLAGS) $(CFLAGS)
>> +CXXFLAGS   := $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS)
>> YASMFLAGS  += $(IFLAGS:%=%/) -Pconfig.asm
>> 
>> HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS)
>> diff --git a/configure b/configure
>> index 94a0a6c..3787894 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4519,6 +4519,7 @@ fi
>> 
>> add_cppflags -D_ISOC99_SOURCE
>> add_cxxflags -D__STDC_CONSTANT_MACROS
>> +add_cxxflags -std=c++11
> 
> Is the c++ code in our tree actually c++11? Or just standard c++98? The 
> -std=c++11
> option is relatively recent. Very old compilers may not recognize it.
> 
> If it is, then you should check if it's supported using check_cxxflags(), 
> then try the
> same with c++0x (the original value for the standard back when it was planned 
> to
> be finished in the last decade, and a compatibility alias for c++11 on newer
> compilers). If neither work then configure should abort.
> 
> If it's not, then change it to use c++98.

Ok, submitted a patch to use c++98. It’s simple, but can you take a look to 
make sure we’re on the same wavelength?

> 
>> check_cflags -std=c99
>> check_cc -D_FILE_OFFSET_BITS=64 <> #include 
>> 
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] lavd/decklink_common: Fix error caused by -Werror=missing-prototypes

2016-06-23 Thread Richard Kern

> On Jun 23, 2016, at 8:06 PM, Carl Eugen Hoyos  wrote:
> 
> Rick Kern  gmail.com> writes:
> 
>> This temporarily disables the missing-prototypes error so 
>> the file can be included.
> 
> Can't you add -Wno-error=missing-prototypes to the cxx flags 
> just as you did in 1/2?

This was just disabling it for the bad include instead of every file. I’ll add 
it to the cxx flags - much cleaner anyway.

> 
> Thank you for working on this, I like 1/2, Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/videotoolbox: fix H.264 hwaccel init issue

2016-06-17 Thread Richard Kern

> On Jun 17, 2016, at 10:36 AM, Clément Bœsch <u...@pkh.me> wrote:
> 
> On Fri, Jun 17, 2016 at 09:43:09AM -0400, Richard Kern wrote:
>> Since ca2f19b9cc (h264: switch to h2645_parse for NAL parsing) the hwaccel 
>> wouldn’t init (when the first h.264 frame is decoded). It was the same on OS 
>> X and iOS - creating the decoder would return a “decoder malfunction” error. 
>> Apple’s suggested way to create the decoder config for h.264 decoders is 
>> CMVideoFormatDescriptionCreateFromH264ParameterSets(), and switching to this 
>> function solved the issue on OS X and iOS. A user on IRC confirmed it worked 
>> for them too.
>> 
> 
> So avc_info constructed from extradata in decoder_config_create() wasn't
> enough? (Any idea why?)

I don’t know why. Unfortunately there isn’t much documentation, and the error 
message is vague.

> 
> "the hwaccel wouldn't init", why? Is it because the SPS/PPS NALs were
> somehow split out of the packets since ca2f19b9cc and thus VT never got
> them, or I misunderstand?

The same SPS and PPS from the H264Context are being used to create the avcC 
atom as are passed to CMVideoFormatDescriptionCreateFromH264ParameterSets()… 
I’ll need to do some digging in the commit that broke it this weekend.

> 
> -- 
> Clément B.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] two small untested VT patches

2016-06-17 Thread Richard Kern

> On Jun 17, 2016, at 10:10 AM, Clément Bœsch  wrote:
> 
> $subj
> 
> (sorry no mac available right now)

OS X works fine. I can test iOS later today if you like, but it’s small. LGTM.

> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-cvslog] lavc/videotoolbox: fix H.264 hwaccel init issue

2016-06-17 Thread Richard Kern

> On Jun 17, 2016, at 5:31 AM, Clément Bœsch  wrote:
> 
> On Fri, Jun 17, 2016 at 03:24:10AM +0200, Rick Kern wrote:
>> ffmpeg | branch: master | Rick Kern  | Wed Jun  1 21:40:22 
>> 2016 -0400| [8e47a99f576da10b2a36e33b6b9acbf1c2da7485] | committer: Rick Kern
>> 
>> lavc/videotoolbox: fix H.264 hwaccel init issue
>> 
>> Fixes VTDecompressionSessionCreate() error.
>> 
> 
> Please reference the closing Ticket next time, and mention that it's a
> regression.

ok

> 
> Also, can you elaborate on why this fix is required? What was wrong
> exactly previously, and why was it working?
> 
> It feels like it's including more than a fix.

Since ca2f19b9cc (h264: switch to h2645_parse for NAL parsing) the hwaccel 
wouldn’t init (when the first h.264 frame is decoded). It was the same on OS X 
and iOS - creating the decoder would return a “decoder malfunction” error. 
Apple’s suggested way to create the decoder config for h.264 decoders is 
CMVideoFormatDescriptionCreateFromH264ParameterSets(), and switching to this 
function solved the issue on OS X and iOS. A user on IRC confirmed it worked 
for them too.

> 
> (BTW, do you happen to be on IRC?)

Yeah, I’m rkern. I’m in the eastern US time zone and sign in to both #ffmpeg 
and #ffmpeg-devel.

> 
> Regards,
> 
> -- 
> Clément B.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/audiotoolboxenc: fix dropped frames on iOS

2016-06-09 Thread Richard Kern

> On Jun 2, 2016, at 2:32 AM, Rick Kern  wrote:
> 
> AudioConverterFillComplexBuffer() doesn't always call its callback. A frame
> queue is used to prevent skipped audio samples.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/audiotoolboxenc.c | 78 +---
> 1 file changed, 52 insertions(+), 26 deletions(-)
> 
> diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
> index 855df0c..262308a 100644
> --- a/libavcodec/audiotoolboxenc.c
> +++ b/libavcodec/audiotoolboxenc.c
> @@ -22,6 +22,9 @@
> 
> #include 
> 
> +#define FF_BUFQUEUE_SIZE 256
> +#include "libavfilter/bufferqueue.h"
> +
> #include "config.h"
> #include "audio_frame_queue.h"
> #include "avcodec.h"
> @@ -38,8 +41,8 @@ typedef struct ATDecodeContext {
> int quality;
> 
> AudioConverterRef converter;
> -AVFrame in_frame;
> -AVFrame new_in_frame;
> +struct FFBufQueue frame_queue;
> +struct FFBufQueue used_frame_queue;
> 
> unsigned pkt_size;
> AudioFrameQueue afq;
> @@ -449,28 +452,30 @@ static OSStatus ffat_encode_callback(AudioConverterRef 
> converter, UInt32 *nb_pac
> {
> AVCodecContext *avctx = inctx;
> ATDecodeContext *at = avctx->priv_data;
> +AVFrame *frame;
> 
> -if (at->eof) {
> -*nb_packets = 0;
> -return 0;
> +if (!at->frame_queue.available) {
> +if (at->eof) {
> +*nb_packets = 0;
> +return 0;
> +} else {
> +*nb_packets = 0;
> +return 1;
> +}
> }
> 
> -av_frame_unref(>in_frame);
> -av_frame_move_ref(>in_frame, >new_in_frame);
> -
> -if (!at->in_frame.data[0]) {
> -*nb_packets = 0;
> -return 1;
> -}
> +frame = ff_bufqueue_get(>frame_queue);
> 
> data->mNumberBuffers  = 1;
> data->mBuffers[0].mNumberChannels = avctx->channels;
> -data->mBuffers[0].mDataByteSize   = at->in_frame.nb_samples *
> +data->mBuffers[0].mDataByteSize   = frame->nb_samples *
> 
> av_get_bytes_per_sample(avctx->sample_fmt) *
> avctx->channels;
> -data->mBuffers[0].mData   = at->in_frame.data[0];
> -if (*nb_packets > at->in_frame.nb_samples)
> -*nb_packets = at->in_frame.nb_samples;
> +data->mBuffers[0].mData   = frame->data[0];
> +if (*nb_packets > frame->nb_samples)
> +*nb_packets = frame->nb_samples;
> +
> +ff_bufqueue_add(avctx, >used_frame_queue, frame);
> 
> return 0;
> }
> @@ -492,20 +497,38 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket 
> *avpkt,
> };
> AudioStreamPacketDescription out_pkt_desc = {0};
> 
> -if ((ret = ff_alloc_packet2(avctx, avpkt, at->pkt_size, 0)) < 0)
> -return ret;
> -
> -av_frame_unref(>new_in_frame);
> -
> if (frame) {
> +AVFrame *in_frame;
> +
> +if (ff_bufqueue_is_full(>frame_queue)) {
> +/*
> + * The frame queue is significantly larger than needed in 
> practice,
> + * but no clear way to determine the minimum number of samples to
> + * get output from AudioConverterFillComplexBuffer().
> + */
> +av_log(avctx, AV_LOG_ERROR, "Bug: frame queue is too small.\n");
> +return AVERROR_BUG;
> +}
> +
> if ((ret = ff_af_queue_add(>afq, frame)) < 0)
> return ret;
> -if ((ret = av_frame_ref(>new_in_frame, frame)) < 0)
> +
> +in_frame = av_frame_alloc();
> +if (!in_frame)
> +return AVERROR(ENOMEM);
> +
> +if ((ret = av_frame_ref(in_frame, frame)) < 0)
> return ret;
> +
> +ff_bufqueue_add(avctx, >frame_queue, in_frame);
> } else {
> at->eof = 1;
> }
> 
> +if ((ret = ff_alloc_packet2(avctx, avpkt, at->pkt_size, 0)) < 0)
> +return ret;
> +
> +
> out_buffers.mBuffers[0].mData = avpkt->data;
> 
> *got_packet_ptr = avctx->frame_size / at->frame_size;
> @@ -513,6 +536,9 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket 
> *avpkt,
> ret = AudioConverterFillComplexBuffer(at->converter, 
> ffat_encode_callback, avctx,
>   got_packet_ptr, _buffers,
>   (avctx->frame_size > 
> at->frame_size) ? NULL : _pkt_desc);
> +
> +ff_bufqueue_discard_all(>used_frame_queue);
> +
> if ((!ret || ret == 1) && *got_packet_ptr) {
> avpkt->size = out_buffers.mBuffers[0].mDataByteSize;
> ff_af_queue_remove(>afq, out_pkt_desc.mVariableFramesInPacket ?
> @@ -531,16 +557,16 @@ static av_cold void ffat_encode_flush(AVCodecContext 
> *avctx)
> {
> ATDecodeContext *at = avctx->priv_data;
> AudioConverterReset(at->converter);
> -av_frame_unref(>new_in_frame);
> -av_frame_unref(>in_frame);
> +ff_bufqueue_discard_all(>frame_queue);
> +

Re: [FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: set extradata when opening codec

2016-06-09 Thread Richard Kern

> On Jun 8, 2016, at 5:48 AM, Michael Niedermayer  
> wrote:
> 
> On Thu, Jun 02, 2016 at 02:43:56AM -0400, Rick Kern wrote:
>> VideoToolbox doesn't supply parameter sets until the first frame is done
>> encoding. This spins up a temporary encoder and encodes a single frame to
>> get this data.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> libavcodec/videotoolboxenc.c | 326 
>> ---
>> 1 file changed, 241 insertions(+), 85 deletions(-)
> [...]
> 
>> @@ -1753,6 +1801,114 @@ end_nopkt:
>> return status;
>> }
>> 
>> +static int vtenc_populate_extradata(AVCodecContext   *avctx,
>> +CMVideoCodecType codec_type,
>> +CFStringRef  profile_level,
>> +CFNumberRef  gamma_level,
>> +CFDictionaryRef  enc_info,
>> +CFDictionaryRef  pixel_buffer_info)
>> +{
>> +VTEncContext *vtctx = avctx->priv_data;
>> +AVFrame *frame = av_frame_alloc();
>> +int y_size = avctx->width * avctx->height;
>> +int chroma_size = (avctx->width / 2) * (avctx->height / 2);
>> +CMSampleBufferRef buf = NULL;
>> +int status;
>> +
>> +if (!frame)
>> +return AVERROR(ENOMEM);
>> +
>> +frame->buf[0] = av_buffer_alloc(y_size + 2 * chroma_size);
>> +
>> +if(!frame->buf[0]){
>> +status = AVERROR(ENOMEM);
>> +goto pe_cleanup;
>> +}
>> +
>> +status = vtenc_create_encoder(avctx,
>> +  codec_type,
>> +  profile_level,
>> +  gamma_level,
>> +  enc_info,
>> +  pixel_buffer_info,
>> +  >session);
>> +if (status)
>> +goto pe_cleanup;
>> +
>> +frame->data[0] = frame->buf[0]->data;
>> +memset(frame->data[0],   0,  y_size);
>> +
>> +frame->data[1] = frame->buf[0]->data + y_size;
>> +memset(frame->data[1], 128, chroma_size);
>> +
>> +
>> +if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
>> +frame->data[2] = frame->buf[0]->data + y_size + chroma_size;
>> +memset(frame->data[2], 128, chroma_size);
>> +}
>> +
>> +frame->linesize[0] = avctx->width;
>> +
>> +if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) {
>> +frame->linesize[1] =
>> +frame->linesize[2] = (avctx->width + 1) / 2;
>> +} else {
>> +frame->linesize[1] = (avctx->width + 1) / 2;
>> +}
>> +
>> +frame->format  = avctx->pix_fmt;
>> +frame->width   = avctx->width;
>> +frame->height  = avctx->height;
> 
>> +frame->colorspace  = avctx->colorspace;
> 
> Iam not sure the docs fully match current intend but
> colorspace and color_range are documented to be only accessed
> through av_frame_get_color_range(), av_frame_set_color_range(),
> av_frame_get_colorspace() and av_frame_set_colorspace()

I’ll change these locally and push tomorrow if no one else reviews.

> 
> 
> [...]
> -- 
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: fix H.264 hwaccel init issue

2016-06-07 Thread Richard Kern

> On Jun 6, 2016, at 9:00 AM, Richard Kern <ker...@gmail.com> wrote:
> 
> Ping. This fixes #5595. 
> 
>> On Jun 1, 2016, at 10:06 PM, Rick Kern <ker...@gmail.com> wrote:
>> 
>> Fixes VTDecompressionSessionCreate() error.
>> 
>> Signed-off-by: Rick Kern <ker...@gmail.com>
>> ---
>> libavcodec/videotoolbox.c | 59 
>> ---
>> 1 file changed, 45 insertions(+), 14 deletions(-)
>> 
>> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
>> index 2f4d531..cadfb23 100644
>> --- a/libavcodec/videotoolbox.c
>> +++ b/libavcodec/videotoolbox.c
>> @@ -487,23 +487,53 @@ static CFDictionaryRef 
>> videotoolbox_buffer_attributes_create(int width,
>>return buffer_attributes;
>> }
>> 
>> -static CMVideoFormatDescriptionRef 
>> videotoolbox_format_desc_create(CMVideoCodecType codec_type,
>> +static CMVideoFormatDescriptionRef 
>> videotoolbox_format_desc_create(AVCodecContext *avctx,
>> +   
>> CMVideoCodecType codec_type,
>>   
>> CFDictionaryRef decoder_spec,
>>   int width,
>>   int height)
>> {
>> -CMFormatDescriptionRef cm_fmt_desc;
>> -OSStatus status;
>> -
>> -status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
>> -codec_type,
>> -width,
>> -height,
>> -decoder_spec, // Dictionary of 
>> extension
>> -_fmt_desc);
>> -
>> -if (status)
>> -return NULL;
>> +CMFormatDescriptionRef cm_fmt_desc = NULL;
>> +int status;
>> +H264Context *h = codec_type == kCMVideoCodecType_H264 ? 
>> avctx->priv_data : NULL;
>> +
>> +if (h && h->sps.data_size && h->pps.data_size) {
>> +int ps_count = 2;
>> +const uint8_t **ps_data = av_malloc(sizeof(uint8_t*) * ps_count);
>> +size_t *ps_sizes = av_malloc(sizeof(size_t)  * ps_count);
>> +
>> +ps_data[0]  = h->sps.data;
>> +ps_sizes[0] = h->sps.data_size;
>> +
>> +ps_data[1]  = h->pps.data;
>> +ps_sizes[1] = h->pps.data_size;
>> +
>> +status = CMVideoFormatDescriptionCreateFromH264ParameterSets(NULL,
>> + 
>> ps_count,
>> + 
>> ps_data,
>> + 
>> ps_sizes,
>> + 4,
>> + 
>> _fmt_desc);
>> +av_freep(_sizes);
>> +av_freep(_data);
>> +
>> +if (status) {
>> +av_log(avctx, AV_LOG_ERROR, "Error creating H.264 format 
>> description: %d\n", status);
>> +return NULL;
>> +}
>> +} else {
>> +status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
>> +codec_type,
>> +width,
>> +height,
>> +decoder_spec, // Dictionary 
>> of extension
>> +_fmt_desc);
>> +
>> +if (status) {
>> +av_log(avctx, AV_LOG_ERROR, "Error creating format description: 
>> %d\n", status);
>> +return NULL;
>> +}
>> +}
>> 
>>return cm_fmt_desc;
>> }
>> @@ -543,7 +573,8 @@ static int videotoolbox_default_init(AVCodecContext 
>> *avctx)
>> 
>>decoder_spec = 
>> videotoolbox_decoder_config_create(videotoolbox->cm_codec_type, avctx);
>> 
>> -videotoolbox->cm_fmt_desc = 
>> videotoolbox_format_desc_create(videotoolbox->cm_codec_type,
>> +videotoolbox->cm_fmt_desc = videotoolbox_format_desc_create(avctx,
>> +
>> videotoolbox->cm_codec_type,
>>decoder_spec,
>>avctx->width,
>>
>> avctx->height);
>> -- 
>> 2.7.4
>> 

No one’s reviewed, but pon pon confirmed the fix. What’s the policy? Can I 
push, or should I contact the maintainer directly?


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/audiotoolboxenc: fix dropped frames on iOS

2016-06-07 Thread Richard Kern
Ping.

> On Jun 2, 2016, at 2:32 AM, Rick Kern  wrote:
> 
> AudioConverterFillComplexBuffer() doesn't always call its callback. A frame
> queue is used to prevent skipped audio samples.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/audiotoolboxenc.c | 78 +---
> 1 file changed, 52 insertions(+), 26 deletions(-)
> 
> diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
> index 855df0c..262308a 100644
> --- a/libavcodec/audiotoolboxenc.c
> +++ b/libavcodec/audiotoolboxenc.c
> @@ -22,6 +22,9 @@
> 
> #include 
> 
> +#define FF_BUFQUEUE_SIZE 256
> +#include "libavfilter/bufferqueue.h"
> +
> #include "config.h"
> #include "audio_frame_queue.h"
> #include "avcodec.h"
> @@ -38,8 +41,8 @@ typedef struct ATDecodeContext {
> int quality;
> 
> AudioConverterRef converter;
> -AVFrame in_frame;
> -AVFrame new_in_frame;
> +struct FFBufQueue frame_queue;
> +struct FFBufQueue used_frame_queue;
> 
> unsigned pkt_size;
> AudioFrameQueue afq;
> @@ -449,28 +452,30 @@ static OSStatus ffat_encode_callback(AudioConverterRef 
> converter, UInt32 *nb_pac
> {
> AVCodecContext *avctx = inctx;
> ATDecodeContext *at = avctx->priv_data;
> +AVFrame *frame;
> 
> -if (at->eof) {
> -*nb_packets = 0;
> -return 0;
> +if (!at->frame_queue.available) {
> +if (at->eof) {
> +*nb_packets = 0;
> +return 0;
> +} else {
> +*nb_packets = 0;
> +return 1;
> +}
> }
> 
> -av_frame_unref(>in_frame);
> -av_frame_move_ref(>in_frame, >new_in_frame);
> -
> -if (!at->in_frame.data[0]) {
> -*nb_packets = 0;
> -return 1;
> -}
> +frame = ff_bufqueue_get(>frame_queue);
> 
> data->mNumberBuffers  = 1;
> data->mBuffers[0].mNumberChannels = avctx->channels;
> -data->mBuffers[0].mDataByteSize   = at->in_frame.nb_samples *
> +data->mBuffers[0].mDataByteSize   = frame->nb_samples *
> 
> av_get_bytes_per_sample(avctx->sample_fmt) *
> avctx->channels;
> -data->mBuffers[0].mData   = at->in_frame.data[0];
> -if (*nb_packets > at->in_frame.nb_samples)
> -*nb_packets = at->in_frame.nb_samples;
> +data->mBuffers[0].mData   = frame->data[0];
> +if (*nb_packets > frame->nb_samples)
> +*nb_packets = frame->nb_samples;
> +
> +ff_bufqueue_add(avctx, >used_frame_queue, frame);
> 
> return 0;
> }
> @@ -492,20 +497,38 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket 
> *avpkt,
> };
> AudioStreamPacketDescription out_pkt_desc = {0};
> 
> -if ((ret = ff_alloc_packet2(avctx, avpkt, at->pkt_size, 0)) < 0)
> -return ret;
> -
> -av_frame_unref(>new_in_frame);
> -
> if (frame) {
> +AVFrame *in_frame;
> +
> +if (ff_bufqueue_is_full(>frame_queue)) {
> +/*
> + * The frame queue is significantly larger than needed in 
> practice,
> + * but no clear way to determine the minimum number of samples to
> + * get output from AudioConverterFillComplexBuffer().
> + */
> +av_log(avctx, AV_LOG_ERROR, "Bug: frame queue is too small.\n");
> +return AVERROR_BUG;
> +}
> +
> if ((ret = ff_af_queue_add(>afq, frame)) < 0)
> return ret;
> -if ((ret = av_frame_ref(>new_in_frame, frame)) < 0)
> +
> +in_frame = av_frame_alloc();
> +if (!in_frame)
> +return AVERROR(ENOMEM);
> +
> +if ((ret = av_frame_ref(in_frame, frame)) < 0)
> return ret;
> +
> +ff_bufqueue_add(avctx, >frame_queue, in_frame);
> } else {
> at->eof = 1;
> }
> 
> +if ((ret = ff_alloc_packet2(avctx, avpkt, at->pkt_size, 0)) < 0)
> +return ret;
> +
> +
> out_buffers.mBuffers[0].mData = avpkt->data;
> 
> *got_packet_ptr = avctx->frame_size / at->frame_size;
> @@ -513,6 +536,9 @@ static int ffat_encode(AVCodecContext *avctx, AVPacket 
> *avpkt,
> ret = AudioConverterFillComplexBuffer(at->converter, 
> ffat_encode_callback, avctx,
>   got_packet_ptr, _buffers,
>   (avctx->frame_size > 
> at->frame_size) ? NULL : _pkt_desc);
> +
> +ff_bufqueue_discard_all(>used_frame_queue);
> +
> if ((!ret || ret == 1) && *got_packet_ptr) {
> avpkt->size = out_buffers.mBuffers[0].mDataByteSize;
> ff_af_queue_remove(>afq, out_pkt_desc.mVariableFramesInPacket ?
> @@ -531,16 +557,16 @@ static av_cold void ffat_encode_flush(AVCodecContext 
> *avctx)
> {
> ATDecodeContext *at = avctx->priv_data;
> AudioConverterReset(at->converter);
> -av_frame_unref(>new_in_frame);
> -av_frame_unref(>in_frame);
> +ff_bufqueue_discard_all(>frame_queue);
> +

Re: [FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: set extradata when opening codec

2016-06-07 Thread Richard Kern
Apple confirmed there’s no way to get the parameter sets earlier through 
VideoToolbox. If no one reviews, I’ll push in about 24 h.

> On Jun 2, 2016, at 2:43 AM, Rick Kern  wrote:
> 
> VideoToolbox doesn't supply parameter sets until the first frame is done
> encoding. This spins up a temporary encoder and encodes a single frame to
> get this data.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/videotoolboxenc.c | 326 ---
> 1 file changed, 241 insertions(+), 85 deletions(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index f4f0d8e..895924a 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -96,6 +96,13 @@ typedef struct VTEncContext {
> bool warned_color_range;
> } VTEncContext;
> 
> +static int vtenc_populate_extradata(AVCodecContext   *avctx,
> +CMVideoCodecType codec_type,
> +CFStringRef  profile_level,
> +CFNumberRef  gamma_level,
> +CFDictionaryRef  enc_info,
> +CFDictionaryRef  pixel_buffer_info);
> +
> /**
>  * NULL-safe release of *refPtr, and sets value to NULL.
>  */
> @@ -388,7 +395,7 @@ static int set_extradata(AVCodecContext *avctx, 
> CMSampleBufferRef sample_buffer)
> return status;
> }
> 
> -avctx->extradata = av_malloc(total_size);
> +avctx->extradata = av_mallocz(total_size + AV_INPUT_BUFFER_PADDING_SIZE);
> if (!avctx->extradata) {
> return AVERROR(ENOMEM);
> }
> @@ -761,83 +768,28 @@ static int get_cv_ycbcr_matrix(AVCodecContext *avctx, 
> CFStringRef *matrix) {
> return 0;
> }
> 
> -
> -static av_cold int vtenc_init(AVCodecContext *avctx)
> +static int vtenc_create_encoder(AVCodecContext   *avctx,
> +CMVideoCodecType codec_type,
> +CFStringRef  profile_level,
> +CFNumberRef  gamma_level,
> +CFDictionaryRef  enc_info,
> +CFDictionaryRef  pixel_buffer_info,
> +VTCompressionSessionRef *session)
> {
> -CFMutableDictionaryRef enc_info;
> -CFMutableDictionaryRef pixel_buffer_info;
> -CMVideoCodecType   codec_type;
> -VTEncContext   *vtctx = avctx->priv_data;
> -CFStringRefprofile_level;
> -SInt32 bit_rate = avctx->bit_rate;
> -CFNumberRefbit_rate_num;
> -CFBooleanRef   has_b_frames_cfbool;
> -CFNumberRefgamma_level;
> -intstatus;
> -
> -codec_type = get_cm_codec_type(avctx->codec_id);
> -if (!codec_type) {
> -av_log(avctx, AV_LOG_ERROR, "Error: no mapping for AVCodecID %d\n", 
> avctx->codec_id);
> -return AVERROR(EINVAL);
> -}
> -
> -vtctx->has_b_frames = avctx->max_b_frames > 0;
> -if(vtctx->has_b_frames && vtctx->profile == H264_PROF_BASELINE){
> -av_log(avctx, AV_LOG_WARNING, "Cannot use B-frames with baseline 
> profile. Output will not contain B-frames.\n");
> -vtctx->has_b_frames = false;
> -}
> -
> -if (vtctx->entropy == VT_CABAC && vtctx->profile == H264_PROF_BASELINE) {
> -av_log(avctx, AV_LOG_WARNING, "CABAC entropy requires 'main' or 
> 'high' profile, but baseline was requested. Encode will not use CABAC 
> entropy.\n");
> -vtctx->entropy = VT_ENTROPY_NOT_SET;
> -}
> -
> -if (!get_vt_profile_level(avctx, _level)) return AVERROR(EINVAL);
> -
> -vtctx->session = NULL;
> -
> -enc_info = CFDictionaryCreateMutable(
> -kCFAllocatorDefault,
> -20,
> -,
> -
> -);
> -
> -if (!enc_info) return AVERROR(ENOMEM);
> -
> -#if !TARGET_OS_IPHONE
> -if (!vtctx->allow_sw) {
> -CFDictionarySetValue(enc_info, 
> kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder, 
> kCFBooleanTrue);
> -} else {
> -CFDictionarySetValue(enc_info, 
> kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,  
> kCFBooleanTrue);
> -}
> -#endif
> -
> -if (avctx->pix_fmt != AV_PIX_FMT_VIDEOTOOLBOX) {
> -status = create_cv_pixel_buffer_info(avctx, _buffer_info);
> -if (status) {
> -CFRelease(enc_info);
> -return status;
> -}
> -} else {
> -pixel_buffer_info = NULL;
> -}
> -
> -status = VTCompressionSessionCreate(
> -kCFAllocatorDefault,
> -avctx->width,
> -avctx->height,
> -codec_type,
> -enc_info,
> -pixel_buffer_info,
> -kCFAllocatorDefault,
> -vtenc_output_callback,
> -avctx,
> ->session
> -);
> -
> -if (pixel_buffer_info) CFRelease(pixel_buffer_info);
> -

Re: [FFmpeg-devel] [PATCH] lavc/videotoolbox: fix H.264 hwaccel init issue

2016-06-06 Thread Richard Kern
Ping. This fixes #5595. 

> On Jun 1, 2016, at 10:06 PM, Rick Kern  wrote:
> 
> Fixes VTDecompressionSessionCreate() error.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/videotoolbox.c | 59 ---
> 1 file changed, 45 insertions(+), 14 deletions(-)
> 
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 2f4d531..cadfb23 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -487,23 +487,53 @@ static CFDictionaryRef 
> videotoolbox_buffer_attributes_create(int width,
> return buffer_attributes;
> }
> 
> -static CMVideoFormatDescriptionRef 
> videotoolbox_format_desc_create(CMVideoCodecType codec_type,
> +static CMVideoFormatDescriptionRef 
> videotoolbox_format_desc_create(AVCodecContext *avctx,
> +   
> CMVideoCodecType codec_type,
>
> CFDictionaryRef decoder_spec,
>int width,
>int height)
> {
> -CMFormatDescriptionRef cm_fmt_desc;
> -OSStatus status;
> -
> -status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
> -codec_type,
> -width,
> -height,
> -decoder_spec, // Dictionary of 
> extension
> -_fmt_desc);
> -
> -if (status)
> -return NULL;
> +CMFormatDescriptionRef cm_fmt_desc = NULL;
> +int status;
> +H264Context *h = codec_type == kCMVideoCodecType_H264 ? avctx->priv_data 
> : NULL;
> +
> +if (h && h->sps.data_size && h->pps.data_size) {
> +int ps_count = 2;
> +const uint8_t **ps_data = av_malloc(sizeof(uint8_t*) * ps_count);
> +size_t *ps_sizes = av_malloc(sizeof(size_t)  * ps_count);
> +
> +ps_data[0]  = h->sps.data;
> +ps_sizes[0] = h->sps.data_size;
> +
> +ps_data[1]  = h->pps.data;
> +ps_sizes[1] = h->pps.data_size;
> +
> +status = CMVideoFormatDescriptionCreateFromH264ParameterSets(NULL,
> + 
> ps_count,
> + ps_data,
> + 
> ps_sizes,
> + 4,
> + 
> _fmt_desc);
> +av_freep(_sizes);
> +av_freep(_data);
> +
> +if (status) {
> +av_log(avctx, AV_LOG_ERROR, "Error creating H.264 format 
> description: %d\n", status);
> +return NULL;
> +}
> +} else {
> +status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
> +codec_type,
> +width,
> +height,
> +decoder_spec, // Dictionary 
> of extension
> +_fmt_desc);
> +
> +if (status) {
> +av_log(avctx, AV_LOG_ERROR, "Error creating format description: 
> %d\n", status);
> +return NULL;
> +}
> +}
> 
> return cm_fmt_desc;
> }
> @@ -543,7 +573,8 @@ static int videotoolbox_default_init(AVCodecContext 
> *avctx)
> 
> decoder_spec = 
> videotoolbox_decoder_config_create(videotoolbox->cm_codec_type, avctx);
> 
> -videotoolbox->cm_fmt_desc = 
> videotoolbox_format_desc_create(videotoolbox->cm_codec_type,
> +videotoolbox->cm_fmt_desc = videotoolbox_format_desc_create(avctx,
> +
> videotoolbox->cm_codec_type,
> decoder_spec,
> avctx->width,
> 
> avctx->height);
> -- 
> 2.7.4
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 01/12] lavc/videotoolboxenc: Use shared pixel buffer pool

2016-04-26 Thread Richard Kern

> On Apr 26, 2016, at 8:14 AM, Carl Eugen Hoyos <ceho...@ag.or.at> wrote:
> 
> Richard Kern  gmail.com> writes:
> 
>>>> static const enum AVPixelFormat pix_fmts[] = {
>>>>AV_PIX_FMT_NV12,
>>>> -#if !TARGET_OS_IPHONE
>>>>AV_PIX_FMT_YUV420P,
>>>> -#endif
>>>>AV_PIX_FMT_NONE
>>> 
>>> Sorry: How is this related?
>> Using a shared pixel buffer pool also sets up an internal 
>> color converter when needed.
> 
> And is this generally wanted?
> (I assume so.)
The pool? Probably. Using it reduces memcpy calls in the media server process.

I dug into this a little - yuv420p is supported natively (at least on some 
devices), so it shouldn’t have been excluded in the first place.

> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 01/12] lavc/videotoolboxenc: Use shared pixel buffer pool

2016-04-25 Thread Richard Kern

> On Apr 23, 2016, at 12:23 PM, Carl Eugen Hoyos  wrote:
> 
> Rick Kern  gmail.com> writes:
> 
>> +if(!*refPtr) return;
> 
> Is this needed (I don't know)?
> If yes, please make it two lines.
> 
>> +CFRelease(*refPtr);
>> +*refPtr = NULL;
>> +switch (fmt) {
>> +case AV_PIX_FMT_NV12:
>> +switch (range) {
>> +case AVCOL_RANGE_MPEG:
>> +*av_pixel_format = 
>> kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
>> +break;
>> +
>> +case AVCOL_RANGE_JPEG:
>> +*av_pixel_format = 
>> kCVPixelFormatType_420YpCbCr8BiPlanarFullRange;
>> +break;
>> +
>> +default:
>> +if (range_guessed) *range_guessed = 1;
>> +*av_pixel_format = 
>> kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
> 
> You can rearrange this to make the patch smaller (and 
> the default case easier to read).
> Same below.
> 
>> static const enum AVPixelFormat pix_fmts[] = {
>> AV_PIX_FMT_NV12,
>> -#if !TARGET_OS_IPHONE
>> AV_PIX_FMT_YUV420P,
>> -#endif
>> AV_PIX_FMT_NONE
> 
> Sorry: How is this related?
Using a shared pixel buffer pool also sets up an internal color converter when 
needed.

> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 03/12] lavc/videotoolboxenc: Require hardware encoding

2016-04-25 Thread Richard Kern

> On Apr 23, 2016, at 12:25 PM, Carl Eugen Hoyos  wrote:
> 
> Rick Kern  gmail.com> writes:
> 
>> +#if !TARGET_OS_IPHONE
>> +{ "allow_sw", "Allow software encoding", OFFSET(allow_sw), 
> 
> I have no strong opinion, but shouldn't the option 
> always exist (but only work in some cases)?
iOS doesn’t support software encoding, and the dictionary keys to allow it 
aren’t part of the headers.

> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 13/13] lavc/videotoolboxenc: Set colorimetry values

2016-04-22 Thread Richard Kern

> On Apr 10, 2016, at 12:27 AM, Carl Eugen Hoyos  wrote:
> 
> Rick Kern  gmail.com> writes:
> 
>> +enabled kCVImageBufferColorPrimaries_ITU_R_2020 && 
>> add_cppflags -DHAVE_VT_BT2020_KEYS
> 
> This is not ok, the define should be added to config.h.
> 
>> +#ifndef HAVE_VT_BT2020_KEYS
>> +# define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
>> +# define kCVImageBufferTransferFunction_ITU_R_2020 CFSTR("ITU_R_2020")
>> +# define kCVImageBufferYCbCrMatrix_ITU_R_2020  CFSTR("ITU_R_2020")
>> +#endif
> 
> Is this safer than #ifndef kCVImageBufferYCbCrMatrix_ITU_R_2020?
These aren’t macros in the system header file.

> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 12/13] lavc/videotoolboxenc: Support pixel aspect ratio

2016-04-22 Thread Richard Kern

> On Apr 10, 2016, at 12:24 AM, Carl Eugen Hoyos  wrote:
> 
> Rick Kern  gmail.com> writes:
> 
>> +if (status) {
>> +av_log(
>> +   avctx,
>> +   AV_LOG_ERROR,
>> +   "Error setting pixel aspect ratio to %d:%d: %d.\n",
> 
> Why would the function call fail?
> 
> I would expect that the pixel aspect ratio has max 
> values, if yes, you first have to av_reduce the sar.
Some encoders enforce specific pixel aspect ratios. The vt docs don’t mention a 
max value, but I’ll call av_reduce.

> 
>> +   avctx->sample_aspect_ratio.num,
>> +   avctx->sample_aspect_ratio.den,
>> +   status);
>> +
>> +return AVERROR_EXTERNAL;
> 
> In any case, printing the error should be enough imo.
> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 03/13] lavc/videotoolboxenc: Remove redundant code

2016-04-10 Thread Richard Kern

> On Apr 10, 2016, at 3:47 AM, Hendrik Leppkes  wrote:
> 
> On Sun, Apr 10, 2016 at 6:17 AM, Carl Eugen Hoyos  wrote:
>> Rick Kern  gmail.com> writes:
>> 
>>> Don't require hardware encoding and explicitly fallback to
>>> software if it fails. Enabling it without requiring it
>>> will use hardware encoding if available.
>> 
>> Hardware encoding should be required unless the user
>> specifies something else.
>> 
> 
> I agree, the goal of VT should be hardware encoding primarily.
This commit message could have been worded better. It already falls back to 
software - this is just cleaner. The user has to explicitly request this 
encoder, so it shouldn’t fail if it’s capable of encoding.

Another goal is to encode video without embedding the encoder in the user's 
application, so it doesn’t matter if it’s hardware accelerated. I’m not 
familiar with patent laws, so I can’t really speak to why this is important.

Beyond that, a few other VT codecs have been requested, but none of these are 
hardware accelerated.

In any case, I'll add a require-hw option, but I think the default should fall 
back to software.

> 
> - Hendrik
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2] lavc/videotoolboxenc: Workaround encoder error

2016-04-01 Thread Richard Kern

> On Mar 24, 2016, at 1:56 PM, Rick Kern  wrote:
> 
> CMVideoFormatDescriptionGetH264ParameterSetAtIndex() fails on some 
> hardware/OS versions when retrieving the parameter set count alone.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/videotoolboxenc.c | 43 ---
> 1 file changed, 32 insertions(+), 11 deletions(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 0791146..3177074 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -194,6 +194,7 @@ static int get_params_size(
> {
> size_t total_size = 0;
> size_t ps_count;
> +int is_count_bad = 0;
> size_t i;
> int status;
> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
> @@ -203,11 +204,12 @@ static int get_params_size(
> _count,
> NULL);
> if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count: 
> %d\n", status);
> -return AVERROR_EXTERNAL;
> +is_count_bad = 1;
> +ps_count = 0;
> +status   = 0;
> }
> 
> -for(i = 0; i < ps_count; i++){
> +for (i = 0; i < ps_count || is_count_bad; i++) {
> const uint8_t *ps;
> size_t ps_size;
> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
> @@ -216,14 +218,24 @@ static int get_params_size(
> _size,
> NULL,
> NULL);
> -if(status){
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set size 
> for index %zd: %d\n", i, status);
> -return AVERROR_EXTERNAL;
> +if (status) {
> +/*
> + * When ps_count is invalid, status != 0 ends the loop normally
> + * unless we didn't get any parameter sets.
> + */
> +if (i > 0 && is_count_bad) status = 0;
> +
> +break;
> }
> 
> total_size += ps_size + sizeof(start_code);
> }
> 
> +if (status) {
> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set sizes: 
> %d\n", status);
> +return AVERROR_EXTERNAL;
> +}
> +
> *size = total_size;
> return 0;
> }
> @@ -235,6 +247,7 @@ static int copy_param_sets(
> size_t  dst_size)
> {
> size_t ps_count;
> +int is_count_bad = 0;
> int status;
> size_t offset = 0;
> size_t i;
> @@ -246,11 +259,13 @@ static int copy_param_sets(
> _count,
> NULL);
> if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count for 
> copying: %d\n", status);
> -return AVERROR_EXTERNAL;
> +is_count_bad = 1;
> +ps_count = 0;
> +status   = 0;
> }
> 
> -for (i = 0; i < ps_count; i++) {
> +
> +for (i = 0; i < ps_count || is_count_bad; i++) {
> const uint8_t *ps;
> size_t ps_size;
> size_t next_offset;
> @@ -262,8 +277,9 @@ static int copy_param_sets(
> NULL,
> NULL);
> if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data 
> for index %zd: %d\n", i, status);
> -return AVERROR_EXTERNAL;
> +if (i > 0 && is_count_bad) status = 0;
> +
> +break;
> }
> 
> next_offset = offset + sizeof(start_code) + ps_size;
> @@ -279,6 +295,11 @@ static int copy_param_sets(
> offset = next_offset;
> }
> 
> +if (status) {
> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data: 
> %d\n", status);
> +return AVERROR_EXTERNAL;
> +}
> +
> return 0;
> }
> 
> -- 
> 2.7.4
> 
Ping - does anyone else want to review? The logic is clearer and the commit 
message is better.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix crash when closing codec after error

2016-04-01 Thread Richard Kern

> On Mar 24, 2016, at 12:46 PM, Richard Kern <ker...@gmail.com> wrote:
> 
>> 
>> On Mar 25, 2016, at 12:37 AM, wm4 <nfx...@googlemail.com> wrote:
>> 
>> On Mon, 21 Mar 2016 00:55:56 +0800
>> Rick Kern <ker...@gmail.com> wrote:
>> 
>>> Fixes crash in #5352. VTCompressionSessionInvalidate() crashes if the 
>>> internal encoder hasn't completed, but hasn't experienced an error. The 
>>> function call isn't needed since the encoder is invalidated when the 
>>> reference count reaches 0 anyway.
>>> 
>>> Signed-off-by: Rick Kern <ker...@gmail.com>
>>> ---
>>> libavcodec/videotoolboxenc.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>> 
>>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>>> index 3ed1f64..0791146 100644
>>> --- a/libavcodec/videotoolboxenc.c
>>> +++ b/libavcodec/videotoolboxenc.c
>>> @@ -1275,7 +1275,6 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
>>> 
>>>if(!vtctx->session) return 0;
>>> 
>>> -VTCompressionSessionInvalidate(vtctx->session);
>>>pthread_cond_destroy(>cv_sample_sent);
>>>pthread_mutex_destroy(>lock);
>>>CFRelease(vtctx->session);
>> 
>> Seems fine. So if we don't need it, what is
>> VTCompressionSessionInvalidate intended for in general?
> It could be used to tear down the encoder without the session being 
> deallocated.
Can this be pushed?

> 
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 
>> <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Workaround encoder error

2016-03-24 Thread Richard Kern

> On Mar 25, 2016, at 12:45 AM, wm4  wrote:
> 
> On Mon, 21 Mar 2016 19:55:24 +0800
> Rick Kern > wrote:
> 
>> Fixes bug #5352: Error when fetching parameter sets.
>> 
>> Signed-off-by: Rick Kern >
> 
> Could use some more explanations. A referenced issue is IMHO not
> enough, and the issue tracker might disappear/be reset/be replaced in
> the future too.
> 
>> ---
>> libavcodec/videotoolboxenc.c | 38 --
>> 1 file changed, 24 insertions(+), 14 deletions(-)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index 0791146..a9fa96b 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -194,6 +194,7 @@ static int get_params_size(
>> {
>> size_t total_size = 0;
>> size_t ps_count;
>> +int is_count_bad = 0;
>> size_t i;
>> int status;
>> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
>> @@ -203,27 +204,31 @@ static int get_params_size(
>> _count,
>> NULL);
>> if (status) {
>> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count: 
>> %d\n", status);
>> -return AVERROR_EXTERNAL;
>> +is_count_bad = 1;
>> +ps_count = 0;
>> +status   = 0;
>> }
>> 
>> -for(i = 0; i < ps_count; i++){
>> +for (i = 0; (is_count_bad && !status) || i < ps_count; i++) {
>> const uint8_t *ps;
>> size_t ps_size;
>> +
>> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
>> i,
>> ,
>> _size,
>> NULL,
>> NULL);
>> -if(status){
>> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set size 
>> for index %zd: %d\n", i, status);
>> -return AVERROR_EXTERNAL;
>> -}
>> +if (status) break;
>> 
>> total_size += ps_size + sizeof(start_code);
>> }
>> 
>> +if (status && (!i || !is_count_bad)) {
> 
> Using the loop variable here seems unnecessarily subtle. (Same in
> copy_params_set below.) Why does it even check for i==0, isn't that a
> valid index just like i!=0?
When getting ps_count fails, it depends on getting a failure from 
CMVideoFormatDescriptionGetH264ParameterSetAtIndex() to stop looping. It fails 
on i == 0 because it didn’t get anything. I’ll make that clearer.

> 
>> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set sizes: 
>> %d\n", status);
>> +return AVERROR_EXTERNAL;
>> +}
>> +
>> *size = total_size;
>> return 0;
>> }
>> @@ -235,6 +240,7 @@ static int copy_param_sets(
>> size_t  dst_size)
>> {
>> size_t ps_count;
>> +int is_count_bad = 0;
>> int status;
>> size_t offset = 0;
>> size_t i;
>> @@ -246,11 +252,13 @@ static int copy_param_sets(
>> _count,
>> NULL);
>> if (status) {
>> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count for 
>> copying: %d\n", status);
>> -return AVERROR_EXTERNAL;
>> +is_count_bad = 1;
>> +ps_count = 0;
>> +status   = 0;
>> }
>> 
>> -for (i = 0; i < ps_count; i++) {
>> +
>> +for (i = 0; (is_count_bad && !status) || i < ps_count; i++) {
>> const uint8_t *ps;
>> size_t ps_size;
>> size_t next_offset;
>> @@ -261,10 +269,7 @@ static int copy_param_sets(
>> _size,
>> NULL,
>> NULL);
>> -if (status) {
>> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data 
>> for index %zd: %d\n", i, status);
>> -return AVERROR_EXTERNAL;
>> -}
>> +if (status) break;
>> 
>> next_offset = offset + sizeof(start_code) + ps_size;
>> if (dst_size < next_offset) {
>> @@ -279,6 +284,11 @@ static int copy_param_sets(
>> offset = next_offset;
>> }
>> 
>> +if (status && (!i || !is_count_bad)) {
>> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data: 
>> %d\n", status);
>> +return AVERROR_EXTERNAL;
>> +}
>> +
>> return 0;
>> }
>> 
> 
> ___
> ffmpeg-devel mailing list
> 

Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix crash when closing codec after error

2016-03-24 Thread Richard Kern

> On Mar 25, 2016, at 12:37 AM, wm4  wrote:
> 
> On Mon, 21 Mar 2016 00:55:56 +0800
> Rick Kern  wrote:
> 
>> Fixes crash in #5352. VTCompressionSessionInvalidate() crashes if the 
>> internal encoder hasn't completed, but hasn't experienced an error. The 
>> function call isn't needed since the encoder is invalidated when the 
>> reference count reaches 0 anyway.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> libavcodec/videotoolboxenc.c | 1 -
>> 1 file changed, 1 deletion(-)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index 3ed1f64..0791146 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -1275,7 +1275,6 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
>> 
>> if(!vtctx->session) return 0;
>> 
>> -VTCompressionSessionInvalidate(vtctx->session);
>> pthread_cond_destroy(>cv_sample_sent);
>> pthread_mutex_destroy(>lock);
>> CFRelease(vtctx->session);
> 
> Seems fine. So if we don't need it, what is
> VTCompressionSessionInvalidate intended for in general?
It could be used to tear down the encoder without the session being deallocated.

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Fix crash when closing codec after error

2016-03-24 Thread Richard Kern
Can this one be reviewed too?

> On Mar 21, 2016, at 12:55 AM, Rick Kern  wrote:
> 
> Fixes crash in #5352. VTCompressionSessionInvalidate() crashes if the 
> internal encoder hasn't completed, but hasn't experienced an error. The 
> function call isn't needed since the encoder is invalidated when the 
> reference count reaches 0 anyway.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/videotoolboxenc.c | 1 -
> 1 file changed, 1 deletion(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 3ed1f64..0791146 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -1275,7 +1275,6 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
> 
> if(!vtctx->session) return 0;
> 
> -VTCompressionSessionInvalidate(vtctx->session);
> pthread_cond_destroy(>cv_sample_sent);
> pthread_mutex_destroy(>lock);
> CFRelease(vtctx->session);
> -- 
> 2.5.4 (Apple Git-61)
> 

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: Workaround encoder error

2016-03-24 Thread Richard Kern
Ping - can this be reviewed?

> On Mar 21, 2016, at 7:55 PM, Rick Kern  wrote:
> 
> Fixes bug #5352: Error when fetching parameter sets.
> 
> Signed-off-by: Rick Kern 
> ---
> libavcodec/videotoolboxenc.c | 38 --
> 1 file changed, 24 insertions(+), 14 deletions(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index 0791146..a9fa96b 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -194,6 +194,7 @@ static int get_params_size(
> {
> size_t total_size = 0;
> size_t ps_count;
> +int is_count_bad = 0;
> size_t i;
> int status;
> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
> @@ -203,27 +204,31 @@ static int get_params_size(
> _count,
> NULL);
> if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count: 
> %d\n", status);
> -return AVERROR_EXTERNAL;
> +is_count_bad = 1;
> +ps_count = 0;
> +status   = 0;
> }
> 
> -for(i = 0; i < ps_count; i++){
> +for (i = 0; (is_count_bad && !status) || i < ps_count; i++) {
> const uint8_t *ps;
> size_t ps_size;
> +
> status = CMVideoFormatDescriptionGetH264ParameterSetAtIndex(vid_fmt,
> i,
> ,
> _size,
> NULL,
> NULL);
> -if(status){
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set size 
> for index %zd: %d\n", i, status);
> -return AVERROR_EXTERNAL;
> -}
> +if (status) break;
> 
> total_size += ps_size + sizeof(start_code);
> }
> 
> +if (status && (!i || !is_count_bad)) {
> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set sizes: 
> %d\n", status);
> +return AVERROR_EXTERNAL;
> +}
> +
> *size = total_size;
> return 0;
> }
> @@ -235,6 +240,7 @@ static int copy_param_sets(
> size_t  dst_size)
> {
> size_t ps_count;
> +int is_count_bad = 0;
> int status;
> size_t offset = 0;
> size_t i;
> @@ -246,11 +252,13 @@ static int copy_param_sets(
> _count,
> NULL);
> if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set count for 
> copying: %d\n", status);
> -return AVERROR_EXTERNAL;
> +is_count_bad = 1;
> +ps_count = 0;
> +status   = 0;
> }
> 
> -for (i = 0; i < ps_count; i++) {
> +
> +for (i = 0; (is_count_bad && !status) || i < ps_count; i++) {
> const uint8_t *ps;
> size_t ps_size;
> size_t next_offset;
> @@ -261,10 +269,7 @@ static int copy_param_sets(
> _size,
> NULL,
> NULL);
> -if (status) {
> -av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data 
> for index %zd: %d\n", i, status);
> -return AVERROR_EXTERNAL;
> -}
> +if (status) break;
> 
> next_offset = offset + sizeof(start_code) + ps_size;
> if (dst_size < next_offset) {
> @@ -279,6 +284,11 @@ static int copy_param_sets(
> offset = next_offset;
> }
> 
> +if (status && (!i || !is_count_bad)) {
> +av_log(avctx, AV_LOG_ERROR, "Error getting parameter set data: 
> %d\n", status);
> +return AVERROR_EXTERNAL;
> +}
> +
> return 0;
> }
> 
> -- 
> 2.5.4 (Apple Git-61)
> 

___
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.

2016-03-20 Thread Richard Kern

> On Mar 20, 2016, at 11:49 PM, 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
> <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/videotoolboxenc: remove *_NULLABLE annotations; fixes pre-10.11 build

2016-03-02 Thread Richard Kern

> On Mar 3, 2016, at 11:46 AM, Rodger Combs  wrote:
> 
> These macros were added in OS X 10.11, and the file compiles without warnings
> on both 10.10 and 10.11 with them removed.
> 
> Thanks to mark4o on IRC for pointing out the failure and testing the patch.
Lgtm - thanks for the quick fix.

> ---
> libavcodec/videotoolboxenc.c | 14 +++---
> 1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index bbecb24..3ed1f64 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -317,11 +317,11 @@ static int set_extradata(AVCodecContext *avctx, 
> CMSampleBufferRef sample_buffer)
> }
> 
> static void vtenc_output_callback(
> -void *CM_NULLABLE ctx,
> +void *ctx,
> void *sourceFrameCtx,
> OSStatus status,
> VTEncodeInfoFlags flags,
> -CM_NULLABLE CMSampleBufferRef sample_buffer)
> +CMSampleBufferRef sample_buffer)
> {
> AVCodecContext *avctx = ctx;
> VTEncContext   *vtctx = avctx->priv_data;
> @@ -975,11 +975,11 @@ static int get_cv_pixel_info(
> #if !TARGET_OS_IPHONE
> //Not used on iOS - frame is always copied.
> static void free_avframe(
> -void   *CV_NULLABLE release_ctx,
> -const void *CV_NULLABLE data,
> -size_t  size,
> -size_t  plane_count,
> -const void *CV_NULLABLE plane_addresses[])
> +void   *release_ctx,
> +const void *data,
> +size_t  size,
> +size_t  plane_count,
> +const void *plane_addresses[])
> {
> AVFrame *frame = release_ctx;
> av_frame_free();
> -- 
> 2.7.2
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v9] VideoToolbox H.264 Encoder

2016-03-02 Thread Richard Kern

> On Mar 2, 2016, at 12:11 AM, wm4  wrote:
> 
> On Tue, 01 Mar 2016 14:57:29 +
> Timothy Gu > wrote:
> 
>> Hi,
>> 
>> On Mon, Feb 29, 2016 at 9:42 PM Rick Kern  wrote:
>> 
>>> Autodetected by default. Encode using -codec:v vtenc.
>>> 
>>> Signed-off-by: Rick Kern 
>>> ---
>>> MAINTAINERS|1 +
>>> configure  |   19 +
>>> libavcodec/Makefile|1 +
>>> libavcodec/allcodecs.c |1 +
>>> libavcodec/vtenc.c | 1339
>>> 
>>> 5 files changed, 1361 insertions(+)
>>> create mode 100644 libavcodec/vtenc.c
>>> 
>> 
>> We already have videotoolbox AVHWAccel. Maybe it would be better to change
>> the name of the file to videotoolboxenc.c so that it's easier to associate
>> these two files?
> 
> I don't mind. They're pretty different after all.
Sounds good. I’ll rename it.

> 
>> 
>>> +AVCodec ff_vtenc_encoder = {  
>> 
>>> +.name = "vtenc",
>>> +.long_name= NULL_IF_CONFIG_SMALL("VideoToolbox H.264
>>> Encoder"),
>>> 
>> 
>> The norm seems to be using "h264_videotoolbox" (like "h264_qsv") so that
>> potential future extensions to VideoToolbox can be supported without
>> changing the name of the codec.
>> 
> 
> Good point.
Ok. I’d also like to make configure —enable-videotoolbox apply to the 
VideoToolbox external library, not just the hwaccel. The VideoToolbox hwaccel 
build code will have to be updated to depend on the external library, but then 
disabling VideoToolbox-related code requires one parameter. The names of the 
hwaccels would stay the same, so I don’t see any backwards compatibility issues.

> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org 
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel 
> 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Richard Kern
Please ignore this patch - the options code need to be updated.

> On Feb 29, 2016, at 11:58 PM, wm4  wrote:
> 
> On Mon, 29 Feb 2016 23:14:17 +0800
> Rick Kern  wrote:
> 
>> Autodetected by default. Encode using -codec:v vtenc.
>> 
>> Signed-off-by: Rick Kern 
>> ---
> 
> OK, autodetection seems to work properly on non-OSX too. I'll apply in
> 18 hours or so.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v7] VideoToolbox H.264 Encoder

2016-02-29 Thread Richard Kern

> On Feb 29, 2016, at 11:19 PM, Clément Bœsch  wrote:
> 
> On Mon, Feb 29, 2016 at 11:14:17PM +0800, Rick Kern wrote:
> [...]
>> +if (!profile) {
>> +//VideoToolbox auto-selects profile and level.
>> +return true;
>> +} else if (!av_strcasecmp("baseline", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_AutoLevel;
>> +else if (!strcmp("1.3",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_1_3;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Baseline_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else if (!av_strcasecmp("main", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_AutoLevel;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_Main_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else if (!av_strcasecmp("high", profile)) {
>> +if  (!strcmp("auto", level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_AutoLevel;
>> +else if (!strcmp("3.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_0;
>> +else if (!strcmp("3.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_1;
>> +else if (!strcmp("3.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_3_2;
>> +else if (!strcmp("4.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_0;
>> +else if (!strcmp("4.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_1;
>> +else if (!strcmp("4.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_4_2;
>> +else if (!strcmp("5.0",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_0;
>> +else if (!strcmp("5.1",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_1;
>> +else if (!strcmp("5.2",  level)) *profile_level_val = 
>> kVTProfileLevel_H264_High_5_2;
>> +else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized level %s\n", 
>> vtctx->level);
>> +return false;
>> +}
>> +} else {
>> +av_log(avctx, AV_LOG_ERROR, "Unrecognized profile %s\n", 
>> vtctx->profile);
>> +return false;
>> +}
> 
> Can't you use AV_OPT_TYPE_CONST for those?
No, doesn’t look like it. The VideoToolbox constants aren’t 1-to-1 with the 
command line options.

> 
> [...]
> 
> -- 
> Clément B.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v5] Added VideoToolbox H.264 encoder.

2016-02-17 Thread Richard Kern

> On Feb 16, 2016, at 5:28 PM, wm4  wrote:
> 
> On Tue, 16 Feb 2016 09:58:30 +0800
> Rick Kern > wrote:
> 
>> Enable with configure --enable-vtenc and encode using -codec:v vtenc_h264.
>> 
>> Signed-off-by: Rick Kern 
>> ---
>> MAINTAINERS|1 +
>> configure  |3 +
>> libavcodec/Makefile|1 +
>> libavcodec/allcodecs.c |1 +
>> libavcodec/vtenc.c | 1269 
>> 
>> 5 files changed, 1275 insertions(+)
>> create mode 100644 libavcodec/vtenc.c
>> 
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 0705a69..a6a5fcf 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -289,6 +289,7 @@ Codecs:
>>   vp8   David Conrad, Jason Garrett-Glaser, 
>> Ronald Bultje
>>   vp9   Ronald Bultje, Clément Bœsch
>>   vqavideo.cMike Melanson
>> +  vtenc.c   Rick Kern
>>   wavpack.c Kostya Shishkov
>>   wmaprodec.c   Sascha Sommer
>>   wmavoice.cRonald S. Bultje
>> diff --git a/configure b/configure
>> index 2148f11..ab0958b 100755
>> --- a/configure
>> +++ b/configure
>> @@ -287,6 +287,7 @@ External library support:
>>   --disable-sdldisable sdl [autodetect]
>>   --disable-securetransport disable Secure Transport, needed for TLS support
>>on OSX if openssl and gnutls are not used 
>> [autodetect]
>> +  --enable-vtenc   enable VideoToolbox encoder [no]
>>   --enable-x11grab enable X11 grabbing (legacy) [no]
>>   --disable-xlib   disable xlib [autodetect]
>>   --disable-zlib   disable zlib [autodetect]
>> @@ -1505,6 +1506,7 @@ EXTERNAL_LIBRARY_LIST="
>> schannel
>> sdl
>> securetransport
>> +vtenc
>> x11grab
>> xlib
>> zlib
>> @@ -5605,6 +5607,7 @@ enabled openssl   && { use_pkg_config openssl 
>> openssl/ssl.h SSL_library_
>>check_lib openssl/ssl.h SSL_library_init 
>> -lssl -lcrypto -lws2_32 -lgdi32 ||
>>die "ERROR: openssl not found"; }
>> enabled qtkit_indev  && { check_header_objcc QTKit/QTKit.h || disable 
>> qtkit_indev; }
>> +enabled vtenc && require VideoToolbox 
>> VideoToolbox/VTCompressionSession.h 
>> VTCompressionSessionPrepareToEncodeFrames -framework VideoToolbox
>> 
>> # libdc1394 check
>> if enabled libdc1394; then
>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
>> index f6a4fbb..409fa62 100644
>> --- a/libavcodec/Makefile
>> +++ b/libavcodec/Makefile
>> @@ -119,6 +119,7 @@ OBJS-$(CONFIG_TEXTUREDSP)  += texturedsp.o
>> OBJS-$(CONFIG_TEXTUREDSPENC)   += texturedspenc.o
>> OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
>> OBJS-$(CONFIG_VIDEODSP)+= videodsp.o
>> +OBJS-$(CONFIG_VTENC)   += vtenc.o
>> OBJS-$(CONFIG_VP3DSP)  += vp3dsp.o
>> OBJS-$(CONFIG_VP56DSP) += vp56dsp.o
>> OBJS-$(CONFIG_VP8DSP)  += vp8dsp.o
>> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
>> index 2097db0..91a0284 100644
>> --- a/libavcodec/allcodecs.c
>> +++ b/libavcodec/allcodecs.c
>> @@ -610,6 +610,7 @@ void avcodec_register_all(void)
>> REGISTER_ENCODER(HEVC_QSV,  hevc_qsv);
>> REGISTER_ENCODER(LIBKVAZAAR,libkvazaar);
>> REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
>> +REGISTER_ENCODER(VTENC_H264,vtenc_h264);
>> 
>> /* parsers */
>> REGISTER_PARSER(AAC,aac);
>> diff --git a/libavcodec/vtenc.c b/libavcodec/vtenc.c
>> new file mode 100644
>> index 000..6f35930
>> --- /dev/null
>> +++ b/libavcodec/vtenc.c
>> @@ -0,0 +1,1269 @@
>> +/*
>> + * copyright (c) 2015 Rick Kern 
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
>> USA
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include "avcodec.h"
>> +#include "libavutil/opt.h"
>> +#include "libavutil/avassert.h"
>> +#include 

Re: [FFmpeg-devel] [PATCH v5] Added VideoToolbox H.264 encoder.

2016-02-17 Thread Richard Kern

> On Feb 16, 2016, at 5:18 PM, Carl Eugen Hoyos  wrote:
> 
> wm4  googlemail.com> writes:
> 
>> On Tue, 16 Feb 2016 08:32:40 + (UTC)
>> Carl Eugen Hoyos  ag.or.at> wrote:
>> 
>>> Rick Kern  gmail.com> writes:
>>> 
 +enabled vtenc && 
 require VideoToolbox VideoToolbox/VTCompressionSession.h 
> 
> I cut away the relevant part here, sorry:
> VTCompressionSessionPrepareToEncodeFrames
> 
>>> On which osx systems is this header not available?
>> 
>> The same where videotoolbox decoding is not available, maybe.
> 
> Above is supported since 10.9 which in turn is 
> supported on hardware that was sold from 2009 on.
> I believe it should be autodetected to avoid bitrot.
Ok, I’ll update the patch to autodetect it.
.
> 
> Carl Eugen
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Pull request for VideoToolbox Encoder

2016-02-15 Thread Richard Kern
VideoToolbox Encoder for OSX/iOS: https://github.com/FFmpeg/FFmpeg/pull/177

I submitted a patch a while ago and had it reviewed, but it was never pushed.

Rick

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v4] Added VideoToolbox H.264 encoder.

2015-12-12 Thread Richard Kern
On Nov 28, 2015, at 5:23 PM, Richard Kern <ker...@gmail.com> wrote:
> 
> On Nov 28, 2015, at 5:07 PM, Timothy Gu <timothyg...@gmail.com> wrote:
>> 
>> On Sat, Nov 28, 2015 at 02:06:07PM -0500, Rick Kern wrote:
>>> vtenc.c was updated to match the coding style of the project.
>>> 
>>> I used several other files to get a feel for the project's coding
>>> style. Is there documentation for this?
>> 
>> Yes: https://ffmpeg.org/developer.html#Coding-Rules-1
>> 
>> Timothy
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> Got it - I didn’t realize ‘indent’ was a source code formatter.

Ping - can this be pushed, or does anyone else want to review?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v4] Added VideoToolbox H.264 encoder.

2015-11-28 Thread Richard Kern
On Nov 28, 2015, at 5:07 PM, Timothy Gu  wrote:
> 
> On Sat, Nov 28, 2015 at 02:06:07PM -0500, Rick Kern wrote:
>> vtenc.c was updated to match the coding style of the project.
>> 
>> I used several other files to get a feel for the project's coding
>> style. Is there documentation for this?
> 
> Yes: https://ffmpeg.org/developer.html#Coding-Rules-1
> 
> Timothy
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Got it - I didn’t realize ‘indent’ was a source code formatter.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel