[vlc-commits] stream: add STREAM_GET_PRIVATE_BLOCK for block-based buffering

Rémi Denis-Courmont git at videolan.org
Tue Aug 25 20:33:16 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 28 18:37:32 2015 +0300| [84d07db2eb67eb7bbad658cfed4e1ef2e7c3e92d] | committer: Rémi Denis-Courmont

stream: add STREAM_GET_PRIVATE_BLOCK for block-based buffering

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84d07db2eb67eb7bbad658cfed4e1ef2e7c3e92d
---

 include/vlc_stream.h |    1 +
 src/input/stream.c   |   15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index cfd01b7..648a777 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -106,6 +106,7 @@ enum stream_query_e
     STREAM_SET_PRIVATE_ID_STATE = 0x1000, /* arg1= int i_private_data, bool b_selected    res=can fail */
     STREAM_SET_PRIVATE_ID_CA,             /* arg1= int i_program_number, uint16_t i_vpid, uint16_t i_apid1, uint16_t i_apid2, uint16_t i_apid3, uint8_t i_length, uint8_t *p_data */
     STREAM_GET_PRIVATE_ID_STATE,          /* arg1=int i_private_data arg2=bool *          res=can fail */
+    STREAM_GET_PRIVATE_BLOCK, /**< arg1= block_t **b, arg2=bool *eof */
 };
 
 VLC_API ssize_t stream_Read(stream_t *, void *, size_t);
diff --git a/src/input/stream.c b/src/input/stream.c
index cbf6346..de32be3 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -498,6 +498,21 @@ int stream_vaControl(stream_t *s, int cmd, va_list args)
             }
             return ret;
         }
+
+        case STREAM_GET_PRIVATE_BLOCK:
+        {
+            block_t **b = va_arg(args, block_t **);
+            bool *eof = va_arg(args, bool *);
+
+            if (priv->peek != NULL)
+            {
+                *b = priv->peek;
+                priv->peek = NULL;
+                *eof = false;
+                return VLC_SUCCESS;
+            }
+            return stream_ControlInternal(s, STREAM_GET_PRIVATE_BLOCK, b, eof);
+        }
     }
     return s->pf_control(s, cmd, args);
 }



More information about the vlc-commits mailing list