コード例 #1
0
ファイル: OMX_SendCommand.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        cmdstr = element.get('cmd')
        nparam1str = element.get('nparam1')
        cmddatastr = element.get('cmddata')
        log_api ("%s '%s' '%s' '%s' '%s'" \
                       % (element.tag, name, cmdstr, nparam1str, cmddatastr))
        handle = context.handles[alias]
        cmd = get_il_enum_from_string(cmdstr)
	if (cmd == OMX_CommandPortEnable or cmd == OMX_CommandPortDisable):
            # nParam1 is the port index to be enabled/disabled, not an enum
            nparam1 = int(nparam1str)
	else:
            nparam1 = get_il_enum_from_string(nparam1str)

        if (handle != None):
            context.cmdevents[handle.value].clear()
            omxerror = OMX_SendCommand(handle, cmd, nparam1, None)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

        log_result (element.tag + " '" + name + "'", err)

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #2
0
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        cmdstr = element.get('cmd')
        nparam1str = element.get('nparam1')
        cmddatastr = element.get('cmddata')
        log_api ("%s '%s' '%s' '%s' '%s'" \
                       % (element.tag, name, cmdstr, nparam1str, cmddatastr))
        handle = context.handles[alias]
        cmd = get_il_enum_from_string(cmdstr)
        if (cmd == OMX_CommandPortEnable or cmd == OMX_CommandPortDisable):
            # nParam1 is the port index to be enabled/disabled, not an enum
            nparam1 = int(nparam1str)
        else:
            nparam1 = get_il_enum_from_string(nparam1str)

        if (handle != None):
            context.cmdevents[handle.value].clear()
            omxerror = OMX_SendCommand(handle, cmd, nparam1, None)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

        log_result(element.tag + " '" + name + "'", err)

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #3
0
ファイル: OMX_ResetEvent.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        evtstr = element.get('evt')
        log_api ("%s '%s' '%s'" \
            % (element.tag, name, evtstr ))
        handle = context.handles[alias]
        evt = get_il_enum_from_string(evtstr)

        if (handle != None):
            if (evt == OMX_EventCmdComplete):
                context.cmdevents[handle.value].clear()

            elif (evt == OMX_EventBufferFlag):
                context.eosevents[handle.value].clear()

            elif (evt == OMX_EventPortSettingsChanged):
                context.settings_changed_events[handle.value].clear()

            else:
                log_line ()
                log_line ("Unhandled event %s" % (evtstr))
                return get_il_enum_from_string("OMX_ErrorNotImplemented")
        else:
            log_line ()
            log_line ("Unknown handle")
            return get_il_enum_from_string("OMX_ErrorUndefined")

        return 0
コード例 #4
0
    def run(self, element, context):

        role = element.get('role')
        log_api("%s '%s'" % (element.tag, role))

        cname = (c_ubyte * OMX_MAX_STRINGNAME_SIZE)()
        index = OMX_U32()
        index = 0
        err = OMX_ERRORTYPE()

        log_line()

        while True:

            omxerror = OMX_ComponentOfRoleEnum(cast(cname, POINTER(c_char)),
                                               role, index)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            if (err == "OMX_ErrorNoMore") or (err != "OMX_ErrorNone"):
                break

            log_line ("Component #%d : %s" \
                          % (index, cast(cname, c_char_p).value),  1)
            index = index + 1

        if (err == "OMX_ErrorNoMore"):
            log_result(element.tag, "OMX_ErrorNone")
            return 0
        else:
            log_result(element.tag, err)
            return interror
コード例 #5
0
    def run(self, element, context):

        name = element.get('name')
        log_api ("%s '%s'" % (element.tag, name))

        crole = (c_ubyte * OMX_MAX_STRINGNAME_SIZE)()
        index = OMX_U32()
        index = 0
        err = OMX_ERRORTYPE()

        log_line ()

        while True:

            omxerror = OMX_RoleOfComponentEnum(cast(crole, POINTER(c_char)),
                                               name, index)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            if (err == "OMX_ErrorNoMore") or (err != "OMX_ErrorNone"):
                break

            log_line ("Role #%d : %s" \
                          % (index, cast(crole, c_char_p).value),  1)
            index = index + 1

        if (err == "OMX_ErrorNoMore"):
            log_result(element.tag, "OMX_ErrorNone")
            return 0
        else:
            log_result(element.tag, err)
            return interror
コード例 #6
0
ファイル: OMX_SetupTunnel.py プロジェクト: a06kin/skema
    def run(self, element, context):
        outcomp = element.get('outcomp')
        outcompname = context.cnames[outcomp]
        outport = element.get('outport')

        incomp = element.get('incomp')
        incompname = context.cnames[incomp]
        inport = element.get('inport')
        log_api ("%s '%s:Port-%d' <->  '%s:Port-%d'" \
                       % (element.tag, outcompname, \
                              int(outport), incompname, int(inport)))
        outhdl = context.handles[outcomp]
        inhdl = context.handles[incomp]

        if (outhdl != None and inhdl != None):
            omxerror = OMX_SetupTunnel(outhdl, int(outport), inhdl,
                                       int(inport))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            log_result(element.tag, err)

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #7
0
    def run(self, element, context):

        log_api ("%s" % element.tag)

        cname = (c_ubyte * OMX_MAX_STRINGNAME_SIZE)()
        cnamelen = OMX_U32()
        cnamelen = OMX_MAX_STRINGNAME_SIZE

        index = OMX_U32()
        index = 0

        err = OMX_ERRORTYPE()
        log_line ()

        while True:

            omxerror = OMX_ComponentNameEnum(cast(cname, POINTER(c_char)),
                                             cnamelen, index)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            if (err == "OMX_ErrorNoMore") or (err != "OMX_ErrorNone"):
                break

            log_line ("Component at index #%d : %s" \
                          % (index, cast(cname, c_char_p).value),  1)
            index = index + 1

        if (err == "OMX_ErrorNoMore"):
            log_result(element.tag, "OMX_ErrorNone")
            return 0
        else:
            log_result(element.tag, err)
            return interror
