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

List:       helix-datatype-dev
Subject:    [datatype-dev] CR: Fix for Bug 9720 : Messaging application can not
From:       ugundeli () real ! com
Date:       2009-11-23 0:24:50
Message-ID: 36155.67.185.163.45.1258935890.squirrel () mailone ! real ! com
[Download RAW message or body]

This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.


Project: Real Player for Android

Synopsis: Fix for Bug 9720 : Messaging application can not capture
thumbnails of video.

Overview: This CR fixes the bug 9720 : Messaging application can not
capture thumbnails of video. This bug is fixed by creating a proper fd://
formatted filename in MetaDataDriver.cpp's setDataSource() method, adding
"HELIX_FEATURE_DTDR_USE_RECOGNIZER" define to
helix-client-android-full.pf, setting "UseFileRecognition" flag for
DtDriver in thumbnail_service.cpp and finally fixing very minor problem in
ffdriver.cpp.

About the change in ffdriver.cpp: In case of State_FindFileFormats, if
"HELIX_FEATURE_DTDR_USE_RECOGNIZER" is defined, it assumes that MimeType
is already found out using recognizer. but there can be a situation where
"HELIX_FEATURE_DTDR_USE_RECOGNIZER" is defined BUT the application using
DtDriver may NOT have set "UseFileRecognition" flag and thus state 
State_RecognizeFormat NEVER gets triggered and MimeType is NULL.
Therefore, DtDriver may end up finding INCORRECT or NO fileformat at all.

Files Added: None

Files Modified:
datatype/tools/dtdriver/engine/ffdriver.cpp
player/common/dtdr_service/thumbnail_service/thumbnailservice.cpp
player/kit/android/MetaDataDriver.cpp
cvsroot/ribosome/build/umakepf/helix-client-android-full.pf

Platforms and Profiles Build and Functionality Verified:
Platform: android-donut-arm.eabi
Profile: helix-client-android
target(s): android_all

Branch: hxclient_3_6_1_atlas_restricted
        hxclient_3_1_0_atlas

Attachment:
bug9720_fix_diff.txt

thanks,
-Umakant.
["bug9720_fix_diff.txt" (text/plain)]

Index: datatype/tools/dtdriver/engine/ffdriver.cpp
===================================================================
RCS file: /cvsroot/datatype/tools/dtdriver/engine/ffdriver.cpp,v
retrieving revision 1.39.2.20
diff -u -b -B -r1.39.2.20 ffdriver.cpp
--- datatype/tools/dtdriver/engine/ffdriver.cpp	11 Feb 2009 18:23:39 -0000	1.39.2.20
+++ datatype/tools/dtdriver/engine/ffdriver.cpp	22 Nov 2009 22:44:38 -0000
@@ -772,7 +772,7 @@
             (pWriteFileName ? pWriteFileName : "NULL"));
     UINT16 iStream;
     HX_RESULT status = HXR_OK;
-
+    const char *pMimeType = NULL;
     // Clear the stop flag
     m_bStop = FALSE;
     m_bSoftStop = FALSE;
@@ -1046,14 +1046,19 @@
             case State_FindFileFormats:
                 MEMPROBE_RESET(MEMPRB_FORMATTOTAL);
                 MEMPROBE_RESET(MEMPRB_FORMATCREATE);
+            if(m_bUseFileRecognition)
+            {
 #ifdef HELIX_FEATURE_DTDR_USE_RECOGNIZER
-                const char *pMimeType = NULL;
                 pMimeType = m_strMimeType;
                 status = m_pContext->FindFileFormat(m_pFileFormat, 
                                 m_pInputFileName,
                                 m_ulFormatAttemptCount,
+                                NULL,
                                 (char *)pMimeType);
-#else
+#endif
+            }
+            else
+            {
                 status = HXR_OK;
 		if (m_pInputFileName && (!m_pFileFormat))
 		{
@@ -1076,7 +1081,7 @@
 							    m_pInputFileSysShortName);	// Use as mime-type in this context
 		    }
 		}
