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
af252afb
Commit
af252afb
authored
Dec 28, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/Framework/VLCMediaPlayer.m: Enable bindings uses on the @"time" key.
parent
cf0875cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
+20
-19
No files found.
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
View file @
af252afb
...
@@ -43,10 +43,15 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t *event, void *
...
@@ -43,10 +43,15 @@ static void HandleMediaInstanceVolumeChanged(const libvlc_event_t *event, void *
static
void
HandleMediaTimeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
static
void
HandleMediaTimeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaPlayerTimeChanged
:)
withArgumentAsObject:
[
NSNumber
numberWithLongLong
:
event
->
u
.
media_instance_position_changed
.
new_position
]];
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
withDelegateMethod:
@selector
(
mediaPlayerTimeChanged
:)
withDelegateMethod:
@selector
(
mediaPlayerTimeChanged
:)
withNotificationName:
VLCMediaPlayerTimeChanged
];
withNotificationName:
VLCMediaPlayerTimeChanged
];
[
pool
release
];
}
}
static
void
HandleMediaInstanceStateChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
static
void
HandleMediaInstanceStateChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
...
@@ -74,13 +79,13 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -74,13 +79,13 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
@interface
VLCMediaPlayer
(
Private
)
@interface
VLCMediaPlayer
(
Private
)
-
(
void
)
registerObservers
;
-
(
void
)
registerObservers
;
-
(
void
)
unregisterObservers
;
-
(
void
)
unregisterObservers
;
-
(
void
)
mediaPlayerTimeChanged
:(
NSNumber
*
)
newTime
;
@end
@end
@implementation
VLCMediaPlayer
@implementation
VLCMediaPlayer
-
(
id
)
init
-
(
id
)
init
{
{
self
=
[
self
initWithVideoView
:
nil
];
return
[
self
initWithVideoView
:
nil
];
return
self
;
}
}
-
(
id
)
initWithVideoView
:(
VLCVideoView
*
)
aVideoView
-
(
id
)
initWithVideoView
:(
VLCVideoView
*
)
aVideoView
...
@@ -89,7 +94,7 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -89,7 +94,7 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
{
{
delegate
=
nil
;
delegate
=
nil
;
media
=
nil
;
media
=
nil
;
cachedTime
=
[[
VLCTime
nullTime
]
retain
];
// Create a media instance, it doesn't matter what library we start off with
// Create a media instance, it doesn't matter what library we start off with
// it will change depending on the media descriptor provided to the media
// it will change depending on the media descriptor provided to the media
// instance
// instance
...
@@ -116,9 +121,8 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -116,9 +121,8 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
libvlc_media_instance_release
((
libvlc_media_instance_t
*
)
instance
);
libvlc_media_instance_release
((
libvlc_media_instance_t
*
)
instance
);
// Get rid of everything else
// Get rid of everything else
instance
=
nil
;
videoView
=
nil
;
[
media
release
];
[
media
release
];
[
cachedTime
release
];
[
super
dealloc
];
[
super
dealloc
];
}
}
...
@@ -282,18 +286,7 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -282,18 +286,7 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
-
(
VLCTime
*
)
time
-
(
VLCTime
*
)
time
{
{
libvlc_exception_t
ex
;
return
cachedTime
;
libvlc_exception_init
(
&
ex
);
// Results are returned in seconds...duration is returned in milliseconds
long
long
time
=
libvlc_media_instance_get_time
(
(
libvlc_media_instance_t
*
)
instance
,
&
ex
)
*
1000
;
if
(
libvlc_exception_raised
(
&
ex
))
{
libvlc_exception_clear
(
&
ex
);
return
[
VLCTime
nullTime
];
// Error in obtaining the time, return a null time defintition (--:--:--)
}
else
return
[
VLCTime
timeWithNumber
:[
NSNumber
numberWithLongLong
:
time
]];
}
}
-
(
void
)
setChapter
:(
int
)
value
;
-
(
void
)
setChapter
:(
int
)
value
;
...
@@ -518,6 +511,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
...
@@ -518,6 +511,7 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
/* FIXME: We may want to turn that off when none is interested by that */
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
}
}
...
@@ -530,4 +524,11 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
...
@@ -530,4 +524,11 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
libvlc_event_detach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
NULL
);
}
}
-
(
void
)
mediaPlayerTimeChanged
:(
NSNumber
*
)
newTime
{
[
self
willChangeValueForKey
:
@"time"
];
[
cachedTime
release
];
cachedTime
=
[[
VLCTime
timeWithNumber
:
newTime
]
retain
];
[
self
didChangeValueForKey
:
@"time"
];
}
@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