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

List:       helix-datatype-dev
Subject:    [RESEND]Re: [datatype-dev] CR:Changes to support rmra, rmda,
From:       "Varun Kathuria" <vkathuria () real ! com>
Date:       2009-03-24 10:57:30
Message-ID: 782B2C603C614BA291D4046CA6D5643B () abc
[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.


Resending
Please Review.

Thanks
Varun Kathuria
----- Original Message ----- 
From: "Varun Kathuria" <vkathuria@real.com>
To: <ehyche@real.com>; <datatype-dev@helixcommunity.org>
Sent: Thursday, March 19, 2009 5:40 PM
Subject: Re: [datatype-dev] CR:Changes to support rmra, rmda,rdrf atom in 
mov file


> Hi Eric,
>
> Please find the updated diff with your suggested changes to use proxy file
> format.
>
> These changes done for proxy fileformat support. It is needed to support
> rmra,rmda,rdrf atom support in mov file. First filesystem object is 
> created
> from plugin handler based on protocol. After initializing the filesystem
> object, created an IHXRequest and set the URL that we got from the rdrf 
> box
> into that request. Then new mp4 file format instance is created by plugin
> handler. After creating new mp4 file format, all the file format object
> calls are proxy to new fileformat object.
>
> The diff attached is only for proxy fileformat as the other changes are
> already approved by you.
>
> Thanks
> Varun Kathuria
> ----- Original Message ----- 
> From: "Eric Hyche" <ehyche@real.com>
> To: "'Varun Kathuria'" <vkathuria@real.com>;
> <datatype-dev@helixcommunity.org>
> Sent: Thursday, March 12, 2009 7:32 PM
> Subject: RE: [datatype-dev] CR:Changes to support rmra, rmda,rdrf atom in
> mov file
>
>
>> Varun,
>>
>> Here are my comments:
>>
>> 1) datatype/mp4/fileformat/plugin.cpp - looks good
>>
>> 2) datatype/mp4/fileformat/qtatmmgs.cpp
>>
>> +    HX_DELETE(m_pRefURL);
>>
>> This was allocated with "new char []". Therefore,
>> it should be deleted with HX_VECTOR_DELETE(),
>> not HX_DELETE().
>>
>> 3) datatype/mp4/fileformat/qtatoms.cpp - looks good
>>
>> 4) datatype/mp4/fileformat/pub/qtatmmgs.h - looks good
>>
>> 5) datatype/mp4/fileformat/pub/qtatoms.h - looks good
>>
>> 6) datatype/mp4/fileformat/qtffplin.cpp
>>
>>   Ok, the problem I have with the current approach is this:
>>    - the file format for the original source
>>      is hanging - you never return the media engine's
>>      call to GetFileHeader()
>>    - the file format itself is telling the group
>>      manager to switch to the next group. This is not
>>      the job of the fileformat.
>>
>>   The more I look at this, the less I like the "group
>>   manager approach", since this will not work for
>>   profiles that don't use the group manager (like
>>   all the symbian profiles). Also, if a file like
>>   this is already in a playlist, then these changes
>>   will mess up the playlist.
>>
>>   So I think we should go with a fileformat proxy approach:
>>   that is, when we see files like this, we should
>>   create another instance of the mp4 file format plugin
>>   and simply proxy that file format from then on.
>>
>>   So in AtomReady(), if we detect that we have this
>>   kind of mov file (which references another mov file),
>>   then we:
>>
>>     - Use the plugin handler to create another instance
>>       of the mp4 file format
>>     - Create an IHXRequest and set the URL that we
>>       got from the rdrf box into that request.
>>     - Call InitFileFormat on the new file format with
>>       ourselves as the IHXFormatResponse interface (so
>>       we'll have to add IHXFormatResponse support to
>>       CQTFileFormat).
>>     - Once the new file format instance responds with
>>       InitDone(), then we need to call GetFileHeader()
>>       on it.
>>     - Once the new file format instance responds with
>>       FileHeaderReady(), then we just proxy that call
>>       to our format response.
>>     - Then for all GetStreamHeader(), GetPacket(),
>>       Seek() calls from then on, we simply proxy the
>>       call to the new file format instance.
>>
>>  This is a fairly significant change, and I'll let Leina
>>  know that this is really more than a bug fix. She may
>>  want to defer it.
>>
>> Eric
>>
>>
>>
>>
>> =======================================
>> Eric Hyche (ehyche@real.com)
>> Principal Engineer
>> RealNetworks, Inc.
>>
>>
>>>-----Original Message-----
>>>From: Varun Kathuria [mailto:vkathuria@real.com]
>>>Sent: Tuesday, March 10, 2009 2:10 AM
>>>To: ehyche@real.com; datatype-dev@helixcommunity.org
>>>Subject: Re: [datatype-dev] CR:Changes to support rmra, rmda,rdrf atom in
>>>mov file
>>>
>>>Hi Eric,
>>>
>>>Please find the updated diff.
>>>
>>>Comments Below.
>>>
>>>Thanks
>>>Varun Kathuria
>>>----- Original Message -----
>>>From: "Eric Hyche" <ehyche@real.com>
>>>To: "'Varun Kathuria'" <vkathuria@real.com>;
>>><datatype-dev@helixcommunity.org>
>>>Sent: Monday, March 09, 2009 11:17 PM
>>>Subject: RE: [datatype-dev] CR:Changes to support rmra, rmda,rdrf atom in
>>>mov file
>>>
>>>
>>>> Varun,
>>>>
>>>> Comments below...
>>>>
>>>> =======================================
>>>> Eric Hyche (ehyche@real.com)
>>>> Principal Engineer
>>>> RealNetworks, Inc.
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>From: Varun Kathuria [mailto:vkathuria@real.com]
>>>>>Sent: Tuesday, March 03, 2009 7:32 AM
>>>>>To: ehyche@real.com; datatype-dev@helixcommunity.org
>>>>>Subject: Re: [datatype-dev] CR:Changes to support rmra, rmda,rdrf atom
>>>>>in mov file
>>>>>
>>>>>Hi Eric,
>>>>>
>>>>>I have done the other changes you have suggested. But for the below
>>>>>change:
>>>>>
>>>>> > +                                IHXGroup* pGroup = NULL;
>>>>>> +                                pGroupMgr->CreateGroup(pGroup);
>>>>>> +                                // Prepare the track properties
>>>>>> +                                IHXValues* pTrackProperties = NULL;
>>>>>>
>>>>>> You do not need to create a new group - you need to get the
>>>>>> *current* group and add a track to the current group.
>>>>>>
>>>>>> +
>>>>>> + pGroupMgr->SetCurrentGroup(1);
>>>>>
>>>>>I tried to do by this code:
>>>>>
>>>>>        IHXGroup* pGroup = NULL;
>>>>>            UINT16 m_uGroupIndexWithin = 0;
>>>>>            pGroupMgr->GetCurrentGroup(m_uGroupIndexWithin);
>>>>>            pGroupMgr->GetGroup(m_uGroupIndexWithin, pGroup);
>>>>>            IHXValues* pTrackProperties = NULL;
>>>>>            IHXBuffer*  pValue = NULL;
>>>>>            if(pGroup && SUCCEEDED(CreateValuesCCF(pTrackProperties,
>>>>> m_pContext)))
>>>>>            {
>>>>>              retVal = HXR_OK;
>>>>>              if (HXR_OK == CreateAndSetBufferCCF(pValue,
>>>>>(BYTE*)szURL.GetBuffer(0), strlen(szURL)+1,
>>>>>m_pContext))
>>>>>              {
>>>>>               pTrackProperties->SetPropertyCString("url", pValue);
>>>>>               pGroup->AddTrack(pTrackProperties);
>>>>>               HX_RELEASE(pValue);
>>>>>              }
>>>>>
>>>>>But If we add the track to the same group, then i am not able to play
>>>>>the next track
>>>>>
>>>>>Here is the problem:
>>>>>
>>>>>When we add track to same group,When we add track to same group,then
>>>>>HXPlayer::InitializeRenderers, we get
>>>>>
>>>>>m_pSourceMap->GetCount()=2, for this file since we have added a Track
>>>>>in current group.
>>>>>
>>>>
>>>> Yes, I think the reason for this is that you are adding tracks in the
>>>> fileformat rather than a renderer, which is what most meta formats do.
>>>>
>>>> So when you encounter an .mp4 file like this, you add a track for the
>>>> URL in the 'url ' box. But what do you do for the URL you are
>>>> currently playing? Do you provide a stream header and any packets for
>>>> this URL?
>>>>
>>>> Eric
>>>[Varun] First CAtomizer::CompleteAtomization() calls
>>>CQTFileFormat::AtomReady().
>>>In CQTFileFormat::AtomReady(), we check for rmra atom & we extract the 
>>>url
>>>from that & fill it the
>>>next group.
>>>Because we do not have any stream in the currently playing URL, so we
>>>return HXR_OK from AtomReady()
>>>after filling up the reference url.
>>>----
>>>>
>>>>>For first source, which is for rdrf mov file (Reference file), We get
>>>>>bSourceInitialized equal to false. So it initialises
>>>>>bAllInitialized=FALSE; So 'm_bInitialized' member variable of
>>>>>HXPlayer() is always false. It never set to true. So
>>>>>HXPlayer::InitializeRenderers() is called again n again due to it. It
>>>>>calls setuplayout() and which further calls
>>>>>CHXSiteManager::HookupSingleSiteByStringHelper().
>>>>>Then inside this function i get the assert failed at
>>>>>"m_SitesToSUS.Lookup(pSite,pVoid)".
>>>>>
>>>>>In normal case, once HXFileSource::StreamHeaderReady() is called, the
>>>>>member variable m_bInitialized of SourceInfo() gets true. It
>>>>>intialises bSourceInitialized  to TRUE, and
>>>>>setuplayout() is called only
>>>>>once.
>>>>>Also i checked with other formats like ram fileformat & meta
>>>>>fileformat, they all are creating 'n'
>>>>>group for 'n' number of URL's.
>>>>>
>>>>>Can you give me some reference where we are using one group for
>>>>>different tracks and on the faliure on any of those it returns with
>>>>>some information to start a next track?
>>>>>
>>>>>
>>>>>Thanks
>>>>>
>>>>>Varun Kathuria
>>>>>
>>>>>----- Original Message -----
>>>>>
>>>>> From: Varun Kathuria <mailto:vkathuria@real.com>
>>>>> To: ehyche@real.com ; datatype-dev@helixcommunity.org
>>>>> Sent: Tuesday, March 03, 2009 8:25 AM
>>>>> Subject: Re: [datatype-dev] CR:Changes to support rmra, rmda,rdrf
>>>>> atom in mov file
>>>>>
>>>>> Hi Eric,
>>>>>
>>>>> The link i sent you is not working for me either.
>>>>>
>>>>> Please try this one:
>>>>> http://movies.apple.com/movies/wb/watchmen/watchmen-tales-
>>>>>clip_h.320.mov?width=320&height=136
>>>>><http://movies.apple.com/movies/wb/watchmen/watchmen-tales-
>>>>>clip_h.320.mov?width=320&height=136>
>>>>>
>>>>> Inside it relative url is given i.e "watchmen-tales-clip_h320.mov"
>>>>> So it will reconstructed as :
>>>>> http://movies.apple.com/movies/wb/watchmen/watchmen-tales-
>>>>>clip_h320.mov
>>>>><http://movies.apple.com/movies/wb/watchmen/watchmen-tales-clip_h320.m
>>>>>ov>
>>>>> It is working for me.
>>>>>
>>>>> Please not in the both url there is very minor difference i.e in the
>>>>>name
>>>>> 'watchmen-tales-
>>>>>clip_h.320.mov'   &  'watchmen-tales-clip_h320.mov'
>>>>> One contains h.320.mov and the other h320.mov.
>>>>>
>>>>> Thanks
>>>>> Varun Kathuria
>>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: "Eric Hyche" <ehyche@real.com <mailto:ehyche@real.com> >
>>>>> To: "'Varun Kathuria'" <vkathuria@real.com
>>>>><mailto:vkathuria@real.com> >;
>>>>> <datatype-
>>>>>dev@helixcommunity.org <mailto:datatype-dev@helixcommunity.org> >
>>>>> Cc: "'Milko Boic'" <milko@real.com <mailto:milko@real.com> >
>>>>> Sent: Monday, March 02, 2009 10:38 PM
>>>>> Subject: RE: [datatype-dev] CR:Changes to support rmra, rmda, rdrf
>>>>>atom  in mov file
>>>>>
>>>>>
>>>>> > [Milko: please note a question for you down in (3) below...]
>>>>> >
>>>>> > Varun,
>>>>> >
>>>>> > Some comments:
>>>>> >
>>>>> > 1) When I try a link from http://www.apple.com/trailers
>>>>> > <http://www.apple.com/trailers>  such
>>>>>as:
>>>>> >
>>>>> >
>>>>> > http://movies.apple.com/movies/sony_pictures/angelsanddemons/angels
>>>>> > anddemons-
>>>>>tlr2_h.480.mov?width=480&height=260
>>>>><http://movies.apple.com/movies/sony_pictures/angelsanddemons/angelsan
>>>>>ddemons-
>>>>>tlr2_h.480.mov?width=480&height=260>
>>>>> >
>>>>> >   I get a .mov file with a rmra box inside a moov box, like
>>>>> >   the .mov file I've attached.
>>>>> >
>>>>> >   The embedded URL inside this mov file is relative and is:
>>>>> >
>>>>> >   angelsanddemons-t1r2_h480.mov
>>>>> >
>>>>> >   but when I try the reconstructed URL:
>>>>> >
>>>>> >
>>>>> > http://movies.apple.com/movies/sony_pictures/angelsanddemons/angels
>>>>> > anddemons-t1r2_h480.mov
>>>>><http://movies.apple.com/movies/sony_pictures/angelsanddemons/angelsan
>>>>>ddemons-t1r2_h480.mov>
>>>>> >
>>>>> >   I get a 404 Not Found.
>>>>> >
>>>>> >   Also the file from the link you sent seems to have a circular
>>>>> > reference -
>>>>> >   the URL inside the file is the same as the file itself.
>>>>> >
>>>>> > 2) One of my concerns is that your solution of adding
>>>>> >   the URL found in the rmra/rmda/rdrf/url box to
>>>>> >   the group manager is that some profiles do not use
>>>>> >   the group manager, so this would not work for them.
>>>>> >
>>>>> >   One approach that *would* work under all circumstances
>>>>> >   would be to proxy open a file object for the URL, create
>>>>> >   a child fileformat and then have the primary file format
>>>>> >   simply proxy the child fileformat.
>>>>> >
>>>>> >   However, this is a pretty involved task. So if your team
>>>>> >   is under a tight deadline, then I would be OK with
>>>>> >   going with this approach under an appropriate HELIX_FEATURE_xxx
>>>>> >   define and then re-implementing it at a later time.
>>>>> >
>>>>> > 3) My other concern is that this seems similar to external data
>>>>> > reference
>>>>> >   atoms as defined in the ISO file format spec, which we already
>>>>> >   have support for. However, I think external data reference boxes
>>>>> >   assume that the 'url ' box is pointing to an mdat box in
>>>>> >   an external file, but not that the 'url ' is pointing to an
>>>>> >   entirely different .mov file.
>>>>> >
>>>>> >   Milko: can you confirm this?
>>>>> >
>>>>> > I will go ahead and comment on the CR as it is. However, if my
>>>>> > assumption in (3) is not correct, then we will have to re-work this
>>>>> > fix to use the existing external data reference code.
>>>>> >
>>>>> > +#define REF_URL      HX_MAKE4CC('u', 'r', 'l', ' ') /* 'url ' */
>>>>> >
>>>>> > 4cc's should be defined in the QTKnownAtomType enum in qtatoms.h,
>>>>> > not here using HX_MAKE4CC.
>>>>> >
>>>>> > +#include "ihxtlogsystem.h"
>>>>> >
>>>>> > Why do you need this include in qtatmmgs.cpp?
>>>>> >
>>>>> > +                        m_pRefURL = new char[Refurlsize+1];
>>>>> > +                        strncpy(m_pRefURL,(const char
>>>>> > *)data,Refurlsize);
>>>>> > +                        m_pRefURL[Refurlsize] = '\0';
>>>>> >
>>>>> > You should *always* check the result of a memory allocation before
>>>>> > using it. You should fail if the memory allocation does not
>>>>> > succeed.
>>>>> >
>>>>> > +                                IHXGroup* pGroup = NULL;
>>>>> > +                                pGroupMgr->CreateGroup(pGroup);
>>>>> > +                                // Prepare the track properties
>>>>> > +                                IHXValues* pTrackProperties =
>>>>> > + NULL;
>>>>> >
>>>>> > You do not need to create a new group - you need to get the
>>>>> > *current* group and add a track to the current group.
>>>>> >
>>>>> > +
>>>>> > + pGroupMgr->SetCurrentGroup(1);
>>>>> >
>>>>> > Since you will be adding a track to the current group, then you do
>>>>> > not need to call SetCurrentGroup().
>>>>> >
>>>>> > Rest looks good.
>>>>> >
>>>>> > =======================================
>>>>> > Eric Hyche (ehyche@real.com <mailto:ehyche@real.com> ) Principal
>>>>> > Engineer RealNetworks, Inc.
>>>>> >
>>>>> >
>>>>> >>-----Original Message-----
>>>>> >>From: Varun Kathuria [mailto:vkathuria@real.com]
>>>>> >>Sent: Monday, March 02, 2009 11:19 AM
>>>>> >>To: ehyche@real.com <mailto:ehyche@real.com> ;
>>>>> >>datatype-dev@helixcommunity.org
>>>>><mailto:datatype-dev@helixcommunity.org>
>>>>> >>Subject: Re: [datatype-dev] CR:Changes to support rmra, rmda, rdrf
>>>>> >>atom in mov file
>>>>> >>
>>>>> >>Hi Eric,
>>>>> >>It is the online link:
>>>>> >>http://movies.apple.com/movies/wb/observeandreport/observeandreport
>>>>> >>-tlr1_h.320.mov
>>>>> >>
>>>>> >>It can be played online. In this link, relative url is given.
>>>>> >>All the other related links can be found at
>>>>> >>http://www.apple.com/trailers
>>>>><http://www.apple.com/trailers>
>>>>> >>
>>>>> >>Thanks
>>>>> >>Varun Kathuria
>>>>> >>----- Original Message ----- From: "Eric Hyche" <ehyche@real.com
>>>>> >><mailto:ehyche@real.com> >
>>>>> >>To: "'Varun Kathuria'" <vkathuria@real.com
>>>>> >><mailto:vkathuria@real.com>
>>>>> >> >;
>>>>> >><datatype-dev@helixcommunity.org
>>>>> >><mailto:datatype-dev@helixcommunity.org> >
>>>>> >>Sent: Monday, March 02, 2009 9:16 PM
>>>>> >>Subject: RE: [datatype-dev] CR:Changes to support rmra, rmda, rdrf
>>>>> >>atom in mov file
>>>>> >>
>>>>> >>
>>>>> >>> Varun,
>>>>> >>>
>>>>> >>> Can you send me the .mov file containing these rmra/rdrf atoms?
>>>>> >>>
>>>>> >>> Eric
>>>>> >>>
>>>>> >>> =======================================
>>>>> >>> Eric Hyche (ehyche@real.com <mailto:ehyche@real.com> )
>>>>> >>> Principal Engineer
>>>>> >>> RealNetworks, Inc.
>>>>> >>>
>>>>> >>>
>>>>> >>>>-----Original Message-----
>>>>> >>>>From: datatype-dev-bounces@helixcommunity.org 
>>>>> >>>><mailto:datatype-dev-
>>>>>bounces@helixcommunity.org>
>>>>> >>>>[mailto:datatype-dev-bounces@helixcommunity.org] On
>>>>> >>>>Behalf Of Varun Kathuria
>>>>> >>>>Sent: Wednesday, February 25, 2009 6:57 AM
>>>>> >>>>To: datatype-dev@helixcommunity.org
>>>>> >>>><mailto:datatype-dev@helixcommunity.org>
>>>>> >>>>Subject: [datatype-dev] CR:Changes to support rmra, rmda, rdrf 
>>>>> >>>>atom
>>>>> >>>>in mov
>>>>> >>>>file
>>>>> >>>>
>>>>> >>>>Project: RealPlayer for MID
>>>>> >>>>
>>>>> >>>>
>>>>> >>>>Synopsis:
>>>>> >>>>Changes to support rmra, rmda, rdrf atom in mov file.
>>>>> >>>>
>>>>> >>>>Overview:
>>>>> >>>>The mov file is containing  'rmra'(Reference movie atom) atom
>>>>> >>>>instead
>>>>> >>>>of a
>>>>> >>>>'mvhd'(movie header) atom.
>>>>> >>>>The 'rmra' atom is containing 'rmda'(reference movie descriptor
>>>>> >>>>atom)
>>>>> >>>>atom. And 'rmda' atom is
>>>>> >>>>containing 'rdrf' (data reference atom) atom.
>>>>> >>>>'rdrf' can contain 'alis' or 'url'. URL can be absolute or
>>>>> >>>>relative.
>>>>> >>>>We
>>>>> >>>>are checking if we have
>>>>> >>>>rmra(Reference movie) atom & not having mvhd(movie header) atom in
>>>>> >>>>CQTFileFormat::AtomReady(). Then we
>>>>> >>>>add the that url into the groupmanager.
>>>>> >>>>
>>>>> >>>>Files Added:
>>>>> >>>>None
>>>>> >>>>
>>>>> >>>>Files Modified:
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/plugin.cpp
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/qtatmmgs.cpp
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/qtatoms.cpp
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/qtffplin.cpp
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/pub/qtatmmgs.h
>>>>> >>>>/cvsroot/datatype/mp4/fileformat/pub/qtatoms.h
>>>>> >>>>
>>>>> >>>>Image Size and Heap Use impact (Client -Only):
>>>>> >>>>None.
>>>>> >>>>
>>>>> >>>>Platforms and Profiles Affected:
>>>>> >>>>None
>>>>> >>>>
>>>>> >>>>Distribution Libraries Affected:
>>>>> >>>>None
>>>>> >>>>
>>>>> >>>>Distribution library impact and planned action:
>>>>> >>>>None
>>>>> >>>>
>>>>> >>>>Platforms and Profiles Build Verified:
>>>>> >>>>BIF branch   ->hxclient_3_1_0_atlas
>>>>> >>>>Target(s)      ->player_mid_all_installers
>>>>> >>>>Profile          ->helix-client-moblin
>>>>> >>>>SYSTEM_ID ->linux-2.2-libc6-gcc32-i586
>>>>> >>>>
>>>>> >>>>Files Attached:
>>>>> >>>>diff_mov.txt
>>>>> >>>>
>>>>> >>>>
>>>>> >>>>Thanks & Regards,
>>>>> >>>>Varun Kathuria
>>>>> >>>
>>>>> >
>>>>>
>>>>>
>>>>>________________________________
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Datatype-dev mailing list
>>>>> Datatype-dev@helixcommunity.org
>>>>> http://lists.helixcommunity.org/mailman/listinfo/datatype-dev
>>>>>
>>>>
>>>>
>>
>