コード例 #8
0
ファイル: OMX_TeardownTunnel.py プロジェクト: tizonia/skema
    def run(self, element, context):
        outcomp = element.get('outcomp')
        outcompname = context.cnames[outcomp]
        outport = element.get('outport')

        incomp = element.get('incomp')
        incompname = context.cnames[incomp]
        inport = element.get('inport')
        log_api ("%s '%s:Port-%d' <->  '%s:Port-%d'" \
                       % (element.tag, outcompname, \
                              int(outport), incompname, int(inport)))
        outhdl = context.handles[outcomp]
        inhdl  = context.handles[incomp]

        if (outhdl != None and inhdl != None):
            omxerror = OMX_TeardownTunnel(outhdl, int(outport), inhdl, int(inport))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            log_result (element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_result (element.tag, "OMX_ErrorUndefined")
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #9
0
ファイル: OMX_ResetEvent.py プロジェクト: a06kin/skema
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        evtstr = element.get('evt')
        log_api ("%s '%s' '%s'" \
            % (element.tag, name, evtstr ))
        handle = context.handles[alias]
        evt = get_il_enum_from_string(evtstr)

        if (handle != None):
            if (evt == OMX_EventCmdComplete):
                context.cmdevents[handle.value].clear()

            elif (evt == OMX_EventBufferFlag):
                context.eosevents[handle.value].clear()

            elif (evt == OMX_EventPortSettingsChanged):
                context.settings_changed_events[handle.value].clear()

            elif (evt == OMX_EventPortFormatDetected):
                context.format_detected_events[handle.value].clear()

            else:
                log_line()
                log_line("Unhandled event %s" % (evtstr))
                return get_il_enum_from_string("OMX_ErrorNotImplemented")
        else:
            log_line()
            log_line("Unknown handle")
            return get_il_enum_from_string("OMX_ErrorUndefined")

        return 0
コード例 #10
0
ファイル: OMX_GetConfig.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        indexstr = element.get('index')
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')

        log_api ("%s '%s' '%s:Port-%d'" \
                        % (element.tag, indexstr, name, int(portstr)))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)

        param_type         = omxil12_indexes[indexstr]
        param_struct       = param_type()
        param_struct.nSize = sizeof(param_type)

        if (portstr != None):
            param_struct.nPortIndex = int(portstr)

        if (handle != None):
            omxerror = OMX_GetConfig(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, val in param_type._fields_:
                for name2, val2 in element.items():
                    if (name2 == name):
                        getattr(param_struct, name, int(val2))


            omxerror = OMX_GetConfig(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            domstr = ""
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, val in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                else:
                    log_line ("%s -> '%s'" \
                        % (name, getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror
        else:
            log_line ("%s -> '%s %s'" \
                          % (element.tag, \
                                 "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #11
0
    def run(self, element, context):
        indexstr = element.get('index')
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')

        log_api ("%s '%s' '%s:Port-%d'" \
                        % (element.tag, indexstr, name, int(portstr)))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)

        param_type = omxil12_indexes[indexstr]
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

        if (portstr != None):
            param_struct.nPortIndex = int(portstr)

        if (handle != None):
            omxerror = OMX_GetConfig(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, val in param_type._fields_:
                for name2, val2 in element.items():
                    if (name2 == name):
                        setattr(param_struct, name, int(val2))

            omxerror = OMX_SetConfig(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            domstr = ""
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_line()
            log_line("%s" % param_struct.__class__.__name__, 1)
            for name, val in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                else:
                    log_line ("%s -> '%s'" \
                        % (name, getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror
        else:
            log_line ("%s -> '%s %s'" \
                          % (element.tag, \
                                 "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #12
0
    def run(self, element, context):
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')

        log_api("%s %s:Port-%s'" % (element.tag, name, portstr))

        context.base_profile_mgr.start_exchange(alias, portstr)

        log_result(element.tag, "OMX_ErrorNone")

        return 0
コード例 #13
0
    def run(self, element, context):
        delay_in_seconds = element.get('delay')
        log_api ("%s '%s'" \
            % (element.tag, delay_in_seconds))

        time.sleep(float(delay_in_seconds))

        log_line()
        msg = "Waited '" + delay_in_seconds + "' seconds"
        log_result(msg, "OMX_ErrorNone")

        return 0
コード例 #14
0
    def run(self, element, context):
        alias       = element.get('alias')
        name        = context.cnames[alias]
        portstr     = element.get('port')

        log_api ("%s %s:Port-%s'" % (element.tag, name, portstr))

        context.base_profile_mgr.start_exchange(alias, portstr)

        log_result (element.tag, "OMX_ErrorNone")

        return 0
コード例 #15
0
ファイル: OMX_Wait.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        delay_in_seconds = element.get('delay')
        log_api ("%s '%s'" \
            % (element.tag, delay_in_seconds))

        time.sleep(float(delay_in_seconds))

        log_line ()
        msg = "Waited '" + delay_in_seconds + "' seconds"
        log_result (msg, "OMX_ErrorNone")

        return 0
コード例 #16
0
    def run(self, element, context):
        alias = element.get("alias")
        name = context.cnames[alias]
        portstr = element.get("port")
        howmanystr = element.get("howmany")

        log_api("%s %s:Port-%s' 'Howmany:%s'" % (element.tag, name, portstr, howmanystr))

        context.base_profile_mgr.allocate_buffers(alias, portstr, howmanystr)

        log_result(element.tag, "OMX_ErrorNone")

        return 0
コード例 #17
0
    def run(self, element, context):
        alias       = element.get('alias')
        name        = context.cnames[alias]
        portstr     = element.get('port')
        howmanystr  = element.get('howmany')

        log_api ("%s %s:Port-%s' 'Howmany:%s'" \
                     % (element.tag, name, portstr, howmanystr))

        context.base_profile_mgr.allocate_buffers(alias, portstr, howmanystr)

        log_result (element.tag, "OMX_ErrorNone")

        return 0
コード例 #18
0
    def run(self, element, context):
        alias       = element.get('alias')
        name        = context.cnames[alias]
        portstr     = element.get('port')
        howmanystr  = element.get('howmany')

        log_api ("%s %s:Port-%s' 'Howmany:%s'" \
                     % (element.tag, name, portstr, howmanystr))

        context.base_profile_mgr.free_buffers(alias, portstr, howmanystr)

        log_result (element.tag, "OMX_ErrorNone")

        return 0
コード例 #19
0
ファイル: OMX_Deinit.py プロジェクト: a06kin/skema
    def run(self, element, context):
        log_api("%s" % element.tag)

        omxerror = OMX_Deinit()
        interror = int(omxerror & 0xffffffff)
        err = get_string_from_il_enum(interror, "OMX_Error")
        log_result(element.tag, err)

        # Deinit here the base profile manager
        context.base_profile_mgr.stop()

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #20
0
ファイル: OMX_StopSubProcess.py プロジェクト: tizonia/skema
    def run(self, element, context):
        alias = element.get('alias')

        log_api ("%s '%s'" \
            % (element.tag, alias))

        pid = context.subprocesses[alias].pid
        context.subprocesses[alias].terminate()
        del context.subprocesses[alias]

        log_line ()
        msg = "Stopped sub-process '" + alias + "' with PID " + str(pid)
        log_result (msg, "OMX_ErrorNone")

        return 0
コード例 #21
0
ファイル: OMX_StopSubProcess.py プロジェクト: a06kin/skema
    def run(self, element, context):
        alias = element.get('alias')

        log_api ("%s '%s'" \
            % (element.tag, alias))

        pid = context.subprocesses[alias].pid
        context.subprocesses[alias].terminate()
        del context.subprocesses[alias]

        log_line ()
        msg = "Stopped sub-process '" + alias + "' with PID " + str(pid)
        log_result (msg, "OMX_ErrorNone")

        return 0
コード例 #22
0
ファイル: OMX_Deinit.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        log_api ("%s" % element.tag)

        omxerror = OMX_Deinit()
        interror = int(omxerror & 0xffffffff)
        err = get_string_from_il_enum(interror, "OMX_Error")
        log_result(element.tag, err)

        # Deinit here the base profile manager
        context.base_profile_mgr.stop()

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #23
0
ファイル: OMX_GetContentURI.py プロジェクト: minlunlee/skema
    def run(self, element, context):
        indexstr = "OMX_IndexParamContentURI"
        alias = element.get('alias')
        name = context.cnames[alias]
#        This param struct does not have a port index.
#        portstr = element.get('port')
        log_api ("%s '%s' '%s'" \
                       % (element.tag, indexstr, name))
        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_CONTENTURITYPE
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

#        This param struct does not have a port index.
#        if (portstr != None):
#            param_struct.nPortIndex = int(portstr)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            uristr = c_char_p()
            uristr = cast(param_struct.contentURI, c_char_p)

            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "contentURI"):
                    log_param (name, uristr.value, 1)
                else:
                    log_param (name, str(getattr(param_struct, name)), 1)

            log_result (element.tag, err)
            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #24
0
    def run(self, element, context):
        name = element.get('name')
        alias = element.get('alias')
        expectstr = element.get('expect', default='OMX_ErrorNone')
        context.cnames[alias] = name
        context.aliases[name] = alias

        log_api("%s '%s' Expected '%s'" % (element.tag, name, expectstr))

        handle = OMX_HANDLETYPE()
        EVT_HDLER_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, OMX_EVENTTYPE, OMX_U32, OMX_U32,
                                   OMX_PTR)
        EBD_CBACK_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, POINTER(OMX_BUFFERHEADERTYPE))
        FBD_CBACK_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, POINTER(OMX_BUFFERHEADERTYPE))

        context.cbacks.EventHandler = EVT_HDLER_TYPE(my_evt_hdler)
        context.cbacks.EmptyBufferDone = EBD_CBACK_TYPE(my_ebd_cback)
        context.cbacks.FillBufferDone = FBD_CBACK_TYPE(my_fbd_cback)

        omxerror = OMX_GetHandle(byref(handle), name, None,
                                 byref(context.cbacks))

        interror = int(omxerror & 0xffffffff)
        err = get_string_from_il_enum(interror, "OMX_Error")

        if (expectstr == err):
            if (interror == OMX_ErrorNone):
                context.handles[alias] = handle
                context.cnames2[handle.value] = name
                context.cmdevents[handle.value] = threading.Event()
                context.eosevents[handle.value] = threading.Event()
                context.settings_changed_events[
                    handle.value] = threading.Event()
                context.format_detected_events[
                    handle.value] = threading.Event()
                context.error_events[handle.value] = []
                context.ignored_error_events[handle.value] = []
            else:
                context.handles[alias] = OMX_HANDLETYPE()
            log_result(element.tag, err)
            return 0
        else:
            log_result(element.tag, err)
            return interror
コード例 #25
0
ファイル: OMX_Init.py プロジェクト: a06kin/skema
    def run(self, element, context):
        log_api("%s" % element.tag)

        # Init here the base profile manager, in case its needed
        context.base_profile_mgr = SkemaBaseProfileManager()
        context.base_profile_mgr.start()

        omxerror = OMX_Init()
        interror = int(omxerror & 0xffffffff)
        err = get_string_from_il_enum(interror, "OMX_Error")

        log_result(element.tag, err)

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #26
0
ファイル: OMX_Init.py プロジェクト: tizonia/skema
    def run(self, element, context):
        log_api ("%s" % element.tag)

        # Init here the base profile manager, in case its needed
        context.base_profile_mgr = SkemaBaseProfileManager()
        context.base_profile_mgr.start()

        omxerror = OMX_Init()
        interror = int(omxerror & 0xffffffff)
        err      = get_string_from_il_enum(interror, "OMX_Error")

        log_result(element.tag, err)

        if (err == "OMX_ErrorNone"):
            return 0
        else:
            return interror
コード例 #27
0
ファイル: OMX_GetHandle.py プロジェクト: tizonia/skema
    def run(self, element, context):
        name                  = element.get('name')
        alias                 = element.get('alias')
        expectstr             = element.get('expect', default='OMX_ErrorNone')
        context.cnames[alias] = name
        context.aliases[name] = alias

        log_api ("%s '%s' Expected '%s'" % (element.tag, name, expectstr))

        handle = OMX_HANDLETYPE()
        EVT_HDLER_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, OMX_EVENTTYPE, OMX_U32, OMX_U32,
                                   OMX_PTR)
        EBD_CBACK_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, POINTER(OMX_BUFFERHEADERTYPE))
        FBD_CBACK_TYPE = CFUNCTYPE(UNCHECKED(OMX_ERRORTYPE), OMX_HANDLETYPE,
                                   OMX_PTR, POINTER(OMX_BUFFERHEADERTYPE))

        context.cbacks.EventHandler    = EVT_HDLER_TYPE(my_evt_hdler)
        context.cbacks.EmptyBufferDone = EBD_CBACK_TYPE(my_ebd_cback)
        context.cbacks.FillBufferDone  = FBD_CBACK_TYPE(my_fbd_cback)

        omxerror = OMX_GetHandle(byref(handle), name, None,
                                 byref(context.cbacks))

        interror = int(omxerror & 0xffffffff)
        err      = get_string_from_il_enum(interror, "OMX_Error")

        if (expectstr == err):
            if (interror == OMX_ErrorNone):
                context.handles[alias]                        = handle
                context.cnames2[handle.value]                 = name
                context.cmdevents[handle.value]               = threading.Event()
                context.eosevents[handle.value]               = threading.Event()
                context.settings_changed_events[handle.value] = threading.Event()
                context.format_detected_events[handle.value]  = threading.Event()
                context.error_events[handle.value]            = []
                context.ignored_error_events[handle.value]    = []
            else:
                context.handles[alias] = OMX_HANDLETYPE()
            log_result (element.tag, err)
            return 0
        else:
            log_result (element.tag, err)
            return interror
コード例 #28
0
    def run(self, element, context):
        alias = element.get('alias')
        name = context.cnames[alias]
        log_api("%s '%s'" % (element.tag, name))
        handle = context.handles[alias]
        cname = (c_ubyte * OMX_MAX_STRINGNAME_SIZE)()
        cversion = OMX_VERSIONTYPE()
        specversion = OMX_VERSIONTYPE()
        cuuid = OMX_UUIDTYPE()
        if (handle != None):
            omxerror = OMX_GetComponentVersion(handle,
                                               cast(cname, POINTER(c_char)),
                                               byref(cversion),
                                               byref(specversion),
                                               byref(cuuid))
            interror = int(omxerror & 0xffffffff)

            err = get_string_from_il_enum(interror, "OMX_Error")

            log_line()
            msg = "Component Name : " + cast(cname, c_char_p).value
            log_line(msg, 1)

            log_line()
            log_line("Component Version", 1)
            for name, _ in struct_anon_1._fields_:
                log_param(name, str(getattr(cversion.s, name)), 2)

            log_line()
            log_line("Spec Version", 1)
            for name, _ in struct_anon_1._fields_:
                log_param(name, str(getattr(specversion.s, name)), 2)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #29
0
    def run(self, element, context):
        alias        = element.get('alias')
        name         = context.cnames[alias]
        portstr      = element.get('port')
        allocatorstr = element.get('allocator')
        modestr      = element.get('mode')
        uristr       = element.get('uri')

        log_api ("%s %s:Port-%d' 'Allocator:%s' 'Mode:%s' 'Uri:%s'" \
                     % (element.tag, name, int(portstr),           \
                            allocatorstr, modestr, uristr))

        context.base_profile_mgr.manage_port(alias, portstr, allocatorstr,
                                             modestr, uristr)

        log_result (element.tag, "OMX_ErrorNone")

        return 0
コード例 #30
0
    def run(self, element, context):
        alias  = element.get('alias')
        name   = context.cnames[alias]
        log_api ("%s '%s'" % (element.tag, name))
        handle = context.handles[alias]
        cname = (c_ubyte * OMX_MAX_STRINGNAME_SIZE)()
        cversion = OMX_VERSIONTYPE()
        specversion = OMX_VERSIONTYPE()
        cuuid = OMX_UUIDTYPE()
        if (handle != None):
            omxerror = OMX_GetComponentVersion(handle, cast(cname, POINTER(c_char)),
                                               byref(cversion),
                                               byref(specversion),
                                               byref(cuuid))
            interror = int(omxerror & 0xffffffff)

            err = get_string_from_il_enum(interror, "OMX_Error")

            log_line ()
            msg = "Component Name : " + cast(cname, c_char_p).value
            log_line (msg, 1)

            log_line ()
            log_line ("Component Version", 1)
            for name, _ in struct_anon_1._fields_:
                log_param (name, str(getattr(cversion.s, name)), 2)

            log_line ()
            log_line ("Spec Version", 1)
            for name, _ in struct_anon_1._fields_:
                log_param (name, str(getattr(specversion.s, name)), 2)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #31
0
ファイル: OMX_GetContentURI.py プロジェクト: a06kin/skema
    def run(self, element, context):
        indexstr = "OMX_IndexParamContentURI"
        alias = element.get('alias')
        name = context.cnames[alias]
        log_api ("%s '%s' '%s'" \
                       % (element.tag, indexstr, name))
        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_CONTENTURITYPE
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            uristr = c_char_p()
            uristr = cast(param_struct.contentURI, c_char_p)

            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "URI"):
                    log_param (name, uristr.value, 1)
                else:
                    log_param (name, str(getattr(param_struct, name)), 1)

            log_result (element.tag, err)
            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #32
0
ファイル: OMX_StartSubProcess.py プロジェクト: tizonia/skema
    def run(self, element, context):
        alias = element.get('alias')
        cmdlinestr = element.get('cmdline')

        # Replace '$USER' and '$HOME' strings wih the actual representations
        cmdlinestr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], cmdlinestr, 0)
        cmdlinestr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], cmdlinestr, 0)

        log_api ("%s '%s' '%s'" \
            % (element.tag, alias, cmdlinestr))

        args = shlex.split(cmdlinestr)
        process = Popen(args)
        context.subprocesses[alias] = process

        log_line ()
        msg = "Started sub-process '" + alias + "' with PID " + str(context.subprocesses[alias].pid)
        log_result (msg, "OMX_ErrorNone")

        return 0
