changeset 14934:89031188b7b2

Rather simple patch for RAWDV demuxer which lets it say whats the total movie length. Patch by Oded Shimon
author rtognimp
date Wed, 09 Mar 2005 20:29:50 +0000
parents 0f4d98b3ea66
children b3274e6b88ef
files libmpdemux/demux_rawdv.c libmpdemux/demuxer.c
diffstat 2 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rawdv.c	Wed Mar 09 12:41:04 2005 +0000
+++ b/libmpdemux/demux_rawdv.c	Wed Mar 09 20:29:50 2005 +0000
@@ -225,4 +225,22 @@
   free(frames);
 }
 
+int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg) {
+    rawdv_frames_t *frames = (rawdv_frames_t *)demuxer->priv;
+    sh_video_t *sh_video=demuxer->video->sh;
+
+    switch(cmd) {
+        case DEMUXER_CTRL_GET_TIME_LENGTH:
+            *((unsigned long *)arg)=frames->frame_number / sh_video->fps;
+            return DEMUXER_CTRL_OK;
+
+        case DEMUXER_CTRL_GET_PERCENT_POS:
+            *((int *)arg)=(int)(frames->current_frame * 100. / frames->frame_number);
+            return DEMUXER_CTRL_OK;
+
+        default:
+            return DEMUXER_CTRL_NOTIMPL;
+    }
+}
+
 #endif
--- a/libmpdemux/demuxer.c	Wed Mar 09 12:41:04 2005 +0000
+++ b/libmpdemux/demuxer.c	Wed Mar 09 20:29:50 2005 +0000
@@ -1720,6 +1720,9 @@
 #ifdef USE_WIN32DLL
 extern int demux_avs_control(demuxer_t *demuxer, int cmd, void *arg);
 #endif
+#ifdef HAVE_LIBDV095
+extern int demux_rawdv_control(demuxer_t *demuxer,int cmd, void *arg);
+#endif
 
 int demux_control(demuxer_t *demuxer, int cmd, void *arg) {
     switch(demuxer->type) {
@@ -1762,6 +1765,10 @@
         case DEMUXER_TYPE_AVS:
    	    return demux_avs_control(demuxer, cmd, arg);
 #endif 
+#ifdef HAVE_LIBDV095
+        case DEMUXER_TYPE_RAWDV:
+            return demux_rawdv_control(demuxer,cmd, arg);
+#endif
 	default:
 	    return DEMUXER_CTRL_NOTIMPL;
     }