Skip to content

Commit 5c617ce

Browse files
committed
gstplayer: feature parity with audioplayers player
- add audio balance setter/getter - support releasing & prerolling a playback source - add separate seeking info, duration and end of stream notifiers - make gstreamer_video_player.h not depend on gstreamer headers (if possible)
1 parent 91dfa31 commit 5c617ce

File tree

2 files changed

+230
-41
lines changed

2 files changed

+230
-41
lines changed

src/plugins/gstreamer_video_player.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "util/lock_ops.h"
66
#include "util/refcounting.h"
77

8+
#include <gst/video/video-format.h>
9+
810
#include "config.h"
911

1012
#if !defined(HAVE_EGL_GLES2)
@@ -65,6 +67,19 @@ struct video_info;
6567
struct gstplayer;
6668
struct flutterpi;
6769

70+
typedef struct _GstStructure GstStructure;
71+
72+
/// Create a gstreamer video player.
73+
struct gstplayer *gstplayer_new(
74+
struct flutterpi *flutterpi,
75+
const char *uri,
76+
void *userdata,
77+
bool play_video,
78+
bool play_audio,
79+
bool subtitles,
80+
GstStructure *headers
81+
);
82+
6883
/// Create a gstreamer video player that loads the video from a flutter asset.
6984
/// @arg asset_path The path of the asset inside the asset bundle.
7085
/// @arg package_name The name of the package containing the asset
@@ -131,6 +146,11 @@ int gstplayer_pause(struct gstplayer *player);
131146
/// @returns Current playback position, in milliseconds from the beginning of the video.
132147
int64_t gstplayer_get_position(struct gstplayer *player);
133148

149+
/// Get the duration of the currently playing medium.
150+
/// @returns Duration of the current medium in milliseconds, -1 if the duration
151+
/// is not yet known, or INT64_MAX for live sources.
152+
int64_t gstplayer_get_duration(struct gstplayer *player);
153+
134154
/// Set whether the video should loop.
135155
/// @arg looping Whether the video should start playing from the beginning when the
136156
/// end is reached.
@@ -155,6 +175,14 @@ int gstplayer_step_forward(struct gstplayer *player);
155175

156176
int gstplayer_step_backward(struct gstplayer *player);
157177

178+
void gstplayer_set_audio_balance(struct gstplayer *player, float balance);
179+
180+
float gstplayer_get_audio_balance(struct gstplayer *player);
181+
182+
bool gstplayer_release(struct gstplayer *p);
183+
184+
bool gstplayer_preroll(struct gstplayer *p, const char *uri);
185+
158186
struct video_info {
159187
int width, height;
160188

@@ -173,6 +201,17 @@ struct video_info {
173201
/// So you need to make sure you do the proper rethreading in the listener callback.
174202
struct notifier *gstplayer_get_video_info_notifier(struct gstplayer *player);
175203

204+
struct seeking_info {
205+
bool can_seek;
206+
int64_t seek_begin_ms, seek_end_ms;
207+
};
208+
209+
struct notifier *gstplayer_get_seeking_info_notifier(struct gstplayer *player);
210+
211+
struct notifier *gstplayer_get_duration_notifier(struct gstplayer *player);
212+
213+
struct notifier *gstplayer_get_eos_notifier(struct gstplayer *player);
214+
176215
/// @brief Get the value notifier for the buffering state.
177216
///
178217
/// Gets notified with a value of type `struct buffering_state*` when the buffering state changes.

0 commit comments

Comments
 (0)