コード例 #33
0
ファイル: OMX_IgnoreError.py プロジェクト: tizonia/skema
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        errstr = element.get('err')
        ndata2str = element.get('ndata2')
        log_api ("%s '%s' '%s' '%s'" \
            % (element.tag, name, errstr, ndata2str))
        handle = context.handles[alias]
        err = get_il_enum_from_string(errstr)
        # TODO: Check we are receiving an error code
        #err = get_string_from_il_enum(interror, "OMX_Error")

        if (handle != None):
            context.ignored_error_events[handle.value].append(err)
        else:
            log_line ()
            log_line ("Unknown handle")
            return get_il_enum_from_string("OMX_ErrorUndefined")

        return 0
コード例 #34
0
ファイル: OMX_FreeHandle.py プロジェクト: a06kin/skema
    def run(self, element, context):
        alias = element.get('alias')
        log_api ("%s '%s'" \
                       % (element.tag, context.cnames[alias]))
        handle = context.handles[alias]
        if (handle != None):
            omxerror = OMX_FreeHandle(handle)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_result(element.tag, err)
            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #35
0
ファイル: OMX_FreeHandle.py プロジェクト: tizonia/skema
    def run(self, element, context):
        alias = element.get('alias')
        log_api ("%s '%s'" \
                       % (element.tag, context.cnames[alias]))
        handle = context.handles[alias]
        if (handle != None):
            omxerror = OMX_FreeHandle(handle)
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_result (element.tag, err)
            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #36