-#endif
+             }
                 if (SUCCEEDED(m_status))
                 {
                     m_status = status;
@@ -3788,7 +3793,7 @@
             }
             else
             {
-                m_strMimeType = pMimeType->GetBuffer();
+                m_strMimeType = (char*)pMimeType->GetBuffer();
             }
 
             m_state = State_RecognizeFormatDone;

Index: player/common/dtdr_service/thumbnail_service/thumbnailservice.cpp
===================================================================
RCS file: /cvsroot/player/common/dtdr_service/thumbnail_service/thumbnailservice.cpp,v
 retrieving revision 1.1.2.7.2.4
diff -u -b -B -r1.1.2.7.2.4 thumbnailservice.cpp
--- player/common/dtdr_service/thumbnail_service/thumbnailservice.cpp	16 Nov 2009 \
                13:13:18 -0000	1.1.2.7.2.4
+++ player/common/dtdr_service/thumbnail_service/thumbnailservice.cpp	22 Nov 2009 \
22:45:49 -0000 @@ -102,32 +102,6 @@
     long int processTimeUnit = PROCESS_TIME_UNIT;
     m_pContext = pContext;
     RetVal = HXDTDriveService::Init(pContext);
-    if (FAILED(RetVal))
-    {
-        return RetVal;
-    }
-
-    if (RetVal == HXR_OK)
-    {
-        m_pCCF->CreateInstance(CLSID_IHXValues, (void**)&m_pOptions);
-        if (m_pOptions == NULL)
-        {
-            RetVal = HXR_OUTOFMEMORY;
-        }
-        if(m_pOptions)
-        {
-            m_pOptions->SetPropertyULONG32(DECODEVIDEO_OPTION_NAME, 1);
-            m_pOptions->SetPropertyULONG32(BLOCK_OPTION_NAME, 1);
-            m_pOptions->SetPropertyULONG32(PROCESSTIMEUNITS_OPTION_NAME, \
                processTimeUnit);
-            m_pOptions->SetPropertyULONG32("StartTime", startTime);
-            m_pOptions->SetPropertyULONG32(DECODE_OPTION_NAME, 1);
-            m_pOptions->SetPropertyULONG32(SYNCHRONOUS_OPTION_NAME, 1);
-            m_pOptions->SetPropertyULONG32(COLORCONVERT_OPTION_NAME, CID_RGB24);
-            Open(m_pOptions);		
-            m_pVideothumbPicInfo = new HXVideoThumbnailPicInfo;	
-        }
-    }
-
     return RetVal;
 }
 
