seek.c 40.7 KB
Newer Older
1
#include <stdlib.h>
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
2 3 4 5 6
#include <glib.h>
#include <gtk/gtk.h>
#include <gst/gst.h>
#include <string.h>

7 8 9
GST_DEBUG_CATEGORY (seek_debug);
#define GST_CAT_DEFAULT (seek_debug)

10
static GList *seekable_pads = NULL;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
11
static GList *rate_pads = NULL;
12
static GList *seekable_elements = NULL;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
13

14 15 16
static gboolean accurate_seek = FALSE;
static gboolean keyframe_seek = FALSE;

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
17
static GstElement *pipeline;
Wim Taymans's avatar
Wim Taymans committed
18 19
static gint64 position;
static gint64 duration;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
20
static GtkAdjustment *adjustment;
21
static GtkWidget *hscale;
22
static gboolean stats = FALSE;
23 24
static gboolean elem_seek = FALSE;
static gboolean verbose = FALSE;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
25

26 27
static GstState state;
static guint update_id = 0;
28 29
static guint seek_timeout_id = 0;
static gulong changed_id;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
30

Wim Taymans's avatar
Wim Taymans committed
31
//#define SOURCE "filesrc"
32
#define SOURCE "gnomevfssrc"
33 34
#define ASINK "alsasink"
//#define ASINK "osssink"
Wim Taymans's avatar
Wim Taymans committed
35
#define VSINK "xvimagesink"
36
//#define VSINK "sdlvideosink"
Wim Taymans's avatar
Wim Taymans committed
37 38
//#define VSINK "ximagesink"
//#define VSINK "aasink"
39
//#define VSINK "cacasink"
40

41 42
//#define UPDATE_INTERVAL 500
#define UPDATE_INTERVAL 100
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
43

44
/* number of milliseconds to play for after a seek */
Wim Taymans's avatar
Wim Taymans committed
45 46
//#define SCRUB_TIME 250
//#define SCRUB
47

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
48
#define THREAD
49
#define PAD_SEEK
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
50 51 52

typedef struct
{
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
53 54 55
  const gchar *padname;
  GstPad *target;
  GstElement *bin;
56 57
}
dyn_link;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
58

