• 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_NODES_SYNC_CONTROL_H_INCLUDED
19 #define PVMF_NODES_SYNC_CONTROL_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 #ifndef PVMF_TIMESTAMP_H_INCLUDED
31 #include "pvmf_timestamp.h"
32 #endif
33 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
34 #include "pvmf_node_interface.h"
35 #endif
36 #ifndef PVMF_RETURN_CODES_H_INCLUDED
37 #include "pvmf_return_codes.h"
38 #endif
39 #ifndef PVMF_EVENT_HANDLING_H_INCLUDED
40 #include "pvmf_event_handling.h"
41 #endif
42 
43 #define PvmfNodesSyncControlUuid PVUuid(0xd4d82607,0xbca5,0x43e3,0x88,0x30,0xa3,0x1b,0x36,0x0a,0xb5,0xf2)
44 
45 // Forward declarations
46 class PVMFMediaClock;
47 
48 /**
49  * Configuration interface used by data sink nodes to synchronize rendering of media data
50  * and handle repositioning.
51  */
52 class PvmfNodesSyncControlInterface : public PVInterface
53 {
54     public:
55         /**
56          * Sets the clock to which media data is synchronized.
57          *
58          * @param aClock Clock object to which media data is synchronized.
59          * @return Completion status.
60          */
61         virtual PVMFStatus SetClock(PVMFMediaClock* aClock) = 0;
62 
63         /**
64          * Notifies the data sink node that clock rate is changing. Also allows
65          * the underlying data sink node to tell whether the new rate can be supported
66          * via the return code.
67          *
68          * @param aRate The new playback rate expressed in millipercent of "real-time" playback
69          * @return PVMFSuccess if the data sink can handle the new rate. PVMFFailure if it cannot
70          **/
71         virtual PVMFStatus ChangeClockRate(int32 aRate) = 0;
72 
73         /**
74          * Configure the criteria to determine whether media data is early or late.
75          *
76          * Media data is considered early if it has a timestamp earlier than the current time of the clock by
77          * the early margin.  The media data will be scheduled to be processed at the later time that is
78          * synchronized to the clock.  Media data is considered late if it has a timestamp later than the
79          * current time of the clock by the late margin and will be dropped.
80          *
81          * @param aEarlyMargin Early margin in milliseconds.
82          * @param aLateMargin Late margin in milliseconds.
83          * @return Completion status
84          */
85         virtual PVMFStatus SetMargins(int32 aEarlyMargin, int32 aLateMargin) = 0;
86 
87         /**
88          * Notification that the clock has started
89          *
90          * The clock reference passed in by SetClock() can be controlled outside of
91          * the node. This lets the controller of the clock notify the node when the clock
92          * has started progressing
93          *
94          * @return None
95          */
96         virtual void ClockStarted(void) = 0;
97 
98         /**
99          * Notification that the clock has stopped
100          *
101          * The clock reference passed in by SetClock() can be controlled outside of
102          * the node. This lets the controller of the clock notify the node when the clock
103          * has stopped progressing due to Pause() or Stop() being called on the clock.
104          *
105          * @return None
106          */
107         virtual void ClockStopped(void) = 0;
108 
109         /**
110          * Skip processing media data until a specified timestamp
111          *
112          * Media data with timestamp before the specified starting and resume timestamp will be skipped.  Default
113          * behaviour is to drop all skipped data, where SyncMediaData API will return -1 for all timestamps
114          * before the starting/resume time.  If aRenderSkippedData is set to true, SyncMediaData API will return
115          * 0 for all timestamps after the starting time but before the resume time to indicate forced rendering of all skipped data.
116          * This method is asynchronous and the completion of this command will be sent through the
117          * PVMFNodeCmdStatusObserver of the node implementing this interface.
118          *
119          * @param aSessionId Session ID returned when creating a session with the node
120          * @param aResumeTimestamp Timestamp at which normal evaluation of timestamp against the clock will resume. This timestamp
121          *                         must be greater than or equal to aStartingTimestamp
122          * @param aPlayBackPositionContinuous When set to true, this is meant to notify the data sink that
123          *        this skip media data call does not relate to a change in source position. Or in
124          *        other words source is continuous. Example: Smart Forward Repositioning (SFR). In this case the source node
125          *        remains in the same position but sinks are asked to skip thru media data segments.
126          * @param aContext Optional opaque data to be passed back to user with the command response
127          * @returns A unique command id for asynchronous completion.
128          */
129         virtual PVMFCommandId SkipMediaData(PVMFSessionId aSessionId,
130                                             PVMFTimestamp aResumeTimestamp,
131                                             uint32 aStreamID = 0,
132                                             bool aPlayBackPositionContinuous = false,
133                                             OsclAny* aContext = NULL) = 0;
134 };
135 
136 #endif // PVMF_NODES_SYNC_CONTROL_H_INCLUDED
137 
138 
139 
140 
141