3gppttstructs.h

来自「symbian 下的helix player源代码」· C头文件 代码 · 共 639 行 · 第 1/2 页

H
639
字号
private:
    UINT16                      m_uiTextLengthInBytes;
    const char*                 m_pText;
    IHXBuffer*                  m_pIHXBuff;
    //  0 or more of these
    const UINT8*                m_pTextModifierData;   
    UINT16                      m_uiTextModifiersTotalSize;


};



//STYL
class C3GPPTextStyleBox
{

public:
    
    ~C3GPPTextStyleBox();
    HX_RESULT Build(const UINT8*& pData);

    UINT16 GetEntryCount() const { return  (UINT16)m_entries.GetCount(); }
    const C3GPPStyleRecord* GetStyleRecord(UINT16 uiEntry) const
    {
        HX_ASSERT(uiEntry < m_entries.GetCount());
        return (const C3GPPStyleRecord*)m_entries.GetItem(uiEntry);
    }

private:
    void CleanUp();

private:
    SimpleArray m_entries;


};


//HLIT
class C3GPPTextHighlightBox
{
  public:
      C3GPPTextHighlightBox() : m_uiStartCharOffset(0), m_uiEndCharOffset(0) {};

      HX_RESULT Build(const UINT8*& pData)
      {
          m_uiStartCharOffset = ReadUI16(pData);
          m_uiEndCharOffset = ReadUI16(pData);
          return HXR_OK;
      }

      UINT16 GetStartOffset() const { return m_uiStartCharOffset;}
      UINT16 GetEndOffset() const { return m_uiEndCharOffset;}

  private:

    UINT16  m_uiStartCharOffset;
    UINT16  m_uiEndCharOffset;
};

//HCLR
class C3GPPTextHilightColorBox
{
  public:
      C3GPPTextHilightColorBox() : m_HighlightColorRGBA(0) {}

      HX_RESULT Build(const UINT8*& pData)
      {
          m_HighlightColorRGBA = ReadARGB(pData);
          return HXR_OK;
      }

      UINT32 GetHighlightColor() const { return m_HighlightColorRGBA; }

  private:

      // /Specifies entire sample's highlight (incl. karaoke) color:
      UINT32 m_HighlightColorRGBA;
};

//KROK
class C3GPPTextKaraokeBox
{

public:
    //KROK entry
    class C3GPPTextKaraokeControlEntry
    {
    public:
        C3GPPTextKaraokeControlEntry() 
        : m_ulHighlightEndTime(0)
        , m_uiStartCharOffset(0)
        , m_uiEndCharOffset(0) {}
           
        HX_RESULT Build(const UINT8*& pData);

        UINT16 GetStartOffset() const {return m_uiStartCharOffset; }
        UINT16 GetEndOffset() const {return m_uiEndCharOffset;}
        UINT32 GetHighlightEndTime() const {return m_ulHighlightEndTime;}
    private:
        UINT32  m_ulHighlightEndTime;
        UINT16  m_uiStartCharOffset;
        UINT16  m_uiEndCharOffset;
    };

  public:

    /*C3GPPTextKaraokeBox() 
        : m_ul1stHighlightStartTime(0) {};*/
    ~C3GPPTextKaraokeBox();
    HX_RESULT Build(const UINT8*& pData);

    UINT32 Get1stHighlightStartTime() const {return m_ul1stHighlightStartTime;}
    UINT16 GetEntryCount() const { return (UINT16)m_entries.GetCount(); }
    const C3GPPTextKaraokeControlEntry* GetKaraokeControlEntry(UINT16 uiEntry) const
    {
        HX_ASSERT(uiEntry < m_entries.GetCount());
        return (C3GPPTextKaraokeControlEntry*)m_entries.GetItem(uiEntry);
    }

private:
    void CleanUp();
private:
    UINT32 m_ul1stHighlightStartTime;
    SimpleArray m_entries;
};

//DLAY
class C3GPPTextScrollDelayBox 
{
public:
    C3GPPTextScrollDelayBox() : m_ulScrollDelay(0) {}
    HX_RESULT Build(const UINT8*& pData)
    {
        m_ulScrollDelay = ReadUL32(pData);
        return HXR_OK;
    }

