Player events

Player events — Player events

Functions

Types and Values

Description

Player events

Functions

flu_player_event_new ()

FluPlayerEvent *
flu_player_event_new (FluPlayerEventType type);

Creates a new FluPlayerEvent

Parameters

type

The FluPlayerEvent type

 

Returns

The newly created event.

[transfer full]


flu_player_event_copy ()

FluPlayerEvent *
flu_player_event_copy (const FluPlayerEvent *event);

Copies a FluPlayerEvent

Parameters

event

The FluPlayerEvent to copy

 

Returns

The copied event.

[transfer full]


flu_player_event_free ()

void
flu_player_event_free (FluPlayerEvent *event);

Frees the FluPlayerEvent

Parameters

event

The FluPlayerEvent to free

 

Types and Values

enum FluPlayerState

Enum values used to describe an FluPlayer state.

Members

FLU_PLAYER_STATE_STOPPED

The player is currently stopped

 

FLU_PLAYER_STATE_SEEKING

The player is currently seeking

 

FLU_PLAYER_STATE_PAUSED

The player is currently paused

 

FLU_PLAYER_STATE_PLAYING

The player is currently playing

 

enum FluUserOperation

Enum values used to describe different kinds of prohibited user operations. This is mostly used in the case of DVD playback for example when the user is not allowed to skip some scene or for advertising scenarios.

Members

FLU_USER_OPERATION_NONE

No operation is prohibited.

 

FLU_USER_OPERATION_SET_POSITION

User cannot change playback position.

 

FLU_USER_OPERATION_SET_RATE

User cannot change playback rate.

 

FLU_USER_OPERATION_SET_AUDIO_STREAM

User cannot change currently playing audio stream.

 

FLU_USER_OPERATION_SET_VIDEO_STREAM

User cannot change currently playing video stream.

 

FLU_USER_OPERATION_SET_TEXT_STREAM

User cannot change currently playing text stream.

 

FLU_USER_OPERATION_CALL_TITLE_MENU

User cannot go to the title menu.

 

FLU_USER_OPERATION_CALL_ROOT_MENU

User cannot go to the root menu.

 

FLU_USER_OPERATION_CALL_TEXT_MENU

User cannot go to the subtitles/text menu.

 

FLU_USER_OPERATION_CALL_AUDIO_MENU

User cannot go to the audio menu.

 

FLU_USER_OPERATION_CALL_VIDEO_MENU

User cannot go to the video menu.

 

FLU_USER_OPERATION_CALL_CHAPTER_MENU

User cannot go to the chapters menu.

 

FLU_USER_OPERATION_SELECT_BUTTON

User cannot go trigger a select button event.

 

FLU_USER_OPERATION_SKIP_CHAPTER

User cannot skip to a different chapter.

 

FLU_USER_OPERATION_PAUSE

User cannot pause playback.

 

FLU_USER_OPERATION_STOP

User cannot stop playback.

 

FLU_USER_OPERATION_RESUME

User cannot resume movie playback from a menu.

 

FLU_USER_OPERATION_ALL

User cannot perform any operation.

 

enum FluPlaybackDirection

Enum values used to describe FluPlayer playback direction.

Members

FLU_PLAYBACK_DIRECTION_FORWARDS

The player is playing forwards (from past to future)

 

FLU_PLAYBACK_DIRECTION_BACKWARDS

The player is playing backwards (from future to past)

 

enum FluPlayerEventType

Enum values used to describe different type of events that can be raised by a FluPlayer.

Members

FLU_PLAYER_EVENT_EMPTY

   

FLU_PLAYER_EVENT_STREAMS_AVAILABLE

New information about available streams has been received. Application should query available streams and their respective info again.

 

FLU_PLAYER_EVENT_STREAM_STATE_CHANGED

The state of a stream has changed.

 

FLU_PLAYER_EVENT_STREAM_INFO_UPDATED

Information about a stream has been updated.

 

FLU_PLAYER_EVENT_STREAM_ERROR

An error occured on the stream and thus it can not be played.

 

FLU_PLAYER_EVENT_REQUEST_TEXTURE

A video stream is requesting an output texture.

 

FLU_PLAYER_EVENT_BUFFERING

The player is buffering data in order to resume playback and prevent jittering.

 

FLU_PLAYER_EVENT_ERROR

A fatal error occured on the player.

 

FLU_PLAYER_EVENT_EOS

The player reached the end of stream.

 

FLU_PLAYER_EVENT_STATE

The player state has changed.

 

FLU_PLAYER_EVENT_UOP_CHANGED

User Operation masks have changed.

 

FLU_PLAYER_EVENT_REQUEST_RENDER_MODE

A stream is requesting it's render mode.

 

FLU_PLAYER_EVENT_REQUEST_RENDER_DEVICE

A stream has received a buffer to render.

 

FLU_PLAYER_EVENT_RENDER

A stream needs a device to render to

 

FLU_PLAYER_EVENT_MEDIA_INFO_UPDATED

Media information about the currently opened resource has been updated.

 

