FreeRDP/channels/tsmf/client/gstreamer/tsmf_platform.h

86 lines
2.5 KiB
C
Raw Normal View History

2014-05-26 11:01:13 +04:00
/*
* FreeRDP: A Remote Desktop Protocol Implementation
* Video Redirection Virtual Channel - GStreamer Decoder
* platform specific functions
*
* (C) Copyright 2014 Thincast Technologies GmbH
* (C) Copyright 2014 Armin Novak <armin.novak@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
2019-11-06 17:24:51 +03:00
*/
2014-05-26 11:01:13 +04:00
#ifndef FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H
#define FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H
2014-05-23 15:46:37 +04:00
#include <gst/gst.h>
#include <tsmf_decoder.h>
typedef struct _TSMFGstreamerDecoder
{
ITSMFDecoder iface;
int media_type; /* TSMF_MAJOR_TYPE_AUDIO or TSMF_MAJOR_TYPE_VIDEO */
gint64 duration;
GstState state;
2019-11-06 17:24:51 +03:00
GstCaps* gst_caps;
2014-05-23 15:46:37 +04:00
2019-11-06 17:24:51 +03:00
GstElement* pipe;
GstElement* src;
GstElement* queue;
GstElement* outsink;
GstElement* volume;
2014-05-23 15:46:37 +04:00
BOOL ready;
BOOL paused;
- Use decodebin2 instead of old decodebin - decodebin has issues - Use autovideosink - xvimagesink does not work with cards with no xv ports available and cant be used if wanted to use the fluendo hardware accelerated playback codec - Use autoaudiosink - let gstreamer choose best audio playback plugin - Catch when autosinks add known elements so that we can manipulate properties on them - Adjust caps of various media types to work better with gstreamer, some codecs are picky about having certain fields available - Remove unneeded plugins such as "ffmpegcolorspace" and "videoscale" - these do not work correctly with fluendo hardware accelerated playback codec - Name audio/video gstreamer elements better for easier debugging - Update gstreamer pipeline and element properties to handle playback better - Detect when valid timestamps are available for buffer from server and try to account for when they are not valid - Start time is much more reliable then end time from server for various media formats, so use it when possible to make decisions instead of end time - Do not rebuild gstreamer pipeline for a seek(very expensive), instead reset gstreamer time to 0 and maintain offset between real time and gstreamer time - Change buffer filled function back to a buffer level function, so that we can use buffer level to make better choices above gstreamer decoder in tsmf - Remove ack function from gstreamer, instead rely on ack thread to handle acks - Rework X11 gstreamer code to handle various videosinks which implement the XOverlayInterface and to keep more detailed information on the sub-window that is used for display - Add check to see if a decoder is available for telling the server the client various media types - Add in support for M4S2 and WMA1 media types - Fix flush message handling, they are for individual streams and not the entire presentation - Delay eos response to try to allow more time for buffers to be loaded into decoder, as we anticipate acks to server and the server will issue stop as soon as we ack eos. - Fix issue with geometry info being ignored when resent for new streams within existing presentation - Fixed volume level initialization issue when a stream is stopped and restarted - Attempt to sync video/audio streams...because we run two different gstreamer pipelines - they can enter pause/playing states at different times and are thus not synchronized. Attempt to adjust video buffer timestamps based on difference between audio/video running time to account for this difference. This logic accounts for a huge improvement in audio/video sync(ie. lip sync to words)
2015-07-08 00:39:29 +03:00
UINT64 last_sample_start_time;
2014-05-23 15:46:37 +04:00
UINT64 last_sample_end_time;
- Use decodebin2 instead of old decodebin - decodebin has issues - Use autovideosink - xvimagesink does not work with cards with no xv ports available and cant be used if wanted to use the fluendo hardware accelerated playback codec - Use autoaudiosink - let gstreamer choose best audio playback plugin - Catch when autosinks add known elements so that we can manipulate properties on them - Adjust caps of various media types to work better with gstreamer, some codecs are picky about having certain fields available - Remove unneeded plugins such as "ffmpegcolorspace" and "videoscale" - these do not work correctly with fluendo hardware accelerated playback codec - Name audio/video gstreamer elements better for easier debugging - Update gstreamer pipeline and element properties to handle playback better - Detect when valid timestamps are available for buffer from server and try to account for when they are not valid - Start time is much more reliable then end time from server for various media formats, so use it when possible to make decisions instead of end time - Do not rebuild gstreamer pipeline for a seek(very expensive), instead reset gstreamer time to 0 and maintain offset between real time and gstreamer time - Change buffer filled function back to a buffer level function, so that we can use buffer level to make better choices above gstreamer decoder in tsmf - Remove ack function from gstreamer, instead rely on ack thread to handle acks - Rework X11 gstreamer code to handle various videosinks which implement the XOverlayInterface and to keep more detailed information on the sub-window that is used for display - Add check to see if a decoder is available for telling the server the client various media types - Add in support for M4S2 and WMA1 media types - Fix flush message handling, they are for individual streams and not the entire presentation - Delay eos response to try to allow more time for buffers to be loaded into decoder, as we anticipate acks to server and the server will issue stop as soon as we ack eos. - Fix issue with geometry info being ignored when resent for new streams within existing presentation - Fixed volume level initialization issue when a stream is stopped and restarted - Attempt to sync video/audio streams...because we run two different gstreamer pipelines - they can enter pause/playing states at different times and are thus not synchronized. Attempt to adjust video buffer timestamps based on difference between audio/video running time to account for this difference. This logic accounts for a huge improvement in audio/video sync(ie. lip sync to words)
2015-07-08 00:39:29 +03:00
BOOL seeking;
UINT64 seek_offset;
2014-05-23 15:46:37 +04:00
double gstVolume;
BOOL gstMuted;
int pipeline_start_time_valid; /* We've set the start time and have not reset the pipeline */
2019-11-06 17:24:51 +03:00
int shutdown; /* The decoder stream is shutting down */
2014-05-23 15:46:37 +04:00
2019-11-06 17:24:51 +03:00
void* platform;
2014-05-23 15:46:37 +04:00
2019-11-06 17:24:51 +03:00
BOOL (*ack_cb)(void*, BOOL);
void (*sync_cb)(void*);
void* stream;
2014-05-23 15:46:37 +04:00
} TSMFGstreamerDecoder;
2014-11-10 22:02:54 +03:00
const char* tsmf_platform_get_video_sink(void);
const char* tsmf_platform_get_audio_sink(void);
2014-05-23 15:46:37 +04:00
2014-11-10 22:02:54 +03:00
int tsmf_platform_create(TSMFGstreamerDecoder* decoder);
int tsmf_platform_set_format(TSMFGstreamerDecoder* decoder);
int tsmf_platform_register_handler(TSMFGstreamerDecoder* decoder);
int tsmf_platform_free(TSMFGstreamerDecoder* decoder);
2014-05-23 15:46:37 +04:00
2014-11-10 22:02:54 +03:00
int tsmf_window_create(TSMFGstreamerDecoder* decoder);
2019-11-06 17:24:51 +03:00
int tsmf_window_resize(TSMFGstreamerDecoder* decoder, int x, int y, int width, int height,
int nr_rect, RDP_RECT* visible);
2014-11-10 22:02:54 +03:00
int tsmf_window_destroy(TSMFGstreamerDecoder* decoder);
2014-05-23 15:46:37 +04:00
- Use decodebin2 instead of old decodebin - decodebin has issues - Use autovideosink - xvimagesink does not work with cards with no xv ports available and cant be used if wanted to use the fluendo hardware accelerated playback codec - Use autoaudiosink - let gstreamer choose best audio playback plugin - Catch when autosinks add known elements so that we can manipulate properties on them - Adjust caps of various media types to work better with gstreamer, some codecs are picky about having certain fields available - Remove unneeded plugins such as "ffmpegcolorspace" and "videoscale" - these do not work correctly with fluendo hardware accelerated playback codec - Name audio/video gstreamer elements better for easier debugging - Update gstreamer pipeline and element properties to handle playback better - Detect when valid timestamps are available for buffer from server and try to account for when they are not valid - Start time is much more reliable then end time from server for various media formats, so use it when possible to make decisions instead of end time - Do not rebuild gstreamer pipeline for a seek(very expensive), instead reset gstreamer time to 0 and maintain offset between real time and gstreamer time - Change buffer filled function back to a buffer level function, so that we can use buffer level to make better choices above gstreamer decoder in tsmf - Remove ack function from gstreamer, instead rely on ack thread to handle acks - Rework X11 gstreamer code to handle various videosinks which implement the XOverlayInterface and to keep more detailed information on the sub-window that is used for display - Add check to see if a decoder is available for telling the server the client various media types - Add in support for M4S2 and WMA1 media types - Fix flush message handling, they are for individual streams and not the entire presentation - Delay eos response to try to allow more time for buffers to be loaded into decoder, as we anticipate acks to server and the server will issue stop as soon as we ack eos. - Fix issue with geometry info being ignored when resent for new streams within existing presentation - Fixed volume level initialization issue when a stream is stopped and restarted - Attempt to sync video/audio streams...because we run two different gstreamer pipelines - they can enter pause/playing states at different times and are thus not synchronized. Attempt to adjust video buffer timestamps based on difference between audio/video running time to account for this difference. This logic accounts for a huge improvement in audio/video sync(ie. lip sync to words)
2015-07-08 00:39:29 +03:00
int tsmf_window_map(TSMFGstreamerDecoder* decoder);
int tsmf_window_unmap(TSMFGstreamerDecoder* decoder);
2014-05-23 15:46:37 +04:00
2014-11-10 22:02:54 +03:00
BOOL tsmf_gstreamer_add_pad(TSMFGstreamerDecoder* mdecoder);
void tsmf_gstreamer_remove_pad(TSMFGstreamerDecoder* mdecoder);
2014-05-23 15:46:37 +04:00
#endif /* FREERDP_CHANNEL_TSMF_CLIENT_GST_PLATFORM_H */