0
ファイル: OMX_IgnoreError.py プロジェクト: a06kin/skema
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        errstr = element.get('err')
        ndata2str = element.get('ndata2')
        log_api ("%s '%s' '%s' '%s'" \
            % (element.tag, name, errstr, ndata2str))
        handle = context.handles[alias]
        err = get_il_enum_from_string(errstr)
        # TODO: Check we are receiving an error code
        #err = get_string_from_il_enum(interror, "OMX_Error")

        if (handle != None):
            context.ignored_error_events[handle.value].append(err)
        else:
            log_line()
            log_line("Unknown handle")
            return get_il_enum_from_string("OMX_ErrorUndefined")

        return 0
コード例 #37
0
    def run(self, element, context):
        alias = element.get('alias')
        cmdlinestr = element.get('cmdline')

        # Replace '$USER' and '$HOME' strings wih the actual representations
        cmdlinestr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], cmdlinestr, 0)
        cmdlinestr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], cmdlinestr, 0)

        log_api ("%s '%s' '%s'" \
            % (element.tag, alias, cmdlinestr))

        args = shlex.split(cmdlinestr)
        process = Popen(args)
        context.subprocesses[alias] = process

        log_line ()
        msg = "Started sub-process '" + alias + "' with PID " + str(context.subprocesses[alias].pid)
        log_result (msg, "OMX_ErrorNone")

        return 0
