forked from mirror/openmw-tes3mp
really purge libav
This commit is contained in:
parent
39f89f967b
commit
3ea3d07d44
8 changed files with 3 additions and 261 deletions
|
@ -107,22 +107,11 @@ unset(FFMPEG_LIBRARIES CACHE)
|
||||||
|
|
||||||
find_package(FFmpeg REQUIRED)
|
find_package(FFmpeg REQUIRED)
|
||||||
|
|
||||||
set (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARY})
|
set (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWSCALE_LIBRARY} ${SWRESAMPLE_LIBRARIES})
|
||||||
|
|
||||||
if ( NOT AVCODEC_FOUND OR NOT AVFORMAT_FOUND OR NOT AVUTIL_FOUND OR NOT SWSCALE_FOUND )
|
if ( NOT AVCODEC_FOUND OR NOT AVFORMAT_FOUND OR NOT AVUTIL_FOUND OR NOT SWSCALE_FOUND OR NOT SWRESAMPLE_FOUND)
|
||||||
message(FATAL_ERROR "FFmpeg component required, but not found!")
|
message(FATAL_ERROR "FFmpeg component required, but not found!")
|
||||||
endif()
|
endif()
|
||||||
set(SOUND_INPUT_INCLUDES ${FFMPEG_INCLUDE_DIRS})
|
|
||||||
if( SWRESAMPLE_FOUND )
|
|
||||||
add_definitions(-DHAVE_LIBSWRESAMPLE)
|
|
||||||
set (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${SWRESAMPLE_LIBRARIES})
|
|
||||||
else()
|
|
||||||
if( AVRESAMPLE_FOUND )
|
|
||||||
set (FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVRESAMPLE_LIBRARIES})
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Install either libswresample (FFmpeg) or libavresample (Libav).")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
# Required for building the FFmpeg headers
|
# Required for building the FFmpeg headers
|
||||||
add_definitions(-D__STDC_CONSTANT_MACROS)
|
add_definitions(-D__STDC_CONSTANT_MACROS)
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ add_openmw_dir (mwscript
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwsound
|
add_openmw_dir (mwsound
|
||||||
soundmanagerimp openal_output ffmpeg_decoder sound sound_decoder sound_output loudness libavwrapper movieaudiofactory
|
soundmanagerimp openal_output ffmpeg_decoder sound sound_decoder sound_output loudness movieaudiofactory
|
||||||
)
|
)
|
||||||
|
|
||||||
add_openmw_dir (mwworld
|
add_openmw_dir (mwworld
|
||||||
|
|
|
@ -6,16 +6,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#ifndef HAVE_LIBSWRESAMPLE
|
|
||||||
// FIXME: remove this section once libswresample is packaged for Debian
|
|
||||||
int swr_init(AVAudioResampleContext *avr);
|
|
||||||
void swr_free(AVAudioResampleContext **avr);
|
|
||||||
int swr_convert( AVAudioResampleContext *avr, uint8_t** output, int out_samples, const uint8_t** input, int in_samples);
|
|
||||||
AVAudioResampleContext * swr_alloc_set_opts( AVAudioResampleContext *avr, int64_t out_ch_layout, AVSampleFormat out_fmt, int out_rate, int64_t in_ch_layout, AVSampleFormat in_fmt, int in_rate, int o, void* l);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <components/vfs/manager.hpp>
|
#include <components/vfs/manager.hpp>
|
||||||
|
|
||||||
namespace MWSound
|
namespace MWSound
|
||||||
|
|
|
@ -22,13 +22,7 @@ extern "C"
|
||||||
// From version 54.56 binkaudio encoding format changed from S16 to FLTP. See:
|
// From version 54.56 binkaudio encoding format changed from S16 to FLTP. See:
|
||||||
// https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d
|
// https://gitorious.org/ffmpeg/ffmpeg/commit/7bfd1766d1c18f07b0a2dd042418a874d49ea60d
|
||||||
// http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=872
|
// http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=872
|
||||||
#ifdef HAVE_LIBSWRESAMPLE
|
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
#else
|
|
||||||
#include <libavresample/avresample.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
#define SwrContext AVAudioResampleContext
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <components/files/constrainedfilestream.hpp>
|
#include <components/files/constrainedfilestream.hpp>
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
#ifndef HAVE_LIBSWRESAMPLE
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
// From libavutil version 52.2.0 and onward the declaration of
|
|
||||||
// AV_CH_LAYOUT_* is removed from libavcodec/avcodec.h and moved to
|
|
||||||
// libavutil/channel_layout.h
|
|
||||||
#if AV_VERSION_INT(52, 2, 0) <= AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
|
||||||
LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO)
|
|
||||||
#include <libavutil/channel_layout.h>
|
|
||||||
#endif
|
|
||||||
#include <libavresample/avresample.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
|
|
||||||
/* FIXME: delete this file once libswresample is packaged for Debian */
|
|
||||||
|
|
||||||
int swr_init(AVAudioResampleContext *avr) { return 1; }
|
|
||||||
|
|
||||||
void swr_free(AVAudioResampleContext **avr) { avresample_free(avr); }
|
|
||||||
|
|
||||||
int swr_convert(
|
|
||||||
AVAudioResampleContext *avr,
|
|
||||||
uint8_t** output,
|
|
||||||
int out_samples,
|
|
||||||
const uint8_t** input,
|
|
||||||
int in_samples)
|
|
||||||
{
|
|
||||||
// FIXME: potential performance hit
|
|
||||||
int out_plane_size = 0;
|
|
||||||
int in_plane_size = 0;
|
|
||||||
return avresample_convert(avr, output, out_plane_size, out_samples,
|
|
||||||
(uint8_t **)input, in_plane_size, in_samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
AVAudioResampleContext * swr_alloc_set_opts(
|
|
||||||
AVAudioResampleContext *avr,
|
|
||||||
int64_t out_ch_layout,
|
|
||||||
AVSampleFormat out_fmt,
|
|
||||||
int out_rate,
|
|
||||||
int64_t in_ch_layout,
|
|
||||||
AVSampleFormat in_fmt,
|
|
||||||
int in_rate,
|
|
||||||
int o,
|
|
||||||
void* l)
|
|
||||||
{
|
|
||||||
avr = avresample_alloc_context();
|
|
||||||
if(!avr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int res;
|
|
||||||
res = av_opt_set_int(avr, "out_channel_layout", out_ch_layout, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_ch_layout = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "out_sample_fmt", out_fmt, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_fmt = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "out_sample_rate", out_rate, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_rate = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_channel_layout", in_ch_layout, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_ch_layout = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_sample_fmt", in_fmt, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_fmt = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_sample_rate", in_rate, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_rate = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "internal_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: internal_sample_fmt\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(avresample_open(avr) < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "Error opening context\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return avr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
1
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
1
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
|
@ -6,7 +6,6 @@ set(OSG_FFMPEG_VIDEOPLAYER_SOURCE_FILES
|
||||||
videoplayer.cpp
|
videoplayer.cpp
|
||||||
videostate.cpp
|
videostate.cpp
|
||||||
videodefs.hpp
|
videodefs.hpp
|
||||||
libavwrapper.cpp
|
|
||||||
audiodecoder.cpp
|
audiodecoder.cpp
|
||||||
audiofactory.hpp
|
audiofactory.hpp
|
||||||
)
|
)
|
||||||
|
|
12
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
12
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
|
@ -6,24 +6,12 @@ extern "C"
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
#ifdef HAVE_LIBSWRESAMPLE
|
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
#else
|
|
||||||
// FIXME: remove this section once libswresample is packaged for Debian
|
|
||||||
#include <libavresample/avresample.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
#define SwrContext AVAudioResampleContext
|
|
||||||
int swr_init(AVAudioResampleContext *avr);
|
|
||||||
void swr_free(AVAudioResampleContext **avr);
|
|
||||||
int swr_convert( AVAudioResampleContext *avr, uint8_t** output, int out_samples, const uint8_t** input, int in_samples);
|
|
||||||
AVAudioResampleContext * swr_alloc_set_opts( AVAudioResampleContext *avr, int64_t out_ch_layout, AVSampleFormat out_fmt, int out_rate, int64_t in_ch_layout, AVSampleFormat in_fmt, int in_rate, int o, void* l);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
|
||||||
#define av_frame_alloc avcodec_alloc_frame
|
#define av_frame_alloc avcodec_alloc_frame
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "videostate.hpp"
|
#include "videostate.hpp"
|
||||||
|
|
110
extern/osg-ffmpeg-videoplayer/libavwrapper.cpp
vendored
110
extern/osg-ffmpeg-videoplayer/libavwrapper.cpp
vendored
|
@ -1,110 +0,0 @@
|
||||||
// This file is a wrapper around the libavresample library (the API-incompatible swresample replacement in the libav fork of ffmpeg), to make it look like swresample to the user.
|
|
||||||
|
|
||||||
#ifndef HAVE_LIBSWRESAMPLE
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
// From libavutil version 52.2.0 and onward the declaration of
|
|
||||||
// AV_CH_LAYOUT_* is removed from libavcodec/avcodec.h and moved to
|
|
||||||
// libavutil/channel_layout.h
|
|
||||||
#if AV_VERSION_INT(52, 2, 0) <= AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
|
||||||
LIBAVUTIL_VERSION_MINOR, LIBAVUTIL_VERSION_MICRO)
|
|
||||||
#include <libavutil/channel_layout.h>
|
|
||||||
#endif
|
|
||||||
#include <libavresample/avresample.h>
|
|
||||||
#include <libavutil/opt.h>
|
|
||||||
|
|
||||||
/* FIXME: delete this file once libswresample is packaged for Debian */
|
|
||||||
|
|
||||||
int swr_init(AVAudioResampleContext *avr) { return 1; }
|
|
||||||
|
|
||||||
void swr_free(AVAudioResampleContext **avr) { avresample_free(avr); }
|
|
||||||
|
|
||||||
int swr_convert(
|
|
||||||
AVAudioResampleContext *avr,
|
|
||||||
uint8_t** output,
|
|
||||||
int out_samples,
|
|
||||||
const uint8_t** input,
|
|
||||||
int in_samples)
|
|
||||||
{
|
|
||||||
// FIXME: potential performance hit
|
|
||||||
int out_plane_size = 0;
|
|
||||||
int in_plane_size = 0;
|
|
||||||
return avresample_convert(avr, output, out_plane_size, out_samples,
|
|
||||||
(uint8_t **)input, in_plane_size, in_samples);
|
|
||||||
}
|
|
||||||
|
|
||||||
AVAudioResampleContext * swr_alloc_set_opts(
|
|
||||||
AVAudioResampleContext *avr,
|
|
||||||
int64_t out_ch_layout,
|
|
||||||
AVSampleFormat out_fmt,
|
|
||||||
int out_rate,
|
|
||||||
int64_t in_ch_layout,
|
|
||||||
AVSampleFormat in_fmt,
|
|
||||||
int in_rate,
|
|
||||||
int o,
|
|
||||||
void* l)
|
|
||||||
{
|
|
||||||
avr = avresample_alloc_context();
|
|
||||||
if(!avr)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int res;
|
|
||||||
res = av_opt_set_int(avr, "out_channel_layout", out_ch_layout, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_ch_layout = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "out_sample_fmt", out_fmt, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_fmt = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "out_sample_rate", out_rate, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: out_rate = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_channel_layout", in_ch_layout, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_ch_layout = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_sample_fmt", in_fmt, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_fmt = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "in_sample_rate", in_rate, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: in_rate = %d\n", res);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
res = av_opt_set_int(avr, "internal_sample_fmt", AV_SAMPLE_FMT_FLTP, 0);
|
|
||||||
if(res < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "av_opt_set_int: internal_sample_fmt\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(avresample_open(avr) < 0)
|
|
||||||
{
|
|
||||||
av_log(avr, AV_LOG_ERROR, "Error opening context\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return avr;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
Loading…
Reference in a new issue