📄 ndsp_subpic.h
字号:
/* __________________________________________________________________________ AHEAD - NERO DIGITAL SUBPICTURE decoder This software implements a Nero Digital compliant subpicture decoder. Copyright (c) 2004 AHEAD, all rights reserved. __________________________________________________ http://www.nero.com __ _______________________________________________________________________*/#ifndef __ndsp_SUBPICTURE_H__#define __ndsp_SUBPICTURE_H__#define ALLOW_OS_CODE 1#include "../../rmdef/rmdef.h"// basic type definitions//typedef unsigned char Uint8;typedef unsigned short Uint16;typedef unsigned long Uint32;typedef unsigned long long Uint64;typedef signed short Int16;typedef signed long Int32;typedef signed long long Int64;typedef unsigned int Uint;typedef signed int Int;typedef unsigned char Bool;typedef void Void;typedef void * Pvoid;#define ndsp_Handle Pvoid#define ndsp_Status Uint32typedef enum { DM4V_STATUS_OK, DM4V_NO_ERROR, M4V_STATUS_PARAM, DM4V_STATUS_CORRUPT, DM4V_STATUS_PARAM,} DM4V_Status;#define MAX_NDSP_PKT_SIZE 53220// Subpicture display control commands//#define FSTA_DSP 0x00#define STA_DSP 0x01#define STP_DSP 0x02#define SET_COLOR 0x03#define SET_CONTR 0x04#define SET_DAREA 0x05#define SET_DSPXA 0x06#define CHG_COLCON 0x07#define CMD_END 0xff// Subpicture pixel data types//#define PIX_BACKG 0x00#define PIX_PATTN 0x01#define PIX_EMPH1 0x02#define PIX_EMPH2 0x03// structure to hold palette informationtypedef struct { Uint8 Alpha; Uint8 Y; Uint8 Cb; Uint8 Cr;} ndsp_ND_YUV;// structure typedef struct { Uint8 * pData[4]; Int32 iWidth; Uint32 iHeight;} ndsp_AyuvFrame;// structure to work with frame regionstypedef struct{ Int32 left; Int32 top; Int32 right; Int32 bottom;} RECT;//-----------------------------------// subpicture header// typedef struct{ Int32 spu_size; Int32 sp_dcsqt_addr;} SPUnitHeader;/*------------------------------------*//* defines subpicture display control *//*------------------------------------*/typedef struct{ ndsp_ND_YUV col_table[4]; RECT PXD_area; Int16 F0_addr; /* note : 0 is invalid */ Int16 F1_addr; /* note : 0 is invalid */ Bool display_sp;} SP_DC;/*---------------------------------------------*//* defines subpicture display control sequence *//*---------------------------------------------*/typedef struct{ Int16 sp_dcsq_stm; Uint8 * commands; Int32 data_size;} SP_DCSQ;/*---------------------------------*//* defines a subpicture packet *//*---------------------------------*/struct ND_SP_PKT{ Uint8 data[MAX_NDSP_PKT_SIZE]; SPUnitHeader spuh; Int64 pts; Bool display_sp; Bool force_disp_sp; struct ND_SP_PKT * next;};/*-------------------------------------------*//* defines a set of alpha surface parameters *//*-------------------------------------------*/typedef struct{ RECT * pArea; ndsp_ND_YUV * pColTable; Pvoid pDstBuffer; Uint32 dwStride;} ALPHA_SURFACE_PARAMS;typedef struct{ /* pointer to sp packet being built */ struct ND_SP_PKT * pCurrPacket; /* current position into the SPU buffer */ Uint8 * pCurrentBuffPos; /* pointer to current sp packet */ struct ND_SP_PKT * pSP_pkt; /* current subpicture display context */ SP_DC SPdc; /* indicates if subpic is enabled */ Bool bSubpicEnabled; /* current palette for SP color codes */ ndsp_ND_YUV Sp_Palette[16]; Bool bPaletteValid; /* alpha plane of SP coefficients */ Uint8 * pAlphaPlane; /* AYUV output buffer */ ndsp_AyuvFrame OutBuffer; /* critical section lock */// CCritSec m_csLock; /* init state */ Bool bDecoderInitialised; /* native subpicture size */ Int32 iSpWidth; Int32 iSpHeight;} ndsp_SubpicDecoder;//// interface function prototypes//// Used to create an instance of the SP decoder.ndsp_Handle ndsp_CreateInstance( Int iWidth, Int iHeight, ndsp_ND_YUV * sppal );// SP packets with timings are given to this function.DM4V_Status ndsp_ProcessSampleData( ndsp_Handle hndsp, Uint8 * pData, Uint iLength, Int64 rtPTS);// Used to destroy an instance of the SP decoder. DM4V_Status ndsp_Destroy(ndsp_Handle hndsp);// Used to reset the SP decoder (for example after discontinuities)DM4V_Status ndsp_Reset(ndsp_Handle hndsp);// Used to set the state of the SP decoder (enable/disable SP display)DM4V_Status ndsp_SetSubpicStatus(ndsp_Handle hndsp, Bool bState);// Used to query if subpicture should be blended, at a given time. // If the SP has to be blended, a non-NULL AYUV frame pointer is returned.// This should be called for every video frame.ndsp_AyuvFrame * ndsp_ShouldBlendSubpic(ndsp_Handle hndsp, Int64 rtFrameTime);#endif // __ndsp_SUBPICTURE_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -