On Nov 2, 2011, at 5:44 PM, Diego Biurrun wrote:
> From: Sebastien Zwickert <[email protected]>
>
> Support h264 accelerated decoding through MacOSX VDA framework
>
> Signed-off-by: Luca Barbato <[email protected]>
> Signed-off-by: Diego Biurrun <[email protected]>
> ---
>
> +
> +/* Mutex manager callback. */
> +static int vda_lock_operation(void **mtx, enum AVLockOp op)
> +{
> + switch (op) {
> + case AV_LOCK_CREATE:
> + *mtx = av_malloc(sizeof(pthread_mutex_t));
> + if (!*mtx)
> + return 1;
> + return !!pthread_mutex_init(*mtx, NULL);
> + case AV_LOCK_OBTAIN:
> + return !!pthread_mutex_lock(*mtx);
> + case AV_LOCK_RELEASE:
> + return !!pthread_mutex_unlock(*mtx);
> + case AV_LOCK_DESTROY:
> + pthread_mutex_destroy(*mtx);
> + av_freep(mtx);
> + return 0;
> + }
> + return 1;
> +}
Just use pthread functions directly.
> […]
> +/* Decoder callback that adds the vda frame to the queue in display order. */
> +static void vda_decoder_callback(void *vda_hw_ctx,
> + CFDictionaryRef user_info,
> + OSStatus status,
> + uint32_t infoFlags,
> + CVImageBufferRef image_buffer)
> +{
> + struct vda_context *vda_ctx = (struct vda_context*)vda_hw_ctx;
> + vda_frame *new_frame;
> + vda_frame *queue_walker;
> +
> + if (NULL == image_buffer)
> + return;
> +
> + if (kCVPixelFormatType_422YpCbCr8 !=
> CVPixelBufferGetPixelFormatType(image_buffer))
> + return;
Shouldn't this return an error?
I'm not really familiar with hwaccel, but if you can test it it looks OK.
Of course also make sure to test that it falls back to software decoding on
10bit content.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel