Пример #1
0
static int Setup( vlc_va_t *va, AVCodecContext *avctx, vlc_fourcc_t *p_chroma )
{
    av_vda_default_free(avctx);

    (void) va;
    *p_chroma = VLC_CODEC_UYVY;

    return (av_vda_default_init(avctx) < 0) ? VLC_EGENERIC : VLC_SUCCESS;
}
Пример #2
0
static void vda_uninit(AVCodecContext *s)
{
    InputStream *ist = s->opaque;
    VDAContext  *vda = ist->hwaccel_ctx;

    ist->hwaccel_uninit        = NULL;
    ist->hwaccel_retrieve_data = NULL;

    av_frame_free(&vda->tmp_frame);

    av_vda_default_free(s);
    av_freep(&ist->hwaccel_ctx);
}
static void videotoolbox_uninit(AVCodecContext *s)
{
    InputStream *ist = s->opaque;
    VTContext  *vt = ist->hwaccel_ctx;

    ist->hwaccel_uninit        = NULL;
    ist->hwaccel_retrieve_data = NULL;

    av_frame_free(&vt->tmp_frame);

    if (ist->hwaccel_id == HWACCEL_VIDEOTOOLBOX) {
#if CONFIG_VIDEOTOOLBOX
        av_videotoolbox_default_free(s);
#endif
    } else {
#if CONFIG_VDA
        av_vda_default_free(s);
#endif
    }
    av_freep(&ist->hwaccel_ctx);
}
Пример #4
0
Файл: vda.c Проект: 0xheart0/vlc
static int Open(vlc_va_t *va,
                AVCodecContext *avctx,
                enum PixelFormat pix_fmt,
                const es_format_t *fmt,
                picture_sys_t *p_sys)
{
    if( pix_fmt != AV_PIX_FMT_VDA )
        return VLC_EGENERIC;

    (void) fmt;
    (void) p_sys;

    size_t i_profile = 0xFFFF, i_level = 0xFFFF;

    switch (avctx->codec_id) {
        case AV_CODEC_ID_H264:
            msg_Dbg( va, "trying to decode MPEG-4 Part 10: profile %d, level %d", avctx->profile, avctx->level);

            switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
                case FF_PROFILE_H264_CONSTRAINED_BASELINE:
                case FF_PROFILE_H264_BASELINE:
                case FF_PROFILE_H264_MAIN:
                case FF_PROFILE_H264_HIGH:
                    break;

                default:
                    msg_Dbg( va, "unsupported H264 profile %d", avctx->profile);
                    return -1;
            }
            break;

        default:
#ifndef NDEBUG
            msg_Err( va, "codec %d is not supported", avctx->codec_id);
#endif
            return VLC_EGENERIC;
    }

    vlc_va_sys_t *sys = calloc(1, sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;

    sys->vdactx = av_vda_alloc_context();
    sys->vdactx->cv_pix_fmt_type = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
    sys->i_width = avctx->width;
    sys->i_height = avctx->height;

    int i_ret = av_vda_default_init2(avctx, sys->vdactx);

    msg_Dbg(va, "Creating VDA decoder %i", i_ret);

    if (i_ret != 0) {
        av_vda_default_free(avctx);
        return VLC_EGENERIC;
    }

    va->sys = sys;
    va->description = (char *)"VDA";
    va->get = Get;
    va->release = Release;
    va->extract = Extract;

    return VLC_SUCCESS;
}
Пример #5
0
Файл: vda.c Проект: 0xheart0/vlc
static void Close( vlc_va_t *va, AVCodecContext *avctx )
{
    av_vda_default_free(avctx);
    (void) va;
}