FreeRDP
tsmf_gstreamer.c File Reference
#include <freerdp/config.h>
#include <winpr/assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <winpr/string.h>
#include <winpr/platform.h>
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include "tsmf_constants.h"
#include "tsmf_decoder.h"
#include "tsmf_platform.h"

Macros

#define SEEK_TOLERANCE   10 * 1000 * 1000
 

Functions

static BOOL tsmf_gstreamer_pipeline_build (TSMFGstreamerDecoder *mdecoder)
 
static void tsmf_gstreamer_clean_up (TSMFGstreamerDecoder *mdecoder)
 
static int tsmf_gstreamer_pipeline_set_state (TSMFGstreamerDecoder *mdecoder, GstState desired_state)
 
static BOOL tsmf_gstreamer_buffer_level (ITSMFDecoder *decoder)
 
static const char * get_type (TSMFGstreamerDecoder *mdecoder)
 
static void cb_child_added (GstChildProxy *child_proxy, GObject *object, TSMFGstreamerDecoder *mdecoder)
 
static void tsmf_gstreamer_enough_data (GstAppSrc *src, gpointer user_data)
 
static void tsmf_gstreamer_need_data (GstAppSrc *src, guint length, gpointer user_data)
 
static gboolean tsmf_gstreamer_seek_data (GstAppSrc *src, guint64 offset, gpointer user_data)
 
static BOOL tsmf_gstreamer_change_volume (ITSMFDecoder *decoder, UINT32 newVolume, UINT32 muted)
 
static GstClockTime tsmf_gstreamer_timestamp_ms_to_gst (UINT64 ms_timestamp)
 
static GstBuffer * tsmf_get_buffer_from_data (const void *raw_data, gsize size)
 
static BOOL tsmf_gstreamer_set_format (ITSMFDecoder *decoder, TS_AM_MEDIA_TYPE *media_type)
 
static BOOL tsmf_gstreamer_decodeEx (ITSMFDecoder *decoder, const BYTE *data, UINT32 data_size, UINT32 extensions, UINT64 start_time, UINT64 end_time, UINT64 duration)
 
static BOOL tsmf_gstreamer_control (ITSMFDecoder *decoder, ITSMFControlMsg control_msg, UINT32 *arg)
 
static void tsmf_gstreamer_free (ITSMFDecoder *decoder)
 
static UINT64 tsmf_gstreamer_get_running_time (ITSMFDecoder *decoder)
 
static BOOL tsmf_gstreamer_update_rendering_area (ITSMFDecoder *decoder, int newX, int newY, int newWidth, int newHeight, int numRectangles, RDP_RECT *rectangles)
 
static BOOL tsmf_gstreamer_ack (ITSMFDecoder *decoder, BOOL(*cb)(void *, BOOL), void *stream)
 
static BOOL tsmf_gstreamer_sync (ITSMFDecoder *decoder, void(*cb)(void *), void *stream)
 
 WINPR_ASSERT (sptr)
 
 gst_init (NULL, NULL)
 
 if (!decoder) return ERROR_OUTOFMEMORY
 
 if (tsmf_platform_create(decoder)< 0)
 

Variables

sptr = NULL
 
TSMFGstreamerDecoderdecoder = calloc(1, sizeof(TSMFGstreamerDecoder))
 
decoder iface SetFormat = tsmf_gstreamer_set_format
 
decoder iface Decode = NULL
 
decoder iface GetDecodedData = NULL
 
decoder iface GetDecodedFormat = NULL
 
decoder iface GetDecodedDimension = NULL
 
decoder iface GetRunningTime = tsmf_gstreamer_get_running_time
 
decoder iface UpdateRenderingArea = tsmf_gstreamer_update_rendering_area
 
decoder iface Free = tsmf_gstreamer_free
 
decoder iface Control = tsmf_gstreamer_control
 
decoder iface DecodeEx = tsmf_gstreamer_decodeEx
 
decoder iface ChangeVolume = tsmf_gstreamer_change_volume
 
decoder iface BufferLevel = tsmf_gstreamer_buffer_level
 
decoder iface SetAckFunc = tsmf_gstreamer_ack
 
decoder iface SetSyncFunc = tsmf_gstreamer_sync
 
decoder paused = FALSE
 
decoder gstVolume = 0.5
 
decoder gstMuted = FALSE
 
decoder state = GST_STATE_VOID_PENDING
 
decoder last_sample_start_time = 0
 
decoder last_sample_end_time = 0
 
decoder seek_offset = 0
 
decoder seeking = FALSE
 
return CHANNEL_RC_OK
 

Macro Definition Documentation

◆ SEEK_TOLERANCE

#define SEEK_TOLERANCE   10 * 1000 * 1000

Function Documentation

◆ cb_child_added()

static void cb_child_added ( GstChildProxy *  child_proxy,
GObject *  object,
TSMFGstreamerDecoder mdecoder 
)
static
Here is the caller graph for this function:

◆ get_type()

static const char* get_type ( TSMFGstreamerDecoder mdecoder)
static
Here is the caller graph for this function:

◆ gst_init()

gst_init ( NULL  ,
NULL   
)

◆ if() [1/2]

if ( decoder)

◆ if() [2/2]

if ( )

◆ tsmf_get_buffer_from_data()

