[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] flash/flashhost flash_guest_player.cpp, 1.31,
From:       milko () helixcommunity ! org
Date:       2007-07-31 23:38:18
Message-ID: 200707312338.l6VNcXrx028985 () dommarcmx ! xen ! 10east ! com
[Download RAW message or body]

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

Modified Files:
	flash_guest_player.cpp flash_guest_player_ns.cpp 
	flash_hosted_factory.cpp 
Log Message:
Added FLV playback support for Mac.


Index: flash_guest_player_ns.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player_ns.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- flash_guest_player_ns.cpp	9 Jul 2007 08:12:48 -0000	1.23
+++ flash_guest_player_ns.cpp	31 Jul 2007 23:38:15 -0000	1.24
@@ -96,6 +96,12 @@
 #define FLASH_WINDOW_TRANSPARENT
 //////////////////////////////////////////////
 
+#define FLASH_PACING_INTERVAL		66  // in milliseconds
+#define FLASH_FLV_PACING_INTERVAL	33  // in milliseconds
+#define FLV_PLAYTIME_UPDATE_INTERVAL	100 // in milliseconds
+
+#define SOURCE_URL_FLASH_CUSTOM_VAR	    "sourceURL"
+
 #define MAX_BUFSIZE 4096
 const UINT32 dDefaultWindowWidth=500;
[...3116 lines suppressed...]
             // Send data to the plugin
             UINT32 bytesWritten = m_PluginFuncs.write(&m_NPP, &m_NPStream, \
m_ulFileOffset - ulSize, ulSize, (void*) (pBufferRead->GetBuffer())); +#if \
defined(_MAC_UNIX) +	    // MBO - Test
+	    // printf("m_PluginFuncs.write(m_NPP=%p m_NPStream=%p Offset=%ld Size=%ld\n", \
&m_NPP, &m_NPStream, m_ulFileOffset - ulSize, ulSize); +#endif	// _MAC_UNIX
             // Did the plugin accept all the bytes?
             if (bytesWritten != ulSize)
             {
@@ -3606,6 +4761,10 @@
 
     // Check to see how many bytes the plugin can take
     UINT32 ulMaxBytes = (UINT32) m_PluginFuncs.writeready( &m_NPP, &m_NPStream);
+#if defined(_MAC_UNIX)
+    // MBO - Test
+    // printf("m_PluginFuncs.writeready(m_NPP=%p m_NPStream=%p MaxBytes=%ld\n", \
&m_NPP, &m_NPStream, ulMaxBytes); +#endif	// _MAC_UNIX
     // Compute the number of bytes left in the file buffer
     UINT32 ulBytesLeft = ((m_ulFileSize >= m_ulFileOffset) ? (m_ulFileSize - \
m_ulFileOffset) : 0);  // Do we have any bytes left to read?

Index: flash_hosted_factory.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_hosted_factory.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- flash_hosted_factory.cpp	6 Jul 2007 22:00:26 -0000	1.3
+++ flash_hosted_factory.cpp	31 Jul 2007 23:38:15 -0000	1.4
@@ -57,14 +57,20 @@
 #include "flash_guest_player.h"
 #include "flash_hosted_factory.h"
 
+#define	HELIX_FEATURE_FLASHHOST_FLV // MBO - Temp define - need to move to profile
+
 
 DEFINE_GUEST_FACTORY_NO_PLAYLISTS (CFlashHostedPluginFactory,		// Factory name
                                    CFlashGuestPlayer,			// Guest player name
                                    "Helix DNA Hosted Flash Player Plugin; \
                priority=Helix DNA 2",	// Media description
                                    "application/x-shockwave-flash",	// Mime types
-                                   "swf",				// File extensions
+#if defined(HELIX_FEATURE_FLASHHOST_FLV)
+                                   "swf|flv",				// File extensions
+#else	// HELIX_FEATURE_FLASHHOST_FLV
+				   "swf",				// File extensions
+#endif	// HELIX_FEATURE_FLASHHOST_FLV
                                    "Macromedia Flash Files (*.swf)",	// File open \
                name
-                                   "",					// Scheme extension info.
+                                   "rtmp|rtmps|file:flv",		// Scheme extension info.
                                    "application/x-shockwave-flashx");	// Mime type
 
 

Index: flash_guest_player.cpp
===================================================================
RCS file: /cvsroot/datatype/flash/flashhost/flash_guest_player.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- flash_guest_player.cpp	9 Jul 2007 08:12:48 -0000	1.31
+++ flash_guest_player.cpp	31 Jul 2007 23:38:15 -0000	1.32
@@ -75,11 +75,21 @@
 #include "filespecutils.h"
 #include "hxinter.h" // IHXEventManager
 #include "hxprefutil.h"
+#include "single_buffer_file_object.h"
 #include "platform.h"
 #include "clntcore.ver"
 
-const UINT32 dDefaultWindowWidth=500;
-const UINT32 dDefaultWindowHeight=500;
+#include "xml_flash.h"
+
+
+const UINT32 dDefaultWindowWidth = 500;
+const UINT32 dDefaultWindowHeight = 500;
+
+const UINT32 dDefaultFLVWidth = 320;
+const UINT32 dDefaultFLVHeight = 240;
+
+const UINT32 dDefaultDuration = 0;
+const UINT32 dDefaultFLVDuration = 5000;	// in milliseconds
 
 CFlashGuestPlayer::CFlashGuestPlayer()
     : m_lRefCount(0)
@@ -89,15 +99,16 @@
     , m_pResponseList(NULL)
     , m_ulFileOffset(0)
     , m_ulFileSize(0)
+    , m_ulFLVFileSize(0)
     , m_pNetworkConfig(NULL)
-    , m_ulDuration(0)
-    , m_bWindowless(FALSE)
+    , m_ulDuration(dDefaultDuration)
     , m_bTransparent(FALSE)
     , m_bLoop(TRUE)
     , m_bDisableAlphaBlending(FALSE)
     , m_pExternalInterfaceResponse(NULL)
     , m_pRepresentingSite(NULL)
     , m_bWindowlessPref(TRUE)
+    , m_bWindowless(TRUE)
     , m_bHostManagesFileIO(FALSE)
     , m_bUseDoubleBuffer(TRUE)
     , m_bShowMenuPref(TRUE)
@@ -639,6 +650,166 @@
     HXLOGL4(HXLOG_FPHR, "CFlashGuestPlayer::FixFlashURL() fixed url = %s", (const \
char*) pszURL);  }
 
