changeset 29504:940fb22fd9dd

Reuse ds_get_packet in ds_get_packet_pts
author reimar
date Sun, 23 Aug 2009 15:32:42 +0000
parents a3e1ef1c76d0
children fa1ad0b67187
files libmpdemux/demuxer.c
diffstat 1 files changed, 4 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Sat Aug 22 19:30:19 2009 +0000
+++ b/libmpdemux/demuxer.c	Sun Aug 23 15:32:42 2009 +0000
@@ -646,19 +646,12 @@
 {
     int len;
     *pts = MP_NOPTS_VALUE;
-    if (ds->buffer_pos >= ds->buffer_size) {
-        if (!ds_fill_buffer(ds)) {
-            // EOF
-            *start = NULL;
-            return -1;
-        }
-    }
+    len = ds_get_packet(ds, start);
+    if (len < 0)
+        return len;
     // Return pts unless this read starts from the middle of a packet
-    if (!ds->buffer_pos)
+    if (len == ds->buffer_pos)
         *pts = ds->current->pts;
-    len = ds->buffer_size - ds->buffer_pos;
-    *start = &ds->buffer[ds->buffer_pos];
-    ds->buffer_pos += len;
     return len;
 }