|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Telephony Multimedia Service |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef TMS_CLIENT_SINK_H |
|
19 #define TMS_CLIENT_SINK_H |
|
20 |
|
21 #include <tms.h> |
|
22 #include <tmssink.h> |
|
23 |
|
24 namespace TMS { |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class TMSClientSinkBody; |
|
28 class TMSClientSinkObserver; |
|
29 class TMSBuffer; |
|
30 |
|
31 /** |
|
32 * TMSClientSink class |
|
33 * |
|
34 * This class provides TMS client sink interface. It serves as a data sink |
|
35 * to the TMS, which supplies the client with buffers recorded by the a/v |
|
36 * recording device. The constant flow of data between the a/v recorder |
|
37 * device and the client is accomplished by sending BufferProcessed() events |
|
38 * in response to TMSClientSinkObserver::ProcessBuffer sink observer callbacks. |
|
39 * This indicates to the TMS that the supplied buffer has been consumed by the |
|
40 * client and it is ready to receive more recorded data. |
|
41 * |
|
42 * @lib tmsapi.lib |
|
43 * |
|
44 */ |
|
45 class TMSClientSink : public TMSSink |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Destructor |
|
50 */ |
|
51 IMPORT_C virtual ~TMSClientSink(); |
|
52 |
|
53 /** |
|
54 * Add client as an observer for this sink object. |
|
55 * |
|
56 * This function can be called at any time. It is recommended adding the |
|
57 * observer before calling any functions on the sink. Otherwise, the |
|
58 * observer may miss a callback. |
|
59 * |
|
60 * A reference to the obsrvr is stored in the sink. The QueueEvent function |
|
61 * will be called when a sink event occurs. When the sink object is deleted, |
|
62 * all TMSClientSinkObserver references are automatically released. The |
|
63 * ownership of the obsrvr is still maintained by the client. Should the |
|
64 * client need to delete the obsrvr before deleting the sink, it should |
|
65 * remove all the obsrvr reference from the sink by calling RemoveObserver() |
|
66 * function. |
|
67 * |
|
68 * @param obsrvr |
|
69 * Listener to be added. |
|
70 * |
|
71 * @param user_data |
|
72 * Any user data passed to the function. |
|
73 * |
|
74 * @return |
|
75 * TMS_RESULT_SUCCESS if the operation was successful. |
|
76 * TMS_RESULT_ALREADY_EXIST if the obsrvr is already in the list. |
|
77 * |
|
78 */ |
|
79 IMPORT_C gint AddObserver(TMSClientSinkObserver& obsrvr, |
|
80 gpointer user_data); |
|
81 |
|
82 /** |
|
83 * Remove client observer from this sink object. |
|
84 * |
|
85 * This function can be called at any time. |
|
86 * |
|
87 * @param obsrvr |
|
88 * The listener to be removed. |
|
89 * |
|
90 * @return |
|
91 * TMS_RESULT_SUCCESS if the operation was successful. |
|
92 * TMS_RESULT_DOES_NOT_EXIST if obsrvr is not already in the list. |
|
93 * |
|
94 */ |
|
95 IMPORT_C gint RemoveObserver(TMSClientSinkObserver& obsrvr); |
|
96 |
|
97 /** |
|
98 * Tell the sink that the buffer passed in has been processed by |
|
99 * the client and is ready to be reused by the Sink. |
|
100 * |
|
101 * This function must be called in response to the callback from the |
|
102 * sink observer TMSClientSinkObserver::ProcessBuffer(). |
|
103 * |
|
104 * @param buffer |
|
105 * The buffer which has been processed by the client (filled in |
|
106 * with data). |
|
107 * |
|
108 * @return |
|
109 * Status of the operation. |
|
110 * |
|
111 */ |
|
112 IMPORT_C gint BufferProcessed(TMSBuffer* buffer); |
|
113 |
|
114 /** |
|
115 * Return sink type. |
|
116 * |
|
117 * This function can be called at any time. |
|
118 * |
|
119 * @param sinktype |
|
120 * The type of sink object (TMS_SINK_CLIENT). |
|
121 * |
|
122 * @return |
|
123 * TMS_RESULT_SUCCESS if the operation was successful. |
|
124 * |
|
125 */ |
|
126 IMPORT_C virtual gint GetType(TMSSinkType& sinktype); |
|
127 |
|
128 protected: |
|
129 /** |
|
130 * Constructor |
|
131 */ |
|
132 IMPORT_C TMSClientSink(); |
|
133 |
|
134 protected: |
|
135 TMSClientSinkBody *iBody; |
|
136 }; |
|
137 |
|
138 } //namespace TMS |
|
139 |
|
140 #endif //TMS_CLIENT_SINK_H |
|
141 |
|
142 // End of file |
|
143 |