clapper-gtk: video: Use "scaletempo" by default

Do not require applications to import GStreamer and their devs to learn its
basics just to set this single element. Similarly as ClapperGtkVideo sets
"clappersink" during construction, it can also set "scaletempo" as this is
the most common choice for an audio filter.

Elements can still be changed like before if desired by setting corresponding
player properties.
This commit is contained in:
Rafał Dzięgiel
2024-06-29 14:49:01 +02:00
parent 147399afd8
commit 636e61ead1
2 changed files with 13 additions and 6 deletions

View File

@@ -1220,7 +1220,6 @@ clapper_app_window_constructed (GObject *object)
ClapperPlayer *player = clapper_app_window_get_player (self);
ClapperQueue *queue = clapper_player_get_queue (player);
ClapperGtkExtraMenuButton *button;
GstElement *element;
AdwStyleManager *manager;
static const GActionEntry win_entries[] = {
@@ -1266,9 +1265,6 @@ clapper_app_window_constructed (GObject *object)
/* FIXME: Allow setting sink/filter elements from prefs window
* (this should include parsing bin descriptions) */
element = gst_element_factory_make ("scaletempo", NULL);
if (G_LIKELY (element != NULL))
clapper_player_set_audio_filter (player, element);
clapper_player_set_autoplay (player, TRUE);

View File

@@ -1108,6 +1108,11 @@ _fading_overlay_revealed_cb (GtkRevealer *revealer,
*
* Creates a new #ClapperGtkVideo instance.
*
* Newly created video widget will also set some default GStreamer elements
* on its [class@Clapper.Player]. This includes Clapper own video sink and
* a "scaletempo" element as audio filter. Both can still be changed after
* construction by setting corresponding player properties.
*
* Returns: a new video #GtkWidget.
*/
GtkWidget *
@@ -1397,7 +1402,7 @@ static void
clapper_gtk_video_constructed (GObject *object)
{
ClapperGtkVideo *self = CLAPPER_GTK_VIDEO_CAST (object);
GstElement *vsink = gst_element_factory_make ("clappersink", NULL);
GstElement *afilter, *vsink;
ClapperQueue *queue;
self->player = clapper_player_new ();
@@ -1408,6 +1413,8 @@ clapper_gtk_video_constructed (GObject *object)
g_signal_connect (self->player, "notify::video-sink",
G_CALLBACK (_video_sink_changed_cb), self);
vsink = gst_element_factory_make ("clappersink", NULL);
/* FIXME: This is a temporary workaround for lack
* of DMA_DRM negotiation support in sink itself */
if (G_LIKELY (vsink != NULL)) {
@@ -1422,9 +1429,13 @@ clapper_gtk_video_constructed (GObject *object)
vsink = bin;
}
}
clapper_player_set_video_sink (self->player, vsink);
}
clapper_player_set_video_sink (self->player, vsink);
afilter = gst_element_factory_make ("scaletempo", NULL);
if (G_LIKELY (afilter != NULL))
clapper_player_set_audio_filter (self->player, afilter);
g_signal_connect (self->player, "error",
G_CALLBACK (_player_error_cb), self);