Exemplo n.º 1
0
static int Open(vlc_object_t *p_this)
{
    vout_display_t *vd = (vout_display_t *)p_this;
    vout_display_t *p_dec = vd;
    char ppsz_components[MAX_COMPONENTS_LIST_SIZE][OMX_MAX_STRINGNAME_SIZE];
    picture_t** pictures = NULL;
    OMX_PARAM_PORTDEFINITIONTYPE *def;

    static OMX_CALLBACKTYPE callbacks =
        { OmxEventHandler, OmxEmptyBufferDone, OmxFillBufferDone };

    if (InitOmxCore(p_this) != VLC_SUCCESS)
        return VLC_EGENERIC;

    int components = CreateComponentsList(p_this, "iv_renderer", ppsz_components);
    if (components <= 0) {
        DeinitOmxCore();
        return VLC_EGENERIC;
    }

    /* Allocate structure */
    vout_display_sys_t *p_sys = (struct vout_display_sys_t*) calloc(1, sizeof(*p_sys));
    if (!p_sys) {
        DeinitOmxCore();
        return VLC_ENOMEM;
    }

    vd->sys     = p_sys;
    strcpy(p_sys->psz_component, ppsz_components[0]);

    /* Load component */
    OMX_ERRORTYPE omx_error = pf_get_handle(&p_sys->omx_handle,
                                            p_sys->psz_component, vd, &callbacks);
    CHECK_ERROR(omx_error, "OMX_GetHandle(%s) failed (%x: %s)",
                p_sys->psz_component, omx_error, ErrorToString(omx_error));

    InitOmxEventQueue(&p_sys->event_queue);
    OMX_FIFO_INIT(&p_sys->port.fifo, pOutputPortPrivate);
    p_sys->port.b_direct = false;
    p_sys->port.b_flushed = true;

    OMX_PORT_PARAM_TYPE param;
    OMX_INIT_STRUCTURE(param);
    omx_error = OMX_GetParameter(p_sys->omx_handle, OMX_IndexParamVideoInit, &param);
    CHECK_ERROR(omx_error, "OMX_GetParameter(OMX_IndexParamVideoInit) failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

    p_sys->port.i_port_index = param.nStartPortNumber;
    p_sys->port.b_valid = true;
    p_sys->port.omx_handle = p_sys->omx_handle;

    def = &p_sys->port.definition;
    OMX_INIT_STRUCTURE(*def);
    def->nPortIndex = p_sys->port.i_port_index;
    omx_error = OMX_GetParameter(p_sys->omx_handle, OMX_IndexParamPortDefinition, def);
    CHECK_ERROR(omx_error, "OMX_GetParameter(OMX_IndexParamPortDefinition) failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

#define ALIGN(x, y) (((x) + ((y) - 1)) & ~((y) - 1))

    def->format.video.nFrameWidth = vd->fmt.i_width;
    def->format.video.nFrameHeight = vd->fmt.i_height;
    def->format.video.nStride = 0;
    def->format.video.nSliceHeight = 0;
    p_sys->port.definition.format.video.eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar;

    if (!strcmp(p_sys->psz_component, "OMX.broadcom.video_render")) {
        def->format.video.nSliceHeight = ALIGN(def->format.video.nFrameHeight, 16);
    }

    omx_error = OMX_SetParameter(p_sys->omx_handle, OMX_IndexParamPortDefinition, &p_sys->port.definition);
    CHECK_ERROR(omx_error, "OMX_SetParameter(OMX_IndexParamPortDefinition) failed (%x: %s)",
                omx_error, ErrorToString(omx_error));
    OMX_GetParameter(p_sys->omx_handle, OMX_IndexParamPortDefinition, &p_sys->port.definition);

    if (def->format.video.nStride < (int) def->format.video.nFrameWidth)
        def->format.video.nStride = def->format.video.nFrameWidth;
    if (def->format.video.nSliceHeight < def->format.video.nFrameHeight)
        def->format.video.nSliceHeight = def->format.video.nFrameHeight;

    p_sys->port.pp_buffers =
            malloc(p_sys->port.definition.nBufferCountActual *
                   sizeof(OMX_BUFFERHEADERTYPE*));
    p_sys->port.i_buffers = p_sys->port.definition.nBufferCountActual;

    omx_error = OMX_SendCommand(p_sys->omx_handle, OMX_CommandStateSet, OMX_StateIdle, 0);
    CHECK_ERROR(omx_error, "OMX_CommandStateSet Idle failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

    unsigned int i;
    for (i = 0; i < p_sys->port.i_buffers; i++) {
        omx_error = OMX_AllocateBuffer(p_sys->omx_handle, &p_sys->port.pp_buffers[i],
                                       p_sys->port.i_port_index, 0,
                                       p_sys->port.definition.nBufferSize);
        if (omx_error != OMX_ErrorNone)
            break;
        OMX_FIFO_PUT(&p_sys->port.fifo, p_sys->port.pp_buffers[i]);
    }
    if (omx_error != OMX_ErrorNone) {
        p_sys->port.i_buffers = i;
        for (i = 0; i < p_sys->port.i_buffers; i++)
            OMX_FreeBuffer(p_sys->omx_handle, p_sys->port.i_port_index, p_sys->port.pp_buffers[i]);
        msg_Err(vd, "OMX_AllocateBuffer failed (%x: %s)",
                omx_error, ErrorToString(omx_error));
        goto error;
    }

    omx_error = WaitForSpecificOmxEvent(&p_sys->event_queue, OMX_EventCmdComplete, 0, 0, 0);
    CHECK_ERROR(omx_error, "Wait for Idle failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

    omx_error = OMX_SendCommand(p_sys->omx_handle, OMX_CommandStateSet,
                                OMX_StateExecuting, 0);
    CHECK_ERROR(omx_error, "OMX_CommandStateSet Executing failed (%x: %s)",
                omx_error, ErrorToString(omx_error));
    omx_error = WaitForSpecificOmxEvent(&p_sys->event_queue, OMX_EventCmdComplete, 0, 0, 0);
    CHECK_ERROR(omx_error, "Wait for Executing failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

    if (!strcmp(p_sys->psz_component, "OMX.broadcom.video_render")) {
        OMX_CONFIG_DISPLAYREGIONTYPE config_display;
        OMX_INIT_STRUCTURE(config_display);
        config_display.nPortIndex = p_sys->port.i_port_index;

        config_display.set = OMX_DISPLAY_SET_SRC_RECT;
        config_display.src_rect.width = vd->cfg->display.width;
        config_display.src_rect.height = vd->cfg->display.height;
        OMX_SetConfig(p_sys->omx_handle, OMX_IndexConfigDisplayRegion, &config_display);
        config_display.set = OMX_DISPLAY_SET_FULLSCREEN;
        config_display.fullscreen = OMX_TRUE;
        OMX_SetConfig(p_sys->omx_handle, OMX_IndexConfigDisplayRegion, &config_display);

        UpdateDisplaySize(vd, vd->cfg);
    }


    /* Setup chroma */
    video_format_t fmt = vd->fmt;

    fmt.i_chroma = VLC_CODEC_I420;
    video_format_FixRgb(&fmt);

    /* Setup vout_display */
    vd->fmt     = fmt;
    vd->pool    = Pool;
    vd->display = Display;
    vd->control = Control;
    vd->prepare = NULL;
    vd->manage  = NULL;

    /* Create the associated picture */
    pictures = calloc(p_sys->port.i_buffers, sizeof(*pictures));
    if (!pictures)
        goto error;
    for (unsigned int i = 0; i < p_sys->port.i_buffers; i++) {
        picture_sys_t *picsys = malloc(sizeof(*picsys));
        if (unlikely(picsys == NULL))
            goto error;
        picsys->sys = p_sys;

        picture_resource_t resource = { .p_sys = picsys };

        picture_t *picture = picture_NewFromResource(&fmt, &resource);
        if (unlikely(picture == NULL))
        {
            free(picsys);
            goto error;
        }
        pictures[i] = picture;
    }

    /* Wrap it into a picture pool */
    picture_pool_configuration_t pool_cfg;
    memset(&pool_cfg, 0, sizeof(pool_cfg));
    pool_cfg.picture_count = p_sys->port.i_buffers;
    pool_cfg.picture       = pictures;
    pool_cfg.lock          = LockSurface;
    pool_cfg.unlock        = UnlockSurface;

    p_sys->pool = picture_pool_NewExtended(&pool_cfg);
    if (!p_sys->pool) {
        for (unsigned int i = 0; i < p_sys->port.i_buffers; i++)
            picture_Release(pictures[i]);
        goto error;
    }

    /* Fix initial state */
    vout_display_SendEventFullscreen(vd, true);

    free(pictures);
    return VLC_SUCCESS;

error:
    free(pictures);
    Close(p_this);
    return VLC_EGENERIC;
}
Exemplo n.º 2
0
// init driver
static int init(sh_video_t *sh){
int i;   

uint8_t *extradata = (uint8_t *)(sh->bih + 1);
    int extradata_size = sh->bih->biSize - sizeof(*sh->bih);
	unsigned char *p = extradata;   
for (i=0;i<extradata_size;i++)
  mp_msg(MSGT_VO,MSGL_ERR,"[%x]",extradata[i]);


        dll_handle=dlopen("libOmxCore.so",RTLD_NOW|RTLD_GLOBAL);
        if (dll_handle){
        pf_init = dlsym( dll_handle, "OMX_Init" );
        pf_deinit = dlsym( dll_handle, "OMX_Deinit" );
        pf_get_handle = dlsym( dll_handle, "OMX_GetHandle" );
        pf_free_handle = dlsym( dll_handle, "OMX_FreeHandle" );
        pf_component_enum = dlsym( dll_handle, "OMX_ComponentNameEnum" );
        pf_get_roles_of_component = dlsym( dll_handle, "OMX_GetRolesOfComponent" );
        if( !pf_init || !pf_deinit || !pf_get_handle || !pf_free_handle ||
        !pf_component_enum || !pf_get_roles_of_component )
        {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Error in OMX");
        }
        else
        {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Success in OMX");
        omx_error = pf_init();
        if(omx_error != OMX_ErrorNone)
        {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","OMX Init Failed");
        return 0;
 	}
        while (1){
        omx_error=pf_component_enum(psz_name, OMX_MAX_STRINGNAME_SIZE, i);
        if(omx_error != OMX_ErrorNone) break;
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Component %d,%s",i,psz_name);
        omx_error = pf_get_roles_of_component(psz_name, &no_of_roles, NULL);
        if (omx_error != OMX_ErrorNone) {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","No Role for Component %s",psz_name);
        }
        else {
        if(no_of_roles == 0) {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","No Role for Component -2  %s",psz_name);
        }
        else
        {
                string_of_roles = malloc(no_of_roles * sizeof(OMX_STRING));
                for (index1 = 0; index1 < no_of_roles; index1++)
                {
                        *(string_of_roles + index1) = malloc(no_of_roles * OMX_MAX_STRINGNAME_SIZE);
                }
                omx_error = pf_get_roles_of_component(psz_name, &no_of_roles, string_of_roles);
                if (omx_error == OMX_ErrorNone && string_of_roles!=NULL) {
                for (index1 = 0; index1 < no_of_roles; index1++) {
                __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","The role %i for the component:  %s",(index1+1),*(string_of_roles+index1));
                }
                }
                else    {
                __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Error getting role");
                }
        }
        }
        i++;
        }
        omx_error=pf_get_handle( &omx_handle, "OMX.qcom.video.decoder.avc\0",NULL,&callbacks);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Get Handle %s",ErrorToString(omx_error));
	if (omx_handle){
	input_port_def.nPortIndex = 0;
	 omx_error = OMX_GetParameter(omx_handle,
                               OMX_IndexParamPortDefinition,
                               &input_port_def);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","GetPortDefination %s",ErrorToString(omx_error));


        input_port_def.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;     
	input_port_def.format.video.nFrameWidth  = sh->disp_w;
        input_port_def.format.video.nFrameHeight = sh->disp_h;
        omx_error = OMX_SetParameter(omx_handle,
                               OMX_IndexParamPortDefinition,
                               &input_port_def);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","SetParameter %s",ErrorToString(omx_error));
	
	omx_error = OMX_SendCommand(omx_handle, OMX_CommandPortEnable, 1, NULL);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","PortEnable %s",ErrorToString(omx_error));
	
	outBufferParseVideo[0] = outBufferParseVideo[1] = NULL;
	omx_error = OMX_SendCommand( omx_handle, OMX_CommandStateSet, OMX_StateIdle, 0 );
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","StateIdle %s",ErrorToString(omx_error));
	sleep(1);
	omx_error = OMX_SendCommand( omx_handle, OMX_CommandStateSet, OMX_StateLoaded, 0 );
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","StateLoaded %s",ErrorToString(omx_error));

	omx_error = OMX_AllocateBuffer(omx_handle, &outBufferParseVideo[0], 0, NULL,16384);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","AllocateBuffer %s",ErrorToString(omx_error));
	
	omx_error = OMX_AllocateBuffer(omx_handle, &outBufferParseVideo[1], 0, NULL,16384);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","AllocateBuffer %s",ErrorToString(omx_error));
/*	omx_error = OMX_UseBuffer(omx_handle, &inBufferVideoDec[0], 0, NULL, 16384, outBufferParseVideo[0]->pBuffer);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","UseBuffer 1%s",ErrorToString(omx_error));
	omx_error = OMX_UseBuffer(omx_handle, &inBufferVideoDec[1], 0, NULL, 16384, outBufferParseVideo[1]->pBuffer);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","UseBuffer 2%s",ErrorToString(omx_error));*/
	omx_error = OMX_AllocateBuffer(omx_handle, &outBufferVideoDec[0], 1, NULL, 16384);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","AllocateBuffer Video 1%s",ErrorToString(omx_error));
	omx_error = OMX_AllocateBuffer(omx_handle, &outBufferVideoDec[1], 1, NULL, 16384);
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","AllocateBuffer Video 2%s",ErrorToString(omx_error));
	omx_error = OMX_SendCommand(omx_handle, OMX_CommandStateSet,OMX_StateExecuting, 0);
	sleep(1);
	outBufferParseVideo[0]->nFilledLen = extradata_size;
	memcpy(outBufferParseVideo[0]->pBuffer, extradata, extradata_size);
	omx_error=OMX_EmptyThisBuffer(omx_handle, outBufferParseVideo[0]);
        if (omx_error != OMX_ErrorNone) {
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Error %s",ErrorToString(omx_error));
        }
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Error %s",ErrorToString(omx_error));









        }
	}
        }
        else
        __android_log_print(ANDROID_LOG_ERROR  , "MPlayer","Unable to open OMX dll");
        

  return 1;
}
Exemplo n.º 3
0
static int Open(vlc_object_t *obj)
{
    char ppsz_components[MAX_COMPONENTS_LIST_SIZE][OMX_MAX_STRINGNAME_SIZE];
    OMX_U8 psz_role[OMX_MAX_STRINGNAME_SIZE];
    filter_t *filter = (filter_t*) obj;
    OMX_PARAM_PORTDEFINITIONTYPE def;
    OMX_PORT_PARAM_TYPE param;
    filter_t *p_dec = filter;
    OMX_ERRORTYPE omx_error;
    filter_sys_t *sys;
    unsigned int i, j;
    int components;

    static OMX_CALLBACKTYPE callbacks =
        { OmxEventHandler, OmxEmptyBufferDone, OmxFillBufferDone };

    if (InitOmxCore(obj) != VLC_SUCCESS)
        return VLC_EGENERIC;

    components = CreateComponentsList(obj, "image_fx", ppsz_components);
    if (components <= 0) {
        DeinitOmxCore();
        msg_Err(filter, "Could not find image_fx component.\n");
        return VLC_EGENERIC;
    }

    sys = calloc(1, sizeof(*sys));
    if (unlikely(sys == NULL))
            return VLC_ENOMEM;
    strcpy(sys->psz_component, ppsz_components[0]);
    filter->p_sys = sys;

    /* Initialize the OMX component */
    omx_error = pf_get_handle(&sys->omx_handle, sys->psz_component, filter,
            &callbacks);
    CHECK_ERROR(omx_error, "OMX_GetHandle(%s) failed (%x: %s)",
            sys->psz_component, omx_error, ErrorToString(omx_error));

    omx_error = OMX_ComponentRoleEnum(sys->omx_handle, psz_role, 0);
    if(omx_error == OMX_ErrorNone)
        msg_Dbg(filter, "loaded component %s of role %s", sys->psz_component, psz_role);
    else
        msg_Dbg(filter, "loaded component %s", sys->psz_component);
    PrintOmx(obj, sys->omx_handle, OMX_ALL);

    InitOmxEventQueue(&sys->event_queue);

    OMX_INIT_STRUCTURE(param);
    OMX_INIT_STRUCTURE(def);
    omx_error = OMX_GetParameter(sys->omx_handle, OMX_IndexParamImageInit, &param);
    CHECK_ERROR(omx_error, "OMX_GetParameter(OMX_IndexParamImageInit) failed (%x: %s)",
                omx_error, ErrorToString(omx_error));

    sys->num_ports = param.nPorts;
    sys->ports = &sys->out;
    for (i = 0; i < param.nPorts; i++) {
        OmxPort *p_port;

        def.nPortIndex = param.nStartPortNumber + i;
        omx_error = OMX_GetParameter(sys->omx_handle,
                OMX_IndexParamPortDefinition, &def);
        if (omx_error != OMX_ErrorNone) {
            msg_Warn(obj, "Port Defintion could not be retrieved for port %d",
                    (int)def.nPortIndex);
            continue;
        }

        if (def.eDir == OMX_DirInput) {
            msg_Dbg(obj, "Port %d is input.", (int)def.nPortIndex);
            p_port = &sys->in;
        } else {
            msg_Dbg(obj, "Port %d is output.", (int)def.nPortIndex);
            p_port = &sys->out;
        }

        def.nBufferCountActual = def.nBufferCountMin;
        omx_error = OMX_SetParameter(sys->omx_handle,
                OMX_IndexParamPortDefinition, &def);
        if (omx_error != OMX_ErrorNone) {
            msg_Warn(obj, "Port Defintion could not be updated for port %d",
                    (int)def.nPortIndex);
            continue;
        }

        p_port->b_valid = true;
        p_port->i_port_index = def.nPortIndex;
        p_port->definition = def;
        p_port->omx_handle = sys->omx_handle;
    }

    if (!sys->in.b_valid || !sys->out.b_valid) {
        omx_error = OMX_ErrorInvalidComponent;
        CHECK_ERROR(omx_error, "couldn't find an input and/or output port.");
    }

    SetFormat(filter, &sys->in);
    SetFormat(filter, &sys->out);

    /* allocate array for port buffers */
    for (i = 0; i < sys->num_ports; i++) {
        OmxPort *port = &sys->ports[i];

        vlc_mutex_init(&port->fifo.lock);
        vlc_cond_init(&port->fifo.wait);
        port->fifo.pp_last = &port->fifo.p_first;
        port->b_flushed = true;
        if (port == &sys->in) {
            port->b_direct = true;
            port->p_fmt = &filter->fmt_in;
            port->fifo.offset = offsetof(OMX_BUFFERHEADERTYPE, pOutputPortPrivate) /
                                sizeof(void*);
        } else {
            port->b_direct = true;
            port->p_fmt = &filter->fmt_out;
            port->fifo.offset = offsetof(OMX_BUFFERHEADERTYPE, pInputPortPrivate) /
                                sizeof(void*);
        }

        msg_Dbg(obj, "Allocate headroom for %u buffers.",
                (unsigned)port->definition.nBufferCountActual);
        port->pp_buffers = malloc(port->definition.nBufferCountActual *
                sizeof(OMX_BUFFERHEADERTYPE*));
        if (unlikely(port->pp_buffers == NULL)) {
            omx_error = OMX_ErrorInsufficientResources;
            CHECK_ERROR(omx_error, "memory allocation failed");
        }
        port->i_buffers = port->definition.nBufferCountActual;

        /* enable port */
        if (!port->definition.bEnabled) {
            omx_error = OMX_SendCommand(sys->omx_handle, OMX_CommandPortEnable,
                    port->i_port_index, NULL);
            CHECK_ERROR(omx_error, "OMX_CommandPortEnable on %i failed (%x)",
                    (int)port->i_port_index, omx_error);

            omx_error = WaitForSpecificOmxEvent(&sys->event_queue,
                    OMX_EventCmdComplete, 0, 0, 0);
            CHECK_ERROR(omx_error, "Wait for PortEnable on %i failed (%x)",
                    (int)port->i_port_index, omx_error);
        }
    }

    /* Put component into idle state */
    omx_error = OMX_SendCommand(sys->omx_handle, OMX_CommandStateSet, OMX_StateIdle, 0);
    CHECK_ERROR(omx_error, "OMX_CommandStateSet Idle failed (%x: %s)", omx_error,
            ErrorToString(omx_error));

    /* allocate buffers/bufferheaders for direct rendering */
    for (i = 0; i < sys->num_ports; i++) {
        OmxPort *port = &sys->ports[i];

        for (j = 0; j < port->i_buffers; j++) {
            if (port->b_direct) {
                omx_error = OMX_UseBuffer(sys->omx_handle, &port->pp_buffers[j],
                        port->i_port_index, 0, port->definition.nBufferSize,
                        (void*)1);
                CHECK_ERROR(omx_error, "OMX_UseBuffer failed (%x: %s)", omx_error,
                        ErrorToString(omx_error));
                msg_Dbg(obj, "Use direct rendering on port %u",
                        (unsigned)port->i_port_index);
                msg_Dbg(obj, "Allocated direct rendering buffer header: %p",
                        port->pp_buffers[j]);
            } else {
                omx_error = OMX_AllocateBuffer(sys->omx_handle,
                        &port->pp_buffers[j], port->i_port_index, 0,
                        port->definition.nBufferSize);
                msg_Dbg(obj, "Use indirect rendering on port %u",
                        (unsigned)port->i_port_index);
            }

            if (omx_error != OMX_ErrorNone) {
                msg_Warn(obj, "Buffer allocate failed on buffer %d for port %d (%x: %s)",
                        j, i, omx_error, ErrorToString(omx_error));
                CHECK_ERROR(omx_error, "OMX_FillBuffer failed (%x: %s)", omx_error,
                        ErrorToString(omx_error));
                break;
            }
            OMX_FIFO_PUT(&port->fifo, port->pp_buffers[j]);
        }
        msg_Dbg(obj, "Allocated %u buffers for port %u",
                (unsigned)port->i_buffers, (unsigned)port->i_port_index);
    }

    omx_error = WaitForSpecificOmxEvent(&sys->event_queue, OMX_EventCmdComplete,
            0, 0, 0);
    CHECK_ERROR(omx_error, "Wait for Idle failed (%x: %s)", omx_error,
            ErrorToString(omx_error));

    msg_Dbg(obj, "Reached Idle state, transition to Executing.");
    SetDeinterlaceMode(filter);

    omx_error = OMX_SendCommand(sys->omx_handle, OMX_CommandStateSet,
            OMX_StateExecuting, 0);
    CHECK_ERROR(omx_error, "OMX_CommandStateSet Executing failed (%x)", omx_error);

    omx_error = WaitForSpecificOmxEvent(&sys->event_queue,
            OMX_EventCmdComplete, 0, 0, 0);
    CHECK_ERROR(omx_error, "Wait for Executing failed (%x)", omx_error );

    filter->pf_video_filter = Deinterlace;
    filter->fmt_out.video.i_frame_rate *= 2;
    printf("OMXIL deinterlace filter initialized with %d->%d fps\n",
        filter->fmt_in.video.i_frame_rate,
        filter->fmt_out.video.i_frame_rate);

    return VLC_SUCCESS;

error:
    Close(obj);
    return VLC_EGENERIC;
}