Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC Browser Plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
VideoLAN
VLC Browser Plugins
Commits
5395720e
Commit
5395720e
authored
Jun 21, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowed mac plugin: show last frame if input is paused and don't show branding when buffering
parent
8a21163b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
30 deletions
+53
-30
npapi/vlcplugin_mac.mm
npapi/vlcplugin_mac.mm
+53
-30
No files found.
npapi/vlcplugin_mac.mm
View file @
5395720e
...
...
@@ -45,6 +45,9 @@
@interface
VLCPlaybackLayer
:
CALayer
{
CGColorSpaceRef
_colorspace
;
VlcPluginMac
*
_cppPlugin
;
CGImageRef
_lastFrame
;
int
_cached_width
;
int
_cached_height
;
}
@property
(
readwrite
)
VlcPluginMac
*
cppPlugin
;
...
...
@@ -268,7 +271,9 @@ void VlcPluginMac::update_controls()
[
controllerLayer
setIsPlaying
:
playlist_isplaying
()];
[
controllerLayer
setIsFullscreen
:
this
->
get_fullscreen
()];
if
(
player_has_vout
())
{
libvlc_state_t
currentstate
=
libvlc_media_player_get_state
(
getMD
());
if
(
currentstate
==
libvlc_Playing
||
currentstate
==
libvlc_Paused
||
currentstate
==
libvlc_Opening
)
{
[
noMediaLayer
setHidden
:
YES
];
[
playbackLayer
setHidden
:
NO
];
}
else
{
...
...
@@ -444,6 +449,8 @@ bool VlcPluginMac::handle_event(void *event)
-
(
void
)
dealloc
{
CGColorSpaceRelease
(
_colorspace
);
if
(
_lastFrame
)
CGImageRelease
(
_lastFrame
);
[
super
dealloc
];
}
...
...
@@ -452,14 +459,26 @@ bool VlcPluginMac::handle_event(void *event)
if
(
!
cgContext
)
return
;
if
(
!
[
self
cppPlugin
]
->
playlist_isplaying
()
||
!
[
self
cppPlugin
]
->
player_has_vout
())
BOOL
b_paused
=
!
([
self
cppPlugin
]
->
playlist_isplaying
());
if
((
!
_lastFrame
&&
b_paused
)
||
!
[
self
cppPlugin
]
->
get_player
().
is_open
())
{
NSLog
(
@"no last frame or no open player"
);
return
;
}
float
media_width
=
[
self
cppPlugin
]
->
m_media_width
;
float
media_height
=
[
self
cppPlugin
]
->
m_media_height
;
if
(
media_width
==
0.
||
media_height
==
0.
)
if
(
media_width
==
0.
||
media_height
==
0.
)
{
if
(
_cached_height
!=
0
&&
_cached_width
!=
0
)
{
media_width
=
_cached_width
;
media_height
=
_cached_height
;
}
else
return
;
}
else
{
_cached_width
=
media_width
;
_cached_height
=
media_height
;
}
CGRect
layerRect
=
self
.
bounds
;
float
display_width
=
0.
;
...
...
@@ -494,14 +513,18 @@ bool VlcPluginMac::handle_event(void *event)
static
const
size_t
kComponentsPerPixel
=
4
;
static
const
size_t
kBitsPerComponent
=
sizeof
(
unsigned
char
)
*
8
;
/* render frame */
if
(
!
b_paused
)
{
/* fetch frame */
CFDataRef
dataRef
=
CFDataCreateWithBytesNoCopy
(
kCFAllocatorDefault
,
(
const
uint8_t
*
)
&
[
self
cppPlugin
]
->
m_frame_buf
[
0
],
sizeof
([
self
cppPlugin
]
->
m_frame_buf
[
0
]),
kCFAllocatorNull
);
CGDataProviderRef
dataProvider
=
CGDataProviderCreateWithCFData
(
dataRef
);
CGImageRef
image
=
CGImageCreate
(
media_width
,
if
(
_lastFrame
)
CGImageRelease
(
_lastFrame
);
_lastFrame
=
CGImageCreate
(
media_width
,
media_height
,
kBitsPerComponent
,
kBitsPerComponent
*
kComponentsPerPixel
,
...
...
@@ -512,17 +535,17 @@ bool VlcPluginMac::handle_event(void *event)
NULL
,
true
,
kCGRenderingIntentPerceptual
);
if
(
!
image
)
{
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
if
(
!
_lastFrame
)
{
CGImageRelease
(
_lastFrame
);
CGContextRestoreGState
(
cgContext
);
return
;
}
}
CGRect
rect
=
CGRectMake
(
left
,
top
,
display_width
,
display_height
);
CGContextDrawImage
(
cgContext
,
rect
,
image
);
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
CGContextDrawImage
(
cgContext
,
rect
,
_lastFrame
);
CGContextRestoreGState
(
cgContext
);
}
...
...
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