# Path: skema/omxil12.py
# def get_il_enum_from_string(string):
#     from skema import omxil12
#     for name, val in omxil12.__dict__.iteritems():
#         if name == string:
#             return val
#     raise AttributeError
# 
# Path: skema/omxil12.py
# def get_string_from_il_enum(enum, hint):
#     from skema import omxil12
#     for name, val in omxil12.__dict__.iteritems():
#         if enum == val:
#             if name.startswith(hint):
#                 return name
#     raise AttributeError
# 
# Path: skema/omxil12.py
# OMX_PARAM_CONTENTURITYPE = struct_OMX_PARAM_CONTENTURITYPE # OMX_Component.h: 126
# 
# Path: skema/omxil12.py
# def OMX_GetParameter(hComponent, nParamIndex, pComponentParameterStructure):
#     return ((cast(hComponent, POINTER(OMX_COMPONENTTYPE)).contents.GetParameter) (hComponent, nParamIndex, pComponentParameterStructure))
# 
# Path: skema/utils.py
# def log_api(line):
#     log_line ()
#     logging.info("")
#     log_line ()
#     logging.info("")
#     l = "[" + line  +"]"
#     logging.info(l)
#     lansi = "[skema] " + bcolors.BOLD + l + bcolors.ENDC
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_line(line="", tabs=0):
#     if (line == ""):
#         lansi = "[skema] "
#         l = ""
#     else:
#         l = ('\t' * tabs) + "[" + line + "]"
#         lansi = "[skema] " + bcolors.WARNING + l + bcolors.ENDC
#     logging.info(l)
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_param(param, val, tabs=0):
#     l = ('\t' * tabs) + "[" + param + " -> '" + val + "']"
#     lansi = "[skema] " + bcolors.WARNING + l + bcolors.ENDC
#     logging.info(l)
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_result(tag, err):
#     log_line ()
#     if (err == "OMX_ErrorNone"):
#         l = "[" + tag + " -> '" + err + "']"
#         lansi = "[skema] " + bcolors.OKGREEN + l + bcolors.ENDC
#         logging.info(l)
#     else:
#         l = "[" + tag + " -> '" + err + "']"
#         lansi = "[skema] " + bcolors.FAIL + l + bcolors.ENDC
#         logging.error(l)
# 
#     printit (lansi)


import skema.tag
from skema.omxil12 import get_il_enum_from_string
from skema.omxil12 import get_string_from_il_enum
from skema.omxil12 import OMX_PARAM_CONTENTURITYPE
from skema.omxil12 import OMX_GetParameter
from skema.utils import log_api
from skema.utils import log_line
from skema.utils import log_param
from skema.utils import log_result
from ctypes import c_char_p
from ctypes import sizeof
from ctypes import cast
from ctypes import byref
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.






class tag_OMX_GetContentURI(skema.tag.SkemaTag):
    """

    """
    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):

# Path: skema/omxil12.py
# def get_il_enum_from_string(string):
#     from skema import omxil12
#     for name, val in omxil12.__dict__.iteritems():
#         if name == string:
#             return val
#     raise AttributeError
# 
# Path: skema/omxil12.py
# def get_string_from_il_enum(enum, hint):
#     from skema import omxil12
#     for name, val in omxil12.__dict__.iteritems():
#         if enum == val:
#             if name.startswith(hint):
#                 return name
#     raise AttributeError
# 
# Path: skema/omxil12.py
# OMX_PARAM_CONTENTURITYPE = struct_OMX_PARAM_CONTENTURITYPE # OMX_Component.h: 126
# 
# Path: skema/omxil12.py
# def OMX_GetParameter(hComponent, nParamIndex, pComponentParameterStructure):
#     return ((cast(hComponent, POINTER(OMX_COMPONENTTYPE)).contents.GetParameter) (hComponent, nParamIndex, pComponentParameterStructure))
# 
# Path: skema/utils.py
# def log_api(line):
#     log_line ()
#     logging.info("")
#     log_line ()
#     logging.info("")
#     l = "[" + line  +"]"
#     logging.info(l)
#     lansi = "[skema] " + bcolors.BOLD + l + bcolors.ENDC
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_line(line="", tabs=0):
#     if (line == ""):
#         lansi = "[skema] "
#         l = ""
#     else:
#         l = ('\t' * tabs) + "[" + line + "]"
#         lansi = "[skema] " + bcolors.WARNING + l + bcolors.ENDC
#     logging.info(l)
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_param(param, val, tabs=0):
#     l = ('\t' * tabs) + "[" + param + " -> '" + val + "']"
#     lansi = "[skema] " + bcolors.WARNING + l + bcolors.ENDC
#     logging.info(l)
#     printit (lansi)
# 
# Path: skema/utils.py
# def log_result(tag, err):
#     log_line ()
#     if (err == "OMX_ErrorNone"):
#         l = "[" + tag + " -> '" + err + "']"
#         lansi = "[skema] " + bcolors.OKGREEN + l + bcolors.ENDC
#         logging.info(l)
#     else:
#         l = "[" + tag + " -> '" + err + "']"
#         lansi = "[skema] " + bcolors.FAIL + l + bcolors.ENDC
#         logging.error(l)
# 
#     printit (lansi)


# Path: skema/tags/OMX_GetContentURI.py
import skema.tag
from skema.omxil12 import get_il_enum_from_string
from skema.omxil12 import get_string_from_il_enum
from skema.omxil12 import OMX_PARAM_CONTENTURITYPE
from skema.omxil12 import OMX_GetParameter
from skema.utils import log_api
from skema.utils import log_line
from skema.utils import log_param
from skema.utils import log_result
from ctypes import c_char_p
from ctypes import sizeof
from ctypes import cast
from ctypes import byref

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.






class tag_OMX_GetContentURI(skema.tag.SkemaTag):
    """

    """
    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))