/*
 * Copyright 2010 Trident Microsystems (Far East) Ltd. All rights reserved.
 * All prior copyright rights in this work and the accompanying software
 * products transferred to Trident Microsystems (Far East) Ltd. by written
 * agreement.
 */
/*****************************************************************************/
/* Copyright (c) 2010 NXP B.V.  All rights are reserved.                     */
/*                                                                           */
/* Redistribution and use in source and binary forms, with or without        */
/* modification, are permitted provided that the following conditions        */
/* are met:                                                                  */
/*                                                                           */
/* Redistributions of source code must retain the above copyright            */
/* notice, this list of conditions and the following disclaimer.             */
/*                                                                           */
/* Redistributions in binary form must reproduce the above copyright         */
/* notice, this list of conditions and the following disclaimer in the       */
/* documentation and/or other materials provided with the distribution.      */
/*                                                                           */
/* Neither the name of NXP nor the names of its                              */
/* contributors may be used to endorse or promote products derived from      */
/* this software without specific prior written permission.                  */
/*                                                                           */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE         */
/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */
/* DAMAGE.                                                                   */
/*                                                                           */
/*****************************************************************************/

/*############################################################
 *
 * Module name  : tmVideoFormats.h  %version: SOUsb225#3 %
 *
 * Last Update  : %date_modified: Tue Jul  8 18:07:54 2003 %
 *
 * Description: This header file contains the standard enumerations, types, and
 * structures used for the DVP audio and video software streams.
 *
 * TriMedia audio and video format definitions. The definitions in this file are
 * fundamental to the TM Software Streaming Architecture (TSSA).
 *
 * Document ref: DVP Coding Guidelines Specification
 *
 *############################################################
 */

#ifndef TMVIDEOFORMATS_H
#define TMVIDEOFORMATS_H

//-----------------------------------------------------------------------------
// Standard include files:
//-----------------------------------------------------------------------------
//

//-----------------------------------------------------------------------------
// Project include files:
//-----------------------------------------------------------------------------
//
#ifndef TMNXTYPES_H
#include "tmNxTypes.h"                    // DVP Standard data types/defines
#endif

