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_STREAMING_DATA_SOURCE_H_INCLUDED
19#define PVMF_STREAMING_DATA_SOURCE_H_INCLUDED
20
21#ifndef OSCL_BASE_H_INCLUDED
22#include "oscl_base.h"
23#endif
24#ifndef OSCL_STRING_H_INCLUDED
25#include "oscl_string.h"
26#endif
27#ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
28#include "oscl_string_containers.h"
29#endif
30#ifndef PV_UUID_H_INCLUDED
31#include "pv_uuid.h"
32#endif
33#ifndef PV_INTERFACE_H_INCLUDED
34#include "pv_interface.h"
35#endif
36
37#define PVMF_STREAMING_DATASOURCE_UUID PVUuid(0x0b3fabc5,0x9f20,0x4197,0xa8,0x1c,0x32,0x54,0x0f,0xb6,0xbe,0x2c)
38
39class OsclFileHandle;
40class PVMFCPMPluginAccessInterfaceFactory;
41
42#define BITMASK_PVMF_SOURCE_INTENT_PLAY          0x00000001
43#define BITMASK_PVMF_SOURCE_INTENT_GETMETADATA   0x00000002
44#define BITMASK_PVMF_SOURCE_INTENT_PREVIEW       0x00000004
45#define BITMASK_PVMF_SOURCE_INTENT_THUMBNAILS    0x00000008
46
47//Source data for local file playback (format type PVMF_MPEG4FF & others)
48class PVMFStreamingDataSource : public PVInterface
49{
50    public:
51        //default constructor
52        PVMFStreamingDataSource(OsclFileHandle*aFileHandle = NULL)
53                : iFileHandle(aFileHandle)
54                , iPreviewMode(false)
55                , iIntent(BITMASK_PVMF_SOURCE_INTENT_PLAY)
56        {
57        }
58
59        //copy constructor
60        PVMFStreamingDataSource(const PVMFStreamingDataSource& source) : PVInterface(source)
61                , iFileHandle(source.iFileHandle)
62                , iStreamStatsLoggingURL(source.iStreamStatsLoggingURL)
63                , iPreviewMode(source.iPreviewMode)
64                , iIntent(source.iIntent)
65        {}
66
67        /* From PVInterface */
68        void addRef()
69        {
70            iRefCounter++;
71        }
72        void removeRef()
73        {
74            iRefCounter--;
75        }
76        bool queryInterface(const PVUuid& uuid, PVInterface*& iface)
77        {
78            if (uuid == PVUuid(PVMF_STREAMING_DATASOURCE_UUID))
79            {
80                iface = this;
81                return true;
82            }
83            else
84            {
85                iface = NULL;
86                return false;
87            }
88        }
89        int32 iRefCounter;
90
91        OsclFileHandle* iFileHandle;
92        //Optional file handle.
93        //When not NULL, the sdp file will be accessed using this handle.
94        //When NULL, the file will be opened using its string URL.
95
96        OSCL_wHeapString<OsclMemAllocator> iStreamStatsLoggingURL;
97        //Optional logging url.
98        //When present, streaming stats will be sent to this URL.
99        //Typically applies to MS HTTP Streaming sessions
100
101        bool iPreviewMode;
102        //Optional field to indicate if the source that is being
103        //passed in will be played back in a preview mode.
104
105        uint32 iIntent;
106        //Optional field to indicate if the source that is being
107        //passed in will be used for play back or just for metadata retrieval
108
109        OSCL_wHeapString<OsclMemAllocator> iProxyName;
110        //HTTP proxy name, either ip or dns
111        int32   iProxyPort;
112        //HTTP proxy port
113};
114
115
116#endif //PVMF_STREAMING_DATA_SOURCE_H_INCLUDED
117
118