@@ -242,6 +216,35 @@
 HXThumbnailService::GetThumbnailData(const char * pInputFilename, \
HXVideoThumbnailPicInfo *pOutputThumbnailPicInfo)  { 
     HX_RESULT Retval = HXR_OK;
+    HXBOOL bUseRecognizer = FALSE;
+    long int startTime = START_TIME;	
+    long int processTimeUnit = PROCESS_TIME_UNIT;
+
+    if (strncmp (pInputFilename,"fd://",5) == 0) 
+    {
+        bUseRecognizer = TRUE;
+    }
+    if (Retval == HXR_OK && m_pCCF)
+    {
+        m_pCCF->CreateInstance(CLSID_IHXValues, (void**)&m_pOptions);
+        if (m_pOptions == NULL)
+        {
+            Retval = HXR_OUTOFMEMORY;
+        }
+        if(m_pOptions)
+        {
+            m_pOptions->SetPropertyULONG32(DECODEVIDEO_OPTION_NAME, 1);
+            m_pOptions->SetPropertyULONG32(BLOCK_OPTION_NAME, 1);
+            m_pOptions->SetPropertyULONG32(PROCESSTIMEUNITS_OPTION_NAME, \
processTimeUnit); +            m_pOptions->SetPropertyULONG32("StartTime", \
startTime); +            m_pOptions->SetPropertyULONG32(DECODE_OPTION_NAME, 1);
+            m_pOptions->SetPropertyULONG32(SYNCHRONOUS_OPTION_NAME, 1);
+            m_pOptions->SetPropertyULONG32(COLORCONVERT_OPTION_NAME, CID_RGB24);
+            m_pOptions->SetPropertyULONG32("UseFileRecognition", bUseRecognizer);
+            Open(m_pOptions);		
+            m_pVideothumbPicInfo = new HXVideoThumbnailPicInfo;	
+        }
+    }
 
     if(!pOutputThumbnailPicInfo)
     {
Index: player/kit/android/MetaDataDriver.cpp
===================================================================
RCS file: /cvsroot/player/kit/android/Attic/MetaDataDriver.cpp,v
retrieving revision 1.1.2.3.2.4
diff -u -b -B -r1.1.2.3.2.4 MetaDataDriver.cpp
--- player/kit/android/MetaDataDriver.cpp	10 Nov 2009 19:47:37 -0000	1.1.2.3.2.4
+++ player/kit/android/MetaDataDriver.cpp	22 Nov 2009 22:45:50 -0000
@@ -284,20 +284,34 @@
 
 status_t MetaDataDriver::setDataSource(int fd, int64_t offset, int64_t length)
 {
-    //FIXME: Currently Helix's interface only consider filename as the input
-    //       but Android will call this function from GUI. So that the temp
-    //       workaround here is to get filename from a file descriptor.
-    char tmp[256];
-    char name[256];
-    snprintf(tmp, 255, "/proc/%d/fd/%d", getpid(), fd);
-    INT32 lLen = readlink(tmp, name, 255);
-    name[lLen] = '\0';
-        if(m_pFileName)
+    int myFD = -1;
+
+    myFD = dup(fd);
+    if (myFD == -1)
         {
-                free(m_pFileName);
-                m_pFileName = NULL;
+	LOGE("setDataSource(fd, offset, length): invalid fd");
+	return BAD_VALUE;
         }
-    m_pFileName = strdup(name);
+
+    // create data source url with fd protocol scheme
+    char  pszFD[16];
+    char  pszOffset[16];
+    char  pszLength[16];
+
+    sprintf(pszFD, "%d", myFD);
+    sprintf(pszOffset, "%lld", offset);
+    sprintf(pszLength, "%lld", length);
+
+    CHXString szStringURL = "fd://";				// protocol scheme
+    szStringURL = szStringURL + "fileinput";			// default file name prefix
+    szStringURL = szStringURL + pszFD;				// attach fd number to the file name
+    szStringURL = szStringURL + "?FileDescriptor=" + pszFD;	// url parameter \
"FileDescriptor" +    szStringURL = szStringURL + "&Offset=" + pszOffset;		// url \
parameter "Offset" +    szStringURL = szStringURL + "&Length=" + pszLength;		// url \
parameter "Length" +
+    //LOGV("setDataSource(%s)", (const char*)szStringURL);
+    m_pFileName = strdup(szStringURL);
+LOGD("m_pFileName : %s",m_pFileName);
     return OK;    
 }

Index: helix-client-android-full.pf
===================================================================
RCS file: /cvsroot/ribosome/build/umakepf/helix-client-android-full.pf,v
retrieving revision 1.3
diff -u -b -B -r1.3 helix-client-android-full.pf
--- helix-client-android-full.pf	18 Nov 2009 21:23:15 -0000	1.3
+++ helix-client-android-full.pf	22 Nov 2009 22:53:57 -0000
@@ -72,6 +72,7 @@
 project.AddDefines('HELIX_FEATURE_HTTP_MEMCACHE')
 project.AddDefines('HELIX_FEATURE_FILESYSTEM_LOCAL_FD')
 project.AddDefines('HELIX_FEATURE_16BIT_MIXENGINE')
+project.AddDefines('HELIX_FEATURE_DTDR_USE_RECOGNIZER')
 
 # Remove features that are not supported
 project.RemoveDefines('USE_XWINDOWS')



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


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

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