#ifdef __cplusplus
extern "C"
{
#endif

//-----------------------------------------------------------------------------
// Types and defines:
//-----------------------------------------------------------------------------
//

//{{DVI
// AV buffer structures (3 entries each for planar buffers):

// Physical buffer structure (for planar/non-planar video modes)
// NOTE: buffer that are passed with their physical address cannot be accessed
//       by the CPU. They are used for hardware DMA only !
//DOCNEEDED35
typedef struct tmAvPhysBuffer
{
    UInt32  buffer1;            // Y plane, YUV non-planar, RGB non-planar
    UInt32  buffer2;            // U plane, UV semi-planar plane
    UInt32  buffer3;            // V plane

}   tmAvPhysBuffer_t, *ptmAvPhysBuffer_t;

// Virtual buffer structure (for planar/non-planar video modes)
// NOTE: Virtual address buffers are only accessed by the CPU.  They cannot
//       be used for hardware DMA access !
//DOCNEEDED36
typedef struct tmAvVirtBuffer
{
    pVoid  pBuffer1;            // Y plane, YUV non-planar, RGB non-planar
    pVoid  pBuffer2;            // U plane, UV semi-planar plane
    pVoid  pBuffer3;            // V plane

}   tmAvVirtBuffer_t, *ptmAvVirtBuffer_t;
//}}

/* Video format type definitions */

typedef enum tmVideoTypeFormat {
    vtfGeneric              = (Int) 0xffffffffu,
    vtfNone                 = (Int) 0x80000000u,
    vtfReserved1            = 0x00000001, // vtfMPEG1Video is obsolete: use vtfMPEG and subtype
    vtfReserved2            = 0x00000002, // vtfMPEG2Video is obsolete: use vtfMPEG and subtype
    vtfQuicktimeVideo       = 0x00000004, //DOCNEEDED37
    vtfCLUT                 = 0x00000008, //{}DVI (new value) //DOCNEEDED38
    vtfYUV                  = 0x00000010,
    vtfRGB                  = 0x00000020,
    vtfJPEG                 = 0x00000040, //DOCNEEDED39
    vtfMPEG                 = 0x00000080,
    vtfDVC                  = 0x00000100, //DOCNEEDED40
    vtfH261                 = 0x00000200, //DOCNEEDED41
    vtfH263                 = 0x00000400, //DOCNEEDED42
//{{DVI
    vtfAlpha                = 0x00000800, // just alpha:  antialiased fonts //DOCNEEDED43
    vtfBlock                = 0x00001000, // 2D blocks like vectors, SAD, DCT //DOCNEEDED44
//}}
//{{SSGSVL
    vtfWMV                  = 0x00002000, //DOCNEEDED45
    vtfReal                 = 0x00004000, //DOCNEEDED46
    vtfDIVX                 = 0x00040000   // Brought in by IPK@STP  24.10.2003
//}}
} tmVideoTypeFormat_t;                     /* can be OR'ed */

//{{DVI
//DOCNEEDED47
typedef enum tmVideoOutFormat {
    vofGeneric      = (Int) 0xffffffffu,
    vofNone         = (Int) 0x80000000u,
    // The following are YUV only
    vof8bitYUV422   = 0x00000001,   // One IF,  8 bit, YUV422 SD
    vof10bitYUV422  = 0x00000002,   // One IF, 10 bit, YUV422 SD
    vof16bitYUV422  = 0x00000004,   // Dual IF,  8 bit, YUV422 HD
    vof20bitYUV422  = 0x00000008,   // Dual IF, 10 bit, YUV422 HD

    // The following can be RGB or YUV444
    vof8bit444      = 0x00000010,   // One IF,  8 bit, RGB or YUV
    vof10bit444     = 0x00000020,   // One IF, 10 bit, RGB or YUV
    vof8bit444X     = 0x00000040,   // One IF,  8 bit, RGBX or YUVX
    vof10bit444X    = 0x00000080,   // One IF, 10 bit, RGBX or YUVX
    vof24bit444     = 0x00000100,   // Dual IF,  8 bit, RGB or YUV
    vof30bit444     = 0x00000200    // Dual IF, 10 bit, RGB or YUV
} tmVideoOutFormat_t;
//}}

//{{SSGSVL
//DOCNEEDED48
typedef enum tmVideoSubtypeMicrosoft {
    vsmsV7 = 0x00000001,
    vsmsV8 = 0x00000002,
    vsmsV9 = 0x00000004
} tmVideoSubtypeMicrosoft_t;
//}}

//=============================================================================
// Video Format Subtype YUV:
//=============================================================================

//{}DVI video format split into YUV and RGB types. !!many values changed

//DOCNEEDED49
typedef enum tmVideoYUVFormat {
    vdfGeneric              = (Int) 0xffffffffu,
    vdfNone                 = (Int) 0x80000000u,
    vdfUYVY                 = 0x00000001,   // Co-sited YUV422, bytes: U0, Y0, V0, Y1
    vdfYUY2                 = 0x00000002,   // Co-sited YUV422, bytes: Y0, U0, Y1, V0
    vdfVYUY                 = 0x00000004,   // Co-sited YUV422, bytes: V0, Y1, U0, Y0 !!
    vdfUYVYInterspersed     = 0x00000008,   // Same as vdfUYVY with interspersed U, V
    vdfYUY2Interspersed     = 0x00000010,   // Same as vdfYUY2 with interspersed U, V
    vdfVYUYInterspersed     = 0x00000020,   // Same as vdfVYUY with interspersed U, V

    vdfXVYU8888             = 0x00000100,   // u32: xxxxxxxx vvvvvvvv yyyyyyyy uuuuuuuu
    vdfAVYU8888             = 0x00000200,   // u32: aaaaaaaa vvvvvvvv yyyyyyyy uuuuuuuu
    vdfXYUV8888             = 0x00000400,   // u32: xxxxxxxx yyyyyyyy uuuuuuuu vvvvvvvv
    vdfAYUV8888             = 0x00000800,   // u32: aaaaaaaa yyyyyyyy uuuuuuuu vvvvvvvv

    // U0, Y0, V0, Y1:  For VO overlay, with low bit of UV for alpha blending
    vdfYUV422SequenceAlpha  = 0x00001000, //{}was 0x2000

    vdfY8                   = 0x00002000,   // Luma only, 8 bit/pixel (Y0, Y1, Y2, Y3)

    vdfYUV422Sequence       = vdfUYVY,      // YUV422, bytes: U0, Y0, V0, Y1 //{}was 0x1000
    vdfMono                 = vdfY8,        // Luma only, 8 bit/pixel (Y0, Y1, Y2, Y3) //{}was 0x4000

    vdfDTVCMSequence        = 0x00008000,   // TODO: ?? //{}was 0x20000

    // Planar YUV formats following:
    vdfYUV444Planar         = 0x00010000,   // YUV444, 3 planes //{}was 0x8000
    vdfYUV422Planar         = 0x00020000,   // YUV422, 3 planes //{}was 0x80
    vdfYUV420Planar         = 0x00040000,   // YUV420, 3 planes //{}was 0x40
    vdfYUV411Planar         = 0x00080000,   // YUV411, 3 planes //{}was 0x100
    vdfYUV422SemiPlanar     = 0x00100000,   // YUV422, 2 planes, 1 for Y, 1 for U and V
    vdfYUV420SemiPlanar     = 0x00200000,   // YUV420, 2 planes, 1 for Y, 1 for U and V

// TODO: Should the following formats also have "Planar" in their name??
    vdfYUV420Interspersed   = 0x00400000,   // Same as vdfYUV420Planar with intersp U, V //{}was 0x200
    vdfYUV422Interspersed   = 0x00800000,   // Same as vdfYUV422Planar with intersp U, V //{}was 0x400
    vdfYUV411Interspersed   = 0x01000000,   // Same as vdfYUV411Planar with intersp U, V //{}was 0x800

    vdfDTVCMPlanar          = 0x02000000,   // TODO: ?? //{}was 0x10000

    vdfYInterleavedUV420    = 0x04000000,   // YUV420 output by TM2 mpeg2 //{}was 0x40000

    vdfYUV422PlanarAlpha4   = 0x08000000,   // TODO: ?? //{}was 0x80000
    vdfYUV444PlanarAlpha    = 0x10000000    // TODO: ?? //{}DVI
} tmVideoYUVFormat_t;                       /* can be OR'ed */

//=============================================================================
// Video Format Subtype RGB:
//=============================================================================

//DOCNEEDED50
typedef enum tmVideoRGBFormat {
    vcfGeneric              = (Int) 0xffffffffu,
    vcfNone                 = (Int) 0x80000000u,
    vcfRGB8A_233            = 0x00000001,
    vcfRGB8R_332            = 0x00000002,
    vcfRGB15Alpha           = 0x00000004,   // u16: arrr rrgg gggb bbbb
    vcfRGB16                = 0x00000008,   // u16: rrrr rggg gggb bbbb
    vcfRGB24                = 0x00000010,   // u32: xxxxxxxx rrrrrrrr gggggggg bbbbbbbb
    vcfRGB24Alpha           = 0x00000020,   // u32: aaaaaaaa rrrrrrrr gggggggg bbbbbbbb

//{{DVI !!values changed
    vcfXRGB1555             = 0x00000040,   // u16: xrrr rrgg gggb bbbb
    vcfXRGB4444             = 0x00000080,   // u16: xxxx rrrr gggg bbbb
    vcfARGB4444             = 0x00000100,   // u16: aaaa rrrr gggg bbbb
    vcfXRGB4453             = 0x00000200,   // u16: xxxx rrrr gggg gbbb
    vcfARGB4453             = 0x00000400,   // u16: aaaa rrrr gggg gbbb
    vcf1BPP                 = 0x00000800,   // 1 bit/pixel // u32: p24..p31 p16..p23 p08..p15 p00..p07
    vcfARGB1555             = vcfRGB15Alpha,
    vcfARGB8888             = vcfRGB24Alpha,
    vcfRGB565               = vcfRGB16,
    vcfXRGB8888             = vcfRGB24
//}}
} tmVideoRGBFormatNew_t;



//=============================================================================
// Video Format Subtype RGB:
//=============================================================================

typedef enum {
    vdf1BPP                 = 0x00000001,   // 1 bit/pixel
                                            // u32: p24..p31 p16..p23 p08..p15 p00..p07

    vdfRGB8A_233            = 0x00000002,   // ??
    vdfRGB8R_332            = 0x00000004,   // ??
    vdfXRGB1555             = 0x00000010,   // u16: xrrr rrgg gggb bbbb
    vdfARGB1555             = 0x00000020,   // u16: arrr rrgg gggb bbbb
    vdfRGB565               = 0x00000040,   // u16: rrrr rggg gggb bbbb
    vdfXRGB4444             = 0x00000100,   // u16: xxxx rrrr gggg bbbb
    vdfARGB4444             = 0x00000200,   // u16: aaaa rrrr gggg bbbb
    vdfXRGB4453             = 0x00000400,   // u16: xxxx rrrr gggg gbbb
    vdfARGB4453             = 0x00000800,   // u16: aaaa rrrr gggg gbbb

    vdfXRGB8888             = 0x00001000,   // u32: xxxxxxxx rrrrrrrr gggggggg bbbbbbbb
    vdfARGB8888             = 0x00002000,   // u32: aaaaaaaa rrrrrrrr gggggggg bbbbbbbb

    vdfRGB15Alpha           = vdfARGB1555,
    vdfRGB16                = vdfRGB565,
    vdfRGB24                = vdfXRGB8888,
    vdfRGB24Alpha           = vdfARGB8888
} tmVideoRGBFormat_t;                       //

//typedef tmVideoYUVFormat_t tmVideoRGBYUVFormat_t;

//=============================================================================
// Video Format Subtype CLUT:
//=============================================================================

//{{DVI
//DOCNEEDED51
typedef enum tmVideoCLUTFormat {
    // RGB entries in the LUT (no alpha) u32: xxxxxxxx rrrrrrrr gggggggg bbbbbbbb
    vdfRGBCLUT1bpp          = 0x00000001,
    vdfRGBCLUT2bpp          = 0x00000002,
    vdfRGBCLUT4bpp          = 0x00000004,
    vdfRGBCLUT8bpp          = 0x00000008,

    // RGB entries in the LUT with alpha u32: aaaaaaaa rrrrrrrr gggggggg bbbbbbbb
    vdfARGBCLUT1bpp         = 0x00000010,
    vdfARGBCLUT2bpp         = 0x00000020,
    vdfARGBCLUT4bpp         = 0x00000040,
    vdfARGBCLUT8bpp         = 0x00000080,

    // YUV entries in the LUT (no alpha) u32: xxxxxxxx yyyyyyyy uuuuuuuu vvvvvvvv
    vdfYUVCLUT1bpp          = 0x00000100,
    vdfYUVCLUT2bpp          = 0x00000200,
    vdfYUVCLUT4bpp          = 0x00000400,
    vdfYUVCLUT8bpp          = 0x00000800,

    // YUV entries in the LUT with alpha u32: aaaaaaaa yyyyyyyy uuuuuuuu vvvvvvvv
    vdfAYUVCLUT1bpp         = 0x00001000,
    vdfAYUVCLUT2bpp         = 0x00002000,
    vdfAYUVCLUT4bpp         = 0x00004000,
    vdfAYUVCLUT8bpp         = 0x00008000,

    // Hardware Cursor as 2 BPP
    vdfRGB2bppHwCursor      = 0x00010000
} tmVideoCLUTFormat_t;                     /* can be OR'ed */

//=============================================================================
// Video Format Subtype Alpha:
//=============================================================================

//DOCNEEDED52
typedef enum tmVideoAlphaFormat {
    vdfA1                   = 0x00000001,   // 1 bpp alpha only
    vdfA2                   = 0x00000002,   // 2 bpp alpha only
    vdfA4                   = 0x00000004,   // 4 bpp alpha only
    vdfA8                   = 0x00000008    // 8 bpp alpha only
} tmVideoAlphaFormat_t;

//=============================================================================
// Video Format Subtype Block:
//=============================================================================

//DOCNEEDED53
typedef enum tmVideoBlockFormat {
    vdfVector8x8         = 0x00000001,   // 2D motion vector for a block, See
                                         // Condor block. Bit from msb to lsb:
                                         // temp_pos_mode (2b)
                                         // layer (4b)
                                         // vx (10b) 1/4 pixel resolution hor
                                         // penalty (8b)
                                         // vy (8b) 1/4 pixel resolution vert
    vdfSAD8x8            = 0x00000002    // UInt16 Sum of Absolute differences
} tmVideoBlockFormat_t;
//}}

//=============================================================================

/* these are used in the description field of a video format */
//DOCNEEDED54
typedef enum tmVideoFlags {
    vdfInterlaced       = 0x00000001,
    vdfBottomFieldFirst = 0x00000002,
    vdfFieldInFrame     = 0x00000004,
    vdfFieldInField     = 0x00000008,
    vdfProgressive      = 0x00000010,

#ifndef TMFL_EXCLUDE_AVFORMATS_LEGACY
    vdfFrameRate_23_976 = 0x00000100, /* used by video encoders */
    vdfFrameRate_24     = 0x00000200,
    vdfFrameRate_25     = 0x00000400,
    vdfFrameRate_29_97  = 0x00000800,
    vdfFrameRate_30     = 0x00001000,
    vdfFrameRate_50     = 0x00002000,
    vdfFrameRate_59_94  = 0x00004000,
    vdfFrameRate_60     = 0x00008000,
#endif

//{{TTI
    vdfDTVCM_0Video     = 0x00010000,
    vdfDTVCM_25Video    = 0x00020000,
    vdfDTVCM_50Video    = 0x00040000,
    vdfDTVCM_75Video    = 0x00080000,
    vdfDTVCM_100Video   = 0x00100000,
//}}

    vdfMPEGExtension    = 0x00200000,

//{{DVI
    vdfYUVRangeFull     = 0x00400000,   // YUV values have full range 0..255
    vdfYUVRangeITU      = 0x00800000,   // YUV values are limited to ITU-R BT.601-4
                                        //   Y: 16..235
                                        //   U and V: 16..240, with offset 128 = 0

    vdfPremultAlpha     = 0x01000000,   // color values are premultipled with alpha
    vdfDithered         = 0x02000000    // color values are dithered
//}}

//{{TTI !!values changed
#ifndef TMFL_EXCLUDE_AVFORMATS_LEGACY
    ,
    vdfAspectRatio_4x3  = 0x10000000,
    vdfAspectRatio_16x9 = 0x20000000
#endif
//}}
} tmVideoFlags_t;

//{{DVI
//DOCNEEDED55
//Max number of VBI lines for a certain standard
//PAL has 49 lines of VBI == 24.5 per field => buffer size should be 25.
#define PAL_VBI_LINES_FIELD1   (25)
#define PAL_VBI_LINES_FIELD2   (25)
//NTSC + SECAM definitions not used at all.
#define NTSC_VBI_LINES_FIELD1  (21)
#define NTSC_VBI_LINES_FIELD2  (21)
#define SECAM_VBI_LINES_FIELD1 (22)
#define SECAM_VBI_LINES_FIELD2 (22)

//Length of data structure for a certain type VBI data
#define OUT_DATA_LENGTH_L21    ( 2)
#define OUT_DATA_LENGTH_EU_TXT (42)
#define OUT_DATA_LENGTH_WSS    (14)
#define OUT_DATA_LENGTH_VPS    (26)
#define OUT_DATA_LENGTH_NABTS  (33)
//}}

//{{SSG/TTI
/* dataFormat fields VDECMPEG */
#define VO_DF_PS_MASK           0x3
#define VO_DF_PS_SHIFT          0x0
#define VO_DF_CF_MASK           0x3
#define VO_DF_CF_SHIFT          0x2
#define VO_DF_COL_CONV_MASK     0x7
#define VO_DF_COL_CONV_SHIFT    0x4
#define VO_DF_PROG_FR_MASK      0x1
#define VO_DF_PROG_FR_SHIFT     0x7
#define VO_DF_TFF_MASK          0x1
#define VO_DF_TFF_SHIFT         0x8
#define VO_DF_RFF_MASK          0x1
#define VO_DF_RFF_SHIFT         0x9
#define VO_DF_PROGSEQ_MASK      0x1
#define VO_DF_PROGSEQ_SHIFT     0xa
#define VO_DF_LASTFRAME_MASK    0x1
#define VO_DF_LASTFRAME_SHIFT   0xb
#define VO_DF_FRAME_RATE_MASK   0xf
#define VO_DF_FRAME_RATE_SHIFT  0xc
#define VO_DF_FRAME_SENT_MASK   0x1
#define VO_DF_FRAME_SENT_SHIFT  0x10
#define VO_DF_PTYPE_MASK        0x3
#define VO_DF_PTYPE_SHIFT       0x11
#define VO_DF_NEW_FORMAT_MASK   0x1
#define VO_DF_NEW_FORMAT_SHIFT  0x13
//}}

//DOCNEEDED56
typedef enum tmVideoDataService {
    vdsNone              = 0x00000000,
    vdsEuroTeleText      = 0x00000001,
    vdsEuroClosedCaption = 0x00000002,
    vdsVPS               = 0x00000004,
    vdsWSS               = 0x00000008,
    vdsUSTeleText        = 0x00000010,
    vdsUSClosedCaption   = 0x00000020,
    vdsTeleText          = 0x00000040,
    vdsVITC_EBU          = 0x00000080,
    vdsVITC_SMPTE        = 0x00000100,
    vdsUSNABTS           = 0x00000200,
    vdsMoji              = 0x00000400,
    vdsJapFormatSwitch   = 0x00000800,
    vdsUpsampledRaw      = 0x00001000
} tmVideoDataService_t;                          /* can be OR'ed */

//DOCNEEDED57
typedef enum tmVideoColor {
    vctNone,
    vctBrightness,
    vctContrast,
    vctSaturation,
    vctHue,
    vctSharpness
} tmVideoColor_t;

//DOCNEEDED58
typedef enum tmVideoCapabilitiesFlags {
    vcapNone             = 0x00000000,
    vcapAutoStandard     = 0x00000001,
    vcapBrightness       = 0x00000002,
    vcapContrast         = 0x00000004,
    vcapSaturation       = 0x00000008,
    vcapHue              = 0x00000010,
    vcapSharpness        = 0x00000020,
    vcapRawVBI           = 0x00000040,
    vcapSlicedVBI        = 0x00000080,
    vcapScaleX           = 0x00000100,
    vcapScaleY           = 0x00000200,
    vcapSquarePixel      = 0x00000400,
    vcapCCIR601          = 0x00000800,
    vcapPowerDown        = 0x00001000,
    vcapOutputTriState   = 0x00002000,
    vcapGPIO             = 0x00004000,
    vcapAcquisition      = 0x00008000,
    vcapInterlace        = 0x00010000,
    vcapAncCapture       = 0x00020000
} tmVideoCapabilitiesFlags_t; /* can be OR'ed */

//DOCNEEDED59
typedef enum tmVideoSourceType {
    vsoNone,
    vsoCamera,
    vsoTV,
    vsoVCR
} tmVideoSourceType_t;

//DOCNEEDED60
typedef enum tmVideoStatusType {
    vstNone,
    vstLocked,
    vstReady,
    vstSyncLock,
    vstCopy,
    vstColorSignal,
    vstFrequency,
    vstPowerUp,
    vstFifo,
    vstDataServices,
    vstFidText
} tmVideoStatusType_t;

//DOCNEEDED61
typedef enum tmVideoVBIMode {
    vvmNone,
    vvmBasebandYuv,
    vvmRawY
} tmVideoVBIMode_t;

//DOCNEEDED62
typedef enum tmVideoSlicerMode {
    vsmNone,
    vsmAnc,
    vsmSavEav
} tmVideoSlicerMode_t;

//{{SSGSVL
//DOCNEEDED63
typedef enum {
    vsRealVideo5  = 0x00000001,
    vsRealVideoG2 = 0x00000002,
    vsRealVideo7  = 0x00000004,
    vsRealVideo8  = 0x00000010,
    vsRealVideo9  = 0x00000020
} tmVideoSubtypeRealNetworks_t;
//}}

/* Subtypes to identify MPEG video formats */
typedef enum tmVideoMPEGFormat {
    vmfGeneric              = (Int) 0xffffffffu,
    vmfNone                 = (Int) 0x80000000u,
    vmfMPEG1                = 0x00000001,
    vmfMPEG2                = 0x00000002,
    vmfMPEG4                = 0x00000004 //DOCNEEDED64
} tmVideoMPEGFormat_t;                        /* can be OR'ed */
/* TODO: Do we need any more description of MPEG 4 video? */

// Brought in by IPK@STP
// 24.10.2003
// need to document-get approval-finalize
/* Subtypes to identify MPEG video formats */
typedef enum tmVideoDIVXformat {
    vmfDIVX3                = 0x00000001,
    vmfDIVX4                = 0x00000002,
    vmfDIVX5                = 0x00000004,
    vmfXVID                 = 0x00000008
} tmVideoDIVXFormat_t;                        /* can be OR'ed */

typedef enum tmVideoAnalogStandard {
    vasGeneric              = (Int) 0xffffffffu,
    vasNone                 = (Int) 0x80000000u,
// SDTV:
    vasNTSC                 = 0x00000001,
    vasPAL                  = 0x00000002,
    vasSECAM                = 0x00000004,
// HDTV:
//DOCNEEDED65
    vas720x480p             = 0x00000010,
    vas768x576p             = 0x00000020,
    vas960x540p             = 0x00000080,
    vas1920x1080            = 0x00000100,
    vas960x1080             = 0x00000200,     // half-res mode
// CRT:
//DOCNEEDED66
    vas640x480x60           = 0x00001000,
    vas800x600x75           = 0x00002000,
    vas1024x768x60          = 0x00004000,
    vas720x576x100          = 0x00008000,
    vas960x576x100          = 0x00010000
} tmVideoAnalogStandard_t;                     /* can be OR'ed */

typedef enum tmVideoAnalogAdapter {
    vaaGeneric              = (Int) 0xffffffffu,
    vaaNone                 = (Int) 0x80000000u,
    vaaCVBS                 = 0x00000001,
    vaaSvideo               = 0x00000002,
    vaaExt1                 = 0x00000004, //DOCNEEDED67
    vaaSCART                = 0x00000008, // RGB interlaced plus sync //DOCNEEDED68
    vaaVGA                  = 0x00000010  // RGB //DOCNEEDED69
} tmVideoAnalogAdapter_t;                     /* can be OR'ed */

//{{DVI
// The auxiliary video data type defines 2 data types,
// one for MPEG user data and one that combines all
// the video data services (= VBI data).
// MPEG user data:
//     - The subtypes are defined tmMpegUserData_t.
//     - The data buffer contains the raw user data
//       as it is received in the mpeg stream. No
//       processing is done.
//
// Video data services:
//     - The subtypes are defined by tmVideoDataService_t.
//     - The data buffer stores the VBI data for all lines
//       and the line number the data should be inserted.
//       The buffer layout is as follows:
//          < 2 bytes for first line number > < data bytes first line >
//          < 2 bytes for second line number > < data bytes second line > < ...
//
//       The line number is stored in two bytes, the LSB byte first :
//       < LSB byte > < MSB byte > < data bytes ...
//         ^      ^     ^       ^
//         |      |     |       |
//         |     bit 0  |      bit 0
//        bit 7        bit 7
//

//enumeration of auxiliary video data types.
//DOCNEEDED70
typedef enum tmAuxVideoDataTypeFormat {
    avdtfGeneric            = (Int) 0xffffffffu,
    avdtfNone               = (Int) 0x80000000u,
    avdtfMpegUserData       = 0x00000001,
    avdtfDataService        = 0x00000002
} tmAuxVideoDataTypeFormat_t;

//enumeration of mpeg user data subtypes
//DOCNEEDED71
typedef enum tmMpegUserData {
    mpegUserDataNone        = 0x00,
    mpegUserDataSequence    = 0x01,
    mpegUserDataGop         = 0x02,
    mpegUserDataPicture     = 0x04
} tmMpegUserData_t;

//new format for auxiliary video data
//DOCNEEDED72
typedef
    struct tmAuxVideoDataFormat
    {
        tmAvFormatVARIABLES;
        UInt32 nrLines;        // only used for avdtfDataService
                               // data type.
        UInt32 nrBytesPerLine; // only used for avdtfDataService
                               // data type. This does not include
                               // the two bytes used to store the
                               // line number
    }
    tmAuxVideoDataFormat_t, *ptmAuxVideoDataFormat_t;
//}}

//{{DVI
// tmAspectRatio_t:
// Video aspect ratio. The value of each member match
// the code defined by the mpeg standard.
//DOCNEEDED73
typedef enum tmAspectRatio {
    tmAspectRatioNone       = 0x00,
    tmAspectRatio_1x1       = 0x01,
    tmAspectRatio_4x3       = 0x02,
    tmAspectRatio_16x9      = 0x03,
    tmAspectRatio_1x2_21    = 0x04
} tmAspectRatio_t, *ptmAspectRatio_t;

//
// tmFrameRate_t:
// Video frame rates. The value of each member match
// the code defined by the mpeg standard.
//DOCNEEDED74
typedef enum tmFrameRate {
    tmFrameRateNone     = 0x00,
    tmFrameRate_23_976  = 0x01,
    tmFrameRate_24      = 0x02,
    tmFrameRate_25      = 0x03,
    tmFrameRate_29_97   = 0x04,
    tmFrameRate_30      = 0x05,
    tmFrameRate_50      = 0x06,
    tmFrameRate_59_94   = 0x07,
    tmFrameRate_60      = 0x08
} tmFrameRate_t;
//}}

/* subclass of tmAvFormat_t */
//DOCNEEDED75
typedef
    struct tmVideoFormat
    {
        tmAvFormatVARIABLES;
        UInt32                  imageWidth;
        UInt32                  imageHeight;
        UInt32                  imageStride;
        UInt32                  activeVideoStartX;
        UInt32                  activeVideoStartY;
        UInt32                  activeVideoEndX;
        UInt32                  activeVideoEndY;
        tmVideoAnalogStandard_t videoStandard;
        UInt32                  imageUVStride;
//{{DVI !!new structure members
        tmFrameRate_t           frameRate;
        tmAspectRatio_t         aspectRatio;
//}}
    }
    tmVideoFormat_t, *ptmVideoFormat_t;

// Structures for VBI data services
//DOCNEEDED76
typedef struct tmVideoDataServiceDesc
{
    tmVideoDataService_t    service;    // Video data service
    UInt32                  lineNr;     // Line number for this service
    UInt32                  dataSize;   // Number of bytes in data buffer
    UInt8                  *pData;      // Ptr to buffer containing VBI data
} tmVideoDataServiceDesc_t, *ptmVideoDataServiceDesc_t;

//DOCNEEDED77
typedef struct tmVideoDataServiceList
{
    tmAvHeaderFlags_t         fieldDesc; // Field description (odd/even select)
    UInt32                    nrOfLines; // Number of entries in description buf
    ptmVideoDataServiceDesc_t pDataDesc; // Ptr to data description buffers

} tmVideoDataServiceList_t, *ptmVideoDataServiceList_t;

//
// tmField_t:
// Field type.
//DOCNEEDED78
typedef enum tmField {
    tmFieldNone             = 0x00,

    // field 1 or the odd field.
    tmField1                = 0x01,

    // field 2 or the even field.
    tmField2                = 0x02,

    tmFieldBoth             = 0x03
} tmField_t, *ptmField_t;

//
// tmMegType_t:
// Mpeg type, mpeg 1 or mpeg 2.
//DOCNEEDED79
typedef enum tmMpegType {
    tmMpegTypeNone      = 0x00,
    tmMpegType1         = 0x01,
    tmMpegType2         = 0x02
} tmMpegType_t;

//
// tmMpegLevel_t:
// MPEG levels. The value of each member match
// the code defined by the mpeg standard.
//DOCNEEDED80
typedef enum tmMpegLevel {
    tmMpegLevelNone     = 0x00,
    tmMpegLevelHigh     = 0x04,
    tmMpegLevelHigh1440 = 0x06,
    tmMpegLevelMain     = 0x08,
    tmMpegLevelLow      = 0x0a
} tmMpegLevel_t;

//
// tmMpegProfile_t:
// Mpeg profiles. The value of each member match
// the code defined by the mpeg standard.
//DOCNEEDED81
typedef enum tmMpegProfile {
    tmMpegProfileNone       = 0x00,
    tmMpegProfileHigh       = 0x01,
    tmMpegProfileSpaScal    = 0x02,
    tmMpegProfileSnrScal    = 0x03,
    tmMpegProfileMain       = 0x04,
    tmMpegProfileSimple     = 0x05
} tmMpegProfile_t;

// tmolVrendGfxVoAspectConversion_t
// Enumeration of aspect ratio conversion methods.
//DOCNEEDED82
typedef enum tmAspectConversion
{
    tmAspectConvNone,               // no conversion
    tmAspectConvPanScan,            // use pan-scan info from stream
    tmAspectConvLetterboxTop,       // letterbox format with black bars
    tmAspectConvLetterboxCenter,    // letterbox format with black bars
    tmAspectConvCenterCut           // center and scale
} tmAspectConversion_t, *ptmAspectConversion_t;

// tmAspectFormat_t
// Video position when  letter boxing is applied.
//DOCNEEDED83
typedef enum tmAspectFormat
{
    tmAspectFrmtFull,               // use full format
    tmAspectFrmtLetterboxCenter,    // use pan-scan info from stream
    tmAspectFrmtLetterboxTop        // letterbox format with black bars
} tmAspectFormat_t;

// tmVideoAspect_t
// Video aspect structure.
//DOCNEEDED84
typedef struct tmVideoAspect
{
    // aspect ratio of video window (4:3, 16:9, ...)
    tmAspectRatio_t     ratio;
    // Aspect format (full, letter boxed center, letter boxed top)
    tmAspectFormat_t    format;
} tmVideoAspect_t, *ptmVideoAspect_t;


typedef struct {
    UInt32             size;
    UInt32             display_end_time;
    Bool               valid_end_time;
    UInt16             overlayHorzOffset;
    UInt16             overlayVertOffset;
    unsigned char      alpha0;
    unsigned char      alpha1;
} tmalVdecSubpicDVDPictureInfo_t, *ptmalVdecSubpicDVDPictureInfo_t;

typedef struct {
    UInt16             startx;
    UInt16             starty;
    UInt16             width;
    UInt16             height;
    UInt16             top_line_skip;
    UInt16             bot_line_skip;
    UInt16             part_menu;
    UInt32             last_sp_time;
    UInt16             samples_per_line;
} tmalVdecSubpicDVDPositionInfo_t, *ptmalVdecSubpicDVDPositionInfo_t;

#define MAX_UD_INDEX_TM 3
/* tmalVdecMpegPictureInfo_t ---------------------------------------------
 *
 */
typedef struct{
    UInt32                 size;
    UInt32                 dataFormat;
    Int16                  displayHorizontalSize;
    Int16                  displayVerticalSize;
    Int16                  frameCentreHorizOffset[3];
    Int16                  frameCentreVertOffset[3];
    UInt16                 aspectRatio;
    ptmAvPacket_t          userData[2][MAX_UD_INDEX_TM];   /* [top/bot][seq/gop/pic] */
} tmalVdecMpegPictureInfo_t, *ptmalVdecMpegPictureInfo_t;


//=============================================================================
// Types for Video Output Copy Protection - Macrovision (MV):
//=============================================================================

typedef enum tmVideoOutMVMode_t {
    vmvNone                 = 0x00000000,   // None - MV Disabled
    vmvHSyncReduction       = 0x00000001,   // Reduction of H-Sync amplitude
    vmvVSyncReduction       = 0x00000002,   // Reduction of V-Sync amplitude
    vmvVbiPulse             = 0x00000004,   // Insertion of AGC pulses and
                                            // pseudo syncs in VBI
    vmvColorStripe          = 0x00000008,   // Color stripe - color burst invers.
    vmvAgcCycling           = 0x00000010    // Amplitude of AGC pulses is
                                            // cyclically modulated
} tmVideoOutMVMode_t;       // can be or'ed

typedef struct tmVideoOutMVColorStripe {
    UInt8       n0;                         // On/Off/Mode
    UInt8       n1;                         // First line stripe 1, field 1
    UInt8       n2;                         // First line stripe 2, field 1
    UInt8       n3;                         // First line stripe 1, field 2
    UInt8       n4;                         // First line stripe 2, field 2
    UInt8       n5;                         // Spacing, stripe to stripe
    UInt8       n6;                         // Number of stripes per field
    UInt8       n7;                         // Number of lines per stripe
} tmVideoOutMVColorStripe_t, *ptmVideoOutMVColorStripe_t;

typedef struct tmVideoOutMVVbiPulse {
    UInt8       n8a;                        // Pseudo-sync pulse duration (A)
    UInt8       n8b;                        // Pseudo-sync pulse duration (B)
    UInt8       n9a;                        // Pseudo-sync pulse location (A)
    UInt8       n9b;                        // Pseudo-sync pulse location (B)
    UInt8       n10a;                       // Pseudo-sync pulse spacing (A)
    UInt8       n10b;                       // Pseudo-sync pulse spacing (B)
    UInt16      n11;                        // Line # with pseudo-sync and AGC
    UInt16      n12;                        // Line # with (B) ps.-sync and AGC
    UInt8       n13;                        // Ps.-Sync and AGC pattern A
    UInt8       n14;                        // Ps.-Sync and AGC pattern A
} tmVideoOutMVVbiPulse_t, *ptmVideoOutMVVbiPulse_t;

typedef struct tmVideoOutMVBackPorch {
    UInt8       n15;                        // Number of Back Porch pulses
                                            // before/after V-Sync pulse
} tmVideoOutMVBackPorch_t, *ptmVideoOutMVBackPorch_t;

typedef struct tmVideoOutMVColorBurst {
    UInt8       n16;                        // Advance burst start on/off
    UInt8       n17;                        // Start of burst to 1st phase sw.
    UInt8       n18;                        // 1st - 2nd phase switch
    UInt8       n19;                        // 2nd phase switch to burst end
    UInt8       n20;                        // Burst phase by zone
    UInt8       n21;                        // Burst phase code
} tmVideoOutMVColorBurst_t, *ptmVideoOutMVColorBurst_t;

typedef struct tmVideoOutMVSetup {
    tmVideoOutMVMode_t          mode;       // Or'ed mode of vmvNone (disabled)
    tmVideoOutMVColorStripe_t   cStripe;    // Color Stripe setup
    tmVideoOutMVVbiPulse_t      vbiPulse;   // VBI pulse setup
    tmVideoOutMVBackPorch_t     backPorch;  // Back Porch setup
    tmVideoOutMVColorBurst_t    cBurst;     // Color Burst setup
} tmVideoOutMVSetup_t, *ptmVideoOutMVSetup_t;



#ifdef __cplusplus
}
#endif

#endif
