tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
2012-03-02 11:01:37 +00:00
|
|
|
* playback-test.c: playback sample application
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
* 2006 Stefan Kost <ensonic@users.sf.net>
|
2012-02-24 10:44:53 +00:00
|
|
|
* 2012 Collabora Ltd.
|
|
|
|
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
*/
|
2008-06-27 07:42:07 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2002-08-11 11:45:07 +00:00
|
|
|
#include <stdlib.h>
|
2009-05-27 14:37:38 +00:00
|
|
|
#include <math.h>
|
2002-05-28 20:30:11 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2011-05-25 17:50:34 +00:00
|
|
|
#include <gdk/gdk.h>
|
|
|
|
#if defined (GDK_WINDOWING_X11)
|
2008-06-24 16:05:06 +00:00
|
|
|
#include <gdk/gdkx.h>
|
2011-05-25 17:50:34 +00:00
|
|
|
#elif defined (GDK_WINDOWING_WIN32)
|
2010-09-27 08:46:54 +00:00
|
|
|
#include <gdk/gdkwin32.h>
|
2012-02-20 13:35:37 +00:00
|
|
|
#elif defined (GDK_WINDOWING_QUARTZ)
|
2012-05-21 11:14:32 +00:00
|
|
|
#include <gdk/gdkquartz.h>
|
2008-06-27 07:42:07 +00:00
|
|
|
#endif
|
2010-09-27 08:46:54 +00:00
|
|
|
|
2011-11-30 06:23:47 +00:00
|
|
|
#include <gst/video/videooverlay.h>
|
2012-03-02 09:00:55 +00:00
|
|
|
#include <gst/video/colorbalance.h>
|
2012-04-13 09:01:03 +00:00
|
|
|
#include <gst/video/navigation.h>
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2012-03-02 11:01:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (playback_debug);
|
|
|
|
#define GST_CAT_DEFAULT (playback_debug)
|
2005-09-19 16:09:41 +00:00
|
|
|
|
2012-02-22 14:43:25 +00:00
|
|
|
/* Copied from gst-plugins-base/gst/playback/gstplay-enum.h */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_PLAY_FLAG_VIDEO = (1 << 0),
|
|
|
|
GST_PLAY_FLAG_AUDIO = (1 << 1),
|
|
|
|
GST_PLAY_FLAG_TEXT = (1 << 2),
|
|
|
|
GST_PLAY_FLAG_VIS = (1 << 3),
|
|
|
|
GST_PLAY_FLAG_SOFT_VOLUME = (1 << 4),
|
|
|
|
GST_PLAY_FLAG_NATIVE_AUDIO = (1 << 5),
|
|
|
|
GST_PLAY_FLAG_NATIVE_VIDEO = (1 << 6),
|
|
|
|
GST_PLAY_FLAG_DOWNLOAD = (1 << 7),
|
|
|
|
GST_PLAY_FLAG_BUFFERING = (1 << 8),
|
|
|
|
GST_PLAY_FLAG_DEINTERLACE = (1 << 9),
|
2014-03-16 16:00:38 +00:00
|
|
|
GST_PLAY_FLAG_SOFT_COLORBALANCE = (1 << 10),
|
|
|
|
GST_PLAY_FLAG_FORCE_FILTERS = (1 << 11),
|
2012-02-22 14:43:25 +00:00
|
|
|
} GstPlayFlags;
|
2007-06-21 08:34:46 +00:00
|
|
|
|
|
|
|
/* configuration */
|
|
|
|
|
2008-04-09 21:42:24 +00:00
|
|
|
#define FILL_INTERVAL 100
|
2007-06-21 08:34:46 +00:00
|
|
|
//#define UPDATE_INTERVAL 500
|
|
|
|
//#define UPDATE_INTERVAL 100
|
2009-12-08 16:30:39 +00:00
|
|
|
#define UPDATE_INTERVAL 40
|
2015-01-14 13:35:34 +00:00
|
|
|
#define SLOW_UPDATE_INTERVAL 500
|
2007-06-21 08:34:46 +00:00
|
|
|
|
|
|
|
/* number of milliseconds to play for after a seek */
|
|
|
|
#define SCRUB_TIME 100
|
|
|
|
|
|
|
|
/* timeout for gst_element_get_state() after a seek */
|
|
|
|
#define SEEK_TIMEOUT 40 * GST_MSECOND
|
|
|
|
|
2008-06-24 16:05:06 +00:00
|
|
|
#define DEFAULT_VIDEO_HEIGHT 300
|
|
|
|
|
2009-09-09 14:21:57 +00:00
|
|
|
/* the state to go to when stop is pressed */
|
|
|
|
#define STOP_STATE GST_STATE_READY
|
|
|
|
|
2010-09-24 14:31:37 +00:00
|
|
|
#define N_GRAD 1000.0
|
2007-06-21 08:34:46 +00:00
|
|
|
|
2008-02-27 12:19:31 +00:00
|
|
|
/* we keep an array of the visualisation entries so that we can easily switch
|
|
|
|
* with the combo box index. */
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstElementFactory *factory;
|
|
|
|
} VisEntry;
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
/* GTK widgets */
|
|
|
|
GtkWidget *window;
|
|
|
|
GtkWidget *video_combo, *audio_combo, *text_combo, *vis_combo;
|
2012-03-01 11:52:21 +00:00
|
|
|
GtkWidget *video_window;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GtkWidget *vis_checkbox, *video_checkbox, *audio_checkbox;
|
|
|
|
GtkWidget *text_checkbox, *mute_checkbox, *volume_spinbutton;
|
2012-03-01 11:52:21 +00:00
|
|
|
GtkWidget *soft_volume_checkbox, *native_audio_checkbox,
|
|
|
|
*native_video_checkbox;
|
|
|
|
GtkWidget *download_checkbox, *buffering_checkbox, *deinterlace_checkbox;
|
|
|
|
GtkWidget *soft_colorbalance_checkbox;
|
|
|
|
GtkWidget *video_sink_entry, *audio_sink_entry, *text_sink_entry;
|
|
|
|
GtkWidget *buffer_size_entry, *buffer_duration_entry;
|
|
|
|
GtkWidget *ringbuffer_maxsize_entry, *connection_speed_entry;
|
|
|
|
GtkWidget *av_offset_entry, *subtitle_encoding_entry;
|
|
|
|
GtkWidget *subtitle_fontdesc_button;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
GtkWidget *seek_format_combo, *seek_position_label, *seek_duration_label;
|
2015-01-14 13:35:34 +00:00
|
|
|
GtkWidget *seek_start_label, *seek_stop_label;
|
2012-03-01 09:45:51 +00:00
|
|
|
GtkWidget *seek_entry;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GtkWidget *seek_scale, *statusbar;
|
|
|
|
guint status_id;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
GtkWidget *step_format_combo, *step_amount_spinbutton, *step_rate_spinbutton;
|
2012-02-24 10:44:53 +00:00
|
|
|
GtkWidget *shuttle_scale;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GtkWidget *contrast_scale, *brightness_scale, *hue_scale, *saturation_scale;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
GstNavigationCommand cmd;
|
|
|
|
GtkWidget *button;
|
|
|
|
} navigation_buttons[14];
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
guintptr embed_xid;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
/* GStreamer pipeline */
|
2002-05-28 20:30:11 +00:00
|
|
|
GstElement *pipeline;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GstElement *navigation_element;
|
|
|
|
GstElement *colorbalance_element;
|
2012-03-02 09:00:55 +00:00
|
|
|
GstElement *overlay_element;
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
/* Settings */
|
|
|
|
gboolean accurate_seek;
|
|
|
|
gboolean keyframe_seek;
|
|
|
|
gboolean loop_seek;
|
|
|
|
gboolean flush_seek;
|
|
|
|
gboolean scrub;
|
|
|
|
gboolean play_scrub;
|
|
|
|
gboolean skip_seek;
|
2014-12-10 14:54:07 +00:00
|
|
|
gboolean skip_seek_key_only;
|
|
|
|
gboolean skip_seek_no_audio;
|
2012-02-24 10:44:53 +00:00
|
|
|
gdouble rate;
|
2012-05-23 14:07:20 +00:00
|
|
|
gboolean snap_before;
|
|
|
|
gboolean snap_after;
|
examples/seeking/: Added app for playback speed testing.
Original commit message from CVS:
* examples/seeking/Makefile.am:
* examples/seeking/scrubby.c: (gst_element_factory_make_or_warn),
(dynamic_link), (setup_dynamic_link), (make_wav_pipeline),
(make_playerbin_pipeline), (format_value), (update_scale),
(speed_cb), (seek_cb), (do_seek), (start_seek), (stop_seek),
(play_cb), (pause_cb), (stop_cb), (print_message), (bus_message),
(print_usage), (main):
Added app for playback speed testing.
* examples/seeking/seek.c: (dynamic_link),
(make_avi_msmpeg4v3_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (do_seek), (set_update_scale),
(message_received), (main):
Updated seek example.
2005-11-04 10:49:55 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
/* From commandline parameters */
|
|
|
|
gboolean stats;
|
|
|
|
gboolean verbose;
|
|
|
|
const gchar *pipeline_spec;
|
|
|
|
gint pipeline_type;
|
|
|
|
GList *paths, *current_path;
|
2012-03-01 12:24:45 +00:00
|
|
|
GList *sub_paths, *current_sub_path;
|
examples/seeking/: Added app for playback speed testing.
Original commit message from CVS:
* examples/seeking/Makefile.am:
* examples/seeking/scrubby.c: (gst_element_factory_make_or_warn),
(dynamic_link), (setup_dynamic_link), (make_wav_pipeline),
(make_playerbin_pipeline), (format_value), (update_scale),
(speed_cb), (seek_cb), (do_seek), (start_seek), (stop_seek),
(play_cb), (pause_cb), (stop_cb), (print_message), (bus_message),
(print_usage), (main):
Added app for playback speed testing.
* examples/seeking/seek.c: (dynamic_link),
(make_avi_msmpeg4v3_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (do_seek), (set_update_scale),
(message_received), (main):
Updated seek example.
2005-11-04 10:49:55 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
/* Internal state */
|
|
|
|
gint64 position, duration;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gboolean is_live;
|
|
|
|
gboolean buffering;
|
|
|
|
GstBufferingMode mode;
|
|
|
|
gint64 buffering_left;
|
|
|
|
GstState state;
|
|
|
|
guint update_id;
|
2015-01-14 13:35:34 +00:00
|
|
|
guint slow_update_id;
|
2012-05-21 06:01:09 +00:00
|
|
|
guint seek_timeout_id; /* Used for scrubbing in paused */
|
2012-02-24 10:44:53 +00:00
|
|
|
gulong changed_id;
|
|
|
|
guint fill_id;
|
examples/seeking/: Added app for playback speed testing.
Original commit message from CVS:
* examples/seeking/Makefile.am:
* examples/seeking/scrubby.c: (gst_element_factory_make_or_warn),
(dynamic_link), (setup_dynamic_link), (make_wav_pipeline),
(make_playerbin_pipeline), (format_value), (update_scale),
(speed_cb), (seek_cb), (do_seek), (start_seek), (stop_seek),
(play_cb), (pause_cb), (stop_cb), (print_message), (bus_message),
(print_usage), (main):
Added app for playback speed testing.
* examples/seeking/seek.c: (dynamic_link),
(make_avi_msmpeg4v3_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (do_seek), (set_update_scale),
(message_received), (main):
Updated seek example.
2005-11-04 10:49:55 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gboolean need_streams;
|
|
|
|
gint n_video, n_audio, n_text;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
GMutex state_mutex;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GArray *vis_entries; /* Array of VisEntry structs */
|
examples/seeking/: Added app for playback speed testing.
Original commit message from CVS:
* examples/seeking/Makefile.am:
* examples/seeking/scrubby.c: (gst_element_factory_make_or_warn),
(dynamic_link), (setup_dynamic_link), (make_wav_pipeline),
(make_playerbin_pipeline), (format_value), (update_scale),
(speed_cb), (seek_cb), (do_seek), (start_seek), (stop_seek),
(play_cb), (pause_cb), (stop_cb), (print_message), (bus_message),
(print_usage), (main):
Added app for playback speed testing.
* examples/seeking/seek.c: (dynamic_link),
(make_avi_msmpeg4v3_mp3_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (do_seek), (set_update_scale),
(message_received), (main):
Updated seek example.
2005-11-04 10:49:55 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gboolean shuttling;
|
|
|
|
gdouble shuttle_rate;
|
|
|
|
gdouble play_rate;
|
2012-03-01 09:45:51 +00:00
|
|
|
|
|
|
|
const GstFormatDefinition *seek_format;
|
|
|
|
GList *formats;
|
2012-03-02 11:01:37 +00:00
|
|
|
} PlaybackApp;
|
2008-02-27 12:19:31 +00:00
|
|
|
|
2012-03-02 11:01:37 +00:00
|
|
|
static void clear_streams (PlaybackApp * app);
|
|
|
|
static void find_interface_elements (PlaybackApp * app);
|
2009-05-27 14:37:38 +00:00
|
|
|
static void volume_notify_cb (GstElement * pipeline, GParamSpec * arg,
|
2012-03-02 11:01:37 +00:00
|
|
|
PlaybackApp * app);
|
2012-02-24 11:00:41 +00:00
|
|
|
static void mute_notify_cb (GstElement * pipeline, GParamSpec * arg,
|
2012-03-02 11:01:37 +00:00
|
|
|
PlaybackApp * app);
|
|
|
|
|
|
|
|
static void video_sink_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void text_sink_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void audio_sink_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void buffer_size_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void buffer_duration_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void ringbuffer_maxsize_activate_cb (GtkEntry * entry,
|
|
|
|
PlaybackApp * app);
|
|
|
|
static void connection_speed_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void av_offset_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
|
|
|
static void subtitle_encoding_activate_cb (GtkEntry * entry, PlaybackApp * app);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2007-06-21 08:34:46 +00:00
|
|
|
/* pipeline construction */
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2003-11-02 23:06:23 +00:00
|
|
|
static GstElement *
|
2010-03-15 21:49:53 +00:00
|
|
|
gst_element_factory_make_or_warn (const gchar * type, const gchar * name)
|
2003-11-02 23:06:23 +00:00
|
|
|
{
|
|
|
|
GstElement *element = gst_element_factory_make (type, name);
|
|
|
|
|
2011-08-30 08:21:31 +00:00
|
|
|
#ifndef GST_DISABLE_PARSE
|
|
|
|
if (!element) {
|
|
|
|
/* Try parsing it as a pipeline description */
|
|
|
|
element = gst_parse_bin_from_description (type, TRUE, NULL);
|
|
|
|
if (element) {
|
|
|
|
gst_element_set_name (element, name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-02 23:06:23 +00:00
|
|
|
if (!element) {
|
2004-03-14 22:34:34 +00:00
|
|
|
g_warning ("Failed to create element %s of type %s", name, type);
|
2003-11-02 23:06:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2008-06-24 16:05:06 +00:00
|
|
|
static void
|
2012-03-01 12:24:45 +00:00
|
|
|
set_uri_property (GObject * object, const gchar * property,
|
|
|
|
const gchar * location)
|
2008-06-24 16:05:06 +00:00
|
|
|
{
|
|
|
|
gchar *uri;
|
|
|
|
|
|
|
|
/* Add "file://" prefix for convenience */
|
2012-03-01 12:24:45 +00:00
|
|
|
if (location && (g_str_has_prefix (location, "/")
|
|
|
|
|| !gst_uri_is_valid (location))) {
|
2011-05-25 17:45:33 +00:00
|
|
|
uri = gst_filename_to_uri (location, NULL);
|
|
|
|
g_print ("Setting URI: %s\n", uri);
|
2012-03-01 12:24:45 +00:00
|
|
|
g_object_set (object, property, uri, NULL);
|
2008-06-24 16:05:06 +00:00
|
|
|
g_free (uri);
|
|
|
|
} else {
|
2011-05-25 17:45:33 +00:00
|
|
|
g_print ("Setting URI: %s\n", location);
|
2012-03-01 12:24:45 +00:00
|
|
|
g_object_set (object, property, location, NULL);
|
2008-06-24 16:05:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-01 12:24:45 +00:00
|
|
|
static void
|
|
|
|
playbin_set_uri (GstElement * playbin, const gchar * location,
|
|
|
|
const gchar * sub_location)
|
2003-02-02 19:25:58 +00:00
|
|
|
{
|
2012-03-01 12:24:45 +00:00
|
|
|
set_uri_property (G_OBJECT (playbin), "uri", location);
|
|
|
|
set_uri_property (G_OBJECT (playbin), "suburi", sub_location);
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
static void
|
2012-03-02 11:07:22 +00:00
|
|
|
make_playbin_pipeline (PlaybackApp * app, const gchar * location)
|
2008-06-24 16:05:06 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
GstElement *pipeline;
|
2010-09-27 09:32:31 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
app->pipeline = pipeline = gst_element_factory_make ("playbin", "playbin");
|
2012-02-24 10:44:53 +00:00
|
|
|
g_assert (pipeline);
|
2003-02-02 19:25:58 +00:00
|
|
|
|
2012-03-01 12:24:45 +00:00
|
|
|
playbin_set_uri (pipeline, location,
|
|
|
|
app->current_sub_path ? app->current_sub_path->data : NULL);
|
2009-05-27 14:37:38 +00:00
|
|
|
|
|
|
|
g_signal_connect (pipeline, "notify::volume", G_CALLBACK (volume_notify_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
2012-02-24 11:00:41 +00:00
|
|
|
g_signal_connect (pipeline, "notify::mute", G_CALLBACK (mute_notify_cb), app);
|
2012-02-23 12:31:37 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_element = GST_ELEMENT (gst_object_ref (pipeline));
|
|
|
|
app->colorbalance_element = GST_ELEMENT (gst_object_ref (pipeline));
|
2007-11-16 16:02:45 +00:00
|
|
|
}
|
|
|
|
|
2006-05-09 11:21:24 +00:00
|
|
|
#ifndef GST_DISABLE_PARSE
|
2012-02-24 10:44:53 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
make_parselaunch_pipeline (PlaybackApp * app, const gchar * description)
|
2005-11-11 19:16:35 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->pipeline = gst_parse_launch (description, NULL);
|
2005-11-11 19:16:35 +00:00
|
|
|
}
|
2006-05-09 11:21:24 +00:00
|
|
|
#endif
|
2005-11-11 19:16:35 +00:00
|
|
|
|
2007-06-21 08:34:46 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-15 21:49:53 +00:00
|
|
|
const gchar *name;
|
2012-03-02 11:01:37 +00:00
|
|
|
void (*func) (PlaybackApp * app, const gchar * location);
|
2014-12-15 12:12:44 +00:00
|
|
|
const gchar *help;
|
2007-06-21 08:34:46 +00:00
|
|
|
}
|
|
|
|
Pipeline;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
static const Pipeline pipelines[] = {
|
2014-12-15 12:12:44 +00:00
|
|
|
{"playbin", make_playbin_pipeline, "[URLS|FILENAMES]"},
|
2007-06-21 08:34:46 +00:00
|
|
|
#ifndef GST_DISABLE_PARSE
|
2014-12-15 12:12:44 +00:00
|
|
|
{"parse-launch", make_parselaunch_pipeline, "[PARSE-LAUNCH-LINE]"},
|
2007-06-21 08:34:46 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ui callbacks and helpers */
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static gchar *
|
2012-03-02 11:01:37 +00:00
|
|
|
format_value (GtkScale * scale, gdouble value, PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2002-06-06 20:26:52 +00:00
|
|
|
gint64 real;
|
|
|
|
gint64 seconds;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
real = value * app->duration / N_GRAD;
|
2002-06-06 20:26:52 +00:00
|
|
|
seconds = (gint64) real / GST_SECOND;
|
2017-06-06 05:45:08 +00:00
|
|
|
/* Use two different formatting depending on the amount */
|
|
|
|
if (seconds < 60 * 60) {
|
|
|
|
gint64 subseconds = (gint64) real / (GST_MSECOND);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2017-06-06 05:45:08 +00:00
|
|
|
/* Sub hour positioning */
|
|
|
|
return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%03"
|
|
|
|
G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 1000);
|
|
|
|
} else {
|
|
|
|
gint64 days = seconds / (24 * 60 * 60);
|
|
|
|
gint64 hours = (seconds / (60 * 60)) % 60;
|
|
|
|
gint64 minutes = (seconds / 60) % 60;
|
|
|
|
|
|
|
|
if (days) {
|
|
|
|
return g_strdup_printf ("%02" G_GINT64_FORMAT "d%02" G_GINT64_FORMAT
|
|
|
|
"h%02" G_GINT64_FORMAT "m", days, hours, minutes);
|
|
|
|
} else {
|
|
|
|
return g_strdup_printf ("%02" G_GINT64_FORMAT "h%02" G_GINT64_FORMAT
|
|
|
|
"m%02" G_GINT64_FORMAT "s", hours, minutes, seconds % 60);
|
|
|
|
}
|
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
2009-06-12 11:55:33 +00:00
|
|
|
static gchar *
|
|
|
|
shuttle_format_value (GtkScale * scale, gdouble value)
|
|
|
|
{
|
|
|
|
return g_strdup_printf ("%0.*g", gtk_scale_get_digits (scale), value);
|
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const gchar *name;
|
|
|
|
const GstFormat format;
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
|
|
|
seek_format;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
static seek_format seek_formats[] = {
|
|
|
|
{"tim", GST_FORMAT_TIME},
|
|
|
|
{"byt", GST_FORMAT_BYTES},
|
|
|
|
{"buf", GST_FORMAT_BUFFERS},
|
|
|
|
{"def", GST_FORMAT_DEFAULT},
|
|
|
|
{NULL, 0},
|
2002-05-28 20:30:11 +00:00
|
|
|
};
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
query_positions (PlaybackApp * app)
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
gint i = 0;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print ("positions %8.8s: ", GST_ELEMENT_NAME (app->pipeline));
|
|
|
|
while (seek_formats[i].name) {
|
|
|
|
gint64 position, total;
|
|
|
|
GstFormat format;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
format = seek_formats[i].format;
|
2005-05-09 10:56:13 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
if (gst_element_query_position (app->pipeline, format, &position) &&
|
|
|
|
gst_element_query_duration (app->pipeline, format, &total)) {
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
|
|
|
|
seek_formats[i].name, position, total);
|
|
|
|
} else {
|
|
|
|
g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*", "*NA*");
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
i++;
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print (" %s\n", GST_ELEMENT_NAME (app->pipeline));
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
static gboolean start_seek (GtkRange * range, GdkEventButton * event,
|
2012-03-02 11:01:37 +00:00
|
|
|
PlaybackApp * app);
|
2012-02-24 10:44:53 +00:00
|
|
|
static gboolean stop_seek (GtkRange * range, GdkEventButton * event,
|
2012-03-02 11:01:37 +00:00
|
|
|
PlaybackApp * app);
|
|
|
|
static void seek_cb (GtkRange * range, PlaybackApp * app);
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
set_scale (PlaybackApp * app, gdouble value)
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
g_signal_handlers_block_by_func (app->seek_scale, start_seek, app);
|
|
|
|
g_signal_handlers_block_by_func (app->seek_scale, stop_seek, app);
|
|
|
|
g_signal_handlers_block_by_func (app->seek_scale, seek_cb, app);
|
|
|
|
gtk_range_set_value (GTK_RANGE (app->seek_scale), value);
|
|
|
|
g_signal_handlers_unblock_by_func (app->seek_scale, start_seek, app);
|
|
|
|
g_signal_handlers_unblock_by_func (app->seek_scale, stop_seek, app);
|
|
|
|
g_signal_handlers_unblock_by_func (app->seek_scale, seek_cb, app);
|
|
|
|
gtk_widget_queue_draw (app->seek_scale);
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
}
|
|
|
|
|
2008-04-09 21:42:24 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
update_fill (PlaybackApp * app)
|
2012-02-24 10:44:53 +00:00
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
query = gst_query_new_buffering (GST_FORMAT_PERCENT);
|
2012-07-19 10:45:17 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (gst_element_query (app->pipeline, query)) {
|
2012-07-19 10:45:17 +00:00
|
|
|
gint64 start, stop, estimated_total;
|
2012-02-24 10:44:53 +00:00
|
|
|
GstFormat format;
|
|
|
|
gdouble fill;
|
|
|
|
gboolean busy;
|
|
|
|
gint percent;
|
|
|
|
GstBufferingMode mode;
|
|
|
|
gint avg_in, avg_out;
|
|
|
|
gint64 buffering_left;
|
|
|
|
|
|
|
|
gst_query_parse_buffering_percent (query, &busy, &percent);
|
|
|
|
gst_query_parse_buffering_stats (query, &mode, &avg_in, &avg_out,
|
|
|
|
&buffering_left);
|
2012-07-19 10:45:17 +00:00
|
|
|
gst_query_parse_buffering_range (query, &format, &start, &stop,
|
|
|
|
&estimated_total);
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
/* note that we could start the playback when buffering_left < remaining
|
|
|
|
* playback time */
|
|
|
|
GST_DEBUG ("buffering total %" G_GINT64_FORMAT " ms, left %"
|
2012-07-19 10:45:17 +00:00
|
|
|
G_GINT64_FORMAT " ms", estimated_total, buffering_left);
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG ("start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT,
|
|
|
|
start, stop);
|
|
|
|
|
|
|
|
if (stop != -1)
|
|
|
|
fill = N_GRAD * stop / GST_FORMAT_PERCENT_MAX;
|
|
|
|
else
|
|
|
|
fill = N_GRAD;
|
|
|
|
|
|
|
|
gtk_range_set_fill_level (GTK_RANGE (app->seek_scale), fill);
|
|
|
|
}
|
|
|
|
gst_query_unref (query);
|
2008-04-09 21:42:24 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-01-14 13:35:34 +00:00
|
|
|
static gboolean
|
|
|
|
update_seek_range (PlaybackApp * app)
|
|
|
|
{
|
|
|
|
GstFormat format = GST_FORMAT_TIME;
|
|
|
|
gint64 seek_start, seek_stop;
|
|
|
|
gboolean seekable;
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
query = gst_query_new_seeking (format);
|
|
|
|
if (gst_element_query (app->pipeline, query)) {
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
gst_query_parse_seeking (query, &format, &seekable, &seek_start,
|
|
|
|
&seek_stop);
|
|
|
|
if (!seekable) {
|
|
|
|
seek_start = seek_stop = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%" G_GINT64_FORMAT, seek_start);
|
|
|
|
gtk_label_set_text (GTK_LABEL (app->seek_start_label), str);
|
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%" G_GINT64_FORMAT, seek_stop);
|
|
|
|
gtk_label_set_text (GTK_LABEL (app->seek_stop_label), str);
|
|
|
|
g_free (str);
|
|
|
|
}
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
update_scale (PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
GstFormat format = GST_FORMAT_TIME;
|
2012-03-01 09:45:51 +00:00
|
|
|
gint64 seek_pos, seek_dur;
|
|
|
|
gchar *str;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2007-06-21 08:34:46 +00:00
|
|
|
//position = 0;
|
|
|
|
//duration = 0;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
gst_element_query_position (app->pipeline, format, &app->position);
|
|
|
|
gst_element_query_duration (app->pipeline, format, &app->duration);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->stats)
|
|
|
|
query_positions (app);
|
2009-06-01 09:31:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->position >= app->duration)
|
|
|
|
app->duration = app->position;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->duration > 0) {
|
|
|
|
set_scale (app, app->position * N_GRAD / app->duration);
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
if (app->seek_format) {
|
|
|
|
format = app->seek_format->value;
|
|
|
|
seek_pos = seek_dur = -1;
|
2012-03-02 09:00:55 +00:00
|
|
|
gst_element_query_position (app->pipeline, format, &seek_pos);
|
|
|
|
gst_element_query_duration (app->pipeline, format, &seek_dur);
|
2012-03-01 09:45:51 +00:00
|
|
|
|
|
|
|
str = g_strdup_printf ("%" G_GINT64_FORMAT, seek_pos);
|
|
|
|
gtk_label_set_text (GTK_LABEL (app->seek_position_label), str);
|
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%" G_GINT64_FORMAT, seek_dur);
|
|
|
|
gtk_label_set_text (GTK_LABEL (app->seek_duration_label), str);
|
|
|
|
g_free (str);
|
2009-05-27 14:37:38 +00:00
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-02 11:01:37 +00:00
|
|
|
static void set_update_scale (PlaybackApp * app, gboolean active);
|
|
|
|
static void set_update_fill (PlaybackApp * app, gboolean active);
|
2007-02-27 18:45:37 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
end_scrub (PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2006-03-29 13:54:24 +00:00
|
|
|
GST_DEBUG ("end scrub, PAUSE");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
|
|
|
app->seek_timeout_id = 0;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-11-16 10:54:45 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
send_event (PlaybackApp * app, GstEvent * event)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2005-06-02 13:33:40 +00:00
|
|
|
gboolean res = FALSE;
|
2002-06-06 20:26:52 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG ("send event on element %s", GST_ELEMENT_NAME (app->pipeline));
|
|
|
|
res = gst_element_send_event (app->pipeline, event);
|
2005-06-02 13:33:40 +00:00
|
|
|
|
2005-11-16 10:54:45 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
do_seek (PlaybackApp * app, GstFormat format, gint64 position)
|
2005-11-16 10:54:45 +00:00
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
GstEvent *s_event;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
|
2005-12-12 13:03:50 +00:00
|
|
|
flags = 0;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->flush_seek)
|
2005-12-12 13:03:50 +00:00
|
|
|
flags |= GST_SEEK_FLAG_FLUSH;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->accurate_seek)
|
2005-11-16 10:54:45 +00:00
|
|
|
flags |= GST_SEEK_FLAG_ACCURATE;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->keyframe_seek)
|
2005-11-16 10:54:45 +00:00
|
|
|
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->loop_seek)
|
2005-11-16 10:54:45 +00:00
|
|
|
flags |= GST_SEEK_FLAG_SEGMENT;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->skip_seek)
|
2014-12-10 14:54:07 +00:00
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE;
|
|
|
|
if (app->skip_seek_key_only)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_KEY_UNITS;
|
|
|
|
if (app->skip_seek_no_audio)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_NO_AUDIO;
|
2012-05-23 14:07:20 +00:00
|
|
|
if (app->snap_before)
|
|
|
|
flags |= GST_SEEK_FLAG_SNAP_BEFORE;
|
|
|
|
if (app->snap_after)
|
|
|
|
flags |= GST_SEEK_FLAG_SNAP_AFTER;
|
2005-11-16 10:54:45 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->rate >= 0) {
|
|
|
|
s_event = gst_event_new_seek (app->rate,
|
2012-03-01 09:45:51 +00:00
|
|
|
format, flags, GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_SET,
|
2008-07-24 13:19:26 +00:00
|
|
|
GST_CLOCK_TIME_NONE);
|
2007-02-27 18:45:37 +00:00
|
|
|
GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
|
2012-03-01 09:45:51 +00:00
|
|
|
app->rate, GST_TIME_ARGS (position), GST_TIME_ARGS (app->duration));
|
2006-10-10 18:56:01 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
s_event = gst_event_new_seek (app->rate,
|
2012-03-01 09:45:51 +00:00
|
|
|
format, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
|
|
|
GST_SEEK_TYPE_SET, position);
|
2007-02-27 18:45:37 +00:00
|
|
|
GST_DEBUG ("seek with rate %lf to %" GST_TIME_FORMAT " / %" GST_TIME_FORMAT,
|
2012-03-01 09:45:51 +00:00
|
|
|
app->rate, GST_TIME_ARGS (0), GST_TIME_ARGS (position));
|
2006-10-10 18:56:01 +00:00
|
|
|
}
|
2005-11-16 10:54:45 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
res = send_event (app, s_event);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
if (res) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->flush_seek) {
|
|
|
|
gst_element_get_state (GST_ELEMENT (app->pipeline), NULL, NULL,
|
|
|
|
SEEK_TIMEOUT);
|
2007-02-27 18:45:37 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_scale (app, TRUE);
|
2005-12-12 13:03:50 +00:00
|
|
|
}
|
2007-05-09 11:25:34 +00:00
|
|
|
} else {
|
2005-06-02 13:33:40 +00:00
|
|
|
g_print ("seek failed\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_scale (app, TRUE);
|
2007-05-09 11:25:34 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
seek_cb (GtkRange * range, PlaybackApp * app)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2012-03-01 09:45:51 +00:00
|
|
|
gint64 real;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
real =
|
|
|
|
gtk_range_get_value (GTK_RANGE (app->seek_scale)) * app->duration /
|
|
|
|
N_GRAD;
|
|
|
|
|
|
|
|
GST_DEBUG ("value=%f, real=%" G_GINT64_FORMAT,
|
|
|
|
gtk_range_get_value (GTK_RANGE (app->seek_scale)), real);
|
|
|
|
|
2006-03-29 13:54:24 +00:00
|
|
|
GST_DEBUG ("do seek");
|
2012-03-01 09:45:51 +00:00
|
|
|
do_seek (app, GST_FORMAT_TIME, real);
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->play_scrub) {
|
2013-03-15 09:07:55 +00:00
|
|
|
if (app->buffering) {
|
|
|
|
GST_DEBUG ("do scrub seek, waiting for buffering");
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("do scrub seek, PLAYING");
|
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PLAYING);
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->seek_timeout_id == 0) {
|
|
|
|
app->seek_timeout_id =
|
|
|
|
g_timeout_add (SCRUB_TIME, (GSourceFunc) end_scrub, app);
|
2006-03-22 12:28:36 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-09 21:42:24 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
advanced_seek_button_cb (GtkButton * button, PlaybackApp * app)
|
2012-03-01 09:45:51 +00:00
|
|
|
{
|
|
|
|
GstFormat fmt;
|
|
|
|
gint64 pos;
|
|
|
|
const gchar *text;
|
|
|
|
gchar *endptr;
|
|
|
|
|
|
|
|
fmt = app->seek_format->value;
|
|
|
|
|
|
|
|
text = gtk_entry_get_text (GTK_ENTRY (app->seek_entry));
|
|
|
|
|
|
|
|
pos = g_ascii_strtoll (text, &endptr, 10);
|
|
|
|
if (endptr != text && pos != G_MAXINT64 && pos != G_MININT64) {
|
|
|
|
do_seek (app, fmt, pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-09 21:42:24 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
set_update_fill (PlaybackApp * app, gboolean active)
|
2008-04-09 21:42:24 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG ("fill scale is %d", active);
|
|
|
|
|
|
|
|
if (active) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->fill_id == 0) {
|
|
|
|
app->fill_id =
|
|
|
|
g_timeout_add (FILL_INTERVAL, (GSourceFunc) update_fill, app);
|
2008-04-09 21:42:24 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->fill_id) {
|
|
|
|
g_source_remove (app->fill_id);
|
|
|
|
app->fill_id = 0;
|
2008-04-09 21:42:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
set_update_scale (PlaybackApp * app, gboolean active)
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
{
|
2007-02-27 18:45:37 +00:00
|
|
|
GST_DEBUG ("update scale is %d", active);
|
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
if (active) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->update_id == 0) {
|
|
|
|
app->update_id =
|
|
|
|
g_timeout_add (UPDATE_INTERVAL, (GSourceFunc) update_scale, app);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
2015-01-14 13:35:34 +00:00
|
|
|
if (app->slow_update_id == 0) {
|
|
|
|
app->slow_update_id =
|
|
|
|
g_timeout_add (SLOW_UPDATE_INTERVAL, (GSourceFunc) update_seek_range,
|
|
|
|
app);
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->update_id) {
|
|
|
|
g_source_remove (app->update_id);
|
|
|
|
app->update_id = 0;
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
2015-01-14 13:35:34 +00:00
|
|
|
if (app->slow_update_id) {
|
|
|
|
g_source_remove (app->slow_update_id);
|
|
|
|
app->slow_update_id = 0;
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
start_seek (GtkRange * range, GdkEventButton * event, PlaybackApp * app)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2006-03-29 13:54:24 +00:00
|
|
|
if (event->type != GDK_BUTTON_PRESS)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_scale (app, FALSE);
|
2006-10-13 11:25:10 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING && app->flush_seek && app->scrub) {
|
2006-03-29 13:54:24 +00:00
|
|
|
GST_DEBUG ("start scrub seek, PAUSE");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
2006-03-29 13:54:24 +00:00
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->changed_id == 0 && app->flush_seek && app->scrub) {
|
|
|
|
app->changed_id =
|
|
|
|
g_signal_connect (app->seek_scale, "value-changed",
|
|
|
|
G_CALLBACK (seek_cb), app);
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
stop_seek (GtkRange * range, GdkEventButton * event, PlaybackApp * app)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->changed_id) {
|
|
|
|
g_signal_handler_disconnect (app->seek_scale, app->changed_id);
|
|
|
|
app->changed_id = 0;
|
2005-12-12 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->flush_seek || !app->scrub) {
|
2012-03-01 09:45:51 +00:00
|
|
|
gint64 real;
|
|
|
|
|
2006-03-29 13:54:24 +00:00
|
|
|
GST_DEBUG ("do final seek");
|
2012-03-01 09:45:51 +00:00
|
|
|
real =
|
|
|
|
gtk_range_get_value (GTK_RANGE (app->seek_scale)) * app->duration /
|
|
|
|
N_GRAD;
|
|
|
|
do_seek (app, GST_FORMAT_TIME, real);
|
2005-12-12 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->seek_timeout_id != 0) {
|
|
|
|
g_source_remove (app->seek_timeout_id);
|
|
|
|
app->seek_timeout_id = 0;
|
2007-02-26 11:48:49 +00:00
|
|
|
/* Still scrubbing, so the pipeline is playing, see if we need PAUSED
|
|
|
|
* instead. */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PAUSED) {
|
2007-02-26 11:48:49 +00:00
|
|
|
GST_DEBUG ("stop scrub seek, PAUSED");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
2007-02-26 11:48:49 +00:00
|
|
|
}
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
2013-03-15 09:07:55 +00:00
|
|
|
if (app->buffering) {
|
|
|
|
GST_DEBUG ("stop scrub seek, waiting for buffering");
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("stop scrub seek, PLAYING");
|
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PLAYING);
|
|
|
|
}
|
2006-03-22 12:28:36 +00:00
|
|
|
}
|
examples/seeking/seek.c: Updated seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(do_seek), (seek_cb), (stop_seek):
Updated seek example.
* gst/playback/gstdecodebin.c: (remove_element_chain), (unlinked):
* gst/playback/gstplaybasebin.c: (queue_threshold_reached),
(queue_out_of_data), (gen_preroll_element), (new_decoded_pad):
* gst/playback/gstplaybin.c: (add_sink):
* gst/playback/gststreaminfo.c: (gst_stream_info_dispose),
(gst_stream_info_set_mute):
Some refcount leak fixes.
2005-07-18 10:53:03 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
play_cb (GtkButton * button, PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
GstStateChangeReturn ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state != GST_STATE_PLAYING) {
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("PLAY pipeline\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar), app->status_id);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
if (app->pipeline_type == 0) {
|
|
|
|
video_sink_activate_cb (GTK_ENTRY (app->video_sink_entry), app);
|
|
|
|
audio_sink_activate_cb (GTK_ENTRY (app->audio_sink_entry), app);
|
|
|
|
text_sink_activate_cb (GTK_ENTRY (app->text_sink_entry), app);
|
|
|
|
buffer_size_activate_cb (GTK_ENTRY (app->buffer_size_entry), app);
|
|
|
|
buffer_duration_activate_cb (GTK_ENTRY (app->buffer_duration_entry), app);
|
|
|
|
ringbuffer_maxsize_activate_cb (GTK_ENTRY (app->ringbuffer_maxsize_entry),
|
|
|
|
app);
|
|
|
|
connection_speed_activate_cb (GTK_ENTRY (app->connection_speed_entry),
|
|
|
|
app);
|
|
|
|
av_offset_activate_cb (GTK_ENTRY (app->av_offset_entry), app);
|
|
|
|
subtitle_encoding_activate_cb (GTK_ENTRY (app->subtitle_encoding_entry),
|
|
|
|
app);
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
ret = gst_element_set_state (app->pipeline, GST_STATE_PLAYING);
|
2008-04-03 16:10:53 +00:00
|
|
|
switch (ret) {
|
|
|
|
case GST_STATE_CHANGE_FAILURE:
|
|
|
|
goto failed;
|
|
|
|
case GST_STATE_CHANGE_NO_PREROLL:
|
2012-02-24 10:44:53 +00:00
|
|
|
app->is_live = TRUE;
|
2008-04-03 16:10:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
app->state = GST_STATE_PLAYING;
|
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Playing");
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
2009-06-12 11:55:33 +00:00
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
{
|
|
|
|
g_print ("PLAY failed\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Play failed");
|
2002-06-06 20:26:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
pause_cb (GtkButton * button, PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_lock (&app->state_mutex);
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state != GST_STATE_PAUSED) {
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar), app->status_id);
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("PAUSE pipeline\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
ret = gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
2008-04-03 16:10:53 +00:00
|
|
|
switch (ret) {
|
|
|
|
case GST_STATE_CHANGE_FAILURE:
|
|
|
|
goto failed;
|
|
|
|
case GST_STATE_CHANGE_NO_PREROLL:
|
2012-02-24 10:44:53 +00:00
|
|
|
app->is_live = TRUE;
|
2008-04-03 16:10:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->state = GST_STATE_PAUSED;
|
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Paused");
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_unlock (&app->state_mutex);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
{
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_unlock (&app->state_mutex);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
g_print ("PAUSE failed\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Pause failed");
|
2002-06-06 20:26:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
stop_cb (GtkButton * button, PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state != STOP_STATE) {
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
GstStateChangeReturn ret;
|
2012-02-20 15:44:07 +00:00
|
|
|
gint i;
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("READY pipeline\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar), app->status_id);
|
2008-04-03 16:10:53 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_lock (&app->state_mutex);
|
2012-02-24 10:44:53 +00:00
|
|
|
ret = gst_element_set_state (app->pipeline, STOP_STATE);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto failed;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->state = STOP_STATE;
|
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Stopped");
|
|
|
|
gtk_widget_queue_draw (app->video_window);
|
2007-06-21 08:34:46 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->is_live = FALSE;
|
|
|
|
app->buffering = FALSE;
|
|
|
|
set_update_scale (app, FALSE);
|
|
|
|
set_scale (app, 0.0);
|
|
|
|
set_update_fill (app, FALSE);
|
gst/playback/: Add mute property.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(gst_play_bin_set_property), (gst_play_bin_get_property),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_set_mute),
(gst_play_sink_get_mute), (gen_audio_chain):
* gst/playback/gstplaysink.h:
Add mute property.
* gst/playback/gststreamselector.c: (gst_selector_pad_event),
(gst_selector_pad_chain):
* gst/playback/gststreamselector.h:
Make sure we forward the event only once.
* tests/examples/seek/seek.c: (stop_cb), (mute_toggle_cb), (main):
Add and implement the mute button for playbin2.
2008-02-14 18:24:42 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->pipeline_type == 0)
|
|
|
|
clear_streams (app);
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_unlock (&app->state_mutex);
|
2007-12-31 13:17:29 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (app->seek_scale), TRUE);
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (app->navigation_buttons); i++)
|
|
|
|
gtk_widget_set_sensitive (app->navigation_buttons[i].button, FALSE);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
|
|
|
|
failed:
|
|
|
|
{
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_unlock (&app->state_mutex);
|
2007-06-21 08:34:46 +00:00
|
|
|
g_print ("STOP failed\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Stop failed");
|
2002-06-06 20:26:52 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
|
|
|
|
2012-05-23 14:07:20 +00:00
|
|
|
static void
|
|
|
|
snap_before_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
|
|
|
{
|
|
|
|
app->snap_before = gtk_toggle_button_get_active (button);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
snap_after_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
|
|
|
{
|
|
|
|
app->snap_after = gtk_toggle_button_get_active (button);
|
|
|
|
}
|
|
|
|
|
2005-11-13 13:53:26 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
accurate_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2005-11-13 13:53:26 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->accurate_seek = gtk_toggle_button_get_active (button);
|
2005-11-13 13:53:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
key_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2005-11-13 13:53:26 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->keyframe_seek = gtk_toggle_button_get_active (button);
|
2005-11-13 13:53:26 +00:00
|
|
|
}
|
|
|
|
|
2005-11-16 10:54:45 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
loop_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2005-11-16 10:54:45 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->loop_seek = gtk_toggle_button_get_active (button);
|
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
2012-03-01 09:45:51 +00:00
|
|
|
gint64 real;
|
|
|
|
|
|
|
|
real =
|
|
|
|
gtk_range_get_value (GTK_RANGE (app->seek_scale)) * app->duration /
|
|
|
|
N_GRAD;
|
|
|
|
do_seek (app, GST_FORMAT_TIME, real);
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
}
|
2005-11-16 10:54:45 +00:00
|
|
|
}
|
|
|
|
|
2005-12-12 13:03:50 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
flush_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2005-12-12 13:03:50 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->flush_seek = gtk_toggle_button_get_active (button);
|
2005-12-12 13:03:50 +00:00
|
|
|
}
|
|
|
|
|
2006-03-22 12:28:36 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
scrub_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2006-03-22 12:28:36 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->scrub = gtk_toggle_button_get_active (button);
|
2006-03-22 12:28:36 +00:00
|
|
|
}
|
|
|
|
|
2006-08-24 11:18:56 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
play_scrub_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2006-08-24 11:18:56 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
app->play_scrub = gtk_toggle_button_get_active (button);
|
2006-08-24 11:18:56 +00:00
|
|
|
}
|
2006-10-12 19:39:07 +00:00
|
|
|
|
2008-12-11 10:28:43 +00:00
|
|
|
static void
|
2014-12-10 14:54:07 +00:00
|
|
|
skip_toggle_common (gboolean * v, GtkToggleButton * button, PlaybackApp * app)
|
2008-12-11 10:28:43 +00:00
|
|
|
{
|
2014-12-10 14:54:07 +00:00
|
|
|
*v = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
2012-03-01 09:45:51 +00:00
|
|
|
gint64 real;
|
|
|
|
|
|
|
|
real =
|
|
|
|
gtk_range_get_value (GTK_RANGE (app->seek_scale)) * app->duration /
|
|
|
|
N_GRAD;
|
|
|
|
do_seek (app, GST_FORMAT_TIME, real);
|
2008-12-11 10:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-10 14:54:07 +00:00
|
|
|
static void
|
|
|
|
skip_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
|
|
|
{
|
|
|
|
skip_toggle_common (&app->skip_seek, button, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
skip_key_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
|
|
|
{
|
|
|
|
skip_toggle_common (&app->skip_seek_key_only, button, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
skip_audio_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
|
|
|
{
|
|
|
|
skip_toggle_common (&app->skip_seek_no_audio, button, app);
|
|
|
|
}
|
|
|
|
|
2006-10-07 18:35:39 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
rate_spinbutton_changed_cb (GtkSpinButton * button, PlaybackApp * app)
|
2006-10-07 18:35:39 +00:00
|
|
|
{
|
2006-10-10 18:56:01 +00:00
|
|
|
gboolean res = FALSE;
|
|
|
|
GstEvent *s_event;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->rate = gtk_spin_button_get_value (button);
|
2006-10-10 18:56:01 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG ("rate changed to %lf", app->rate);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2006-10-10 18:56:01 +00:00
|
|
|
flags = 0;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->flush_seek)
|
2006-10-10 18:56:01 +00:00
|
|
|
flags |= GST_SEEK_FLAG_FLUSH;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->loop_seek)
|
2006-10-10 18:56:01 +00:00
|
|
|
flags |= GST_SEEK_FLAG_SEGMENT;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->accurate_seek)
|
2008-02-12 19:50:36 +00:00
|
|
|
flags |= GST_SEEK_FLAG_ACCURATE;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->keyframe_seek)
|
2008-02-12 19:50:36 +00:00
|
|
|
flags |= GST_SEEK_FLAG_KEY_UNIT;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->skip_seek)
|
2014-12-10 14:54:07 +00:00
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE;
|
|
|
|
if (app->skip_seek_key_only)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_KEY_UNITS;
|
|
|
|
if (app->skip_seek_no_audio)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_NO_AUDIO;
|
2006-10-10 18:56:01 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->rate >= 0.0) {
|
|
|
|
s_event = gst_event_new_seek (app->rate,
|
|
|
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, app->position,
|
2008-07-24 13:19:26 +00:00
|
|
|
GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE);
|
2006-10-12 19:39:07 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
s_event = gst_event_new_seek (app->rate,
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_SEEK_TYPE_SET, app->position);
|
2006-10-12 19:39:07 +00:00
|
|
|
}
|
2006-10-10 18:56:01 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
res = send_event (app, s_event);
|
2006-10-10 18:56:01 +00:00
|
|
|
|
|
|
|
if (res) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->flush_seek) {
|
|
|
|
gst_element_get_state (GST_ELEMENT (app->pipeline), NULL, NULL,
|
|
|
|
SEEK_TIMEOUT);
|
2006-10-10 18:56:01 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
g_print ("seek failed\n");
|
2006-10-07 18:35:39 +00:00
|
|
|
}
|
2006-10-12 19:39:07 +00:00
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
static void
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (GstElement * pipeline, GstPlayFlags flag, gboolean state)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
|
|
|
gint flags;
|
|
|
|
|
2012-02-22 14:43:25 +00:00
|
|
|
g_print ("%ssetting flag 0x%08x\n", (state ? "" : "un"), flag);
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
g_object_get (pipeline, "flags", &flags, NULL);
|
|
|
|
if (state)
|
2012-02-22 14:43:25 +00:00
|
|
|
flags |= flag;
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
else
|
2012-02-22 14:43:25 +00:00
|
|
|
flags &= ~(flag);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
g_object_set (pipeline, "flags", flags, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
vis_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
2008-02-27 12:19:31 +00:00
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_VIS, state);
|
|
|
|
gtk_widget_set_sensitive (app->vis_combo, state);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
audio_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
2008-03-24 11:46:15 +00:00
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_AUDIO, state);
|
|
|
|
gtk_widget_set_sensitive (app->audio_combo, state);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
video_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
2008-03-24 11:46:15 +00:00
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_VIDEO, state);
|
|
|
|
gtk_widget_set_sensitive (app->video_combo, state);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
text_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
2008-03-24 11:46:15 +00:00
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_TEXT, state);
|
|
|
|
gtk_widget_set_sensitive (app->text_combo, state);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: Add mute property.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(gst_play_bin_set_property), (gst_play_bin_get_property),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_set_mute),
(gst_play_sink_get_mute), (gen_audio_chain):
* gst/playback/gstplaysink.h:
Add mute property.
* gst/playback/gststreamselector.c: (gst_selector_pad_event),
(gst_selector_pad_chain):
* gst/playback/gststreamselector.h:
Make sure we forward the event only once.
* tests/examples/seek/seek.c: (stop_cb), (mute_toggle_cb), (main):
Add and implement the mute button for playbin2.
2008-02-14 18:24:42 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
mute_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
gst/playback/: Add mute property.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(gst_play_bin_set_property), (gst_play_bin_get_property),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_set_mute),
(gst_play_sink_get_mute), (gen_audio_chain):
* gst/playback/gstplaysink.h:
Add mute property.
* gst/playback/gststreamselector.c: (gst_selector_pad_event),
(gst_selector_pad_chain):
* gst/playback/gststreamselector.h:
Make sure we forward the event only once.
* tests/examples/seek/seek.c: (stop_cb), (mute_toggle_cb), (main):
Add and implement the mute button for playbin2.
2008-02-14 18:24:42 +00:00
|
|
|
{
|
|
|
|
gboolean mute;
|
|
|
|
|
|
|
|
mute = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "mute", mute, NULL);
|
gst/playback/: Add mute property.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(gst_play_bin_set_property), (gst_play_bin_get_property),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_set_mute),
(gst_play_sink_get_mute), (gen_audio_chain):
* gst/playback/gstplaysink.h:
Add mute property.
* gst/playback/gststreamselector.c: (gst_selector_pad_event),
(gst_selector_pad_chain):
* gst/playback/gststreamselector.h:
Make sure we forward the event only once.
* tests/examples/seek/seek.c: (stop_cb), (mute_toggle_cb), (main):
Add and implement the mute button for playbin2.
2008-02-14 18:24:42 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 19:25:43 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
download_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2009-07-10 19:25:43 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_DOWNLOAD, state);
|
2012-02-22 14:43:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
buffering_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2012-02-22 14:43:25 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_BUFFERING, state);
|
2012-02-22 14:43:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
soft_volume_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2012-02-22 14:43:25 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_SOFT_VOLUME, state);
|
2012-02-22 14:43:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
native_audio_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2012-02-22 14:43:25 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_NATIVE_AUDIO, state);
|
2012-02-22 14:43:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
native_video_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2012-02-22 14:43:25 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_NATIVE_VIDEO, state);
|
gst/playback/: Add mute property.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(gst_play_bin_set_property), (gst_play_bin_get_property),
(pad_added_cb), (pad_removed_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_set_mute),
(gst_play_sink_get_mute), (gen_audio_chain):
* gst/playback/gstplaysink.h:
Add mute property.
* gst/playback/gststreamselector.c: (gst_selector_pad_event),
(gst_selector_pad_chain):
* gst/playback/gststreamselector.h:
Make sure we forward the event only once.
* tests/examples/seek/seek.c: (stop_cb), (mute_toggle_cb), (main):
Add and implement the mute button for playbin2.
2008-02-14 18:24:42 +00:00
|
|
|
}
|
|
|
|
|
2009-07-10 19:25:43 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
deinterlace_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2009-07-10 19:25:43 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_DEINTERLACE, state);
|
2009-07-10 19:25:43 +00:00
|
|
|
}
|
|
|
|
|
2009-10-23 18:56:11 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
soft_colorbalance_toggle_cb (GtkToggleButton * button, PlaybackApp * app)
|
2009-10-23 18:56:11 +00:00
|
|
|
{
|
|
|
|
gboolean state;
|
|
|
|
|
|
|
|
state = gtk_toggle_button_get_active (button);
|
2012-02-24 10:44:53 +00:00
|
|
|
update_flag (app->pipeline, GST_PLAY_FLAG_SOFT_COLORBALANCE, state);
|
2009-10-23 18:56:11 +00:00
|
|
|
}
|
|
|
|
|
2008-02-08 18:17:51 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
clear_streams (PlaybackApp * app)
|
2008-02-08 18:17:51 +00:00
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
/* remove previous info */
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < app->n_video; i++)
|
|
|
|
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (app->video_combo), 0);
|
|
|
|
for (i = 0; i < app->n_audio; i++)
|
|
|
|
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (app->audio_combo), 0);
|
|
|
|
for (i = 0; i < app->n_text; i++)
|
|
|
|
gtk_combo_box_text_remove (GTK_COMBO_BOX_TEXT (app->text_combo), 0);
|
2008-02-08 18:17:51 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->n_audio = app->n_video = app->n_text = 0;
|
|
|
|
gtk_widget_set_sensitive (app->video_combo, FALSE);
|
|
|
|
gtk_widget_set_sensitive (app->audio_combo, FALSE);
|
|
|
|
gtk_widget_set_sensitive (app->text_combo, FALSE);
|
2008-02-18 11:54:15 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->need_streams = TRUE;
|
2008-02-08 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
update_streams (PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
2008-02-08 18:17:51 +00:00
|
|
|
gint i;
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->pipeline_type == 0 && app->need_streams) {
|
2008-02-08 18:17:51 +00:00
|
|
|
GstTagList *tags;
|
2009-03-24 14:26:57 +00:00
|
|
|
gchar *name, *str;
|
2008-02-08 18:17:51 +00:00
|
|
|
gint active_idx;
|
2008-03-24 11:46:15 +00:00
|
|
|
gboolean state;
|
2008-02-08 18:17:51 +00:00
|
|
|
|
|
|
|
/* remove previous info */
|
2012-02-24 10:44:53 +00:00
|
|
|
clear_streams (app);
|
2008-02-08 18:17:51 +00:00
|
|
|
|
2011-12-19 08:49:07 +00:00
|
|
|
/* here we get and update the different streams detected by playbin */
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_get (app->pipeline, "n-video", &app->n_video, NULL);
|
|
|
|
g_object_get (app->pipeline, "n-audio", &app->n_audio, NULL);
|
|
|
|
g_object_get (app->pipeline, "n-text", &app->n_text, NULL);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print ("video %d, audio %d, text %d\n", app->n_video, app->n_audio,
|
|
|
|
app->n_text);
|
2008-02-08 18:17:51 +00:00
|
|
|
|
|
|
|
active_idx = 0;
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < app->n_video; i++) {
|
|
|
|
g_signal_emit_by_name (app->pipeline, "get-video-tags", i, &tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
if (tags) {
|
2012-05-26 18:56:48 +00:00
|
|
|
str = gst_tag_list_to_string (tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
g_print ("video %d: %s\n", i, str);
|
|
|
|
g_free (str);
|
2015-07-15 01:50:46 +00:00
|
|
|
gst_tag_list_unref (tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
}
|
2008-02-08 18:17:51 +00:00
|
|
|
/* find good name for the label */
|
|
|
|
name = g_strdup_printf ("video %d", i + 1);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->video_combo),
|
|
|
|
name);
|
2008-02-08 18:17:51 +00:00
|
|
|
g_free (name);
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
state =
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app->video_checkbox));
|
|
|
|
gtk_widget_set_sensitive (app->video_combo, state && app->n_video > 0);
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->video_combo), active_idx);
|
2008-02-08 18:17:51 +00:00
|
|
|
|
|
|
|
active_idx = 0;
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < app->n_audio; i++) {
|
|
|
|
g_signal_emit_by_name (app->pipeline, "get-audio-tags", i, &tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
if (tags) {
|
2012-05-26 18:56:48 +00:00
|
|
|
str = gst_tag_list_to_string (tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
g_print ("audio %d: %s\n", i, str);
|
|
|
|
g_free (str);
|
2015-07-15 01:50:46 +00:00
|
|
|
gst_tag_list_unref (tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
}
|
2008-02-08 18:17:51 +00:00
|
|
|
/* find good name for the label */
|
|
|
|
name = g_strdup_printf ("audio %d", i + 1);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->audio_combo),
|
|
|
|
name);
|
2008-02-08 18:17:51 +00:00
|
|
|
g_free (name);
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
state =
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app->audio_checkbox));
|
|
|
|
gtk_widget_set_sensitive (app->audio_combo, state && app->n_audio > 0);
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->audio_combo), active_idx);
|
2008-02-08 18:17:51 +00:00
|
|
|
|
|
|
|
active_idx = 0;
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < app->n_text; i++) {
|
|
|
|
g_signal_emit_by_name (app->pipeline, "get-text-tags", i, &tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
|
2008-03-24 11:46:15 +00:00
|
|
|
name = NULL;
|
|
|
|
if (tags) {
|
|
|
|
const GValue *value;
|
|
|
|
|
2012-05-26 18:56:48 +00:00
|
|
|
str = gst_tag_list_to_string (tags);
|
2009-03-24 14:26:57 +00:00
|
|
|
g_print ("text %d: %s\n", i, str);
|
|
|
|
g_free (str);
|
|
|
|
|
2008-03-24 11:46:15 +00:00
|
|
|
/* get the language code if we can */
|
|
|
|
value = gst_tag_list_get_value_index (tags, GST_TAG_LANGUAGE_CODE, 0);
|
|
|
|
if (value && G_VALUE_HOLDS_STRING (value)) {
|
|
|
|
name = g_strdup_printf ("text %s", g_value_get_string (value));
|
|
|
|
}
|
2015-07-15 01:50:46 +00:00
|
|
|
gst_tag_list_unref (tags);
|
2008-03-24 11:46:15 +00:00
|
|
|
}
|
|
|
|
/* find good name for the label if we didn't use a tag */
|
|
|
|
if (name == NULL)
|
|
|
|
name = g_strdup_printf ("text %d", i + 1);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->text_combo),
|
|
|
|
name);
|
2008-02-08 18:17:51 +00:00
|
|
|
g_free (name);
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
state =
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app->text_checkbox));
|
|
|
|
gtk_widget_set_sensitive (app->text_combo, state && app->n_text > 0);
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->text_combo), active_idx);
|
2008-02-18 11:54:15 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->need_streams = FALSE;
|
2008-02-04 11:51:31 +00:00
|
|
|
}
|
2008-02-08 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
video_combo_cb (GtkComboBox * combo, PlaybackApp * app)
|
2008-02-08 18:17:51 +00:00
|
|
|
{
|
2009-03-20 15:13:06 +00:00
|
|
|
gint active;
|
|
|
|
|
|
|
|
active = gtk_combo_box_get_active (combo);
|
|
|
|
|
|
|
|
g_print ("setting current video track %d\n", active);
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "current-video", active, NULL);
|
2008-02-08 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
audio_combo_cb (GtkComboBox * combo, PlaybackApp * app)
|
2008-02-08 18:17:51 +00:00
|
|
|
{
|
2009-03-20 15:13:06 +00:00
|
|
|
gint active;
|
|
|
|
|
|
|
|
active = gtk_combo_box_get_active (combo);
|
|
|
|
|
|
|
|
g_print ("setting current audio track %d\n", active);
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "current-audio", active, NULL);
|
2008-02-08 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
text_combo_cb (GtkComboBox * combo, PlaybackApp * app)
|
2008-02-08 18:17:51 +00:00
|
|
|
{
|
2009-03-20 15:13:06 +00:00
|
|
|
gint active;
|
|
|
|
|
|
|
|
active = gtk_combo_box_get_active (combo);
|
|
|
|
|
|
|
|
g_print ("setting current text track %d\n", active);
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "current-text", active, NULL);
|
2008-02-08 18:17:51 +00:00
|
|
|
}
|
|
|
|
|
2008-02-27 12:19:31 +00:00
|
|
|
static gboolean
|
2012-02-24 10:44:53 +00:00
|
|
|
filter_vis_features (GstPluginFeature * feature, gpointer data)
|
2008-02-27 12:19:31 +00:00
|
|
|
{
|
|
|
|
GstElementFactory *f;
|
2012-11-17 00:26:45 +00:00
|
|
|
const gchar *klass;
|
2008-02-27 12:19:31 +00:00
|
|
|
|
|
|
|
if (!GST_IS_ELEMENT_FACTORY (feature))
|
|
|
|
return FALSE;
|
|
|
|
f = GST_ELEMENT_FACTORY (feature);
|
2012-11-17 00:26:45 +00:00
|
|
|
klass = gst_element_factory_get_metadata (f, GST_ELEMENT_METADATA_KLASS);
|
|
|
|
if (!g_strrstr (klass, "Visualization"))
|
2008-02-27 12:19:31 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
init_visualization_features (PlaybackApp * app)
|
2008-02-27 12:19:31 +00:00
|
|
|
{
|
|
|
|
GList *list, *walk;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->vis_entries = g_array_new (FALSE, FALSE, sizeof (VisEntry));
|
2008-02-27 12:19:31 +00:00
|
|
|
|
2012-01-02 14:30:53 +00:00
|
|
|
list = gst_registry_feature_filter (gst_registry_get (),
|
2012-02-24 10:44:53 +00:00
|
|
|
filter_vis_features, FALSE, NULL);
|
2008-02-27 12:19:31 +00:00
|
|
|
|
|
|
|
for (walk = list; walk; walk = g_list_next (walk)) {
|
|
|
|
VisEntry entry;
|
|
|
|
const gchar *name;
|
|
|
|
|
|
|
|
entry.factory = GST_ELEMENT_FACTORY (walk->data);
|
2012-11-17 00:26:45 +00:00
|
|
|
name = gst_element_factory_get_metadata (entry.factory,
|
|
|
|
GST_ELEMENT_METADATA_LONGNAME);
|
2008-02-27 12:19:31 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_array_append_val (app->vis_entries, entry);
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->vis_combo), name);
|
2008-02-27 12:19:31 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->vis_combo), 0);
|
2015-07-14 04:00:03 +00:00
|
|
|
gst_plugin_feature_list_free (list);
|
2008-02-27 12:19:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
vis_combo_cb (GtkComboBox * combo, PlaybackApp * app)
|
2008-02-27 12:19:31 +00:00
|
|
|
{
|
|
|
|
guint index;
|
|
|
|
VisEntry *entry;
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
/* get the selected index and get the factory for this index */
|
2012-02-24 10:44:53 +00:00
|
|
|
index = gtk_combo_box_get_active (GTK_COMBO_BOX (app->vis_combo));
|
|
|
|
if (app->vis_entries->len > 0) {
|
|
|
|
entry = &g_array_index (app->vis_entries, VisEntry, index);
|
2008-08-21 11:20:36 +00:00
|
|
|
|
|
|
|
/* create an instance of the element from the factory */
|
|
|
|
element = gst_element_factory_create (entry->factory, NULL);
|
|
|
|
if (!element)
|
|
|
|
return;
|
|
|
|
|
2011-12-19 08:49:07 +00:00
|
|
|
/* set vis plugin for playbin */
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "vis-plugin", element, NULL);
|
2008-08-21 11:20:36 +00:00
|
|
|
}
|
2008-02-27 12:19:31 +00:00
|
|
|
}
|
|
|
|
|
2008-02-08 18:17:51 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
volume_spinbutton_changed_cb (GtkSpinButton * button, PlaybackApp * app)
|
2008-02-08 18:17:51 +00:00
|
|
|
{
|
|
|
|
gdouble volume;
|
|
|
|
|
|
|
|
volume = gtk_spin_button_get_value (button);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_set (app->pipeline, "volume", volume, NULL);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 11:00:41 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
volume_notify_idle_cb (PlaybackApp * app)
|
2009-05-27 14:37:38 +00:00
|
|
|
{
|
|
|
|
gdouble cur_volume, new_volume;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_object_get (app->pipeline, "volume", &new_volume, NULL);
|
|
|
|
cur_volume =
|
|
|
|
gtk_spin_button_get_value (GTK_SPIN_BUTTON (app->volume_spinbutton));
|
2009-05-27 14:37:38 +00:00
|
|
|
if (fabs (cur_volume - new_volume) > 0.001) {
|
2012-02-24 10:44:53 +00:00
|
|
|
g_signal_handlers_block_by_func (app->volume_spinbutton,
|
|
|
|
volume_spinbutton_changed_cb, app);
|
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (app->volume_spinbutton),
|
|
|
|
new_volume);
|
|
|
|
g_signal_handlers_unblock_by_func (app->volume_spinbutton,
|
|
|
|
volume_spinbutton_changed_cb, app);
|
2009-05-27 14:37:38 +00:00
|
|
|
}
|
2012-02-24 11:00:41 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2009-05-27 14:37:38 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
volume_notify_cb (GstElement * pipeline, GParamSpec * arg, PlaybackApp * app)
|
2012-02-24 11:00:41 +00:00
|
|
|
{
|
|
|
|
/* Do this from the main thread */
|
|
|
|
g_idle_add ((GSourceFunc) volume_notify_idle_cb, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
mute_notify_idle_cb (PlaybackApp * app)
|
2012-02-24 11:00:41 +00:00
|
|
|
{
|
|
|
|
gboolean cur_mute, new_mute;
|
|
|
|
|
|
|
|
g_object_get (app->pipeline, "mute", &new_mute, NULL);
|
|
|
|
cur_mute =
|
|
|
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (app->mute_checkbox));
|
|
|
|
if (cur_mute != new_mute) {
|
|
|
|
g_signal_handlers_block_by_func (app->mute_checkbox, mute_toggle_cb, app);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->mute_checkbox),
|
|
|
|
new_mute);
|
|
|
|
g_signal_handlers_unblock_by_func (app->mute_checkbox, mute_toggle_cb, app);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
mute_notify_cb (GstElement * pipeline, GParamSpec * arg, PlaybackApp * app)
|
2012-02-24 11:00:41 +00:00
|
|
|
{
|
|
|
|
/* Do this from the main thread */
|
|
|
|
g_idle_add ((GSourceFunc) mute_notify_idle_cb, app);
|
2009-05-27 14:37:38 +00:00
|
|
|
}
|
|
|
|
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
shot_cb (GtkButton * button, PlaybackApp * app)
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
{
|
2011-12-01 15:48:49 +00:00
|
|
|
GstSample *sample = NULL;
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
GST_DEBUG ("taking snapshot");
|
|
|
|
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
/* convert to our desired format (RGB24) */
|
2011-12-01 15:48:49 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, "RGB",
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
/* Note: we don't ask for a specific width/height here, so that
|
|
|
|
* videoscale can adjust dimensions from a non-1/1 pixel aspect
|
|
|
|
* ratio to a 1/1 pixel-aspect-ratio */
|
2011-12-01 15:48:49 +00:00
|
|
|
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
|
|
|
|
|
|
|
|
/* convert the latest sample to the requested format */
|
2012-03-02 09:00:55 +00:00
|
|
|
g_signal_emit_by_name (app->pipeline, "convert-sample", caps, &sample);
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
2011-12-01 15:48:49 +00:00
|
|
|
if (sample) {
|
|
|
|
GstBuffer *buffer;
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *s;
|
|
|
|
gboolean res;
|
|
|
|
gint width, height;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GError *error = NULL;
|
2012-01-20 15:11:54 +00:00
|
|
|
GstMapInfo map;
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
|
|
|
|
/* get the snapshot buffer format now. We set the caps on the appsink so
|
|
|
|
* that it can only be an rgb buffer. The only thing we have not specified
|
|
|
|
* on the caps is the height, which is dependant on the pixel-aspect-ratio
|
|
|
|
* of the source material */
|
2011-12-01 15:48:49 +00:00
|
|
|
caps = gst_sample_get_caps (sample);
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
if (!caps) {
|
|
|
|
g_warning ("could not get snapshot format\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
/* we need to get the final caps on the buffer to get the size */
|
|
|
|
res = gst_structure_get_int (s, "width", &width);
|
|
|
|
res |= gst_structure_get_int (s, "height", &height);
|
|
|
|
if (!res) {
|
|
|
|
g_warning ("could not get snapshot dimension\n");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create pixmap from buffer and save, gstreamer video buffers have a stride
|
|
|
|
* that is rounded up to the nearest multiple of 4 */
|
2011-12-01 15:48:49 +00:00
|
|
|
buffer = gst_sample_get_buffer (sample);
|
2012-01-20 15:11:54 +00:00
|
|
|
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
|
|
|
pixbuf = gdk_pixbuf_new_from_data (map.data,
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
|
|
|
|
GST_ROUND_UP_4 (width * 3), NULL, NULL);
|
|
|
|
|
|
|
|
/* save the pixbuf */
|
|
|
|
gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
|
2012-01-20 15:11:54 +00:00
|
|
|
gst_buffer_unmap (buffer, &map);
|
2015-08-20 06:59:15 +00:00
|
|
|
g_clear_error (&error);
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
|
|
|
|
done:
|
2011-12-01 15:48:49 +00:00
|
|
|
gst_sample_unref (sample);
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-01 09:31:49 +00:00
|
|
|
/* called when the Step button is pressed */
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
step_cb (GtkButton * button, PlaybackApp * app)
|
2009-06-01 09:31:49 +00:00
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
GstFormat format;
|
|
|
|
guint64 amount;
|
|
|
|
gdouble rate;
|
|
|
|
gboolean flush, res;
|
|
|
|
gint active;
|
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
active = gtk_combo_box_get_active (GTK_COMBO_BOX (app->step_format_combo));
|
2009-06-01 09:31:49 +00:00
|
|
|
amount =
|
|
|
|
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON
|
2012-02-24 10:44:53 +00:00
|
|
|
(app->step_amount_spinbutton));
|
|
|
|
rate =
|
|
|
|
gtk_spin_button_get_value (GTK_SPIN_BUTTON (app->step_rate_spinbutton));
|
2009-06-12 11:55:33 +00:00
|
|
|
flush = TRUE;
|
2009-06-01 09:31:49 +00:00
|
|
|
|
|
|
|
switch (active) {
|
|
|
|
case 0:
|
|
|
|
format = GST_FORMAT_BUFFERS;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
format = GST_FORMAT_TIME;
|
|
|
|
amount *= GST_MSECOND;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
format = GST_FORMAT_UNDEFINED;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
event = gst_event_new_step (format, amount, rate, flush, FALSE);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
res = send_event (app, event);
|
2011-04-13 23:24:26 +00:00
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
g_print ("Sending step event failed\n");
|
|
|
|
}
|
2009-06-01 09:31:49 +00:00
|
|
|
}
|
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
message_received (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
2011-11-07 23:41:33 +00:00
|
|
|
switch (GST_MESSAGE_TYPE (message)) {
|
|
|
|
case GST_MESSAGE_ERROR:
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (app->pipeline),
|
2011-11-07 23:41:33 +00:00
|
|
|
GST_DEBUG_GRAPH_SHOW_ALL, "seek.error");
|
|
|
|
break;
|
|
|
|
case GST_MESSAGE_WARNING:
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (app->pipeline),
|
2011-11-07 23:41:33 +00:00
|
|
|
GST_DEBUG_GRAPH_SHOW_ALL, "seek.warning");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
g_print ("message from \"%s\" (%s): ",
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
|
|
|
|
gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
|
|
|
|
if (s) {
|
|
|
|
gchar *sstr;
|
|
|
|
|
|
|
|
sstr = gst_structure_to_string (s);
|
|
|
|
g_print ("%s\n", sstr);
|
|
|
|
g_free (sstr);
|
|
|
|
} else {
|
|
|
|
g_print ("no message details\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-12 11:55:33 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
do_shuttle (PlaybackApp * app)
|
2009-06-12 11:55:33 +00:00
|
|
|
{
|
|
|
|
guint64 duration;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->shuttling)
|
2009-06-12 11:55:33 +00:00
|
|
|
duration = 40 * GST_MSECOND;
|
|
|
|
else
|
2012-07-18 15:47:27 +00:00
|
|
|
duration = 0;
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_send_event (app->pipeline,
|
|
|
|
gst_event_new_step (GST_FORMAT_TIME, duration, app->shuttle_rate, FALSE,
|
2009-06-12 11:55:33 +00:00
|
|
|
FALSE));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_sync_step_done (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2009-06-12 11:55:33 +00:00
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
guint64 amount;
|
|
|
|
gdouble rate;
|
|
|
|
gboolean flush;
|
|
|
|
gboolean intermediate;
|
|
|
|
guint64 duration;
|
|
|
|
gboolean eos;
|
|
|
|
|
|
|
|
gst_message_parse_step_done (message, &format, &amount, &rate, &flush,
|
|
|
|
&intermediate, &duration, &eos);
|
|
|
|
|
|
|
|
if (eos) {
|
|
|
|
g_print ("stepped till EOS\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
if (g_mutex_trylock (&app->state_mutex)) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->shuttling)
|
|
|
|
do_shuttle (app);
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_unlock (&app->state_mutex);
|
2009-06-12 11:55:33 +00:00
|
|
|
} else {
|
|
|
|
/* ignore step messages that come while we are doing a state change */
|
|
|
|
g_print ("state change is busy\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
shuttle_toggled (GtkToggleButton * button, PlaybackApp * app)
|
2009-06-12 11:55:33 +00:00
|
|
|
{
|
|
|
|
gboolean active;
|
|
|
|
|
|
|
|
active = gtk_toggle_button_get_active (button);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (active != app->shuttling) {
|
|
|
|
app->shuttling = active;
|
|
|
|
g_print ("shuttling %s\n", app->shuttling ? "active" : "inactive");
|
2009-06-12 11:55:33 +00:00
|
|
|
if (active) {
|
2012-02-24 10:44:53 +00:00
|
|
|
app->shuttle_rate = 0.0;
|
|
|
|
app->play_rate = 1.0;
|
|
|
|
pause_cb (NULL, app);
|
|
|
|
gst_element_get_state (app->pipeline, NULL, NULL, -1);
|
2009-06-12 11:55:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
shuttle_rate_switch (PlaybackApp * app)
|
2009-06-12 11:55:33 +00:00
|
|
|
{
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstEvent *s_event;
|
|
|
|
gboolean res;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
2009-06-12 11:55:33 +00:00
|
|
|
/* pause when we need to */
|
2012-02-24 10:44:53 +00:00
|
|
|
pause_cb (NULL, app);
|
|
|
|
gst_element_get_state (app->pipeline, NULL, NULL, -1);
|
2009-06-12 11:55:33 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->play_rate == 1.0)
|
|
|
|
app->play_rate = -1.0;
|
2009-06-12 11:55:33 +00:00
|
|
|
else
|
2012-02-24 10:44:53 +00:00
|
|
|
app->play_rate = 1.0;
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print ("rate changed to %lf %" GST_TIME_FORMAT "\n", app->play_rate,
|
|
|
|
GST_TIME_ARGS (app->position));
|
2009-06-12 11:55:33 +00:00
|
|
|
|
|
|
|
flags = GST_SEEK_FLAG_FLUSH;
|
|
|
|
flags |= GST_SEEK_FLAG_ACCURATE;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->play_rate >= 0.0) {
|
|
|
|
s_event = gst_event_new_seek (app->play_rate,
|
|
|
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, app->position,
|
2009-06-12 11:55:33 +00:00
|
|
|
GST_SEEK_TYPE_SET, GST_CLOCK_TIME_NONE);
|
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
s_event = gst_event_new_seek (app->play_rate,
|
2009-06-12 11:55:33 +00:00
|
|
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_SEEK_TYPE_SET, app->position);
|
2009-06-12 11:55:33 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
res = send_event (app, s_event);
|
2009-06-12 11:55:33 +00:00
|
|
|
if (res) {
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_get_state (app->pipeline, NULL, NULL, SEEK_TIMEOUT);
|
2009-06-12 11:55:33 +00:00
|
|
|
} else {
|
|
|
|
g_print ("seek failed\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
shuttle_value_changed (GtkRange * range, PlaybackApp * app)
|
2009-06-12 11:55:33 +00:00
|
|
|
{
|
|
|
|
gdouble rate;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
rate = gtk_range_get_value (range);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
|
|
|
if (rate == 0.0) {
|
|
|
|
g_print ("rate 0.0, pause\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
pause_cb (NULL, app);
|
|
|
|
gst_element_get_state (app->pipeline, NULL, NULL, -1);
|
2009-06-12 11:55:33 +00:00
|
|
|
} else {
|
|
|
|
g_print ("rate changed %0.3g\n", rate);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if ((rate < 0.0 && app->play_rate > 0.0) || (rate > 0.0
|
|
|
|
&& app->play_rate < 0.0)) {
|
|
|
|
shuttle_rate_switch (app);
|
2009-06-12 11:55:33 +00:00
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->shuttle_rate = ABS (rate);
|
|
|
|
if (app->state != GST_STATE_PLAYING) {
|
|
|
|
do_shuttle (app);
|
|
|
|
play_cb (NULL, app);
|
2009-06-12 11:55:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
colorbalance_value_changed (GtkRange * range, PlaybackApp * app)
|
2012-02-22 13:58:38 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
const gchar *label;
|
2012-02-22 13:58:38 +00:00
|
|
|
gdouble val;
|
|
|
|
gint ival;
|
|
|
|
GstColorBalanceChannel *channel = NULL;
|
|
|
|
const GList *channels, *l;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (range == GTK_RANGE (app->contrast_scale))
|
|
|
|
label = "CONTRAST";
|
|
|
|
else if (range == GTK_RANGE (app->brightness_scale))
|
|
|
|
label = "BRIGHTNESS";
|
|
|
|
else if (range == GTK_RANGE (app->hue_scale))
|
|
|
|
label = "HUE";
|
|
|
|
else if (range == GTK_RANGE (app->saturation_scale))
|
|
|
|
label = "SATURATION";
|
|
|
|
else
|
2012-08-08 09:19:20 +00:00
|
|
|
g_return_if_reached ();
|
2012-02-24 10:44:53 +00:00
|
|
|
|
2012-02-22 13:58:38 +00:00
|
|
|
val = gtk_range_get_value (range);
|
|
|
|
|
2012-02-24 11:03:34 +00:00
|
|
|
g_print ("colorbalance %s value changed %lf\n", label, val / N_GRAD);
|
2012-02-22 13:58:38 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->colorbalance_element) {
|
|
|
|
find_interface_elements (app);
|
|
|
|
if (!app->colorbalance_element)
|
2012-02-22 13:58:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
channels =
|
|
|
|
gst_color_balance_list_channels (GST_COLOR_BALANCE
|
2012-02-24 10:44:53 +00:00
|
|
|
(app->colorbalance_element));
|
2012-02-22 13:58:38 +00:00
|
|
|
for (l = channels; l; l = l->next) {
|
|
|
|
GstColorBalanceChannel *tmp = l->data;
|
|
|
|
|
|
|
|
if (g_strrstr (tmp->label, label)) {
|
|
|
|
channel = tmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!channel)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ival =
|
|
|
|
(gint) (0.5 + channel->min_value +
|
2012-02-24 11:03:34 +00:00
|
|
|
(val / N_GRAD) * ((gdouble) channel->max_value -
|
2012-02-22 13:58:38 +00:00
|
|
|
(gdouble) channel->min_value));
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_color_balance_set_value (GST_COLOR_BALANCE (app->colorbalance_element),
|
2012-02-22 13:58:38 +00:00
|
|
|
channel, ival);
|
|
|
|
}
|
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
seek_format_changed_cb (GtkComboBox * box, PlaybackApp * app)
|
2012-03-01 09:45:51 +00:00
|
|
|
{
|
|
|
|
gchar *format_str;
|
|
|
|
GList *l;
|
|
|
|
const GstFormatDefinition *format = NULL;
|
|
|
|
|
|
|
|
format_str = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (box));
|
|
|
|
|
|
|
|
for (l = app->formats; l; l = l->next) {
|
|
|
|
const GstFormatDefinition *tmp = l->data;
|
|
|
|
|
|
|
|
if (g_strcmp0 (tmp->nick, format_str) == 0) {
|
|
|
|
format = tmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!format)
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
app->seek_format = format;
|
|
|
|
update_scale (app);
|
|
|
|
|
|
|
|
done:
|
|
|
|
g_free (format_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
update_formats (PlaybackApp * app)
|
2012-03-01 09:45:51 +00:00
|
|
|
{
|
|
|
|
GstIterator *it;
|
|
|
|
gboolean done;
|
|
|
|
GList *l;
|
2012-03-02 09:00:55 +00:00
|
|
|
GValue item = { 0, };
|
2012-03-01 09:45:51 +00:00
|
|
|
gchar *selected;
|
|
|
|
gint selected_idx = 0, i;
|
|
|
|
|
|
|
|
selected =
|
|
|
|
gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT
|
|
|
|
(app->seek_format_combo));
|
|
|
|
if (selected == NULL)
|
|
|
|
selected = g_strdup ("time");
|
|
|
|
|
|
|
|
it = gst_format_iterate_definitions ();
|
|
|
|
done = FALSE;
|
|
|
|
|
|
|
|
g_list_free (app->formats);
|
|
|
|
app->formats = NULL;
|
|
|
|
|
|
|
|
while (!done) {
|
|
|
|
switch (gst_iterator_next (it, &item)) {
|
2012-03-02 09:00:55 +00:00
|
|
|
case GST_ITERATOR_OK:{
|
|
|
|
GstFormatDefinition *def = g_value_get_pointer (&item);
|
|
|
|
|
|
|
|
app->formats = g_list_prepend (app->formats, def);
|
|
|
|
g_value_reset (&item);
|
2012-03-01 09:45:51 +00:00
|
|
|
break;
|
2012-03-02 09:00:55 +00:00
|
|
|
}
|
2012-03-01 09:45:51 +00:00
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
g_list_free (app->formats);
|
|
|
|
app->formats = NULL;
|
|
|
|
gst_iterator_resync (it);
|
|
|
|
break;
|
|
|
|
case GST_ITERATOR_ERROR:
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
default:
|
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-03-02 09:00:55 +00:00
|
|
|
g_value_unset (&item);
|
2012-03-01 09:45:51 +00:00
|
|
|
|
|
|
|
app->formats = g_list_reverse (app->formats);
|
|
|
|
gst_iterator_free (it);
|
|
|
|
|
|
|
|
g_signal_handlers_block_by_func (app->seek_format_combo,
|
|
|
|
seek_format_changed_cb, app);
|
|
|
|
gtk_combo_box_text_remove_all (GTK_COMBO_BOX_TEXT (app->seek_format_combo));
|
|
|
|
|
|
|
|
for (i = 0, l = app->formats; l; l = l->next, i++) {
|
|
|
|
const GstFormatDefinition *def = l->data;
|
|
|
|
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->seek_format_combo),
|
|
|
|
def->nick);
|
|
|
|
if (g_strcmp0 (def->nick, selected) == 0)
|
|
|
|
selected_idx = i;
|
|
|
|
}
|
|
|
|
g_signal_handlers_unblock_by_func (app->seek_format_combo,
|
|
|
|
seek_format_changed_cb, app);
|
|
|
|
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->seek_format_combo),
|
|
|
|
selected_idx);
|
|
|
|
|
|
|
|
g_free (selected);
|
|
|
|
}
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_async_done (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG ("async done");
|
2012-03-01 09:45:51 +00:00
|
|
|
|
|
|
|
/* Now query all available GstFormats */
|
|
|
|
update_formats (app);
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
/* when we get ASYNC_DONE we can query position, duration and other
|
|
|
|
* properties */
|
2012-02-24 10:44:53 +00:00
|
|
|
update_scale (app);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
|
|
|
|
/* update the available streams */
|
2012-02-24 10:44:53 +00:00
|
|
|
update_streams (app);
|
2012-02-20 15:44:07 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
find_interface_elements (app);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
2006-10-12 19:39:07 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_state_changed (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2006-10-12 19:39:07 +00:00
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
|
|
|
|
/* We only care about state changed on the pipeline */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (s && GST_MESSAGE_SRC (message) == GST_OBJECT_CAST (app->pipeline)) {
|
2006-10-12 19:39:07 +00:00
|
|
|
GstState old, new, pending;
|
|
|
|
|
|
|
|
gst_message_parse_state_changed (message, &old, &new, &pending);
|
|
|
|
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
/* When state of the pipeline changes to paused or playing we start updating scale */
|
2006-10-12 19:39:07 +00:00
|
|
|
if (new == GST_STATE_PLAYING) {
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_scale (app, TRUE);
|
2006-10-12 19:39:07 +00:00
|
|
|
} else {
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_scale (app, FALSE);
|
2006-10-12 19:39:07 +00:00
|
|
|
}
|
2011-11-07 23:41:33 +00:00
|
|
|
|
|
|
|
/* dump graph for (some) pipeline state changes */
|
|
|
|
{
|
|
|
|
gchar *dump_name;
|
|
|
|
|
|
|
|
dump_name = g_strdup_printf ("seek.%s_%s",
|
|
|
|
gst_element_state_get_name (old), gst_element_state_get_name (new));
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (app->pipeline),
|
2011-11-07 23:41:33 +00:00
|
|
|
GST_DEBUG_GRAPH_SHOW_ALL, dump_name);
|
|
|
|
|
|
|
|
g_free (dump_name);
|
|
|
|
}
|
2006-10-12 19:39:07 +00:00
|
|
|
}
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_segment_done (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
{
|
|
|
|
GstEvent *s_event;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
gboolean res;
|
|
|
|
GstFormat format;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_DEBUG ("position is %" GST_TIME_FORMAT, GST_TIME_ARGS (app->position));
|
|
|
|
gst_message_parse_segment_done (message, &format, &app->position);
|
|
|
|
GST_DEBUG ("end of segment at %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (app->position));
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
2007-12-14 19:06:24 +00:00
|
|
|
flags = 0;
|
|
|
|
/* in the segment-done callback we never flush as this would not make sense
|
|
|
|
* for seamless playback. */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->loop_seek)
|
2008-12-11 10:28:43 +00:00
|
|
|
flags |= GST_SEEK_FLAG_SEGMENT;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->skip_seek)
|
2014-12-10 14:54:07 +00:00
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE;
|
|
|
|
if (app->skip_seek_key_only)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_KEY_UNITS;
|
|
|
|
if (app->skip_seek_no_audio)
|
|
|
|
flags |= GST_SEEK_FLAG_TRICKMODE_NO_AUDIO;
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
s_event = gst_event_new_seek (app->rate,
|
2007-02-27 18:45:37 +00:00
|
|
|
GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, G_GINT64_CONSTANT (0),
|
2012-02-24 10:44:53 +00:00
|
|
|
GST_SEEK_TYPE_SET, app->duration);
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("restart loop with rate %lf to 0 / %" GST_TIME_FORMAT,
|
2012-02-24 10:44:53 +00:00
|
|
|
app->rate, GST_TIME_ARGS (app->duration));
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
res = send_event (app, s_event);
|
2007-12-14 19:06:24 +00:00
|
|
|
if (!res)
|
tests/examples/seek/seek.c: Allow to toggle looping while it plays. Fix callback prototype. Clean up code a bit more....
Original commit message from CVS:
* tests/examples/seek/seek.c: (set_scale), (update_scale),
(do_seek), (stop_seek), (pause_cb), (stop_cb), (loop_toggle_cb),
(rate_spinbutton_changed_cb), (msg_eos), (msg_segment_done),
(main):
Allow to toggle looping while it plays. Fix callback prototype. Clean
up code a bit more. Add copyright header.
2007-01-16 12:17:06 +00:00
|
|
|
g_print ("segment seek failed\n");
|
|
|
|
}
|
|
|
|
|
2008-04-11 01:25:01 +00:00
|
|
|
/* in stream buffering mode we PAUSE the pipeline until we receive a 100%
|
|
|
|
* message */
|
2008-04-03 16:10:53 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
do_stream_buffering (PlaybackApp * app, gint percent)
|
2008-04-03 16:10:53 +00:00
|
|
|
{
|
|
|
|
gchar *bufstr;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar), app->status_id);
|
2008-04-03 16:10:53 +00:00
|
|
|
bufstr = g_strdup_printf ("Buffering...%d", percent);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id, bufstr);
|
2008-04-03 16:10:53 +00:00
|
|
|
g_free (bufstr);
|
|
|
|
|
|
|
|
if (percent == 100) {
|
|
|
|
/* a 100% message means buffering is done */
|
2012-02-24 10:44:53 +00:00
|
|
|
app->buffering = FALSE;
|
2008-04-03 16:10:53 +00:00
|
|
|
/* if the desired state is playing, go back */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
2008-04-11 01:25:01 +00:00
|
|
|
/* no state management needed for live pipelines */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->is_live) {
|
2008-04-11 01:25:01 +00:00
|
|
|
fprintf (stderr, "Done buffering, setting pipeline to PLAYING ...\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PLAYING);
|
2008-04-11 01:25:01 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_pop (GTK_STATUSBAR (app->statusbar), app->status_id);
|
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Playing");
|
2008-04-03 16:10:53 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* buffering busy */
|
2014-11-28 13:28:06 +00:00
|
|
|
if (!app->buffering && app->state == GST_STATE_PLAYING) {
|
2008-04-03 16:10:53 +00:00
|
|
|
/* we were not buffering but PLAYING, PAUSE the pipeline. */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->is_live) {
|
2008-04-11 01:25:01 +00:00
|
|
|
fprintf (stderr, "Buffering, setting pipeline to PAUSED ...\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
2008-04-11 01:25:01 +00:00
|
|
|
}
|
2008-04-03 16:10:53 +00:00
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
app->buffering = TRUE;
|
2008-04-03 16:10:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-11 01:25:01 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
do_download_buffering (PlaybackApp * app, gint percent)
|
2008-04-11 01:25:01 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->buffering && percent < 100) {
|
2008-04-11 01:25:01 +00:00
|
|
|
gchar *bufstr;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->buffering = TRUE;
|
2008-04-11 01:25:01 +00:00
|
|
|
|
|
|
|
bufstr = g_strdup_printf ("Downloading...");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id, bufstr);
|
2008-04-11 01:25:01 +00:00
|
|
|
g_free (bufstr);
|
|
|
|
|
|
|
|
/* once we get a buffering message, we'll do the fill update */
|
2012-02-24 10:44:53 +00:00
|
|
|
set_update_fill (app, TRUE);
|
2008-04-11 01:25:01 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING && !app->is_live) {
|
2008-04-11 01:25:01 +00:00
|
|
|
fprintf (stderr, "Downloading, setting pipeline to PAUSED ...\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
2009-07-10 20:29:51 +00:00
|
|
|
/* user has to manually start the playback */
|
2012-02-24 10:44:53 +00:00
|
|
|
app->state = GST_STATE_PAUSED;
|
2008-04-11 01:25:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_buffering (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2008-04-11 01:25:01 +00:00
|
|
|
{
|
|
|
|
gint percent;
|
|
|
|
|
|
|
|
gst_message_parse_buffering (message, &percent);
|
|
|
|
|
|
|
|
/* get more stats */
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_message_parse_buffering_stats (message, &app->mode, NULL, NULL,
|
|
|
|
&app->buffering_left);
|
2008-04-11 01:25:01 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
switch (app->mode) {
|
2008-04-11 01:25:01 +00:00
|
|
|
case GST_BUFFERING_DOWNLOAD:
|
2012-02-24 10:44:53 +00:00
|
|
|
do_download_buffering (app, percent);
|
2008-04-11 01:25:01 +00:00
|
|
|
break;
|
|
|
|
case GST_BUFFERING_LIVE:
|
2012-02-24 10:44:53 +00:00
|
|
|
app->is_live = TRUE;
|
2008-04-11 01:25:01 +00:00
|
|
|
case GST_BUFFERING_TIMESHIFT:
|
|
|
|
case GST_BUFFERING_STREAM:
|
2012-02-24 10:44:53 +00:00
|
|
|
do_stream_buffering (app, percent);
|
2008-04-11 01:25:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-04-10 12:12:53 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_clock_lost (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2009-04-10 12:12:53 +00:00
|
|
|
{
|
|
|
|
g_print ("clock lost! PAUSE and PLAY to select a new clock\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state == GST_STATE_PLAYING) {
|
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PAUSED);
|
|
|
|
gst_element_set_state (app->pipeline, GST_STATE_PLAYING);
|
2010-08-04 11:44:22 +00:00
|
|
|
}
|
2009-04-10 12:12:53 +00:00
|
|
|
}
|
|
|
|
|
2012-02-22 13:58:38 +00:00
|
|
|
static gboolean
|
|
|
|
is_valid_color_balance_element (GstElement * element)
|
|
|
|
{
|
|
|
|
GstColorBalance *bal = GST_COLOR_BALANCE (element);
|
|
|
|
gboolean have_brightness = FALSE;
|
|
|
|
gboolean have_contrast = FALSE;
|
|
|
|
gboolean have_hue = FALSE;
|
|
|
|
gboolean have_saturation = FALSE;
|
|
|
|
const GList *channels, *l;
|
|
|
|
|
|
|
|
channels = gst_color_balance_list_channels (bal);
|
|
|
|
for (l = channels; l; l = l->next) {
|
|
|
|
GstColorBalanceChannel *ch = l->data;
|
|
|
|
|
|
|
|
if (g_strrstr (ch->label, "BRIGHTNESS"))
|
|
|
|
have_brightness = TRUE;
|
|
|
|
else if (g_strrstr (ch->label, "CONTRAST"))
|
|
|
|
have_contrast = TRUE;
|
|
|
|
else if (g_strrstr (ch->label, "HUE"))
|
|
|
|
have_hue = TRUE;
|
|
|
|
else if (g_strrstr (ch->label, "SATURATION"))
|
|
|
|
have_saturation = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return have_brightness && have_contrast && have_hue && have_saturation;
|
|
|
|
}
|
2008-06-27 07:55:40 +00:00
|
|
|
|
2012-02-20 13:57:36 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
find_interface_elements (PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
2012-02-22 13:58:38 +00:00
|
|
|
GstIterator *it;
|
2012-03-02 09:00:55 +00:00
|
|
|
GValue item = { 0, };
|
2012-02-22 13:58:38 +00:00
|
|
|
gboolean done = FALSE, hardware = FALSE;
|
2012-02-20 13:57:36 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->pipeline_type == 0)
|
2012-02-20 13:57:36 +00:00
|
|
|
return;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_object_unref (app->navigation_element);
|
|
|
|
app->navigation_element = NULL;
|
2012-02-20 13:57:36 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->colorbalance_element)
|
|
|
|
gst_object_unref (app->colorbalance_element);
|
|
|
|
app->colorbalance_element = NULL;
|
2012-02-22 13:58:38 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_element =
|
|
|
|
gst_bin_get_by_interface (GST_BIN (app->pipeline), GST_TYPE_NAVIGATION);
|
2012-02-22 13:58:38 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
it = gst_bin_iterate_all_by_interface (GST_BIN (app->pipeline),
|
2012-02-22 13:58:38 +00:00
|
|
|
GST_TYPE_COLOR_BALANCE);
|
|
|
|
while (!done) {
|
|
|
|
switch (gst_iterator_next (it, &item)) {
|
|
|
|
case GST_ITERATOR_OK:{
|
2012-03-02 09:00:55 +00:00
|
|
|
GstElement *element = GST_ELEMENT (g_value_get_object (&item));
|
2012-02-22 13:58:38 +00:00
|
|
|
|
|
|
|
if (is_valid_color_balance_element (element)) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->colorbalance_element) {
|
|
|
|
app->colorbalance_element =
|
|
|
|
GST_ELEMENT_CAST (gst_object_ref (element));
|
2012-02-22 13:58:38 +00:00
|
|
|
hardware =
|
|
|
|
(gst_color_balance_get_balance_type (GST_COLOR_BALANCE
|
|
|
|
(element)) == GST_COLOR_BALANCE_HARDWARE);
|
|
|
|
} else if (!hardware) {
|
|
|
|
gboolean tmp =
|
|
|
|
(gst_color_balance_get_balance_type (GST_COLOR_BALANCE
|
|
|
|
(element)) == GST_COLOR_BALANCE_HARDWARE);
|
|
|
|
|
|
|
|
if (tmp) {
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->colorbalance_element)
|
|
|
|
gst_object_unref (app->colorbalance_element);
|
|
|
|
app->colorbalance_element =
|
2012-02-22 13:58:38 +00:00
|
|
|
GST_ELEMENT_CAST (gst_object_ref (element));
|
|
|
|
hardware = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-20 13:57:36 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
g_value_reset (&item);
|
2012-02-22 13:58:38 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (hardware && app->colorbalance_element)
|
2012-02-22 13:58:38 +00:00
|
|
|
done = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_ITERATOR_RESYNC:
|
|
|
|
gst_iterator_resync (it);
|
|
|
|
done = FALSE;
|
|
|
|
hardware = FALSE;
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->colorbalance_element)
|
|
|
|
gst_object_unref (app->colorbalance_element);
|
|
|
|
app->colorbalance_element = NULL;
|
2012-02-22 13:58:38 +00:00
|
|
|
break;
|
|
|
|
case GST_ITERATOR_DONE:
|
|
|
|
case GST_ITERATOR_ERROR:
|
|
|
|
default:
|
|
|
|
done = TRUE;
|
|
|
|
}
|
2012-02-20 13:57:36 +00:00
|
|
|
}
|
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
g_value_unset (&item);
|
2012-02-22 13:58:38 +00:00
|
|
|
gst_iterator_free (it);
|
2012-02-20 13:57:36 +00:00
|
|
|
}
|
|
|
|
|
2012-02-20 15:44:07 +00:00
|
|
|
/* called when Navigation command button is pressed */
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
navigation_cmd_cb (GtkButton * button, PlaybackApp * app)
|
2012-02-20 15:44:07 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
GstNavigationCommand cmd = GST_NAVIGATION_COMMAND_INVALID;
|
|
|
|
gint i;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->navigation_element) {
|
|
|
|
find_interface_elements (app);
|
|
|
|
if (!app->navigation_element)
|
2012-02-20 15:44:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (app->navigation_buttons); i++) {
|
|
|
|
if (app->navigation_buttons[i].button == GTK_WIDGET (button)) {
|
|
|
|
cmd = app->navigation_buttons[i].cmd;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd != GST_NAVIGATION_COMMAND_INVALID)
|
|
|
|
gst_navigation_send_command (GST_NAVIGATION (app->navigation_element), cmd);
|
2012-02-20 15:44:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
|
2009-12-29 00:40:27 +00:00
|
|
|
/* We set the xid here in response to the prepare-xwindow-id message via a
|
|
|
|
* bus sync handler because we don't know the actual videosink used from the
|
|
|
|
* start (as we don't know the pipeline, or bin elements such as autovideosink
|
|
|
|
* or gconfvideosink may be used which create the actual videosink only once
|
|
|
|
* the pipeline is started) */
|
2008-06-24 16:05:06 +00:00
|
|
|
static GstBusSyncReply
|
2012-03-02 11:01:37 +00:00
|
|
|
bus_sync_handler (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2008-06-24 16:05:06 +00:00
|
|
|
{
|
2012-03-02 09:00:55 +00:00
|
|
|
if (gst_is_video_overlay_prepare_window_handle_message (message)) {
|
2008-06-24 16:05:06 +00:00
|
|
|
GstElement *element = GST_ELEMENT (GST_MESSAGE_SRC (message));
|
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
if (app->overlay_element)
|
|
|
|
gst_object_unref (app->overlay_element);
|
|
|
|
app->overlay_element = GST_ELEMENT (gst_object_ref (element));
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2012-02-20 19:39:59 +00:00
|
|
|
g_print ("got prepare-xwindow-id, setting XID %" G_GUINTPTR_FORMAT "\n",
|
2012-02-24 10:44:53 +00:00
|
|
|
app->embed_xid);
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2009-12-29 00:40:27 +00:00
|
|
|
/* Should have been initialised from main thread before (can't use
|
|
|
|
* GDK_WINDOW_XID here with Gtk+ >= 2.18, because the sync handler will
|
|
|
|
* be called from a streaming thread and GDK_WINDOW_XID maps to more than
|
|
|
|
* a simple structure lookup with Gtk+ >= 2.18, where 'more' is stuff that
|
|
|
|
* shouldn't be done from a non-GUI thread without explicit locking). */
|
2012-02-24 10:44:53 +00:00
|
|
|
g_assert (app->embed_xid != 0);
|
2012-02-21 09:01:30 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (element),
|
|
|
|
app->embed_xid);
|
2011-08-08 13:41:17 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
find_interface_elements (app);
|
2008-06-24 16:05:06 +00:00
|
|
|
}
|
|
|
|
return GST_BUS_PASS;
|
|
|
|
}
|
2008-06-27 07:42:07 +00:00
|
|
|
#endif
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2009-05-19 13:02:44 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
draw_cb (GtkWidget * widget, cairo_t * cr, PlaybackApp * app)
|
2009-05-19 13:02:44 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->state < GST_STATE_PAUSED) {
|
2011-11-12 15:51:52 +00:00
|
|
|
int width, height;
|
2010-03-14 22:14:19 +00:00
|
|
|
|
2011-11-12 15:51:52 +00:00
|
|
|
width = gtk_widget_get_allocated_width (widget);
|
|
|
|
height = gtk_widget_get_allocated_height (widget);
|
2010-07-24 09:48:33 +00:00
|
|
|
cairo_set_source_rgb (cr, 0, 0, 0);
|
2011-11-12 15:51:52 +00:00
|
|
|
cairo_rectangle (cr, 0, 0, width, height);
|
2010-07-24 09:48:33 +00:00
|
|
|
cairo_fill (cr);
|
2011-11-12 15:51:52 +00:00
|
|
|
return TRUE;
|
2009-05-19 13:02:44 +00:00
|
|
|
}
|
2012-02-20 13:09:28 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
if (app->overlay_element)
|
|
|
|
gst_video_overlay_expose (GST_VIDEO_OVERLAY (app->overlay_element));
|
2012-02-20 13:09:28 +00:00
|
|
|
|
2009-05-19 13:02:44 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-12-29 00:40:27 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
realize_cb (GtkWidget * widget, PlaybackApp * app)
|
2009-12-29 00:40:27 +00:00
|
|
|
{
|
2011-11-12 15:51:52 +00:00
|
|
|
GdkWindow *window = gtk_widget_get_window (widget);
|
2010-03-14 22:14:19 +00:00
|
|
|
|
2011-11-12 15:51:52 +00:00
|
|
|
/* This is here just for pedagogical purposes, GDK_WINDOW_XID will call it
|
|
|
|
* as well */
|
|
|
|
if (!gdk_window_ensure_native (window))
|
2012-12-10 13:35:37 +00:00
|
|
|
g_error ("Couldn't create native window needed for GstVideoOverlay!");
|
2010-03-14 22:14:19 +00:00
|
|
|
|
2011-05-25 17:50:34 +00:00
|
|
|
#if defined (GDK_WINDOWING_WIN32)
|
2014-05-04 15:57:35 +00:00
|
|
|
app->embed_xid = (guintptr) GDK_WINDOW_HWND (window);
|
2014-05-06 06:50:16 +00:00
|
|
|
g_print ("Window realize: video window HWND = %" G_GUINTPTR_FORMAT "\n",
|
|
|
|
app->embed_xid);
|
2012-02-20 13:35:37 +00:00
|
|
|
#elif defined (GDK_WINDOWING_QUARTZ)
|
2012-05-21 11:14:32 +00:00
|
|
|
app->embed_xid = (guintptr) gdk_quartz_window_get_nsview (window);
|
2016-07-06 14:14:32 +00:00
|
|
|
g_print ("Window realize: video window NSView = %" G_GUINTPTR_FORMAT "\n",
|
|
|
|
app->embed_xid);
|
2012-02-20 13:35:37 +00:00
|
|
|
#elif defined (GDK_WINDOWING_X11)
|
2012-02-24 10:44:53 +00:00
|
|
|
app->embed_xid = GDK_WINDOW_XID (window);
|
2012-02-20 19:39:59 +00:00
|
|
|
g_print ("Window realize: video window XID = %" G_GUINTPTR_FORMAT "\n",
|
2012-02-24 10:44:53 +00:00
|
|
|
app->embed_xid);
|
2009-12-29 00:40:27 +00:00
|
|
|
#endif
|
|
|
|
}
|
2009-05-19 13:02:44 +00:00
|
|
|
|
2012-02-20 13:57:36 +00:00
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
button_press_cb (GtkWidget * widget, GdkEventButton * event, PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
|
|
|
gtk_widget_grab_focus (widget);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (app->navigation_element),
|
2012-02-20 13:57:36 +00:00
|
|
|
"mouse-button-press", event->button, event->x, event->y);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
button_release_cb (GtkWidget * widget, GdkEventButton * event,
|
|
|
|
PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (app->navigation_element),
|
2012-02-20 13:57:36 +00:00
|
|
|
"mouse-button-release", event->button, event->x, event->y);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
key_press_cb (GtkWidget * widget, GdkEventKey * event, PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (app->navigation_element),
|
2012-02-20 13:57:36 +00:00
|
|
|
"key-press", gdk_keyval_name (event->keyval));
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
key_release_cb (GtkWidget * widget, GdkEventKey * event, PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_navigation_send_key_event (GST_NAVIGATION (app->navigation_element),
|
2012-02-20 13:57:36 +00:00
|
|
|
"key-release", gdk_keyval_name (event->keyval));
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2012-03-02 11:01:37 +00:00
|
|
|
motion_notify_cb (GtkWidget * widget, GdkEventMotion * event, PlaybackApp * app)
|
2012-02-20 13:57:36 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_navigation_send_mouse_event (GST_NAVIGATION (app->navigation_element),
|
2012-02-20 13:57:36 +00:00
|
|
|
"mouse-move", 0, event->x, event->y);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-06-24 16:05:06 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_eos (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2008-06-24 16:05:06 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
message_received (bus, message, app);
|
2008-06-24 16:05:06 +00:00
|
|
|
|
|
|
|
/* Set new uri for playerbins and continue playback */
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->current_path && app->pipeline_type == 0) {
|
|
|
|
stop_cb (NULL, app);
|
|
|
|
app->current_path = g_list_next (app->current_path);
|
2012-03-01 12:24:45 +00:00
|
|
|
app->current_sub_path = g_list_next (app->current_sub_path);
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->current_path) {
|
2012-03-01 12:24:45 +00:00
|
|
|
playbin_set_uri (app->pipeline, app->current_path->data,
|
|
|
|
app->current_sub_path ? app->current_sub_path->data : NULL);
|
2012-02-24 10:44:53 +00:00
|
|
|
play_cb (NULL, app);
|
2008-06-24 16:05:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-01 09:31:49 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg_step_done (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2009-06-01 09:31:49 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
if (!app->shuttling)
|
|
|
|
message_received (bus, message, app);
|
2009-06-01 09:31:49 +00:00
|
|
|
}
|
|
|
|
|
2012-02-20 14:29:49 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
msg (GstBus * bus, GstMessage * message, PlaybackApp * app)
|
2012-02-20 14:29:49 +00:00
|
|
|
{
|
|
|
|
GstNavigationMessageType nav_type;
|
|
|
|
|
|
|
|
nav_type = gst_navigation_message_get_type (message);
|
|
|
|
switch (nav_type) {
|
|
|
|
case GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED:{
|
|
|
|
GstQuery *query;
|
2012-02-20 15:44:07 +00:00
|
|
|
gboolean res, j;
|
2012-02-20 14:29:49 +00:00
|
|
|
|
|
|
|
/* Heuristic to detect if we're dealing with a DVD menu */
|
|
|
|
query = gst_navigation_query_new_commands ();
|
|
|
|
res = gst_element_query (GST_ELEMENT (GST_MESSAGE_SRC (message)), query);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
for (j = 0; j < G_N_ELEMENTS (app->navigation_buttons); j++)
|
|
|
|
gtk_widget_set_sensitive (app->navigation_buttons[j].button, FALSE);
|
2012-02-20 15:44:07 +00:00
|
|
|
|
2012-02-20 14:29:49 +00:00
|
|
|
if (res) {
|
|
|
|
gboolean is_menu = FALSE;
|
|
|
|
guint i, n;
|
|
|
|
|
|
|
|
if (gst_navigation_query_parse_commands_length (query, &n)) {
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
GstNavigationCommand cmd;
|
|
|
|
|
|
|
|
if (!gst_navigation_query_parse_commands_nth (query, i, &cmd))
|
|
|
|
break;
|
|
|
|
|
|
|
|
is_menu |= (cmd == GST_NAVIGATION_COMMAND_ACTIVATE);
|
|
|
|
is_menu |= (cmd == GST_NAVIGATION_COMMAND_LEFT);
|
|
|
|
is_menu |= (cmd == GST_NAVIGATION_COMMAND_RIGHT);
|
|
|
|
is_menu |= (cmd == GST_NAVIGATION_COMMAND_UP);
|
|
|
|
is_menu |= (cmd == GST_NAVIGATION_COMMAND_DOWN);
|
2012-02-20 15:44:07 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
for (j = 0; j < G_N_ELEMENTS (app->navigation_buttons); j++) {
|
|
|
|
if (app->navigation_buttons[j].cmd != cmd)
|
2012-02-20 15:44:07 +00:00
|
|
|
continue;
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_set_sensitive (app->navigation_buttons[j].button,
|
|
|
|
TRUE);
|
2012-02-20 15:44:07 +00:00
|
|
|
}
|
2012-02-20 14:29:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_set_sensitive (GTK_WIDGET (app->seek_scale), !is_menu);
|
2012-02-20 14:29:49 +00:00
|
|
|
} else {
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_query_unref (query);
|
2012-02-24 10:44:53 +00:00
|
|
|
message_received (bus, message, app);
|
2012-02-20 14:29:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-08 14:34:41 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
connect_bus_signals (PlaybackApp * app)
|
2008-02-08 14:34:41 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (app->pipeline));
|
2008-02-08 14:34:41 +00:00
|
|
|
|
2012-02-20 13:35:37 +00:00
|
|
|
#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->pipeline_type != 0) {
|
2012-03-02 09:00:55 +00:00
|
|
|
/* handle prepare-xwindow-id element message synchronously, but only for non-playbin */
|
2012-06-20 10:30:36 +00:00
|
|
|
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, app,
|
|
|
|
NULL);
|
2012-02-23 10:43:09 +00:00
|
|
|
}
|
2008-06-27 07:42:07 +00:00
|
|
|
#endif
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2008-02-08 14:34:41 +00:00
|
|
|
gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
|
2009-06-12 11:55:33 +00:00
|
|
|
gst_bus_enable_sync_message_emission (bus);
|
2008-02-08 14:34:41 +00:00
|
|
|
|
|
|
|
g_signal_connect (bus, "message::state-changed",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (msg_state_changed), app);
|
|
|
|
g_signal_connect (bus, "message::segment-done", G_CALLBACK (msg_segment_done),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::async-done", G_CALLBACK (msg_async_done),
|
|
|
|
app);
|
|
|
|
|
|
|
|
g_signal_connect (bus, "message::new-clock", G_CALLBACK (message_received),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::clock-lost", G_CALLBACK (msg_clock_lost),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::error", G_CALLBACK (message_received), app);
|
|
|
|
g_signal_connect (bus, "message::warning", G_CALLBACK (message_received),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::eos", G_CALLBACK (msg_eos), app);
|
|
|
|
g_signal_connect (bus, "message::tag", G_CALLBACK (message_received), app);
|
|
|
|
g_signal_connect (bus, "message::element", G_CALLBACK (message_received),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::segment-done", G_CALLBACK (message_received),
|
|
|
|
app);
|
|
|
|
g_signal_connect (bus, "message::buffering", G_CALLBACK (msg_buffering), app);
|
|
|
|
// g_signal_connect (bus, "message::step-done", G_CALLBACK (msg_step_done),
|
|
|
|
// app);
|
|
|
|
g_signal_connect (bus, "message::step-start", G_CALLBACK (msg_step_done),
|
|
|
|
app);
|
2009-06-12 11:55:33 +00:00
|
|
|
g_signal_connect (bus, "sync-message::step-done",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (msg_sync_step_done), app);
|
|
|
|
g_signal_connect (bus, "message", G_CALLBACK (msg), app);
|
2008-02-08 14:34:41 +00:00
|
|
|
|
|
|
|
gst_object_unref (bus);
|
|
|
|
}
|
|
|
|
|
2008-06-24 16:05:06 +00:00
|
|
|
/* Return GList of paths described in location string */
|
|
|
|
static GList *
|
|
|
|
handle_wildcards (const gchar * location)
|
|
|
|
{
|
|
|
|
GList *res = NULL;
|
|
|
|
gchar *path = g_path_get_dirname (location);
|
|
|
|
gchar *pattern = g_path_get_basename (location);
|
|
|
|
GPatternSpec *pspec = g_pattern_spec_new (pattern);
|
|
|
|
GDir *dir = g_dir_open (path, 0, NULL);
|
|
|
|
const gchar *name;
|
|
|
|
|
|
|
|
g_print ("matching %s from %s\n", pattern, path);
|
|
|
|
|
|
|
|
if (!dir) {
|
|
|
|
g_print ("opening directory %s failed\n", path);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((name = g_dir_read_name (dir)) != NULL) {
|
|
|
|
if (g_pattern_match_string (pspec, name)) {
|
|
|
|
res = g_list_append (res, g_strjoin ("/", path, name, NULL));
|
|
|
|
g_print (" found clip %s\n", name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_dir_close (dir);
|
|
|
|
out:
|
|
|
|
g_pattern_spec_free (pspec);
|
|
|
|
g_free (pattern);
|
|
|
|
g_free (path);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
delete_event_cb (GtkWidget * widget, GdkEvent * event, PlaybackApp * app)
|
2008-06-24 16:05:06 +00:00
|
|
|
{
|
2012-02-24 10:44:53 +00:00
|
|
|
stop_cb (NULL, app);
|
2008-06-24 16:05:06 +00:00
|
|
|
gtk_main_quit ();
|
|
|
|
}
|
|
|
|
|
2003-02-02 19:25:58 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
video_sink_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2003-02-02 19:25:58 +00:00
|
|
|
{
|
2012-03-01 11:52:21 +00:00
|
|
|
GstElement *sink = NULL;
|
|
|
|
const gchar *text;
|
2003-02-02 19:25:58 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
sink = gst_element_factory_make_or_warn (text, NULL);
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
2012-03-01 11:52:21 +00:00
|
|
|
|
|
|
|
g_object_set (app->pipeline, "video-sink", sink, NULL);
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
audio_sink_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2012-03-01 11:52:21 +00:00
|
|
|
GstElement *sink = NULL;
|
|
|
|
const gchar *text;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
sink = gst_element_factory_make_or_warn (text, NULL);
|
|
|
|
}
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
g_object_set (app->pipeline, "audio-sink", sink, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
text_sink_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
GstElement *sink = NULL;
|
|
|
|
const gchar *text;
|
|
|
|
|
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
sink = gst_element_factory_make_or_warn (text, NULL);
|
check/pipelines/simple_launch_lines.c: Small update, use API as stated in design docs.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Small update, use API as stated in design docs.
* examples/seeking/seek.c: (make_avi_msmpeg4v3_mp3_pipeline),
(update_scale), (do_seek), (seek_cb), (set_update_scale),
(start_seek), (stop_seek), (play_cb), (pause_cb), (stop_cb),
(message_received), (main):
Updated seek example for GOption. Some usability improvements.
2005-10-10 16:26:40 +00:00
|
|
|
}
|
2005-09-19 16:09:41 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
g_object_set (app->pipeline, "text-sink", sink, NULL);
|
|
|
|
}
|
2011-05-25 18:03:44 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
buffer_size_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
2011-05-25 18:03:44 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
2014-02-08 16:07:15 +00:00
|
|
|
gint64 v;
|
2012-03-01 11:52:21 +00:00
|
|
|
gchar *endptr;
|
2005-09-19 16:09:41 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
v = g_ascii_strtoll (text, &endptr, 10);
|
2014-05-06 06:51:11 +00:00
|
|
|
if (endptr != text && v >= G_MININT && v <= G_MAXINT) {
|
|
|
|
g_object_set (app->pipeline, "buffer-size", (gint) v, NULL);
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
2003-02-02 19:25:58 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
buffer_duration_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
2003-02-02 19:25:58 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
gint64 v;
|
|
|
|
gchar *endptr;
|
|
|
|
|
|
|
|
v = g_ascii_strtoll (text, &endptr, 10);
|
|
|
|
if (endptr != text && v != G_MAXINT64 && v != G_MININT64) {
|
|
|
|
g_object_set (app->pipeline, "buffer-duration", v, NULL);
|
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
}
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
ringbuffer_maxsize_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
2007-06-21 08:34:46 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
guint64 v;
|
|
|
|
gchar *endptr;
|
|
|
|
|
|
|
|
v = g_ascii_strtoull (text, &endptr, 10);
|
|
|
|
if (endptr != text && v != G_MAXUINT64) {
|
|
|
|
g_object_set (app->pipeline, "ring-buffer-max-size", v, NULL);
|
|
|
|
}
|
2008-06-24 16:05:06 +00:00
|
|
|
}
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
connection_speed_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
|
|
|
|
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
2014-02-08 16:07:15 +00:00
|
|
|
gint64 v;
|
2012-03-01 11:52:21 +00:00
|
|
|
gchar *endptr;
|
|
|
|
|
|
|
|
v = g_ascii_strtoll (text, &endptr, 10);
|
|
|
|
if (endptr != text && v != G_MAXINT64 && v != G_MININT64) {
|
|
|
|
g_object_set (app->pipeline, "connection-speed", v, NULL);
|
|
|
|
}
|
2008-06-24 16:05:06 +00:00
|
|
|
}
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
subtitle_encoding_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
g_object_set (app->pipeline, "subtitle-encoding", text, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
subtitle_fontdesc_cb (GtkFontButton * button, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
2018-01-08 14:21:29 +00:00
|
|
|
gchar *text;
|
2012-03-01 11:52:21 +00:00
|
|
|
|
2018-01-08 14:21:29 +00:00
|
|
|
text = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (button));
|
2012-03-01 11:52:21 +00:00
|
|
|
g_object_set (app->pipeline, "subtitle-font-desc", text, NULL);
|
2018-01-08 14:21:29 +00:00
|
|
|
g_free (text);
|
2012-03-01 11:52:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
av_offset_activate_cb (GtkEntry * entry, PlaybackApp * app)
|
2012-03-01 11:52:21 +00:00
|
|
|
{
|
|
|
|
const gchar *text;
|
|
|
|
|
|
|
|
text = gtk_entry_get_text (entry);
|
|
|
|
if (text != NULL && *text != '\0') {
|
|
|
|
gint64 v;
|
|
|
|
gchar *endptr;
|
|
|
|
|
|
|
|
v = g_ascii_strtoll (text, &endptr, 10);
|
|
|
|
if (endptr != text && v != G_MAXINT64 && v != G_MININT64) {
|
|
|
|
g_object_set (app->pipeline, "av-offset", v, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-02-02 19:25:58 +00:00
|
|
|
static void
|
|
|
|
print_usage (int argc, char **argv)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
2014-12-15 12:12:44 +00:00
|
|
|
g_print ("Usage: %s <type> <argument>\n", argv[0]);
|
2003-02-02 19:25:58 +00:00
|
|
|
g_print (" possible types:\n");
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (pipelines); i++) {
|
2014-12-15 12:12:44 +00:00
|
|
|
g_print (" %d = %s %s\n", i, pipelines[i].name, pipelines[i].help);
|
2003-02-02 19:25:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
create_ui (PlaybackApp * app)
|
2002-05-28 20:30:11 +00:00
|
|
|
{
|
2012-03-01 08:46:45 +00:00
|
|
|
GtkWidget *hbox, *vbox, *seek, *playbin, *step, *navigation, *colorbalance;
|
|
|
|
GtkWidget *play_button, *pause_button, *stop_button;
|
2012-02-24 10:44:53 +00:00
|
|
|
GtkAdjustment *adjustment;
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
/* initialize gui elements ... */
|
2012-02-24 10:44:53 +00:00
|
|
|
app->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
app->video_window = gtk_drawing_area_new ();
|
|
|
|
g_signal_connect (app->video_window, "draw", G_CALLBACK (draw_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "realize", G_CALLBACK (realize_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "button-press-event",
|
|
|
|
G_CALLBACK (button_press_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "button-release-event",
|
|
|
|
G_CALLBACK (button_release_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "key-press-event",
|
|
|
|
G_CALLBACK (key_press_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "key-release-event",
|
|
|
|
G_CALLBACK (key_release_cb), app);
|
|
|
|
g_signal_connect (app->video_window, "motion-notify-event",
|
|
|
|
G_CALLBACK (motion_notify_cb), app);
|
|
|
|
gtk_widget_set_can_focus (app->video_window, TRUE);
|
|
|
|
gtk_widget_add_events (app->video_window,
|
2012-02-20 13:57:36 +00:00
|
|
|
GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
|
|
|
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
|
2009-12-29 00:40:27 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->statusbar = gtk_statusbar_new ();
|
|
|
|
app->status_id =
|
2012-03-02 11:01:37 +00:00
|
|
|
gtk_statusbar_get_context_id (GTK_STATUSBAR (app->statusbar),
|
|
|
|
"playback-test");
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_statusbar_push (GTK_STATUSBAR (app->statusbar), app->status_id,
|
|
|
|
"Stopped");
|
2015-04-02 13:32:15 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2006-09-18 11:40:14 +00:00
|
|
|
gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2006-09-18 11:40:14 +00:00
|
|
|
/* media controls */
|
2015-04-02 13:32:15 +00:00
|
|
|
play_button = gtk_button_new_from_icon_name ("media-playback-start",
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
|
|
|
pause_button = gtk_button_new_from_icon_name ("media-playback-pause",
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
|
|
|
stop_button = gtk_button_new_from_icon_name ("media-playback-stop",
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
2006-09-18 11:40:14 +00:00
|
|
|
|
2012-02-24 12:54:47 +00:00
|
|
|
/* seek expander */
|
|
|
|
{
|
2012-03-01 08:46:45 +00:00
|
|
|
GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox,
|
2012-05-23 14:07:20 +00:00
|
|
|
*flush_checkbox, *snap_before_checkbox, *snap_after_checkbox;
|
2012-03-01 08:46:45 +00:00
|
|
|
GtkWidget *scrub_checkbox, *play_scrub_checkbox, *rate_label;
|
2014-12-10 14:54:07 +00:00
|
|
|
GtkWidget *skip_checkbox, *skip_key_checkbox, *skip_audio_checkbox,
|
|
|
|
*rate_spinbutton;
|
2012-03-01 09:45:51 +00:00
|
|
|
GtkWidget *flagtable, *advanced_seek, *advanced_seek_grid;
|
|
|
|
GtkWidget *duration_label, *position_label, *seek_button;
|
2015-01-14 13:35:34 +00:00
|
|
|
GtkWidget *start_label, *stop_label;
|
2012-03-01 08:46:45 +00:00
|
|
|
|
2012-02-24 12:54:47 +00:00
|
|
|
seek = gtk_expander_new ("seek options");
|
|
|
|
flagtable = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (flagtable), 2);
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_grid_set_row_homogeneous (GTK_GRID (flagtable), FALSE);
|
2012-02-24 12:54:47 +00:00
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (flagtable), 2);
|
2012-03-26 07:13:20 +00:00
|
|
|
gtk_grid_set_column_homogeneous (GTK_GRID (flagtable), FALSE);
|
2012-02-24 12:54:47 +00:00
|
|
|
|
2012-03-02 11:01:37 +00:00
|
|
|
accurate_checkbox = gtk_check_button_new_with_label ("Accurate Playback");
|
|
|
|
key_checkbox = gtk_check_button_new_with_label ("Key-unit Playback");
|
2012-02-24 12:54:47 +00:00
|
|
|
loop_checkbox = gtk_check_button_new_with_label ("Loop");
|
|
|
|
flush_checkbox = gtk_check_button_new_with_label ("Flush");
|
|
|
|
scrub_checkbox = gtk_check_button_new_with_label ("Scrub");
|
|
|
|
play_scrub_checkbox = gtk_check_button_new_with_label ("Play Scrub");
|
2014-12-10 14:54:07 +00:00
|
|
|
skip_checkbox = gtk_check_button_new_with_label ("Trickmode Play");
|
|
|
|
skip_key_checkbox =
|
|
|
|
gtk_check_button_new_with_label ("Trickmode - Keyframes Only");
|
|
|
|
skip_audio_checkbox =
|
|
|
|
gtk_check_button_new_with_label ("Trickmode - No Audio");
|
2012-05-23 14:07:20 +00:00
|
|
|
snap_before_checkbox = gtk_check_button_new_with_label ("Snap before");
|
|
|
|
snap_after_checkbox = gtk_check_button_new_with_label ("Snap after");
|
2012-02-24 12:54:47 +00:00
|
|
|
rate_spinbutton = gtk_spin_button_new_with_range (-100, 100, 0.1);
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (rate_spinbutton), 3);
|
|
|
|
rate_label = gtk_label_new ("Rate");
|
|
|
|
|
|
|
|
gtk_widget_set_tooltip_text (accurate_checkbox,
|
|
|
|
"accurate position is requested, this might be considerably slower for some formats");
|
|
|
|
gtk_widget_set_tooltip_text (key_checkbox,
|
|
|
|
"seek to the nearest keyframe. This might be faster but less accurate");
|
|
|
|
gtk_widget_set_tooltip_text (loop_checkbox, "loop playback");
|
|
|
|
gtk_widget_set_tooltip_text (flush_checkbox,
|
|
|
|
"flush pipeline after seeking");
|
|
|
|
gtk_widget_set_tooltip_text (rate_spinbutton,
|
|
|
|
"define the playback rate, " "negative value trigger reverse playback");
|
|
|
|
gtk_widget_set_tooltip_text (scrub_checkbox, "show images while seeking");
|
|
|
|
gtk_widget_set_tooltip_text (play_scrub_checkbox,
|
|
|
|
"play video while seeking");
|
|
|
|
gtk_widget_set_tooltip_text (skip_checkbox,
|
|
|
|
"Skip frames while playing at high frame rates");
|
2014-12-10 14:54:07 +00:00
|
|
|
gtk_widget_set_tooltip_text (skip_key_checkbox,
|
|
|
|
"Skip everything except keyframes while playing at high frame rates");
|
|
|
|
gtk_widget_set_tooltip_text (skip_audio_checkbox,
|
|
|
|
"Do not decode audio during trick mode playback");
|
2012-05-23 14:07:20 +00:00
|
|
|
gtk_widget_set_tooltip_text (snap_before_checkbox,
|
|
|
|
"Favor snapping to the frame before the seek target");
|
|
|
|
gtk_widget_set_tooltip_text (snap_after_checkbox,
|
|
|
|
"Favor snapping to the frame after the seek target");
|
2012-02-24 12:54:47 +00:00
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (flush_checkbox), TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scrub_checkbox), TRUE);
|
|
|
|
|
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (rate_spinbutton), app->rate);
|
|
|
|
|
2012-03-01 08:46:45 +00:00
|
|
|
g_signal_connect (G_OBJECT (accurate_checkbox), "toggled",
|
|
|
|
G_CALLBACK (accurate_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (key_checkbox), "toggled",
|
|
|
|
G_CALLBACK (key_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (loop_checkbox), "toggled",
|
|
|
|
G_CALLBACK (loop_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (flush_checkbox), "toggled",
|
|
|
|
G_CALLBACK (flush_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (scrub_checkbox), "toggled",
|
|
|
|
G_CALLBACK (scrub_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (play_scrub_checkbox), "toggled",
|
|
|
|
G_CALLBACK (play_scrub_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (skip_checkbox), "toggled",
|
|
|
|
G_CALLBACK (skip_toggle_cb), app);
|
2014-12-10 14:54:07 +00:00
|
|
|
g_signal_connect (G_OBJECT (skip_key_checkbox), "toggled",
|
|
|
|
G_CALLBACK (skip_key_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (skip_audio_checkbox), "toggled",
|
|
|
|
G_CALLBACK (skip_audio_toggle_cb), app);
|
2012-03-01 08:46:45 +00:00
|
|
|
g_signal_connect (G_OBJECT (rate_spinbutton), "value-changed",
|
|
|
|
G_CALLBACK (rate_spinbutton_changed_cb), app);
|
2012-05-23 14:07:20 +00:00
|
|
|
g_signal_connect (G_OBJECT (snap_before_checkbox), "toggled",
|
|
|
|
G_CALLBACK (snap_before_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (snap_after_checkbox), "toggled",
|
|
|
|
G_CALLBACK (snap_after_toggle_cb), app);
|
2012-03-01 08:46:45 +00:00
|
|
|
|
2012-02-24 12:54:47 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), accurate_checkbox, 0, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), flush_checkbox, 1, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), loop_checkbox, 2, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), key_checkbox, 0, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), scrub_checkbox, 1, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), play_scrub_checkbox, 2, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), skip_checkbox, 3, 0, 1, 1);
|
2014-12-10 14:54:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), skip_key_checkbox, 3, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), skip_audio_checkbox, 3, 2, 1, 1);
|
2012-02-24 12:54:47 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), rate_label, 4, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), rate_spinbutton, 4, 1, 1, 1);
|
2012-05-23 14:07:20 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), snap_before_checkbox, 0, 2, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), snap_after_checkbox, 1, 2, 1, 1);
|
2012-02-24 12:54:47 +00:00
|
|
|
|
2012-03-26 07:11:49 +00:00
|
|
|
advanced_seek = gtk_frame_new ("Advanced Seeking");
|
2012-03-01 09:45:51 +00:00
|
|
|
advanced_seek_grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (advanced_seek_grid), 2);
|
|
|
|
gtk_grid_set_row_homogeneous (GTK_GRID (advanced_seek_grid), FALSE);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (advanced_seek_grid), 5);
|
|
|
|
gtk_grid_set_column_homogeneous (GTK_GRID (advanced_seek_grid), FALSE);
|
|
|
|
|
|
|
|
app->seek_format_combo = gtk_combo_box_text_new ();
|
|
|
|
g_signal_connect (app->seek_format_combo, "changed",
|
|
|
|
G_CALLBACK (seek_format_changed_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_format_combo, 0,
|
|
|
|
0, 1, 1);
|
|
|
|
|
|
|
|
app->seek_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_width_chars (GTK_ENTRY (app->seek_entry), 12);
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_entry, 0, 1, 1,
|
|
|
|
1);
|
|
|
|
|
2012-03-26 07:11:49 +00:00
|
|
|
seek_button = gtk_button_new_with_label ("Seek");
|
2012-03-01 09:45:51 +00:00
|
|
|
g_signal_connect (G_OBJECT (seek_button), "clicked",
|
|
|
|
G_CALLBACK (advanced_seek_button_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), seek_button, 1, 0, 1, 1);
|
|
|
|
|
|
|
|
position_label = gtk_label_new ("Position:");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), position_label, 2, 0, 1, 1);
|
|
|
|
duration_label = gtk_label_new ("Duration:");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), duration_label, 2, 1, 1, 1);
|
|
|
|
|
|
|
|
app->seek_position_label = gtk_label_new ("-1");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_position_label, 3,
|
|
|
|
0, 1, 1);
|
|
|
|
app->seek_duration_label = gtk_label_new ("-1");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_duration_label, 3,
|
|
|
|
1, 1, 1);
|
|
|
|
|
2015-01-14 13:35:34 +00:00
|
|
|
start_label = gtk_label_new ("Seek start:");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), start_label, 4, 0, 1, 1);
|
|
|
|
stop_label = gtk_label_new ("Seek stop:");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), stop_label, 4, 1, 1, 1);
|
|
|
|
|
|
|
|
app->seek_start_label = gtk_label_new ("-1");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_start_label, 5,
|
|
|
|
0, 1, 1);
|
|
|
|
app->seek_stop_label = gtk_label_new ("-1");
|
|
|
|
gtk_grid_attach (GTK_GRID (advanced_seek_grid), app->seek_stop_label, 5,
|
|
|
|
1, 1, 1);
|
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (advanced_seek), advanced_seek_grid);
|
2012-05-23 14:07:20 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (flagtable), advanced_seek, 0, 3, 3, 2);
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (seek), flagtable);
|
2012-02-24 12:54:47 +00:00
|
|
|
}
|
2006-10-07 18:35:39 +00:00
|
|
|
|
2009-06-01 09:31:49 +00:00
|
|
|
/* step expander */
|
|
|
|
{
|
|
|
|
GtkWidget *hbox;
|
2012-03-01 08:46:45 +00:00
|
|
|
GtkWidget *step_button, *shuttle_checkbox;
|
2009-06-01 09:31:49 +00:00
|
|
|
|
|
|
|
step = gtk_expander_new ("step options");
|
2015-04-02 13:32:15 +00:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-06-01 09:31:49 +00:00
|
|
|
|
2012-03-01 09:45:51 +00:00
|
|
|
app->step_format_combo = gtk_combo_box_text_new ();
|
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->step_format_combo),
|
2010-10-20 09:01:59 +00:00
|
|
|
"frames");
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (app->step_format_combo),
|
2010-10-20 09:01:59 +00:00
|
|
|
"time (ms)");
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (app->step_format_combo), 0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), app->step_format_combo, FALSE, FALSE,
|
2009-06-01 09:31:49 +00:00
|
|
|
2);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->step_amount_spinbutton = gtk_spin_button_new_with_range (1, 1000, 1);
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (app->step_amount_spinbutton),
|
|
|
|
0);
|
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (app->step_amount_spinbutton),
|
|
|
|
1.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), app->step_amount_spinbutton, FALSE,
|
|
|
|
FALSE, 2);
|
|
|
|
|
|
|
|
app->step_rate_spinbutton = gtk_spin_button_new_with_range (0.0, 100, 0.1);
|
|
|
|
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (app->step_rate_spinbutton), 3);
|
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (app->step_rate_spinbutton),
|
|
|
|
1.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), app->step_rate_spinbutton, FALSE, FALSE,
|
2009-06-01 09:31:49 +00:00
|
|
|
2);
|
|
|
|
|
2015-04-02 13:32:15 +00:00
|
|
|
step_button =
|
|
|
|
gtk_button_new_from_icon_name ("media-seek-forward",
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
2009-06-01 09:31:49 +00:00
|
|
|
gtk_button_set_label (GTK_BUTTON (step_button), "Step");
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), step_button, FALSE, FALSE, 2);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (step_button), "clicked", G_CALLBACK (step_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
2009-06-01 09:31:49 +00:00
|
|
|
|
2009-06-12 11:55:33 +00:00
|
|
|
/* shuttle scale */
|
|
|
|
shuttle_checkbox = gtk_check_button_new_with_label ("Shuttle");
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), shuttle_checkbox, FALSE, FALSE, 2);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shuttle_checkbox), FALSE);
|
2009-11-06 11:25:05 +00:00
|
|
|
g_signal_connect (shuttle_checkbox, "toggled", G_CALLBACK (shuttle_toggled),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
adjustment =
|
2009-06-12 11:55:33 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, -3.00, 4.0, 0.1, 1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->shuttle_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (app->shuttle_scale), 2);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (app->shuttle_scale), GTK_POS_TOP);
|
|
|
|
g_signal_connect (app->shuttle_scale, "value-changed",
|
|
|
|
G_CALLBACK (shuttle_value_changed), app);
|
|
|
|
g_signal_connect (app->shuttle_scale, "format_value",
|
|
|
|
G_CALLBACK (shuttle_format_value), app);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), app->shuttle_scale, TRUE, TRUE, 2);
|
2009-06-12 11:55:33 +00:00
|
|
|
|
2009-06-01 09:31:49 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (step), hbox);
|
|
|
|
}
|
|
|
|
|
2012-02-20 15:44:07 +00:00
|
|
|
/* navigation command expander */
|
|
|
|
{
|
|
|
|
GtkWidget *navigation_button;
|
|
|
|
GtkWidget *grid;
|
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
navigation = gtk_expander_new ("navigation commands");
|
|
|
|
grid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (grid), 2);
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_grid_set_row_homogeneous (GTK_GRID (grid), FALSE);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (grid), 2);
|
2012-03-26 07:13:20 +00:00
|
|
|
gtk_grid_set_column_homogeneous (GTK_GRID (grid), FALSE);
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 1");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU1;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 2");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Title Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU2;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 3");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Root Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU3;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 4");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Subpicture Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU4;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 5");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Audio Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU5;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 6");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Angle Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU6;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Menu 7");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i, 0, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
|
|
|
gtk_widget_set_tooltip_text (navigation_button, "DVD Chapter Menu");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_MENU7;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Left");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_LEFT;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Right");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_RIGHT;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Up");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_UP;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Down");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_DOWN;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Activate");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_ACTIVATE;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Prev. Angle");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_PREV_ANGLE;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
navigation_button = gtk_button_new_with_label ("Next. Angle");
|
|
|
|
g_signal_connect (G_OBJECT (navigation_button), "clicked",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (navigation_cmd_cb), app);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (grid), navigation_button, i - 7, 1, 1, 1);
|
|
|
|
gtk_widget_set_sensitive (navigation_button, FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->navigation_buttons[i].button = navigation_button;
|
|
|
|
app->navigation_buttons[i++].cmd = GST_NAVIGATION_COMMAND_NEXT_ANGLE;
|
2012-02-20 15:44:07 +00:00
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (navigation), grid);
|
|
|
|
}
|
|
|
|
|
2012-02-22 14:52:04 +00:00
|
|
|
/* colorbalance expander */
|
|
|
|
{
|
2012-02-22 13:58:38 +00:00
|
|
|
GtkWidget *vbox, *frame;
|
|
|
|
|
|
|
|
colorbalance = gtk_expander_new ("color balance options");
|
2015-04-02 13:32:15 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2012-02-22 13:58:38 +00:00
|
|
|
|
|
|
|
/* contrast scale */
|
|
|
|
frame = gtk_frame_new ("Contrast");
|
|
|
|
adjustment =
|
2012-02-24 11:03:34 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (N_GRAD / 2.0, 0.00, N_GRAD, 0.1,
|
|
|
|
1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->contrast_scale =
|
|
|
|
gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (app->contrast_scale), FALSE);
|
|
|
|
g_signal_connect (app->contrast_scale, "value-changed",
|
|
|
|
G_CALLBACK (colorbalance_value_changed), app);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), app->contrast_scale);
|
2012-02-22 13:58:38 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
/* brightness scale */
|
|
|
|
frame = gtk_frame_new ("Brightness");
|
|
|
|
adjustment =
|
2012-02-24 11:03:34 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (N_GRAD / 2.0, 0.00, N_GRAD, 0.1,
|
|
|
|
1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->brightness_scale =
|
|
|
|
gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (app->brightness_scale), FALSE);
|
|
|
|
g_signal_connect (app->brightness_scale, "value-changed",
|
|
|
|
G_CALLBACK (colorbalance_value_changed), app);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), app->brightness_scale);
|
2012-02-22 13:58:38 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
/* hue scale */
|
|
|
|
frame = gtk_frame_new ("Hue");
|
|
|
|
adjustment =
|
2012-02-24 11:03:34 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (N_GRAD / 2.0, 0.00, N_GRAD, 0.1,
|
|
|
|
1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->hue_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (app->hue_scale), FALSE);
|
|
|
|
g_signal_connect (app->hue_scale, "value-changed",
|
|
|
|
G_CALLBACK (colorbalance_value_changed), app);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), app->hue_scale);
|
2012-02-22 13:58:38 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
/* saturation scale */
|
|
|
|
frame = gtk_frame_new ("Saturation");
|
|
|
|
adjustment =
|
2012-02-24 11:03:34 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (N_GRAD / 2.0, 0.00, N_GRAD, 0.1,
|
|
|
|
1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->saturation_scale =
|
|
|
|
gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_draw_value (GTK_SCALE (app->saturation_scale), FALSE);
|
|
|
|
g_signal_connect (app->saturation_scale, "value-changed",
|
|
|
|
G_CALLBACK (colorbalance_value_changed), app);
|
|
|
|
gtk_container_add (GTK_CONTAINER (frame), app->saturation_scale);
|
2012-02-22 13:58:38 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (colorbalance), vbox);
|
|
|
|
}
|
|
|
|
|
2006-09-18 11:40:14 +00:00
|
|
|
/* seek bar */
|
2004-03-14 22:34:34 +00:00
|
|
|
adjustment =
|
2010-09-24 14:31:37 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, N_GRAD, 0.1, 1.0, 1.0));
|
2015-04-02 13:32:15 +00:00
|
|
|
app->seek_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_scale_set_digits (GTK_SCALE (app->seek_scale), 2);
|
|
|
|
gtk_scale_set_value_pos (GTK_SCALE (app->seek_scale), GTK_POS_RIGHT);
|
|
|
|
gtk_range_set_show_fill_level (GTK_RANGE (app->seek_scale), TRUE);
|
2014-02-07 14:33:34 +00:00
|
|
|
gtk_range_set_restrict_to_fill_level (GTK_RANGE (app->seek_scale), FALSE);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_range_set_fill_level (GTK_RANGE (app->seek_scale), N_GRAD);
|
|
|
|
|
|
|
|
g_signal_connect (app->seek_scale, "button_press_event",
|
|
|
|
G_CALLBACK (start_seek), app);
|
|
|
|
g_signal_connect (app->seek_scale, "button_release_event",
|
|
|
|
G_CALLBACK (stop_seek), app);
|
|
|
|
g_signal_connect (app->seek_scale, "format_value", G_CALLBACK (format_value),
|
|
|
|
app);
|
|
|
|
|
|
|
|
if (app->pipeline_type == 0) {
|
2012-03-01 11:52:21 +00:00
|
|
|
GtkWidget *pb2vbox, *boxes, *boxes2, *panel, *boxes3;
|
2012-03-01 08:46:45 +00:00
|
|
|
GtkWidget *volume_label, *shot_button;
|
2012-03-01 11:52:21 +00:00
|
|
|
GtkWidget *label;
|
2012-03-01 08:46:45 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
playbin = gtk_expander_new ("playbin options");
|
2011-12-19 08:49:07 +00:00
|
|
|
/* the playbin panel controls for the video/audio/subtitle tracks */
|
2015-04-02 13:32:15 +00:00
|
|
|
panel = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2012-02-24 10:44:53 +00:00
|
|
|
app->video_combo = gtk_combo_box_text_new ();
|
|
|
|
app->audio_combo = gtk_combo_box_text_new ();
|
|
|
|
app->text_combo = gtk_combo_box_text_new ();
|
|
|
|
gtk_widget_set_sensitive (app->video_combo, FALSE);
|
|
|
|
gtk_widget_set_sensitive (app->audio_combo, FALSE);
|
|
|
|
gtk_widget_set_sensitive (app->text_combo, FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (panel), app->video_combo, TRUE, TRUE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (panel), app->audio_combo, TRUE, TRUE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (panel), app->text_combo, TRUE, TRUE, 2);
|
|
|
|
g_signal_connect (G_OBJECT (app->video_combo), "changed",
|
|
|
|
G_CALLBACK (video_combo_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->audio_combo), "changed",
|
|
|
|
G_CALLBACK (audio_combo_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->text_combo), "changed",
|
|
|
|
G_CALLBACK (text_combo_cb), app);
|
2011-12-19 08:49:07 +00:00
|
|
|
/* playbin panel for flag checkboxes and volume/mute */
|
2012-02-22 14:43:25 +00:00
|
|
|
boxes = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (boxes), 2);
|
2012-03-01 09:45:51 +00:00
|
|
|
gtk_grid_set_row_homogeneous (GTK_GRID (boxes), FALSE);
|
2012-02-22 14:43:25 +00:00
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (boxes), 2);
|
2012-03-26 07:13:20 +00:00
|
|
|
gtk_grid_set_column_homogeneous (GTK_GRID (boxes), FALSE);
|
2012-02-22 14:43:25 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
app->video_checkbox = gtk_check_button_new_with_label ("Video");
|
|
|
|
app->audio_checkbox = gtk_check_button_new_with_label ("Audio");
|
|
|
|
app->text_checkbox = gtk_check_button_new_with_label ("Text");
|
|
|
|
app->vis_checkbox = gtk_check_button_new_with_label ("Vis");
|
2012-03-01 11:52:21 +00:00
|
|
|
app->soft_volume_checkbox = gtk_check_button_new_with_label ("Soft Volume");
|
|
|
|
app->native_audio_checkbox =
|
|
|
|
gtk_check_button_new_with_label ("Native Audio");
|
|
|
|
app->native_video_checkbox =
|
|
|
|
gtk_check_button_new_with_label ("Native Video");
|
|
|
|
app->download_checkbox = gtk_check_button_new_with_label ("Download");
|
|
|
|
app->buffering_checkbox = gtk_check_button_new_with_label ("Buffering");
|
|
|
|
app->deinterlace_checkbox = gtk_check_button_new_with_label ("Deinterlace");
|
|
|
|
app->soft_colorbalance_checkbox =
|
2012-02-22 14:43:25 +00:00
|
|
|
gtk_check_button_new_with_label ("Soft Colorbalance");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->mute_checkbox = gtk_check_button_new_with_label ("Mute");
|
2009-05-27 14:37:38 +00:00
|
|
|
volume_label = gtk_label_new ("Volume");
|
2012-02-24 10:44:53 +00:00
|
|
|
app->volume_spinbutton = gtk_spin_button_new_with_range (0, 10.0, 0.1);
|
2012-03-01 11:52:21 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->video_checkbox, 0, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->audio_checkbox, 1, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->text_checkbox, 2, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->vis_checkbox, 3, 0, 1, 1);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->soft_volume_checkbox, 4, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->native_audio_checkbox, 5, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->native_video_checkbox, 0, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->download_checkbox, 1, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->buffering_checkbox, 2, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->deinterlace_checkbox, 3, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->soft_colorbalance_checkbox, 4, 1, 1,
|
|
|
|
1);
|
2012-02-22 14:43:25 +00:00
|
|
|
|
2012-03-26 07:15:18 +00:00
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->mute_checkbox, 6, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), volume_label, 5, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes), app->volume_spinbutton, 6, 1, 1, 1);
|
2012-03-01 11:52:21 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->video_checkbox),
|
|
|
|
TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->audio_checkbox),
|
|
|
|
TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->text_checkbox), TRUE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->vis_checkbox), FALSE);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->soft_volume_checkbox),
|
2012-02-22 14:43:25 +00:00
|
|
|
TRUE);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
|
|
|
|
(app->native_audio_checkbox), FALSE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
|
|
|
|
(app->native_video_checkbox), FALSE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->download_checkbox),
|
2012-02-22 14:43:25 +00:00
|
|
|
FALSE);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->buffering_checkbox),
|
2012-02-22 14:43:25 +00:00
|
|
|
FALSE);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->deinterlace_checkbox),
|
2012-02-22 14:43:25 +00:00
|
|
|
FALSE);
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
|
2012-03-01 11:52:21 +00:00
|
|
|
(app->soft_colorbalance_checkbox), TRUE);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->mute_checkbox),
|
|
|
|
FALSE);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_spin_button_set_value (GTK_SPIN_BUTTON (app->volume_spinbutton), 1.0);
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->video_checkbox), "toggled",
|
|
|
|
G_CALLBACK (video_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->audio_checkbox), "toggled",
|
|
|
|
G_CALLBACK (audio_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->text_checkbox), "toggled",
|
|
|
|
G_CALLBACK (text_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->vis_checkbox), "toggled",
|
|
|
|
G_CALLBACK (vis_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->soft_volume_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (soft_volume_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->native_audio_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (native_audio_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->native_video_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (native_video_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->download_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (download_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->buffering_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (buffering_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->deinterlace_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (deinterlace_toggle_cb), app);
|
2012-03-01 11:52:21 +00:00
|
|
|
g_signal_connect (G_OBJECT (app->soft_colorbalance_checkbox), "toggled",
|
2012-02-24 10:44:53 +00:00
|
|
|
G_CALLBACK (soft_colorbalance_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->mute_checkbox), "toggled",
|
|
|
|
G_CALLBACK (mute_toggle_cb), app);
|
|
|
|
g_signal_connect (G_OBJECT (app->volume_spinbutton), "value-changed",
|
|
|
|
G_CALLBACK (volume_spinbutton_changed_cb), app);
|
2011-12-19 08:49:07 +00:00
|
|
|
/* playbin panel for snapshot */
|
2015-04-02 13:32:15 +00:00
|
|
|
boxes2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
shot_button =
|
|
|
|
gtk_button_new_from_icon_name ("document-save", GTK_ICON_SIZE_BUTTON);
|
2009-06-14 18:30:59 +00:00
|
|
|
gtk_widget_set_tooltip_text (shot_button,
|
|
|
|
"save a screenshot .png in the current directory");
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
g_signal_connect (G_OBJECT (shot_button), "clicked", G_CALLBACK (shot_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
|
|
|
app->vis_combo = gtk_combo_box_text_new ();
|
|
|
|
g_signal_connect (G_OBJECT (app->vis_combo), "changed",
|
|
|
|
G_CALLBACK (vis_combo_cb), app);
|
|
|
|
gtk_widget_set_sensitive (app->vis_combo, FALSE);
|
2008-02-27 12:19:31 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (boxes2), shot_button, TRUE, TRUE, 2);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (boxes2), app->vis_combo, TRUE, TRUE, 2);
|
gst/playback/: Add screenshot conversion code from totem.
Original commit message from CVS:
* gst/playback/Makefile.am:
* gst/playback/gstscreenshot.c: (feed_fakesrc), (save_result),
(create_element), (gst_play_frame_conv_convert):
* gst/playback/gstscreenshot.h:
Add screenshot conversion code from totem.
* gst/playback/gstplay-marshal.list:
* gst/playback/gstplaybin2.c: (gst_play_marshal_BUFFER__BOXED),
(gst_play_bin_class_init), (gst_play_bin_convert_frame),
(gst_play_bin_get_property), (no_more_pads_cb), (activate_group):
Implement frame property to get a color-unconverted snapshot.
Implement convert-frame action signal to get a converted snapshot image.
Configure connection speed in uridecodebin.
Document some more properties.
* gst/playback/gstplaysink.c: (gst_play_sink_class_init),
(gen_video_chain), (gen_audio_chain), (gst_play_sink_reconfigure),
(gst_play_sink_get_last_frame):
* gst/playback/gstplaysink.h:
Use last-buffer property of the video sink to get a video snapshot.
* tests/examples/seek/seek.c: (shot_cb), (main):
Add snapshot button for playbin2 and use the frame property to save the
frame as a png in the current directory.
2008-02-19 15:02:33 +00:00
|
|
|
|
2008-02-27 12:19:31 +00:00
|
|
|
/* fill the vis combo box and the array of factories */
|
2012-02-24 10:44:53 +00:00
|
|
|
init_visualization_features (app);
|
2012-03-01 08:46:45 +00:00
|
|
|
|
2012-03-01 11:52:21 +00:00
|
|
|
/* Grid with other properties */
|
|
|
|
boxes3 = gtk_grid_new ();
|
|
|
|
gtk_grid_set_row_spacing (GTK_GRID (boxes3), 2);
|
|
|
|
gtk_grid_set_row_homogeneous (GTK_GRID (boxes3), FALSE);
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (boxes3), 2);
|
2012-03-26 07:13:20 +00:00
|
|
|
gtk_grid_set_column_homogeneous (GTK_GRID (boxes3), FALSE);
|
2012-03-01 11:52:21 +00:00
|
|
|
|
|
|
|
label = gtk_label_new ("Video sink");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 0, 0, 1, 1);
|
|
|
|
app->video_sink_entry = gtk_entry_new ();
|
|
|
|
g_signal_connect (app->video_sink_entry, "activate",
|
|
|
|
G_CALLBACK (video_sink_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->video_sink_entry, 0, 1, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Audio sink");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 1, 0, 1, 1);
|
|
|
|
app->audio_sink_entry = gtk_entry_new ();
|
|
|
|
g_signal_connect (app->audio_sink_entry, "activate",
|
|
|
|
G_CALLBACK (audio_sink_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->audio_sink_entry, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Text sink");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 2, 0, 1, 1);
|
|
|
|
app->text_sink_entry = gtk_entry_new ();
|
|
|
|
g_signal_connect (app->text_sink_entry, "activate",
|
|
|
|
G_CALLBACK (text_sink_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->text_sink_entry, 2, 1, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Buffer Size");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 0, 2, 1, 1);
|
|
|
|
app->buffer_size_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app->buffer_size_entry), "-1");
|
|
|
|
g_signal_connect (app->buffer_size_entry, "activate",
|
|
|
|
G_CALLBACK (buffer_size_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->buffer_size_entry, 0, 3, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Buffer Duration");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 1, 2, 1, 1);
|
|
|
|
app->buffer_duration_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app->buffer_duration_entry), "-1");
|
|
|
|
g_signal_connect (app->buffer_duration_entry, "activate",
|
|
|
|
G_CALLBACK (buffer_duration_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->buffer_duration_entry, 1, 3, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Ringbuffer Max Size");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 2, 2, 1, 1);
|
|
|
|
app->ringbuffer_maxsize_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app->ringbuffer_maxsize_entry), "0");
|
|
|
|
g_signal_connect (app->ringbuffer_maxsize_entry, "activate",
|
|
|
|
G_CALLBACK (ringbuffer_maxsize_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->ringbuffer_maxsize_entry, 2, 3, 1,
|
|
|
|
1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Connection Speed");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 3, 2, 1, 1);
|
|
|
|
app->connection_speed_entry = gtk_entry_new ();
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app->connection_speed_entry), "0");
|
|
|
|
g_signal_connect (app->connection_speed_entry, "activate",
|
|
|
|
G_CALLBACK (connection_speed_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->connection_speed_entry, 3, 3, 1,
|
|
|
|
1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("A/V offset");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 4, 2, 1, 1);
|
|
|
|
app->av_offset_entry = gtk_entry_new ();
|
|
|
|
g_signal_connect (app->av_offset_entry, "activate",
|
|
|
|
G_CALLBACK (av_offset_activate_cb), app);
|
|
|
|
gtk_entry_set_text (GTK_ENTRY (app->av_offset_entry), "0");
|
|
|
|
g_signal_connect (app->av_offset_entry, "activate",
|
|
|
|
G_CALLBACK (av_offset_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->av_offset_entry, 4, 3, 1, 1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Subtitle Encoding");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 0, 4, 1, 1);
|
|
|
|
app->subtitle_encoding_entry = gtk_entry_new ();
|
|
|
|
g_signal_connect (app->subtitle_encoding_entry, "activate",
|
|
|
|
G_CALLBACK (subtitle_encoding_activate_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->subtitle_encoding_entry, 0, 5, 1,
|
|
|
|
1);
|
|
|
|
|
|
|
|
label = gtk_label_new ("Subtitle Fontdesc");
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), label, 1, 4, 1, 1);
|
|
|
|
app->subtitle_fontdesc_button = gtk_font_button_new ();
|
|
|
|
g_signal_connect (app->subtitle_fontdesc_button, "font-set",
|
|
|
|
G_CALLBACK (subtitle_fontdesc_cb), app);
|
|
|
|
gtk_grid_attach (GTK_GRID (boxes3), app->subtitle_fontdesc_button, 1, 5, 1,
|
|
|
|
1);
|
|
|
|
|
2015-04-02 13:32:15 +00:00
|
|
|
pb2vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2012-03-01 08:46:45 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (pb2vbox), panel, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (pb2vbox), boxes, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (pb2vbox), boxes2, FALSE, FALSE, 2);
|
2012-03-01 11:52:21 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (pb2vbox), boxes3, FALSE, FALSE, 2);
|
2012-03-01 08:46:45 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (playbin), pb2vbox);
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
} else {
|
2012-03-01 08:46:45 +00:00
|
|
|
playbin = NULL;
|
gst/playback/gstplaybin2.c: Remove stream-info, we going for something easier.
Original commit message from CVS:
* gst/playback/gstplaybin2.c: (gst_play_bin_class_init),
(get_group), (get_n_pads), (gst_play_bin_get_property),
(pad_added_cb), (no_more_pads_cb), (perform_eos),
(autoplug_select_cb), (deactivate_group):
Remove stream-info, we going for something easier.
Refactor getting the current group.
Implement getting the number of audio/video/text streams.
* gst/playback/gststreamselector.c:
(gst_stream_selector_class_init), (gst_stream_selector_init),
(gst_stream_selector_get_property),
(gst_stream_selector_request_new_pad),
(gst_stream_selector_release_pad):
* gst/playback/gststreamselector.h:
Add property for number of pads.
* tests/examples/seek/seek.c: (set_scale), (update_flag),
(vis_toggle_cb), (audio_toggle_cb), (video_toggle_cb),
(text_toggle_cb), (update_streams), (msg_async_done),
(msg_state_changed), (main):
Block slider callback when updating the slider position.
Add gui elements for controlling playbin2.
Add callback for async_done that updates position/duration.
2008-02-01 16:44:21 +00:00
|
|
|
}
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
/* do the packing stuff ... */
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_window_set_default_size (GTK_WINDOW (app->window), 250, 96);
|
2008-06-24 16:05:06 +00:00
|
|
|
/* FIXME: can we avoid this for audio only? */
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (app->video_window), -1,
|
2008-06-24 16:05:06 +00:00
|
|
|
DEFAULT_VIDEO_HEIGHT);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (app->window), vbox);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), app->video_window, TRUE, TRUE, 2);
|
2008-06-24 16:05:06 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 2);
|
2002-05-28 20:30:11 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
|
2012-02-24 12:54:47 +00:00
|
|
|
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), seek, FALSE, FALSE, 2);
|
2012-03-01 08:46:45 +00:00
|
|
|
if (playbin)
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), playbin, FALSE, FALSE, 2);
|
2009-06-01 09:31:49 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), step, FALSE, FALSE, 2);
|
2012-02-20 15:44:07 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), navigation, FALSE, FALSE, 2);
|
2012-02-22 14:52:04 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), colorbalance, FALSE, FALSE, 2);
|
2015-04-02 13:32:15 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox),
|
|
|
|
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, 2);
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), app->seek_scale, FALSE, FALSE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), app->statusbar, FALSE, FALSE, 2);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
/* connect things ... */
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
2004-03-14 22:34:34 +00:00
|
|
|
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
2012-02-24 10:44:53 +00:00
|
|
|
app);
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (app->window), "delete-event",
|
|
|
|
G_CALLBACK (delete_event_cb), app);
|
2012-06-14 22:08:54 +00:00
|
|
|
|
|
|
|
gtk_widget_set_can_default (play_button, TRUE);
|
|
|
|
gtk_widget_grab_default (play_button);
|
2012-02-24 10:44:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
set_defaults (PlaybackApp * app)
|
2012-02-24 10:44:53 +00:00
|
|
|
{
|
2012-03-02 11:01:37 +00:00
|
|
|
memset (app, 0, sizeof (PlaybackApp));
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
app->flush_seek = TRUE;
|
|
|
|
app->scrub = TRUE;
|
|
|
|
app->rate = 1.0;
|
|
|
|
|
|
|
|
app->position = app->duration = -1;
|
|
|
|
app->state = GST_STATE_NULL;
|
|
|
|
|
|
|
|
app->need_streams = TRUE;
|
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_init (&app->state_mutex);
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
app->play_rate = 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-03-02 11:01:37 +00:00
|
|
|
reset_app (PlaybackApp * app)
|
2012-02-24 10:44:53 +00:00
|
|
|
{
|
2012-03-01 09:45:51 +00:00
|
|
|
g_list_free (app->formats);
|
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
g_mutex_clear (&app->state_mutex);
|
2012-02-24 10:44:53 +00:00
|
|
|
|
2012-03-02 09:00:55 +00:00
|
|
|
if (app->overlay_element)
|
|
|
|
gst_object_unref (app->overlay_element);
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app->navigation_element)
|
|
|
|
gst_object_unref (app->navigation_element);
|
|
|
|
|
|
|
|
g_list_foreach (app->paths, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (app->paths);
|
2012-03-01 12:24:45 +00:00
|
|
|
g_list_foreach (app->sub_paths, (GFunc) g_free, NULL);
|
|
|
|
g_list_free (app->sub_paths);
|
2015-09-18 05:29:46 +00:00
|
|
|
if (app->vis_entries)
|
|
|
|
g_array_free (app->vis_entries, TRUE);
|
2012-02-24 10:44:53 +00:00
|
|
|
g_print ("free pipeline\n");
|
|
|
|
gst_object_unref (app->pipeline);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
2012-03-02 11:01:37 +00:00
|
|
|
PlaybackApp app;
|
2012-02-24 10:44:53 +00:00
|
|
|
GOptionEntry options[] = {
|
|
|
|
{"stats", 's', 0, G_OPTION_ARG_NONE, &app.stats,
|
|
|
|
"Show pad stats", NULL},
|
|
|
|
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &app.verbose,
|
|
|
|
"Verbose properties", NULL},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
GOptionContext *ctx;
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
set_defaults (&app);
|
2005-11-13 13:53:26 +00:00
|
|
|
|
2012-03-02 11:01:37 +00:00
|
|
|
ctx = g_option_context_new ("- playback testing in gsteamer");
|
2012-02-24 10:44:53 +00:00
|
|
|
g_option_context_add_main_entries (ctx, options, NULL);
|
|
|
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
|
|
|
g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
|
|
|
|
|
|
|
|
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
|
|
|
|
g_print ("Error initializing: %s\n", err->message);
|
2015-08-20 06:59:15 +00:00
|
|
|
g_option_context_free (ctx);
|
|
|
|
g_clear_error (&err);
|
2012-02-24 10:44:53 +00:00
|
|
|
exit (1);
|
|
|
|
}
|
2015-07-14 04:00:03 +00:00
|
|
|
g_option_context_free (ctx);
|
2012-03-02 11:01:37 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (playback_debug, "playback-test", 0,
|
|
|
|
"playback example");
|
2012-02-24 10:44:53 +00:00
|
|
|
|
2012-03-01 12:24:45 +00:00
|
|
|
if (argc < 3) {
|
2012-02-24 10:44:53 +00:00
|
|
|
print_usage (argc, argv);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
2014-12-15 12:12:44 +00:00
|
|
|
app.pipeline_type = -1;
|
|
|
|
if (g_ascii_isdigit (argv[1][0])) {
|
|
|
|
app.pipeline_type = atoi (argv[1]);
|
|
|
|
} else {
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (pipelines); ++i) {
|
|
|
|
if (strcmp (pipelines[i].name, argv[1]) == 0) {
|
|
|
|
app.pipeline_type = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
if (app.pipeline_type < 0 || app.pipeline_type >= G_N_ELEMENTS (pipelines)) {
|
|
|
|
print_usage (argc, argv);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
app.pipeline_spec = argv[2];
|
|
|
|
|
|
|
|
if (g_path_is_absolute (app.pipeline_spec) &&
|
|
|
|
(g_strrstr (app.pipeline_spec, "*") != NULL ||
|
|
|
|
g_strrstr (app.pipeline_spec, "?") != NULL)) {
|
|
|
|
app.paths = handle_wildcards (app.pipeline_spec);
|
|
|
|
} else {
|
|
|
|
app.paths = g_list_prepend (app.paths, g_strdup (app.pipeline_spec));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!app.paths) {
|
|
|
|
g_print ("opening %s failed\n", app.pipeline_spec);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
app.current_path = app.paths;
|
|
|
|
|
2012-03-01 12:24:45 +00:00
|
|
|
if (argc > 3 && argv[3]) {
|
|
|
|
if (g_path_is_absolute (argv[3]) &&
|
|
|
|
(g_strrstr (argv[3], "*") != NULL ||
|
|
|
|
g_strrstr (argv[3], "?") != NULL)) {
|
|
|
|
app.sub_paths = handle_wildcards (argv[3]);
|
|
|
|
} else {
|
|
|
|
app.sub_paths = g_list_prepend (app.sub_paths, g_strdup (argv[3]));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!app.sub_paths) {
|
|
|
|
g_print ("opening %s failed\n", argv[3]);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
app.current_sub_path = app.sub_paths;
|
|
|
|
}
|
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
pipelines[app.pipeline_type].func (&app, app.current_path->data);
|
2017-05-11 09:59:21 +00:00
|
|
|
if (!app.pipeline || !GST_IS_PIPELINE (app.pipeline)) {
|
|
|
|
g_print ("Pipeline failed on %s\n", argv[3]);
|
|
|
|
exit (-1);
|
|
|
|
}
|
2012-02-24 10:44:53 +00:00
|
|
|
|
|
|
|
create_ui (&app);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
|
|
|
/* show the gui. */
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_show_all (app.window);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2009-12-29 00:40:27 +00:00
|
|
|
/* realize window now so that the video window gets created and we can
|
|
|
|
* obtain its XID before the pipeline is started up and the videosink
|
|
|
|
* asks for the XID of the window to render onto */
|
2012-02-24 10:44:53 +00:00
|
|
|
gtk_widget_realize (app.window);
|
2009-12-29 00:40:27 +00:00
|
|
|
|
2012-02-20 13:35:37 +00:00
|
|
|
#if defined (GDK_WINDOWING_X11) || defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_QUARTZ)
|
2009-12-29 00:40:27 +00:00
|
|
|
/* we should have the XID now */
|
2012-02-24 10:44:53 +00:00
|
|
|
g_assert (app.embed_xid != 0);
|
2012-02-23 10:43:09 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app.pipeline_type == 0) {
|
2012-03-02 09:00:55 +00:00
|
|
|
gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (app.pipeline),
|
2012-02-24 10:44:53 +00:00
|
|
|
app.embed_xid);
|
2012-02-23 10:43:09 +00:00
|
|
|
}
|
2010-04-02 16:56:34 +00:00
|
|
|
#endif
|
2009-12-29 00:40:27 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
if (app.verbose) {
|
|
|
|
g_signal_connect (app.pipeline, "deep_notify",
|
2005-03-31 09:43:49 +00:00
|
|
|
G_CALLBACK (gst_object_default_deep_notify), NULL);
|
examples/seeking/seek.c: Added playbin seeking example.
Original commit message from CVS:
* examples/seeking/seek.c: (make_dv_pipeline), (make_avi_pipeline),
(make_mpeg_pipeline), (make_mpegnt_pipeline),
(make_playerbin_pipeline), (query_durations_elems),
(query_durations_pads), (query_positions_elems),
(query_positions_pads), (update_scale), (iterate), (stop_seek),
(main):
Added playbin seeking example.
2004-07-08 15:43:24 +00:00
|
|
|
}
|
2008-02-08 14:34:41 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
connect_bus_signals (&app);
|
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
gtk_main ();
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
g_print ("NULL pipeline\n");
|
2012-02-24 10:44:53 +00:00
|
|
|
gst_element_set_state (app.pipeline, GST_STATE_NULL);
|
2002-05-28 20:30:11 +00:00
|
|
|
|
2012-02-24 10:44:53 +00:00
|
|
|
reset_app (&app);
|
2008-06-24 16:05:06 +00:00
|
|
|
|
2002-05-28 20:30:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|