#ifndef PHSTBESMETADATA_H    /* Multi-include protection. */
#define PHSTBESMETADATA_H

/*****************************************************************************/
/* Copyright (c) 2009 NXP B.V.                                               */
/*                                                                           */
/* This library is free software; you can redistribute it and/or             */
/* modify it under the terms of the GNU Lesser General Public                */
/* License as published by the Free Software Foundation, using               */
/* version 2.1 of the License.                                               */
/*                                                                           */
/* This library 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          */
/* Lesser General Public License for more details.                           */
/*                                                                           */
/* You should have received a copy of the GNU Lesser General Public          */
/* License along with this library; if not, write to the Free Software       */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   */
/*                                                                           */
/*****************************************************************************/
/**
    @file   phStbEsMetaData.h
    @brief  Elementary stream meta data structure

@b  Component: IphStbEsMetaData
*//*
Rev Date        Author      Comments
--------------------------------------------------------------------------------
  1 20060124    mpage       First Revision
  2 20060210    mpage       Adding flags
  3 20060830    mpage       Adding explicit DIVX formats
  4 20070628    mpage       Adding sync with timestamp flag
  5 20090212    laird       Matching with phStbAv (allows more debugging)
  6 20090309    batelaan    License->LGPL
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/

/*******************
* INCLUDE FILES    *
********************/

#ifdef __cplusplus
extern "C"
{
#endif

/**************************************************************
* EXPORTED MACROS         PH[<LAYER>]_<MODULE><_WORD>+        *
***************************************************************/

/** Magic value. */
#define PH_STBESMETADATA_MAGIC      (0xFEDCBA01)

/** Audio identification. */
#define PH_STBESFORMAT_IS_AUDIO(format)  (((format) >= phStbEsFormatAudioAac) && ((format) <= phStbEsFormatAudioWmaPro))

/** Video identification. */
#define PH_STBESFORMAT_IS_VIDEO(format)  (((format) >= phStbEsFormatVideoMpeg1) && ((format) <= phStbEsFormatVideoVP6))

/**************************************************************
* EXPORTED TYPEDEFS       [p]ph[<Layer>]<Module>_<Word>+_t  *
***************************************************************/

/** Es formats.
    If adding to this enum, make sure the format identification macros
    are updated above.
*/
typedef enum
{
    phStbEsFormatNone = 0,

    /** Audio formats. */
    phStbEsFormatAudioAac,
    phStbEsFormatAudioAc3,
    phStbEsFormatAudioBurstDTS,
    phStbEsFormatAudioLpcm,
    phStbEsFormatAudioMp3,
    phStbEsFormatAudioMpeg,
    phStbEsFormatAudioMpeg4Aac,
    phStbEsFormatAudioWma,
    phStbEsFormatAudioWmaPro,

    /** Video formats. */
    phStbEsFormatVideoMpeg1,
    phStbEsFormatVideoMpeg2,
    phStbEsFormatVideoMpeg4,
    phStbEsFormatVideoWmv,
    phStbEsFormatVideoDivx3,
    phStbEsFormatVideoDivx4,
    phStbEsFormatVideoDivx5,
    phStbEsFormatVideoXvid,
    phStbEsFormatVideoH263,
    phStbEsFormatVideoH264,
    phStbEsFormatVideoVP6,

    /** Guard. */
    phStbEsFormatGeneric
} phStbEsFormat_t;

/** Flags that can be set on a payload by payload basis.
    May be OR'd together.
    Note that the values of the following must match the
    definitions in MPTK. */
typedef enum
{
    phStbEsFlagPacketNewStream          = 0x00000040U,
    phStbEsFlagPesPacketStart           = 0x00000100U,
    phStbEsFlagPesPacketEnd             = 0x00000200U,
    phStbEsFlagEndOfStream              = 0x00000400U,
    phStbEsFlagSyncWithTimestamp        = 0x00010000U,
    phStbEsFlagPesPacketContinue        = 0x01000000U
} phStbEsFlag_t;

/** ES Meta Data.
    Note that it is not necessary to fill out all fields as some may
    not apply to all streams.
*/
typedef struct phStbEsMetaData
{
    /** Magic id to check for meta data. Must be the value
    PH_STBESMETADATA_MAGIC. */
    UInt32 magicStart;
    /** Indicates whether the following format value is valid. */
    Bool formatValid;
    /** The stream format. */
    phStbEsFormat_t format;
    /** Payload flags. */
    phStbEsFlag_t flags;
    /** Indicates whether the following dimensions values are valid. */
    Bool dimensionsValid;
    /** The width of the stream. */
    UInt32 width;
    /** The height of the stream. */
    UInt32 height;
    /** Indicates whether the following time values are valid. */
    Bool timeValid;
    /** Upper 32 bits of any timestamp for the following payload. */
    UInt32 timeHi;
    /** Lower 32 bits of any timestamp for the following payload. */
    UInt32 timeLo;
    /** Length of the following payload in bytes. */
    UInt32 payLoadLength;
    /** Magic id to check for meta data. Must be the value
    PH_STBESMETADATA_MAGIC. */
    UInt32 magicEnd;
} phStbEsMetaData_t;

#ifdef __cplusplus
}
#endif

#endif /* PHSTBESMETADATA_H      Do not add any thing below this line */