コード例 #38
0
ファイル: event.py プロジェクト: minlunlee/skema
def my_evt_hdler(a, b, c, d, e, f):
    evtstr = get_string_from_il_enum(c, "OMX_Event")
    config = get_config()
    name = str()
    name = config.cnames2[a]

    if (c == OMX_EventCmdComplete):
        config.cmdevents[a].set()
        cmdstr = get_string_from_il_enum(d, "OMX_Command")
        if (d == OMX_CommandStateSet):
            statestr = get_string_from_il_enum(e, "OMX_State")
            log_line ()
            log_api("EventHandler '%s'" % (name))
            log_line ()
            log_line ("Received -> '%s' '%s' '%s'" \
                            % (evtstr, cmdstr, statestr), 1)
    elif (c == OMX_EventBufferFlag):
        config.eosevents[a].set()
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d'" \
                        % (evtstr, d), 1)
    elif (c == OMX_EventPortSettingsChanged):
        config.settings_changed_events[a].set()
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d'" \
                        % (evtstr, d), 1)

    return 0
コード例 #39
0
ファイル: OMX_BaseProfilePort.py プロジェクト: tizonia/skema
    def run(self, element, context):
        alias        = element.get('alias')
        name         = context.cnames[alias]
        portstr      = element.get('port')
        allocatorstr = element.get('allocator')
        modestr      = element.get('mode')
        uristr       = element.get('uri')

        # Replace '$USER' and '$HOME' strings wih the actual representations
        uristr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], uristr, 1)
        uristr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], uristr, 1)

        log_api ("%s %s:Port-%d' 'Allocator:%s' 'Mode:%s' 'Uri:%s'" \
                     % (element.tag, name, int(portstr),           \
                            allocatorstr, modestr, uristr))

        context.base_profile_mgr.manage_port(alias, portstr, allocatorstr,
                                             modestr, uristr)

        log_result (element.tag, "OMX_ErrorNone")

        return 0
コード例 #40
0
    def run(self, element, context):
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')
        allocatorstr = element.get('allocator')
        modestr = element.get('mode')
        uristr = element.get('uri')

        # Replace '$USER' and '$HOME' strings wih the actual representations
        uristr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], uristr, 1)
        uristr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], uristr, 1)

        log_api ("%s %s:Port-%d' 'Allocator:%s' 'Mode:%s' 'Uri:%s'" \
                     % (element.tag, name, int(portstr),           \
                            allocatorstr, modestr, uristr))

        context.base_profile_mgr.manage_port(alias, portstr, allocatorstr,
                                             modestr, uristr)

        log_result(element.tag, "OMX_ErrorNone")

        return 0
コード例 #41
0
def my_evt_hdler(a, b, c, d, e, f):
    evtstr = get_string_from_il_enum(c, "OMX_Event")
    config = get_config()
    name = str()
    name = config.cnames2[a]

    if (c == OMX_EventCmdComplete):
        config.cmdevents[a].set()
        cmdstr = get_string_from_il_enum(d, "OMX_Command")
        if (d == OMX_CommandStateSet):
            statestr = get_string_from_il_enum(e, "OMX_State")
            log_line()
            log_api("EventHandler '%s'" % (name))
            log_line()
            log_line ("Received -> '%s' '%s' '%s'"         \
                            % (evtstr, cmdstr, statestr), 1)
    elif (c == OMX_EventBufferFlag):
        config.eosevents[a].set()
        log_line()
        log_api("EventHandler '%s'" % (name))
        log_line()
        log_line ("Received -> '%s' Port '%d'"             \
                        % (evtstr, d), 1)
    elif (c == OMX_EventPortSettingsChanged):
        config.settings_changed_events[a].set()
        idxstr = get_string_from_il_enum(e, "OMX_Index")
        log_line()
        log_api("EventHandler '%s'" % (name))
        log_line()
        log_line ("Received -> '%s' Port '%d' Index '%s'"             \
                  % (evtstr, d, idxstr), 1)


