Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
4k
Issue boards
Milestones
Code
Merge requests
453
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC
Commits
91a29cac
Commit
91a29cac
authored
5 years ago
by
Felix Paul Kühne
Browse files
Options
Downloads
Patches
Plain Diff
macosx/input item: implement parsing
parent
1daec27b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/gui/macosx/library/VLCInputItem.h
+8
-0
8 additions, 0 deletions
modules/gui/macosx/library/VLCInputItem.h
modules/gui/macosx/library/VLCInputItem.m
+75
-0
75 additions, 0 deletions
modules/gui/macosx/library/VLCInputItem.m
with
83 additions
and
0 deletions
modules/gui/macosx/library/VLCInputItem.h
+
8
−
0
View file @
91a29cac
...
...
@@ -28,6 +28,10 @@
NS_ASSUME_NONNULL_BEGIN
extern
NSString
*
VLCInputItemParsingSucceeded
;
extern
NSString
*
VLCInputItemParsingFailed
;
extern
NSString
*
VLCInputItemSubtreeAdded
;
@interface
VLCInputItem
:
NSObject
-
(
instancetype
)
initWithInputItem
:(
struct
input_item_t
*
)
p_inputItem
;
...
...
@@ -37,6 +41,10 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
readonly
)
NSString
*
MRL
;
@property
(
readonly
)
vlc_tick_t
duration
;
@property
(
readonly
)
enum
input_item_type_e
inputType
;
@property
(
readonly
)
struct
input_item_node_t
*
subTree
;
-
(
void
)
parseInputItem
;
-
(
void
)
cancelParsing
;
@end
...
...
This diff is collapsed.
Click to expand it.
modules/gui/macosx/library/VLCInputItem.m
+
75
−
0
View file @
91a29cac
...
...
@@ -22,8 +22,47 @@
#import "VLCInputItem.h"
#import "main/VLCMain.h"
#import "extensions/NSString+Helpers.h"
NSString
*
VLCInputItemParsingSucceeded
=
@"VLCInputItemParsingSucceeded"
;
NSString
*
VLCInputItemParsingFailed
=
@"VLCInputItemParsingFailed"
;
NSString
*
VLCInputItemSubtreeAdded
=
@"VLCInputItemSubtreeAdded"
;
@interface
VLCInputItem
()
{
input_item_parser_id_t
*
_p_parserID
;
}
-
(
void
)
parsingEnded
:(
int
)
status
;
-
(
void
)
subTreeAdded
:(
input_item_node_t
*
)
p_node
;
@end
static
void
cb_parsing_ended
(
input_item_t
*
p_item
,
int
status
,
void
*
p_data
)
{
VLC_UNUSED
(
p_item
);
dispatch_async
(
dispatch_get_main_queue
(),
^
{
VLCInputItem
*
inputItem
=
(
__bridge
VLCInputItem
*
)
p_data
;
[
inputItem
parsingEnded
:
status
];
});
}
static
void
cb_subtree_added
(
input_item_t
*
p_item
,
input_item_node_t
*
p_node
,
void
*
p_data
)
{
VLC_UNUSED
(
p_item
);
dispatch_async
(
dispatch_get_main_queue
(),
^
{
VLCInputItem
*
inputItem
=
(
__bridge
VLCInputItem
*
)
p_data
;
[
inputItem
subTreeAdded
:
p_node
];
});
}
static
const
struct
input_item_parser_cbs_t
parserCallbacks
=
{
cb_parsing_ended
,
cb_subtree_added
,
};
@implementation
VLCInputItem
-
(
instancetype
)
initWithInputItem
:(
struct
input_item_t
*
)
p_inputItem
...
...
@@ -38,6 +77,9 @@
-
(
void
)
dealloc
{
if
(
_p_parserID
)
{
input_item_parser_id_Release
(
_p_parserID
);
}
input_item_Release
(
_vlcInputItem
);
}
...
...
@@ -73,6 +115,39 @@
return
ITEM_TYPE_UNKNOWN
;
}
-
(
void
)
parseInputItem
{
_p_parserID
=
input_item_Parse
(
_vlcInputItem
,
(
vlc_object_t
*
)
getIntf
(),
&
parserCallbacks
,
(
__bridge
void
*
)
self
);
}
-
(
void
)
cancelParsing
{
if
(
_p_parserID
)
{
input_item_parser_id_Interrupt
(
_p_parserID
);
}
}
-
(
void
)
parsingEnded
:(
int
)
status
{
NSNotificationCenter
*
notificationCenter
=
[
NSNotificationCenter
defaultCenter
];
if
(
status
)
{
[
notificationCenter
postNotificationName
:
VLCInputItemParsingSucceeded
object
:
self
];
}
else
{
[
notificationCenter
postNotificationName
:
VLCInputItemParsingFailed
object
:
self
];
}
input_item_parser_id_Release
(
_p_parserID
);
_p_parserID
=
NULL
;
}
-
(
void
)
subTreeAdded
:(
input_item_node_t
*
)
p_node
{
_subTree
=
p_node
;
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCInputItemSubtreeAdded
object
:
self
];
}
@end
@interface
VLCInputNode
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment