[MPlayer-dev-eng] [PATCH] -slave support for demux_get_time_length & get_precent_pos

Balatoni Denes pnis at coder.hu
Wed Nov 20 17:26:09 CET 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I forgot the patch, didn't I

Denes

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi!
>
> This patch adds two commands to input.c , mp_cmd_get_time_length &
> mp_cmd_get_precent pos, to help frontends getting the stream position &
> total time.
>
> It also fixes a stupid typo in demuxer.c 's demuxer_get_percent_pos .
>
> bye
> Denes
>
- -- 
"Use the source Luke !"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE927ehaQToeq3jgogRAi7lAJ9YMwtu8BhbZ1ZG1vpiEOoVG5jf0QCfcBzZ
VEJpLnZEJu4Sa37QzEN1wrs=
=bfEc
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -Naur main/input/input.c main.gany/input/input.c
--- main/input/input.c	Mon Nov 18 01:11:56 2002
+++ main.gany/input/input.c	Wed Nov 20 16:53:16 2002
@@ -67,6 +67,8 @@
   { MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_SUB_VISIBILITY, "sub_visibility", 0, { {-1,{0}} } },
   { MP_CMD_VOBSUB_LANG, "vobsub_lang", 0, { {-1,{0}} } },
+  { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
+  { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },
 #ifdef USE_TV
   { MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1,  { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }},
   { MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} }  },
diff -Naur main/input/input.h main.gany/input/input.h
--- main/input/input.h	Mon Nov 18 01:11:56 2002
+++ main.gany/input/input.h	Wed Nov 20 16:54:45 2002
@@ -33,6 +33,8 @@
 #define MP_CMD_VOBSUB_LANG 31
 #define MP_CMD_MENU 32
 #define MP_CMD_SET_MENU 33
+#define MP_CMD_GET_TIME_LENGTH 34
+#define MP_CMD_GET_PERCENT_POS 35
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001
diff -Naur main/libmpdemux/demuxer.c main.gany/libmpdemux/demuxer.c
--- main/libmpdemux/demuxer.c	Sat Nov 16 04:42:14 2002
+++ main.gany/libmpdemux/demuxer.c	Wed Nov 20 17:08:10 2002
@@ -1276,7 +1276,7 @@
 
 int demuxer_get_percent_pos(demuxer_t *demuxer){     
     int ans;     
-    if (demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans)<=DEMUXER_CTRL_OK)  {
+    if (demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans)<=0)  {
         ans=0;     
     }
     if (ans>100 || ans<0) ans=0;
diff -Naur main/mplayer.c main.gany/mplayer.c
--- main/mplayer.c	Sat Nov 16 04:42:13 2002
+++ main.gany/mplayer.c	Wed Nov 20 16:51:45 2002
@@ -2345,6 +2345,15 @@
     case MP_CMD_VF_CHANGE_RECTANGLE:
 	set_rectangle(sh_video, cmd->args[0].v.i, cmd->args[1].v.i);
 	break;
+	
+    case MP_CMD_GET_TIME_LENGTH : {
+	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ANS_LENGTH=%ld\n", demuxer_get_time_length(demuxer));
+    } break;
+
+    case MP_CMD_GET_PERCENT_POS : {
+	mp_msg(MSGT_GLOBAL,MSGL_INFO,"ANS_PERCENT_POSITION=%ld\n", demuxer_get_percent_pos(demuxer));
+    } break;
+
 #ifdef USE_DVDNAV
     case MP_CMD_DVDNAV_EVENT: {
       dvdnav_priv_t * dvdnav_priv = (dvdnav_priv_t*)(stream->priv);


More information about the MPlayer-dev-eng mailing list