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

libvlcpp: add some functions for Video.

parent f81a7e47
......@@ -8,12 +8,14 @@ libvlcpp_la_SOURCES = \
media.cpp \
media.hpp \
media_player.cpp \
media_player.hpp
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
library_include_HEADERS = exception.hpp libvlc.hpp media.hpp media_player.hpp video.hpp
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvlcpp.pc
......@@ -245,3 +245,27 @@ void MediaPlayer::nextFrame()
Exception ex;
libvlc_media_player_next_frame( m_player, &ex.ex );
}
void MediaPlayer::toggleFullscreen()
{
Exception ex;
libvlc_toggle_fullscreen( m_player, &ex.ex );
}
void MediaPlayer::enableFullscreen()
{
Exception ex;
libvlc_set_fullscreen( m_player, 1, &ex.ex );
}
void MediaPlayer::disableFullscreen()
{
Exception ex;
libvlc_set_fullscreen( m_player, 0, &ex.ex );
}
int MediaPlayer::fullscreen()
{
Exception ex;
return libvlc_get_fullscreen( m_player, &ex.ex );
}
......@@ -158,7 +158,7 @@ public:
/**
* Set the movie time (in ms)
* @param the movie time (in ms)
* @param new_time the movie time (in ms)
*/
void setTime( int64_t new_time );
......@@ -170,7 +170,7 @@ public:
/**
* Set the movie position (in percent)
* @param the movie position
* @param position the movie position
*/
void setPosition( float position );
......@@ -282,7 +282,30 @@ public:
*/
void nextFrame();
protected:
/**
* Toggle fullscreen status on a non-embedded video output
*/
void toggleFullscreen();
/**
* Enable fullscreen on a non-embedded video output
*/
void enableFullscreen();
/**
* Disable fullscreen on a non-embedded video output
*/
void disableFullscreen();
/**
* Get the fullscreen status
* @return true if the fullscreen is enable, false overwise
*/
int fullscreen();
private:
/** The media player instance of libvlc */
libvlc_media_player_t *m_player;
};
......
/*****************************************************************************
* video.cpp: video part of an 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 "video.hpp"
#include "exception.hpp"
using namespace libvlc;
Video::Video( libvlc_media_player_t *player )
{
m_player = player;
libvlc_media_player_retain( m_player );
}
Video::~Video()
{
libvlc_media_player_release( m_player );
}
float Video::scale()
{
Exception ex;
return libvlc_video_get_scale( m_player, &ex.ex );
}
char *Video::aspectRatio()
{
Exception ex;
return libvlc_video_get_aspect_ratio( m_player, &ex.ex );
}
void Video::setAspectRatio( const char *aspect_ratio )
{
Exception ex;
libvlc_video_set_aspect_ratio( m_player, aspect_ratio, &ex.ex );
}
int Video::spu()
{
Exception ex;
return libvlc_video_get_spu( m_player, &ex.ex );
}
int Video::spuCount()
{
Exception ex;
return libvlc_video_get_spu_count( m_player, &ex.ex );
}
void Video::setSpu( int spu )
{
Exception ex;
libvlc_video_set_spu( m_player, spu, &ex.ex );
}
void Video::setSubtitleFile( const char *subtitle_file )
{
Exception ex;
libvlc_video_set_subtitle_file( m_player, subtitle_file, &ex.ex );
}
char *Video::cropGeometry()
{
Exception ex;
return libvlc_video_get_crop_geometry( m_player, &ex.ex );
}
void Video::setCropGeometry( const char *geometry )
{
Exception ex;
libvlc_video_set_crop_geometry( m_player, geometry, &ex.ex );
}
int Video::track()
{
Exception ex;
return libvlc_video_get_track( m_player, &ex.ex );
}
int Video::trackCount()
{
Exception ex;
return libvlc_video_get_track_count( m_player, &ex.ex );
}
void Video::setTrack( int track )
{
Exception ex;
libvlc_video_set_track( m_player, track, &ex.ex );
}
void Video::snapshot( const char *filepath, int with, int height )
{
Exception ex;
libvlc_video_take_snapshot( m_player, filepath, with, height, &ex.ex );
}
void Video::deinterlace( int enable, const char *mode )
{
Exception ex;
libvlc_video_set_deinterlace( m_player, enable, mode, &ex.ex );
}
/*****************************************************************************
* video.hpp: video part of an 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_VIDEO_HPP
#define LIBVLCPP_VIDEO_HPP
#include <vlc/libvlc.h>
#include <vlc/libvlc_media.h>
#include <vlc/libvlc_media_player.h>
#include "libvlc.hpp"
namespace libvlc
{
class Video
{
public:
/**
* Constructor
* @param player: the player handling the video
*/
Video( libvlc_media_player_t *player );
/** Destructor */
~Video();
/**
* Get the height of the video
* @return the height of the video
*/
int height();
/**
* Get the width of the video
* @return the widht of the video
*/
int width();
/**
* Get the current scaling factor of the video
* @return the current scaling factor or 0 if the video is set to fit to the output
*/
float scale();
/**
* Set the scaling factor
* @param factor: the new scaling factor
*/
void setScale( float factor );
/**
* Get the current video aspect ratio
* @return the aspect ratio
*/
char *aspectRatio();
/**
* set the video aspect ratio
* @param aspect_ratio: the aspect ratio
*/
void setAspectRatio( const char *aspect_ratio );
/**
* Get the current video subtitle
* @return the video subtitle
*/
int spu();
/**
* Get the number of available video subtitles
* @return the number of subtitle
*/
int spuCount();
/**
* Set the video subtitle index
* @param spu: the video subtitle
*/
void setSpu( int spu );
/** Get informations about the current spu */
/**
* Set the subtitle file
* @param subtitle_file: the new subtitle file
*/
void setSubtitleFile( const char *subtitle_file );
/** Get title description */
/** Get chapter description */
/**
* Get the current crop filter geometry
* @return the crop geonmetry
*/
char *cropGeometry();
/**
* Set the crop geometry
* @param geometry: the new crop filter geometry
*/
void setCropGeometry( const char *geometry );
/**
* Get the current video track
* @return the video track
*/
int track();
/**
* Get the number of video tracks
* @return the number of video tracks
*/
int trackCount();
/**
* Set the video track
* @param track: the video track
*/
void setTrack( int track );
/** get track description */
/**
* Take a snapshot and save it to a file
* @param filepath: path where to save the file
* @param widht: widht of the snapshot
* @param height: height of the snapshot
*/
void snapshot( const char *filepath, int widht, int height );
/**
* Enable or disable deinterlace filter and select the deinterlace filter to use
* @param enable: true to enable the deinterlace filter
* @param mode: the deinterlace filter to use
*/
void deinterlace( int enable, const char *mode );
private:
/** The media player instance of libvlc */
libvlc_media_player_t *m_player;
};
};
#endif // LIBVLCPP_VIDEO_HPP
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