FLU_PLAYER_EVENT_BOOKMARKS_AVAILABLE

New information about available bookmarks has been received. Application should query available bookmarks and their respective info again.

 

FLU_PLAYER_EVENT_REQUEST_DRM_AGENT

A DRM capable element is asking the application for a DRM agent.

 

FLU_PLAYER_EVENT_SEEK_SOURCE

The source requests to seek to a given position.

 

FLU_PLAYER_EVENT_NEED_DATA_SOURCE

The source requests new data to be supplied.

 

FluPlayerEventAny

typedef struct {
  FluPlayerEventType type;
} FluPlayerEventAny;

Contains the fields which are common to all event structs. Any event pointer can safely be cast to a pointer to a FluPlayerEventAny to access these fields.

Members

FluPlayerEventType type;

the type of the event.

 

FluPlayerEventError

typedef struct {
  FluPlayerEventType type;
  GError *error;
  const gchar *dbg;
} FluPlayerEventError;

Event structure describing an error that occurred in an FluPlayer instance.

Members

FluPlayerEventType type;

   

GError *error;

a GError describing the error

 

const gchar *dbg;

Debug string

 

FluPlayerEventStreamError

typedef struct {
  FluPlayerEventType type;
  GError *error;
  const gchar *dbg;
  FluStream *stream;
} FluPlayerEventStreamError;

Event structure describing an error that occured in an FluStream instance.

Members

FluPlayerEventType type;

   

GError *error;

a GError describing the error

 

const gchar *dbg;

Debug string

 

FluStream *stream;

Pointer to the FluStream that has generated the error

 

FluPlayerEventBuffering

typedef struct {
  FluPlayerEventType type;
  gint percent;
} FluPlayerEventBuffering;

Event structure providing information about the current buffering state of an FluPlayer instance. When percent is lower than 100, the player is paused and buffering data. When percent reaches 100 again, playback will resume.

Members

FluPlayerEventType type;

   

gint percent;

Buffering level in percentage

 

FluPlayerEventRequestTexture

typedef struct {
  FluPlayerEventType type;
  guintptr handle;
  FluStream *stream;
  gboolean handle_aspect_ratio;
} FluPlayerEventRequestTexture;

Event structure used by a stream to retrieve information about the target rendering texture. When a video stream is preparing to render the first video frame it will request a destination drawable to the application. Application should set the target texture pointer in handle while handling this event. The video rendering component is sometimes able to handle the drawing of black borders and maintain the original video aspect ratio. In most cases this will work just fine but it is recommended that the application handles this directly to support special cases like forcing a specific aspect ratio, video cropping, etc...

Members

FluPlayerEventType type;

   

guintptr handle;

A generic pointer used to exchange a texture identifier. It is specific to the windowing system.

 

FluStream *stream;

A pointer to the FluStream that needs a target texture

 

gboolean handle_aspect_ratio;

TRUE if the video rendering element should handle black borders to maintain aspect ratio. By default this should be handled by the application.

 

FluPlayerEventStreamChanged

typedef struct {
  FluPlayerEventType type;
  FluStream *stream;
  FluStreamChangedFlags changed_flags;
} FluPlayerEventStreamChanged;

Event structure used to notify applications that a stream 's changed

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream

 

FluStreamChangedFlags changed_flags;

FluPlayerEventStreamChangedFlags specifying what changed

 

struct FluPlayerEventStreamInfoUpdated

struct FluPlayerEventStreamInfoUpdated {
  FluPlayerEventType type;
  FluStream *stream;
};

Alias of FluPlayerEventStreamChanged for backwards compatibility


struct FluPlayerEventStreamStateChanged

struct FluPlayerEventStreamStateChanged {
  FluPlayerEventType type;
  FluStream *stream;
};

Event structure used to notify applications that a stream 's state has changed. That means that the stream either became active thanks to data flow (after being requested) or inactive.

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream

 

FluPlayerEventState

typedef struct {
  FluPlayerEventType type;
  FluPlayerState state;
} FluPlayerEventState;

Event structure used to notify applications that the player's state has changed. The new current state is provided in state or can be queried using flu_player_state_get().

Members

FluPlayerEventType type;

   

FluPlayerState state;

Player's current state

 

FluPlayerEventUOPChanged

typedef struct {
  FluPlayerEventType type;
  FluUserOperation prohibited_operations;
} FluPlayerEventUOPChanged;

Event structure used to notify applications that the player's UOP (User Operation Prohibition) has changed.

Members

FluPlayerEventType type;

   

FluUserOperation prohibited_operations;

new User Operation Prohibition

 

FluPlayerEventRequestRenderMode

typedef struct {
  FluPlayerEventType type;
  FluStream *stream;
  gboolean render;
  gboolean synchronize;
  gboolean notify;
} FluPlayerEventRequestRenderMode;

Event structure used to retrieve information about the target rendering mode for stream . Whenever the stream is about to be decoded, the application can decide to render or not to render a specific stream.

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream that requests a render mode

 

gboolean render;

TRUE if the stream should be rendered or FALSE otherwise. Note that this boolean refers to the rendering not the decoding. By default the value is TRUE.

 

gboolean synchronize;

TRUE if the stream should respect timestamps and synchronize against the clock. This can be useful when playing from a live source with poor management of clock discrepancies and you want to play at the source's speed ignoring timestamps. By default the value is TRUE.

 

gboolean notify;

TRUE if the stream will notify through the FLU_PLAYER_EVENT_RENDER that a new sample is going to be rendered.

 

struct FluPlayerEventRequestRenderDevice

struct FluPlayerEventRequestRenderDevice {
  FluPlayerEventType type;
  FluStream *stream;
  GList *devices;
  gint selected;
};

Event structure used to retrieve what device to use to render a stream .

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream that requests a render mode

 

GList *devices;

List of devices

 

gint selected;

Index of selected one from devices list

 

FluPlayerEventRender

typedef struct {
  FluPlayerEventType type;
  FluStream *stream;
  guint64 pts;
  guint64 duration;
} FluPlayerEventRender;

Event structure indicating that a stream is ready to render a sample.

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream that received a sample for rendering

 

guint64 pts;

Timestamp of the sample in nanoseconds

 

guint64 duration;

Sample duration in nanoseconds

 

FluPlayerEventMediaInfoUpdated

typedef struct {
  FluPlayerEventType type;
  const FluMediaInfo *info;
  FluSource *source;
} FluPlayerEventMediaInfoUpdated;

Event structure used to notify applications that a player's FluMediaInfo has changed.

Members

FluPlayerEventType type;

   

const FluMediaInfo *info;

A pointer to the FluMediaInfo. The structure referenced by this pointer should not be freed or modified in any way.

 

FluSource *source;

   

FluPlayerEventRequestDRMAgent

typedef struct {
  FluPlayerEventType type;
  guintptr handle;
  gpointer init_data;
  gsize init_data_size;
  gboolean try_inband;
} FluPlayerEventRequestDRMAgent;

Event structure used to retrieve the DRM agent handle used for decrypting

Members

FluPlayerEventType type;

   

guintptr handle;

A generic pointer used to set the drm agent to use

 

gpointer init_data;

Data chunk extracted from the stream that is necessary to init drm agent, such as PSSH atom, or Playready Object.

 

gsize init_data_size;

size of init_data

 

gboolean try_inband;

allow player to try drm object creation on it's own if no handle is provided by user. TRUE by default.

 

FluPlayerEventSeekSource

typedef struct {
  FluPlayerEventType type;
  FluSource *source;
  guint64 position;
  FluFormat format;
} FluPlayerEventSeekSource;

Event structure used to request a seek on FluSource

Members

FluPlayerEventType type;

   

FluSource *source;

FluSource requesting seek

 

guint64 position;

Position in bytes to seek

 

FluFormat format;

Format of seek event from FluFormat

 

FluPlayerEventSourceNeedData

typedef struct {
  FluPlayerEventType type;
  FluSource *source;
  FluPlaybackDirection playback_direction;
  guint8 *data;
  gsize size;
  guint64 pts;
  GFreeFunc free_func;
} FluPlayerEventSourceNeedData;

Event structure used when FluSource request data. This event is used with seekable FluCustomSource.

Members

FluPlayerEventType type;

   

FluSource *source;

FluSource requesting seek

 

FluPlaybackDirection playback_direction;

current playback direction

 

guint8 *data;

pointer to the data. The structure takes the ownership

 

gsize size;

size of the data. Can be FLU_SIZE_UNKNOWN if not defined.

 

guint64 pts;

timestamp of the data. Can be FLU_TIME_NONE if not defined.

 

GFreeFunc free_func;

   

FluPlayerEventStreamsAvailable

typedef struct {
  FluPlayerEventType type;
  FluStream *stream;
  gboolean added;
} FluPlayerEventStreamsAvailable;

Event structure used when a new stream is add to a FluSource

Members

FluPlayerEventType type;

   

FluStream *stream;

A pointer to the FluStream that has been added to trigger event

 

gboolean added;

True if the stream has been added to the source

 

FluPlayerEvent

The FluPlayerEvent struct contains a union of all of the event structs, and allows access to the data fields in a number of ways.

The event type is always the first field in all of the event structs, and can always be accessed with the following code, no matter what type of event it is: <informalexample> <programlisting> FluPlayerEvent *event; FluPlayerEventType type;

type = event->type; </programlisting> </informalexample>

To access other fields of the event structs, the pointer to the event can be cast to the appropriate event struct pointer, or the union member name can be used. For example if the event type is FLU_PLAYER_EVENT_STATE then the state can be accessed with: <informalexample> <programlisting> FluPlayerEvent *event; FluPlayerState state;

state = ((FluPlayerEventState*)event)->state; </programlisting> </informalexample> or: <informalexample> <programlisting> FluPlayerEvent *event; FluPlayerState state;

state = event->state.x; </programlisting> </informalexample>

stream_info_updated and stream_state_changed are aliases of stream_changed for backwards compatibility