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
|
|
|
#include <stdlib.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2006-06-23 09:53:09 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (scrubby_debug);
|
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
|
|
|
#define GST_CAT_DEFAULT (scrubby_debug)
|
|
|
|
|
|
|
|
static GstElement *pipeline;
|
|
|
|
static gint64 position;
|
|
|
|
static gint64 duration;
|
|
|
|
static GtkAdjustment *adjustment;
|
|
|
|
static GtkWidget *hscale;
|
|
|
|
static GtkAdjustment *sadjustment;
|
|
|
|
static GtkWidget *shscale;
|
|
|
|
static gboolean verbose = FALSE;
|
|
|
|
|
|
|
|
static guint bus_watch = 0;
|
|
|
|
static guint update_id = 0;
|
|
|
|
static guint changed_id = 0;
|
|
|
|
static guint schanged_id = 0;
|
|
|
|
|
2011-06-14 23:52:47 +00:00
|
|
|
#define SOURCE "filesrc"
|
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
|
|
|
#define ASINK "alsasink"
|
|
|
|
//#define ASINK "osssink"
|
|
|
|
#define VSINK "xvimagesink"
|
|
|
|
//#define VSINK "ximagesink"
|
|
|
|
//#define VSINK "aasink"
|
|
|
|
//#define VSINK "cacasink"
|
|
|
|
|
|
|
|
#define RANGE_PREC 10000
|
|
|
|
#define SEGMENT_LEN 100
|
|
|
|
#define UPDATE_INTERVAL 500
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static gdouble prev_range = -1.0;
|
|
|
|
static GstClockTime prev_time = GST_CLOCK_TIME_NONE;
|
|
|
|
static gdouble cur_range;
|
|
|
|
static GstClockTime cur_time;
|
|
|
|
static GstClockTimeDiff diff;
|
|
|
|
static gdouble cur_speed = 1.0;
|
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
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const gchar *padname;
|
|
|
|
GstPad *target;
|
|
|
|
GstElement *bin;
|
|
|
|
}
|
|
|
|
dyn_link;
|
|
|
|
|
|
|
|
static GstElement *
|
2010-03-15 21:49:53 +00:00
|
|
|
gst_element_factory_make_or_warn (const gchar * type, const gchar * name)
|
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
|
|
|
{
|
|
|
|
GstElement *element = gst_element_factory_make (type, name);
|
|
|
|
|
|
|
|
if (!element) {
|
|
|
|
g_warning ("Failed to create element %s of type %s", name, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
|
|
|
|
{
|
|
|
|
dyn_link *connect = (dyn_link *) data;
|
|
|
|
|
|
|
|
if (connect->padname == NULL ||
|
|
|
|
!strcmp (gst_pad_get_name (newpad), connect->padname)) {
|
|
|
|
if (connect->bin)
|
|
|
|
gst_bin_add (GST_BIN (pipeline), connect->bin);
|
|
|
|
gst_pad_link (newpad, connect->target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
setup_dynamic_link (GstElement * element, const gchar * padname,
|
|
|
|
GstPad * target, GstElement * bin)
|
|
|
|
{
|
|
|
|
dyn_link *connect;
|
|
|
|
|
|
|
|
connect = g_new0 (dyn_link, 1);
|
|
|
|
connect->padname = g_strdup (padname);
|
|
|
|
connect->target = target;
|
|
|
|
connect->bin = bin;
|
|
|
|
|
|
|
|
g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
|
|
|
|
connect);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
make_wav_pipeline (const gchar * location)
|
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstElement *src, *decoder, *audiosink;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("app");
|
|
|
|
|
|
|
|
src = gst_element_factory_make_or_warn (SOURCE, "src");
|
|
|
|
decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
|
|
|
|
audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (src), "location", location, NULL);
|
|
|
|
|
|
|
|
gst_bin_add (GST_BIN (pipeline), src);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), decoder);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), audiosink);
|
|
|
|
|
|
|
|
gst_element_link (src, decoder);
|
|
|
|
|
Don't use bad gst_element_get_pad().
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind):
* gst/playback/decodetest.c: (new_decoded_pad_cb):
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
(try_to_link_1), (elem_is_dynamic), (close_link), (type_found),
(cleanup_decodebin):
* gst/playback/gstdecodebin2.c: (gst_decode_bin_init),
(connect_element), (gst_decode_group_control_demuxer_pad):
* gst/playback/gstplaybasebin.c: (queue_remove_probe),
(queue_out_of_data), (gen_preroll_element), (preroll_unlinked),
(mute_group_type):
* gst/playback/gstplaybin.c: (gst_play_bin_vis_blocked),
(gst_play_bin_set_property), (handoff), (gen_video_element),
(gen_text_element), (gen_audio_element), (gen_vis_element),
(remove_sinks), (add_sink), (setup_sinks):
* gst/playback/gstplaybin2.c: (pad_added_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_get_video_sink),
(gst_play_sink_get_audio_sink), (gst_play_sink_vis_unblocked),
(gst_play_sink_vis_blocked), (gst_play_sink_set_vis_plugin),
(gst_play_sink_get_vis_plugin), (gst_play_sink_set_mute),
(gen_video_chain), (gen_text_chain), (gen_audio_chain),
(gen_vis_chain), (gst_play_sink_reconfigure),
(gst_play_sink_set_font_desc), (gst_play_sink_get_font_desc),
(gst_play_sink_request_pad):
* gst/playback/gsturidecodebin.c: (type_found), (setup_source):
* gst/playback/test.c: (gen_video_element), (gen_audio_element),
(cb_newpad):
* gst/playback/test6.c: (new_decoded_pad_cb):
* tests/check/elements/audioconvert.c: (GST_START_TEST):
* tests/check/elements/audiorate.c: (test_injector_chain),
(do_perfect_stream_test):
* tests/check/elements/ffmpegcolorspace.c: (GST_START_TEST):
* tests/check/elements/gdpdepay.c: (GST_START_TEST):
* tests/check/elements/gnomevfssink.c:
* tests/check/elements/textoverlay.c:
(notgst_check_setup_src_pad2), (notgst_check_teardown_src_pad2):
* tests/check/elements/videotestsrc.c: (GST_START_TEST):
* tests/check/libs/cddabasesrc.c: (GST_START_TEST):
* tests/check/pipelines/oggmux.c: (test_pipeline):
* tests/check/pipelines/streamheader.c: (GST_START_TEST):
* tests/check/pipelines/theoraenc.c: (GST_START_TEST):
* tests/check/pipelines/vorbisenc.c: (GST_START_TEST):
* tests/examples/seek/scrubby.c: (make_wav_pipeline):
* tests/examples/seek/seek.c: (make_mod_pipeline),
(make_dv_pipeline), (make_wav_pipeline), (make_flac_pipeline),
(make_sid_pipeline), (make_parse_pipeline), (make_vorbis_pipeline),
(make_theora_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline),
(update_fill), (msg_buffering):
Don't use bad gst_element_get_pad().
2008-05-21 16:36:50 +00:00
|
|
|
setup_dynamic_link (decoder, "src", gst_element_get_static_pad (audiosink,
|
|
|
|
"sink"), NULL);
|
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
|
|
|
|
|
|
|
return pipeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstElement *
|
|
|
|
make_playerbin_pipeline (const gchar * location)
|
|
|
|
{
|
|
|
|
GstElement *player;
|
|
|
|
|
|
|
|
player = gst_element_factory_make ("playbin", "player");
|
|
|
|
g_assert (player);
|
|
|
|
|
|
|
|
g_object_set (G_OBJECT (player), "uri", location, NULL);
|
|
|
|
|
|
|
|
return player;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
format_value (GtkScale * scale, gdouble value)
|
|
|
|
{
|
|
|
|
gint64 real;
|
|
|
|
gint64 seconds;
|
|
|
|
gint64 subseconds;
|
|
|
|
|
|
|
|
real = value * duration / RANGE_PREC;
|
|
|
|
seconds = (gint64) real / GST_SECOND;
|
|
|
|
subseconds = (gint64) real / (GST_SECOND / RANGE_PREC);
|
|
|
|
|
|
|
|
return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
|
|
|
|
G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
update_scale (gpointer data)
|
|
|
|
{
|
|
|
|
position = 0;
|
|
|
|
duration = 0;
|
|
|
|
|
2011-07-27 00:18:19 +00:00
|
|
|
gst_element_query_position (pipeline, GST_FORMAT_TIME, &position);
|
|
|
|
gst_element_query_duration (pipeline, GST_FORMAT_TIME, &duration);
|
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
|
|
|
|
|
|
|
if (position >= duration)
|
|
|
|
duration = position;
|
|
|
|
|
|
|
|
if (duration > 0) {
|
|
|
|
gtk_adjustment_set_value (adjustment,
|
|
|
|
position * (gdouble) RANGE_PREC / duration);
|
|
|
|
gtk_widget_queue_draw (hscale);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
speed_cb (GtkWidget * widget)
|
|
|
|
{
|
|
|
|
GstEvent *s_event;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
GST_DEBUG ("speed change");
|
|
|
|
cur_speed = gtk_range_get_value (GTK_RANGE (widget));
|
|
|
|
|
2006-10-18 13:42:49 +00:00
|
|
|
if (cur_speed == 0.0)
|
|
|
|
return;
|
|
|
|
|
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
|
|
|
s_event = gst_event_new_seek (cur_speed,
|
|
|
|
GST_FORMAT_TIME, 0, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_NONE, -1);
|
|
|
|
|
|
|
|
res = gst_element_send_event (pipeline, s_event);
|
|
|
|
if (!res)
|
|
|
|
g_print ("speed change failed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean do_seek (GtkWidget * widget, gboolean flush, gboolean segment);
|
|
|
|
|
|
|
|
static void
|
|
|
|
seek_cb (GtkWidget * widget)
|
|
|
|
{
|
|
|
|
if (changed_id) {
|
|
|
|
GST_DEBUG ("seek because of slider move");
|
|
|
|
|
|
|
|
if (do_seek (widget, TRUE, TRUE)) {
|
|
|
|
g_source_remove (changed_id);
|
|
|
|
changed_id = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
do_seek (GtkWidget * widget, gboolean flush, gboolean segment)
|
|
|
|
{
|
|
|
|
gint64 start, stop;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
GstEvent *s_event;
|
|
|
|
gdouble rate;
|
|
|
|
GTimeVal tv;
|
|
|
|
gboolean valid;
|
|
|
|
gdouble new_range;
|
|
|
|
|
|
|
|
if (segment)
|
|
|
|
new_range = gtk_range_get_value (GTK_RANGE (widget));
|
|
|
|
else {
|
|
|
|
new_range = (gdouble) RANGE_PREC;
|
|
|
|
cur_time = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
valid = prev_time != -1;
|
|
|
|
|
|
|
|
GST_DEBUG ("flush %d, segment %d, valid %d", flush, segment, valid);
|
|
|
|
|
|
|
|
if (new_range == cur_range)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
prev_time = cur_time;
|
|
|
|
prev_range = cur_range;
|
|
|
|
|
|
|
|
cur_range = new_range;
|
|
|
|
|
|
|
|
g_get_current_time (&tv);
|
|
|
|
cur_time = GST_TIMEVAL_TO_TIME (tv);
|
|
|
|
|
|
|
|
if (!valid)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
GST_DEBUG ("cur: %lf, %" GST_TIME_FORMAT, cur_range,
|
|
|
|
GST_TIME_ARGS (cur_time));
|
|
|
|
GST_DEBUG ("prev: %lf, %" GST_TIME_FORMAT, prev_range,
|
|
|
|
GST_TIME_ARGS (prev_time));
|
|
|
|
|
|
|
|
diff = cur_time - prev_time;
|
|
|
|
|
|
|
|
GST_DEBUG ("diff: %" GST_TIME_FORMAT, GST_TIME_ARGS (diff));
|
|
|
|
|
|
|
|
start = prev_range * duration / RANGE_PREC;
|
|
|
|
/* play 50 milliseconds */
|
|
|
|
stop = segment ? cur_range * duration / RANGE_PREC : duration;
|
|
|
|
|
|
|
|
if (start == stop)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (segment)
|
|
|
|
rate = (stop - start) / (gdouble) diff;
|
|
|
|
else
|
|
|
|
rate = cur_speed;
|
|
|
|
|
|
|
|
if (start > stop) {
|
|
|
|
gint64 tmp;
|
|
|
|
|
|
|
|
tmp = start;
|
|
|
|
start = stop;
|
|
|
|
stop = tmp;
|
|
|
|
}
|
|
|
|
|
2006-10-18 13:42:49 +00:00
|
|
|
if (rate == 0.0)
|
|
|
|
return TRUE;
|
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
|
|
|
|
|
|
|
GST_DEBUG ("seek to %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", rate %lf"
|
|
|
|
" on element %s",
|
|
|
|
GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate,
|
|
|
|
GST_ELEMENT_NAME (pipeline));
|
|
|
|
|
|
|
|
s_event = gst_event_new_seek (rate,
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
(flush ? GST_SEEK_FLAG_FLUSH : 0) |
|
|
|
|
(segment ? GST_SEEK_FLAG_SEGMENT : 0),
|
|
|
|
GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop);
|
|
|
|
|
|
|
|
res = gst_element_send_event (pipeline, s_event);
|
|
|
|
if (!res)
|
|
|
|
g_print ("seek failed\n");
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
|
|
|
|
{
|
|
|
|
if (update_id) {
|
|
|
|
g_source_remove (update_id);
|
|
|
|
update_id = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (changed_id == 0) {
|
2009-11-06 11:25:05 +00:00
|
|
|
changed_id =
|
|
|
|
g_signal_connect (hscale, "value_changed", G_CALLBACK (seek_cb),
|
|
|
|
pipeline);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("start seek");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
stop_seek (GtkWidget * widget, gpointer user_data)
|
|
|
|
{
|
|
|
|
update_id =
|
2011-01-11 14:41:53 +00:00
|
|
|
g_timeout_add (UPDATE_INTERVAL, (GSourceFunc) update_scale, pipeline);
|
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
|
|
|
|
|
|
|
GST_DEBUG ("stop seek");
|
|
|
|
|
|
|
|
if (changed_id) {
|
|
|
|
g_source_remove (changed_id);
|
|
|
|
changed_id = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
do_seek (hscale, FALSE, FALSE);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
play_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
GstState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
|
|
|
|
if (state != GST_STATE_PLAYING) {
|
|
|
|
g_print ("PLAY pipeline\n");
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
update_id =
|
2011-01-11 14:41:53 +00:00
|
|
|
g_timeout_add (UPDATE_INTERVAL, (GSourceFunc) update_scale, pipeline);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pause_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
GstState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
|
|
|
|
if (state != GST_STATE_PAUSED) {
|
|
|
|
g_print ("PAUSE pipeline\n");
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
|
|
|
g_source_remove (update_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
stop_cb (GtkButton * button, gpointer data)
|
|
|
|
{
|
|
|
|
GstState state;
|
|
|
|
|
|
|
|
gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
|
|
|
|
if (state != GST_STATE_READY) {
|
|
|
|
g_print ("READY pipeline\n");
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
2007-05-09 11:25:34 +00:00
|
|
|
/* position and speed return to their default values */
|
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
|
|
|
gtk_adjustment_set_value (adjustment, 0.0);
|
2007-05-09 11:25:34 +00:00
|
|
|
gtk_adjustment_set_value (sadjustment, 1.0);
|
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
|
|
|
g_source_remove (update_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_message (GstMessage * message)
|
|
|
|
{
|
|
|
|
const GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_message_get_structure (message);
|
|
|
|
g_print ("Got Message from element \"%s\"\n",
|
|
|
|
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
|
|
|
|
|
|
|
|
if (s) {
|
|
|
|
gchar *sstr;
|
|
|
|
|
|
|
|
sstr = gst_structure_to_string (s);
|
|
|
|
g_print ("%s\n", sstr);
|
|
|
|
g_free (sstr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
bus_message (GstBus * bus, GstMessage * message, gpointer data)
|
|
|
|
{
|
|
|
|
switch (GST_MESSAGE_TYPE (message)) {
|
|
|
|
case GST_MESSAGE_EOS:
|
|
|
|
g_print ("EOS\n");
|
|
|
|
break;
|
|
|
|
case GST_MESSAGE_ERROR:
|
|
|
|
case GST_MESSAGE_WARNING:
|
|
|
|
print_message (message);
|
|
|
|
break;
|
|
|
|
case GST_MESSAGE_SEGMENT_START:
|
|
|
|
break;
|
|
|
|
case GST_MESSAGE_SEGMENT_DONE:
|
|
|
|
GST_DEBUG ("segment_done, doing next seek");
|
|
|
|
if (!do_seek (hscale, FALSE, update_id == 0)) {
|
|
|
|
if (changed_id == 0) {
|
2009-11-06 11:25:05 +00:00
|
|
|
changed_id =
|
|
|
|
g_signal_connect (hscale, "value_changed", G_CALLBACK (seek_cb),
|
|
|
|
pipeline);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-15 21:49:53 +00:00
|
|
|
const gchar *name;
|
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
|
|
|
GstElement *(*func) (const gchar * location);
|
|
|
|
}
|
|
|
|
Pipeline;
|
|
|
|
|
|
|
|
static Pipeline pipelines[] = {
|
|
|
|
{"wav", make_wav_pipeline},
|
|
|
|
{"playerbin", make_playerbin_pipeline},
|
|
|
|
{NULL, NULL},
|
|
|
|
};
|
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
|
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
|
|
|
|
|
|
|
static void
|
|
|
|
print_usage (int argc, char **argv)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_print ("usage: %s <type> <filename>\n", argv[0]);
|
|
|
|
g_print (" possible types:\n");
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_TYPES; i++) {
|
|
|
|
g_print (" %d = %s\n", i, pipelines[i].name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
|
|
|
|
GstBus *bus;
|
|
|
|
GOptionEntry options[] = {
|
|
|
|
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
|
|
|
"Verbose properties", NULL},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
gint type;
|
|
|
|
GOptionContext *ctx;
|
|
|
|
GError *err = NULL;
|
|
|
|
|
2007-01-05 16:02:50 +00:00
|
|
|
if (!g_thread_supported ())
|
|
|
|
g_thread_init (NULL);
|
|
|
|
|
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
|
|
|
ctx = g_option_context_new ("seek");
|
|
|
|
g_option_context_add_main_entries (ctx, options, NULL);
|
|
|
|
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
|
|
|
|
|
|
|
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
|
|
|
|
g_print ("Error initializing: %s\n", err->message);
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (scrubby_debug, "scrubby", 0, "scrubby example");
|
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
|
|
|
if (argc != 3) {
|
|
|
|
print_usage (argc, argv);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
type = atoi (argv[1]);
|
|
|
|
|
|
|
|
if (type < 0 || type >= NUM_TYPES) {
|
|
|
|
print_usage (argc, argv);
|
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
pipeline = pipelines[type].func (argv[2]);
|
|
|
|
g_assert (pipeline);
|
|
|
|
|
|
|
|
/* initialize gui elements ... */
|
|
|
|
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
hbox = gtk_hbox_new (FALSE, 0);
|
|
|
|
vbox = gtk_vbox_new (FALSE, 0);
|
|
|
|
play_button = gtk_button_new_with_label ("play");
|
|
|
|
pause_button = gtk_button_new_with_label ("pause");
|
|
|
|
stop_button = gtk_button_new_with_label ("stop");
|
|
|
|
|
|
|
|
adjustment =
|
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, (gdouble) RANGE_PREC, 0.1,
|
|
|
|
1.0, 1.0));
|
|
|
|
hscale = gtk_hscale_new (adjustment);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (hscale), 2);
|
|
|
|
|
|
|
|
sadjustment =
|
2007-05-09 11:25:34 +00:00
|
|
|
GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 0.0, 5.0, 0.1, 1.0, 0.0));
|
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
|
|
|
shscale = gtk_hscale_new (sadjustment);
|
|
|
|
gtk_scale_set_digits (GTK_SCALE (shscale), 2);
|
|
|
|
|
2009-11-06 11:25:05 +00:00
|
|
|
schanged_id =
|
|
|
|
g_signal_connect (shscale, "value_changed", G_CALLBACK (speed_cb),
|
|
|
|
pipeline);
|
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
|
|
|
|
2009-11-06 11:25:05 +00:00
|
|
|
g_signal_connect (hscale, "button_press_event", G_CALLBACK (start_seek),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (hscale, "button_release_event", G_CALLBACK (stop_seek),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (hscale, "format_value", G_CALLBACK (format_value),
|
|
|
|
pipeline);
|
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
|
|
|
|
|
|
|
/* do the packing stuff ... */
|
|
|
|
gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
|
|
|
|
gtk_container_add (GTK_CONTAINER (window), vbox);
|
|
|
|
gtk_container_add (GTK_CONTAINER (vbox), hbox);
|
|
|
|
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);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), shscale, TRUE, TRUE, 2);
|
|
|
|
|
|
|
|
/* connect things ... */
|
|
|
|
g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
|
|
|
|
pipeline);
|
|
|
|
g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
|
|
|
|
|
|
|
|
/* show the gui. */
|
|
|
|
gtk_widget_show_all (window);
|
|
|
|
|
|
|
|
if (verbose) {
|
|
|
|
g_signal_connect (pipeline, "deep_notify",
|
|
|
|
G_CALLBACK (gst_object_default_deep_notify), NULL);
|
|
|
|
}
|
|
|
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
|
|
|
g_assert (bus);
|
|
|
|
|
|
|
|
bus_watch = gst_bus_add_watch_full (bus,
|
2005-12-12 13:03:50 +00:00
|
|
|
G_PRIORITY_HIGH, bus_message, pipeline, NULL);
|
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
|
|
|
|
|
|
|
gtk_main ();
|
|
|
|
|
|
|
|
g_print ("NULL pipeline\n");
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
|
|
|
|
|
|
|
g_print ("free pipeline\n");
|
|
|
|
gst_object_unref (pipeline);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|