[vlc-devel] [PATCH 1/2] test: demux-run: add libvlc_demux_process_memory

Thomas Guillem thomas at gllm.fr
Wed Feb 20 18:40:07 CET 2019


Same than vlc_demux_process_memory but with a libvlc_instance_t arg.
---
 test/src/input/demux-run.c | 19 +++++++++++++------
 test/src/input/demux-run.h |  3 +++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/test/src/input/demux-run.c b/test/src/input/demux-run.c
index fe9ce530b5..8178756ed6 100644
--- a/test/src/input/demux-run.c
+++ b/test/src/input/demux-run.c
@@ -363,6 +363,18 @@ int vlc_demux_process_path(const struct vlc_run_args *args, const char *path)
     return ret;
 }
 
+int libvlc_demux_process_memory(libvlc_instance_t *vlc,
+                                const struct vlc_run_args *args,
+                                const unsigned char *buf, size_t length)
+{
+    stream_t *s = vlc_stream_MemoryNew(VLC_OBJECT(vlc->p_libvlc_int),
+                                       (void *)buf, length, true);
+    if (s == NULL)
+        fprintf(stderr, "Error: cannot create input stream\n");
+
+    return demux_process_stream(args, s);
+}
+
 int vlc_demux_process_memory(const struct vlc_run_args *args,
                              const unsigned char *buf, size_t length)
 {
@@ -370,12 +382,7 @@ int vlc_demux_process_memory(const struct vlc_run_args *args,
     if (vlc == NULL)
         return -1;
 
-    stream_t *s = vlc_stream_MemoryNew(VLC_OBJECT(vlc->p_libvlc_int),
-                                       (void *)buf, length, true);
-    if (s == NULL)
-        fprintf(stderr, "Error: cannot create input stream\n");
-
-    int ret = demux_process_stream(args, s);
+    int ret = libvlc_demux_process_memory(vlc, args, buf, length);
     libvlc_release(vlc);
     return ret;
 }
diff --git a/test/src/input/demux-run.h b/test/src/input/demux-run.h
index 01ae245891..551f002770 100644
--- a/test/src/input/demux-run.h
+++ b/test/src/input/demux-run.h
@@ -30,3 +30,6 @@ int vlc_demux_process_url(const struct vlc_run_args *, const char *url);
 int vlc_demux_process_path(const struct vlc_run_args *, const char *path);
 int vlc_demux_process_memory(const struct vlc_run_args *,
                              const unsigned char *buf, size_t length);
+int libvlc_demux_process_memory(libvlc_instance_t *vlc,
+                                const struct vlc_run_args *args,
+                                const unsigned char *buf, size_t length);
-- 
2.20.1



More information about the vlc-devel mailing list