Commit 1cf82527 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

VLCMedia: Cleaning.

parent 00a09756
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -20,21 +20,21 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <cassert>
#include "VLCMedia.h"
#include "VLCInstance.h"
//Allow PRId64 to be defined:
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <cstdio>
using namespace LibVLCpp;
Media::Media( const QString& filename ) :
m_fileName( filename )
{
m_internalPtr = libvlc_media_new_location( *(LibVLCpp::Instance::getInstance()), filename.toLocal8Bit() );
m_internalPtr = libvlc_media_new_location( *(LibVLCpp::Instance::getInstance()),
filename.toLocal8Bit() );
}
Media::~Media()
......@@ -42,40 +42,46 @@ Media::~Media()
libvlc_media_release( m_internalPtr );
}
void Media::addOption( const char* opt )
void
Media::addOption( const char* opt )
{
libvlc_media_add_option_flag( m_internalPtr, opt, libvlc_media_option_trusted );
}
void Media::setVideoLockCallback( void* callback )
void
Media::setVideoLockCallback( void* callback )
{
char param[64];
sprintf( param, ":sout-smem-video-prerender-callback=%"PRId64, (intptr_t)callback );
addOption(param);
}
void Media::setVideoUnlockCallback( void* callback )
void
Media::setVideoUnlockCallback( void* callback )
{
char param[64];
sprintf( param, ":sout-smem-video-postrender-callback=%"PRId64, (intptr_t)callback );
addOption( param );
}
void Media::setAudioLockCallback( void* callback )
void
Media::setAudioLockCallback( void* callback )
{
char param[64];
sprintf( param, ":sout-smem-audio-prerender-callback=%"PRId64, (intptr_t)callback );
addOption(param);
}
void Media::setAudioUnlockCallback( void* callback )
void
Media::setAudioUnlockCallback( void* callback )
{
char param[64];
sprintf( param, ":sout-smem-audio-postrender-callback=%"PRId64, (intptr_t)callback );
addOption( param );
}
void Media::setVideoDataCtx( void* dataCtx )
void
Media::setVideoDataCtx( void* dataCtx )
{
char param[64];
......@@ -83,7 +89,8 @@ void Media::setVideoDataCtx( void* dataCtx )
addOption( param );
}
void Media::setAudioDataCtx( void* dataCtx )
void
Media::setAudioDataCtx( void* dataCtx )
{
char param[64];
......@@ -91,7 +98,8 @@ void Media::setAudioDataCtx( void* dataCtx )
addOption( param );
}
const QString& Media::getFileName() const
const QString&
Media::getFileName() const
{
return m_fileName;
}
......@@ -26,7 +26,6 @@
#include "vlc/vlc.h"
#include <QString>
#include <QMutex>
#include "VLCpp.hpp"
......
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -78,7 +78,8 @@ MediaPlayer::registerEvents()
/**
* Event dispatcher.
*/
void MediaPlayer::callbacks( const libvlc_event_t* event, void* ptr )
void
MediaPlayer::callbacks( const libvlc_event_t* event, void* ptr )
{
MediaPlayer* self = reinterpret_cast<MediaPlayer*>( ptr );
switch ( event->type )
......@@ -131,79 +132,89 @@ void MediaPlayer::callbacks( const libvlc_event_t* ev
}
}
void MediaPlayer::play()
void
MediaPlayer::play()
{
//qDebug() << "Asking for play media player";
libvlc_media_player_play( m_internalPtr );
}
void MediaPlayer::pause()
void
MediaPlayer::pause()
{
libvlc_media_player_pause( m_internalPtr );
}
void MediaPlayer::stop()
void
MediaPlayer::stop()
{
//qDebug() << "Asking for stop media player";
libvlc_media_player_stop( m_internalPtr );
}
qint64 MediaPlayer::getTime()
qint64
MediaPlayer::getTime()
{
qint64 t = libvlc_media_player_get_time( m_internalPtr );
return t;
}
void MediaPlayer::setTime( qint64 time )
void
MediaPlayer::setTime( qint64 time )
{
libvlc_media_player_set_time( m_internalPtr, time );
}
float MediaPlayer::getPosition()
float
MediaPlayer::getPosition()
{
float p = libvlc_media_player_get_position( m_internalPtr );
return p;
return libvlc_media_player_get_position( m_internalPtr );
}
void MediaPlayer::setPosition( float pos )
void
MediaPlayer::setPosition( float pos )
{
libvlc_media_player_set_position( m_internalPtr, pos );
}
qint64 MediaPlayer::getLength()
qint64
MediaPlayer::getLength()
{
qint64 length = libvlc_media_player_get_length( m_internalPtr );
return length;
return libvlc_media_player_get_length( m_internalPtr );
}
void MediaPlayer::takeSnapshot( const char* outputFile, unsigned int width, unsigned int heigth )
void
MediaPlayer::takeSnapshot( const char* outputFile, unsigned int width, unsigned int heigth )
{
libvlc_video_take_snapshot( *this, 0, outputFile, width, heigth );
}
bool MediaPlayer::isPlaying()
bool
MediaPlayer::isPlaying()
{
int res = libvlc_media_player_is_playing( m_internalPtr );
return (res == 1);
return ( libvlc_media_player_is_playing( m_internalPtr ) == 1 );
}
bool MediaPlayer::isSeekable()
bool
MediaPlayer::isSeekable()
{
int res = libvlc_media_player_is_seekable( m_internalPtr );
return (res == 1);
return ( libvlc_media_player_is_seekable( m_internalPtr ) == 1 );
}
void MediaPlayer::setDrawable( void* hwnd )
void
MediaPlayer::setDrawable( void* hwnd )
{
libvlc_media_player_set_hwnd( m_internalPtr, hwnd );
}
void MediaPlayer::setDrawable( uint32_t drawable )
void
MediaPlayer::setDrawable( uint32_t drawable )
{
libvlc_media_player_set_xwindow( m_internalPtr, drawable );
}
void MediaPlayer::setMedia( Media* media )
void
MediaPlayer::setMedia( Media* media )
{
libvlc_media_player_set_media( m_internalPtr, media->getInternalPtr() );
}
......@@ -214,29 +225,32 @@ MediaPlayer::getSize( quint32 *outWidth, quint32 *outHeight )
libvlc_video_get_size( m_internalPtr, 0, outWidth, outHeight );
}
float MediaPlayer::getFps()
float
MediaPlayer::getFps()
{
float fps = libvlc_media_player_get_fps( m_internalPtr );
return fps;
return libvlc_media_player_get_fps( m_internalPtr );
}
void MediaPlayer::nextFrame()
void
MediaPlayer::nextFrame()
{
libvlc_media_player_next_frame( m_internalPtr );
}
bool MediaPlayer::hasVout()
bool
MediaPlayer::hasVout()
{
bool res = libvlc_media_player_has_vout( m_internalPtr );
return res;
return libvlc_media_player_has_vout( m_internalPtr );
}
const QString& MediaPlayer::getLoadedFileName() const
const QString&
MediaPlayer::getLoadedFileName() const
{
return m_media->getFileName();
}
QString MediaPlayer::getLoadedMRL()
QString
MediaPlayer::getLoadedMRL()
{
Media::internalPtr media = libvlc_media_player_get_media( m_internalPtr );
char* str = libvlc_media_get_mrl( media );
......
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
......@@ -3,7 +3,7 @@
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
......@@ -26,6 +26,8 @@
#include "VLCMedia.h"
#include "Workflow/Types.h"
#include <QMutexLocker>
AudioClipWorkflow::AudioClipWorkflow( ClipHelper *ch ) :
ClipWorkflow( ch ),
m_lastReturnedBuffer( NULL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment