// Display function. public override void Display(MHEngine engine) { if (!RunningStatus) { return; } if (m_nBoxWidth == 0 || m_nBoxHeight == 0) { return; // Can't draw zero sized boxes. } // The bounding box is assumed always to be True. MHRgba lineColour = GetColour(m_LineColour); MHRgba fillColour = GetColour(m_FillColour); IMHContext d = engine.GetContext(); // Fill the centre. if (m_nBoxHeight < m_nLineWidth * 2 || m_nBoxWidth < m_nLineWidth * 2) { // If the area is very small but non-empty fill it with the line colour d.DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight, lineColour); } else { d.DrawRect(m_nPosX + m_nLineWidth, m_nPosY + m_nLineWidth, m_nBoxWidth - m_nLineWidth * 2, m_nBoxHeight - m_nLineWidth * 2, fillColour); // Draw the lines round the outside. UK MHEG allows us to treat all line styles as solid. // It isn't clear when we draw dashed and dotted lines what colour to put in the spaces. d.DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nLineWidth, lineColour); d.DrawRect(m_nPosX, m_nPosY + m_nBoxHeight - m_nLineWidth, m_nBoxWidth, m_nLineWidth, lineColour); d.DrawRect(m_nPosX, m_nPosY + m_nLineWidth, m_nLineWidth, m_nBoxHeight - m_nLineWidth * 2, lineColour); d.DrawRect(m_nPosX + m_nBoxWidth - m_nLineWidth, m_nPosY + m_nLineWidth, m_nLineWidth, m_nBoxHeight - m_nLineWidth * 2, lineColour); } }
public override void StopPlaying(MHEngine engine) { m_fStreamPlaying = false; if (m_fRunning) { engine.GetContext().StopVideo(); } }
public override void Deactivation(MHEngine engine) { if (!m_fRunning) { return; } base.Deactivation(engine); if (m_fStreamPlaying) { engine.GetContext().StopVideo(); } }
public virtual void WhoAmI(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Return a concatenation of the strings we respond to in // GetEngineSupport(UKEngineProfile(X)) if (args.Size == 1) { MHOctetString result = new MHOctetString(); result.Copy(MHEngine.MHEGEngineProviderIdString); result.Append(" "); result.Append(engine.GetContext().GetReceiverId()); result.Append(" "); result.Append(engine.GetContext().GetDSMCCId()); engine.FindObject((args.GetAt(0).GetReference())).SetVariableValue(new MHUnion(result)); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }
public override void BeginPlaying(MHEngine engine) { m_fStreamPlaying = true; if (m_fRunning && m_streamContentRef.IsSet()) { string stream = ""; MHOctetString str = m_streamContentRef.ContentRef; if (str.Size != 0) { stream = str.ToString(); } engine.GetContext().BeginVideo(stream, m_nComponentTag); } }
public virtual void SI_TuneIndex(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Tunes to an index returned by GSI if (args.Size == 1) { int nChannel = GetInt(args.GetAt(0), engine); bool res = engine.GetContext().TuneTo(nChannel); SetSuccessFlag(success, res, engine); } else { SetSuccessFlag(success, false, engine); } }
// Display function. public override void Display(MHEngine engine) { if (!RunningStatus || m_pDisplay == null || m_nBoxWidth == 0 || m_nBoxHeight == 0) { return; // Can't draw zero sized boxes. } // We only need to recreate the display if something has changed. if (m_NeedsRedraw) { Redraw(); m_NeedsRedraw = false; } // Draw the background first, then the text. engine.GetContext().DrawRect(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight, GetColour(m_bgColour)); m_pDisplay.Draw(m_nPosX, m_nPosY); }
// Deactivation for Audio is defined in the corrigendum public override void Deactivation(MHEngine engine) { if (!m_fRunning) { return; } m_fRunning = false; // Stop presenting the audio if (m_fStreamPlaying) { engine.GetContext().StopAudio(); } base.Deactivation(engine); }
public override void Activation(MHEngine engine) { if (m_fRunning) { return; } base.Activation(engine); if (m_fStreamPlaying && m_streamContentRef.IsSet()) { string stream = ""; MHOctetString str = m_streamContentRef.ContentRef; if (str.Size != 0) { stream = str.ToString(); } engine.GetContext().BeginVideo(stream, m_nComponentTag); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Tiling - optional MHParseNode pTiling = p.GetNamedArg(ASN1Codes.C_TILING); if (pTiling != null) { m_fTiling = pTiling.GetArgN(0).GetBoolValue(); } // Transparency - optional MHParseNode pTransparency = p.GetNamedArg(ASN1Codes.C_ORIGINAL_TRANSPARENCY); if (pTransparency != null) { m_nOrigTransparency = pTransparency.GetArgN(0).GetIntValue(); } m_pContent = engine.GetContext().CreateBitmap(m_fTiling); }
public override void Display(MHEngine engine) { if (!m_fRunning) { return; } if (m_nBoxWidth == 0 || m_nBoxHeight == 0) { return; // Can't draw zero sized boxes. } // The bounding box is assumed always to be True. // The full screen video is displayed in this rectangle. It is therefore scaled to // m_nDecodeWidth/720 by m_nDecodeHeight/576. Rectangle videoRect = new Rectangle(m_nPosX + m_nXDecodeOffset, m_nPosY + m_nYDecodeOffset, m_nDecodeWidth, m_nDecodeHeight); Rectangle displayRect = videoRect; displayRect.Intersect(new Rectangle(m_nPosX, m_nPosY, m_nBoxWidth, m_nBoxHeight)); engine.GetContext().DrawVideo(videoRect, displayRect); }
public virtual void SI_GetServiceIndex(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Returns an index indicating the service if (args.Size == 2) { MHOctetString str = new MHOctetString(); GetString(args.GetAt(0), str, engine); MHParameter pResInt = args.GetAt(1); // The format of the service is dvb://netID.[transPortID].serviceID // where the IDs are in hex. // or rec://svc/lcn/N where N is the "logical channel number" i.e. the Freeview channel. int nResult = engine.GetContext().GetChannelIndex(str.ToString()); engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(nResult)); Logging.Log(Logging.MHLogDetail, "Get service index for " + str.Printable() + " - result " + nResult); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }
// Activation for Audio is defined in the corrigendum public override void Activation(MHEngine engine) { if (m_fRunning) { return; } base.Activation(engine); // Beginning presentation is started by the Stream object. m_fRunning = true; engine.EventTriggered(this, EventIsRunning); if (m_fStreamPlaying && m_streamContentRef.IsSet()) { string stream = ""; MHOctetString str = m_streamContentRef.ContentRef; if (str.Size != 0) { stream = str.ToString(); } engine.GetContext().BeginAudio(stream, m_nComponentTag); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); m_picture = engine.GetContext().CreateDynamicLineArt(m_fBorderedBBox, GetColour(m_OrigLineColour), GetColour(m_OrigFillColour)); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Font and attributes. MHParseNode pFontBody = p.GetNamedArg(ASN1Codes.C_ORIGINAL_FONT); if (pFontBody != null) { m_OrigFont.Initialise(pFontBody.GetArgN(0), engine); } MHParseNode pFontAttrs = p.GetNamedArg(ASN1Codes.C_FONT_ATTRIBUTES); if (pFontAttrs != null) { pFontAttrs.GetArgN(0).GetStringValue(m_OriginalFontAttrs); } // Colours MHParseNode pTextColour = p.GetNamedArg(ASN1Codes.C_TEXT_COLOUR); if (pTextColour != null) { m_OriginalTextColour.Initialise(pTextColour.GetArgN(0), engine); } MHParseNode pBGColour = p.GetNamedArg(ASN1Codes.C_BACKGROUND_COLOUR); if (pBGColour != null) { m_OriginalBgColour.Initialise(pBGColour.GetArgN(0), engine); } // Character set MHParseNode pChset = p.GetNamedArg(ASN1Codes.C_CHARACTER_SET); if (pChset != null) { m_nCharSet = pChset.GetArgN(0).GetIntValue(); } // Justification MHParseNode pHJust = p.GetNamedArg(ASN1Codes.C_HORIZONTAL_JUSTIFICATION); if (pHJust != null) { m_HorizJ = pHJust.GetArgN(0).GetEnumValue(); } MHParseNode pVJust = p.GetNamedArg(ASN1Codes.C_VERTICAL_JUSTIFICATION); if (pVJust != null) { m_VertJ = pVJust.GetArgN(0).GetEnumValue(); } // Line orientation MHParseNode pLineO = p.GetNamedArg(ASN1Codes.C_LINE_ORIENTATION); if (pLineO != null) { m_LineOrientation = pLineO.GetArgN(0).GetEnumValue(); } // Start corner MHParseNode pStartC = p.GetNamedArg(ASN1Codes.C_START_CORNER); if (pStartC != null) { m_StartCorner = pStartC.GetArgN(0).GetEnumValue(); } // Text wrapping MHParseNode pTextWrap = p.GetNamedArg(ASN1Codes.C_TEXT_WRAPPING); if (pTextWrap != null) { m_fTextWrap = pTextWrap.GetArgN(0).GetBoolValue(); } m_pDisplay = engine.GetContext().CreateText(); m_NeedsRedraw = true; }