shithub: openh264

Download patch

ref: 3b78290cd3af73d9e28c5bf25d897728d640fe4a
parent: 075d9a257e3353785547ba9938d29e9da80ec376
parent: 5482207823be12bb84282e4c30cd6be64fa19b95
author: HaiboZhu <[email protected]>
date: Thu May 22 12:21:09 EDT 2014

Merge pull request #884 from huili2/API_dec_modify_master

modify dec API from void to explicit type

--- a/codec/api/svc/codec_api.h
+++ b/codec/api/svc/codec_api.h
@@ -109,7 +109,7 @@
    */
   virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* pSrc,
       const int iSrcLen,
-      void** ppDst,
+      unsigned char** ppDst,
       SBufferInfo* pDstInfo) = 0;
 
   /*
@@ -174,7 +174,7 @@
 
 DECODING_STATE (*DecodeFrame2) (ISVCDecoder*, const unsigned char* pSrc,
                                 const int iSrcLen,
-                                void** ppDst,
+                                unsigned char** ppDst,
                                 SBufferInfo* pDstInfo);
 
 DECODING_STATE (*DecodeFrameEx) (ISVCDecoder*, const unsigned char* pSrc,
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -76,7 +76,7 @@
   uint8_t* pBuf = NULL;
   uint8_t uiStartCode[4] = {0, 0, 0, 1};
 
-  void* pData[3] = {NULL};
+  uint8_t* pData[3] = {NULL};
   uint8_t* pDst[3] = {NULL};
   SBufferInfo sDstBufInfo;
 
@@ -212,9 +212,9 @@
     pDecoder->DecodeFrame2 (pBuf + iBufPos, iSliceSize, pData, &sDstBufInfo);
 
     if (sDstBufInfo.iBufferStatus == 1) {
-      pDst[0] = (uint8_t*)pData[0];
-      pDst[1] = (uint8_t*)pData[1];
-      pDst[2] = (uint8_t*)pData[2];
+      pDst[0] = pData[0];
+      pDst[1] = pData[1];
+      pDst[2] = pData[2];
     }
     iEnd	= WelsTime();
     iTotal	+= iEnd - iStart;
@@ -247,9 +247,9 @@
 
   pDecoder->DecodeFrame2 (NULL, 0, pData, &sDstBufInfo);
   if (sDstBufInfo.iBufferStatus == 1) {
-    pDst[0] = (uint8_t*)pData[0];
-    pDst[1] = (uint8_t*)pData[1];
-    pDst[2] = (uint8_t*)pData[2];
+    pDst[0] = pData[0];
+    pDst[1] = pData[1];
+    pDst[2] = pData[2];
   }
 
   if (sDstBufInfo.iBufferStatus == 1) {
--- a/codec/decoder/plus/inc/welsDecoderExt.h
+++ b/codec/decoder/plus/inc/welsDecoderExt.h
@@ -64,7 +64,7 @@
 
   /***************************************************************************
   *	Description:
-  *		Decompress one frame, and output RGB24 or YV12 decoded stream and its length.
+  *		Decompress one frame, and output I420 or RGB24(in the future) decoded stream and its length.
   *	Input parameters:
   *       Parameter		TYPE			       Description
   *       pSrc             unsigned char*         the h264 stream to decode
@@ -83,7 +83,7 @@
 
   virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* kpSrc,
       const int kiSrcLen,
-      void** ppDst,
+      unsigned char** ppDst,
       SBufferInfo* pDstInfo);
   virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* kpSrc,
       const int kiSrcLen,
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -320,7 +320,7 @@
 
 DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
     const int kiSrcLen,
-    void** ppDst,
+    unsigned char** ppDst,
     SBufferInfo* pDstInfo) {
   if (kiSrcLen > MAX_ACCESS_UNIT_CAPACITY - MAX_MACROBLOCK_CAPACITY) {//prevent from residual reading overflow
     m_pDecContext->iErrorCode |= dsOutOfMemory;
@@ -361,7 +361,7 @@
 
   m_pDecContext->iFeedbackTidInAu             = -1; //initialize
 
-  WelsDecodeBs (m_pDecContext, kpSrc, kiSrcLen, (unsigned char**)ppDst,
+  WelsDecodeBs (m_pDecContext, kpSrc, kiSrcLen, ppDst,
                 pDstInfo); //iErrorCode has been modified in this function
 
   if (m_pDecContext->iErrorCode) {
@@ -406,7 +406,7 @@
   DstInfo.UsrData.sSystemBuffer.iWidth = iWidth;
   DstInfo.UsrData.sSystemBuffer.iHeight = iHeight;
 
-  eDecState = DecodeFrame2 (kpSrc, kiSrcLen, (void**)ppDst, &DstInfo);
+  eDecState = DecodeFrame2 (kpSrc, kiSrcLen, ppDst, &DstInfo);
   if (eDecState == dsErrorFree) {
     pStride[0] = DstInfo.UsrData.sSystemBuffer.iStride[0];
     pStride[1] = DstInfo.UsrData.sSystemBuffer.iStride[1];
--- a/test/api/BaseDecoderTest.cpp
+++ b/test/api/BaseDecoderTest.cpp
@@ -71,7 +71,7 @@
 
 
 void BaseDecoderTest::DecodeFrame(const uint8_t* src, int sliceSize, Callback* cbk) {
-  void* data[3];
+  uint8_t* data[3];
   SBufferInfo bufInfo;
   memset(data, 0, sizeof(data));
   memset(&bufInfo, 0, sizeof(SBufferInfo));
@@ -82,19 +82,19 @@
   if (bufInfo.iBufferStatus == 1 && cbk != NULL) {
     const Frame frame = {
         { // y plane
-            static_cast<uint8_t*>(data[0]),
+            data[0],
             bufInfo.UsrData.sSystemBuffer.iWidth,
             bufInfo.UsrData.sSystemBuffer.iHeight,
             bufInfo.UsrData.sSystemBuffer.iStride[0]
         },
         { // u plane
-            static_cast<uint8_t*>(data[1]),
+            data[1],
             bufInfo.UsrData.sSystemBuffer.iWidth / 2,
             bufInfo.UsrData.sSystemBuffer.iHeight / 2,
             bufInfo.UsrData.sSystemBuffer.iStride[1]
         },
         { // v plane
-            static_cast<uint8_t*>(data[2]),
+            data[2],
             bufInfo.UsrData.sSystemBuffer.iWidth / 2,
             bufInfo.UsrData.sSystemBuffer.iHeight / 2,
             bufInfo.UsrData.sSystemBuffer.iStride[1]
--- a/test/api/cpp_interface_test.cpp
+++ b/test/api/cpp_interface_test.cpp
@@ -83,7 +83,7 @@
     return static_cast<DECODING_STATE>(3);
   }
   virtual DECODING_STATE EXTAPI DecodeFrame2(const unsigned char* pSrc,
-      const int iSrcLen, void** ppDst, SBufferInfo* pDstInfo) {
+      const int iSrcLen, unsigned char** ppDst, SBufferInfo* pDstInfo) {
     EXPECT_TRUE(gThis == this);
     return static_cast<DECODING_STATE>(4);
   }