コード例 #1
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")
コード例 #2
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")
コード例 #3
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")
コード例 #4
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")
コード例 #5
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")
コード例 #6
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")
コード例 #7
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")
コード例 #8
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")
コード例 #9
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")
コード例 #10
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")