Commit b24c7589 authored by Rémi Duraffort's avatar Rémi Duraffort

Move C++ binding to a new repository vlc/bindings/libvlcpp.git

parent 7a25e2ba
Doxyfile
admin/
m4/
INSTALL
This diff is collapsed.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
doc: Doxyfile
$(DOXYGEN)
.PHONY: doc
#!/bin/sh
# $Id$
#
# ***********************************************************************
# * Copyright © 2010 Rémi Duraffort. *
# * This program is free software; you can redistribute and/or modify *
# * it under the terms of the GNU General Public License as published *
# * by the Free Software Foundation; version 2 of the license. *
# * *
# * 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, you can get it from: *
# * http://www.gnu.org/copyleft/gpl.html *
# ***********************************************************************
set -xe
cd "$(dirname "$0")"
test -f src/libvlc.hpp || {
echo "You must run this script from your libvlcpp directory.">&2
exit 1
}
mkdir -p admin m4
autoreconf -sfi
set +x
echo ""
echo "Type \`./configure' to configure the package for your system"
echo "(type \`./configure -- help' for help)."
echo "Then you can use the usual \`make', \`make install', etc."
dnl configure.ac - Configure script for libvlcpp
AC_COPYRIGHT([Copyright (C) 2010 Rémi Duraffort])
AC_INIT(libvlcpp, 1.0.0, vlc-devel@no-spam@videolan.org)
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR(admin)
AC_CONFIG_MACRO_DIR([m4])
dnl Checks for programs.
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_ARG_VAR([CXXFLAGS], [C++ compiler flag])
dnl Checks for vlc library
PKG_CHECK_MODULES([libvlc], [libvlc >= 1.1.0])
AC_SUBST([libvlc_CFLAGS])
AC_SUBST([libvlc_LIBS])
AC_ARG_VAR([DOXYGEN], [Doxygen command])
AC_PATH_PROG([DOXYGEN], [doxygen], [false])
AM_INIT_AUTOMAKE
AC_CONFIG_FILES([Makefile src/Makefile src/libvlcpp.pc Doxyfile])
AC_OUTPUT
lib_LTLIBRARIES = libvlcpp.la
libvlcpp_la_SOURCES = \
audio.cpp \
audio.hpp \
exception.cpp \
exception.hpp \
libvlc.cpp \
libvlc.hpp \
media.cpp \
media.hpp \
media_player.cpp \
media_player.hpp \
video.cpp \
video.hpp
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 audio.hpp
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvlcpp.pc
/*****************************************************************************
* audio.cpp: audio part of the media player
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 "audio.hpp"
using namespace libvlc;
Audio::Audio()
{
}
Audio::~Audio()
{
libvlc_media_player_release( m_player );
}
void Audio::toggleMute()
{
libvlc_audio_toggle_mute( m_player );
}
int Audio::mute()
{
return libvlc_audio_get_mute( m_player );
}
void Audio::setMute( int mute )
{
libvlc_audio_set_mute( m_player, mute );
}
int Audio::volume()
{
return libvlc_audio_get_volume( m_player );
}
void Audio::setVolume( int volume )
{
libvlc_audio_set_volume( m_player, volume );
}
int Audio::track()
{
return libvlc_audio_get_track( m_player );
}
int Audio::trackCount()
{
return libvlc_audio_get_track_count( m_player );
}
void Audio::setTrack( int track )
{
libvlc_audio_set_track( m_player, track );
}
void Audio::setMediaPlayer( libvlc_media_player_t *player )
{
libvlc_media_player_retain( player );
m_player = player;
}
/*****************************************************************************
* audio.hpp: audio part of the media player
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 LIBVLCPP_AUDIO_HPP
#define LIBVLCPP_AUDIO_HPP
#include <vlc/libvlc.h>
#include <vlc/libvlc_media.h>
#include <vlc/libvlc_media_player.h>
#include "libvlc.hpp"
namespace libvlc
{
class MediaPlayer;
class Audio
{
public:
/**
* Toggle mute status
*/
void toggleMute();
/**
* Get the mute status
* @return true if the sound is muted
*/
int mute();
/**
* Set the mute status
* @param mute: true to mute, otherwise unmute
*/
void setMute( int mute );
/**
* Get the current volume
* @return the current volume
*/
int volume();
/**
* Set the volume
* @param volume: the new volume
*/
void setVolume( int volume );
/**
* Get the current track
* @return the current audio track
*/
int track();
/**
* Get the number of audio tracks
* @return the number of audio tracks
*/
int trackCount();
/**
* Set the audio track
* @param track: the audio track
*/
void setTrack( int track );
/**
* Get the current audio channel
* @return the current audio channel
*/
int channel();
/**
* Set the audio channel
* @param channel: the new audio channel
*/
void setChannel( int channel );
/** trackDescription */
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;
};
};
#endif // LIBVLCPP_AUDIO_HPP
/*****************************************************************************
* exception.cpp: Handle exceptions
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 "exception.hpp"
using namespace libvlc;
Exception::Exception()
{
libvlc_exception_init( &ex );
}
Exception::~Exception()
{
if( libvlc_exception_raised( &ex ) )
throw libvlc_errmsg();
libvlc_exception_clear( &ex );
}
/*****************************************************************************
* exception.hpp: handle exceptions
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 LIBVLCPP_EXCEPTION_HPP
#define LIBVLCPP_EXCEPTION_HPP
#include <vlc/libvlc.h>
#include "libvlc.hpp"
namespace libvlc
{
class Exception
{
public:
/** Create the exception */
Exception();
/** Destroy te exception */
~Exception();
/** The exception */
libvlc_exception_t ex;
};
};
#endif // LIBVLCPP_EXCEPTION_HPP
/*****************************************************************************
* libvlc.cpp: Main libvlc++ class
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 "libvlc.hpp"
using namespace libvlc;
libVLC::libVLC( int i_argc, const char *const *argv )
{
m_instance = libvlc_new( i_argc, argv);
if(!m_instance)
throw libvlc_errmsg();
}
libVLC::~libVLC()
{
libvlc_release( m_instance );
}
const char *libVLC::version()
{
return libvlc_get_version();
}
const char *libVLC::compiler()
{
return libvlc_get_compiler();
}
const char *libVLC::chanset()
{
return libvlc_get_changeset();
}
/*****************************************************************************
* libvlc.hpp: Main libvlc++ class
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 LIBVLCPP_HPP
#define LIBVLCPP_HPP
#include <vlc/libvlc.h>
namespace libvlc
{
class Media;
class MediaPlayer;
class libVLC
{
public:
/**
* Contructor
* @param i_argc: the number of arguments
* @param argv: arguments given to libvlc
*/
libVLC( int i_argc, const char* const* argv );
/* Destructor */
~libVLC();
/**
* Get the version of libVLC
* @return the version
*/
const char *version();
/**
* Get the compiler use for this binari
* @return the compiler used
*/
const char *compiler();
/**
* Get the chanset of libvlc
* @return thje changeset
*/
const char *chanset();
private:
/** The instance of libvlc */
libvlc_instance_t *m_instance;
/**
* Some friends class to access the instance of libvlc
*/
friend class Media;
friend class MediaPlayer;
};
};
#endif // LIBVLCPP_HPP
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libvlcpp
Description: C++ wrapper around libvlc
Requires: libvlc >= 1.1.0
Version: @VERSION@
Cflags: -I${includedir}
Libs: -L${libdir} -lvlcpp
/*****************************************************************************
* media.cpp: Represent a media
*****************************************************************************
* Copyright (C) 2010 the VideoLAN team
* $Id$
*
* Authors: Rémi Duraffort <ivoire@videolan.org>
*
* 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 "media.hpp"
#include "exception.hpp"
using namespace libvlc;
Media::Media( libVLC &libvlcInstance, const char *psz_mrl )
{
m_media = libvlc_media_new( libvlcInstance.m_instance, psz_mrl );
if( !m_media )
throw libvlc_errmsg();
}
Media::Media( const Media& original )
{
m_media = libvlc_media_duplicate( original.m_media );
}
Media::~Media()
{
libvlc_media_release( m_media );
}
void Media::addOption( const char *ppsz_options )
{
libvlc_media_add_option( m_media, ppsz_options );
}
void Media::addOption( const char *ppsz_options, libvlc_media_option_t flag )
{
libvlc_media_add_option_flag( m_media, ppsz_options, flag );
}
int64_t Media::duration()
{
return libvlc_media_get_duration( m_media );
}
int Media::isPreparsed()
{
return libvlc_media_is_preparsed( m_media );
}
char *Media::mrl()
{
return libvlc_media_get_mrl( m_media );
}
char *Media::meta( libvlc_meta_t e_meta )
{
return libvlc_media_get_meta( m_media, e_meta );
}
void Media::setMeta( libvlc_meta_t e_meta, const char *psz_value )
{
libvlc_media_set_meta( m_media, e_meta, psz_value );
}
int Media::saveMeta()
{
return libvlc_media_save_meta( m_media );
}
libvlc_state_t Media::state()
{
return libvlc_media_get_state( m_media );
}
void Media::setUserData( void *p_user_data )
{
libvlc_media_set_user_data( m_media, p_user_data );