コード例 #1
0
ファイル: Stream.cpp プロジェクト: DocOnDev/mythtv
void MHStream::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHPresentable::Initialise(p, engine);
    MHParseNode *pMultiplex = p->GetNamedArg(C_MULTIPLEX);
    if (pMultiplex) {
        for (int i = 0; i < pMultiplex->GetArgCount(); i++) {
            MHParseNode *pItem = pMultiplex->GetArgN(i);
            if (pItem->GetTagNo() == C_AUDIO) {
                MHAudio *pAudio = new MHAudio;
                m_Multiplex.Append(pAudio);
                pAudio->Initialise(pItem, engine);
            }
            else if (pItem->GetTagNo() == C_VIDEO) {
                MHVideo *pVideo = new MHVideo;
                m_Multiplex.Append(pVideo);
                pVideo->Initialise(pItem, engine);
            }
            else if (pItem->GetTagNo() == C_RTGRAPHICS) {
                MHRTGraphics *pRtGraph = new MHRTGraphics;
                m_Multiplex.Append(pRtGraph);
                pRtGraph->Initialise(pItem, engine);
            }
            // Ignore unknown items
        }
    }
    MHParseNode *pStorage = p->GetNamedArg(C_STORAGE);
    if (pStorage) m_nStorage = (enum Storage) pStorage->GetArgN(0)->GetEnumValue();
    MHParseNode *pLooping = p->GetNamedArg(C_LOOPING);
    if (pLooping) m_nLooping = pLooping->GetArgN(0)->GetIntValue();
}
コード例 #2
0
void MHSetData::Initialise(MHParseNode *p, MHEngine *engine)
{
    MHElemAction::Initialise(p, engine); // Target
    MHParseNode *pContent = p->GetArgN(1);

    if (pContent->m_nNodeType == MHParseNode::PNSeq)
    {
        // Referenced content.
        m_fIsIncluded = false;
        m_fSizePresent = m_fCCPriorityPresent = false;
        m_Referenced.Initialise(pContent->GetSeqN(0), engine);

        if (pContent->GetSeqCount() > 1)
        {
            MHParseNode *pArg = pContent->GetSeqN(1);

            if (pArg->m_nNodeType == MHParseNode::PNTagged && pArg->GetTagNo() == C_NEW_CONTENT_SIZE)
            {
                MHParseNode *pVal = pArg->GetArgN(0);

                // It may be NULL as a place-holder
                if (pVal->m_nNodeType == MHParseNode::PNInt)
                {
                    m_fSizePresent = true;
                    m_ContentSize.Initialise(pVal, engine);
                }
            }
        }

        if (pContent->GetSeqCount() > 2)
        {
            MHParseNode *pArg = pContent->GetSeqN(2);

            if (pArg->m_nNodeType == MHParseNode::PNTagged && pArg->GetTagNo() == C_NEW_CONTENT_CACHE_PRIO)
            {
                MHParseNode *pVal = pArg->GetArgN(0);

                if (pVal->m_nNodeType == MHParseNode::PNInt)
                {
                    m_fCCPriorityPresent = true;
                    m_CCPriority.Initialise(pVal, engine);
                }
            }
        }
    }
    else
    {
        m_Included.Initialise(pContent, engine);
        m_fIsIncluded = true;
    }
}
コード例 #3
0
ファイル: Engine.cpp プロジェクト: matt-schrader/mythtv
// Convert the parse tree for an application or scene into an object node.
MHGroup *MHEngine::ParseProgram(QByteArray &text)
{
    if (text.size() == 0)
    {
        return NULL;
    }

    // Look at the first byte to decide whether this is text or binary.  Binary
    // files will begin with 0xA0 or 0xA1, text files with white space, comment ('/')
    // or curly bracket.
    // This is only there for testing: all downloaded objects will be in ASN1
    unsigned char ch = text[0];
    MHParseBase *parser = NULL;
    MHParseNode *pTree = NULL;
    MHGroup *pRes = NULL;

    if (ch >= 128)
    {
        parser = new MHParseBinary(text);
    }
    else
    {
        parser = new MHParseText(text);
    }

    try
    {
        // Parse the binary or text.
        pTree = parser->Parse();

        switch (pTree->GetTagNo())   // The parse node should be a tagged item.
        {
            case C_APPLICATION:
                pRes = new MHApplication;
                break;
            case C_SCENE:
                pRes = new MHScene;
                break;
            default:
                pTree->Failure("Expected Application or Scene"); // throws exception.
        }

        pRes->Initialise(pTree, this); // Convert the parse tree.
        delete(pTree);
        delete(parser);
    }
    catch (...)
    {
        delete(parser);
        delete(pTree);
        delete(pRes);
        throw;
    }

    return pRes;
}
コード例 #4
0
ファイル: Groups.cpp プロジェクト: DragonStalker/mythtv
void MHGroup::Initialise(MHParseNode *p, MHEngine *engine)
{
    engine->GetGroupId().Copy(""); // Set to empty before we start (just in case).
    MHRoot::Initialise(p, engine);

    // Must be an external reference with an object number of zero.
    if (m_ObjectReference.m_nObjectNo != 0 || m_ObjectReference.m_GroupId.Size() == 0)
    {
        MHERROR("Object reference for a group object must be zero and external");
    }

    // Set the group id for the rest of the group to this.
    engine->GetGroupId().Copy(m_ObjectReference.m_GroupId);
    // Some of the information is irrelevant.
    //  MHParseNode *pStdId = p->GetNamedArg(C_STANDARD_IDENTIFIER);
    //  MHParseNode *pStdVersion = p->GetNamedArg(C_STANDARD_VERSION);
    //  MHParseNode *pObjectInfo = p->GetNamedArg(C_OBJECT_INFORMATION);

    MHParseNode *pOnStartUp = p->GetNamedArg(C_ON_START_UP);

    if (pOnStartUp)
    {
        m_StartUp.Initialise(pOnStartUp, engine);
    }

    MHParseNode *pOnCloseDown = p->GetNamedArg(C_ON_CLOSE_DOWN);

    if (pOnCloseDown)
    {
        m_CloseDown.Initialise(pOnCloseDown, engine);
    }

    MHParseNode *pOriginalGCPrio = p->GetNamedArg(C_ORIGINAL_GC_PRIORITY);

    if (pOriginalGCPrio)
    {
        m_nOrigGCPriority = pOriginalGCPrio->GetArgN(0)->GetIntValue();
    }

    // Ignore the other stuff at the moment.
    MHParseNode *pItems = p->GetNamedArg(C_ITEMS);

    if (pItems == NULL)
    {
        p->Failure("Missing :Items block");
        return;
    }

    for (int i = 0; i < pItems->GetArgCount(); i++)
    {
        MHParseNode *pItem = pItems->GetArgN(i);
        MHIngredient *pIngredient = NULL;

        try
        {
            // Generate the particular kind of ingredient.
            switch (pItem->GetTagNo())
            {
                case C_RESIDENT_PROGRAM:
                    pIngredient = new MHResidentProgram;
                    break;
                case C_REMOTE_PROGRAM:
                    pIngredient = new MHRemoteProgram;
                    break;
                case C_INTERCHANGED_PROGRAM:
                    pIngredient = new MHInterChgProgram;
                    break;
                case C_PALETTE:
                    pIngredient = new MHPalette;
                    break;
                case C_FONT:
                    pIngredient = new MHFont;
                    break;
                case C_CURSOR_SHAPE:
                    pIngredient = new MHCursorShape;
                    break;
                case C_BOOLEAN_VARIABLE:
                    pIngredient = new MHBooleanVar;
                    break;
                case C_INTEGER_VARIABLE:
                    pIngredient = new MHIntegerVar;
                    break;
                case C_OCTET_STRING_VARIABLE:
                    pIngredient = new MHOctetStrVar;
                    break;
                case C_OBJECT_REF_VARIABLE:
                    pIngredient = new MHObjectRefVar;
                    break;
                case C_CONTENT_REF_VARIABLE:
                    pIngredient = new MHContentRefVar;
                    break;
                case C_LINK:
                    pIngredient = new MHLink;
                    break;
                case C_STREAM:
                    pIngredient = new MHStream;
                    break;
                case C_BITMAP:
                    pIngredient = new MHBitmap;
                    break;
                case C_LINE_ART:
                    pIngredient = new MHLineArt;
                    break;
                case C_DYNAMIC_LINE_ART:
                    pIngredient = new MHDynamicLineArt;
                    break;
                case C_RECTANGLE:
                    pIngredient = new MHRectangle;
                    break;
                case C_HOTSPOT:
                    pIngredient = new MHHotSpot;
                    break;
                case C_SWITCH_BUTTON:
                    pIngredient = new MHSwitchButton;
                    break;
                case C_PUSH_BUTTON:
                    pIngredient = new MHPushButton;
                    break;
                case C_TEXT:
                    pIngredient = new MHText;
                    break;
                case C_ENTRY_FIELD:
                    pIngredient = new MHEntryField;
                    break;
                case C_HYPER_TEXT:
                    pIngredient = new MHHyperText;
                    break;
                case C_SLIDER:
                    pIngredient = new MHSlider;
                    break;
                case C_TOKEN_GROUP:
                    pIngredient = new MHTokenGroup;
                    break;
                case C_LIST_GROUP:
                    pIngredient = new MHListGroup;
                    break;
                default:
                    MHLOG(MHLogWarning, QString("Unknown ingredient %1").arg(pItem->GetTagNo()));
                    // Future proofing: ignore any ingredients that we don't know about.
                    // Obviously these can only arise in the binary coding.
            }

            if (pIngredient)
            {
                // Initialise it from its argments.
                pIngredient->Initialise(pItem, engine);

                // Remember the highest numbered ingredient
                if (pIngredient->m_ObjectReference.m_nObjectNo > m_nLastId)
                {
                    m_nLastId = pIngredient->m_ObjectReference.m_nObjectNo;
                }

                // Add it to the ingedients of this group.
                m_Items.Append(pIngredient);
            }
        }
        catch (...)
        {
            delete(pIngredient);
            throw;
        }
    }
}
コード例 #5
0
ファイル: Actions.cpp プロジェクト: DaveDaCoda/mythtv
// Process the action set and create the action values.
void MHActionSequence::Initialise(MHParseNode *p, MHEngine *engine)
{
    // Depending on the caller we may have a tagged argument list or a sequence.
    for (int i = 0; i < p->GetArgCount(); i++)
    {
        MHParseNode *pElemAction = p->GetArgN(i);
        MHElemAction *pAction;

        switch (pElemAction->GetTagNo())
        {
            case C_ACTIVATE:
                pAction = new MHActivate(":Activate", true);
                break;
            case C_ADD:
                pAction = new MHAdd;
                break;
            case C_ADD_ITEM:
                pAction = new MHAddItem;
                break;
            case C_APPEND:
                pAction = new MHAppend;
                break;
            case C_BRING_TO_FRONT:
                pAction = new MHBringToFront;
                break;
            case C_CALL:
                pAction = new MHCall(":Call", false);
                break;
            case C_CALL_ACTION_SLOT:
                pAction = new MHCallActionSlot;
                break;
            case C_CLEAR:
                pAction = new MHClear;
                break;
            case C_CLONE:
                pAction = new MHClone;
                break;
            case C_CLOSE_CONNECTION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ??
            case C_DEACTIVATE:
                pAction = new MHActivate(":Deactivate", false);
                break;
            case C_DEL_ITEM:
                pAction = new MHDelItem;
                break;
            case C_DESELECT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_DESELECT_ITEM:
                pAction = new MHDeselectItem;
                break;
            case C_DIVIDE:
                pAction = new MHDivide;
                break;
            case C_DRAW_ARC:
                pAction = new MHDrawArcSector(":DrawArc", false);
                break;
            case C_DRAW_LINE:
                pAction = new MHDrawLine;
                break;
            case C_DRAW_OVAL:
                pAction = new MHDrawOval;
                break;
            case C_DRAW_POLYGON:
                pAction = new MHDrawPoly(":DrawPolygon", true);
                break;
            case C_DRAW_POLYLINE:
                pAction = new MHDrawPoly(":DrawPolyline", false);
                break;
            case C_DRAW_RECTANGLE:
                pAction = new MHDrawRectangle;
                break;
            case C_DRAW_SECTOR:
                pAction = new MHDrawArcSector(":DrawSector", true);
                break;
            case C_FORK:
                pAction = new MHCall(":Fork", true);
                break;
            case C_GET_AVAILABILITY_STATUS:
                pAction = new MHGetAvailabilityStatus;
                break;
            case C_GET_BOX_SIZE:
                pAction = new MHGetBoxSize;
                break;
            case C_GET_CELL_ITEM:
                pAction = new MHGetCellItem;
                break;
            case C_GET_CURSOR_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_GET_ENGINE_SUPPORT:
                pAction = new MHGetEngineSupport;
                break;
            case C_GET_ENTRY_POINT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_GET_FILL_COLOUR:
                pAction = new MHGetFillColour;
                break;
            case C_GET_FIRST_ITEM:
                pAction = new MHGetFirstItem;
                break;
            case C_GET_HIGHLIGHT_STATUS:
                pAction = new MHGetHighlightStatus;
                break;
            case C_GET_INTERACTION_STATUS:
                pAction = new MHGetInteractionStatus;
                break;
            case C_GET_ITEM_STATUS:
                pAction = new MHGetItemStatus;
                break;
            case C_GET_LABEL:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// PushButton
            case C_GET_LAST_ANCHOR_FIRED:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// HyperText
            case C_GET_LINE_COLOUR:
                pAction = new MHGetLineColour;
                break;
            case C_GET_LINE_STYLE:
                pAction = new MHGetLineStyle;
                break;
            case C_GET_LINE_WIDTH:
                pAction = new MHGetLineWidth;
                break;
            case C_GET_LIST_ITEM:
                pAction = new MHGetListItem;
                break;
            case C_GET_LIST_SIZE:
                pAction = new MHGetListSize;
                break;
            case C_GET_OVERWRITE_MODE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// ?
            case C_GET_PORTION:
                pAction = new MHGetPortion;
                break;
            case C_GET_POSITION:
                pAction = new MHGetPosition;
                break;
            case C_GET_RUNNING_STATUS:
                pAction = new MHGetRunningStatus;
                break;
            case C_GET_SELECTION_STATUS:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// ?
            case C_GET_SLIDER_VALUE:
                pAction = new MHGetSliderValue;
                break;
            case C_GET_TEXT_CONTENT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break;// Text
            case C_GET_TEXT_DATA:
                pAction = new MHGetTextData;
                break;
            case C_GET_TOKEN_POSITION:
                pAction = new MHGetTokenPosition;
                break;
            case C_GET_VOLUME:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_LAUNCH:
                pAction = new MHLaunch;
                break;
            case C_LOCK_SCREEN:
                pAction = new MHLockScreen;
                break;
            case C_MODULO:
                pAction = new MHModulo;
                break;
            case C_MOVE:
                pAction = new MHMove;
                break;
            case C_MOVE_TO:
                pAction = new MHMoveTo;
                break;
            case C_MULTIPLY:
                pAction = new MHMultiply;
                break;
            case C_OPEN_CONNECTION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_PRELOAD:
                pAction = new MHPreload;
                break;
            case C_PUT_BEFORE:
                pAction = new MHPutBefore;
                break;
            case C_PUT_BEHIND:
                pAction = new MHPutBehind;
                break;
            case C_QUIT:
                pAction = new MHQuit;
                break;
            case C_READ_PERSISTENT:
                pAction = new MHPersistent(":ReadPersistent", true);
                break;
            case C_RUN:
                pAction = new MHRun;
                break;
            case C_SCALE_BITMAP:
                pAction = new MHScaleBitmap;
                break;
            case C_SCALE_VIDEO:
                pAction = new MHScaleVideo;
                break;
            case C_SCROLL_ITEMS:
                pAction = new MHScrollItems;
                break;
            case C_SELECT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_SELECT_ITEM:
                pAction = new MHSelectItem;
                break;
            case C_SEND_EVENT:
                pAction = new MHSendEvent;
                break;
            case C_SEND_TO_BACK:
                pAction = new MHSendToBack;
                break;
            case C_SET_BOX_SIZE:
                pAction = new MHSetBoxSize;
                break;
            case C_SET_CACHE_PRIORITY:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_COUNTER_END_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Stream
            case C_SET_COUNTER_POSITION:
                pAction = new MHSetCounterPosition;
                break; // Stream
            case C_SET_COUNTER_TRIGGER:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Stream
            case C_SET_CURSOR_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_CURSOR_SHAPE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_DATA:
                pAction = new MHSetData;
                break;
            case C_SET_ENTRY_POINT:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_SET_FILL_COLOUR:
                pAction = new MHSetFillColour;
                break;
            case C_SET_FIRST_ITEM:
                pAction = new MHSetFirstItem;
                break;
            case C_SET_FONT_REF:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Text
            case C_SET_HIGHLIGHT_STATUS:
                pAction = new MHSetHighlightStatus;
                break;
            case C_SET_INTERACTION_STATUS:
                pAction = new MHSetInteractionStatus;
                break;
            case C_SET_LABEL:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // PushButton
            case C_SET_LINE_COLOUR:
                pAction = new MHSetLineColour;
                break;
            case C_SET_LINE_STYLE:
                pAction = new MHSetLineStyle;
                break;
            case C_SET_LINE_WIDTH:
                pAction = new MHSetLineWidth;
                break;
            case C_SET_OVERWRITE_MODE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // EntryField
            case C_SET_PALETTE_REF:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Visible
            case C_SET_PORTION:
                pAction = new MHSetPortion;
                break;
            case C_SET_POSITION:
                pAction = new MHSetPosition;
                break;
            case C_SET_SLIDER_VALUE:
                pAction = new MHSetSliderValue;
                break;
            case C_SET_SPEED:
                pAction = new MHSetSpeed;
                break; // ?
            case C_SET_TIMER:
                pAction = new MHSetTimer;
                break;
            case C_SET_TRANSPARENCY:
                pAction = new MHSetTransparency;
                break;
            case C_SET_VARIABLE:
                pAction = new MHSetVariable;
                break;
            case C_SET_VOLUME:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SPAWN:
                pAction = new MHSpawn;
                break;
            case C_STEP:
                pAction = new MHStep;
                break;
            case C_STOP:
                pAction = new MHStop;
                break;
            case C_STORE_PERSISTENT:
                pAction = new MHPersistent(":StorePersistent", false);
                break;
            case C_SUBTRACT:
                pAction = new MHSubtract;
                break;
            case C_TEST_VARIABLE:
                pAction = new MHTestVariable;
                break;
            case C_TOGGLE:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // Button
            case C_TOGGLE_ITEM:
                pAction = new MHToggleItem;
                break;
            case C_TRANSITION_TO:
                pAction = new MHTransitionTo;
                break;
            case C_UNLOAD:
                pAction = new MHUnload;
                break;
            case C_UNLOCK_SCREEN:
                pAction = new MHUnlockScreen;
                break;
                // UK MHEG added actions.
            case C_SET_BACKGROUND_COLOUR:
                pAction = new MHSetBackgroundColour;
                break;
            case C_SET_CELL_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // ?
            case C_SET_INPUT_REGISTER:
                pAction = new MHSetInputRegister;
                break;
            case C_SET_TEXT_COLOUR:
                pAction = new MHSetTextColour;
                break;
            case C_SET_FONT_ATTRIBUTES:
                pAction = new MHSetFontAttributes;
                break;
            case C_SET_VIDEO_DECODE_OFFSET:
                pAction = new MHSetVideoDecodeOffset;
                break;
            case C_GET_VIDEO_DECODE_OFFSET:
                pAction = new MHGetVideoDecodeOffset;
                break;
            case C_GET_FOCUS_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // HyperText
            case C_SET_FOCUS_POSITION:
                pAction = new MHUnimplementedAction(pElemAction->GetTagNo());
                break; // HyperText
            case C_SET_BITMAP_DECODE_OFFSET:
                pAction = new MHSetBitmapDecodeOffset;
                break;
            case C_GET_BITMAP_DECODE_OFFSET:
                pAction = new MHGetBitmapDecodeOffset;
                break;
            case C_SET_SLIDER_PARAMETERS:
                pAction = new MHSetSliderParameters;
                break;

            // Added in ETSI ES 202 184 V2.1.1 (2010-01)
            case C_GET_COUNTER_POSITION: // Stream position
                pAction = new MHGetCounterPosition;
                break;
            case C_GET_COUNTER_MAX_POSITION: // Stream total size
                pAction = new MHGetCounterMaxPosition;
                break;

            default:
                MHLOG(MHLogWarning, QString("WARN Unknown action %1").arg(pElemAction->GetTagNo()));
                // Future proofing: ignore any actions that we don't know about.
                // Obviously these can only arise in the binary coding.
                pAction = NULL;
        }

        if (pAction)
        {
            Append(pAction); // Add to the sequence.
            pAction->Initialise(pElemAction, engine);
        }
    }
}