[Datatype-cvs] flash/flashhost/platform/win32 flash_guest_player_ax.cpp, 1.21.2.25, 1.21.2.26 hxurlmoniker.cpp, 1.2.2.3, 1.2.2.4

[Datatype-cvs] flash/flashhost/platform/win32 flash_guest_player_ax.cpp, 1.21.2.25, 1.21.2.26 hxurlmoniker.cpp, 1.2.2.3, 1.2.2.4

sfu at helixcommunity.org sfu at helixcommunity.org
Wed May 14 09:16:48 PDT 2008


Update of /cvsroot/datatype/flash/flashhost/platform/win32
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26378/platform/win32

Modified Files:
      Tag: hxclient_3_1_0_atlas
	flash_guest_player_ax.cpp hxurlmoniker.cpp 
Log Message:
bug 217200 fix, check 'FLV' header magic number to block h.264 FLV

Index: hxurlmoniker.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/platform/win32/hxurlmoniker.cpp,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -d -r1.2.2.3 -r1.2.2.4
--- hxurlmoniker.cpp	17 Jan 2008 01:35:26 -0000	1.2.2.3
+++ hxurlmoniker.cpp	14 May 2008 16:16:45 -0000	1.2.2.4
@@ -634,6 +634,7 @@
                 }
             }
             // Is the first buffer we've gotten for this URL?
+            retVal = HXR_OK;
             if (m_ulFileOffset == 0 && m_pResponse)
             {
                 // Get the buffer counters
@@ -641,11 +642,11 @@
                 UINT32 ulLen = pBuffer->GetSize();
                 // Parse the SWF header
                 CHXSWFHeader cSWFHdr;
-                HX_RESULT rv = cSWFHdr.Unpack(&pBuf, &ulLen);
-                if (SUCCEEDED(rv))
+                retVal = cSWFHdr.Unpack(&pBuf, &ulLen);
+                if (SUCCEEDED(retVal))
                 {
                     // Call back to the response and give it the Flash header info
-                    m_pResponse->OnFlashHeader((const wchar_t*) m_pURLStr->GetBuffer(),
+                    retVal = m_pResponse->OnFlashHeader((const wchar_t*) m_pURLStr->GetBuffer(),
                                                cSWFHdr.GetVersion(),
                                                cSWFHdr.GetFileLength(),
                                                cSWFHdr.GetWidthInPixels(),
@@ -653,14 +654,24 @@
                                                cSWFHdr.GetFrameRate(),
                                                cSWFHdr.GetNumFrames());
                 }
+                else
+                {
+                    // Give response the raw header to give it a chance to process it
+                    retVal = m_pResponse->OnRawHeader((const wchar_t*) m_pURLStr->GetBuffer(), pBuffer);
+                }
             }
-            // Update the file offset
-            m_ulFileOffset += ulReadSize;
-            // Add this buffer to the IStream object
-            m_pIStreamHXBuffer->AppendBuffer(pBuffer);
-            // Get the IStream interface from CIStreamIHXBuffer object
+
             IStream* pIStream = NULL;
-            retVal = m_pIStreamHXBuffer->QueryInterface(IID_IStream, (void**) &pIStream);
+            if (SUCCEEDED(retVal))
+            {
+                // Update the file offset
+                m_ulFileOffset += ulReadSize;
+                // Add this buffer to the IStream object
+                m_pIStreamHXBuffer->AppendBuffer(pBuffer);
+                // Get the IStream interface from CIStreamIHXBuffer object
+                retVal = m_pIStreamHXBuffer->QueryInterface(IID_IStream, (void**) &pIStream);
+            }
+
             if (SUCCEEDED(retVal))
             {
                 // Set up the STGMEDIUM struct
@@ -771,6 +782,7 @@
                 retVal = status;
             }
         }
+
         if (FAILED(retVal))
         {
             // Set the state

Index: flash_guest_player_ax.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/platform/win32/flash_guest_player_ax.cpp,v
retrieving revision 1.21.2.25
retrieving revision 1.21.2.26
diff -u -d -r1.21.2.25 -r1.21.2.26
--- flash_guest_player_ax.cpp	13 May 2008 21:59:06 -0000	1.21.2.25
+++ flash_guest_player_ax.cpp	14 May 2008 16:16:45 -0000	1.21.2.26
@@ -2689,11 +2689,12 @@
             {
                 // Yes, this is the same URL that was passed into Open()
                 //
+                
+                // Note: values not correct for compressed SWF
                 // Save the media width and height
                 m_MediaSize.cx = (INT32) ulWidth;
                 m_MediaSize.cy = (INT32) ulHeight;
                 // Save the frame rate
-                // Note: values not correct for compressed SWF
                 m_dFrameRate = dFrameRate;
             }
         }
@@ -2702,6 +2703,50 @@
     return retVal;
 }
 
+STDMETHODIMP CFlashGuestPlayerAX::OnRawHeader(const wchar_t* pwszURL, IHXBuffer* pHeader)
+{
+    HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayerAX::OnRawHeader(pwszURL=%S,size=%u)", pwszURL, pHeader->GetSize());
+    HX_RESULT retVal = HXR_INVALID_PARAMETER;
+
+    if (pwszURL)
+    {
+        // Clear the return value
+        retVal = HXR_OK;
+        // Do we have a wide-char URL
+        if (m_pwszURL)
+        {
+            // Is this the same URL?
+            if (!wcscmp(pwszURL, (const wchar_t*) m_pwszURL))
+            {
+                // Yes, this is the same URL that was passed into Open()
+                //
+                // If it is not SWF (which will get call with OnFlashHeader)
+                // it must be a FLV
+                BYTE*  pBuf  = pHeader->GetBuffer();
+                if (pBuf[0] != 'F' || pBuf[1] != 'L' || pBuf[2] != 'V')
+                {
+                    // header parsing error, not a supported FLV file
+                    retVal = HXR_INVALID_FILE;
+
+                    // send out error msg
+                    IHXBuffer* pErrMsg = NULL;
+                    CreateBufferCCF(pErrMsg, m_pContext);
+                    if (pErrMsg)
+                    {
+                        const char* errMsg = "";
+                        pErrMsg->Set((UINT8*)errMsg, strlen(errMsg)+1);
+                        CallAllResponseError(retVal, pErrMsg);
+                        HX_RELEASE(pErrMsg);
+                    }
+                }
+            }
+        }
+    }
+
+    return retVal;
+}
+
+
 HXBOOL
 CFlashGuestPlayerAX::CopyBitmapToOffscreenBuffer(RECT* pRect, HXBOOL bErase)
 {




More information about the Datatype-cvs mailing list
 

Site Map   |   Terms of Use   |   Privacy Policy   |   Contact Us

Copyright © 1995-2007 RealNetworks, Inc. All rights reserved. RealNetworks and Helix are trademarks of RealNetworks.
All other trademarks or registered trademarks are the property of their respective holders.