[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Fix indentation

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Dec 23 14:18:50 UTC 2023



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
ccc11c3e by Claudio Cambra at 2023-12-23T14:05:15+00:00
macosx: Fix indentation

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
01485abd by Claudio Cambra at 2023-12-23T14:05:15+00:00
macosx: Check whether file is playable before adding it to a media source's child input nodes

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
83eddc2c by Claudio Cambra at 2023-12-23T14:05:15+00:00
macosx: Ensure directories, discs, and other input types are still presented as child nodes in media sources

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
37207266 by Claudio Cambra at 2023-12-23T14:05:15+00:00
input_item: Add a function to check if an input_item is actually playable by VLC

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
41a8d305 by Claudio Cambra at 2023-12-23T14:05:15+00:00
macosx: Use input_item_Playable instead of macosx copied funcs in VLCMediaSource

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


4 changed files:

- include/vlc_input_item.h
- modules/gui/macosx/library/media-source/VLCMediaSource.m
- src/input/item.c
- src/libvlccore.sym


Changes:

=====================================
include/vlc_input_item.h
=====================================
@@ -275,6 +275,12 @@ VLC_API int input_item_AddOpaque(input_item_t *, const char *, void *);
 
 void input_item_ApplyOptions(vlc_object_t *, input_item_t *);
 
+/**
+ * This function checks whether the input item is of a type that can be played.
+ * It does this by checking the extension of the input item.
+ */
+VLC_API bool input_item_Playable(const char *);
+
 VLC_API bool input_item_slave_GetType(const char *, enum slave_type *);
 
 VLC_API input_item_slave_t *input_item_slave_New(const char *, enum slave_type,


=====================================
modules/gui/macosx/library/media-source/VLCMediaSource.m
=====================================
@@ -380,14 +380,14 @@ static const char *const myFoldersDescription = "My Folders";
         return;
     }
 
-    for (NSURL *url in subDirectories) {
+    for (NSURL * const url in subDirectories) {
         NSNumber *isDirectory;
         NSNumber *isVolume;
         NSNumber *isEjectable;
         NSNumber *isInternal;
         NSNumber *isLocal;
 
-	[url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
+	    [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
         [url getResourceValue:&isVolume forKey:NSURLIsVolumeKey error:nil];
         [url getResourceValue:&isEjectable forKey:NSURLVolumeIsEjectableKey error:nil];
         [url getResourceValue:&isInternal forKey:NSURLVolumeIsInternalKey error:nil];
@@ -395,10 +395,13 @@ static const char *const myFoldersDescription = "My Folders";
         
         const enum input_item_type_e inputType = isDirectory.boolValue ? isEjectable.boolValue ? ITEM_TYPE_DISC : ITEM_TYPE_DIRECTORY : ITEM_TYPE_FILE;
         const enum input_item_net_type netType = isLocal.boolValue ? ITEM_LOCAL : ITEM_NET;
+
+        const char * const psz_filename = url.absoluteString.UTF8String;
+        const char * const psz_name = url.lastPathComponent.UTF8String;
         
-        input_item_t *urlInputItem = input_item_NewExt(url.absoluteString.UTF8String, url.lastPathComponent.UTF8String, 0, inputType, netType);
-        if (urlInputItem != NULL) {
-            input_item_node_t *urlNode = input_item_node_Create(urlInputItem);
+        input_item_t *urlInputItem = input_item_NewExt(psz_filename, psz_name, 0, inputType, netType);
+        if (urlInputItem != NULL && (inputType != ITEM_TYPE_FILE || input_item_Playable(psz_filename))) {
+            input_item_node_t * const urlNode = input_item_node_Create(urlInputItem);
             if (urlNode) {
                 input_item_node_AppendNode(directoryNode, urlNode);
             }


=====================================
src/input/item.c
=====================================
@@ -708,6 +708,16 @@ static info_category_t *InputItemFindCat( input_item_t *p_item,
     return NULL;
 }
 
+bool input_item_Playable(const char *psz_filename)
+{
+    if (psz_filename == NULL) {
+        return false;
+    }
+
+    enum slave_type unused;
+    return input_item_slave_GetType(psz_filename, &unused) || input_item_IsMaster(psz_filename);
+}
+
 /**
  * Get a info item from a given category in a given input item.
  *


=====================================
src/libvlccore.sym
=====================================
@@ -206,6 +206,7 @@ input_item_MetaMatch
 input_item_MergeInfos
 input_item_NewExt
 input_item_Hold
+input_item_Playable
 input_item_Release
 input_item_node_AppendItem
 input_item_node_AppendNode



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b85cb032dbb66112af4baccf9d5366461c92f738...41a8d305444e949c396d5cb61cc06f0d7ba984c5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b85cb032dbb66112af4baccf9d5366461c92f738...41a8d305444e949c396d5cb61cc06f0d7ba984c5
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