59
static GstElement *
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
60
gst_element_factory_make_or_warn (gchar * type, gchar * name)
61 62 63 64
{
  GstElement *element = gst_element_factory_make (type, name);

  if (!element) {
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
65
    g_warning ("Failed to create element %s of type %s", name, type);
66 67 68 69 70
  }

  return element;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
71
static void
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
72
dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
73
{
74
  gchar *padname;
75
  dyn_link *connect = (dyn_link *) data;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
76

77 78 79
  padname = gst_pad_get_name (newpad);

  if (connect->padname == NULL || !strcmp (padname, connect->padname)) {
80 81
    if (connect->bin)
      gst_bin_add (GST_BIN (pipeline), connect->bin);
82
    gst_pad_link (newpad, connect->target);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
83

84
    //seekable_pads = g_list_prepend (seekable_pads, newpad);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
85 86
    rate_pads = g_list_prepend (rate_pads, newpad);
  }
87
  g_free (padname);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
88 89 90
}

static void
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
91 92
setup_dynamic_link (GstElement * element, const gchar * padname,
    GstPad * target, GstElement * bin)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
93
{
94
  dyn_link *connect;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
95

96
  connect = g_new0 (dyn_link, 1);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
97 98 99
  connect->padname = g_strdup (padname);
  connect->target = target;
  connect->bin = bin;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
100

101
  g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
102
      connect);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
103 104
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
105 106
static GstElement *
make_mod_pipeline (const gchar * location)
107 108 109 110
{
  GstElement *pipeline;
  GstElement *src, *decoder, *audiosink;
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
111

112 113
  pipeline = gst_pipeline_new ("app");

114 115
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  decoder = gst_element_factory_make_or_warn ("modplug", "decoder");
116
  audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
117 118 119 120 121 122 123 124
  //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);

  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);

125 126
  gst_element_link (src, decoder);
  gst_element_link (decoder, audiosink);
127 128 129 130 131 132 133 134 135

  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
136 137
static GstElement *
make_dv_pipeline (const gchar * location)
Wim Taymans's avatar
Wim Taymans committed
138 139
{
  GstElement *pipeline;
140
  GstElement *src, *demux, *decoder, *audiosink, *videosink;
141
  GstElement *a_queue, *v_queue;
Wim Taymans's avatar
Wim Taymans committed
142
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
143

Wim Taymans's avatar
Wim Taymans committed
144 145 146
  pipeline = gst_pipeline_new ("app");

  src = gst_element_factory_make_or_warn (SOURCE, "src");
147
  demux = gst_element_factory_make_or_warn ("dvdemux", "demuxer");
148
  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
149 150
  decoder = gst_element_factory_make_or_warn ("ffdec_dvvideo", "decoder");
  videosink = gst_element_factory_make_or_warn ("xvimagesink", "v_sink");
151
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
152
  audiosink = gst_element_factory_make_or_warn ("alsasink", "a_sink");
Wim Taymans's avatar
Wim Taymans committed
153 154 155 156

  g_object_set (G_OBJECT (src), "location", location, NULL);

  gst_bin_add (GST_BIN (pipeline), src);
157
  gst_bin_add (GST_BIN (pipeline), demux);
158
  gst_bin_add (GST_BIN (pipeline), a_queue);
Wim Taymans's avatar
Wim Taymans committed
159
  gst_bin_add (GST_BIN (pipeline), audiosink);
160
  gst_bin_add (GST_BIN (pipeline), v_queue);
161
  gst_bin_add (GST_BIN (pipeline), decoder);
Wim Taymans's avatar
Wim Taymans committed
162 163
  gst_bin_add (GST_BIN (pipeline), videosink);

164
  gst_element_link (src, demux);
165
  gst_element_link (a_queue, audiosink);
166 167
  gst_element_link (v_queue, decoder);
  gst_element_link (decoder, videosink);
Wim Taymans's avatar
Wim Taymans committed
168

169 170 171 172
  setup_dynamic_link (demux, "video", gst_element_get_pad (v_queue, "sink"),
      NULL);
  setup_dynamic_link (demux, "audio", gst_element_get_pad (a_queue, "sink"),
      NULL);
173

174 175
  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Wim Taymans's avatar
Wim Taymans committed
176 177 178 179 180
  rate_pads = g_list_prepend (rate_pads, seekable);

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
181 182
static GstElement *
make_wav_pipeline (const gchar * location)
Wim Taymans's avatar
Wim Taymans committed
183 184 185
{
  GstElement *pipeline;
  GstElement *src, *decoder, *audiosink;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
186

Wim Taymans's avatar
Wim Taymans committed
187 188
  pipeline = gst_pipeline_new ("app");

189 190
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
191
  audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
Wim Taymans's avatar
Wim Taymans committed
192 193 194 195 196 197 198

  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);

199
  gst_element_link (src, decoder);
Wim Taymans's avatar
Wim Taymans committed
200

201 202 203 204 205 206 207
  setup_dynamic_link (decoder, "src", gst_element_get_pad (audiosink, "sink"),
      NULL);

  seekable_elements = g_list_prepend (seekable_elements, audiosink);

  /* force element seeking on this pipeline */
  elem_seek = TRUE;
Wim Taymans's avatar
Wim Taymans committed
208 209 210 211

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
212 213
static GstElement *
make_flac_pipeline (const gchar * location)
214 215 216 217
{
  GstElement *pipeline;
  GstElement *src, *decoder, *audiosink;
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
218

219 220
  pipeline = gst_pipeline_new ("app");

221 222
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  decoder = gst_element_factory_make_or_warn ("flacdec", "decoder");
223
  audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
Wim Taymans's avatar
Wim Taymans committed
224
  g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
225 226 227 228 229 230 231

  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);

232 233
  gst_element_link (src, decoder);
  gst_element_link (decoder, audiosink);
234 235 236 237 238 239 240 241 242

  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
243 244
static GstElement *
make_sid_pipeline (const gchar * location)
245 246 247 248
{
  GstElement *pipeline;
  GstElement *src, *decoder, *audiosink;
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
249

250 251
  pipeline = gst_pipeline_new ("app");

252 253
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  decoder = gst_element_factory_make_or_warn ("siddec", "decoder");
254
  audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
255 256 257 258 259 260 261 262
  //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);

  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);

263 264
  gst_element_link (src, decoder);
  gst_element_link (decoder, audiosink);
265 266 267 268 269 270 271 272 273

  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
274 275
static GstElement *
make_parse_pipeline (const gchar * location)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
276 277 278 279
{
  GstElement *pipeline;
  GstElement *src, *parser, *fakesink;
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
280

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
281 282
  pipeline = gst_pipeline_new ("app");

283 284 285
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
  fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
Wim Taymans's avatar
Wim Taymans committed
286 287
  g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
  g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
288 289 290 291 292 293 294

  g_object_set (G_OBJECT (src), "location", location, NULL);

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), parser);
  gst_bin_add (GST_BIN (pipeline), fakesink);

295 296
  gst_element_link (src, parser);
  gst_element_link (parser, fakesink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
297 298

  seekable = gst_element_get_pad (parser, "src");
299
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
300 301 302 303 304 305
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (parser, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
306 307
static GstElement *
make_vorbis_pipeline (const gchar * location)
308
{
309 310
  GstElement *pipeline, *audio_bin;
  GstElement *src, *demux, *decoder, *convert, *audiosink;
311
  GstPad *pad, *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
312

313 314
  pipeline = gst_pipeline_new ("app");

315
  src = gst_element_factory_make_or_warn (SOURCE, "src");
316 317 318
  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
  decoder = gst_element_factory_make_or_warn ("vorbisdec", "decoder");
  convert = gst_element_factory_make_or_warn ("audioconvert", "convert");
319
  audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
Wim Taymans's avatar
Wim Taymans committed
320
  g_object_set (G_OBJECT (audiosink), "sync", TRUE, NULL);
321 322 323

  g_object_set (G_OBJECT (src), "location", location, NULL);

324 325
  audio_bin = gst_bin_new ("a_decoder_bin");

326
  gst_bin_add (GST_BIN (pipeline), src);
327 328 329 330 331
  gst_bin_add (GST_BIN (pipeline), demux);
  gst_bin_add (GST_BIN (audio_bin), decoder);
  gst_bin_add (GST_BIN (audio_bin), convert);
  gst_bin_add (GST_BIN (audio_bin), audiosink);
  gst_bin_add (GST_BIN (pipeline), audio_bin);
332

333 334 335 336
  gst_element_link (src, demux);
  gst_element_link (decoder, convert);
  gst_element_link (convert, audiosink);

337 338 339 340 341 342
  pad = gst_element_get_pad (decoder, "sink");
  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
      NULL);
343 344 345 346 347 348 349 350 351 352 353 354 355 356

  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

static GstElement *
make_theora_pipeline (const gchar * location)
{
  GstElement *pipeline, *video_bin;
  GstElement *src, *demux, *decoder, *convert, *videosink;
357
  GstPad *pad, *seekable;
358 359 360 361 362 363 364

  pipeline = gst_pipeline_new ("app");

  src = gst_element_factory_make_or_warn (SOURCE, "src");
  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
  decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
  convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
Wim Taymans's avatar
Wim Taymans committed
365
  videosink = gst_element_factory_make_or_warn (VSINK, "sink");
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381

  g_object_set (G_OBJECT (src), "location", location, NULL);

  video_bin = gst_bin_new ("v_decoder_bin");

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
  gst_bin_add (GST_BIN (video_bin), decoder);
  gst_bin_add (GST_BIN (video_bin), convert);
  gst_bin_add (GST_BIN (video_bin), videosink);
  gst_bin_add (GST_BIN (pipeline), video_bin);

  gst_element_link (src, demux);
  gst_element_link (decoder, convert);
  gst_element_link (convert, videosink);

382 383 384 385 386 387
  pad = gst_element_get_pad (decoder, "sink");
  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
      NULL);
388 389 390 391 392 393 394 395 396

  seekable = gst_element_get_pad (decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

397 398 399 400 401 402 403 404
static GstElement *
make_vorbis_theora_pipeline (const gchar * location)
{
  GstElement *pipeline, *audio_bin, *video_bin;
  GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
  GstElement *audiosink, *videosink;
  GstElement *a_queue, *v_queue;
  GstPad *seekable;
Wim Taymans's avatar
Wim Taymans committed
405
  GstPad *pad;
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421

  pipeline = gst_pipeline_new ("app");

  src = gst_element_factory_make_or_warn (SOURCE, "src");
  g_object_set (G_OBJECT (src), "location", location, NULL);

  demux = gst_element_factory_make_or_warn ("oggdemux", "demux");

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
  gst_element_link (src, demux);

  audio_bin = gst_bin_new ("a_decoder_bin");
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
  a_decoder = gst_element_factory_make_or_warn ("vorbisdec", "a_dec");
  a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
422
  audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
423

424
  gst_bin_add (GST_BIN (pipeline), audio_bin);
425 426 427 428 429 430

  gst_bin_add (GST_BIN (audio_bin), a_queue);
  gst_bin_add (GST_BIN (audio_bin), a_decoder);
  gst_bin_add (GST_BIN (audio_bin), a_convert);
  gst_bin_add (GST_BIN (audio_bin), audiosink);

431 432 433
  gst_element_link (a_queue, a_decoder);
  gst_element_link (a_decoder, a_convert);
  gst_element_link (a_convert, audiosink);
434

Wim Taymans's avatar
Wim Taymans committed
435 436
  pad = gst_element_get_pad (a_queue, "sink");
  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
437
  gst_object_unref (pad);
438 439 440

  setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
      NULL);
441 442 443 444 445 446

  video_bin = gst_bin_new ("v_decoder_bin");
  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
  v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
  v_convert =
      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
Wim Taymans's avatar
Wim Taymans committed
447
  videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
448 449

  gst_bin_add (GST_BIN (pipeline), video_bin);
450 451 452 453 454 455

  gst_bin_add (GST_BIN (video_bin), v_queue);
  gst_bin_add (GST_BIN (video_bin), v_decoder);
  gst_bin_add (GST_BIN (video_bin), v_convert);
  gst_bin_add (GST_BIN (video_bin), videosink);

456
  gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
457

Wim Taymans's avatar
Wim Taymans committed
458 459
  pad = gst_element_get_pad (v_queue, "sink");
  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
460
  gst_object_unref (pad);
461 462 463

  setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
      NULL);
464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480

  seekable = gst_element_get_pad (a_decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));

  return pipeline;
}

static GstElement *
make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
{
  GstElement *pipeline, *audio_bin, *video_bin;
  GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
  GstElement *audiosink, *videosink;
  GstElement *a_queue, *v_queue;
481
  GstPad *seekable, *pad;
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497

  pipeline = gst_pipeline_new ("app");

  src = gst_element_factory_make_or_warn (SOURCE, "src");
  g_object_set (G_OBJECT (src), "location", location, NULL);

  demux = gst_element_factory_make_or_warn ("avidemux", "demux");

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
  gst_element_link (src, demux);

  audio_bin = gst_bin_new ("a_decoder_bin");
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
  a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
498
  audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
499 500 501 502 503 504

  gst_bin_add (GST_BIN (audio_bin), a_queue);
  gst_bin_add (GST_BIN (audio_bin), a_decoder);
  gst_bin_add (GST_BIN (audio_bin), a_convert);
  gst_bin_add (GST_BIN (audio_bin), audiosink);

505 506 507 508
  gst_element_link (a_queue, a_decoder);
  gst_element_link (a_decoder, a_convert);
  gst_element_link (a_convert, audiosink);

509 510
  gst_bin_add (GST_BIN (pipeline), audio_bin);

511 512 513 514 515 516
  pad = gst_element_get_pad (a_queue, "sink");
  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
      NULL);
517 518 519 520 521 522

  video_bin = gst_bin_new ("v_decoder_bin");
  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
  v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
  v_convert =
      gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
Wim Taymans's avatar
Wim Taymans committed
523
  videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
524 525 526 527 528 529

  gst_bin_add (GST_BIN (video_bin), v_queue);
  gst_bin_add (GST_BIN (video_bin), v_decoder);
  gst_bin_add (GST_BIN (video_bin), v_convert);
  gst_bin_add (GST_BIN (video_bin), videosink);

530 531
  gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);

