Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ee9c15aa
Commit
ee9c15aa
authored
Dec 25, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/Framework/VLCMediaDiscoverer: Publish -isRunning.
parent
1f40daaf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
extras/MacOSX/Framework/Headers/Public/VLCMediaDiscoverer.h
extras/MacOSX/Framework/Headers/Public/VLCMediaDiscoverer.h
+3
-0
extras/MacOSX/Framework/Sources/VLCMediaDiscoverer.m
extras/MacOSX/Framework/Sources/VLCMediaDiscoverer.m
+72
-0
No files found.
extras/MacOSX/Framework/Headers/Public/VLCMediaDiscoverer.h
View file @
ee9c15aa
...
...
@@ -32,6 +32,7 @@
NSString
*
localizedName
;
VLCMediaList
*
discoveredMedia
;
void
*
mdis
;
BOOL
running
;
}
+
(
NSArray
*
)
availableMediaDiscoverer
;
...
...
@@ -40,4 +41,6 @@
-
(
VLCMediaList
*
)
discoveredMedia
;
-
(
NSString
*
)
localizedName
;
-
(
BOOL
)
isRunning
;
@end
extras/MacOSX/Framework/Sources/VLCMediaDiscoverer.m
View file @
ee9c15aa
...
...
@@ -26,11 +26,40 @@
#import "VLCMediaDiscoverer.h"
#import "VLCLibrary.h"
#import "VLCLibVLCBridging.h"
#import "VLCEventManager.h"
#include <vlc/libvlc.h>
static
NSArray
*
availableMediaDiscoverer
=
nil
;
@interface
VLCMediaDiscoverer
(
Private
)
-
(
void
)
mediaDiscovererStarted
;
-
(
void
)
mediaDiscovererEnded
;
@end
/* libvlc event callback */
static
void
HandleMediaDiscovererStarted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
NSLog
(
@"oopps"
);
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
self
=
user_data
;
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaDiscovererStarted
)
withArgumentAsObject:
nil
];
[
pool
release
];
}
static
void
HandleMediaDiscovererEnded
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
id
self
=
user_data
;
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaDiscovererEnded
)
withArgumentAsObject:
nil
];
[
pool
release
];
}
@implementation
VLCMediaDiscoverer
+
(
NSArray
*
)
availableMediaDiscoverer
{
...
...
@@ -55,11 +84,33 @@ static NSArray * availableMediaDiscoverer = nil;
mdis
=
libvlc_media_discoverer_new_from_name
(
[
VLCLibrary
sharedInstance
],
[
aServiceName
UTF8String
],
&
ex
);
libvlc_event_manager_t
*
p_em
=
libvlc_media_discoverer_event_manager
(
mdis
);
libvlc_event_attach
(
p_em
,
libvlc_MediaDiscovererStarted
,
HandleMediaDiscovererStarted
,
self
,
NULL
);
libvlc_event_attach
(
p_em
,
libvlc_MediaDiscovererEnded
,
HandleMediaDiscovererEnded
,
self
,
NULL
);
running
=
libvlc_media_discoverer_is_running
(
mdis
);
quit_on_exception
(
&
ex
);
}
return
self
;
}
-
(
void
)
release
{
@synchronized
(
self
)
{
if
([
self
retainCount
]
<=
1
)
{
/* We must make sure we won't receive new event after an upcoming dealloc
* We also may receive a -retain in some event callback that may occcur
* Before libvlc_event_detach. So this can't happen in dealloc */
libvlc_event_manager_t
*
p_em
=
libvlc_media_list_event_manager
(
mdis
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaDiscovererStarted
,
HandleMediaDiscovererStarted
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaDiscovererEnded
,
HandleMediaDiscovererEnded
,
self
,
NULL
);
}
[
super
release
];
}
}
-
(
void
)
dealloc
{
if
(
localizedName
)
...
...
@@ -105,4 +156,25 @@ static NSArray * availableMediaDiscoverer = nil;
}
return
localizedName
;
}
-
(
BOOL
)
isRunning
{
return
running
;
}
@end
@implementation
VLCMediaDiscoverer
(
Private
)
-
(
void
)
mediaDiscovererStarted
{
[
self
willChangeValueForKey
:
@"running"
];
running
=
YES
;
NSLog
(
@"mediaDiscovererStarted %@"
,
[
self
localizedName
]);
[
self
didChangeValueForKey
:
@"running"
];
}
-
(
void
)
mediaDiscovererEnded
{
[
self
willChangeValueForKey
:
@"running"
];
running
=
NO
;
[
self
didChangeValueForKey
:
@"running"
];
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment