[vlc-commits] [Git][videolan/vlc][master] 13 commits: apple/build: add support for watchOS

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jun 27 12:16:04 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
bebefa53 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
apple/build: add support for watchOS

- - - - -
9dc4e667 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
contrib: recognize the watchOS platform

- - - - -
0ee34bb0 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
src/netconf: fix compilation for watchOS

- - - - -
4c0739fc by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
contrib/ffmpeg: disable everything except audio demuxing/decoding for watchOS

- - - - -
149322c2 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
configure.ac: recognize the watchOS platform

- - - - -
caa63303 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
Makefile.am: disable all modules unsuitable for watchOS

- - - - -
f617a17e by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
AVSampleBuffer aout: declare compatibility with watchOS

- - - - -
52375f70 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
AVSampleBuffer aout: enable compilation for watchOS

- - - - -
2dbc201b by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
test: add watchOS app test app

The watchOS entry point and app setup is very different to other iOS
flavors, so a designated file was created in favor of 10 ifdefs to the
existing code.

- - - - -
f6f9a85b by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
apple/xcodegen: add watchOS support and target

- - - - -
92134e20 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
apple/build: add module removal list for watchOS

- - - - -
21a9c177 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
test: split watchOS and iOS targets for simplicity

- - - - -
916dc562 by Felix Paul Kühne at 2024-06-27T10:41:41+00:00
CI: add watchOS job

- - - - -


18 changed files:

- configure.ac
- contrib/bootstrap
- contrib/src/ffmpeg/rules.mak
- extras/ci/gitlab-ci.yml
- extras/package/apple/build.conf
- extras/package/apple/build.sh
- extras/package/apple/xcodegen.yml
- modules/audio_output/Makefile.am
- modules/audio_output/apple/avaudiosession_common.m
- modules/audio_output/apple/avsamplebuffer.m
- modules/codec/Makefile.am
- modules/services_discovery/Makefile.am
- modules/video_chroma/Makefile.am
- modules/video_filter/Makefile.am
- modules/video_output/Makefile.am
- src/darwin/netconf.m
- test/Makefile.am
- + test/watchosvlc.m


Changes:

=====================================
configure.ac
=====================================
@@ -118,6 +118,7 @@ HAVE_OSX="0"
 HAVE_TVOS="0"
 HAVE_IOS_OR_TVOS="0"
 HAVE_XROS="0"
+HAVE_WATCHOS="0"
 
 dnl  Set x86 asm flags and defines
 X86ASMFLAGS=""
@@ -250,6 +251,19 @@ int foo() { return my_array[0]; }
              ac_cv_func_fork=no
              ],)
 
+    AC_EGREP_CPP(yes,
+            [#import <TargetConditionals.h>
+             #if TARGET_OS_WATCH
+             yes
+             #endif],
+             [HAVE_WATCHOS="1"
+             HAVE_IOS="0"
+             HAVE_OSX="0"
+             HAVE_TVOS="0"
+             HAVE_IOS_OR_TVOS="0"
+             ac_cv_func_fork=no
+             ],)
+
     AS_IF([test "${HAVE_OSX}" = "1"],[VLC_ADD_LIBS([libvlccore],[-Wl,-framework,CoreServices])])
 
     dnl
@@ -493,6 +507,7 @@ AM_CONDITIONAL([HAVE_OSX],     [test "${HAVE_OSX}" = "1"])
 AM_CONDITIONAL([HAVE_TVOS],    [test "${HAVE_TVOS}" = "1"])
 AM_CONDITIONAL([HAVE_IOS_OR_TVOS], [test "${HAVE_IOS_OR_TVOS}" = "1"])
 AM_CONDITIONAL([HAVE_XROS],    [test "${HAVE_XROS}" = "1"])
+AM_CONDITIONAL([HAVE_WATCHOS],    [test "${HAVE_WATCHOS}" = "1"])
 
 AM_CONDITIONAL([HAVE_LIBANL],  [test "${HAVE_LIBANL}" = "1"])
 


=====================================
contrib/bootstrap
=====================================
@@ -287,6 +287,10 @@ case "${OS}" in
 		then
 			add_make_enabled "HAVE_TVOS"
 		fi
+		if test "$BUILDFORWATCHOS"
+		then
+			add_make_enabled "HAVE_WATCHOS"
+		fi
 		if test "$ENABLE_BITCODE"
 		then
 			add_make_enabled "HAVE_BITCODE_ENABLED"


=====================================
contrib/src/ffmpeg/rules.mak
=====================================
@@ -141,6 +141,13 @@ FFMPEGCONF += --cpu=core2
 endif
 ifdef HAVE_IOS
 FFMPEGCONF += --enable-pic --extra-ldflags="$(EXTRA_CFLAGS) -isysroot $(IOS_SDK)"
+ifdef HAVE_WATCHOS
+FFMPEGCONF += --disable-everything
+FFMPEGCONF += --enable-decoder='aac,aac_latm,aac_fixed,aadec,ac3,adpcm_*,aiff,alac,alsdec,amrnb,amrwb,ape,atrac1,atrac3,atrac3plus,atrac9,binkaudio_dct,binkaudio_rdft,bmv_audio,cook,dca,derf,dpcm,dts,dvaudio,eaac,eac3,flac,flv,g722,g723,g726,g729,gsm,metasound,mpc7,mpc8,mpegaudiodec_fixed,mp3,m4a,nellymoser,opus,pcm_*,qdmc,qdm2,ra144,ra288,ralf,rka,shorten,tta,tak,truespeech,vorbis,wavpack,wma,wmalossless,wmapro,wmavoice'
+FFMPEGCONF += --enable-parser='aac,aac_latm,ac3,adpcm,amr,aac_latm,ape,cook,dca,dvaudio,flac,g723,g729,gsm,mlp,mpegaudio,opus,sipr,vorbis,xma'
+FFMPEGCONF += --enable-demuxer='aac,ac3,adts,aiff,ape,asf,au,avi,caf,daud,dirac,dts,dv,ea,flac,flv,gsm,ivf,matroska,mmf,mov,mp3,mpeg,ogg,pcm,rm,sbc,sdp,shorten,voc,w64,wav,wv'
+FFMPEGCONF += --enable-swresample
+endif
 endif
 endif
 


=====================================
extras/ci/gitlab-ci.yml
=====================================
@@ -97,6 +97,12 @@ variables:
         TRIPLET: $HOST_ARCH-apple-appletvos
         SDKNAME: appletvos
 
+.variables-watchos-arm64_32: &variables-watchos-arm64_32
+        VLC_PATH: /Users/videolanci/sandbox/bin
+        HOST_ARCH: arm64_32
+        TRIPLET: $HOST_ARCH-apple-watchos
+        SDKNAME: watchos
+
 .variables-xros-arm64: &variables-xros-arm64
         VLC_PATH: /Users/videolanci/sandbox/bin
         HOST_ARCH: arm64
@@ -582,6 +588,12 @@ tvos-arm64:
     extends: .apple-os-common
     variables: *variables-tvos-arm64
 
+watchos-arm64_32:
+    extends: .apple-os-common
+    tags:
+        - macos-xcode15
+    variables: *variables-watchos-arm64_32
+
 xros-arm64:
     extends: .apple-os-common
     tags:


=====================================
extras/package/apple/build.conf
=====================================
@@ -20,6 +20,8 @@ export VLC_DEPLOYMENT_TARGET_TVOS="11.0"
 export VLC_DEPLOYMENT_TARGET_TVOS_SIMULATOR="12.0"
 # xrOS deployment target
 export VLC_DEPLOYMENT_TARGET_XROS="1.0"
+# watchOS deployment target
+export VLC_DEPLOYMENT_TARGET_WATCHOS="7.5"
 
 #
 # Contrib options
@@ -103,6 +105,32 @@ export VLC_CONTRIB_OPTIONS_XROS=(
     --disable-aom
 )
 
+export VLC_CONTRIB_OPTIONS_WATCHOS=(
+    --disable-gpl
+    --disable-gnuv3
+    --enable-ad-clauses
+    --disable-all
+    --enable-dvbcsa
+    --enable-dvbpsi
+    --enable-ebml
+    --enable-ffmpeg
+    --enable-flac
+    --enable-gsm
+    --enable-matroska
+    --enable-modplug
+    --enable-mysofa
+    --enable-ogg
+    --enable-opus
+    --enable-rnnoise
+    --enable-soxr
+    --enable-spatialaudio
+    --enable-speex
+    --enable-speexdsp
+    --enable-taglib
+    --enable-vorbis
+    --enable-zlib
+)
+
 #
 # VLC options
 #
@@ -110,7 +138,6 @@ export VLC_CONTRIB_OPTIONS_XROS=(
 # Base configure options for VLC
 export VLC_CONFIG_OPTIONS_BASE=(
     --disable-sse
-    --disable-mmx
     --disable-a52
     --disable-vcd
     --disable-libcddb
@@ -154,6 +181,13 @@ export VLC_CONFIG_OPTIONS_TVOS=()
 # Additional configure options for xrOS
 export VLC_CONFIG_OPTIONS_XROS=()
 
+# Additional configure options for watchOS
+export VLC_CONFIG_OPTIONS_WATCHOS=(
+    --disable-chromecast
+    --disable-sout
+    --disable-css
+)
+
 #
 # VLC module options
 #
@@ -199,7 +233,6 @@ export VLC_MODULE_REMOVAL_LIST_BASE=(
     bluescreen
     erase
     speex_resampler
-    magnify
     gradient
     visual
     invert
@@ -233,3 +266,94 @@ export VLC_MODULE_REMOVAL_LIST_TVOS=()
 
 # Additional modules to remove for xrOS
 export VLC_MODULE_REMOVAL_LIST_XROS=()
+
+# Additional modules to remove for watchOS
+export VLC_MODULE_REMOVAL_LIST_WATCHOS=(
+    access_imem
+    access_mms
+    adjust
+    audioscrobbler
+    blend
+    canvas
+    cdg
+    chain
+    chroma_copy
+    croppadd
+    cvdsub
+    deinterlace
+    dummy
+    dvbsub
+    edgedetection
+    flaschen
+    formatcrop
+    fps
+    freeze
+    ftp
+    grey_yuv
+    h26x
+    http
+    https
+    hx
+    hxxxhelper_testdec
+    i420_nv12
+    i420_rgb
+    i420_yuy2
+    i422_i420
+    i422_yuy2
+    idummy
+    image
+    inflate
+    json_tracer
+    logo
+    marq
+    mjpeg
+    orient
+    rawvi
+    rawvideo
+    record
+    rotate
+    rtp_opus
+    rtp_mpeg12
+    rtp_ac3
+    rtp_xiph
+    rtp_raw
+    rtp_h265
+    rtp_h264
+    rtp_rtp_pcm
+    rtp_rtp
+    rv32
+    satip
+    scale
+    spudec
+    subsdec
+    subsdelay
+    substx3g
+    subsusf
+    subtitle
+    svcbsub
+    swscale
+    tcp
+    tdummy
+    telx
+    textst
+    transform
+    ttml
+    ty
+    udp
+    vc1
+    vdr
+    vdummy
+    video_splitter
+    vmem
+    vobsub
+    vpx_alpha
+    wdummy
+    webvtt
+    wextern
+    vgl
+    ytdl
+    yuv
+    yuvp
+    yuy2_i420
+    yuy2_i422
+)


=====================================
extras/package/apple/build.sh
=====================================
@@ -2,7 +2,7 @@
 # Copyright (C) Marvin Scholz
 #
 # Script to help build VLC or libVLC for Apple OSes
-# Supported OSes: iOS, tvOS, macOS
+# Supported OSes: iOS, tvOS, macOS, xrOS, watchOS
 #
 # Currently this script builds a full static library,
 # with all modules and contribs combined into one .a
@@ -211,7 +211,7 @@ set_deployment_target()
 validate_architecture()
 {
     case "$1" in
-    i386|x86_64|armv7|arm64)
+    i386|x86_64|armv7|arm64|armv7k|arm64_32)
         VLC_HOST_ARCH="$1"
         ;;
     aarch64)
@@ -318,8 +318,16 @@ validate_sdk_name()
             VLC_HOST_OS="xros"
             set_deployment_target "$VLC_DEPLOYMENT_TARGET_XROS"
             ;;
-        watch*)
-            abort_err "Building for watchOS is not supported by this script"
+        watchos*)
+            VLC_HOST_PLATFORM="watchOS"
+            VLC_HOST_OS="watchos"
+            set_deployment_target "$VLC_DEPLOYMENT_TARGET_WATCHOS"
+            ;;
+        watchsimulator*)
+            VLC_HOST_PLATFORM="watchSimulator"
+            VLC_HOST_PLATFORM_SIMULATOR="yes"
+            VLC_HOST_OS="watchos"
+            set_deployment_target "$VLC_DEPLOYMENT_TARGET_WATCHOS"
             ;;
         *)
             abort_err "Unhandled SDK name '$1'"
