Commit d51f6812 authored by Rohit Yadav's avatar Rohit Yadav

VLCMediaPlayer.cpp: Add interfaces to control volume.

parent e399eb61
......@@ -117,8 +117,11 @@ MediaPlayer::callbacks( const libvlc_event_t* event, void* ptr )
qDebug() << '[' << (void*)self << "] libvlc_MediaPlayerEncounteredError received."
<< "This is not looking good...";
self->emit errorEncountered();
break ;
break;
case libvlc_MediaPlayerSeekableChanged:
// TODO: Later change it to an event that corresponds volume change, when this thing gets fixed in libvlc
self->emit volumeChanged();
break;
case libvlc_MediaPlayerPausableChanged:
case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerNothingSpecial:
......@@ -152,6 +155,20 @@ MediaPlayer::stop()
libvlc_media_player_stop( m_internalPtr );
}
int
MediaPlayer::getVolume()
{
int volume = libvlc_audio_get_volume( m_internalPtr );
return volume;
}
int
MediaPlayer::setVolume( int volume )
{
//Returns 0 if the volume was set, -1 if it was out of range
return libvlc_audio_set_volume( m_internalPtr, volume / 2 );
}
qint64
MediaPlayer::getTime()
{
......
......@@ -27,6 +27,9 @@
#include <QObject>
#include "VLCpp.hpp"
#define VOLUME_MAX 100
#define AOUT_VOLUME_MAX 1024
struct libvlc_media_player_t;
struct libvlc_event_t;
struct libvlc_event_manager_t;
......@@ -44,6 +47,8 @@ namespace LibVLCpp
void play();
void pause();
void stop();
int getVolume();
int setVolume( int volume );
qint64 getTime();
void setTime( qint64 time );
float getPosition();
......@@ -79,6 +84,7 @@ namespace LibVLCpp
void paused();
void stopped();
void endReached();
void volumeChanged();
void positionChanged( float );
void lengthChanged( qint64 );
void errorEncountered();
......
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