changeset 22355:20be7be45f47

implementation of DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS; patch by the usual Hoyos
author nicodvb
date Tue, 27 Feb 2007 22:25:00 +0000
parents b465e5be1a53
children 37248dbbf6ff
files libmpdemux/demux_rtp.cpp
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_rtp.cpp	Tue Feb 27 21:20:24 2007 +0000
+++ b/libmpdemux/demux_rtp.cpp	Tue Feb 27 22:25:00 2007 +0000
@@ -581,6 +581,26 @@
   return dp;
 }
 
+static int demux_rtp_control(struct demuxer_st *demuxer, int cmd, void *arg) {
+  double endpts = ((RTPState*)demuxer->priv)->mediaSession->playEndTime();
+
+  switch(cmd) {
+    case DEMUXER_CTRL_GET_TIME_LENGTH:
+      if (endpts <= 0)
+        return DEMUXER_CTRL_DONTKNOW;
+      *((double *)arg) = endpts;
+      return DEMUXER_CTRL_OK;
+
+    case DEMUXER_CTRL_GET_PERCENT_POS:
+      if (endpts <= 0)
+        return DEMUXER_CTRL_DONTKNOW;
+      *((int *)arg) = (int)(((RTPState*)demuxer->priv)->videoBufferQueue->prevPacketPTS*100/endpts);
+      return DEMUXER_CTRL_OK;
+
+    default:
+      return DEMUXER_CTRL_NOTIMPL;
+    }
+}
 
 demuxer_desc_t demuxer_desc_rtp = {
   "LIVE555 RTP demuxer",
@@ -595,5 +615,5 @@
   demux_open_rtp,
   demux_close_rtp,
   NULL,
-  NULL
+  demux_rtp_control
 };