• 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 #if !defined (TSC_H_INCLUDED)
19 #define TSC_H_INCLUDED
20 
21 #include "pvt_params.h"
22 
23 #ifndef PVMF_NODE_INTERFACE_H_INCLUDED
24 #include "pvmf_node_interface.h"
25 #endif
26 
27 #define PV_2WAY_TSC_EXTENSIONINTERFACE_UUID PVUuid(0x50e23520,0xf8a3,0x11d9,0xbe,0xab,0x00,0x02,0xa5,0xd5,0xc5,0x1b)
28 enum TSCState
29 {
30     TSC_Idle = 0,
31     TSC_Connecting,
32     TSC_Communicating,
33     TSC_Disconnected
34 };
35 
36 /** Observer interface for TSC extension interface **/
37 class TSCObserver
38 {
39     public:
~TSCObserver()40         virtual ~TSCObserver() {}
41         /* Responses to commands */
42         /* Indicates completion of a previously issued Connect command */
43         virtual void ConnectComplete(PVMFStatus status) = 0;
44 
45         /* Unsolicited indications */
46         /* An internal error has occurred.  User should disconnect and teardown */
47         virtual void InternalError() = 0;
48         /* Requests the user to stop av codecs.  Logical channels will be closed by TSC */
49         virtual void DisconnectRequestReceived() = 0;
50         /* Indicates establishment of an outgoing logical channel by the stack */
51         virtual void OutgoingChannelEstablished(TPVChannelId aId,
52                                                 PVCodecType_t aCodec,
53                                                 uint8* aFormatSpecificInfo = NULL, uint32 aFormatSpecificInfoLen = 0) = 0;
54         /* Indicates establishment of an incoming logical channel by the stack */
55         virtual TPVStatusCode IncomingChannel(TPVChannelId aId,
56                                               PVCodecType_t aCodec,
57                                               uint8* aFormatSpecificInfo = NULL, uint32 aFormatSpecificInfoLen = 0) = 0;
58         /* Indicates closure of a logical channel by the stack */
59         virtual void ChannelClosed(TPVDirection direction,
60                                    TPVChannelId id,
61                                    PVCodecType_t codec,
62                                    PVMFStatus status = PVMFSuccess) = 0;
63         /* Requests the user to generate Intra content for the specified port/logical channel */
64         virtual void RequestFrameUpdate(PVMFPortInterface *port) = 0;
65 };
66 
67 #define MAX_STACK_ELEMENTS 10
68 
69 /** Abstract extension interface for all 2-way Terminal State Controllers **/
70 class TSC : public PVInterface
71 {
72     public:
~TSC()73         virtual ~TSC() {};
74         /* Terminal wide commands */
75         /* Initializes the TSC with reference to mux and controls */
76         virtual TPVStatusCode InitTsc() = 0;
SetTscObserver(TSCObserver * aObserver)77         virtual TSCObserver* SetTscObserver(TSCObserver* aObserver)
78         {
79             if (!iObserver)
80             {
81                 iObserver = aObserver;
82                 return iObserver;
83             }
84             return NULL;
85         }
86         //virtual TPVStatusCode SetCapability(CapabilitySet* capabilities) = 0;
87         virtual CPvtTerminalCapability* GetRemoteCapability() = 0;
GetTscState()88         virtual TSCState GetTscState()
89         {
90             return iState;
91         }
92         virtual TPVStatusCode ResetTsc() = 0;
93         virtual TPVStatusCode Connect(uint16 info_len = 0, uint8* info_buf = NULL) = 0;
94         virtual TPVStatusCode SetTimerRes(uint32 timer_res) = 0;
95 
96         virtual TPVStatusCode Disconnect() = 0;
97         virtual TPVStatusCode Abort() = 0;
98 
99         /* Channel specific commands */
100         virtual TPVStatusCode SetTerminalParam(CPVTerminalParam* params) = 0;
101         virtual CPVTerminalParam* GetTerminalParam() = 0;
102         virtual TPVStatusCode SetOutgoingBitrate(int32 bitrate) = 0;
103         virtual TPVStatusCode RequestFrameUpdate(PVMFPortInterface* port) = 0;
104         /* Returns a pointer to the logical channels buffer.  DO NOT DELETE */
105         virtual const uint8* GetFormatSpecificInfo(PVMFPortInterface* port, uint32* len) = 0;
106 
107         virtual void SetLoopbackMode(TPVLoopbackMode aLoopbackMode) = 0;
108         virtual void ResetStats() = 0;
109         virtual void LogStats(TPVDirection dir) = 0;
110         virtual LogicalChannelInfo* GetLogicalChannelInfo(PVMFPortInterface& port) = 0;
111         virtual void SetDatapathLatency(TPVDirection aDir, PVMFPortInterface* aPort, uint32 aLatency) = 0;
112         virtual void SetSkewReference(PVMFPortInterface* aPort, PVMFPortInterface* aReferencePort) = 0;
113 
114     protected:
TSC()115         TSC() : iState(TSC_Idle), iObserver(NULL)
116         {
117         }
118 
119         TSCState iState;
120         TSCObserver* iObserver;
121     private:
122 };
123 
124 #endif
125 
126