1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * Video Redirection Virtual Channel - Decoder
4  *
5  * Copyright 2010-2011 Vic Lee
6  * Copyright 2012 Hewlett-Packard Development Company, L.P.
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H
22 #define FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H
23 
24 #include "tsmf_types.h"
25 
26 typedef enum _ITSMFControlMsg
27 {
28 	Control_Pause,
29 	Control_Resume,
30 	Control_Restart,
31 	Control_Stop
32 } ITSMFControlMsg;
33 
34 typedef struct _ITSMFDecoder ITSMFDecoder;
35 
36 struct _ITSMFDecoder
37 {
38 	/* Set the decoder format. Return true if supported. */
39 	BOOL (*SetFormat)(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* media_type);
40 	/* Decode a sample. */
41 	BOOL (*Decode)(ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions);
42 	/* Get the decoded data */
43 	BYTE* (*GetDecodedData)(ITSMFDecoder* decoder, UINT32* size);
44 	/* Get the pixel format of decoded video frame */
45 	UINT32 (*GetDecodedFormat)(ITSMFDecoder* decoder);
46 	/* Get the width and height of decoded video frame */
47 	BOOL (*GetDecodedDimension)(ITSMFDecoder* decoder, UINT32* width, UINT32* height);
48 	/* Free the decoder */
49 	void (*Free)(ITSMFDecoder* decoder);
50 	/* Optional Contol function */
51 	BOOL (*Control)(ITSMFDecoder* decoder, ITSMFControlMsg control_msg, UINT32* arg);
52 	/* Decode a sample with extended interface. */
53 	BOOL(*DecodeEx)
54 	(ITSMFDecoder* decoder, const BYTE* data, UINT32 data_size, UINT32 extensions,
55 	 UINT64 start_time, UINT64 end_time, UINT64 duration);
56 	/* Get current play time */
57 	UINT64 (*GetRunningTime)(ITSMFDecoder* decoder);
58 	/* Update Gstreamer Rendering Area */
59 	BOOL(*UpdateRenderingArea)
60 	(ITSMFDecoder* decoder, int newX, int newY, int newWidth, int newHeight, int numRectangles,
61 	 RDP_RECT* rectangles);
62 	/* Change Gstreamer Audio Volume */
63 	BOOL (*ChangeVolume)(ITSMFDecoder* decoder, UINT32 newVolume, UINT32 muted);
64 	/* Check buffer level */
65 	BOOL (*BufferLevel)(ITSMFDecoder* decoder);
66 	/* Register a callback for frame ack. */
67 	BOOL (*SetAckFunc)(ITSMFDecoder* decoder, BOOL (*cb)(void*, BOOL), void* stream);
68 	/* Register a callback for stream seek detection. */
69 	BOOL (*SetSyncFunc)(ITSMFDecoder* decoder, void (*cb)(void*), void* stream);
70 };
71 
72 #define TSMF_DECODER_EXPORT_FUNC_NAME "TSMFDecoderEntry"
73 typedef ITSMFDecoder* (*TSMF_DECODER_ENTRY)(void);
74 
75 ITSMFDecoder* tsmf_load_decoder(const char* name, TS_AM_MEDIA_TYPE* media_type);
76 BOOL tsmf_check_decoder_available(const char* name);
77 
78 #endif /* FREERDP_CHANNEL_TSMF_CLIENT_DECODER_H */
79