⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textst_types.h

📁 这是DVD中伺服部分的核心代码
💻 H
字号:
/*****************************************************************************
******************************************************************************
**                                                                          **
**  Copyright (c) 2005-2006 Videon Central, Inc.                            **
**  All rights reserved.                                                    **
**                                                                          **
**  The computer program contained herein contains proprietary information  **
**  which is the property of Videon Central, Inc.  The program may be used  **
**  and/or copied only with the written permission of Videon Central, Inc.  **
**  or in accordance with the terms and conditions stipulated in the        **
**  agreement/contract under which the programs have been supplied.         **
**                                                                          **
******************************************************************************
*****************************************************************************/
/**
 * @file textst_types.h
 *
 * $Revision: 1.3 $ 
 *
 * Defines the private data types of the TextST Module,
 * that are accessible by all internal modules of the TextST Module.
 * These definitions are not intended to be accessible to modules
 * external to the TextST Module.
 *
 */

#ifndef TEXTST_TYPES_H
#define TEXTST_TYPES_H

#ifdef __cplusplus
extern "C" {
#endif

#include <directfb.h>
#include "vdvd_types.h"
#include "textst_api.h"
#include "osapi.h"

/**
 * TextST Constraints
 */
#define TEXTST_SPB_SIZE                 (512*1024)      // Subtitle Preloading Buffer Size = 512K
#define TEXTST_DB_SIZE                  (2*1024)        // Dialog Buffer Size = 2K
#define TEXTST_DCB_SIZE                 (32*1024)       // Dialog Composition Buffer Size = 32K
#define TEXTST_BOB_SIZE                 (2*1024*1024)   // Bitmap Object Buffer Size = 2M
#define TEXTST_BOB_DEPTH                10
#define TEXTST_MAX_DSS_REGION_STYLES    60
#define TEXTST_MAX_DSS_USER_STYLES      25
#define TEXTST_MAX_PALETTE_ENTRIES      255
#define TEXTST_MAX_REGIONS_PER_DPS      2
#define TEXTST_MAX_CHARS_PER_DPS_REGION 200
#define TEXTST_MAX_FONTS                255
#define TEXTST_MAX_FONTSIZE             144
#define TEXTST_MIN_FONTSIZE             8

/**
 * TextST Constants
 */
#define PRIVATE_STREAM_2_START_CODE     0x000001BF

/**
 * TextST Segment Descriptor
 */
typedef struct tagTEXTST_SEGMENT_DESCRIPTOR
{
    uint8   segment_type;
    uint16  segment_length;
} TEXTST_SEGMENT_DESCRIPTOR;

/**
 * TextST DSS Region Info
 */
typedef struct tagTEXTST_DSS_REGION_INFO
{
    uint16  region_horizontal_position;
    uint16  region_vertical_position;
    uint16  region_width;
    uint16  region_height;
    uint8   region_bg_palette_entry_id_ref;
    uint8   reserved;
} TEXTST_DSS_REGION_INFO;

/**
 * TextST DSS User Control Style
 */
typedef struct tagTEXTST_DSS_USER_CONTROL_STYLE
{
    uint8   user_style_id;
    uint8   region_horizontal_position_diretion;
    uint16  region_horizontal_position_delta;
    uint8   region_vertical_position_direction;
    uint16  region_vertical_position_delta;
    uint8   font_size_inc_dec;
    uint8   font_size_delta;
    uint8   text_box_horizontal_position_direction;
    uint16  text_box_horizontal_position_delta;
    uint8   text_box_vertical_position_direction;
    uint16  text_box_vertical_position_delta;
    uint8   text_box_width_inc_dec;
    uint16  text_box_width_delta;
    uint8   text_box_height_inc_dec;
    uint16  text_box_height_delta;
    uint8   line_space_inc_dec;
    uint8   line_space_delta;
} TEXTST_DSS_USER_CONTROL_STYLE;

/**
 * TextST DSS Region Style
 */
typedef struct tagTEXTST_DSS_REGION_STYLE
{
    uint8                           region_style_id;
    TEXTST_DSS_REGION_INFO          region_info;
    uint16                          text_box_horizontal_position;
    uint16                          text_box_vertical_position;
    uint16                          text_box_width;
    uint16                          text_box_height;
    uint8                           text_flow;
    uint8                           text_horizontal_alignment;
    uint8                           text_vertical_alignment;
    uint8                           line_space;
    uint8                           font_id_ref;
    uint8                           font_style;
    uint8                           font_size;
    uint8                           font_palette_entry_id_ref;
    uint8                           font_outline_palette_entry_id_ref;
    uint8                           font_outline_thickness;
    TEXTST_DSS_USER_CONTROL_STYLE   *user_control_style;
} TEXTST_DSS_REGION_STYLE;

/**
 * TextST Palette Entry
 */
typedef struct tagTEXTST_PALETTE_ENTRY
{
    uint8   palette_entry_id;
    uint8   Y_value;
    uint8   Cr_value;
    uint8   Cb_value;
    uint8   T_value;
} TEXTST_PALETTE_ENTRY;

/**
 * TextST Palette
 */
typedef struct tagTEXTST_PALETTE
{
    uint16                  length;
    TEXTST_PALETTE_ENTRY    *palette_entry;
} TEXTST_PALETTE;

/**
 * TextST Dialog Style Segment (DSS)
 */
typedef struct tagTEXTST_DSS
{
    TEXTST_SEGMENT_DESCRIPTOR       segment_descriptor;
    uint8                           player_style_flag;
    uint8                           number_of_region_styles;
    uint8                           number_of_user_styles;
    TEXTST_DSS_REGION_STYLE         *region_style;
    TEXTST_PALETTE                  palette;
} TEXTST_DSS;

/**
 * TextST Region Subtitle
 */
typedef struct tagTEXTST_REGION_SUBTITLE
{
    uint16      region_subtitle_length;
    uint8       data_length;
    uint8       text_string[TEXTST_MAX_CHARS_PER_DPS_REGION];
    uint8       inline_style_values[TEXTST_MAX_CHARS_PER_DPS_REGION];
    uint8       inline_style_type[TEXTST_MAX_CHARS_PER_DPS_REGION];
    uint8       inline_style_position[TEXTST_MAX_CHARS_PER_DPS_REGION];
} TEXTST_REGION_SUBTITLE;

/**
 * TextST Rendering Information
 */
typedef struct tagTEXTST_RENDER_INFO
{
    uint32                  dps_number;
    uint8                   number_of_regions;
    uint8                   region_style_id_ref[TEXTST_MAX_REGIONS_PER_DPS];
    TEXTST_REGION_SUBTITLE  region_subtitle[TEXTST_MAX_REGIONS_PER_DPS];
} TEXTST_RENDER_INFO;

/**
 * TextST Composition Information (presentation info)
 */
typedef struct tagTEXTST_COMPOSITION_INFO
{
    uint32                  dps_number;
    BOOLEAN                 fFirstDPS;
    uint64                  presentation_start_time;
    uint64                  presentation_end_time;
    uint8                   palette_update_flag;
    TEXTST_PALETTE          palette;
    uint8                   number_of_regions;
    uint8                   continuous_present_flag;
    uint8                   forced_on_flag[TEXTST_MAX_REGIONS_PER_DPS];
    uint8                   region_style_id_ref[TEXTST_MAX_REGIONS_PER_DPS];
} TEXTST_COMPOSITION_INFO;

/**
 * TextST Bitmap Object
 */
typedef struct tagTEXTST_BITMAP_OBJECT
{
    BOOLEAN             fValid;
    uint32              dps_number;
    UBYTE               ubNumberOfRegions;
    PVOID               pvBitmapBuffer[TEXTST_MAX_REGIONS_PER_DPS];
    IDirectFBSurface    *surface[TEXTST_MAX_REGIONS_PER_DPS];
} TEXTST_BITMAP_OBJECT;

/**
 * TextST SPB Info
 */
typedef struct tagTEXTST_SPB_INFO
{
    ULONG   ulSPBDataSize;
    ULONG   ulPktBytesLeft;
    ULONG   ulHdrBytesLeft;
    UBYTE   ubHeader[6];
} TEXTST_SPB_INFO;

/**
 * TextST Display States
 */
typedef enum tagTEXTST_DISPLAY
{
    TEXTST_DISPLAY_OFF = 0,
    TEXTST_DISPLAY_ON
} TEXTST_DISPLAY;

/* maintains handles to important DFB info */
typedef struct tagTEXTST_DFB_INFO
{
    IDirectFB               *pDFBHandle;
    IDirectFBSurface        *PrimarySurface;
    IDirectFBDisplayLayer   *DispLayer;
    IDirectFBPalette        *dfb_palette;
    IDirectFBPalette        *dfb_clear_palette;
    int                     ScreenWidth;
    int                     ScreenHeight;
} TEXTST_DFB_INFO;

/**
 * TextST Font Information
 */
typedef struct tagTEXTST_FONT_INFO
{
    PVOID   pvFontBuffer;
    uint32  uiBufferSize;
} TEXTST_FONT_INFO;

/**
 * 601 or 709 color space is used based on resolution of source content SD=601 HD=709 
 */
typedef enum tag_TEXTST_COLOR_SPACE
{
    REC_601,       
    REC_709
} TEXTST_COLOR_SPACE;


/**
 * TextST Module Info
 */
typedef struct tagTEXTST_INFO
{
    TEXTST_STATE        tState;
    TEXTST_DISPLAY      tDisplay;
    BOOLEAN             fStartPending;
    TEXTST_DSS          *pDSS;
    BOOLEAN             fDSSLoaded;
    USHORT              usNumberOfDPS;
    BYTE                *bSPB;
    OS_MEMPOOL_ID       mempoolDB;
    OS_SEM_ID           semDB;
    OS_MEMPOOL_ID       mempoolDCB;
    OS_SEM_ID           semDCB;
    OS_MEMPOOL_ID       mempoolBOB;
    OS_SEM_ID           semBOB;
    UBYTE               ubNumberOfFonts;
    TEXTST_FONT_INFO    font_info[TEXTST_MAX_FONTS];
    ULONG               ulCurPTS;
    ULONG               ulWaitStartPTS;
    ULONG               ulWaitEndPTS;
    ULONG               SysTimeBase;
    ULONG               InitalCounterTime;
    TEXTST_SPB_INFO     SPBInfo;
    TEXTST_DFB_INFO     DFBInfo;
    UBYTE               ubUserStyleID;
    ULONG               ulColorSpace;
} TEXTST_INFO;

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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