Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
892f3b5a
Commit
892f3b5a
authored
Feb 28, 2010
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc: Attempt to fix set_nsobject() with QMacCocoaViewContainer and improve documentation.
parent
1609af14
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+19
-3
modules/video_output/macosx.m
modules/video_output/macosx.m
+21
-3
No files found.
include/vlc/libvlc_media_player.h
View file @
892f3b5a
...
...
@@ -193,8 +193,10 @@ VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
/**
* Set the NSView handler where the media player should render its video output.
*
* The object minimal_macosx expects is of kind NSObject and should
* respect the protocol:
* Use the vout called "macosx".
*
* The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
* protocol:
*
* @begincode
* \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
...
...
@@ -203,10 +205,24 @@ VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
* \@end
* @endcode
*
* Or it can be an NSView object.
*
* If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
* the following code should work:
* @begincode
* {
* NSView *video = [[NSView alloc] init];
* QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
* libvlc_media_player_set_nsobject(mp, video);
* [video release];
* }
* @endcode
*
* You can find a live example in VLCVideoView in VLCKit.framework.
*
* \param p_mi the Media Player
* \param drawable the NSView handler
* \param drawable the drawable that is either an NSView or an object following
* the VLCOpenGLVideoViewEmbedding protocol.
*/
VLC_PUBLIC_API
void
libvlc_media_player_set_nsobject
(
libvlc_media_player_t
*
p_mi
,
void
*
drawable
);
...
...
modules/video_output/macosx.m
View file @
892f3b5a
...
...
@@ -144,7 +144,21 @@ static int Open(vlc_object_t *this)
/* We don't wait, that means that we'll have to be careful about releasing
* container.
* That's why we'll release on main thread in Close(). */
if
([(
id
)
container
respondsToSelector
:
@selector
(
addVoutSubview
:)])
[(
id
)
container
performSelectorOnMainThread
:
@selector
(
addVoutSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
else
if
([
container
isKindOfClass
:[
NSView
class
]])
{
NSView
*
parentView
=
container
;
[
parentView
performSelectorOnMainThread
:
@selector
(
addSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
setFrame
:)
withObject
:
[
NSValue
valueWithRect
:[
parentView
bounds
]]
waitUntilDone
:
NO
];
}
else
{
msg_Err
(
vd
,
"Invalid drawable-nsobject object. drawable-nsobject must either be an NSView or comply to the @protocol VLCOpenGLVideoViewEmbedding."
);
goto
error
;
}
[
nsPool
release
];
nsPool
=
nil
;
...
...
@@ -192,8 +206,11 @@ void Close(vlc_object_t *this)
[
sys
->
glView
setVoutDisplay
:
nil
];
var_Destroy
(
vd
,
"drawable-nsobject"
);
if
([(
id
)
sys
->
container
respondsToSelector
:
@selector
(
removeVoutSubview
:)])
{
/* This will retain sys->glView */
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
removeVoutSubview
:)
withObject
:
sys
->
glView
waitUntilDone
:
NO
];
}
/* release on main thread as explained in Open() */
[(
id
)
sys
->
container
performSelectorOnMainThread
:
@selector
(
release
)
withObject
:
nil
waitUntilDone
:
NO
];
[
sys
->
glView
performSelectorOnMainThread
:
@selector
(
removeFromSuperview
)
withObject
:
nil
waitUntilDone
:
NO
];
...
...
@@ -353,6 +370,7 @@ static void OpenglSwap(vout_opengl_t *gl)
GLint
params
[]
=
{
1
};
CGLSetParameter
([[
self
openGLContext
]
CGLContextObj
],
kCGLCPSwapInterval
,
params
);
[
self
setAutoresizingMask
:
NSViewWidthSizable
|
NSViewHeightSizable
];
return
self
;
}
...
...
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