+HXBOOL
+CFlashGuestPlayer::DetermineIfFLVSource(IHXRequest* pRequest, 
+					IHXFileObject* pFileObject, 
+					IHXValues* pStreamHeader)
+{
+    HX_RESULT status;
+    HXBOOL bRetVal = FALSE;
+    
+    if (pRequest)
+    {
+	const char* pURL = NULL;
+	
+	pRequest->GetURL(pURL);
+	
+	if (pURL)
+	{
+	    CHXURL* pCHXURL = new CHXURL(pURL, m_pContext);
+	
+	    if (pCHXURL)
+	    {
+		// Get the properties
+		IHXValues* pProps = pCHXURL->GetProperties();
+		if (pProps)
+		{
+		    // Get the full path
+		    IHXBuffer* pFullPathStr = NULL;
+		    status = pProps->GetPropertyBuffer(PROPERTY_FULLPATH, pFullPathStr);
+		    if (SUCCEEDED(status))
+		    {
+			// Put this into a CHXString
+			CHXString cFullPath((const char*) pFullPathStr->GetBuffer());
+			CHXString cExtension;
+			
+			// Get the last '.'
+			INT32 lPeriod = cFullPath.ReverseFind('.');
+			if (lPeriod >= 0)
+			{
+			    cExtension = cFullPath.Right(cFullPath.GetLength() - lPeriod - 1);
+			    
+			    if ((cExtension == "flv") || (cExtension == "FLV"))
+			    {
+				bRetVal = TRUE;
+			    }
+			}
+		    }
+		    
+		    HX_RELEASE(pFullPathStr);
+		    HX_RELEASE(pProps);
+		}
+	    }
+	    
+	    HX_DELETE(pCHXURL);
+	}
+    }
+    
+    m_bIsFLVSource = bRetVal;
+    
+    if (m_bIsFLVSource)
+    {
+	m_MediaSize.cx = dDefaultFLVWidth;
+	m_MediaSize.cy = dDefaultFLVHeight;
+	m_ulDuration = dDefaultFLVDuration;
+	m_bSiteless = TRUE;
+    }
+    
+    return bRetVal;
+}
+
+HX_RESULT 
+CFlashGuestPlayer::GetFLVWrapperFileObject(IHXFileObject* &pFileObject, UINT32& \
ulFileSize) +{
+    IHXFileObject* pFLVWrapperFileObject = NULL;
+    UINT32 ulFLVWrapperFileSize = 0;
+    IHXBuffer* pBuffer = NULL;
+    HX_RESULT retVal = HXR_FAIL;
+        
+#if defined(_MAC_UNIX)
+    // Obtain the FLV Wraper SWF - MBO temporary hacked load from file - will become \
part of code image +    CHXString sFlashGUIFilePath = "RealVideoViewer";
+    
+    if (CFlashGuestPlayerNS::ExpandNSPluginPath(sFlashGUIFilePath))
+    {
+	sFlashGUIFilePath += "/Contents/Resources/flvwrapper.swf";
+	retVal = HXR_OK;
+    }
+    if (SUCCEEDED(retVal))
+    {
+	CHXFileSpecifier dataFile(sFlashGUIFilePath);
+	
+	retVal = CreateBufferCCF(pBuffer, m_pContext);
+
+	if (SUCCEEDED(retVal))
+	{
+	    retVal = CHXFileSpecUtils::ReadBinaryFile(dataFile, pBuffer);
+	}
+    
+	// Create buffer fileobject containing FLV wrapper SWF.
+	if (SUCCEEDED(retVal))
+	{
+	    retVal = CHXSingleBufferFileObject::CreateFileObjectWithRequest(pBuffer, 
+									    "file:///flvwrapper.swf", 
+									    pFLVWrapperFileObject, 
+									    m_pContext);
+	}
+    }
+#endif	// _MAC_UNIX
+    
+    // Export results on success
+    if (SUCCEEDED(retVal))
+    {
+	pFileObject = pFLVWrapperFileObject;
+	pFLVWrapperFileObject = NULL;
+	ulFileSize = pBuffer->GetSize();
+    }
+    
+    HX_RELEASE(pBuffer);
+    HX_RELEASE(pFLVWrapperFileObject);
+    
+    return retVal;
+}
+
+HX_RESULT
+CFlashGuestPlayer::SendFlashMessage(const char* pCommand, const char* pArgs)
+{
+    HX_RESULT retVal = HXR_FAIL;
+    
+    if (pCommand)
+    {
+	// Create the invoke XML for ExternalInterface.call (CallFunction)
+	CHXString strInvokeXML;
+	CHXString strCommand = pCommand;
+	CHXString strArgs;
+	
+	/*** MBO - Test
+	printf("CFlashGuestPlayer::SendFlashMessage %s %s\n", pCommand, pArgs);	
+	***/
+	
+	if (pArgs)
+	{
+	    strArgs = pArgs;
+	}
+
+	retVal = CHXXMLFlash::WriteInvokeXML(strCommand, strArgs, strInvokeXML);
+
+	if (SUCCEEDED(retVal))
+	{
+	    // Create an IHXBuffer
+	    IHXBuffer* pFunction = NULL;
+	    retVal = CreateStringBufferCCF(pFunction, (const char*) strInvokeXML, \
m_pContext); +	    if (SUCCEEDED(retVal))
+	    {
+		retVal = CallExternalFunction(pFunction);
+		HX_RELEASE(pFunction);
+	    }
+	}
+    }
+
+    return retVal;
+}
+
 STDMETHODIMP
 CFlashGuestPlayer::AddExternalInterfaceResponse(IHXExternalInterfaceResponse* \
pResponse)  {


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic