RDK Documentation (Open Sourced RDK Components)
|
Gstreamer based player impl for AAMP. More...
#include "AampMemoryUtils.h"
#include "aampgstplayer.h"
#include "AampFnLogger.h"
#include "isobmffbuffer.h"
#include "AampUtils.h"
#include "AampGstUtils.h"
#include <gst/gst.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "priv_aamp.h"
#include <pthread.h>
#include <atomic>
Go to the source code of this file.
Data Structures | |
struct | media_stream |
Holds stream(Audio, Video, Subtitle and Aux-Audio) specific variables. More... | |
struct | AAMPGstPlayerPriv |
Holds private variables of AAMPGstPlayer. More... | |
Macros | |
#define | GST_ELEMENT_GET_STATE_RETRY_CNT_MAX 5 |
#define | GSTPLAYERSINKBIN_EVENT_HAVE_VIDEO 0x01 |
#define | GSTPLAYERSINKBIN_EVENT_HAVE_AUDIO 0x02 |
#define | GSTPLAYERSINKBIN_EVENT_FIRST_VIDEO_FRAME 0x03 |
#define | GSTPLAYERSINKBIN_EVENT_FIRST_AUDIO_FRAME 0x04 |
#define | GSTPLAYERSINKBIN_EVENT_ERROR_VIDEO_UNDERFLOW 0x06 |
#define | GSTPLAYERSINKBIN_EVENT_ERROR_AUDIO_UNDERFLOW 0x07 |
#define | GSTPLAYERSINKBIN_EVENT_ERROR_VIDEO_PTS 0x08 |
#define | GSTPLAYERSINKBIN_EVENT_ERROR_AUDIO_PTS 0x09 |
#define | DEFAULT_BUFFERING_TO_MS 10 |
#define | DEFAULT_BUFFERING_QUEUED_FRAMES_MIN (5) |
#define | DEFAULT_BUFFERING_MAX_MS (1000) |
#define | DEFAULT_BUFFERING_MAX_CNT (DEFAULT_BUFFERING_MAX_MS/DEFAULT_BUFFERING_TO_MS) |
#define | AAMP_MIN_PTS_UPDATE_INTERVAL 4000 |
#define | AAMP_DELAY_BETWEEN_PTS_CHECK_FOR_EOS_ON_UNDERFLOW 500 |
#define | BUFFERING_TIMEOUT_PRIORITY -70 |
#define | AAMP_MIN_DECODE_ERROR_INTERVAL 10000 |
#define | VIDEO_COORDINATES_SIZE 32 |
Enumerations | |
enum | GstPlayFlags |
Enum of configuration flags used by playbin. More... | |
gmapDecoderLoookUptable | |
Decoder map list lookup table convert from codec to string map list of gstreamer component. | |
#define | PLUGINS_TO_LOWER_RANK_MAX 2 |
#define | NO_PLAYBIN 1 |
#define | ID3_HEADER_SIZE 10 |
static std::map< std::string, std::vector< std::string > > | gmapDecoderLoookUptable |
static const char * | GstPluginNamePR = "aampplayreadydecryptor" |
static const char * | GstPluginNameWV = "aampwidevinedecryptor" |
static const char * | GstPluginNameCK = "aampclearkeydecryptor" |
static const char * | GstPluginNameVMX = "aampverimatrixdecryptor" |
const char * | plugins_to_lower_rank [2] |
static gboolean | bus_message (GstBus *bus, GstMessage *msg, AAMPGstPlayer *_this) |
Called from the mainloop when a message is available on the bus. More... | |
static GstBusSyncReply | bus_sync_handler (GstBus *bus, GstMessage *msg, AAMPGstPlayer *_this) |
Invoked synchronously when a message is available on the bus. More... | |
static gboolean | buffering_timeout (gpointer data) |
g_timeout callback to wait for buffering to change pipeline from paused->playing | |
static void | type_check_instance (const char *str, GstElement *elem) |
check if elemement is instance (BCOM-3563) | |
static GstStateChangeReturn | SetStateWithWarnings (GstElement *element, GstState targetState) |
wraps gst_element_set_state and adds log messages where applicable More... | |
static void | analyze_streams (AAMPGstPlayer *_this) |
Analyze stream info from the GstPipeline. More... | |
static void | need_data (GstElement *source, guint size, AAMPGstPlayer *_this) |
Callback for appsrc "need-data" signal. More... | |
static void | enough_data (GstElement *source, AAMPGstPlayer *_this) |
Callback for appsrc "enough-data" signal. More... | |
static gboolean | appsrc_seek (GstAppSrc *src, guint64 offset, AAMPGstPlayer *_this) |
Callback for appsrc "seek-data" signal. More... | |
static void | InitializeSource (AAMPGstPlayer *_this, GObject *source, MediaType mediaType=eMEDIATYPE_VIDEO) |
Initialize properties/callback of appsrc. More... | |
static void | found_source (GObject *object, GObject *orig, GParamSpec *pspec, AAMPGstPlayer *_this) |
Callback when source is added by playbin. More... | |
static void | httpsoup_source_setup (GstElement *element, GstElement *source, gpointer data) |
callback when the source has been created More... | |
static gboolean | IdleCallbackOnFirstFrame (gpointer user_data) |
Idle callback to notify first frame rendered event. More... | |
static gboolean | IdleCallbackOnEOS (gpointer user_data) |
Idle callback to notify end-of-stream event. More... | |
static gboolean | ProgressCallbackOnTimeout (gpointer user_data) |
Timer's callback to notify playback progress event. More... | |
static gboolean | IdleCallback (gpointer user_data) |
Idle callback to start progress notifier timer. More... | |
static gboolean | IdleCallbackFirstVideoFrameDisplayed (gpointer user_data) |
Idle callback to notify first video frame was displayed. More... | |
static void | AAMPGstPlayer_OnFirstVideoFrameCallback (GstElement *object, guint arg0, gpointer arg1, AAMPGstPlayer *_this) |
Callback invoked after first video frame decoded. More... | |
static void | AAMPGstPlayer_redButtonCallback (GstElement *object, guint hours, guint minutes, guint seconds, gpointer user_data) |
Callback invoked after receiving the SEI Time Code information. More... | |
static void | AAMPGstPlayer_OnAudioFirstFrameAudDecoder (GstElement *object, guint arg0, gpointer arg1, AAMPGstPlayer *_this) |
Callback invoked after first audio buffer decoded. More... | |
bool | AAMPGstPlayer_isVideoDecoder (const char *name, AAMPGstPlayer *_this) |
Check if gstreamer element is video decoder. More... | |
bool | AAMPGstPlayer_isVideoSink (const char *name, AAMPGstPlayer *_this) |
Check if gstreamer element is video sink. More... | |
bool | AAMPGstPlayer_isAudioSinkOrAudioDecoder (const char *name, AAMPGstPlayer *_this) |
Check if gstreamer element is audio sink or audio decoder. More... | |
bool | AAMPGstPlayer_isVideoOrAudioDecoder (const char *name, AAMPGstPlayer *_this) |
Check if gstreamer element is audio decoder. More... | |
static gboolean | VideoDecoderPtsCheckerForEOS (gpointer user_data) |
Notifies EOS if video decoder pts is stalled. More... | |
static void | AAMPGstPlayer_OnGstBufferUnderflowCb (GstElement *object, guint arg0, gpointer arg1, AAMPGstPlayer *_this) |
Callback invoked when facing an underflow. More... | |
static void | AAMPGstPlayer_OnGstPtsErrorCb (GstElement *object, guint arg0, gpointer arg1, AAMPGstPlayer *_this) |
Callback invoked a PTS error is encountered. More... | |
static void | AAMPGstPlayer_OnGstDecodeErrorCb (GstElement *object, guint arg0, gpointer arg1, AAMPGstPlayer *_this) |
Callback invoked a Decode error is encountered. More... | |
static void | AAMPGstPlayer_PlayersinkbinCB (GstElement *playersinkbin, gint status, void *arg) |
Callback for receiving playersinkbin gstreamer events. More... | |
static GstElement * | AAMPGstPlayer_GetAppSrc (AAMPGstPlayer *_this, MediaType mediaType) |
Create an appsrc element for a particular format. More... | |
static int | AAMPGstPlayer_SetupStream (AAMPGstPlayer *_this, MediaType streamId) |
Setup pipeline for a particular stream type. More... | |
bool | hasId3Header (MediaType mediaType, const uint8_t *data, int32_t length) |
uint32_t | getId3TagSize (const uint8_t *data) |
static void | AAMPGstPlayer_SignalEOS (GstElement *source) |
static std::string | StateText (GstState state, char start, char end, GstState currentState, GstState parentState=GST_STATE_VOID_PENDING) |
Generates a state description for gst target, next and pending state i.e. not current state. More... | |
static std::string | SafeName (GstElement *element) |
wraps gst_element_get_name handling unnamed elements and resource freeing More... | |
static std::string | GetStatus (gpointer pElementOrBin, int &recursionCount, gpointer pParent=nullptr) |
| |
static void | LogStatus (GstElement *pElementOrBin) |
static GstState | validateStateWithMsTimeout (AAMPGstPlayer *_this, GstState stateToValidate, guint msTimeOut) |
Validate pipeline state transition within a max timeout. More... | |
static void | DumpFile (const char *fileName) |
Dump a file to log. | |
Gstreamer based player impl for AAMP.
Definition in file aampgstplayer.cpp.
#define DEFAULT_BUFFERING_TO_MS 10 |
TimeOut interval to check buffer fullness
Definition at line 86 of file aampgstplayer.cpp.
#define DEFAULT_BUFFERING_QUEUED_FRAMES_MIN (5) |
if the video decoder has this many queued frames start.. even at 60fps, close to 100ms...
Definition at line 91 of file aampgstplayer.cpp.
#define DEFAULT_BUFFERING_MAX_MS (1000) |
max buffering time
Definition at line 94 of file aampgstplayer.cpp.
#define DEFAULT_BUFFERING_MAX_CNT (DEFAULT_BUFFERING_MAX_MS/DEFAULT_BUFFERING_TO_MS) |
max buffering timeout count
Definition at line 95 of file aampgstplayer.cpp.
#define AAMP_MIN_PTS_UPDATE_INTERVAL 4000 |
Time duration in milliseconds if exceeded and pts has not changed; it is concluded pts is not changing
Definition at line 96 of file aampgstplayer.cpp.
#define AAMP_DELAY_BETWEEN_PTS_CHECK_FOR_EOS_ON_UNDERFLOW 500 |
A timeout interval in milliseconds to check pts in case of underflow
Definition at line 97 of file aampgstplayer.cpp.
#define BUFFERING_TIMEOUT_PRIORITY -70 |
0 is DEFAULT priority whereas -100 is the HIGH_PRIORITY
Definition at line 98 of file aampgstplayer.cpp.
#define AAMP_MIN_DECODE_ERROR_INTERVAL 10000 |
Minimum time interval in milliseconds between two decoder error CB to send anomaly error
Definition at line 99 of file aampgstplayer.cpp.
#define PLUGINS_TO_LOWER_RANK_MAX 2 |
Header size for ID3v2 header
Definition at line 319 of file aampgstplayer.cpp.
#define NO_PLAYBIN 1 |
Header size for ID3v2 header
Definition at line 2172 of file aampgstplayer.cpp.
#define ID3_HEADER_SIZE 10 |
Header size for ID3v2 header
Definition at line 2561 of file aampgstplayer.cpp.
enum GstPlayFlags |
Enum of configuration flags used by playbin.
Definition at line 55 of file aampgstplayer.cpp.
|
static |
Called from the mainloop when a message is available on the bus.
[in] | bus | the GstBus that sent the message |
[in] | msg | the GstMessage |
[in] | _this | pointer to AAMPGstPlayer instance |
FALSE | if the event source should be removed. |
Definition at line 1302 of file aampgstplayer.cpp.
|
static |
Invoked synchronously when a message is available on the bus.
[in] | bus | the GstBus that sent the message |
[in] | msg | the GstMessage |
[in] | _this | pointer to AAMPGstPlayer instance |
GST_BUS_PASS | to pass the message to the async queue |
Definition at line 1566 of file aampgstplayer.cpp.
|
static |
wraps gst_element_set_state and adds log messages where applicable
[in] | element | the GstElement whose state is to be changed |
[in] | targetState | the GstState to apply to element |
[in] | _this | pointer to AAMPGstPlayer instance |
Result | of the state change (from inner gst_element_set_state()) |
Definition at line 3423 of file aampgstplayer.cpp.
|
static |
Analyze stream info from the GstPipeline.
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 509 of file aampgstplayer.cpp.
|
static |
Callback for appsrc "need-data" signal.
[in] | source | pointer to appsrc instance triggering "need-data" signal |
[in] | size | size of data required |
[in] | _this | pointer to AAMPGstPlayer instance associated with the playback |
Definition at line 552 of file aampgstplayer.cpp.
|
static |
Callback for appsrc "enough-data" signal.
[in] | source | pointer to appsrc instance triggering "enough-data" signal |
[in] | _this | pointer to AAMPGstPlayer instance associated with the playback |
Definition at line 578 of file aampgstplayer.cpp.
|
static |
Callback for appsrc "seek-data" signal.
[in] | src | pointer to appsrc instance triggering "seek-data" signal |
[in] | offset | seek position offset |
[in] | _this | pointer to AAMPGstPlayer instance associated with the playback |
Definition at line 608 of file aampgstplayer.cpp.
|
static |
Initialize properties/callback of appsrc.
[in] | _this | pointer to AAMPGstPlayer instance associated with the playback |
[in] | source | pointer to appsrc instance to be initialized |
[in] | mediaType | stream type |
Definition at line 623 of file aampgstplayer.cpp.
|
static |
Callback when source is added by playbin.
[in] | object | a GstObject |
[in] | orig | the object that originated the signal |
[in] | pspec | the property that changed |
[in] | _this | pointer to AAMPGstPlayer instance associated with the playback |
Definition at line 672 of file aampgstplayer.cpp.
|
static |
callback when the source has been created
[in] | element | is the pipeline |
[in] | source | the creation of source triggered this callback |
[in] | data | pointer to data associated with the playback |
Definition at line 714 of file aampgstplayer.cpp.
|
static |
Idle callback to notify first frame rendered event.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_REMOVE,if | the source should be removed |
Definition at line 735 of file aampgstplayer.cpp.
|
static |
Idle callback to notify end-of-stream event.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_REMOVE,if | the source should be removed |
Definition at line 753 of file aampgstplayer.cpp.
|
static |
Timer's callback to notify playback progress event.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_CONTINUE,this | function to be called periodically |
Definition at line 773 of file aampgstplayer.cpp.
|
static |
Idle callback to start progress notifier timer.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_REMOVE,if | the source should be removed |
Definition at line 790 of file aampgstplayer.cpp.
|
static |
Idle callback to notify first video frame was displayed.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_REMOVE,if | the source should be removed |
Definition at line 822 of file aampgstplayer.cpp.
|
static |
Callback invoked after first video frame decoded.
[in] | object | pointer to element raising the callback |
[in] | arg0 | number of arguments |
[in] | arg1 | array of arguments |
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 921 of file aampgstplayer.cpp.
|
static |
Callback invoked after receiving the SEI Time Code information.
[in] | object | pointer to element raising the callback |
[in] | hours | Hour value of the SEI Timecode |
[in] | minutes | Minute value of the SEI Timecode |
[in] | seconds | Second value of the SEI Timecode |
[in] | user_data | pointer to AAMPGstPlayer instance |
Definition at line 938 of file aampgstplayer.cpp.
|
static |
Callback invoked after first audio buffer decoded.
[in] | object | pointer to element raising the callback |
[in] | arg0 | number of arguments |
[in] | arg1 | array of arguments |
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 956 of file aampgstplayer.cpp.
bool AAMPGstPlayer_isVideoDecoder | ( | const char * | name, |
AAMPGstPlayer * | _this | ||
) |
Check if gstreamer element is video decoder.
[in] | name | Name of the element |
[in] | _this | pointer to AAMPGstPlayer instance |
TRUE | if element name is that of the decoder |
Definition at line 969 of file aampgstplayer.cpp.
bool AAMPGstPlayer_isVideoSink | ( | const char * | name, |
AAMPGstPlayer * | _this | ||
) |
Check if gstreamer element is video sink.
[in] | name | Name of the element |
[in] | _this | pointer to AAMPGstPlayer instance |
TRUE | if element name is that of video sink |
Definition at line 985 of file aampgstplayer.cpp.
bool AAMPGstPlayer_isAudioSinkOrAudioDecoder | ( | const char * | name, |
AAMPGstPlayer * | _this | ||
) |
Check if gstreamer element is audio sink or audio decoder.
[in] | name | Name of the element |
[in] | _this | pointer to AAMPGstPlayer instance |
TRUE | if element name is that of audio sink or audio decoder |
Definition at line 1001 of file aampgstplayer.cpp.
bool AAMPGstPlayer_isVideoOrAudioDecoder | ( | const char * | name, |
AAMPGstPlayer * | _this | ||
) |
Check if gstreamer element is audio decoder.
[in] | name | Name of the element |
[in] | _this | pointer to AAMPGstPlayer instance |
TRUE | if element name is that of audio or video decoder |
Definition at line 1018 of file aampgstplayer.cpp.
|
static |
Notifies EOS if video decoder pts is stalled.
[in] | user_data | pointer to AAMPGstPlayer instance |
G_SOURCE_REMOVE,if | the source should be removed |
Definition at line 1055 of file aampgstplayer.cpp.
|
static |
Callback invoked when facing an underflow.
[in] | object | pointer to element raising the callback |
[in] | arg0 | number of arguments |
[in] | arg1 | array of arguments |
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 1136 of file aampgstplayer.cpp.
|
static |
Callback invoked a PTS error is encountered.
[in] | object | pointer to element raising the callback |
[in] | arg0 | number of arguments |
[in] | arg1 | array of arguments |
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 1199 of file aampgstplayer.cpp.
|
static |
Callback invoked a Decode error is encountered.
[in] | object | pointer to element raising the callback |
[in] | arg0 | number of arguments |
[in] | arg1 | array of arguments |
[in] | _this | pointer to AAMPGstPlayer instance |
Definition at line 1224 of file aampgstplayer.cpp.
|
static |
Callback for receiving playersinkbin gstreamer events.
[in] | playersinkbin | instance of playersinkbin |
[in] | status | event name |
[in] | arg | user data (pointer to AAMPGstPlayer instance) |
Definition at line 2020 of file aampgstplayer.cpp.
|
static |
Create an appsrc element for a particular format.
[in] | _this | pointer to AAMPGstPlayer instance |
[in] | mediaType | media type |
pointer | to appsrc instance |
Definition at line 2068 of file aampgstplayer.cpp.
|
static |
Setup pipeline for a particular stream type.
[in] | _this | pointer to AAMPGstPlayer instance |
[in] | streamId | stream type |
0,if | setup successfully. -1, for failure |
Definition at line 2179 of file aampgstplayer.cpp.
bool hasId3Header | ( | MediaType | mediaType, |
const uint8_t * | data, | ||
int32_t | length | ||
) |
Header size for ID3v2 header
Definition at line 2545 of file aampgstplayer.cpp.
uint32_t getId3TagSize | ( | const uint8_t * | data | ) |
Header size for ID3v2 header
Definition at line 2569 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 3011 of file aampgstplayer.cpp.
|
static |
Generates a state description for gst target, next and pending state i.e. not current state.
[in] | state | - the state of the current element |
[in] | start | - a char to place before the state text e.g. on open bracket |
[in] | end | - a char to place after the state text e.g. a close bracket |
[in] | currentState | - the current state from the same element as 'state' |
[in] | parentState | - the state of the parent, if there is one |
Definition at line 3178 of file aampgstplayer.cpp.
|
static |
wraps gst_element_get_name handling unnamed elements and resource freeing
[in] | element | a GstElement |
The | name of element or "unnamed element" as a std::string |
Definition at line 3198 of file aampgstplayer.cpp.
|
static |
[in] | pElementOrBin | - pointer to a gst element or bin |
[in] | pParent | - parent (optional) |
recursionCount | - variable shared with self calls to limit recursion depth |
Definition at line 3226 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 3317 of file aampgstplayer.cpp.
|
static |
Validate pipeline state transition within a max timeout.
[in] | _this | pointer to AAMPGstPlayer instance |
[in] | stateToValidate | state to be validated |
[in] | msTimeOut | max timeout in MS |
Current | pipeline state |
Definition at line 3389 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 109 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 274 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 275 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 276 of file aampgstplayer.cpp.
|
static |
Header size for ID3v2 header
Definition at line 277 of file aampgstplayer.cpp.
const char* plugins_to_lower_rank[2] |
Header size for ID3v2 header
Definition at line 320 of file aampgstplayer.cpp.