summaryrefslogtreecommitdiff
path: root/legacy/emotion/src/modules/gstreamer
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-26 23:17:57 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2008-09-26 23:17:57 +0000
commitaa3aac7dbfd67d5184d41fa73b581df337bcc7ef (patch)
treec7a2a65a01bb4fdb05b6c0d2b4e4e9a173baa716 /legacy/emotion/src/modules/gstreamer
parent2acd11a39ec554ef390bb840175a11e108732379 (diff)
Fix position reporting.
Always call pos_get() and also fix these on xine and gstreamer, we should query the current position and do not trust cached value. For instance, when no video is present, no handoff/frame-decoded is called so no cache is updated. SVN revision: 36271
Diffstat (limited to 'legacy/emotion/src/modules/gstreamer')
-rw-r--r--legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c56
1 files changed, 50 insertions, 6 deletions
diff --git a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
index 2ada21518a..01d989443f 100644
--- a/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
+++ b/legacy/emotion/src/modules/gstreamer/emotion_gstreamer.c
@@ -590,13 +590,42 @@ static double
590em_len_get(void *video) 590em_len_get(void *video)
591{ 591{
592 Emotion_Gstreamer_Video *ev; 592 Emotion_Gstreamer_Video *ev;
593 Emotion_Video_Sink *vsink; 593 Emotion_Video_Sink *vsink;
594 Emotion_Audio_Sink *asink;
595 GstFormat fmt;
596 gint64 val;
597 gboolean ret;
598
599 ev = video;
600 fmt = GST_FORMAT_TIME;
601 ret = gst_element_query_duration(ev->pipeline, &fmt, &val);
602 if (!ret)
603 goto fallback;
604
605 if (fmt != GST_FORMAT_TIME)
606 {
607 fprintf(stderr, "requrested duration in time, but got %s instead.",
608 gst_format_get_name(fmt));
609 goto fallback;
610 }
594 611
595 ev = (Emotion_Gstreamer_Video *)video; 612 if (val <= 0.0)
613 goto fallback;
596 614
597 vsink = (Emotion_Video_Sink *)ecore_list_index_goto(ev->video_sinks, ev->video_sink_nbr); 615 return val / 1000000000.0;
598 if (vsink) 616
599 return (double)vsink->length_time; 617 fallback:
618 fputs("Gstreamer reported no length, try existing sinks...\n", stderr);
619
620 ecore_list_first_goto(ev->audio_sinks);
621 while ((asink = ecore_list_next(ev->audio_sinks)) != NULL)
622 if (asink->length_time >= 0)
623 return asink->length_time;
624
625 ecore_list_first_goto(ev->video_sinks);
626 while ((vsink = ecore_list_next(ev->video_sinks)) != NULL)
627 if (vsink->length_time >= 0)
628 return vsink->length_time;
600 629
601 return 0.0; 630 return 0.0;
602} 631}
@@ -650,9 +679,24 @@ static double
650em_pos_get(void *video) 679em_pos_get(void *video)
651{ 680{
652 Emotion_Gstreamer_Video *ev; 681 Emotion_Gstreamer_Video *ev;
682 GstFormat fmt;
683 gint64 val;
684 gboolean ret;
653 685
654 ev = (Emotion_Gstreamer_Video *)video; 686 ev = video;
687 fmt = GST_FORMAT_TIME;
688 ret = gst_element_query_position(ev->pipeline, &fmt, &val);
689 if (!ret)
690 return ev->position;
691
692 if (fmt != GST_FORMAT_TIME)
693 {
694 fprintf(stderr, "requrested position in time, but got %s instead.",
695 gst_format_get_name(fmt));
696 return ev->position;
697 }
655 698
699 ev->position = val / 1000000000.0;
656 return ev->position; 700 return ev->position;
657} 701}
658 702