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
549b9331
Commit
549b9331
authored
Dec 22, 2009
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/framework: Handle media changed events.
parent
5871680a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
+31
-5
projects/macosx/framework/Sources/VLCMediaPlayer.m
projects/macosx/framework/Sources/VLCMediaPlayer.m
+31
-5
No files found.
projects/macosx/framework/Sources/VLCMediaPlayer.m
View file @
549b9331
...
...
@@ -95,7 +95,7 @@ static void HandleMediaPositionChanged(const libvlc_event_t * event, void * self
static
void
HandleMediaInstanceStateChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
VLCMediaPlayerState
newState
;
if
(
event
->
type
==
libvlc_MediaPlayerPlaying
)
newState
=
VLCMediaPlayerStatePlaying
;
else
if
(
event
->
type
==
libvlc_MediaPlayerPaused
)
...
...
@@ -109,19 +109,31 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
NSLog
(
@"%s: Unknown event"
,
__FUNCTION__
);
return
;
}
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaPlayerStateChanged
:)
withArgumentAsObject:
[
NSNumber
numberWithInt
:
newState
]];
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
withDelegateMethod:
@selector
(
mediaPlayerStateChanged
:)
withNotificationName:
VLCMediaPlayerStateChanged
];
[
pool
release
];
}
static
void
HandleMediaPlayerMediaChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaPlayerMediaChanged
:)
withArgumentAsObject:
[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
event
->
u
.
media_player_media_changed
.
new_media
]];
[
pool
release
];
}
...
...
@@ -134,6 +146,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
-
(
void
)
mediaPlayerTimeChanged
:(
NSNumber
*
)
newTime
;
-
(
void
)
mediaPlayerPositionChanged
:(
NSNumber
*
)
newTime
;
-
(
void
)
mediaPlayerStateChanged
:(
NSNumber
*
)
newState
;
-
(
void
)
mediaPlayerMediaChanged
:(
VLCMedia
*
)
media
;
@end
@implementation
VLCMediaPlayer
...
...
@@ -894,6 +907,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
/* FIXME: We may want to turn that off when none is interested by that */
libvlc_event_attach
(
p_em
,
libvlc_MediaPlayerPositionChanged
,
HandleMediaPositionChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaPlayerTimeChanged
,
HandleMediaTimeChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaPlayerMediaChanged
,
HandleMediaPlayerMediaChanged
,
self
,
&
ex
);
catch_exception
(
&
ex
);
}
...
...
@@ -906,6 +920,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_event_detach
(
p_em
,
libvlc_MediaPlayerEndReached
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaPlayerPositionChanged
,
HandleMediaPositionChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaPlayerTimeChanged
,
HandleMediaTimeChanged
,
self
,
NULL
);
libvlc_event_attach
(
p_em
,
libvlc_MediaPlayerMediaChanged
,
HandleMediaPlayerMediaChanged
,
self
,
NULL
);
}
-
(
void
)
mediaPlayerTimeChanged
:(
NSNumber
*
)
newTime
...
...
@@ -941,4 +956,15 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
[
self
didChangeValueForKey
:
@"state"
];
}
-
(
void
)
mediaPlayerMediaChanged
:(
VLCMedia
*
)
newMedia
{
[
self
willChangeValueForKey
:
@"media"
];
if
(
media
!=
newMedia
)
{
[
media
release
];
media
=
[
newMedia
retain
];
}
[
self
didChangeValueForKey
:
@"media"
];
}
@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