532 533
  gst_bin_add (GST_BIN (pipeline), video_bin);

534 535 536 537 538 539
  pad = gst_element_get_pad (v_queue, "sink");
  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
      NULL);
540 541 542 543 544 545 546 547 548 549

  seekable = gst_element_get_pad (a_decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
550 551
static GstElement *
make_mp3_pipeline (const gchar * location)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
552 553
{
  GstElement *pipeline;
554
  GstElement *src, *decoder, *osssink, *queue;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
555
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
556

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
557 558
  pipeline = gst_pipeline_new ("app");

559 560 561
  src = gst_element_factory_make_or_warn (SOURCE, "src");
  decoder = gst_element_factory_make_or_warn ("mad", "dec");
  queue = gst_element_factory_make_or_warn ("queue", "queue");
562
  osssink = gst_element_factory_make_or_warn (ASINK, "sink");
563

564
  seekable_elements = g_list_prepend (seekable_elements, osssink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
565 566

  g_object_set (G_OBJECT (src), "location", location, NULL);
567
  //g_object_set (G_OBJECT (osssink), "fragment", 0x00180008, NULL);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
568

569 570
  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), decoder);
571 572
  gst_bin_add (GST_BIN (pipeline), queue);
  gst_bin_add (GST_BIN (pipeline), osssink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
573

574 575
  gst_element_link (src, decoder);
  gst_element_link (decoder, queue);
576
  gst_element_link (queue, osssink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
577

578 579
  seekable = gst_element_get_pad (queue, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
580 581 582 583 584 585
  rate_pads = g_list_prepend (rate_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
586 587
static GstElement *
make_avi_pipeline (const gchar * location)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
588 589 590
{
  GstElement *pipeline, *audio_bin, *video_bin;
  GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
591
  GstElement *a_queue = NULL, *v_queue = NULL;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
592
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
593

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
594 595
  pipeline = gst_pipeline_new ("app");

596
  src = gst_element_factory_make_or_warn (SOURCE, "src");
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
597 598
  g_object_set (G_OBJECT (src), "location", location, NULL);

599
  demux = gst_element_factory_make_or_warn ("avidemux", "demux");
600
  seekable_elements = g_list_prepend (seekable_elements, demux);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
601 602 603

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
604
  gst_element_link (src, demux);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
605 606

  audio_bin = gst_bin_new ("a_decoder_bin");
607
  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
608
  audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
609
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
610 611
  gst_element_link (a_decoder, a_queue);
  gst_element_link (a_queue, audiosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
612
  gst_bin_add (GST_BIN (audio_bin), a_decoder);
613 614
  gst_bin_add (GST_BIN (audio_bin), a_queue);
  gst_bin_add (GST_BIN (audio_bin), audiosink);
Wim Taymans's avatar
Wim Taymans committed
615
  gst_element_set_state (audio_bin, GST_STATE_PAUSED);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
616

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
617
  setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
618
          "sink"), audio_bin);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
619 620

  seekable = gst_element_get_pad (a_queue, "src");
621
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
622
  rate_pads = g_list_prepend (rate_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
623 624
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
625 626

  video_bin = gst_bin_new ("v_decoder_bin");
Wim Taymans's avatar
Wim Taymans committed
627
  v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
628
  videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
629
  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
630 631
  gst_element_link (v_decoder, v_queue);
  gst_element_link (v_queue, videosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
632
  gst_bin_add (GST_BIN (video_bin), v_decoder);
633 634
  gst_bin_add (GST_BIN (video_bin), v_queue);
  gst_bin_add (GST_BIN (video_bin), videosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
635

Wim Taymans's avatar
Wim Taymans committed
636
  gst_element_set_state (video_bin, GST_STATE_PAUSED);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
637

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
638
  setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
639
          "sink"), video_bin);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
640 641

  seekable = gst_element_get_pad (v_queue, "src");
642
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
643
  rate_pads = g_list_prepend (rate_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
644 645
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
646 647 648 649

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
650 651
static GstElement *
make_mpeg_pipeline (const gchar * location)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
652 653
{
  GstElement *pipeline, *audio_bin, *video_bin;
654 655
  GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
  GstElement *audiosink, *videosink;
656
  GstElement *a_queue, *v_queue;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
657
  GstPad *seekable;
658
  GstPad *pad;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
659

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
660 661
  pipeline = gst_pipeline_new ("app");

662
  src = gst_element_factory_make_or_warn (SOURCE, "src");
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
663 664
  g_object_set (G_OBJECT (src), "location", location, NULL);

665 666
  //demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
  demux = gst_element_factory_make_or_warn ("flupsdemux", "demux");
667

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
668 669
  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
670
  gst_element_link (src, demux);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
671 672

  audio_bin = gst_bin_new ("a_decoder_bin");
673 674
  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
675
  audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
676
  gst_bin_add (GST_BIN (audio_bin), a_decoder);
677 678
  gst_bin_add (GST_BIN (audio_bin), a_queue);
  gst_bin_add (GST_BIN (audio_bin), audiosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
679

680 681
  gst_element_link (a_decoder, a_queue);
  gst_element_link (a_queue, audiosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
682

683 684 685 686 687 688 689 690
  gst_bin_add (GST_BIN (pipeline), audio_bin);

  pad = gst_element_get_pad (a_decoder, "sink");
  gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, "audio_c0", gst_element_get_pad (audio_bin,
          "sink"), NULL);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
691 692

  video_bin = gst_bin_new ("v_decoder_bin");
693 694
  v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
  v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
695
  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
696
  videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
697

698 699 700 701 702 703 704
  gst_bin_add (GST_BIN (video_bin), v_decoder);
  gst_bin_add (GST_BIN (video_bin), v_queue);
  gst_bin_add (GST_BIN (video_bin), v_filter);
  gst_bin_add (GST_BIN (video_bin), videosink);

  gst_element_link (v_decoder, v_queue);
  gst_element_link (v_queue, v_filter);
705
  gst_element_link (v_filter, videosink);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
706

707
  gst_bin_add (GST_BIN (pipeline), video_bin);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
708

709 710 711 712 713 714 715 716
  pad = gst_element_get_pad (v_decoder, "sink");
  gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
  gst_object_unref (pad);

  setup_dynamic_link (demux, "video_e0", gst_element_get_pad (video_bin,
          "sink"), NULL);

  seekable = gst_element_get_pad (v_filter, "src");
717
  seekable_pads = g_list_prepend (seekable_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
718
  rate_pads = g_list_prepend (rate_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
719 720
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
721 722 723 724

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
725 726
static GstElement *
make_mpegnt_pipeline (const gchar * location)
Wim Taymans's avatar
Wim Taymans committed
727 728 729 730
{
  GstElement *pipeline, *audio_bin, *video_bin;
  GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
  GstElement *audiosink, *videosink;
731
  GstElement *a_queue;
Wim Taymans's avatar
Wim Taymans committed
732
  GstPad *seekable;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
733

Wim Taymans's avatar
Wim Taymans committed
734 735 736 737 738 739 740 741 742 743 744 745
  pipeline = gst_pipeline_new ("app");

  src = gst_element_factory_make_or_warn (SOURCE, "src");
  g_object_set (G_OBJECT (src), "location", location, NULL);

  demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
  //g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);

  seekable_elements = g_list_prepend (seekable_elements, demux);

  gst_bin_add (GST_BIN (pipeline), src);
  gst_bin_add (GST_BIN (pipeline), demux);
746
  gst_element_link (src, demux);
Wim Taymans's avatar
Wim Taymans committed
747 748 749 750

  audio_bin = gst_bin_new ("a_decoder_bin");
  a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
  a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
751
  audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
Wim Taymans's avatar
Wim Taymans committed
752 753
  //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
  g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
754 755
  gst_element_link (a_decoder, a_queue);
  gst_element_link (a_queue, audiosink);
Wim Taymans's avatar
Wim Taymans committed
756
  gst_bin_add (GST_BIN (audio_bin), a_decoder);
757 758
  gst_bin_add (GST_BIN (audio_bin), a_queue);
  gst_bin_add (GST_BIN (audio_bin), audiosink);
Wim Taymans's avatar
Wim Taymans committed
759

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
760
  setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
761
          "sink"), audio_bin);
Wim Taymans's avatar
Wim Taymans committed
762 763 764 765

  seekable = gst_element_get_pad (a_queue, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
766 767
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
Wim Taymans's avatar
Wim Taymans committed
768 769 770

  video_bin = gst_bin_new ("v_decoder_bin");
  v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
771
  v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
772
  videosink = gst_element_factory_make_or_warn ("ximagesink", "v_sink");
773
  gst_element_link_many (v_decoder, v_filter, videosink, NULL);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
774

Wim Taymans's avatar
Wim Taymans committed
775 776
  gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
777
  setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
778
          "sink"), video_bin);
Wim Taymans's avatar
Wim Taymans committed
779 780 781 782

  seekable = gst_element_get_pad (v_decoder, "src");
  seekable_pads = g_list_prepend (seekable_pads, seekable);
  rate_pads = g_list_prepend (rate_pads, seekable);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
783 784
  rate_pads =
      g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
Wim Taymans's avatar
Wim Taymans committed
785 786 787 788

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
789 790
static GstElement *
make_playerbin_pipeline (const gchar * location)
Wim Taymans's avatar
Wim Taymans committed
791
{
792
  GstElement *player;
793 794 795 796

  player = gst_element_factory_make ("playbin", "player");
  g_assert (player);

797
  g_object_set (G_OBJECT (player), "uri", location, NULL);
798 799 800 801 802 803 804

  seekable_elements = g_list_prepend (seekable_elements, player);

  /* force element seeking on this pipeline */
  elem_seek = TRUE;

  return player;
Wim Taymans's avatar
Wim Taymans committed
805 806
}

807 808 809 810 811 812 813 814 815 816 817 818 819 820 821
static GstElement *
make_parselaunch_pipeline (const gchar * description)
{
  GstElement *pipeline;
  GError *error;

  pipeline = gst_parse_launch (description, &error);

  seekable_elements = g_list_prepend (seekable_elements, pipeline);

  elem_seek = TRUE;

  return pipeline;
}

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
822 823
static gchar *
format_value (GtkScale * scale, gdouble value)
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
824
{
825 826 827 828 829 830 831
  gint64 real;
  gint64 seconds;
  gint64 subseconds;

  real = value * duration / 100;
  seconds = (gint64) real / GST_SECOND;
  subseconds = (gint64) real / (GST_SECOND / 100);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
832

833 834
  return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
      G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
835 836 837 838 839 840
}

typedef struct
{
  const gchar *name;
  const GstFormat format;
841 842
}
seek_format;
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
843

Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
844 845 846 847 848 849
static seek_format seek_formats[] = {
  {"tim", GST_FORMAT_TIME},
  {"byt", GST_FORMAT_BYTES},
  {"buf", GST_FORMAT_BUFFERS},
  {"def", GST_FORMAT_DEFAULT},
  {NULL, 0},
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867
};

G_GNUC_UNUSED static void
query_rates (void)
{
  GList *walk = rate_pads;

  while (walk) {
    GstPad *pad = GST_PAD (walk->data);
    gint i = 0;

    g_print ("rate/sec  %8.8s: ", GST_PAD_NAME (pad));
    while (seek_formats[i].name) {
      gint64 value;
      GstFormat format;

      format = seek_formats[i].format;

Wim Taymans's avatar
Wim Taymans committed
868 869
      if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
              &value)) {
870
        g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
871
      } else {
872
        g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
Thomas Vander Stichele's avatar
Thomas Vander Stichele committed
873 874 875 876 877 878 879 880 881 882 883
      }

      i++;
    }
    g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));

    walk = g_list_next (walk);
  }
}

G_GNUC_UNUSED static void
884 885 886 887 888 889 890 891 892 893
query_positions_elems ()
{
  GList *walk = seekable_elements;

  while (walk) {
    GstElement *element = GST_ELEMENT (walk->data);
    gint i = 0;

    g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
    while (seek_formats[i].name) {
Wim Taymans's avatar
Wim Taymans committed
894
      gint64 position, total;
895 896 897
      GstFormat format;

      format = seek_formats[i].format;
Wim Taymans's avatar
Wim Taymans committed
898

Wim Taymans's avatar
Wim Taymans committed
899 900
      if (gst_element_query_position (element, &format, &position) &&
          gst_element_query_duration (element, &format, &total)) {
Wim Taymans's avatar
Wim Taymans committed
901 902
        g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
            seek_formats[i].name, position, total);
Wim Taymans's avatar