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

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] wm/fileformat asf_file_format_file.cpp, 1.5.4.3,
From:       gajia () helixcommunity ! org
Date:       2007-06-21 16:44:54
Message-ID: 200706211645.l5LGjN7F022128 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/wm/fileformat
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv30365

Modified Files:
      Tag: hxclient_2_1_0_cayennes
	asf_file_format_file.cpp 
Log Message:
The previously stopped video is played from the beginning when selecting "Previously \
watched" in Video Center.

"Nokia submits this code under the terms of a commercial contribution agreement with \
RealNetworks, and I am authorized to contribute this code under said agreement."

Modified by:  Gang.Jia@nokia.com Vijay.Gondi@nokia.com

Reviewed by: 

Date: 6/20/2007

Project: SymbianMmf_wm

ErrorId:  ECCI-72NCBW

Synopsis: CR: The previously stopped video is played from the beginning when \
selecting "Previously watched" in Video Center.

This CR adds the seek in stopped state - a use case for Video Center. It also merged \
in the fix from the head for WMV seek before GetPacket() in ASF file format.  
Root Cause of the problem:  Implementation.
  
Files Added:   None.

Files Modified:

/clientapps/symbianMmf/hxmmfstateclosed.cpp
/clientapps/symbianMmf/hxmmfstateclosed.h
/datatype/wm/fileformat/asf_file_format_file.cpp
/datatype/wm/fileformat/pub/asf_file_format_file.h


Image Size and Heap Use impact: no major impact

Module Release testing (STIF) :  Passed local test cases.

Test case(s) Added  :  N/A.

Memory leak check performed : N/A.

Platforms and Profiles Build Verified: helix-client-s60-32-mmf-mdf-arm

Platforms and Profiles Functionality verified: armv5

Branch: 210CayS


Index: asf_file_format_file.cpp
===================================================================
RCS file: /cvsroot/datatype/wm/fileformat/asf_file_format_file.cpp,v
retrieving revision 1.5.4.3
retrieving revision 1.5.4.4
diff -u -d -r1.5.4.3 -r1.5.4.4
--- asf_file_format_file.cpp	25 Apr 2007 14:41:39 -0000	1.5.4.3
+++ asf_file_format_file.cpp	21 Jun 2007 16:44:52 -0000	1.5.4.4
@@ -1085,69 +1085,68 @@
                 retVal = pASFObj->Unpack(pBuffer->GetBuffer(), pBuffer->GetSize());
                 if (SUCCEEDED(retVal))
                 {
-                    // Is this a Index Object or a Simple Index Object?
-                    if (pASFObj->m_eASFObjectType == HX_ASF_Index_Object)
+                    // Make sure the ASF index is set up
+                    retVal = SetupASFIndex();
+                    if (SUCCEEDED(retVal))
                     {
-                        // This is a index object. Our on-the-fly index object is
-                        // essentially the same as an index object. Therefore, we \
                will
-                        // simply copy all the information from this Index Object
-                        // and put it in our on-the-fly Index Object. That way, we \
                should
-                        // never have to seek to the end of the file again from now \
                on.
-                        if (m_pASFIndex)
+                        // Is this a Index Object or a Simple Index Object?
+                        if (pASFObj->m_eASFObjectType == HX_ASF_Index_Object)
                         {
+                            // This is a index object. Our on-the-fly index object \
is +                            // essentially the same as an index object. \
Therefore, we will +                            // simply copy all the information \
from this Index Object +                            // and put it in our on-the-fly \
Index Object. That way, we should +                            // never have to seek \
                to the end of the file again from now on.
                             \
m_pASFIndex->ImportIndexObject((CHXASFTopLevelIndexObject*) pASFObj);  }
-                    }
-                    else
-                    {
-                        // Get the WM stream number of this simple index object
-                        UINT16 usWMStreamNum = \
                GetSimpleIndexObjectStreamNumber(m_ulSimpleIndexOrderIndex);
-                        // This is a simple index object. Our on-the-fly index \
                object
-                        // contains similar information so we will first import
-                        // this information into our on-the-fly object
-                        if (m_pASFIndex)
+                        else
                         {
+                            // Get the WM stream number of this simple index object
+                            UINT16 usWMStreamNum = \
GetSimpleIndexObjectStreamNumber(m_ulSimpleIndexOrderIndex); +                        \
// This is a simple index object. Our on-the-fly index object +                       \
// contains similar information so we will first import +                            \
                // this information into our on-the-fly object
                             \
m_pASFIndex->ImportSimpleIndexObject((CHXASFTopLevelSimpleIndexObject*) pASFObj, \
                usWMStreamNum,
                                                                  \
m_pFilePropertiesObject->m_ulMaxDataPacketSize); +                            // \
Increment the index of the simple index object we have seen so far +                  \
m_ulSimpleIndexOrderIndex++;  }
-                        // Increment the index of the simple index object we have \
                seen so far
-                        m_ulSimpleIndexOrderIndex++;
-                    }
-                    // Now see if we can look up a seek offset
-                    UINT32 ulActualSeekTime  = 0;
-                    UINT32 ulSeekOffset      = 0;
-                    retVal = SearchIndexTable(m_ulDesiredSeekPresTime, FALSE, \
                ulActualSeekTime, ulSeekOffset);
-                    if (SUCCEEDED(retVal))
-                    {
-                        // We were able to look up an offset now, so
-                        // we should seek to that point and then call SeekDone()
-                        //
-                        // Since we have fixed-size packets in ASF, we can
-                        // compute the packet index we are seeking to
-                        if (m_pFilePropertiesObject &&
-                            m_pFilePropertiesObject->m_ulMaxDataPacketSize)
+                        // Now see if we can look up a seek offset
+                        UINT32 ulActualSeekTime  = 0;
+                        UINT32 ulSeekOffset      = 0;
+                        retVal = SearchIndexTable(m_ulDesiredSeekPresTime, FALSE, \
ulActualSeekTime, ulSeekOffset); +                        if (SUCCEEDED(retVal))
                         {
-                            m_ullPacketIndex = (ulSeekOffset - \
                m_ulFirstASFPacketFileOffset) /
-                                                \
m_pFilePropertiesObject->m_ulMaxDataPacketSize; +                            // We \
were able to look up an offset now, so +                            // we should seek \
to that point and then call SeekDone() +                            //
+                            // Since we have fixed-size packets in ASF, we can
+                            // compute the packet index we are seeking to
+                            if (m_pFilePropertiesObject &&
+                                m_pFilePropertiesObject->m_ulMaxDataPacketSize)
+                            {
+                                m_ullPacketIndex = (ulSeekOffset - \
m_ulFirstASFPacketFileOffset) / +                                                    \
m_pFilePropertiesObject->m_ulMaxDataPacketSize; +                            }
+                            // We are seeking to a packet, so all we need
+                            // to do is issue one seek and then we will
+                            // call back with SeekDone().
+                            m_ulState = kStateSeekFinalSeekDonePending;
+                            // Set the seek offset requested
+                            m_ulSeekOffsetRequested = ulSeekOffset;
+                            // Seek the file object
+                            m_pFileObject->Seek(ulSeekOffset, FALSE);
+                        }
+                        else
+                        {
+                            // We were not able to look up a seek offset, so keep \
reading +                            // and try to get another index object
+                            //
+                            // Set the state
+                            m_ulState = kStateSeekIndexObjectHeaderReadDonePending;
+                            // Read HX_ASF_OBJECT_HEADER_SIZE bytes
+                            m_pFileObject->Read(HX_ASF_OBJECT_HEADER_SIZE);
                         }
-                        // We are seeking to a packet, so all we need
-                        // to do is issue one seek and then we will
-                        // call back with SeekDone().
-                        m_ulState = kStateSeekFinalSeekDonePending;
-                        // Set the seek offset requested
-                        m_ulSeekOffsetRequested = ulSeekOffset;
-                        // Seek the file object
-                        m_pFileObject->Seek(ulSeekOffset, FALSE);
-                    }
-                    else
-                    {
-                        // We were not able to look up a seek offset, so keep \
                reading
-                        // and try to get another index object
-                        //
-                        // Set the state
-                        m_ulState = kStateSeekIndexObjectHeaderReadDonePending;
-                        // Read HX_ASF_OBJECT_HEADER_SIZE bytes
-                        m_pFileObject->Read(HX_ASF_OBJECT_HEADER_SIZE);
                     }
                 }
             }