#         if name == "OMX.Aratelia.video_decoder.vp8" and d == 0:
#             os.kill(PID, signal.SIGUSR1)
    elif (c == OMX_EventPortFormatDetected):
        config.format_detected_events[a].set()
        log_line()
        log_api("EventHandler '%s'" % (name))
        log_line()
        log_line ("Received -> '%s' Port '%d'"             \
                        % (evtstr, d), 1)
    elif (c == OMX_EventError):
        interror = int(d & 0xffffffff)
        log_line()
        log_api("EventHandler '%s'" % (name))
        log_line()
        log_line ("Received -> '%s' '%s' Port '%d'"        \
                  % (evtstr, get_string_from_il_enum(interror, "OMX_Error"), e), 1)
        if len(config.ignored_error_events) != 0:
            if interror in config.ignored_error_events[a]:
                log_line ("Ignored -> '%s' '%s' Port '%d'" \
                          % (evtstr, get_string_from_il_enum(interror, "OMX_Error"), e), 1)
            else:
                config.error_events[a].append(interror)
        else:
            config.error_events[a].append(interror)
    else:
        log_line()
        log_api("EventHandler '%s'" % (name))
        log_line()
        log_line ("Received -> '%s' Port '%d'"      \
                  % (evtstr, d), 1)

    return 0
