Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
4fbc0258
Commit
4fbc0258
authored
Mar 27, 2009
by
Ludovic Fauvet
Browse files
Code cleanup / normalization.
Please do not use 'this' pointer when it isn't required.
parent
2279f2d7
Changes
15
Hide whitespace changes
Inline
Side-by-side
src/Image.h
View file @
4fbc0258
...
...
@@ -20,8 +20,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef IMAGE_HPP
#define IMAGE_HPP
...
...
@@ -30,29 +28,29 @@
class
Image
{
public:
Image
(
int
width
,
int
height
)
Image
(
int
width
,
int
height
)
{
this
->
_pixelsData
=
new
uchar
[
width
*
height
*
4
];
this
->
_image
=
new
QImage
(
this
->
_pixelsData
,
width
,
height
,
width
*
4
,
QImage
::
Format_ARGB32
);
m
_pixelsData
=
new
uchar
[
width
*
height
*
4
];
m
_image
=
new
QImage
(
m
_pixelsData
,
width
,
height
,
width
*
4
,
QImage
::
Format_ARGB32
);
}
~
Image
()
{
delete
this
->
_image
;
delete
this
->
_pixelsData
;
delete
m
_image
;
delete
m
_pixelsData
;
}
uchar
*
getBuffer
()
{
return
this
->
_pixelsData
;
return
m
_pixelsData
;
}
QImage
&
getImage
()
{
return
*
(
this
->
_image
);
return
*
(
m
_image
);
}
private:
QImage
*
_image
;
uchar
*
_pixelsData
;
QImage
*
m
_image
;
uchar
*
m
_pixelsData
;
};
#endif // IMAGE_HPP
src/LibVLCpp/VLCException.cpp
View file @
4fbc0258
...
...
@@ -25,50 +25,50 @@
using
namespace
LibVLCpp
;
Exception
::
errorCallback
Exception
::
_errorCallback
=
NULL
;
void
*
Exception
::
_datas
=
NULL
;
Exception
::
errorCallback
Exception
::
m
_errorCallback
=
NULL
;
void
*
Exception
::
m
_datas
=
NULL
;
Exception
::
Exception
()
{
this
->
_internalPtr
=
new
libvlc_exception_t
;
libvlc_exception_init
(
this
->
_internalPtr
);
m
_internalPtr
=
new
libvlc_exception_t
;
libvlc_exception_init
(
m
_internalPtr
);
}
Exception
::~
Exception
()
{
this
->
clear
();
delete
this
->
_internalPtr
;
clear
();
delete
m
_internalPtr
;
}
void
Exception
::
setErrorCallback
(
Exception
::
errorCallback
handler
,
void
*
datas
)
void
Exception
::
setErrorCallback
(
Exception
::
errorCallback
handler
,
void
*
datas
)
{
Exception
::
_datas
=
datas
;
Exception
::
_errorCallback
=
handler
;
Exception
::
m
_datas
=
datas
;
Exception
::
m
_errorCallback
=
handler
;
}
const
char
*
Exception
::
getErrorText
()
const
{
return
libvlc_exception_get_message
(
this
->
_internalPtr
);
return
libvlc_exception_get_message
(
m
_internalPtr
);
}
void
Exception
::
clear
()
{
libvlc_exception_clear
(
this
->
_internalPtr
);
libvlc_exception_clear
(
m
_internalPtr
);
}
int
Exception
::
raised
()
const
{
return
libvlc_exception_raised
(
this
->
_internalPtr
);
return
libvlc_exception_raised
(
m
_internalPtr
);
}
void
Exception
::
checkThrow
()
{
if
(
this
->
raised
()
==
Exception
::
Raised
)
if
(
raised
()
==
Exception
::
Raised
)
{
if
(
Exception
::
_errorCallback
!=
NULL
)
Exception
::
_errorCallback
(
this
->
getErrorText
(),
Exception
::
_datas
);
if
(
Exception
::
m
_errorCallback
!=
NULL
)
Exception
::
m
_errorCallback
(
getErrorText
(),
Exception
::
m
_datas
);
else
qWarning
()
<<
"An exception was raised, but no error handler is set.
\n
Error message is: "
<<
this
->
getErrorText
();
this
->
clear
();
qWarning
()
<<
"An exception was raised, but no error handler is set.
\n
Error message is: "
<<
getErrorText
();
clear
();
}
}
src/LibVLCpp/VLCException.h
View file @
4fbc0258
...
...
@@ -28,7 +28,7 @@
namespace
LibVLCpp
{
class
Exception
:
public
Internal
<
libvlc_exception_t
>
class
Exception
:
public
Internal
<
libvlc_exception_t
>
{
public:
Exception
();
...
...
@@ -44,12 +44,12 @@ namespace LibVLCpp
//error handling part :
//TODO: have a private error handling in which we could fall back for some specific cases
typedef
void
(
*
errorCallback
)(
const
char
*
msg
,
void
*
data
);
static
void
setErrorCallback
(
errorCallback
,
void
*
data
);
typedef
void
(
*
errorCallback
)(
const
char
*
msg
,
void
*
data
);
static
void
setErrorCallback
(
errorCallback
,
void
*
data
);
private:
static
errorCallback
_errorCallback
;
static
void
*
_datas
;
static
errorCallback
m
_errorCallback
;
static
void
*
m
_datas
;
};
}
...
...
src/LibVLCpp/VLCInstance.cpp
View file @
4fbc0258
...
...
@@ -26,8 +26,8 @@
using
namespace
LibVLCpp
;
Instance
::
Instance
(
int
argc
,
const
char
**
argv
)
Instance
::
Instance
(
int
argc
,
const
char
**
argv
)
{
this
->
_internalPtr
=
libvlc_new
(
argc
,
argv
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
m
_internalPtr
=
libvlc_new
(
argc
,
argv
,
m
_ex
);
m
_ex
.
checkThrow
();
}
src/LibVLCpp/VLCInstance.h
View file @
4fbc0258
...
...
@@ -29,12 +29,12 @@
namespace
LibVLCpp
{
class
Instance
:
public
Internal
<
libvlc_instance_t
>
class
Instance
:
public
Internal
<
libvlc_instance_t
>
{
public:
Instance
(
int
argc
,
const
char
**
argv
);
Instance
(
int
argc
,
const
char
**
argv
);
private:
Exception
_ex
;
Exception
m
_ex
;
};
}
...
...
src/LibVLCpp/VLCMedia.cpp
View file @
4fbc0258
...
...
@@ -26,17 +26,17 @@
using
namespace
LibVLCpp
;
Media
::
Media
(
Instance
*
instance
,
const
QString
&
filename
)
:
_instance
(
*
instance
),
_pixelBuffer
(
NULL
)
Media
::
Media
(
Instance
*
instance
,
const
QString
&
filename
)
:
m
_instance
(
*
instance
),
m
_pixelBuffer
(
NULL
)
{
this
->
_internalPtr
=
libvlc_media_new
(
this
->
_instance
,
filename
.
toLocal8Bit
(),
this
->
_ex
);
this
->
_ex
.
checkThrow
();
m
_internalPtr
=
libvlc_media_new
(
m
_instance
,
filename
.
toLocal8Bit
(),
m
_ex
);
m
_ex
.
checkThrow
();
}
Media
::~
Media
()
{
libvlc_media_release
(
this
->
_internalPtr
);
delete
[]
this
->
_pixelBuffer
;
delete
this
->
_dataCtx
;
libvlc_media_release
(
m
_internalPtr
);
delete
[]
m
_pixelBuffer
;
delete
m
_dataCtx
;
}
Media
::
DataCtx
*
Media
::
buildDataCtx
()
...
...
@@ -47,47 +47,47 @@ Media::DataCtx* Media::buildDataCtx()
return
dataCtx
;
}
void
Media
::
addOption
(
const
char
*
opt
)
void
Media
::
addOption
(
const
char
*
opt
)
{
libvlc_media_add_option
(
this
->
_internalPtr
,
opt
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_media_add_option
(
m
_internalPtr
,
opt
,
m
_ex
);
m
_ex
.
checkThrow
();
qDebug
()
<<
"Added media option: "
<<
opt
;
}
Media
::
DataCtx
::~
DataCtx
()
{
delete
this
->
mutex
;
delete
mutex
;
}
void
Media
::
setLockCallback
(
Media
::
lockCallback
callback
)
void
Media
::
setLockCallback
(
Media
::
lockCallback
callback
)
{
char
param
[
64
];
sprintf
(
param
,
":vmem-lock=%lld"
,
(
long
long
int
)(
intptr_t
)
callback
);
this
->
addOption
(
param
);
sprintf
(
param
,
":vmem-lock=%lld"
,
(
long
long
int
)(
intptr_t
)
callback
);
addOption
(
param
);
}
void
Media
::
setUnlockCallback
(
Media
::
unlockCallback
callback
)
void
Media
::
setUnlockCallback
(
Media
::
unlockCallback
callback
)
{
char
param
[
64
];
sprintf
(
param
,
":vmem-unlock=%lld"
,
(
long
long
int
)(
intptr_t
)
callback
);
this
->
addOption
(
param
);
sprintf
(
param
,
":vmem-unlock=%lld"
,
(
long
long
int
)(
intptr_t
)
callback
);
addOption
(
param
);
}
void
Media
::
setDataCtx
()
{
char
param
[
64
];
this
->
_dataCtx
=
new
Media
::
DataCtx
;
this
->
_dataCtx
->
mutex
=
new
QMutex
();
this
->
_dataCtx
->
media
=
this
;
m
_dataCtx
=
new
Media
::
DataCtx
;
m
_dataCtx
->
mutex
=
new
QMutex
();
m
_dataCtx
->
media
=
this
;
sprintf
(
param
,
":vmem-data=%lld"
,
(
long
long
int
)(
intptr_t
)
this
->
_dataCtx
);
this
->
addOption
(
param
);
sprintf
(
param
,
":vmem-data=%lld"
,
(
long
long
int
)(
intptr_t
)
m
_dataCtx
);
addOption
(
param
);
}
void
Media
::
outputInVmem
()
{
this
->
addOption
(
":vout=vmem"
);
addOption
(
":vout=vmem"
);
}
void
Media
::
outputInWindow
()
...
...
@@ -95,12 +95,12 @@ void Media::outputInWindow()
// this->addOption();
}
void
Media
::
setPixelBuffer
(
uchar
*
buffer
)
void
Media
::
setPixelBuffer
(
uchar
*
buffer
)
{
this
->
_pixelBuffer
=
buffer
;
m
_pixelBuffer
=
buffer
;
}
uchar
*
Media
::
getPixelBuffer
()
{
return
this
->
_pixelBuffer
;
return
m
_pixelBuffer
;
}
src/LibVLCpp/VLCMedia.h
View file @
4fbc0258
...
...
@@ -37,7 +37,7 @@
namespace
LibVLCpp
{
class
Media
:
public
Internal
<
libvlc_media_t
>
class
Media
:
public
Internal
<
libvlc_media_t
>
{
public:
struct
DataCtx
...
...
@@ -46,27 +46,27 @@ namespace LibVLCpp
QMutex
*
mutex
;
Media
*
media
;
};
typedef
void
(
*
lockCallback
)(
Media
::
DataCtx
*
dataCtx
,
void
**
pp_ret
);
typedef
void
(
*
unlockCallback
)(
Media
::
DataCtx
*
dataCtx
);
typedef
void
(
*
lockCallback
)(
Media
::
DataCtx
*
dataCtx
,
void
**
pp_ret
);
typedef
void
(
*
unlockCallback
)(
Media
::
DataCtx
*
dataCtx
);
Media
(
Instance
*
instance
,
const
QString
&
filename
);
Media
(
Instance
*
instance
,
const
QString
&
filename
);
~
Media
();
void
addOption
(
const
char
*
opt
);
void
setLockCallback
(
Media
::
lockCallback
);
void
setUnlockCallback
(
Media
::
unlockCallback
);
void
addOption
(
const
char
*
opt
);
void
setLockCallback
(
Media
::
lockCallback
);
void
setUnlockCallback
(
Media
::
unlockCallback
);
void
setDataCtx
();
void
outputInVmem
();
void
outputInWindow
();
void
setPixelBuffer
(
uchar
*
buffer
);
void
setPixelBuffer
(
uchar
*
buffer
);
uchar
*
getPixelBuffer
();
private:
DataCtx
*
buildDataCtx
();
Exception
_ex
;
Instance
&
_instance
;
DataCtx
*
_dataCtx
;
uchar
*
_pixelBuffer
;
Exception
m
_ex
;
Instance
&
m
_instance
;
DataCtx
*
m
_dataCtx
;
uchar
*
m
_pixelBuffer
;
};
}
...
...
src/LibVLCpp/VLCMediaPlayer.cpp
View file @
4fbc0258
...
...
@@ -26,68 +26,68 @@
using
namespace
LibVLCpp
;
MediaPlayer
::
MediaPlayer
(
Media
*
media
,
bool
playStop
/* = true*/
)
MediaPlayer
::
MediaPlayer
(
Media
*
media
,
bool
playStop
/* = true*/
)
{
this
->
_internalPtr
=
libvlc_media_player_new_from_media
(
media
->
getInternalPtr
(),
this
->
_ex
);
this
->
_ex
.
checkThrow
();
m
_internalPtr
=
libvlc_media_player_new_from_media
(
media
->
getInternalPtr
(),
m
_ex
);
m
_ex
.
checkThrow
();
}
void
MediaPlayer
::
play
()
{
libvlc_media_player_play
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_media_player_play
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
}
void
MediaPlayer
::
pause
()
{
libvlc_media_player_pause
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_media_player_pause
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
}
void
MediaPlayer
::
stop
()
{
libvlc_media_player_stop
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_media_player_stop
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
}
qint64
MediaPlayer
::
getTime
()
{
qint64
t
=
libvlc_media_player_get_time
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
qint64
t
=
libvlc_media_player_get_time
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
return
t
;
}
void
MediaPlayer
::
setTime
(
qint64
time
)
void
MediaPlayer
::
setTime
(
qint64
time
)
{
// qDebug() << "Setting media time to " << time;
libvlc_media_player_set_time
(
this
->
_internalPtr
,
time
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_media_player_set_time
(
m
_internalPtr
,
time
,
m
_ex
);
m
_ex
.
checkThrow
();
}
qint64
MediaPlayer
::
getLength
()
{
qint64
length
=
libvlc_media_player_get_length
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
qint64
length
=
libvlc_media_player_get_length
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
// qDebug() << "Media length: " << length;
return
length
;
}
void
MediaPlayer
::
takeSnapshot
(
char
*
outputFile
,
unsigned
int
width
,
unsigned
int
heigth
)
void
MediaPlayer
::
takeSnapshot
(
char
*
outputFile
,
unsigned
int
width
,
unsigned
int
heigth
)
{
libvlc_video_take_snapshot
(
*
this
,
outputFile
,
width
,
heigth
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
libvlc_video_take_snapshot
(
*
this
,
outputFile
,
width
,
heigth
,
m
_ex
);
m
_ex
.
checkThrow
();
}
bool
MediaPlayer
::
isPlaying
()
{
int
res
=
libvlc_media_player_is_playing
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
int
res
=
libvlc_media_player_is_playing
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
return
(
res
==
1
);
}
bool
MediaPlayer
::
isSeekable
()
{
int
res
=
libvlc_media_player_is_seekable
(
this
->
_internalPtr
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
int
res
=
libvlc_media_player_is_seekable
(
m
_internalPtr
,
m
_ex
);
m
_ex
.
checkThrow
();
return
(
res
==
1
);
}
src/LibVLCpp/VLCMediaPlayer.h
View file @
4fbc0258
...
...
@@ -33,22 +33,22 @@
namespace
LibVLCpp
{
class
MediaPlayer
:
public
Internal
<
libvlc_media_player_t
>
class
MediaPlayer
:
public
Internal
<
libvlc_media_player_t
>
{
public:
MediaPlayer
(
Media
*
media
,
bool
playStop
=
true
);
MediaPlayer
(
Media
*
media
,
bool
playStop
=
true
);
void
play
();
void
pause
();
void
stop
();
qint64
getTime
();
void
setTime
(
qint64
time
);
void
setTime
(
qint64
time
);
qint64
getLength
();
void
takeSnapshot
(
char
*
outputFile
,
unsigned
int
width
,
unsigned
int
heigth
);
void
takeSnapshot
(
char
*
outputFile
,
unsigned
int
width
,
unsigned
int
heigth
);
bool
isPlaying
();
bool
isSeekable
();
private:
Exception
_ex
;
Exception
m
_ex
;
};
}
...
...
src/LibVLCpp/VLCpp.hpp
View file @
4fbc0258
...
...
@@ -28,21 +28,21 @@
namespace
LibVLCpp
{
template
<
typename
T
>
template
<
typename
T
>
class
Internal
{
public:
typedef
T
*
internalPtr
;
T
*
getInternalPtr
()
{
assert
(
this
->
_internalPtr
!=
NULL
);
return
this
->
_internalPtr
;
assert
(
m
_internalPtr
!=
NULL
);
return
m
_internalPtr
;
}
operator
T
*
()
{
return
this
->
_internalPtr
;}
operator
T
*
()
{
return
m
_internalPtr
;
}
protected:
Internal
()
:
_internalPtr
(
NULL
)
{}
Internal
()
:
m
_internalPtr
(
NULL
)
{}
T
*
_internalPtr
;
T
*
m
_internalPtr
;
};
}
...
...
src/LibVLCpp/VlmManager.cpp
View file @
4fbc0258
...
...
@@ -3,25 +3,25 @@
using
namespace
LibVLCpp
;
VlmManager
::
VlmManager
(
Instance
*
instance
)
:
_instance
(
*
instance
)
VlmManager
::
VlmManager
(
Instance
*
instance
)
:
m
_instance
(
*
instance
)
{
}
VlmMedia
*
VlmManager
::
addMedia
(
const
QString
&
filename
,
const
char
*
const
*
argv
,
int
argc
)
VlmMedia
*
VlmManager
::
addMedia
(
const
QString
&
filename
,
const
char
*
const
*
argv
,
int
argc
)
{
VlmMedia
*
media
=
new
VlmMedia
(
this
->
_instance
,
filename
);
VlmMedia
*
media
=
new
VlmMedia
(
m
_instance
,
filename
);
libvlc_vlm_add_broadcast
(
this
->
_instance
,
media
->
getHash
().
toLocal8Bit
(),
filename
.
toLocal8Bit
(),
libvlc_vlm_add_broadcast
(
m
_instance
,
media
->
getHash
().
toLocal8Bit
(),
filename
.
toLocal8Bit
(),
"#duplicate{dst=display{vmem}}"
,
argc
,
argv
,
true
,
false
,
this
->
_ex
);
this
->
_ex
.
checkThrow
();
this
->
_hashTable
[
media
->
getHash
()]
=
media
;
argc
,
argv
,
true
,
false
,
m
_ex
);
m
_ex
.
checkThrow
();
m
_hashTable
[
media
->
getHash
()
]
=
media
;
return
media
;
}
VlmMedia
*
VlmManager
::
getMedia
(
const
QString
&
hash
)
VlmMedia
*
VlmManager
::
getMedia
(
const
QString
&
hash
)
{
if
(
this
->
_hashTable
.
contains
(
hash
)
==
true
)
return
this
->
_hashTable
[
hash
];
if
(
m
_hashTable
.
contains
(
hash
)
)
return
m
_hashTable
[
hash
];
return
NULL
;
}
src/LibVLCpp/VlmManager.h
View file @
4fbc0258
...
...
@@ -13,14 +13,14 @@ namespace LibVLCpp
class
VlmManager
{
public:
VlmManager
(
Instance
*
instance
);
VlmManager
(
Instance
*
instance
);
VlmMedia
*
addMedia
(
const
QString
&
filename
,
const
char
*
const
*
argv
,
int
argc
);
VlmMedia
*
getMedia
(
const
QString
&
hash
);
VlmMedia
*
addMedia
(
const
QString
&
filename
,
const
char
*
const
*
argv
,
int
argc
);
VlmMedia
*
getMedia
(
const
QString
&
hash
);
private:
QHash
<
QString
,
VlmMedia
*>
_hashTable
;
Instance
&
_instance
;
Exception
_ex
;
QHash
<
QString
,
VlmMedia
*
>
m
_hashTable
;
Instance
&
m
_instance
;
Exception
m
_ex
;
};
}
...
...
src/Media.cpp
View file @
4fbc0258
...
...
@@ -24,7 +24,7 @@
#include "Media.h"
Media
::
Media
(
const
QString
&
mrl
)
:
_mrl
(
mrl
),
_snapshot
(
NULL
)
Media
::
Media
(
const
QString
&
mrl
)
:
m
_mrl
(
mrl
),
m
_snapshot
(
NULL
)
{
char
const
*
vlc_argv
[]
=
{
...
...
@@ -34,88 +34,88 @@ Media::Media(const QString& mrl) : _mrl(mrl), _snapshot(NULL)
//"--plugin-path", VLC_TREE "/modules",
//"--ignore-config", /* Don't use VLC's config files */
};
int
vlc_argc
=
sizeof
(
vlc_argv
)
/
sizeof
(
*
vlc_argv
);
this
->
_instance
=
new
LibVLCpp
::
Instance
(
vlc_argc
,
vlc_argv
);
int
vlc_argc
=
sizeof
(
vlc_argv
)
/
sizeof
(
*
vlc_argv
);
m
_instance
=
new
LibVLCpp
::
Instance
(
vlc_argc
,
vlc_argv
);
this
->
_vlcMedia
=
new
LibVLCpp
::
Media
(
this
->
_instance
,
this
->
_mrl
);
m
_vlcMedia
=
new
LibVLCpp
::
Media
(
m
_instance
,
m
_mrl
);
this
->
_vlcMedia
->
outputInVmem
();
this
->
_vlcMedia
->
setLockCallback
(
Media
::
lock
);
this
->
_vlcMedia
->
setUnlockCallback
(
Media
::
unlock
);
m
_vlcMedia
->
outputInVmem
();
m
_vlcMedia
->
setLockCallback
(
Media
::
lock
);
m
_vlcMedia
->
setUnlockCallback
(
Media
::
unlock
);
char
width
[
64
],
height
[
64
],
chroma
[
64
],
pitch
[
64
];
sprintf
(
width
,
":vmem-width=%i"
,
VIDEOWIDTH
);
sprintf
(
height
,
":vmem-height=%i"
,
VIDEOHEIGHT
);
sprintf
(
chroma
,
":vmem-chroma=%s"
,
"RV32"
);
sprintf
(
pitch
,
":vmem-pitch=%i"
,
VIDEOWIDTH
*
4
);
sprintf
(
width
,
":vmem-width=%i"
,
VIDEOWIDTH
);
sprintf
(
height
,
":vmem-height=%i"
,
VIDEOHEIGHT
);
sprintf
(
chroma
,
":vmem-chroma=%s"
,
"RV32"
);
sprintf
(
pitch
,
":vmem-pitch=%i"
,
VIDEOWIDTH
*
4
);
this
->
_vlcMedia
->
addOption
(
width
);
this
->
_vlcMedia
->
addOption
(
height
);
this
->
_vlcMedia
->
addOption
(
chroma
);
this
->
_vlcMedia
->
addOption
(
pitch
);
m
_vlcMedia
->
addOption
(
width
);
m
_vlcMedia
->
addOption
(
height
);
m
_vlcMedia
->
addOption
(
chroma
);
m
_vlcMedia
->
addOption
(
pitch
);
this
->
_pixelBuffer
=
new
uchar
[
VIDEOHEIGHT
*
VIDEOWIDTH
*
4
];
this
->
_image
=
new
QImage
(
this
->
_pixelBuffer
,
VIDEOWIDTH
,
VIDEOHEIGHT
,
VIDEOWIDTH
*
4
,
QImage
::
Format_RGB32
);
this
->
_image
->
fill
(
0
);
m
_pixelBuffer
=
new
uchar
[
VIDEOHEIGHT
*
VIDEOWIDTH
*
4
];
m
_image
=
new
QImage
(
m
_pixelBuffer
,
VIDEOWIDTH
,
VIDEOHEIGHT
,
VIDEOWIDTH
*
4
,
QImage
::
Format_RGB32
);
m
_image
->
fill
(
0
);
//Once we got the pixel buffer up and running, we can put it in the "render context"
this
->
_vlcMedia
->
setPixelBuffer
(
this
->
_pixelBuffer
);
this
->
_vlcMedia
->
setDataCtx
();
m
_vlcMedia
->
setPixelBuffer
(
m
_pixelBuffer
);
m
_vlcMedia
->
setDataCtx
();
//And now we play the media
this
->
_vlcMediaPlayer
=
new
LibVLCpp
::
MediaPlayer
(
this
->
_vlcMedia
);
m
_vlcMediaPlayer
=
new
LibVLCpp
::
MediaPlayer
(
m
_vlcMedia
);
}
Media
::~
Media
()
{
delete
this
->
_image
;
delete
this
->
_pixelBuffer
;