Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
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
Show 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 @@
...
@@ -32,6 +32,7 @@
NSString
*
localizedName
;
NSString
*
localizedName
;
VLCMediaList
*
discoveredMedia
;
VLCMediaList
*
discoveredMedia
;
void
*
mdis
;
void
*
mdis
;
BOOL
running
;
}
}
+
(
NSArray
*
)
availableMediaDiscoverer
;
+
(
NSArray
*
)
availableMediaDiscoverer
;
...
@@ -40,4 +41,6 @@
...
@@ -40,4 +41,6 @@
-
(
VLCMediaList
*
)
discoveredMedia
;
-
(
VLCMediaList
*
)
discoveredMedia
;
-
(
NSString
*
)
localizedName
;
-
(
NSString
*
)
localizedName
;
-
(
BOOL
)
isRunning
;
@end
@end
extras/MacOSX/Framework/Sources/VLCMediaDiscoverer.m
View file @
ee9c15aa
...
@@ -26,11 +26,40 @@
...
@@ -26,11 +26,40 @@
#import "VLCMediaDiscoverer.h"
#import "VLCMediaDiscoverer.h"
#import "VLCLibrary.h"
#import "VLCLibrary.h"
#import "VLCLibVLCBridging.h"
#import "VLCLibVLCBridging.h"
#import "VLCEventManager.h"
#include <vlc/libvlc.h>
#include <vlc/libvlc.h>
static
NSArray
*
availableMediaDiscoverer
=
nil
;
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
@implementation
VLCMediaDiscoverer
+
(
NSArray
*
)
availableMediaDiscoverer
+
(
NSArray
*
)
availableMediaDiscoverer
{
{
...
@@ -55,11 +84,33 @@ static NSArray * availableMediaDiscoverer = nil;
...
@@ -55,11 +84,33 @@ static NSArray * availableMediaDiscoverer = nil;
mdis
=
libvlc_media_discoverer_new_from_name
(
[
VLCLibrary
sharedInstance
],
mdis
=
libvlc_media_discoverer_new_from_name
(
[
VLCLibrary
sharedInstance
],
[
aServiceName
UTF8String
],
[
aServiceName
UTF8String
],
&
ex
);
&
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
);
quit_on_exception
(
&
ex
);
}
}
return
self
;
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
-
(
void
)
dealloc
{
{
if
(
localizedName
)
if
(
localizedName
)
...
@@ -105,4 +156,25 @@ static NSArray * availableMediaDiscoverer = nil;
...
@@ -105,4 +156,25 @@ static NSArray * availableMediaDiscoverer = nil;
}
}
return
localizedName
;
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
@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