--------------------------------------------------------------------------------


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

["newrmra.txt" (text/plain)]

Index: qtffplin.cpp
===================================================================
RCS file: /cvsroot/datatype/mp4/fileformat/qtffplin.cpp,v
retrieving revision 1.60.2.5
diff -u -r1.60.2.5 qtffplin.cpp
--- qtffplin.cpp	31 Dec 2008 11:22:02 -0000	1.60.2.5
+++ qtffplin.cpp	19 Mar 2009 10:41:36 -0000
@@ -89,6 +89,7 @@
 #include "qtoffsetmpr.h"
 
 #include "metainfokeys.h"
+#include "hxurl.h"
 
 /****************************************************************************
  * Constants
@@ -185,6 +186,7 @@
     , m_pOffsetToTimeMapper(NULL)
     , m_pFileObject(NULL)
     , m_ulNextPacketTime(0)
+    , m_pRedirectFFObject(NULL)
 {
     g_nRefCount_qtff++;
 }
@@ -1651,6 +1653,11 @@
  */
 STDMETHODIMP CQTFileFormat::GetPacket(UINT16 unStreamNumber)
 {
+    if(m_pRedirectFFObject)
+    {
+        return m_pRedirectFFObject->GetPacket(unStreamNumber);
+    }
+
     HX_RESULT retVal;
 
     if (unStreamNumber < m_TrackManager.GetNumStreams())
@@ -1783,6 +1790,11 @@
  */
 STDMETHODIMP CQTFileFormat::Seek(ULONG32 ulOffset)
 {
+    if(m_pRedirectFFObject)
+    {
+        return m_pRedirectFFObject->Seek(ulOffset);
+    }
+
     UINT16 uStreamNum;
     HX_RESULT retVal = HXR_OK;
 
@@ -1885,7 +1897,7 @@
 	m_pFileObject->Close();
 	HX_RELEASE(m_pFileObject);
     }
-
+    HX_RELEASE(m_pRedirectFFObject);
     m_TrackManager.CloseTracks();
 
     return HXR_OK;
@@ -2020,7 +2032,7 @@
 		m_pAtomizer->Close();
 		m_pAtomizer->Release();
 		m_pAtomizer = NULL;
-	    } 
+	    }
 	}
 	else
 	{
@@ -2057,9 +2069,51 @@
 	    }
 	}
 #endif	// QTCONFIG_PACKETIZER_FACTORY
