[vlc-commits] [Git][videolan/vlc][master] 2 commits: apple/bundle.sh: handle extra file

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Jan 31 10:18:33 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
e5c3119c by Thomas Guillem at 2024-01-31T08:53:09+00:00
apple/bundle.sh: handle extra file

Provide extra files to the application bundle that can be loaded by the
file access directly.

Co-authored-by: Alexandre Janniaux <ajanni at videolabs.io>

- - - - -
68ad663f by Alexandre Janniaux at 2024-01-31T08:53:09+00:00
test: iosvlc: provide asset:// redirection

asset:// scheme will be redirected to file:// access with the correct
bundle path setup as prefix, so that any asset:// resource is accessed
from the application package directly.

With EXTRA_FILE=sample.mp4 ../extras/package/apple/bundle.sh, it
provides the ability to play the file by running the application with
the argument `asset://sample.mp4`.

- - - - -


2 changed files:

- extras/package/apple/bundle.sh
- test/iosvlc.m


Changes:

=====================================
extras/package/apple/bundle.sh
=====================================
@@ -9,6 +9,8 @@ readonly APP_EXECUTABLE="${3:-${APP_NAME}}"
 readonly APP="Payload/${APP_NAME}.app"
 readonly IPA="${APP_NAME}_unsigned.ipa"
 
+: ${EXTRA_FILE:=}
+
 # CONVERT_PLIST <input file> <output file>
 # Convert a plist file into binary1 format in order to put it
 # into an Apple bundle.
@@ -47,6 +49,9 @@ cp "${BUILD_DIR}/lib/.libs/libvlc.dylib" "$APP/Frameworks"
 cp "${BUILD_DIR}/src/.libs/libvlccore.dylib" "$APP/Frameworks"
 find "${BUILD_DIR}/modules/.libs/" -name "*.dylib" -exec cp {} "$APP/Frameworks" \;
 fi
+if [ -n "$EXTRA_FILE" ]; then
+    cp "${EXTRA_FILE}" ${APP}/
+fi
 
 # Archive the bundle into a .ipa file.
 zip -r "$IPA" Payload


=====================================
test/iosvlc.m
=====================================
@@ -157,9 +157,38 @@ static int Open(vlc_object_t *obj)
     return VLC_SUCCESS;
 }
 
+#include <vlc_stream.h>
+#include <vlc_access.h>
+
+static int OpenAssetDemux(vlc_object_t *obj)
+{
+    stream_t *access = (stream_t *)obj;
+
+    if (access->psz_location == NULL)
+        return VLC_EGENERIC;
+
+    /* Store startup arguments to forward them to libvlc */
+    NSString *bundle_path = [[NSBundle mainBundle] resourcePath];
+    const char *resource_path = [bundle_path UTF8String];
+    size_t resource_path_length = strlen(resource_path);
+
+    char *url;
+    if (asprintf(&url, "file://%s/%s", resource_path, access->psz_location) < 0)
+        return VLC_ENOMEM;
+
+    access->psz_url = url;
+
+    return VLC_ACCESS_REDIRECT;
+}
+
 vlc_module_begin()
     set_capability("interface", 0)
     set_callback(Open)
+
+    add_submodule()
+    set_capability("access", 1)
+    set_callback(OpenAssetDemux)
+    add_shortcut("asset")
 vlc_module_end()
 
 VLC_EXPORT const vlc_plugin_cb vlc_static_modules[] = {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/12df8b8ec4ea29654c4e1b69c81a31b4356704fa...68ad663f85c49d07fc9865f80ef8c7752c929496

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/12df8b8ec4ea29654c4e1b69c81a31b4356704fa...68ad663f85c49d07fc9865f80ef8c7752c929496
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list