• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #ifndef PVMF_LOCAL_DATA_SOURCE_H_INCLUDED
19 #define PVMF_LOCAL_DATA_SOURCE_H_INCLUDED
20 
21 #ifndef OSCL_BASE_H_INCLUDED
22 #include "oscl_base.h"
23 #endif
24 #ifndef PV_UUID_H_INCLUDED
25 #include "pv_uuid.h"
26 #endif
27 #ifndef PV_INTERFACE_H_INCLUDED
28 #include "pv_interface.h"
29 #endif
30 
31 #define PVMF_LOCAL_DATASOURCE_UUID PVUuid(0xee849325,0x158a,0x4eb5,0xbd,0x4a,0xb8,0xb4,0x9d,0x77,0x4b,0x92)
32 
33 class OsclFileHandle;
34 class PVMFCPMPluginAccessInterfaceFactory;
35 
36 #define BITMASK_PVMF_SOURCE_INTENT_PLAY          0x00000001
37 #define BITMASK_PVMF_SOURCE_INTENT_GETMETADATA   0x00000002
38 #define BITMASK_PVMF_SOURCE_INTENT_PREVIEW       0x00000004
39 #define BITMASK_PVMF_SOURCE_INTENT_THUMBNAILS    0x00000008
40 
41 //Source data for local file playback (format type PVMF_MPEG4FF & others)
42 class PVMFLocalDataSource : public PVInterface
43 {
44     public:
45         //default constructor
46         PVMFLocalDataSource(OsclFileHandle*aFileHandle = NULL)
iFileHandle(aFileHandle)47                 : iFileHandle(aFileHandle)
48                 , iPreviewMode(false)
49                 , iIntent(BITMASK_PVMF_SOURCE_INTENT_PLAY)
50                 , iContentAccessFactory(NULL)
51         {
52         }
53 
54         //copy constructor
PVMFLocalDataSource(const PVMFLocalDataSource & source)55         PVMFLocalDataSource(const PVMFLocalDataSource& source) : PVInterface(source)
56                 , iFileHandle(source.iFileHandle)
57                 , iPreviewMode(source.iPreviewMode)
58                 , iIntent(source.iIntent)
59                 , iContentAccessFactory(source.iContentAccessFactory)
60         {}
61 
62         /* From PVInterface */
addRef()63         void addRef()
64         {
65             iRefCounter++;
66         }
removeRef()67         void removeRef()
68         {
69             iRefCounter--;
70         }
queryInterface(const PVUuid & uuid,PVInterface * & iface)71         bool queryInterface(const PVUuid& uuid, PVInterface*& iface)
72         {
73             if (uuid == PVUuid(PVMF_LOCAL_DATASOURCE_UUID))
74             {
75                 iface = this;
76                 return true;
77             }
78             else
79             {
80                 iface = NULL;
81                 return false;
82             }
83         }
84         int32 iRefCounter;
85 
86         OsclFileHandle* iFileHandle;
87         //Optional file handle.
88         //When not NULL, the file will be accessed using this handle.
89         //When NULL, the file will be opened using its string URL.
90 
91         bool iPreviewMode;
92         //Optional field to indicate if the source that is being
93         //passed in will be played back in a preview mode.
94 
95         uint32 iIntent;
96         //Optional field to indicate if the source that is being
97         //passed in will be used for play back or just for metadata retrieval
98 
99         PVMFCPMPluginAccessInterfaceFactory* iContentAccessFactory;
100 };
101 
102 
103 
104 #endif //PVMF_LOCAL_DATA_SOURCE_H_INCLUDED
105 
106