hmm - handle fstreams where xine dosnt report absolute length - just a
authorraster <raster>
Wed, 21 Jul 2004 06:34:18 +0000 (06:34 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 21 Jul 2004 06:34:18 +0000 (06:34 +0000)
percentage position

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/e17/libs/emotion@10951 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/emotion_xine.c
src/modules/emotion_xine.h

index af1f71c..8f7de4b 100644 (file)
@@ -979,13 +979,20 @@ _em_seek(void *par)
          {
             again:
             ppos = ev->seek_to_pos;
-            xine_play(ev->stream, 0, ppos * 1000);
+            if (ppos > ev->len) ppos = ev->len;
+            if (ev->no_time)
+              xine_play(ev->stream, ppos * 65535, 0);
+            else
+              xine_play(ev->stream, 0, ppos * 1000);
             ev->seek_to = 0;
             if (ev->delete_me) return NULL;
          }
        if (!ev->play)
-         xine_set_param(ev->stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE);
+         {
+            xine_set_param(ev->stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE);
+         }
        if (ev->delete_me) return NULL;
+       usleep(1000000 / 10);
        if (ppos != ev->seek_to_pos)
          goto again;
     }
@@ -1227,9 +1234,18 @@ _em_get_pos_len_th(void *par)
                                     &pos_time,
                                     &length_time))
               {
-                 
-                 ev->pos = (double)pos_time / 1000.0;
-                 ev->len = (double)length_time / 1000.0;
+                 if (length_time == 0)
+                   {
+                      ev->pos = (double)pos_stream / 65535;
+                      ev->len = 1.0;
+                      ev->no_time = 1;
+                   }
+                 else
+                   {
+                      ev->pos = (double)pos_time / 1000.0;
+                      ev->len = (double)length_time / 1000.0;
+                      ev->no_time = 0;
+                   }
               }
             if (ev->delete_me)
               {
@@ -1238,7 +1254,7 @@ _em_get_pos_len_th(void *par)
               }
             ev->get_poslen = 0;
 //          printf("get pos %3.3f\n", ev->pos);
-            usleep(1000000 / 10);
+            usleep(1000000 / 15);
          }
      }
    return NULL;
index 8b9f2a7..fe3bee5 100644 (file)
@@ -17,8 +17,8 @@ struct _Emotion_Xine_Video
    xine_stream_t            *stream;
    xine_event_queue_t       *queue;
    int                       fd;
-   double                    len;
-   double                    pos;
+   volatile double           len;
+   volatile double           pos;
    double                    fps;
    double                    ratio;
    int                       w, h;
@@ -40,6 +40,7 @@ struct _Emotion_Xine_Video
    unsigned char             audio_mute : 1;
    unsigned char             spu_mute : 1;
    volatile unsigned char    delete_me : 1;
+   volatile unsigned char    no_time : 1;
    
    pthread_t                 seek_th;
    pthread_t                 get_pos_len_th;