static GstBuffer* tsmf_get_buffer_from_data ( const void *  raw_data,
gsize  size 
)
static
Here is the caller graph for this function:

◆ tsmf_gstreamer_ack()

static BOOL tsmf_gstreamer_ack ( ITSMFDecoder *  decoder,
BOOL(*)(void *, BOOL)  cb,
void *  stream 
)
static

◆ tsmf_gstreamer_buffer_level()

static BOOL tsmf_gstreamer_buffer_level ( ITSMFDecoder *  decoder)
static
Here is the call graph for this function:

◆ tsmf_gstreamer_change_volume()

static BOOL tsmf_gstreamer_change_volume ( ITSMFDecoder *  decoder,
UINT32  newVolume,
UINT32  muted 
)
static
Here is the caller graph for this function:

◆ tsmf_gstreamer_clean_up()

void tsmf_gstreamer_clean_up ( TSMFGstreamerDecoder mdecoder)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_control()

static BOOL tsmf_gstreamer_control ( ITSMFDecoder *  decoder,
ITSMFControlMsg  control_msg,
UINT32 *  arg 
)
static
Here is the call graph for this function:

◆ tsmf_gstreamer_decodeEx()

static BOOL tsmf_gstreamer_decodeEx ( ITSMFDecoder *  decoder,
const BYTE data,
UINT32  data_size,
UINT32  extensions,
UINT64  start_time,
UINT64  end_time,
UINT64  duration 
)
static
Here is the call graph for this function:

◆ tsmf_gstreamer_enough_data()

static void tsmf_gstreamer_enough_data ( GstAppSrc *  src,
gpointer  user_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_free()

static void tsmf_gstreamer_free ( ITSMFDecoder *  decoder)
static
Here is the call graph for this function:

◆ tsmf_gstreamer_get_running_time()

static UINT64 tsmf_gstreamer_get_running_time ( ITSMFDecoder *  decoder)
static

◆ tsmf_gstreamer_need_data()

static void tsmf_gstreamer_need_data ( GstAppSrc *  src,
guint  length,
gpointer  user_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_pipeline_build()

BOOL tsmf_gstreamer_pipeline_build ( TSMFGstreamerDecoder mdecoder)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_pipeline_set_state()

int tsmf_gstreamer_pipeline_set_state ( TSMFGstreamerDecoder mdecoder,
GstState  desired_state 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_seek_data()

static gboolean tsmf_gstreamer_seek_data ( GstAppSrc *  src,
guint64  offset,
gpointer  user_data 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tsmf_gstreamer_set_format()

static BOOL tsmf_gstreamer_set_format ( ITSMFDecoder *  decoder,
TS_AM_MEDIA_TYPE media_type 
)
static
Here is the call graph for this function:

◆ tsmf_gstreamer_sync()

static BOOL tsmf_gstreamer_sync ( ITSMFDecoder *  decoder,
void(*)(void *)  cb,
void *  stream 
)
static

◆ tsmf_gstreamer_timestamp_ms_to_gst()

static GstClockTime tsmf_gstreamer_timestamp_ms_to_gst ( UINT64  ms_timestamp)
inlinestatic
Here is the caller graph for this function:

◆ tsmf_gstreamer_update_rendering_area()

static BOOL tsmf_gstreamer_update_rendering_area ( ITSMFDecoder *  decoder,
int  newX,
int  newY,
int  newWidth,
int  newHeight,
int  numRectangles,
RDP_RECT rectangles 
)
static
Here is the call graph for this function:

◆ WINPR_ASSERT()

WINPR_ASSERT ( sptr  )

Variable Documentation

◆ BufferLevel

decoder iface BufferLevel = tsmf_gstreamer_buffer_level

◆ ChangeVolume

decoder iface ChangeVolume = tsmf_gstreamer_change_volume

◆ CHANNEL_RC_OK

return CHANNEL_RC_OK

◆ Control

◆ Decode

decoder iface Decode = NULL

◆ DecodeEx

decoder iface DecodeEx = tsmf_gstreamer_decodeEx

◆ decoder

decoder = calloc(1, sizeof(TSMFGstreamerDecoder))

◆ Free

◆ GetDecodedData

decoder iface GetDecodedData = NULL

◆ GetDecodedDimension

decoder iface GetDecodedDimension = NULL

◆ GetDecodedFormat

decoder iface GetDecodedFormat = NULL

◆ GetRunningTime

decoder iface GetRunningTime = tsmf_gstreamer_get_running_time

◆ gstMuted

decoder gstMuted = FALSE

◆ gstVolume

decoder gstVolume = 0.5

◆ last_sample_end_time

decoder last_sample_end_time = 0

◆ last_sample_start_time

decoder last_sample_start_time = 0

◆ paused

decoder paused = FALSE

◆ seek_offset

decoder seek_offset = 0

◆ seeking

decoder seeking = FALSE

◆ SetAckFunc

decoder iface SetAckFunc = tsmf_gstreamer_ack

◆ SetFormat

◆ SetSyncFunc

decoder iface SetSyncFunc = tsmf_gstreamer_sync

◆ sptr

* sptr = NULL

◆ state

int state = GST_STATE_VOID_PENDING

◆ UpdateRenderingArea

decoder iface UpdateRenderingArea = tsmf_gstreamer_update_rendering_area