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
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
e9850033
Commit
e9850033
authored
Mar 25, 2011
by
Rohit Yadav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RenderWidget: A clever implementation of video rendering widget
parent
52d541ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
0 deletions
+162
-0
src/Gui/preview/RenderWidget.h
src/Gui/preview/RenderWidget.h
+63
-0
src/Gui/preview/RenderWidget.mm
src/Gui/preview/RenderWidget.mm
+99
-0
No files found.
src/Gui/preview/RenderWidget.h
0 → 100644
View file @
e9850033
/*****************************************************************************
* RenderWidget: Vout render widget
*****************************************************************************
* Copyright (C) 2008-2011 VideoLAN
*
* Authors: Rohit Yadav <rohityadav89@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef RENDERWIDGET_H
#define RENDERWIDGET_H
#include <QtGlobal>
#include <QWidget>
#if defined( Q_WS_MAC ) && defined( QT_MAC_USE_COCOA )
#include <QMacCocoaViewContainer>
#ifdef __OBJC__
#define ADD_COCOA_NATIVE_REF(CocoaClass) \
@class CocoaClass; \
typedef CocoaClass *Native##CocoaClass##Ref
#else
#define ADD_COCOA_NATIVE_REF(CocoaClass) typedef void *Native##CocoaClass##Ref
#endif
ADD_COCOA_NATIVE_REF
(
NSView
);
#endif
class
RenderWidget
:
public
QWidget
{
Q_OBJECT
public:
#if defined( Q_WS_MAC ) && defined( QT_MAC_USE_COCOA )
RenderWidget
(
QWidget
*
parent
=
NULL
);
NativeNSViewRef
id
()
const
;
void
release
();
private:
NativeNSViewRef
m_video
;
QMacCocoaViewContainer
*
m_container
;
#else
RenderWidget
(
QWidget
*
parent
=
NULL
)
:
QWidget
(
parent
)
{};
WId
id
()
const
{
return
winId
;
};
#endif
};
#endif // RENDERWIDGET_H
src/Gui/preview/RenderWidget.mm
0 → 100644
View file @
e9850033
/*****************************************************************************
* RenderWidget.mm: A NSView Vout render widget for Mac OS
*****************************************************************************
* Copyright (C) 2008-2011 VideoLAN
*
* Authors: Rohit Yadav <rohityadav89@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtGlobal>
#if defined( Q_WS_MAC ) && defined( QT_MAC_USE_COCOA )
#include "RenderWidget.h"
#include <QPalette>
#include <QColor>
#include <QVBoxLayout>
#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
#import <AppKit/NSView.h>
@interface
VLCNSView
:
NSView
BOOL
stretchesVideo
;
-
(
void
)
setStretchesVideo
:
(
BOOL
)
value
;
-
(
BOOL
)
stretchesVideo
;
-
(
void
)
addVoutSubview
:(
NSView
*
)
aView
;
-
(
void
)
removeVoutSubview
:(
NSView
*
)
aView
;
@end
@implementation
VLCNSView
-
(
id
)
initWithFrame
:(
NSRect
)
frameRect
{
if
((
self
=
[
super
initWithFrame
:
frameRect
])
==
nil
){
return
nil
;
}
return
self
;
}
-
(
void
)
dealloc
{
[
super
dealloc
];
}
-
(
void
)
setStretchesVideo
:
(
BOOL
)
value
{
stretchesVideo
=
value
;
}
-
(
BOOL
)
stretchesVideo
{
return
stretchesVideo
;
}
-
(
void
)
addVoutSubview
:(
NSView
*
)
aView
{
[
aView
setFrame
:[
self
bounds
]];
[
self
addSubview
:
aView
];
[
aView
setAutoresizingMask
:
NSViewHeightSizable
|
NSViewWidthSizable
];
}
-
(
void
)
removeVoutSubview
:(
NSView
*
)
aView
{}
@end
RenderWidget
::
RenderWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
m_video
=
[[
VLCNSView
alloc
]
init
];
m_container
=
new
QMacCocoaViewContainer
(
m_video
,
this
);
m_container
->
setAutoFillBackground
(
true
);
QPalette
videoPalette
=
m_container
->
palette
();
videoPalette
.
setColor
(
QPalette
::
Window
,
QColor
(
Qt
::
black
)
);
m_container
->
setPalette
(
videoPalette
);
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
layout
->
addWidget
(
m_container
);
setLayout
(
layout
);
}
/* winId should return pointer to the NSView, m_video */
NativeNSViewRef
RenderWidget
::
id
()
const
{
return
m_video
;
}
void
RenderWidget
::
release
()
{
[
m_video
release
];
}
#endif
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