[vlc-devel] [RFC Patch v2 1/2] libvlc: Add Rust API for writing modules in rust

Kartik Ohri kartikohri13 at gmail.com
Mon Sep 14 13:13:44 CEST 2020


On Mon, Sep 14, 2020 at 11:38 AM Steve Lhomme <robux4 at ycbcr.xyz> wrote:

> On 2020-09-11 21:33, Kartik Ohri wrote:
> > The API is written in two layers. vlccore-sys
> > crate contains one to one bindings of libvlc
> > functions. vlccore-rs crate wraps vlccore-sys and
> > exposes a Rust idiomatic API for writing modules
> > in rust. As of now, the API exposes only a subset
> > of the vlc_stream API. More functionality can be
> > added to Rust API as required in the future.
> > ---
> >   .gitignore                    |   2 +-
> >   configure.ac                  |  13 ++++
> >   src/vlccore-rs/Cargo.toml     |  10 +++
> >   src/vlccore-rs/src/lib.rs     |   1 +
> >   src/vlccore-rs/src/stream.rs  | 120 ++++++++++++++++++++++++++++++++++
> >   src/vlccore-sys/Cargo.toml    |  10 +++
> >   src/vlccore-sys/src/lib.rs    |   2 +
> >   src/vlccore-sys/src/stream.rs |  24 +++++++
> >   8 files changed, 181 insertions(+), 1 deletion(-)
> >   create mode 100644 src/vlccore-rs/Cargo.toml
> >   create mode 100644 src/vlccore-rs/src/lib.rs
> >   create mode 100644 src/vlccore-rs/src/stream.rs
> >   create mode 100644 src/vlccore-sys/Cargo.toml
> >   create mode 100644 src/vlccore-sys/src/lib.rs
> >   create mode 100644 src/vlccore-sys/src/stream.rs
> >
> > diff --git a/.gitignore b/.gitignore
> > index fc368212c8..6c049a80b1 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -46,7 +46,7 @@ wxvlc
> >   vlc_install_dir/*
> >   plugins.dat
> >   patches/*
> > -
> > +**/Cargo.lock
> >   include/vlc/libvlc_version.h
> >
> >   # Ignore build dirs
> > diff --git a/configure.ac b/configure.ac
> > index 99e4669942..53d56a725c 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1896,6 +1896,19 @@ AS_IF([test "${enable_sout}" != "no"], [
> >   ])
> >   AM_CONDITIONAL([ENABLE_SOUT], [test "${enable_sout}" != "no"])
> >
> > +dnl Rust Modules
> > +AC_ARG_ENABLE([rust],
> > +    AS_HELP_STRING([--enable-rust], [enable building Rust modules
> (default disabled)]))
> > +AS_IF([test "${enable_rust}" = "yes"],
> > +      [AC_DEFINE(ENABLE_RUST, 1, [Define to 1 for building rust
> modules.])])
> > +AM_CONDITIONAL([BUILD_RUST], [test "${enable_rust}" = "yes"])
>
> You should only set to true this if cargo is available.
>
> > +if test "${enable_rust}" = "yes"
> > +then
> > +    AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
> > +    AS_IF([test "x$CARGO" = "xno"],
> > +          AC_MSG_ERROR([cargo not found. cargo is required to build
> rust modules]))
> > +fi
>

Ah! Yes. I have made the changes below and tested them locally. Does this
address the issue ?
===================================================================
--- configure.ac (revision 329abd5c6c5a8ac45765b2fca9883dae7155207e)
+++ configure.ac (date 1600072942614)
@@ -1899,15 +1899,13 @@
 dnl Rust Modules
 AC_ARG_ENABLE([rust],
     AS_HELP_STRING([--enable-rust], [enable building Rust modules (default
disabled)]))
-AS_IF([test "${enable_rust}" = "yes"],
-      [AC_DEFINE(ENABLE_RUST, 1, [Define to 1 for building rust
modules.])])
-AM_CONDITIONAL([BUILD_RUST], [test "${enable_rust}" = "yes"])
 if test "${enable_rust}" = "yes"
 then
     AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
     AS_IF([test "x$CARGO" = "xno"],
           AC_MSG_ERROR([cargo not found. cargo is required to build rust
modules]))
 fi
+AM_CONDITIONAL([BUILD_RUST], [test "x$CARGO" = "xyes"])

 dnl Lua modules
 AC_ARG_ENABLE([lua],


> ____________________________________

___________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200914/12a34003/attachment.html>


More information about the vlc-devel mailing list