Loading...

mplayer-dev-eng@mplayerhq.hu

[Prev] Thread [Next]  |  [Prev] Date [Next]

[MPlayer-dev-eng] [PATCH] Add control to demux_rtp.cpp Carl Eugen Hoyos Tue Feb 27 06:05:28 2007

Hi!

Attached patch adds demux_rtp_control to live demuxer.

Please review and apply, Carl Eugen
Index: libmpdemux/demux_rtp.cpp
===================================================================
--- libmpdemux/demux_rtp.cpp    (Revision 22354)
+++ libmpdemux/demux_rtp.cpp    (Arbeitskopie)
@@ -582,7 +582,27 @@
   return dp;
 }
 
+static int demux_rtp_control(struct demuxer_st *demuxer, int cmd, void *arg) {
+  double endpos = ((RTPState*)demuxer->priv)->mediaSession->playEndTime();
 
+  switch(cmd) {
+    case DEMUXER_CTRL_GET_TIME_LENGTH:
+      if (endpos <= 0)
+        return DEMUXER_CTRL_DONTKNOW;
+      *((double *)arg) = endpos;
+      return DEMUXER_CTRL_OK;
+
+    case DEMUXER_CTRL_GET_PERCENT_POS:
+      if (endpos <= 0)
+        return DEMUXER_CTRL_DONTKNOW;
+      *((int *)arg) = 
(int)(((RTPState*)demuxer->priv)->videoBufferQueue->prevPacketPTS*100/endpos);
+      return DEMUXER_CTRL_OK;
+
+    default:
+      return DEMUXER_CTRL_NOTIMPL;
+    }
+}
+
 demuxer_desc_t demuxer_desc_rtp = {
   "LIVE555 RTP demuxer",
   "rtp",
@@ -596,5 +616,5 @@
   demux_open_rtp,
   demux_close_rtp,
   NULL,
-  NULL
+  demux_rtp_control
 };
_______________________________________________
MPlayer-dev-eng mailing list
[EMAIL PROTECTED]
http://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng