Removed deprecated xine plugin to simplify licensing (xine plugin is GPL'd)

This commit is contained in:
Robert Osfield 2018-05-31 15:11:19 +01:00
parent 801069d4cc
commit 5fb1e9c120
6 changed files with 1 additions and 3393 deletions

View File

@ -752,7 +752,6 @@ ELSE()
FIND_PACKAGE(COLLADA) FIND_PACKAGE(COLLADA)
FIND_PACKAGE(FBX) FIND_PACKAGE(FBX)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
FIND_PACKAGE(Xine)
FIND_PACKAGE(OpenVRML) FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(GDAL) FIND_PACKAGE(GDAL)
FIND_PACKAGE(GTA) FIND_PACKAGE(GTA)

View File

@ -32,7 +32,7 @@ SET(TARGET_COMMON_LIBRARIES
osgUtil osgUtil
) )
OPTION(BUILD_OSG_PLUGINS_BY_DEFAULT "If set, all available plugins are built by default and each plugin can be disabled from the build by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 0. If not set, no plugins are built by default and each desired plugin must be explicitly enabled by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 1." ON) OPTION(BUILD_OSG_PLUGINS_BY_DEFAULT "If set, all available plugins are built by default and each plugin can be disabled from the build by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 0. If not set, no plugins are built by default and each desired plugin must be explicitly enabled by setting BUILD_OSG_PLUGIN_<PLUGINNAME> to 1." ON)
# Macro used for adding plugins below. By default, all plugins are built # Macro used for adding plugins below. By default, all plugins are built
# but can be disabled by setting the CMake Variable BUILD_OSG_PLUGIN_<PLUGINNAME> to 0. # but can be disabled by setting the CMake Variable BUILD_OSG_PLUGIN_<PLUGINNAME> to 0.
@ -213,10 +213,6 @@ IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_PLUGIN_DIRECTORY(txp) ADD_PLUGIN_DIRECTORY(txp)
ENDIF() ENDIF()
IF(XINE_FOUND)
ADD_PLUGIN_DIRECTORY(xine)
ENDIF()
IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE) IF(FFMPEG_FOUND AND OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_PLUGIN_DIRECTORY(ffmpeg) ADD_PLUGIN_DIRECTORY(ffmpeg)
ENDIF() ENDIF()

View File

@ -1,16 +0,0 @@
INCLUDE_DIRECTORIES( ${XINE_INCLUDE_DIR} )
SET(TARGET_SRC
video_out_rgb.c
ReaderWriterXine.cpp
)
SET(TARGET_LIBRARIES_VARS XINE_LIBRARY )
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
ENDIF()
#### end var setup ###
SETUP_PLUGIN(xine)

View File

@ -1,367 +0,0 @@
// (C) Robert Osfield, Feb 2004.
// GPL'd.
#include <osg/ImageStream>
#include <osg/Notify>
#include <osg/Geode>
#include <osg/GL>
#include <osg/Timer>
#include <osgDB/Registry>
#include <osgDB/FileNameUtils>
#include <osgDB/FileUtils>
#include <xine.h>
#include <xine/xineutils.h>
#include <xine/video_out.h>
#include "video_out_rgb.h"
namespace osgXine
{
class XineImageStream : public osg::ImageStream
{
public:
XineImageStream():
_xine(0),
_vo(0),
_ao(0),
_visual(0),
_stream(0),
_event_queue(0),
_ready(false),
_volume(-1.0)
{
setOrigin(osg::Image::TOP_LEFT);
}
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
XineImageStream(const XineImageStream& image,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
ImageStream(image,copyop) {}
META_Object(osgXine,XineImageStream);
void setVolume(float volume)
{
_volume = osg::minimum(osg::maximum(volume,0.0f),1.0f);
if (_stream)
{
xine_set_param(_stream, XINE_PARAM_AUDIO_VOLUME, static_cast<int>(_volume*100.0f));
OSG_NOTICE<<"Setting volume "<<_volume<<std::endl;
}
}
float getVolume() const
{
return _volume;
}
bool open(xine_t* xine, const std::string& filename)
{
if (filename==getFileName()) return true;
_xine = xine;
// create visual
rgbout_visual_info_t* visual = new rgbout_visual_info_t;
visual->levels = PXLEVEL_ALL;
visual->format = PX_RGB32;
visual->user_data = this;
visual->callback = my_render_frame;
// set up video driver
_vo = xine_open_video_driver(_xine, "rgb", XINE_VISUAL_TYPE_RGBOUT, (void*)visual);
// set up audio driver
char* audio_driver = getenv("OSG_XINE_AUDIO_DRIVER");
_ao = audio_driver ? xine_open_audio_driver(_xine, audio_driver, NULL) : xine_open_audio_driver(_xine, "auto", NULL);
if (!_vo)
{
OSG_NOTICE<<"XineImageStream::open() : Failed to create video driver"<<std::endl;
return false;
}
// set up stream
_stream = xine_stream_new(_xine, _ao, _vo);
if (_stream)
{
if (_volume < 0.0)
{
_volume = static_cast<float>(xine_get_param(_stream, XINE_PARAM_AUDIO_VOLUME))/100.0f;
}
else
{
setVolume(_volume);
}
}
_event_queue = xine_event_new_queue(_stream);
xine_event_create_listener_thread(_event_queue, event_listener, this);
int result = xine_open(_stream, filename.c_str());
if (result==0)
{
OSG_INFO<<"XineImageStream::open() : Could not ready movie file."<<std::endl;
close();
return false;
}
_ready = false;
int width = xine_get_stream_info(_stream,XINE_STREAM_INFO_VIDEO_WIDTH);
int height = xine_get_stream_info(_stream,XINE_STREAM_INFO_VIDEO_HEIGHT);
allocateImage(width,height,1,GL_RGB,GL_UNSIGNED_BYTE,1);
OSG_INFO<<"XineImageStream::open() size "<<width<<" "<<height<<std::endl;
// play();
return true;
}
virtual void play()
{
if (_status!=PLAYING && _stream)
{
if (_status==PAUSED)
{
xine_set_param (_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL);
_status=PLAYING;
}
else
{
OSG_INFO<<"XineImageStream::play()"<<std::endl;
if (xine_play(_stream, 0, 0))
{
while (!_ready)
{
OSG_INFO<<" waiting..."<<std::endl;
OpenThreads::Thread::microSleep(10000);
}
_status=PLAYING;
}
else
{
OSG_NOTICE<<"Error!!!"<<std::endl;
}
}
}
}
virtual void pause()
{
if (_status==PAUSED || _status==INVALID) return;
_status=PAUSED;
if (_stream)
{
xine_set_param (_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE);
}
}
virtual void rewind()
{
if (_status==INVALID) return;
_status=REWINDING;
if (_stream)
{
OSG_INFO<<"Warning::XineImageStream::rewind() - rewind disabled at present."<<std::endl;
//xine_trick_mode(_stream,XINE_TRICK_MODE_FAST_REWIND,0);
}
}
virtual void quit(bool /*waitForThreadToExit*/ = true)
{
close();
}
static void my_render_frame(uint32_t width, uint32_t height, void* data, void* userData)
{
XineImageStream* imageStream = (XineImageStream*) userData;
GLenum pixelFormat = GL_BGRA;
imageStream->setImage(width,height,1,
GL_RGB,
pixelFormat,GL_UNSIGNED_BYTE,
(unsigned char *)data,
osg::Image::NO_DELETE,
1);
imageStream->_ready = true;
}
xine_t* _xine;
xine_video_port_t* _vo;
xine_audio_port_t* _ao;
rgbout_visual_info_t* _visual;
xine_stream_t* _stream;
xine_event_queue_t* _event_queue;
bool _ready;
float _volume;
protected:
virtual ~XineImageStream()
{
OSG_INFO<<"Killing XineImageStream"<<std::endl;
close();
OSG_INFO<<"Closed XineImageStream"<<std::endl;
}
void close()
{
OSG_INFO<<"XineImageStream::close()"<<std::endl;
if (_stream)
{
OSG_INFO<<" Closing stream"<<std::endl;
xine_close(_stream);
OSG_INFO<<" Disposing stream"<<std::endl;
xine_dispose(_stream);
_stream = 0;
}
if (_event_queue)
{
_event_queue = 0;
}
if (_ao)
{
OSG_INFO<<" Closing audio driver"<<std::endl;
xine_close_audio_driver(_xine, _ao);
_ao = 0;
}
if (_vo)
{
OSG_INFO<<" Closing video driver"<<std::endl;
xine_close_video_driver(_xine, _vo);
_vo = 0;
}
OSG_INFO<<"closed XineImageStream "<<std::endl;
}
static void event_listener(void *user_data, const xine_event_t *event)
{
XineImageStream* xis = reinterpret_cast<XineImageStream*>(user_data);
switch(event->type)
{
case XINE_EVENT_UI_PLAYBACK_FINISHED:
if (xis->getLoopingMode()==LOOPING)
{
//rewind();
xine_play(xis->_stream, 0, 0);
}
break;
}
}
};
}
class ReaderWriterXine : public osgDB::ReaderWriter
{
public:
ReaderWriterXine()
{
supportsExtension("avi","");
supportsExtension("db","");
supportsExtension("ogv","");
supportsExtension("flv","");
supportsExtension("mov","");
supportsExtension("m4v","");
supportsExtension("mpg","Mpeg movie format");
supportsExtension("mpv","Mpeg movie format");
supportsExtension("wmv","");
supportsExtension("xine","Xine plugin Pseduo plugin");
_xine = xine_new();
const char* user_home = xine_get_homedir();
if(user_home)
{
std::string configFile(std::string(user_home)+"/.xine/config");
xine_config_load(_xine, configFile.c_str());
}
xine_init(_xine);
register_rgbout_plugin(_xine);
}
virtual ~ReaderWriterXine()
{
OSG_INFO<<"~ReaderWriterXine()"<<std::endl;
if (_xine) xine_exit(_xine);
_xine = NULL;
}
virtual const char* className() const { return "Xine ImageStream Reader"; }
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const
{
std::string ext = osgDB::getLowerCaseFileExtension(file);
if (!acceptsExtension(ext)) return ReadResult::FILE_NOT_HANDLED;
std::string fileName;
if (ext=="xine")
{
fileName = osgDB::findDataFile( osgDB::getNameLessExtension(file), options);
OSG_INFO<<"Xine stipped filename = "<<fileName<<std::endl;
}
else
{
fileName = osgDB::findDataFile( file, options );
if (fileName.empty()) return ReadResult::FILE_NOT_FOUND;
}
OSG_INFO<<"ReaderWriterXine::readImage "<< file<< std::endl;
osg::ref_ptr<osgXine::XineImageStream> imageStream = new osgXine::XineImageStream();
if (!imageStream->open(_xine, fileName)) return ReadResult::FILE_NOT_HANDLED;
return imageStream.release();
}
protected:
xine_t* _xine;
};
// now register with Registry to instantiate the above
// reader/writer.
REGISTER_OSGPLUGIN(xine, ReaderWriterXine)

File diff suppressed because it is too large Load Diff

View File

@ -1,191 +0,0 @@
/*
* Copyright (C) 2000-2003 the xine project and Claudio "KLaN" Ciccani
*
* This file is part of xine, a free video player.
*
* xine 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.
*
* xine 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
*
* video_out_rgb.h, data types definitions for video_out_rgb.c
* by Claudio "KLaN" Ciccani <klan82@cheapnet.it>
*
*
*/
#ifndef VIDEO_OUT_RGB_H
#define VIDEO_OUT_RGB_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint8_t *r;
uint8_t *g;
uint8_t *b;
} rgb_planar_t;
typedef enum
{
/* PX_RGB_PLANAR = 1, ? */
PX_ARGB = 2, /* 32 bits [a:8@24, r:8@26, g:8@8, b:8@0] */
PX_ARGB1555 = 3, /* 16 bits [a:1@15, r:5@10, g:5@5, b:5@0] */
PX_RGB32 = 4, /* 32 bits [r:8@16, g:8@8, b:8@0] */
PX_RGB24 = 5, /* 24 bits [r:8@16, g:8@8, b:8@0] */
PX_RGB16 = 6, /* 16 bits [r:5@11, g:6@5, b:5@0] */
PX_BGRA = 7, /* 32 bits [a:8@0, r:8@8, g:8@16, b:8@24] */
PX_BGRA5551 = 8, /* 16 bits [a:1@0, r:5@1, g:5@6, b:5@11] */
PX_BGR32 = 9, /* 32 bits [r:8@0, g:8@8, b:8@16] */
PX_BGR24 = 10, /* 24 bits [r:8@0, g:8@8, b:8@16] */
PX_BGR16 = 11 /* 16 bits [r:5@0, g:6@5, b:5@11] */
} rgb_pixel_format_t;
typedef enum
{
PXLEVEL_NONE = 0,
PXLEVEL_R = (1 << 0),
PXLEVEL_G = (1 << 1),
PXLEVEL_B = (1 << 2),
PXLEVEL_ALL = 7 /* PX_LEVEL_R | PX_LEVEL_G | PX_LEVEL_B */
} rgb_pixel_levels_t;
/*
* Applications that want to use this driver must provide a
* callabck function (eg. for rendering frames);
* RGBout will pass it a buffer containing pixels in the format
* specified by "format" (generally you have only to BLIT
* the buffer if you want to display the frame).
* "levels" selects which RGB level is visible (if you don't
* need this feature, set it to PXLEVEL_ALL).
*
* N.B.: DO NOT FREE THE BUFFER
*
*/
typedef struct
{
rgb_pixel_format_t format;
rgb_pixel_levels_t levels;
void* user_data;
void (*callback) (uint32_t width, uint32_t height, void* imageData, void* userData);
} rgbout_visual_info_t;
typedef struct
{
vo_frame_t vo_frame;
uint32_t width;
uint32_t height;
uint32_t pixels;
uint32_t format;
double ratio;
void* chunk[3];
} rgbout_frame_t;
typedef struct rgb_driver_s
{
vo_driver_t vo_driver;
config_values_t* config;
rgbout_frame_t* frame;
uint32_t frame_width;
uint32_t frame_height;
uint32_t lastframe_width;
uint32_t lastframe_height;
rgb_planar_t buffer;
void* outbuffer;
uint32_t accel;
uint8_t cm, pm; /* conversion method, packing method */
uint8_t levels; /* RGB levels mask */
void* user_data;
/* private functions */
void (*convert) (uint8_t* yuv[], rgb_planar_t* rgb,
uint32_t pitches[], uint32_t width, uint32_t height);
void (*pack) (rgb_planar_t* rgb, void* dest, uint32_t pixels, uint32_t accel);
void (*render) (uint32_t width, uint32_t height, void* data, void* userData);
/* public callback */
int (*update_visual) (vo_driver_t* vo_driver,
rgbout_visual_info_t* new_visual);
} rgbout_driver_t;
typedef struct
{
video_driver_class_t driver_class;
} rgbout_class_t;
typedef struct
{
const char* name;
uint32_t required_accel;
void (*convert_yuy2) (uint8_t* yuv[], rgb_planar_t* rgb,
uint32_t pitches[], uint32_t width, uint32_t height);
void (*convert_yv12) (uint8_t* yuv[], rgb_planar_t* rgb,
uint32_t pitches[], uint32_t width, uint32_t height);
} rgbout_converter_t;
typedef struct
{
const char* name;
rgb_pixel_format_t id;
uint8_t pixelsize;
uint8_t scratch;
void (*pack) (rgb_planar_t* rgb, void* dest, uint32_t pixels, uint32_t accel);
} rgbout_packer_t;
void register_rgbout_plugin(xine_t *self);
#define XINE_VISUAL_TYPE_RGBOUT 100
#ifdef __cplusplus
}
#endif
#endif /* VIDEO_OUT_RGB_H */