# 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_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_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/config.py
# def get_config():
#     global _config
#     if _config is not None:
#         return _config
#     _config = SkemaConfig()
#     return _config


import os
import sys
import threading
import signal
from ctypes import *
from omxil12 import *
from skema.utils import log_line
from skema.utils import log_api
from skema.utils import log_result
from skema.config import get_config
    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 ()

# 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_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_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/config.py
# def get_config():
#     global _config
#     if _config is not None:
#         return _config
#     _config = SkemaConfig()
#     return _config


# Path: skema/event.py
import os
import sys
import threading
import signal
from ctypes import *
from omxil12 import *
from skema.utils import log_line
from skema.utils import log_api
from skema.utils import log_result
from skema.config import get_config

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