-	
+
 	if (SUCCEEDED(status))
 	{
+        CQT_moov_Atom *pMoovAtom = NULL;
+        pMoovAtom = (CQT_moov_Atom *)pRootAtom->FindPresentChild(QT_moov);
+        if(pMoovAtom)
+        {
+            HX_RESULT retVal = HXR_FAIL;
+            CQT_mvhd_Atom *pMovieHeaderAtom = NULL;
+            pMovieHeaderAtom = (CQT_mvhd_Atom*)pMoovAtom->FindPresentChild(QT_mvhd);
+            CQT_rmra_Atom *pRmraHeaderAtom = NULL;
+            pRmraHeaderAtom = (CQT_rmra_Atom*)pMoovAtom->FindPresentChild(QT_rmra);
+            if(!pMovieHeaderAtom && pRmraHeaderAtom)
+            {
+                status = m_MovieInfo.Init(pRootAtom->FindPresentChild(QT_moov), \
&m_TrackManager); +                if (SUCCEEDED(status))
+                {
+                        retVal = HXR_FAIL;
+                        // Get the Reference Url
+                        const char* pszReferenceURL = NULL;
+                        pszReferenceURL = m_MovieInfo.GetRefURL();
+                        if(pszReferenceURL)
+                        {
+                            CHXString szURL="";
+                            CHXURL purl(pszReferenceURL,m_pContext);
+                            if(purl.IsRelativeURL())
+                            {
+                                //If the URL is relative, then this code changes it \
to absolute URL. +                                const char *poriginal_url = NULL;
+                                m_pRequest->GetURL(poriginal_url);
+                                const char *prel = strrchr(poriginal_url,'/');
+                                szURL = poriginal_url;
+                                szURL = szURL.Left(prel-poriginal_url+1);
+                                szURL += pszReferenceURL;
+                            }
+                            else
+                            {
+                                szURL = pszReferenceURL;
+                            }
+                            retVal = CreateNewFileFormatObject(szURL.GetBuffer(0));
+                        }
+                }
+                return retVal;
+            }
+        }
 	    HXBOOL bIgnoreHintTracks = FALSE;
 	    do
 	    {
@@ -2169,6 +2223,20 @@
 STDMETHODIMP CQTFileFormat::Subscribe(UINT16 uStreamNum,
 				      UINT16 uRuleNumber)
 {
+    if(m_pRedirectFFObject)
+    {
+        IHXASMSource* pASMSource=NULL;
+        if(HXR_OK==m_pRedirectFFObject->QueryInterface(IID_IHXASMSource,(void \
**)&pASMSource)) +        {	
+            HX_RESULT retval = pASMSource->Subscribe(uStreamNum,uRuleNumber);
+            HX_RELEASE(pASMSource);
+            return retval;
+        }
+        else
+        {
+            return HXR_FAIL;
+        }
+    }
     return m_TrackManager.Subscribe(uStreamNum, uRuleNumber);
 }
 
@@ -2178,6 +2246,20 @@
 STDMETHODIMP CQTFileFormat::Unsubscribe(UINT16 uStreamNum,
 					UINT16 uRuleNumber)
 {
+    if(m_pRedirectFFObject)
+    {
+        IHXASMSource* pASMSource=NULL;
+        if(HXR_OK==m_pRedirectFFObject->QueryInterface(IID_IHXASMSource,(void \
**)&pASMSource)) +        {	
+            HX_RESULT retval = pASMSource->Unsubscribe(uStreamNum,uRuleNumber);
+            HX_RELEASE(pASMSource);
+            return retval;
+        }
+        else
+        {
+            return HXR_FAIL;
+        }
+    }
     return m_TrackManager.Unsubscribe(uStreamNum, uRuleNumber);
 }
 
@@ -2972,6 +3054,11 @@
  */
 STDMETHODIMP CQTFileFormat::GetFileHeader()
 {
+    if(m_pRedirectFFObject)
+    {
+        return m_pRedirectFFObject->GetFileHeader();
+    }
+
     HX_RESULT retVal = HXR_UNEXPECTED;
 
     if (m_State == QTFF_Ready)
@@ -3003,9 +3090,14 @@
  */
 STDMETHODIMP CQTFileFormat::GetStreamHeader(UINT16 unStreamNumber)
 {
+    if(m_pRedirectFFObject)
+    {
+        return m_pRedirectFFObject->GetStreamHeader(unStreamNumber);
+    }
+    
     HX_RESULT retVal;
     IHXValues* pHeader;
-
+    
     retVal = ObtainStreamHeader(unStreamNumber, pHeader);
 
     m_pFFResponse->StreamHeaderReady(retVal, pHeader);
@@ -3015,3 +3107,132 @@
     return retVal;
 }
 
+HX_RESULT CQTFileFormat::CreateNewFileFormatObject(char* purl)
+{
+    HX_RESULT theErr = HXR_FAIL;
+    char*   pExtension = "mov"; //rmra can only contain QuickTime movie reference
+    IHXPluginHandler3* pPlugin2Handler3 = NULL;
+    IHXPlugin*  pPlugin      = NULL;
+    IUnknown* pCurrentFileFormatUnk = NULL;
+    IHXPluginSearchEnumerator* pFileFormatEnumerator = NULL;
+    IHXFileObject* pFileObject = NULL;
+    IHXRequest* pRequest = NULL;
+    IUnknown*	    pUnknown = NULL;
+    IUnknown*	    pObject = NULL;
+    IHXFileSystemObject* pFSObject = NULL;
+    IHXPlugin2Handler* pPlugin2Handler = NULL;
+    IHXPlugin *pHXPlugin = NULL;
+    IHXRequestHandler* pRequestHandler=NULL;
+
+    const char* pProtocolEnd = HXFindChar(purl,':');
+    if (!pProtocolEnd)
+    {
+        return HXR_UNEXPECTED;
+    }
+
+    int nLength = pProtocolEnd - purl;
+    CHXString strProtocol(purl,nLength);
+
+    if (FAILED(m_pContext->QueryInterface(IID_IHXPlugin2Handler, \
(void**)&pPlugin2Handler))) +    {
+        goto exit;
+    }
+
+    if (FAILED( pPlugin2Handler->FindPluginUsingStrings(PLUGIN_CLASS, \
PLUGIN_FILESYSTEM_TYPE,  +        PLUGIN_FILESYSTEMPROTOCOL, (char*)(const \
char*)strProtocol, NULL, NULL, pUnknown))) +    {
+        goto exit;
+    }
+
+    if(FAILED(pUnknown->QueryInterface(IID_IHXFileSystemObject, (void**) \
&pFSObject))) +    {
+        goto exit;
+    }
+
+    if (FAILED (pFSObject->QueryInterface(IID_IHXPlugin,(void**)&pHXPlugin)))
+    {
+        goto exit;
+    }
+
+    if (FAILED(pHXPlugin->InitPlugin(m_pContext)))
+    {
+        goto exit;
+    }
+
+    if (FAILED(pFSObject->CreateFile(&pObject)))
+    {
+        goto exit;
+    }
+
+    if (FAILED(pObject->QueryInterface(IID_IHXFileObject, (void**)&pFileObject)))
+    {
+        goto exit;
+    }
+
+    if (FAILED(pObject->QueryInterface(IID_IHXRequestHandler, \
(void**)&pRequestHandler))) +    {
+        goto exit;
+    }
+
+    if(m_pClassFactory && (HXR_OK \
!=m_pClassFactory->CreateInstance(CLSID_IHXRequest, (void**) &pRequest))) +    {
+        goto exit;
+    }
+
+    if (pRequest)
+    {
+        IHXBuffer* pValue = NULL;
+        pRequest->SetURL((const char*)purl); // Set the reference URL
+        pRequestHandler->SetRequest(pRequest);
+    }
+	
+    if(m_pContext && (HXR_OK != m_pContext->QueryInterface(IID_IHXPluginHandler3, \
(void**) &pPlugin2Handler3))) +    {
+        goto exit;
+    }
+
+    if (FAILED(pPlugin2Handler3->FindGroupOfPluginsUsingStrings(PLUGIN_CLASS, \
PLUGIN_FILEFORMAT_TYPE,  +            PLUGIN_FILEEXTENSIONS, pExtension, 0 ,0, \
pFileFormatEnumerator))) +    {
+        goto exit;
+    }
+
+    if (pFileFormatEnumerator)
+    {
+        pFileFormatEnumerator->GetNextPlugin(pCurrentFileFormatUnk, NULL);
+        HX_ASSERT(pCurrentFileFormatUnk != NULL);
+    }
+
+    if (FAILED( pCurrentFileFormatUnk->QueryInterface(IID_IHXFileFormatObject, \
(void**) &m_pRedirectFFObject))) +    {
+        goto exit;
+    }
+
+    if (FAILED(m_pRedirectFFObject->QueryInterface(IID_IHXPlugin,(void**)&pPlugin)))
+    {
+        goto exit;
+    }
+
+    if (FAILED(pPlugin->InitPlugin((IUnknown*) (IHXStreamSource*)this)))
+    {
+        goto exit;
+    }
+	
+    theErr = m_pRedirectFFObject->InitFileFormat(pRequest,m_pFFResponse,pFileObject);
 +
+exit:
+    HX_RELEASE(pPlugin2Handler);
+    HX_RELEASE(pUnknown);
+    HX_RELEASE(pFSObject);
+    HX_RELEASE(pHXPlugin);
+    HX_RELEASE(pObject);
+    HX_RELEASE(pFileObject);
+    HX_RELEASE(pRequestHandler);
+    HX_RELEASE(pRequest);
+    HX_RELEASE(pPlugin2Handler3);
+    HX_RELEASE(pFileFormatEnumerator);
+    HX_RELEASE(pCurrentFileFormatUnk);
+    HX_RELEASE(pPlugin);
+    return theErr;
+}
+
Index: pub/qtffplin.h
===================================================================
RCS file: /cvsroot/datatype/mp4/fileformat/pub/qtffplin.h,v
retrieving revision 1.17.8.2
diff -u -r1.17.8.2 qtffplin.h
--- pub/qtffplin.h	28 Apr 2008 17:30:19 -0000	1.17.8.2
+++ pub/qtffplin.h	19 Mar 2009 10:41:36 -0000
@@ -309,7 +309,7 @@
     HX_RESULT GetResourceErrorString(UINT32 ulErrorID, CHXString& rErrorStr);
 
     void  WarnIfNotHinted(HX_RESULT status, HXBOOL bIgnoreHintTracks);
-    
+    HX_RESULT  CreateNewFileFormatObject(char* purl);
     IHXScheduler* m_pScheduler;
 
     IHXErrorMessages*	m_pErrorMessages;
@@ -365,6 +365,7 @@
     CQTOffsetToTimeMapper* m_pOffsetToTimeMapper;
     IHXFileObject*  m_pFileObject;
     UINT32 m_ulNextPacketTime;	// in milliseconds
+    IHXFileFormatObject*   m_pRedirectFFObject;
 };
 
 



_______________________________________________
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