@@ -3349,41 +3348,9 @@
 
     if (pPacket && m_pFilePropertiesObject)
     {
-        // Clear the return value
-        retVal = HXR_OK;
-        // Do we already have an index?
-        if (!m_pASFIndex)
-        {
-            // Set the return value
-            retVal = HXR_OUTOFMEMORY;
-            // Create the CHXASFIndex object
-            m_pASFIndex = new CHXASFIndex();
-            if (m_pASFIndex)
-            {
-                // Compute the play duration in ms
-                UINT64 ullPlayDurationInMs = \
                m_pFilePropertiesObject->m_ullPlayDuration / ((UINT64) 10000);
-                // Initialize the index object
-                retVal = m_pASFIndex->Init(m_ulNumWMStreams,
-                                           m_pusWMIndex2StreamNumber,
-                                           INT64_TO_UINT32(ullPlayDurationInMs),
-                                           \
                INT64_TO_UINT32(m_pFilePropertiesObject->m_ullPreroll),
-                                           m_ulFirstASFPacketFileOffset,
-                                           m_pIndexParametersObject);
-                if (SUCCEEDED(retVal))
-                {
-                    // We need to inform the index object about the stream types
-                    // of each of the WM streams
-                    for (UINT32 i = 0; i < m_ulNumWMStreams && SUCCEEDED(retVal); \
                i++)
-                    {
-                        // Get the WM stream number
-                        UINT16 usWMStreamNum = GetWMStreamNumber(i);
-                        // Set the stream type into the index
-                        retVal = m_pASFIndex->SetWMStreamType(usWMStreamNum, \
                GetStreamType(usWMStreamNum));
-                    }
-                }
-            }
-        }
-        if (m_pASFIndex && SUCCEEDED(retVal))
+        // Make sure the ASF index is set up
+        retVal = SetupASFIndex();
+        if (SUCCEEDED(retVal))
         {
             // Add the ASF packet to the index
             retVal = m_pASFIndex->AddASFPacketToIndex(pPacket);
@@ -3693,3 +3660,49 @@
 
     return ulRet;
 }
+
+HX_RESULT CASFFileFormatFile::SetupASFIndex()
+{
+    HX_RESULT retVal = HXR_OK;
+
+    // Do we already have an index?
+    if (!m_pASFIndex)
+    {
+        // Set the return value
+        retVal = HXR_UNEXPECTED;
+        // Make sure we've received the headers
+        if (m_pFilePropertiesObject && m_ulNumWMStreams)
+        {
+            // Set the return value
+            retVal = HXR_OUTOFMEMORY;
+            // Create the CHXASFIndex object
+            m_pASFIndex = new CHXASFIndex();
+            if (m_pASFIndex)
+            {
+                // Compute the play duration in ms
+                UINT64 ullPlayDurationInMs = \
m_pFilePropertiesObject->m_ullPlayDuration / ((UINT64) 10000); +                // \
Initialize the index object +                retVal = \
m_pASFIndex->Init(m_ulNumWMStreams, +                                           \
m_pusWMIndex2StreamNumber, +                                           \
INT64_TO_UINT32(ullPlayDurationInMs), +                                           \
INT64_TO_UINT32(m_pFilePropertiesObject->m_ullPreroll), +                             \
m_ulFirstASFPacketFileOffset, +                                           \
m_pIndexParametersObject); +                if (SUCCEEDED(retVal))
+                {
+                    // We need to inform the index object about the stream types
+                    // of each of the WM streams
+                    for (UINT32 i = 0; i < m_ulNumWMStreams && SUCCEEDED(retVal); \
i++) +                    {
+                        // Get the WM stream number
+                        UINT16 usWMStreamNum = GetWMStreamNumber(i);
+                        // Set the stream type into the index
+                        retVal = m_pASFIndex->SetWMStreamType(usWMStreamNum, \
GetStreamType(usWMStreamNum)); +                    }
+                }
+            }
+        }
+    }
+
+    return retVal;
+}


_______________________________________________
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