コード例 #42
0
ファイル: OMX_SetComponentRole.py プロジェクト: a06kin/skema
    def run(self, element, context):
        indexstr = "OMX_IndexParamStandardComponentRole"
        alias = element.get('alias')
        name = context.cnames[alias]
        rolestr = element.get('role')

        log_api ("%s '%s' '%s'" \
                        % (element.tag, name, rolestr))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_COMPONENTROLETYPE
        param_struct = param_type()
        param_struct.nVersion.nVersion = OMX_VERSION
        param_struct.nSize = sizeof(param_type)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, _ in param_type._fields_:
                for name2, val2 in element.items():
                    if (name != "cRole"):
                        if (name2 == name):
                            setattr(param_struct, name, int(val2))
                    else:
                        libc = CDLL('libc.so.6')
                        libc.strcpy(cast(param_struct.cRole, c_char_p),
                                    rolestr)

            omxerror = OMX_SetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            rolefield = c_char_p()
            rolefield = cast(param_struct.cRole, c_char_p)

            log_line()
            log_line("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "cRole"):
                    log_param(name, rolefield.value, 1)
                else:
                    log_param(name, str(getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #43
0
    def run(self, element, context):
        alias = element.get('comp')
        name = context.cnames[alias]
        evtstr = element.get('evt')
        ndata1str = element.get('ndata1')
        ndata2str = element.get('ndata2')
        timeoutstr = element.get('timeout')
        log_api ("%s '%s' '%s' '%s' '%s'" \
            % (element.tag, name, evtstr, ndata1str, ndata2str))
        handle = context.handles[alias]
        evt = get_il_enum_from_string(evtstr)
        #ndata1 = get_il_enum_from_string(ndata1str)

        if (handle != None):
            if (evt == OMX_EventCmdComplete):
                if (context.cmdevents[handle.value].is_set()):
                    context.cmdevents[handle.value].clear()
                    log_line()
                    log_line ("%s '%s' '%s' '%s' was received OK"     \
                                    % (element.tag, name, evtstr, ndata2str), 1)
                else:
                    log_line()
                    log_line ("%s Waiting for '%s' '%s' from '%s'"    \
                                    % (element.tag, evtstr, ndata2str, name), 1)
                    context.cmdevents[handle.value].wait(int(timeoutstr))
                    if (context.cmdevents[handle.value].is_set()):
                        log_line()
                        log_line ("%s '%s' '%s' '%s' received OK"     \
                                      % (element.tag, name, evtstr, ndata2str))
                    elif len(context.error_events) \
                         and context.error_events[handle.value]:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "'"
                        log_line()
                        interror = 0
                        for interror in context.error_events[handle.value]:
                            log_result(
                                msg,
                                get_string_from_il_enum(interror, "OMX_Error"))
                        return interror
                    else:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "' " + ndata2str + "'"
                        log_line()
                        log_result(msg, "OMX_ErrorTimeout")
                        return get_il_enum_from_string("OMX_ErrorTimeout")

            elif (evt == OMX_EventBufferFlag):
                if (context.eosevents[handle.value].is_set()):
                    context.eosevents[handle.value].clear()
                    log_line()
                    log_line ("%s '%s' '%s' was received OK"          \
                                    % (element.tag, name, evtstr), 1)
                else:
                    log_line()
                    log_line ("%s Waiting for '%s' from '%s'"         \
                                    % (element.tag, evtstr, name), 1)
                    context.eosevents[handle.value].wait(int(timeoutstr))
                    if (context.eosevents[handle.value].is_set()):
                        log_line()
                        log_line ("%s '%s' '%s' received OK"          \
                                        % (element.tag, name, evtstr))
                    elif len(context.error_events) != 0:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "'"
                        log_line()
                        interror = context.error_events[handle.value][0]
                        log_result(
                            msg,
                            get_string_from_il_enum(interror, "OMX_Error"))
                        return interror
                    else:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "'"
                        log_line()
                        log_result(msg, "OMX_ErrorTimeout")
                        return get_il_enum_from_string("OMX_ErrorTimeout")

            elif (evt == OMX_EventPortSettingsChanged):
                if (context.settings_changed_events[handle.value].is_set()):
                    context.settings_changed_events[handle.value].clear()
                    log_line()
                    log_line ("%s '%s' '%s' was received OK"            \
                                    % (element.tag, name, evtstr), 1)
                else:
                    log_line()
                    log_line ("%s Waiting for '%s' from '%s'"           \
                                    % (element.tag, evtstr, name), 1)
                    context.settings_changed_events[handle.value].      \
                        wait(int(timeoutstr))
                    if (context.settings_changed_events[handle.value].is_set()
                        ):
                        log_line()
                        log_line ("%s '%s' '%s' received OK"            \
                                        % (element.tag, name, evtstr))
                    elif len(context.error_events) != 0:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "'"
                        log_line()
                        interror = context.error_events[handle.value][0]
                        log_result(
                            msg,
                            get_string_from_il_enum(interror, "OMX_Error"))
                        return interror
                    else:
                        msg = element.tag + " '" + name + "' " + " '" + \
                            evtstr + "'"
                        log_line()
                        log_result(msg, "OMX_ErrorTimeout")
                        return get_il_enum_from_string("OMX_ErrorTimeout")

            elif (evt == OMX_EventPortFormatDetected):
                if (context.format_detected_events[handle.value].is_set()):
                    context.format_detected_events[handle.value].clear()
                    log_line()
                    log_line ("%s '%s' '%s' was received OK"            \
                                    % (element.tag, name, evtstr), 1)
                else:
                    log_line()
                    log_line ("%s Waiting for '%s' from '%s'"           \
                                    % (element.tag, evtstr, name), 1)
                    context.format_detected_events[handle.value].      \
                        wait(int(timeoutstr))
                    if (context.format_detected_events[handle.value].is_set()):
                        log_line()
                        log_line ("%s '%s' '%s' received OK"            \
                                        % (element.tag, name, evtstr))
                    elif len(context.error_events) != 0:
                        msg = element.tag + " '" + name + "' " + " '" \
                            + evtstr + "'"
                        log_line()
                        interror = context.error_events[handle.value][0]
                        log_result(
                            msg,
                            get_string_from_il_enum(interror, "OMX_Error"))
                        return interror
                    else:
                        msg = element.tag + " '" + name + "' " + " '" + \
                            evtstr + "'"
                        log_line()
                        log_result(msg, "OMX_ErrorTimeout")
                        return get_il_enum_from_string("OMX_ErrorTimeout")
            else:
                log_line()
                log_line("Unhandled event %s" % (evtstr))
                return get_il_enum_from_string("OMX_ErrorNotImplemented")
        else:
            log_line()
            log_line("Unknown handle")
            return get_il_enum_from_string("OMX_ErrorUndefined")

        return 0
コード例 #44
0
    def run(self, element, context):
        indexstr = "OMX_IndexParamStandardComponentRole"
        alias = element.get('alias')
        name = context.cnames[alias]
        rolestr = element.get('role')

        log_api ("%s '%s' '%s'" \
                        % (element.tag, name, rolestr))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_COMPONENTROLETYPE
        param_struct = param_type()
        param_struct.nVersion.nVersion = OMX_VERSION
        param_struct.nSize = sizeof(param_type)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, _ in param_type._fields_:
                for name2, val2 in element.items():
                    if (name != "cRole"):
                        if (name2 == name):
                            setattr(param_struct, name, int(val2))
                    else:
                        libc = CDLL('libc.so.6')
                        libc.strcpy(cast(param_struct.cRole, c_char_p),
                                    rolestr)

            omxerror = OMX_SetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            rolefield = c_char_p()
            rolefield = cast(param_struct.cRole, c_char_p)

            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "cRole"):
                    log_param (name, rolefield.value, 1)
                else:
                    log_param (name, str(getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #45
0
ファイル: event.py プロジェクト: tizonia/skema
def my_evt_hdler(a, b, c, d, e, f):
    evtstr = get_string_from_il_enum(c, "OMX_Event")
    config = get_config()
    name = str()
    name = config.cnames2[a]

    if (c == OMX_EventCmdComplete):
        config.cmdevents[a].set()
        cmdstr       = get_string_from_il_enum(d, "OMX_Command")
        if (d == OMX_CommandStateSet):
            statestr = get_string_from_il_enum(e, "OMX_State")
            log_line ()
            log_api("EventHandler '%s'" % (name))
            log_line ()
            log_line ("Received -> '%s' '%s' '%s'"         \
                            % (evtstr, cmdstr, statestr), 1)
    elif (c == OMX_EventBufferFlag):
        config.eosevents[a].set()
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d'"             \
                        % (evtstr, d), 1)
    elif (c == OMX_EventPortSettingsChanged):
        config.settings_changed_events[a].set()
        idxstr = get_string_from_il_enum(e, "OMX_Index")
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d' Index '%s'"             \
                        % (evtstr, d, idxstr), 1)
    elif (c == OMX_EventPortFormatDetected):
        config.format_detected_events[a].set()
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d'"             \
                        % (evtstr, d), 1)
    elif (c == OMX_EventError):
        interror     = int(d & 0xffffffff)
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' '%s' Port '%d'"        \
                  % (evtstr, get_string_from_il_enum(interror, "OMX_Error"), e), 1)
        if len(config.ignored_error_events) != 0:
            if interror in config.ignored_error_events[a]:
                log_line ("Ignored -> '%s' '%s' Port '%d'" \
                          % (evtstr, get_string_from_il_enum(interror, "OMX_Error"), e), 1)
            else:
                config.error_events[a].append(interror)
        else:
            config.error_events[a].append(interror)
    else:
        log_line ()
        log_api("EventHandler '%s'"  % (name))
        log_line ()
        log_line ("Received -> '%s' Port '%d'"      \
                  % (evtstr, d), 1)

    return 0
コード例 #46
0
ファイル: OMX_GetParameter.py プロジェクト: tizonia/skema
    def run(self, element, context):
        indexstr = element.get('index')
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')
        log_api ("%s '%s' '%s:Port-%d'" \
                       "" % (element.tag, indexstr, name, int(portstr)))
        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)

        param_type         = omxil12_indexes[indexstr]
        param_struct       = param_type()
        param_struct.nSize = sizeof(param_type)

        if (portstr != None):
            param_struct.nPortIndex = int(portstr)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                        % (name, param_struct.nVersion.nVersion),1)
                elif (name == "eDir"):
                    dirstr = get_string_from_il_enum (\
                            getattr(param_struct, name), "OMX_Dir")
                    log_param (name, dirstr, 1)
                elif (name == "eDomain"):
                    domstr = get_string_from_il_enum (\
                                getattr(param_struct, name), "OMX_PortDomain")
                    log_line ("%s -> '%s'" % (name, domstr),1)
                elif (name == "format"):

                    if (domstr == "OMX_PortDomainAudio"):
                        param2_type = OMX_AUDIO_PORTDEFINITIONTYPE
                        decode_audio_portdef (param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainVideo"):
                        param2_type = OMX_VIDEO_PORTDEFINITIONTYPE
                        decode_video_portdef (param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainImage"):
                        param2_type = OMX_IMAGE_PORTDEFINITIONTYPE
                        decode_image_portdef (param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainOther"):
                        param2_type = OMX_OTHER_PORTDEFINITIONTYPE
                        decode_other_portdef (param_struct, param2_type)

                else:
                    log_line ("%s -> '%s'" \
                        % (name, getattr(param_struct, name)),1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]),1)
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #47
0
    def run(self, element, context):
        indexstr = "OMX_IndexParamContentURI"
        uristr = element.get('uri')
        alias = element.get('alias')
        name = context.cnames[alias]

        # Replace '$USER' and '$HOME' strings wih the actual representations
        uristr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], uristr, 1)
        uristr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], uristr, 1)

        log_api ("%s '%s' '%s' '%s'" \
                       % (element.tag, indexstr, name, uristr))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_CONTENTURITYPE
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, _ in param_type._fields_:
                for name2, val2 in element.items():
                    if (name != "contentURI"):
                        if (name2 == name):
                            setattr(param_struct, name, int(val2))
                    else:
                        libc = CDLL('libc.so.6')
                        libc.strcpy(cast(param_struct.contentURI, c_char_p),
                                    uristr)

            omxerror = OMX_SetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            urifield = c_char_p()
            urifield = cast(param_struct.contentURI, c_char_p)

            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "contentURI"):
                    log_param (name, urifield.value, 1)
                else:
                    log_param (name, str(getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                          % (element.tag, \
                                 "Could not find handle for", \
                                 context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #48
0
ファイル: OMX_SetContentURI.py プロジェクト: tizonia/skema
    def run(self, element, context):
        indexstr = "OMX_IndexParamContentURI"
        uristr = element.get('uri')
        alias = element.get('alias')
        name = context.cnames[alias]

        # Replace '$USER' and '$HOME' strings wih the actual representations
        uristr = re.sub("\$USER", pwd.getpwuid(os.getuid())[0], uristr, 1)
        uristr = re.sub("\$HOME", pwd.getpwuid(os.getuid())[5], uristr, 1)

        log_api ("%s '%s' '%s' '%s'" \
                       % (element.tag, indexstr, name, uristr))

        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)
        param_type = OMX_PARAM_CONTENTURITYPE
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            for name, _ in param_type._fields_:
                for name2, val2 in element.items():
                    if (name != "contentURI"):
                        if (name2 == name):
                            setattr(param_struct, name, int(val2))
                    else:
                        libc = CDLL('libc.so.6')
                        libc.strcpy(cast(param_struct.contentURI, c_char_p),
                                    uristr)

            omxerror = OMX_SetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")

            urifield = c_char_p()
            urifield = cast(param_struct.contentURI, c_char_p)

            log_line ()
            log_line ("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                                    % (name, param_struct.nVersion.nVersion), 1)
                elif (name == "contentURI"):
                    log_param (name, urifield.value, 1)
                else:
                    log_param (name, str(getattr(param_struct, name)), 1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                          % (element.tag, \
                                 "Could not find handle for", \
                                 context.cnames[alias]))
            return get_il_enum_from_string("OMX_ErrorUndefined")
コード例 #49
0
    def run(self, element, context):
        indexstr = element.get('index')
        alias = element.get('alias')
        name = context.cnames[alias]
        portstr = element.get('port')
        log_api ("%s '%s' '%s:Port-%d'" \
                       "" % (element.tag, indexstr, name, int(portstr)))
        handle = context.handles[alias]
        index = get_il_enum_from_string(indexstr)

        param_type = omxil12_indexes[indexstr]
        param_struct = param_type()
        param_struct.nSize = sizeof(param_type)

        if (portstr != None):
            param_struct.nPortIndex = int(portstr)

        if (handle != None):
            omxerror = OMX_GetParameter(handle, index, byref(param_struct))
            interror = int(omxerror & 0xffffffff)
            err = get_string_from_il_enum(interror, "OMX_Error")
            log_line()
            log_line("%s" % param_struct.__class__.__name__, 1)
            for name, _ in param_type._fields_:
                if (name == "nVersion"):
                    log_line ("%s -> '%08x'" \
                        % (name, param_struct.nVersion.nVersion),1)
                elif (name == "eDir"):
                    dirstr = get_string_from_il_enum (\
                            getattr(param_struct, name), "OMX_Dir")
                    log_param(name, dirstr, 1)
                elif (name == "eDomain"):
                    domstr = get_string_from_il_enum (\
                                getattr(param_struct, name), "OMX_PortDomain")
                    log_line("%s -> '%s'" % (name, domstr), 1)
                elif (name == "format"):

                    if (domstr == "OMX_PortDomainAudio"):
                        param2_type = OMX_AUDIO_PORTDEFINITIONTYPE
                        decode_audio_portdef(param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainVideo"):
                        param2_type = OMX_VIDEO_PORTDEFINITIONTYPE
                        decode_video_portdef(param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainImage"):
                        param2_type = OMX_IMAGE_PORTDEFINITIONTYPE
                        decode_image_portdef(param_struct, param2_type)
                    elif (domstr == "OMX_PortDomainOther"):
                        param2_type = OMX_OTHER_PORTDEFINITIONTYPE
                        decode_other_portdef(param_struct, param2_type)

                else:
                    log_line ("%s -> '%s'" \
                        % (name, getattr(param_struct, name)),1)

            log_result(element.tag, err)

            if (err == "OMX_ErrorNone"):
                return 0
            else:
                return interror

        else:
            log_line ("%s -> '%s %s'" \
                % (element.tag, \
                       "Could not find handle for", context.cnames[alias]),1)
            return get_il_enum_from_string("OMX_ErrorUndefined")