1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 19 #ifndef __PVVIDEODECBASE_H 20 #define __PVVIDEODECBASE_H 21 22 23 // includes 24 #include <e32std.h> 25 #include <e32base.h> 26 #include "mp4dec_api.h" 27 #include "dspmsgproto1.h" 28 #include "dspmsgproto2.h" 29 #include "dspmsgproto4.h" 30 #include "dsp_msg_proto6.h" 31 #include "DspMsgProto7.h" 32 #include "dspmsgproto9.h" 33 #include "dspmsgproto10.h" 34 #include "dspmsgproto11.h" 35 #include "dspmsgproto12.h" 36 #include "dspmsgproto13.h" 37 #include "dspmsgproto14.h" 38 #include "dspmsgproto15.h" 39 #include "dspmsgproto16.h" 40 #include "dspmsgproto17.h" 41 #include "dspmsgproto20.h" 42 43 #ifndef OSCL_BASE_H_INCLUDED 44 #include "oscl_base.h" 45 #endif 46 47 #ifndef VISUAL_HEADER_H_INCLUDED 48 #include "visual_header.h" 49 #endif 50 51 #ifndef PVVIDEODECODERINTERFACE_H_INCLUDED 52 #include "pvvideodecoderinterface.h" 53 #endif 54 55 #include "pvzcdt.h" 56 #define UChar uint8 57 #define MAX_LAYERS 1 58 59 #define USING_SYNC_2STEP 60 61 class PVM4VDecoder_DPI : public PVVideoDecoderInterface 62 { 63 public: 64 65 PVM4VDecoder_DPI(); 66 PVM4VDecoder_DPI(CPVDsp* aDsp); 67 ~PVM4VDecoder_DPI(); 68 static PVM4VDecoder_DPI* New(void); 69 70 IMPORT_C static PVM4VDecoder_DPI* NewL(CPVDsp* aDsp); 71 72 IMPORT_C bool InitVideoDecoder(uint8 *volbuf[], int32 *volbuf_size, int32 nLayers, int32* iWidth, int32* iHeight, int *mode); 73 74 ////// not implemeneted///////////////////////////////////////////////////////////////////////////////////////////////////////////// 75 IMPORT_C bool GetVolInfo(VolInfo* pVolInfo) {}; 76 IMPORT_C void DecPostProcess(uint8 *YUV) {}; 77 IMPORT_C void DecSetEnhReference(uint8 *refYUV, uint32 timestamp) {}; 78 IMPORT_C void SetReferenceYUV(uint8 *YUV) {}; 79 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 80 81 IMPORT_C void GetVideoDimensions(int32 *display_width, int32 *display_height) 82 { 83 *display_width = GetVideoWidth(); 84 *display_height = GetVideoHeight(); 85 }; 86 87 #ifdef USING_SYNC_2STEP 88 IMPORT_C bool getSynchResponse(uint32 timestamp[], int32 buffer_size[]); 89 IMPORT_C bool DSPDecoderBusy(); 90 #endif 91 92 IMPORT_C int32 GetVideoWidth(void); 93 IMPORT_C int32 GetVideoHeight(void); 94 IMPORT_C int32 DPIFreeVideoDecCtrls(void); 95 96 IMPORT_C void CleanUpVideoDecoder(void); 97 IMPORT_C bool IsIFrame(void); 98 99 IMPORT_C void SetPostProcType(int32 aMode); 100 101 IMPORT_C bool DecodeVideoFrame(uint8 *bitstream[], uint32 *timestamp, int32 *buffer_size, uint *use_ext_ts, uint8 *YUV); 102 IMPORT_C bool DecodeVideoFrame(uint8 *bitstream[], uint32 *timestamp, int32 *buffer_size, uint *use_ext_ts, uint8 *YUV, TRequestStatus *aRequestStatus); 103 IMPORT_C bool DecodeVideoFrameAsyncResp(uint32 timestamp[], int32 buffer_size[]); 104 105 IMPORT_C bool DecodeStillVideoFrame(uint8 *buffer, int32 buf_size, uint8 *YUV); 106 107 IMPORT_C bool GetStillVideoFrameSize(uint8 *buffer, int32 buf_size, int32 *width, int32 *height); 108 109 IMPORT_C uint8* GetDecOutputFrame(void); 110 IMPORT_C void GetDecOutputFrame(uint8*); 111 112 IMPORT_C uint8* CopyDecOutputFrameToSharedMemBuf(void); 113 114 IMPORT_C bool ResetVideoDecoder(void); 115 116 IMPORT_C TDspPointer DPIAllocVideoDecCtrls(void); 117 118 IMPORT_C uint32 GetVideoTimestamp(void); 119 120 IMPORT_C uint32 GetProfileAndLevel(void); 121 122 IMPORT_C uint32 GetDecBitrate(void); 123 124 // only port the API's used in PVPlayer 2.0 125 126 IMPORT_C bool ExtractVolHeader(uint8 *video_buffer, uint8 *vol_header, int32 *vol_header_size); 127 128 IMPORT_C void DecSetReference(uint8 *refYUV, uint32 timestamp); 129 130 #if defined USE_PV_TRANSFER_BUFFER 131 IMPORT_C inline RPVTransferBuffer& GetTxTransferBuffer() 132 { 133 return iTxTransferBuffer; 134 } 135 IMPORT_C inline RPVTransferBuffer& GetRxTransferBuffer() 136 { 137 return iRxTransferBuffer; 138 } 139 #else 140 IMPORT_C inline RTransferBuffer& GetTxTransferBuffer() 141 { 142 return iTxTransferBuffer; 143 } 144 145 IMPORT_C inline RTransferBuffer& GetRxTransferBuffer() 146 { 147 return iRxTransferBuffer; 148 } 149 #endif 150 151 IMPORT_C inline TInt GetNLayers() 152 { 153 return iNLayers; 154 } 155 156 IMPORT_C inline void SetNLayers(int32 aNLayers) 157 { 158 iNLayers = aNLayers; 159 } 160 161 TDspPointer iVideoCtrls; 162 163 protected: 164 165 void ConstructL(void); 166 bool Construct(); 167 168 CPVDsp *iDsp; 169 TDspPointer *iBitstreamDspPointer; 170 int32 iNLayers; 171 CDspMsgProto7 dspMsgProto7; 172 CDspMsgProto15 dspMsgProto15; 173 CDspMsgProto16 dspMsgProto16; 174 175 private: 176 177 bool iWaitingBitstream; 178 179 // the order of object declaration is required to ensure the proper sequence of constructor invocation 180 181 #if defined USE_PV_TRANSFER_BUFFER 182 RPVTransferBuffer iTxTransferBuffer; 183 RPVTransferWindow iTxTransferWindow; 184 RPVTransferBuffer iRxTransferBuffer; 185 RPVTransferWindow iRxTransferWindow; 186 #else 187 RTransferBuffer iTxTransferBuffer; 188 RTransferWindow iTxTransferWindow; 189 RTransferBuffer iRxTransferBuffer; 190 RTransferWindow iRxTransferWindow; 191 #endif 192 193 RPVTransferBuffer iVideoTransBuf[MAX_LAYERS]; 194 RPVTransferWindow iVideoTransWin[MAX_LAYERS]; 195 RPVTransferBuffer iVolHeaderTransBuf[MAX_LAYERS]; 196 RPVTransferWindow iVolHeaderTransWin[MAX_LAYERS]; 197 RPVTransferBuffer iDecodeBusyFlagTransBuf; 198 RPVTransferWindow iDecodeBusyFlagTransWin; 199 200 unsigned short *iDecodeBusyFlagPtr; 201 unsigned char *iVolHeader[MAX_LAYERS]; 202 unsigned char *iVideoBuffer[MAX_LAYERS]; 203 204 uint iHeight; 205 uint iWidth; 206 207 uint iBufferHeight; 208 uint iBufferWidth; 209 210 CDspMsgProto1 dspMsgProto1; 211 CDspMsgProto2 dspMsgProto2; 212 CDspMsgProto4 dspMsgProto4; 213 CDspMsgProto6 dspMsgProto6; // for SBR 214 CDspMsgProto9 dspMsgProto9; 215 CDspMsgProto10 dspMsgProto10; 216 CDspMsgProto11 dspMsgProto11; 217 CDspMsgProto12 dspMsgProto12; 218 CDspMsgProto13 dspMsgProto13; 219 CDspMsgProto14 dspMsgProto14; 220 CDspMsgProto17 dspMsgProto17; 221 CDspMsgProto20 dspMsgProto20; 222 223 int32 iCurrVideoTimeStamp; 224 uint8* iYuvOutputPtr; 225 }; 226 227 #endif 228