    UINT32 GetScrollDelay() const { return m_ulScrollDelay; }

private:
    UINT32  m_ulScrollDelay; // /=delay after a Scroll In &/or before Scroll Out

};

// HREF
class C3GPPTextHyperTextBox
{
public:

    C3GPPTextHyperTextBox() : m_uiStartCharOffset(0), m_uiEndCharOffset(0) {}
    HX_RESULT Build(const UINT8*& pData);

    const char* GetURL() const { return m_strURL;}
    const char* GetAltURL() const { return m_strAltURL;}
    bool HasURL() const { return !m_strURL.Length(); }
    bool HasAltURL() const { return !m_strAltURL.Length(); }

    const UINT16 GetStartOffset() const { return m_uiStartCharOffset;}
    const UINT16 GetEndOffset() const { return m_uiEndCharOffset;}
private:
    UINT16  m_uiStartCharOffset;
    UINT16  m_uiEndCharOffset;
    SimpleString m_strURL;
    SimpleString m_strAltURL;
};


//BLNK
class C3GPPTextBlinkBox
{
public:
    C3GPPTextBlinkBox() : m_uiStartCharOffset(0), m_uiEndCharOffset(0) {}
    HX_RESULT Build(const UINT8*& pData)
    {
        m_uiStartCharOffset = ReadUI16(pData);
        m_uiEndCharOffset = ReadUI16(pData);
        return HXR_OK;
    }
    const UINT16 GetStartOffset() const { return m_uiStartCharOffset; }
    const UINT16 GetEndOffset() const { return m_uiEndCharOffset; }

private:
    UINT16  m_uiStartCharOffset;
    UINT16  m_uiEndCharOffset;

};




class C3GPPTextContainer
{
  public:
    C3GPPTextContainer();
    ~C3GPPTextContainer();

    HX_RESULT Init(
        IHXPacket* pPacket,
        UINT32 ulPacketContentsBeginTime,
        UINT32 ulMaxEndTime,
        UINT16 uiStartCharOffset, 
        /*OUT*/ UINT16& uiREFIndexOfLastChar);

    UINT16 GetTextByteLength() const
    {
        HX_ASSERT(!m_pTextSample  ||  m_pTextSample->GetTextLenInBytes() >
                m_uiUnpackedStartCharOffset);
        return ( (HX_3GPPTT_INVALID_INDEX == m_uiUnpackedEndCharOffset  ||
                HX_3GPPTT_MAX_CHAR_OFFSET == m_uiUnpackedEndCharOffset) ?
                        (m_pTextSample?  m_pTextSample->GetTextLenInBytes() -
                         m_uiUnpackedStartCharOffset   :   0)
                    :
                        // /it's not, apparently, endpoint inclusive (and it is
                        // *not* NULL-terminated)
                        m_uiUnpackedEndCharOffset - m_uiUnpackedStartCharOffset);
    }

    BOOL IsHyperlinked() const { return (m_pTextHyperTextBox != NULL); }
    BOOL ContainsPoint(INT16 iX, INT16 iY) const;
    HX_RESULT UpdateLowestPotentialNextTCStartOffset(
            UINT16 uiCurStartCharOffset, UINT16 uiCurEndCharOffset,
            UINT16& /*REF IN-&-OUT*/ uiLowestPotentialNextTCStartOffsetFound,
            BOOL&   /*REF OUT*/ bAssignBoxToCurrent);

    // /m_pPacket pass-through methods:
    //IHXBuffer*  GetBuffer() {return (m_pPacket? m_pPacket->GetBuffer():NULL); }
    UINT32 GetBeginTime() const { return m_ulBeginTime; }
    UINT32 GetEndTime() const { return m_ulEndTime; }
    UINT32 GetDuration() const { return m_ulEndTime - m_ulBeginTime; }
    UINT32 GetNextActivityTime() const; // /Next time draw or erase or move happens
    UINT32 GetPrevActivityTime()const ; // /Previous time draw or erase or move happened
    void SetPrevActivityTime(UINT32 ulAbsoluteTime); // /Converts to offset (local time)
    UINT32 GetASMRuleNumber() const { return m_pPacket? m_pPacket->GetASMRuleNumber() : 0; }

    // /All data members are unpacked and NULL-terminated where appropriate:
    IHXPacket*       m_pPacket;
    C3GPPTextSample* m_pTextSample;
    UINT16           m_uiUnpackedStartCharOffset;
    UINT16           m_uiUnpackedEndCharOffset;
    UINT16           m_uiTextStyleBoxIndex;
    UINT16           m_uiTextKaraokeBoxIndex;
    HXxRect          m_BoundingRectOfInitialDraw;

    C3GPPTextStyleBox*        m_pTextStyleBox;
    C3GPPTextHighlightBox*    m_pTextHighlightBox;
    C3GPPTextHilightColorBox* m_pTextHilightColorBox;
    C3GPPTextKaraokeBox*      m_pTextKaraokeBox;
    C3GPPTextScrollDelayBox*  m_pTextScrollDelayBox;
    C3GPPTextHyperTextBox*    m_pTextHyperTextBox;
    C3GPPTextboxBox*          m_pTextboxBox;
    C3GPPTextBlinkBox*        m_pTextBlinkBox;

    UINT32                    m_ulBeginTime;
    // /End time is the start time of the next packet (if any):
    UINT32                    m_ulEndTime;

    // /For blinking or scrolling text, this is set to a non-invalid time
    // (i.e., not HX_3GPPTT_INVALID_TIME) and is the next time this's text
    // needs to be redrawn at another location (scroll) or on/off toggle
    // (for blinking):
    UINT32                    m_ulNextDrawUpdateTimeOffset;

    // /Used for scrolling text, this is when the last draw (if any) was done;
    // if it hasn't been drawn yet, this is set to HX_3GPPTT_INVALID_TIME:
    UINT32                    m_ulPrevDrawUpdateTimeOffset;

    // /A T.C. may contain one or more newline chars at its start; this keeps
    // track of how many were found (if any); init'd to HX_3GPPTT_INVALID_INT16
    // which can be used to determine if such counting was performed:
    INT16                     m_lNumUTF16NewlineCharsAtStart;
    // /This keeps track of how many newlines there are, which might equal
    // the above but may be less if there are any CRLF's which are two
    // newline chars that count as only 1 newline:
    INT16                     m_lNumUTF16NewlinesAtStart;

private:
    HX_RESULT BuildSampleModifiers(BOOL& bNeedToBreakTCsUpAtNewlines);

    HX_RESULT BuildSTYL(const UINT8*& pData, 
      UINT16& uiLowestPotentialNextTCStartOffsetFound,
      BOOL& bNeedToBreakTCsUpAtNewlines,
      UINT16& curEndCharOffset);

    HX_RESULT BuildHLIT(const UINT8*& pData, 
      UINT16& uiLowestPotentialNextTCStartOffsetFound,
      BOOL& bNeedToBreakTCsUpAtNewlines,
      UINT16& curEndCharOffset);

    HX_RESULT BuildKROK(const UINT8*& pData, 
      UINT16& uiLowestPotentialNextTCStartOffsetFound,
      BOOL& bNeedToBreakTCsUpAtNewlines,
      UINT16& curEndCharOffset);


    HX_RESULT BuildHREF(const UINT8*& pData, 
      UINT16& uiLowestPotentialNextTCStartOffsetFound,
      BOOL& bNeedToBreakTCsUpAtNewlines,
      UINT16& curEndCharOffset);

    HX_RESULT BuildBLNK(const UINT8*& pData, 
      UINT16& uiLowestPotentialNextTCStartOffsetFound, 
      BOOL& bNeedToBreakTCsUpAtNewlines,
      UINT16& curEndCharOffset);

    HX_RESULT BuildTBOX(const UINT8*& pData);

    HX_RESULT BuildHCLR(const UINT8*& pData);

    HX_RESULT BuildDLAY(const UINT8*& pData);


};


#endif  // _3GPPTTSTRUCTS_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?