libvlcpp_la_CXXFLAGS = @libvlc_CFLAGS@
libvlcpp_la_LDFLAGS = @libvlc_LIBS@ -version-info 1:0:0
library_includedir=$(includedir)/libvlcpp
-library_include_HEADERS = exception.hpp libvlc.hpp media.hpp media_player.hpp video.hpp
+library_include_HEADERS = exception.hpp libvlc.hpp media.hpp media_player.hpp video.hpp audio.hpp
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvlcpp.pc
using namespace libvlc;
-Audio::Audio( libvlc_media_player_t *player )
+Audio::Audio()
{
- m_player = player;
- libvlc_media_player_retain( m_player );
}
Audio::~Audio()
libvlc_audio_set_track( m_player, track );
}
+void Audio::setMediaPlayer( libvlc_media_player_t *player )
+{
+ libvlc_media_player_retain( player );
+ m_player = player;
+}
namespace libvlc
{
+class MediaPlayer;
+
class Audio
{
public:
- /**
- * Constructor
- * @param player: the player handling the audio
- */
- Audio( libvlc_media_player_t *player );
-
- /** Destructor */
- ~Audio();
-
/**
* Toggle mute status
*/
private:
/** The media player instance of libvlc */
libvlc_media_player_t *m_player;
+
+ /**
+ * The constructor is private so only the MediaPlayer can create an instance of this class
+ */
+ Audio();
+
+ /** Destructor only used by the MediaPlayer associated with this class */
+ ~Audio();
+
+ /**
+ * Set the media player. This function can only be used by the MediaPlayer class
+ * @param player: the media player
+ */
+ void setMediaPlayer( libvlc_media_player_t *player);
+
+ /** Friend class */
+ friend class MediaPlayer;
};
};
MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
{
m_player = libvlc_media_player_new( libvlcInstance.m_instance );
+ m_audio.setMediaPlayer( m_player );
}
MediaPlayer::MediaPlayer( Media &media )
{
m_player = libvlc_media_player_new_from_media( media.m_media );
+ m_audio.setMediaPlayer( m_player );
}
MediaPlayer::~MediaPlayer()
{
return libvlc_get_fullscreen( m_player );
}
+
+Audio &MediaPlayer::audio()
+{
+ return m_audio;
+}
#include "libvlc.hpp"
#include "media.hpp"
+#include "audio.hpp"
namespace libvlc
{
* Create a media player with a media associated
* @param media: the associated media (the media can be safely destroy afterward)
*/
- MediaPlayer( Media &media);
+ MediaPlayer( Media &media );
/**
* Destructor
*/
int fullscreen();
+ /**
+ * Get the class that handle the Audio
+ * @return the instance of Audio associated with this MediaPlayer
+ */
+ Audio &audio();
+
private:
/** The media player instance of libvlc */
libvlc_media_player_t *m_player;
+
+ /** The Audio part of the media player */
+ Audio m_audio;
};
};