@@ -625,6 +633,9 @@ elif [ "$VLC_HOST_OS" = "tvos" ]; then
     export BUILDFORTVOS="yes"
 elif [ "$VLC_HOST_OS" = "xros" ]; then
     export BUILDFORIOS="yes"
+elif [ "$VLC_HOST_OS" = "watchos" ]; then
+    export BUILDFORIOS="yes"
+    export BUILDFORWATCHOS="yes"
 fi
 
 # Default to "make" if there is no MAKE env variable
@@ -661,6 +672,8 @@ elif [ "$VLC_HOST_OS" = "tvos" ]; then
     VLC_CONTRIB_OPTIONS+=( "${VLC_CONTRIB_OPTIONS_TVOS[@]}" )
 elif [ "$VLC_HOST_OS" = "xros" ]; then
     VLC_CONTRIB_OPTIONS+=( "${VLC_CONTRIB_OPTIONS_XROS[@]}" )
+elif [ "$VLC_HOST_OS" = "watchos" ]; then
+    VLC_CONTRIB_OPTIONS=( "${VLC_CONTRIB_OPTIONS_WATCHOS[@]}" )
 fi
 
 # Create dir to build contribs in
@@ -743,6 +756,8 @@ elif [ "$VLC_HOST_OS" = "tvos" ]; then
     VLC_CONFIG_OPTIONS+=( "${VLC_CONFIG_OPTIONS_TVOS[@]}" )
 elif [ "$VLC_HOST_OS" = "xros" ]; then
     VLC_CONFIG_OPTIONS+=( "${VLC_CONFIG_OPTIONS_XROS[@]}" )
+elif [ "$VLC_HOST_OS" = "watchos" ]; then
+    VLC_CONFIG_OPTIONS+=( "${VLC_CONFIG_OPTIONS_WATCHOS[@]}" )
 fi
 
 if [ "$VLC_DISABLE_DEBUG" -gt "0" ]; then
@@ -814,6 +829,8 @@ elif [ "$VLC_HOST_OS" = "tvos" ]; then
     VLC_MODULE_REMOVAL_LIST+=( "${VLC_MODULE_REMOVAL_LIST_TVOS[@]}" )
 elif [ "$VLC_HOST_OS" = "xros" ]; then
     VLC_MODULE_REMOVAL_LIST+=( "${VLC_MODULE_REMOVAL_LIST_XROS[@]}" )
+elif [ "$VLC_HOST_OS" = "watchos" ]; then
+    VLC_MODULE_REMOVAL_LIST+=( "${VLC_MODULE_REMOVAL_LIST_WATCHOS[@]}" )
 fi
 
 for module in "${VLC_MODULE_REMOVAL_LIST[@]}"; do


=====================================
extras/package/apple/xcodegen.yml
=====================================
@@ -1,10 +1,12 @@
 name: VLC
 options:
   bundleIdPrefix: org.videolan.vlc
-  supportedDestinations: [iOS, tvOS, visionOS]
+  supportedDestinations: [iOS, tvOS, visionOS, watchOS]
   deploymentTarget:
     iOS: 9.0
     tvOS: 12.0
+    visionOS: 1.0
+    watchOS: 7.4
 configs:
   Debug: debug
   Release: release
@@ -24,7 +26,7 @@ fileGroups:
 targets:
   VLCAutomake:
     type: ""
-    supportedDestinations: [iOS, tvOS, visionOS]
+    supportedDestinations: [iOS, tvOS, visionOS, watchOS]
     legacy:
       toolPath: ${VLC_SRC_DIR}/extras/package/apple/xcode.sh
       passSettings: true
@@ -60,9 +62,48 @@ targets:
             install_name_tool -change "@rpath/libvlccore.dylib" "@rpath/vlccore.framework/vlccore" \
                 "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
             codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+
+  vlccorewatchos:
+    type: "application"
+    platform: [watchOS]
+    dependencies:
+      - target: VLCAutomake
+      - target: vlc
+      - target: vlccore
+    info:
+      path: "vlccorewatchos/Info.plist"
+      properties:
+        CFBundleIdentifier: org.videolan.vlc.vlccore.watchapp
+        WKCompanionAppBundleIdentifier: org.videolan.vlc.vlccore
+        WKRunsIndependentlyOfCompanionApp: true
+        WKApplication: true
+        UIBackgroundModes:
+          - audio
+    settings:
+      PRODUCT_BUNDLE_IDENTIFIER: org.videolan.vlc.vlccoreios.watchapp
+    postBuildScripts:
+      - script: ${VLC_SRC_DIR}/extras/package/apple/copy_plugins.sh
+        name: "Copy VLC plugins"
+
+      - name: Copy vlccorewatchos binary
+        shell: /bin/bash
+        script: |
+            INPUT_FILES=()
+            for arch in ${ARCHS}; do
+                INPUT_FILES+=("${BUILT_PRODUCTS_DIR}/build-${PLATFORM_NAME}-${arch}${BUILD_SUFFIX}/build/test/.libs/vlccorewatchos")
+            done
+            lipo -create \
+                -output "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}" \
+                "${INPUT_FILES[@]}"
+            install_name_tool -change "@rpath/libvlc.dylib" "@rpath/vlc.framework/vlc" \
+                "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+            install_name_tool -change "@rpath/libvlccore.dylib" "@rpath/vlccore.framework/vlccore" \
+                "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+            codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
+
   vlc:
     type: "framework"
-    supportedDestinations: [iOS, tvOS, visionOS]
+    supportedDestinations: [iOS, tvOS, visionOS, watchOS]
     dependencies:
       - target: VLCAutomake
     info:
@@ -87,7 +128,7 @@ targets:
 
   vlccore:
     type: "framework"
-    supportedDestinations: [iOS, tvOS, visionOS]
+    supportedDestinations: [iOS, tvOS, visionOS, watchOS]
     dependencies:
       - target: VLCAutomake
     info:


=====================================
modules/audio_output/Makefile.am
=====================================
@@ -128,6 +128,9 @@ endif
 if HAVE_XROS
 libavsamplebuffer_plugin_la_SOURCES += audio_output/apple/avaudiosession_common.m
 endif
+if HAVE_WATCHOS
+libavsamplebuffer_plugin_la_SOURCES += audio_output/apple/avaudiosession_common.m
+endif
 libavsamplebuffer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(aoutdir)' \
 	-Wl,-framework,CoreMedia,-framework,Foundation,-framework,AVFoundation
 libavsamplebuffer_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-arc
@@ -152,3 +155,6 @@ endif
 if HAVE_XROS
 aout_LTLIBRARIES += libaudiounit_ios_plugin.la libavsamplebuffer_plugin.la
 endif
+if HAVE_WATCHOS
+aout_LTLIBRARIES += libavsamplebuffer_plugin.la
+endif


=====================================
modules/audio_output/apple/avaudiosession_common.m
=====================================
@@ -58,6 +58,7 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession *instance,
         channel_count = max_channel_count;
     }
 
+#if !TARGET_OS_WATCH
     NSError *error = nil;
     BOOL success = [instance setPreferredOutputNumberOfChannels:channel_count
                                                           error:&error];
@@ -69,10 +70,13 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession *instance,
                  !success ? (int)error.code : 0);
         channel_count = 2;
     }
+#else
+    channel_count = 2;
+#endif
 
     if (spatial_audio)
     {
-        if (@available(iOS 15.0, tvOS 15.0 VISIONOS_AVAILABLE, *))
+        if (@available(iOS 15.0, watchOS 8.0, tvOS 15.0 VISIONOS_AVAILABLE, *))
         {
             /* Not mandatory, SpatialAudio can work without it. It just signals to
              * the user that he is playing spatial content */
@@ -88,6 +92,7 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession *instance,
         aout_FormatPrepare(fmt);
     }
 
+#if !TARGET_OS_WATCH
     success = [instance setPreferredSampleRate:fmt->i_rate error:&error];
     if (!success)
     {
@@ -95,6 +100,7 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession *instance,
         msg_Dbg(p_aout, "setPreferredSampleRate failed %s(%d)",
                 error.domain.UTF8String, (int)error.code);
     }
+#endif
 }
 
 int
@@ -128,21 +134,21 @@ avas_GetPortType(audio_output_t *p_aout, AVAudioSession *instance,
     return VLC_SUCCESS;
 }
 
-struct API_AVAILABLE(ios(11.0) VISIONOS_API_AVAILABLE)
+struct API_AVAILABLE(ios(11.0), watchos(7.0) VISIONOS_API_AVAILABLE)
 role2policy
 {
     char role[sizeof("accessibility")];
     AVAudioSessionRouteSharingPolicy policy;
 };
 
-static int API_AVAILABLE(ios(11.0) VISIONOS_API_AVAILABLE)
+static int API_AVAILABLE(ios(11.0), watchos(7.0) VISIONOS_API_AVAILABLE)
 role2policy_cmp(const void *key, const void *val)
 {
     const struct role2policy *entry = val;
     return strcmp(key, entry->role);
 }
 
-static AVAudioSessionRouteSharingPolicy API_AVAILABLE(ios(11.0) VISIONOS_API_AVAILABLE)
+static AVAudioSessionRouteSharingPolicy API_AVAILABLE(ios(11.0), watchos(7.0) VISIONOS_API_AVAILABLE)
 GetRouteSharingPolicy(audio_output_t *p_aout)
 {
 #if __IPHONEOS_VERSION_MAX_ALLOWED < 130000
@@ -154,7 +160,7 @@ GetRouteSharingPolicy(audio_output_t *p_aout)
     /* LongFormAudio by default */
     AVAudioSessionRouteSharingPolicy policy = AVAudioSessionRouteSharingPolicyLongFormAudio;
     AVAudioSessionRouteSharingPolicy video_policy;
-#if !TARGET_OS_TV
+#if TARGET_OS_IOS || TARGET_OS_VISION
     if (@available(iOS 13.0 VISIONOS_AVAILABLE, *))
         video_policy = AVAudioSessionRouteSharingPolicyLongFormVideo;
     else
@@ -199,7 +205,7 @@ avas_SetActive(audio_output_t *p_aout, AVAudioSession *instance, bool active,
 
     if (active)
     {
-        if (@available(iOS 11.0, tvOS 11.0 VISIONOS_AVAILABLE, *))
+        if (@available(iOS 11.0, watchOS 7.0, tvOS 11.0 VISIONOS_AVAILABLE, *))
         {
             AVAudioSessionRouteSharingPolicy policy = GetRouteSharingPolicy(p_aout);
 


=====================================
modules/audio_output/apple/avsamplebuffer.m
=====================================
@@ -39,6 +39,7 @@
 #define MIN_MACOS 11.3
 #define MIN_IOS 14.5
 #define MIN_TVOS 14.5
+#define MIN_WATCHOS 7.4
 
 // work-around to fix compilation on older Xcode releases
 #if defined(TARGET_OS_VISION) && TARGET_OS_VISION
@@ -438,7 +439,7 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, size_t sizeInBytes)
                     selector:@selector(flushedAutomatically:)
                         name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
                       object:nil];
-    if (@available(macOS 12.0, iOS 15.0, tvOS 15.0 VISIONOS_AVAILABLE, *))
+    if (@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0 VISIONOS_AVAILABLE, *))
     {
         [notifCenter addObserver:self
                         selector:@selector(outputConfigurationChanged:)
@@ -459,7 +460,7 @@ error_avas:
 
 @end
 
-static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 DeviceSelect(audio_output_t *aout, const char *name)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -469,7 +470,7 @@ DeviceSelect(audio_output_t *aout, const char *name)
     return VLC_SUCCESS;
 }
 
-static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 MuteSet(audio_output_t *aout, bool mute)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -479,7 +480,7 @@ MuteSet(audio_output_t *aout, bool mute)
     return VLC_SUCCESS;
 }
 
-static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 VolumeSet(audio_output_t *aout, float volume)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -489,7 +490,7 @@ VolumeSet(audio_output_t *aout, float volume)
     return VLC_SUCCESS;
 }
 
-static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 Flush(audio_output_t *aout)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -497,7 +498,7 @@ Flush(audio_output_t *aout)
     [sys flush];
 }
 
-static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 Pause(audio_output_t *aout, bool pause, vlc_tick_t date)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -505,7 +506,7 @@ Pause(audio_output_t *aout, bool pause, vlc_tick_t date)
     [sys pause:pause date:date];
 }
 
-static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -513,7 +514,7 @@ Play(audio_output_t *aout, block_t *block, vlc_tick_t date)
     [sys play:block date:date];
 }
 
-static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static void API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 Stop(audio_output_t *aout)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -521,7 +522,7 @@ Stop(audio_output_t *aout)
     [sys stop];
 }
 
-static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS) VISIONOS_API_AVAILABLE)
+static int API_AVAILABLE(macos(MIN_MACOS), ios(MIN_IOS), tvos(MIN_TVOS), watchos(MIN_WATCHOS) VISIONOS_API_AVAILABLE)
 Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 {
     VLCAVSample *sys = (__bridge VLCAVSample*)aout->sys;
@@ -532,7 +533,7 @@ Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 static void
 Close(vlc_object_t *obj)
 {
-    if (@available(macOS MIN_MACOS, iOS MIN_IOS, tvOS MIN_TVOS VISIONOS_AVAILABLE, *))
+    if (@available(macOS MIN_MACOS, iOS MIN_IOS, tvOS MIN_TVOS, watchOS MIN_WATCHOS VISIONOS_AVAILABLE, *))
     {
         audio_output_t *aout = (audio_output_t *)obj;
         /* Transfer ownership back from VLC to ARC so that it can be released. */
@@ -546,7 +547,7 @@ Open(vlc_object_t *obj)
 {
     audio_output_t *aout = (audio_output_t *)obj;
 
-    if (@available(macOS MIN_MACOS, iOS MIN_IOS, tvOS MIN_TVOS VISIONOS_AVAILABLE, *))
+    if (@available(macOS MIN_MACOS, iOS MIN_IOS, tvOS MIN_TVOS, watchOS MIN_WATCHOS VISIONOS_AVAILABLE, *))
     {
         aout->sys = (__bridge_retained void*) [[VLCAVSample alloc] init:aout];
         if (aout->sys == nil)


=====================================
modules/codec/Makefile.am
=====================================
@@ -64,8 +64,10 @@ endif
 libaudiotoolboxmidi_plugin_la_SOURCES = codec/audiotoolbox_midi.c
 libaudiotoolboxmidi_plugin_la_LDFLAGS = $(AM_LDFLAGS) -Wl,-framework,CoreFoundation,-framework,AudioToolbox
 if HAVE_DARWIN
+if !HAVE_WATCHOS
 codec_LTLIBRARIES += libaudiotoolboxmidi_plugin.la
 endif
+endif
 
 liblpcm_plugin_la_SOURCES = codec/lpcm.c
 codec_LTLIBRARIES += liblpcm_plugin.la
@@ -364,8 +366,10 @@ libvideotoolbox_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) # Trigger MODULE_NAME declar
 libvideotoolbox_plugin_la_LIBADD = libchroma_copy.la libvlc_hxxxhelper.la libvlc_vtutils.la
 libvideotoolbox_plugin_la_LDFLAGS = $(AM_LDFLAGS) -Wl,-framework,CoreFoundation -Wl,-framework,VideoToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,Metal
 if HAVE_DARWIN
+if !HAVE_WATCHOS
 codec_LTLIBRARIES += libvideotoolbox_plugin.la
 endif
+endif
 
 videotoolbox_dpb_test_SOURCES = codec/videotoolbox/dpb_test.c \
                                 codec/videotoolbox/dpb.c \


=====================================
modules/services_discovery/Makefile.am
=====================================
@@ -92,8 +92,10 @@ libbonjour_plugin_la_SOURCES = services_discovery/bonjour.m
 libbonjour_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-arc
 libbonjour_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(sddir)' -Wl,-framework,Foundation
 if HAVE_DARWIN
+if !HAVE_WATCHOS
 sd_LTLIBRARIES += libbonjour_plugin.la
 endif
+endif
 
 libudisks_plugin_la_SOURCES = services_discovery/udisks.c
 libudisks_plugin_la_CFLAGS = $(AM_CFLAGS) $(SDBUS_CFLAGS)


=====================================
modules/video_chroma/Makefile.am
=====================================
@@ -84,8 +84,10 @@ libcvpx_plugin_la_SOURCES = codec/vt_utils.c codec/vt_utils.h video_chroma/cvpx.
 libcvpx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(chromadir)' -Wl,-framework,Foundation -Wl,-framework,VideoToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo
 libcvpx_plugin_la_LIBADD = libchroma_copy.la
 if HAVE_DARWIN
+if !HAVE_WATCHOS
 chroma_LTLIBRARIES += libcvpx_plugin.la
 endif
+endif
 
 libgst_mem_plugin_la_SOURCES = video_chroma/gst_mem.c \
 	codec/gstreamer/gstcopypicture.c codec/gstreamer/gstcopypicture.h codec/gstreamer/gst_mem.h


=====================================
modules/video_filter/Makefile.am
=====================================
@@ -57,9 +57,11 @@ librotate_plugin_la_LIBADD = libvlc_motion.la $(LIBM)
 librotate_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(video_filterdir)'
 if HAVE_DARWIN
 if !HAVE_TVOS
+if !HAVE_WATCHOS
 librotate_plugin_la_LDFLAGS += -Wl,-framework,IOKit,-framework,CoreFoundation
 endif
 endif
+endif
 libscale_plugin_la_SOURCES = video_filter/scale.c
 libscene_plugin_la_SOURCES = video_filter/scene.c
 libscene_plugin_la_LIBADD = $(LIBM)


=====================================
modules/video_output/Makefile.am
=====================================
@@ -74,6 +74,7 @@ vout_LTLIBRARIES += libvout_macosx_plugin.la libcaopengllayer_plugin.la libwindo
 endif
 
 if HAVE_DARWIN
+if !HAVE_WATCHOS
 libsamplebufferdisplay_plugin_la_SOURCES = video_output/apple/VLCSampleBufferDisplay.m codec/vt_utils.c codec/vt_utils.h
 libsamplebufferdisplay_plugin_la_OBJCFLAGS = $(AM_OBJCFLAGS) -fobjc-arc
 if HAVE_OSX
@@ -85,6 +86,7 @@ libsamplebufferdisplay_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
 endif
 vout_LTLIBRARIES += libsamplebufferdisplay_plugin.la
 endif
+endif
 
 libvout_ios_plugin_la_SOURCES = video_output/opengl/display.c $(OPENGL_VOUT_COMMONSOURCES)
 libvout_ios_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DUSE_OPENGL_ES2


=====================================
src/darwin/netconf.m
=====================================
@@ -31,7 +31,9 @@
 
 #import <TargetConditionals.h>
 #if TARGET_OS_IPHONE
+#if !TARGET_OS_WATCH
 #include <CFNetwork/CFProxySupport.h>
+#endif
 #else
 #include <CoreServices/CoreServices.h>
 #endif


=====================================
test/Makefile.am
=====================================
@@ -453,6 +453,16 @@ if HAVE_XROS
 noinst_PROGRAMS += vlccoreios
 endif
 
+vlccorewatchos_SOURCES = watchosvlc.m
+vlccorewatchos_LDFLAGS = $(LDFLAGS_vlc) -Wl,-framework,WatchKit
+vlccorewatchos_LDFLAGS += -Xlinker -rpath -Xlinker "@executable_path/Frameworks/"
+vlccorewatchos_OBJCFLAGS = -fobjc-arc
+vlccorewatchos_LDADD = ../lib/libvlc.la ../src/libvlccore.la
+
+if HAVE_WATCHOS
+noinst_PROGRAMS += vlccorewatchos
+endif
+
 vlc_window_SOURCES = vlc-window.c
 vlc_window_CPPFLAGS = $(AM_CPPFLAGS) -I../include/
 vlc_window_LDADD = ../lib/libvlc.la ../src/libvlccore.la ../compat/libcompat.la


=====================================
test/watchosvlc.m
=====================================
@@ -0,0 +1,150 @@
+/*****************************************************************************
+ * iosvlc.m: watchOS specific development main executable for VLC media player
+ *****************************************************************************
+ * Copyright (C) 2020, 2024 Videolabs
+ *
+ * Authors: Marvin Scholz <epirat07 at gmail dot com>
+ *          Alexandre Janniaux <ajanni at videolabs.io>
+ *          Felix Paul Kühne <fkuehne at videolabs.io>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#undef VLC_DYNAMIC_PLUGINS
+
+#define MODULE_NAME ios_interface
+#undef VLC_DYNAMIC_PLUGINS
+
+#include <vlc/vlc.h>
+
+#include <vlc_common.h>
+#include <vlc_variables.h>
+#include <vlc_plugin.h>
+
+#include "../lib/libvlc_internal.h"
+
+#import <WatchKit/WatchKit.h>
+
+ at interface InterfaceController : WKInterfaceController
+
+ at end
+
+ at implementation InterfaceController
+
+- (void)awakeWithContext:(id)context {
+    [super awakeWithContext:context];
+}
+
+- (void)willActivate {
+    [super willActivate];
+}
+
+- (void)didDeactivate {
+    [super didDeactivate];
+}
+
+ at end
+
+ at interface AppDelegate : NSObject <WKApplicationDelegate> {
+    @public
+    libvlc_instance_t *_libvlc;
+}
+ at end
+
+ at implementation AppDelegate
+/* Called after application launch */
+- (void)applicationDidFinishLaunching {
+    /* Store startup arguments to forward them to libvlc */
+    NSArray *arguments = [[NSProcessInfo processInfo] arguments];
+    unsigned vlc_argc = [arguments count] - 1;
+    const char **vlc_argv = malloc(vlc_argc * sizeof *vlc_argv);
+    if (vlc_argv == NULL)
+        return;
+
+    for (unsigned i = 0; i < vlc_argc; i++)
+        vlc_argv[i] = [[arguments objectAtIndex:i + 1] UTF8String];
+
+    /* Initialize libVLC */
+    _libvlc = libvlc_new(vlc_argc, (const char * const*)vlc_argv);
+    free(vlc_argv);
+
+    if (_libvlc == NULL)
+        return;
+
+    /* Start glue interface, see code below */
+    libvlc_InternalAddIntf(_libvlc->p_libvlc_int, "ios_interface,none");
+
+    /* Start parsing arguments and eventual playback */
+    libvlc_InternalPlay(_libvlc->p_libvlc_int);
+}
+
+- (Class)applicationRootInterfaceControllerClass {
+    return [InterfaceController class];
+}
+ at end
+
+int main(int argc, char * argv[]) {
+    @autoreleasepool {
+        return WKApplicationMain(argc, argv, NSStringFromClass([AppDelegate class]));
+    }
+}
+
+/* Glue interface code */
+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[] = {
+    VLC_SYMBOL(vlc_entry),
+    NULL
+};



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4698e0336447de8dc6f7214743082cc55b6ebd77...916dc562f73fdb6573e3994812e24c8cea3e95ce

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4698e0336447de8dc6f7214743082cc55b6ebd77...916dc562f73fdb6573e3994812e24c8cea3e95ce
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