From 94f3b906053d4f6e9df2e94c2cefca6fdd14730a Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 15 Sep 2015 01:18:32 -0400 Subject: games/alephone: Updated for version 20150620. --- games/alephone/alephone.SlackBuild | 20 +- games/alephone/alephone.info | 8 +- games/alephone/ffmpeg_api.diff | 27 -- games/alephone/r5009.diff | 385 --------------------------- games/alephone/r5010.diff | 13 - games/alephone/r5013.diff | 14 - games/alephone/r5033.diff | 514 ------------------------------------- games/alephone/r5037.diff | 193 -------------- 8 files changed, 11 insertions(+), 1163 deletions(-) delete mode 100644 games/alephone/ffmpeg_api.diff delete mode 100644 games/alephone/r5009.diff delete mode 100644 games/alephone/r5010.diff delete mode 100644 games/alephone/r5013.diff delete mode 100644 games/alephone/r5033.diff delete mode 100644 games/alephone/r5037.diff (limited to 'games/alephone') diff --git a/games/alephone/alephone.SlackBuild b/games/alephone/alephone.SlackBuild index 73d2a82bb9..06ff691383 100644 --- a/games/alephone/alephone.SlackBuild +++ b/games/alephone/alephone.SlackBuild @@ -6,8 +6,13 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. +# 20150915 bkw: +# - update for 20150620 release +# - ffmpeg patches no longer needed +# - move binary to /usr/games + PRGNAM=alephone -VERSION=${VERSION:-20140104} +VERSION=${VERSION:-20150620} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -55,24 +60,13 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; -# Patch came from ArchLinux AUR, this is the two ffmpeg patches catted -# together. -patch -p1 < $CWD/ffmpeg_api.diff -# Thanks to John Vogel for these ffmpeg patches: -patch -p0 < $CWD/r5009.diff -patch -p0 < $CWD/r5010.diff -patch -p0 < $CWD/r5013.diff -patch -p0 < $CWD/r5033.diff -patch -p0 < $CWD/r5037.diff - -autoreconf - [ "${FFMPEG:-yes}" = "no" ] && EXTRAOPT=--disable-ffmpeg CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS -fpermissive" \ ./configure \ $EXTRAOPT \ + --bindir=/usr/games \ --prefix=/usr \ --libdir=/usr/lib${LIBDIRSUFFIX} \ --sysconfdir=/etc \ diff --git a/games/alephone/alephone.info b/games/alephone/alephone.info index 02f36ce31b..07a914e54a 100644 --- a/games/alephone/alephone.info +++ b/games/alephone/alephone.info @@ -1,8 +1,8 @@ PRGNAM="alephone" -VERSION="20140104" -HOMEPAGE="http://marathon.sourceforge.net/" -DOWNLOAD="http://downloads.sourceforge.net/project/marathon/Aleph%20One/2014-01-04/AlephOne-20140104.tar.bz2" -MD5SUM="5d7cad49eab566a8d6c1317a86055a7f" +VERSION="20150620" +HOMEPAGE="https://alephone.lhowon.org/" +DOWNLOAD="https://github.com/Aleph-One-Marathon/alephone/releases/download/release-20150620/AlephOne-20150620.tar.bz2" +MD5SUM="561914ed5880c75877bc9eeb18429a37" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="lua speex zziplib ffmpeg" diff --git a/games/alephone/ffmpeg_api.diff b/games/alephone/ffmpeg_api.diff deleted file mode 100644 index 3128e3d426..0000000000 --- a/games/alephone/ffmpeg_api.diff +++ /dev/null @@ -1,27 +0,0 @@ -diff -rupN AlephOne-20140104/Source_Files/FFmpeg/SDL_ffmpeg.c AlephOne-20140104.new/Source_Files/FFmpeg/SDL_ffmpeg.c ---- AlephOne-20140104/Source_Files/FFmpeg/SDL_ffmpeg.c 2013-07-05 02:33:29.000000000 +0200 -+++ AlephOne-20140104.new/Source_Files/FFmpeg/SDL_ffmpeg.c 2014-03-16 01:53:19.327213212 +0100 -@@ -48,6 +48,11 @@ extern "C" - } - #endif - -+/* set magic number for 1 second of 48khz 32bit audio (removed from upstream) */ -+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE -+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 -+#endif -+ - #include "SDL_ffmpeg.h" - - #ifdef MSVC -diff -rupN AlephOne-20140104/Source_Files/FFmpeg/Movie.cpp AlephOne-20140104.new/Source_Files/FFmpeg/Movie.cpp ---- AlephOne-20140104/Source_Files/FFmpeg/Movie.cpp 2014-01-04 03:19:57.000000000 +0100 -+++ AlephOne-20140104.new/Source_Files/FFmpeg/Movie.cpp 2014-03-16 01:43:32.030011019 +0100 -@@ -491,7 +491,7 @@ bool Movie::Setup() - - // tuning options - int aq = graphics_preferences->movie_export_audio_quality; -- audio_stream->codec->global_quality = audio_stream->quality = FF_QP2LAMBDA * (aq / 10); -+ audio_stream->codec->global_quality = FF_QP2LAMBDA * (aq / 10); - audio_stream->codec->flags |= CODEC_FLAG_QSCALE; - - // find correct sample format diff --git a/games/alephone/r5009.diff b/games/alephone/r5009.diff deleted file mode 100644 index 39f9e648cf..0000000000 --- a/games/alephone/r5009.diff +++ /dev/null @@ -1,385 +0,0 @@ -Index: Source_Files/Sound/FFmpegDecoder.cpp -=================================================================== ---- Source_Files/Sound/FFmpegDecoder.cpp (revision 5008) -+++ Source_Files/Sound/FFmpegDecoder.cpp (revision 5009) -@@ -199,10 +199,13 @@ - - while (pkt_temp.size > 0) - { -- AVFrame frame; -- avcodec_get_frame_defaults(&frame); -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,0) -+ AVFrame *dframe = avcodec_alloc_frame(); -+#else -+ AVFrame *dframe = av_frame_alloc(); -+#endif - int got_frame = 0; -- int bytes_read = avcodec_decode_audio4(dec_ctx, &frame, &got_frame, &pkt_temp); -+ int bytes_read = avcodec_decode_audio4(dec_ctx, dframe, &got_frame, &pkt_temp); - if (bytes_read < 0) - { - av_free_packet(&pkt); -@@ -216,12 +219,12 @@ - - int stride = -1; - if (channels > 1 && av_sample_fmt_is_planar(in_fmt)) -- stride = frame.extended_data[1] - frame.extended_data[0]; -+ stride = dframe->extended_data[1] - dframe->extended_data[0]; - -- int written = convert_audio(frame.nb_samples, channels, -+ int written = convert_audio(dframe->nb_samples, channels, - stride, -- in_fmt, frame.extended_data[0], -- frame.nb_samples, channels, -+ in_fmt, dframe->extended_data[0], -+ dframe->nb_samples, channels, - -1, - out_fmt, av->temp_data); - -@@ -230,6 +233,12 @@ - pkt_temp.data += bytes_read; - pkt_temp.size -= bytes_read; - } -+ -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,0) -+ av_freep(&dframe); -+#else -+ av_frame_free(&dframe); -+#endif - } - - av_free_packet(&pkt); -Index: Source_Files/FFmpeg/Movie.cpp -=================================================================== ---- Source_Files/FFmpeg/Movie.cpp (revision 5008) -+++ Source_Files/FFmpeg/Movie.cpp (revision 5009) -@@ -85,6 +85,15 @@ - } - #endif - -+// FFmpeg compatibility -+#ifndef AV_CODEC_ID_VP8 -+#define AV_CODEC_ID_VP8 CODEC_ID_VP8 -+#endif -+#ifndef AV_CODEC_ID_VORBIS -+#define AV_CODEC_ID_VORBIS CODEC_ID_VORBIS -+#endif -+ -+ - // shamelessly stolen from SDL 2.0 - static int get_cpu_count(void) - { -@@ -399,7 +408,7 @@ - AVStream *video_stream; - if (success) - { -- video_codec = avcodec_find_encoder(CODEC_ID_VP8); -+ video_codec = avcodec_find_encoder(AV_CODEC_ID_VP8); - success = video_codec; - if (!success) err_msg = "Could not find VP8 encoder"; - } -@@ -445,7 +454,11 @@ - } - if (success) - { -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,0) - av->video_frame = avcodec_alloc_frame(); -+#else -+ av->video_frame = av_frame_alloc(); -+#endif - success = av->video_frame; - if (!success) err_msg = "Could not allocate video frame"; - } -@@ -466,7 +479,7 @@ - AVStream *audio_stream; - if (success) - { -- audio_codec = avcodec_find_encoder(CODEC_ID_VORBIS); -+ audio_codec = avcodec_find_encoder(AV_CODEC_ID_VORBIS); - success = audio_codec; - if (!success) err_msg = "Could not find Vorbis encoder"; - } -@@ -511,7 +524,11 @@ - } - if (success) - { -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,0) - av->audio_frame = avcodec_alloc_frame(); -+#else -+ av->audio_frame = av_frame_alloc(); -+#endif - success = av->audio_frame; - if (!success) err_msg = "Could not allocate audio frame"; - } -@@ -550,6 +567,7 @@ - // Start movie file - if (success) - { -+ video_stream->time_base = (AVRational){1, TICKS_PER_SECOND}; - avformat_write_header(av->fmt_ctx, NULL); - } - -@@ -615,13 +633,15 @@ - while (!done) - { - // add video -- int vsize = avcodec_encode_video(vcodec, -- av->video_buf, av->video_bufsize, -- frame); -+ AVPacket pkt; -+ av_init_packet(&pkt); -+ pkt.data = av->video_buf; -+ pkt.size = av->video_bufsize; -+ -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,0,0) -+ int vsize = avcodec_encode_video(vcodec, av->video_buf, av->video_bufsize, frame); - if (vsize > 0) - { -- AVPacket pkt; -- av_init_packet(&pkt); - if (vcodec->coded_frame->pts != AV_NOPTS_VALUE) - { - pkt.pts = av_rescale_q(vcodec->coded_frame->pts, -@@ -630,12 +650,19 @@ - } - if (vcodec->coded_frame->key_frame) - pkt.flags |= AV_PKT_FLAG_KEY; -+ pkt.size = vsize; -+ } -+ -+#else -+ int got_packet = 0; -+ int vsize = avcodec_encode_video2(vcodec, &pkt, frame, &got_packet); -+#endif -+ if (vsize > 0) -+ { - pkt.stream_index = vstream->index; -- pkt.data = av->video_buf; -- pkt.size = vsize; - av_interleaved_write_frame(av->fmt_ctx, &pkt); -- av_free_packet(&pkt); - } -+ av_free_packet(&pkt); - - if (!last || vsize <= 0) - done = true; -@@ -679,7 +706,11 @@ - write_samples, acodec->channels, write_samples * write_bps, - acodec->sample_fmt, av->audio_data_conv); - -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) - avcodec_get_frame_defaults(av->audio_frame); -+#else -+ av_frame_unref(av->audio_frame); -+#endif - av->audio_frame->nb_samples = write_samples; - int asize = avcodec_fill_audio_frame(av->audio_frame, acodec->channels, - acodec->sample_fmt, -@@ -695,7 +726,7 @@ - if (0 == avcodec_encode_audio2(acodec, &pkt, av->audio_frame, &got_pkt) - && got_pkt) - { -- if (acodec->coded_frame->pts != AV_NOPTS_VALUE) -+ if (acodec->coded_frame && acodec->coded_frame->pts != AV_NOPTS_VALUE) - { - pkt.pts = av_rescale_q(acodec->coded_frame->pts, - acodec->time_base, -Index: Source_Files/FFmpeg/SDL_ffmpeg.c -=================================================================== ---- Source_Files/FFmpeg/SDL_ffmpeg.c (revision 5008) -+++ Source_Files/FFmpeg/SDL_ffmpeg.c (revision 5009) -@@ -48,6 +48,38 @@ - } - #endif - -+// FFmpeg compatibility -+#ifndef AV_CODEC_ID_MPEG1VIDEO -+#define AV_CODEC_ID_MPEG1VIDEO CODEC_ID_MPEG1VIDEO -+#endif -+#ifndef AV_CODEC_ID_MPEG2VIDEO -+#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO -+#endif -+#ifndef AV_CODEC_ID_MP2 -+#define AV_CODEC_ID_MP2 CODEC_ID_MP2 -+#endif -+#ifndef AV_CODEC_ID_DVVIDEO -+#define AV_CODEC_ID_DVVIDEO CODEC_ID_DVVIDEO -+#endif -+#ifndef AV_CODEC_ID_DVAUDIO -+#define AV_CODEC_ID_DVAUDIO CODEC_ID_DVAUDIO -+#endif -+#ifndef AV_CODEC_ID_PCM_S16LE -+#define AV_CODEC_ID_PCM_S16LE CODEC_ID_PCM_S16LE -+#endif -+#ifndef AV_CODEC_ID_PCM_S16BE -+#define AV_CODEC_ID_PCM_S16BE CODEC_ID_PCM_S16BE -+#endif -+#ifndef AV_CODEC_ID_PCM_U16LE -+#define AV_CODEC_ID_PCM_U16LE CODEC_ID_PCM_U16LE -+#endif -+#ifndef AV_CODEC_ID_PCM_U16BE -+#define AV_CODEC_ID_PCM_U16BE CODEC_ID_PCM_U16BE -+#endif -+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE -+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 -+#endif -+ - #include "SDL_ffmpeg.h" - - #ifdef MSVC -@@ -169,12 +201,12 @@ - - const SDL_ffmpegCodec SDL_ffmpegCodecPALDVD = - { -- CODEC_ID_MPEG2VIDEO, -+ AV_CODEC_ID_MPEG2VIDEO, - 720, 576, - 1, 25, - 6000000, - -1, -1, -- CODEC_ID_MP2, -+ AV_CODEC_ID_MP2, - 2, 48000, - 192000, - -1, -1 -@@ -182,12 +214,12 @@ - - const SDL_ffmpegCodec SDL_ffmpegCodecPALDV = - { -- CODEC_ID_DVVIDEO, -+ AV_CODEC_ID_DVVIDEO, - 720, 576, - 1, 25, - 6553600, - -1, -1, -- CODEC_ID_DVAUDIO, -+ AV_CODEC_ID_DVAUDIO, - 2, 48000, - 256000, - -1, -1 -@@ -324,7 +356,11 @@ - { - if ( file->type == SDL_ffmpegInputStream ) - { -+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53,17,0) - av_close_input_file( file->_ffmpeg ); -+#else -+ avformat_close_input( &file->_ffmpeg ); -+#endif - } - else if ( file->type == SDL_ffmpegOutputStream ) - { -@@ -448,7 +484,11 @@ - { - stream->mutex = SDL_CreateMutex(); - -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,0) - stream->decodeFrame = avcodec_alloc_frame(); -+#else -+ stream->decodeFrame = av_frame_alloc(); -+#endif - - SDL_ffmpegStream **s = &file->vs; - while ( *s ) -@@ -1301,11 +1341,17 @@ - { - if ( stream && stream->_ffmpeg && stream->_ffmpeg->codec ) - { -- if ( nominator ) *nominator = stream->_ffmpeg->r_frame_rate.num; -+ AVRational frate; -+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(55,12,100) -+ frate = stream->_ffmpeg->r_frame_rate; -+#else -+ frate = av_stream_get_r_frame_rate(stream->_ffmpeg); -+#endif -+ if ( nominator ) *nominator = frate.num; - -- if ( denominator ) *denominator = stream->_ffmpeg->r_frame_rate.den; -+ if ( denominator ) *denominator = frate.den; - -- return ( float )stream->_ffmpeg->r_frame_rate.num / stream->_ffmpeg->r_frame_rate.den; -+ return ( float )frate.num / frate.den; - } - else - { -@@ -1587,13 +1633,13 @@ - stream->codec->pix_fmt = PIX_FMT_YUV420P; - - /* set mpeg2 codec parameters */ -- if ( stream->codec->codec_id == CODEC_ID_MPEG2VIDEO ) -+ if ( stream->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO ) - { - stream->codec->max_b_frames = 2; - } - - /* set mpeg1 codec parameters */ -- if ( stream->codec->codec_id == CODEC_ID_MPEG1VIDEO ) -+ if ( stream->codec->codec_id == AV_CODEC_ID_MPEG1VIDEO ) - { - /* needed to avoid using macroblocks in which some coeffs overflow - this doesnt happen with normal video, it just happens here as the -@@ -1757,10 +1803,10 @@ - - switch ( stream->codec->codec_id ) - { -- case CODEC_ID_PCM_S16LE: -- case CODEC_ID_PCM_S16BE: -- case CODEC_ID_PCM_U16LE: -- case CODEC_ID_PCM_U16BE: -+ case AV_CODEC_ID_PCM_S16LE: -+ case AV_CODEC_ID_PCM_S16BE: -+ case AV_CODEC_ID_PCM_U16LE: -+ case AV_CODEC_ID_PCM_U16BE: - str->encodeAudioInputSize >>= 1; - break; - default: -@@ -2032,19 +2078,41 @@ - while ( size > 0 ) - { - /* Decode the packet */ -- --#if ( LIBAVCODEC_VERSION_MAJOR <= 52 && LIBAVCODEC_VERSION_MINOR <= 20 ) -- int len = avcodec_decode_audio2( file->audioStream->_ffmpeg->codec, ( int16_t* )file->audioStream->sampleBuffer, &audioSize, pack->data, pack->size ); --#else -- int len = avcodec_decode_audio3( file->audioStream->_ffmpeg->codec, ( int16_t* )file->audioStream->sampleBuffer, &audioSize, pack ); -+ AVCodecContext *avctx = file->audioStream->_ffmpeg->codec; -+ AVFrame dframe; -+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) -+ avcodec_get_frame_defaults(&dframe); - #endif -- -- /* if an error occured, we skip the frame */ -- if ( len <= 0 || !audioSize ) -+ int got_frame = 0; -+ int len = avcodec_decode_audio4( avctx, &dframe, &got_frame, pack ); -+ -+ if (len < 0 || !got_frame) - { - SDL_ffmpegSetError( "error decoding audio frame" ); - break; - } -+ -+ int planar = av_sample_fmt_is_planar( avctx->sample_fmt ); -+ int plane_size; -+ int data_size = av_samples_get_buffer_size( &plane_size, avctx->channels, dframe.nb_samples, avctx->sample_fmt, 1 ); -+ if ( data_size > 10000 ) -+ { -+ SDL_ffmpegSetError( "too much data in decoded audio frame" ); -+ break; -+ } -+ memcpy( file->audioStream->sampleBuffer, dframe.extended_data[0], plane_size ); -+ audioSize = plane_size; -+ if ( planar && avctx->channels > 1 ) -+ { -+ int8_t *out = file->audioStream->sampleBuffer + plane_size; -+ int ch; -+ for ( ch = 1; ch < avctx->channels; ch++ ) -+ { -+ memcpy( out, dframe.extended_data[ch], plane_size ); -+ out += plane_size; -+ audioSize += plane_size; -+ } -+ } - - /* change pointers */ - data += len; diff --git a/games/alephone/r5010.diff b/games/alephone/r5010.diff deleted file mode 100644 index ff010424fa..0000000000 --- a/games/alephone/r5010.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: configure.ac -=================================================================== ---- configure.ac (revision 5009) -+++ configure.ac (revision 5010) -@@ -195,7 +195,7 @@ - - if [[ "x$enable_ffmpeg" = "xyes" ]]; then - dnl Check for libavcodec --PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 53.35.0 libavformat >= 53.21.0 libavutil >= 51.22.0 libswscale >= 2.1.0], [ -+PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.100], [ - CPPFLAGS="$FFMPEG_CFLAGS $CPPFLAGS" - LIBS="$FFMPEG_LIBS $LIBS" - AC_DEFINE(HAVE_FFMPEG, 1, [ffmpeg support enabled]) diff --git a/games/alephone/r5013.diff b/games/alephone/r5013.diff deleted file mode 100644 index 48f621d852..0000000000 --- a/games/alephone/r5013.diff +++ /dev/null @@ -1,14 +0,0 @@ -Index: Source_Files/Sound/FFmpegDecoder.cpp -=================================================================== ---- Source_Files/Sound/FFmpegDecoder.cpp (revision 5012) -+++ Source_Files/Sound/FFmpegDecoder.cpp (revision 5013) -@@ -21,6 +21,9 @@ - - */ - -+// make FFmpeg happy -+#define __STDC_CONSTANT_MACROS -+ - #include "FFmpegDecoder.h" - - #ifdef HAVE_FFMPEG diff --git a/games/alephone/r5033.diff b/games/alephone/r5033.diff deleted file mode 100644 index 54f7ea355a..0000000000 --- a/games/alephone/r5033.diff +++ /dev/null @@ -1,514 +0,0 @@ -Index: configure.ac -=================================================================== ---- configure.ac (revision 5032) -+++ configure.ac (revision 5033) -@@ -1,9 +1,13 @@ - dnl Process this file with autoconf to produce a configure script. --dnl Written in 2000 by Christian Bauer -+dnl Written by Christian Bauer and the Aleph One developers. - --AC_INIT([Aleph One/SDL], m4_esyscmd([ grep '^#define A1_DATE_VERSION' Source_Files/Misc/alephversion.h | sed -e 's/\(.*\"\)\(.*\)\(\"\)/\2/g' | tr -d '\n']), [http://sourceforge.net/bugs/?group_id=1997], [AlephOne]) -+AC_INIT([Aleph One], -+ m4_esyscmd([ grep '^#define A1_DATE_VERSION' Source_Files/Misc/alephversion.h | sed -e 's/\(.*\"\)\(.*\)\(\"\)/\2/g' | tr -d '\n']), -+ [http://sourceforge.net/p/marathon/bugs/], -+ [AlephOne], -+ [http://marathon.sourceforge.net/]) - AC_CONFIG_SRCDIR([Source_Files/shell.cpp]) --AC_PREREQ(2.52) -+AC_PREREQ([2.65]) - - dnl Detect the canonical host and target build environment. - AC_CANONICAL_HOST -@@ -11,288 +15,212 @@ - - dnl Init automake. - AM_INIT_AUTOMAKE --AM_CONFIG_HEADER(config.h) -+AM_CONFIG_HEADER([config.h]) - - dnl Configure options. --AC_ARG_ENABLE(opengl, --[ --enable-opengl use OpenGL for rendering [default=yes]], , enable_opengl=yes) --AC_ARG_ENABLE(mad, --[ --enable-mad use libmad for mp3 playback [default=yes]], , enable_mad=yes) --AC_ARG_ENABLE(ffmpeg, --[ --enable-ffmpeg use ffmpeg for audio/video playback and film export [default=yes]], , enable_ffmpeg=yes) --AC_ARG_ENABLE(sndfile, --[ --enable-sndfile use libsndfile for decoding audio files [default=yes]], , enable_sndfile=yes) --AC_ARG_ENABLE(vorbis, --[ --enable-vorbis enable ogg/vorbis music playback [default=yes]], , enable_vorbis=yes) --AC_ARG_ENABLE(lua, --[ --enable-lua use built-in Lua scripting [default=yes]], , enable_lua=yes) --AC_ARG_ENABLE(smpeg, --[ --enable-smpeg use SMPEG for movie playback [default=yes]], , enable_smpeg=yes) --AC_ARG_ENABLE(speex, --[ --enable-speex enable Speex net mic playback [default=yes]], , enable_speex=yes) --AC_ARG_ENABLE(alsa, --[ --enable-alsa enable ALSA net mic transmission [default=yes]], , enable_alsa=yes) --AC_ARG_ENABLE(zzip, --[ --enable-zzip enable zziplib support [default=yes]], , enable_zzip=yes) --AC_ARG_ENABLE(png, --[ --enable-png enable PNG screenshot support [default=yes]], , enable_png=yes) - --dnl Checks for programs. -+dnl AX_ARG_ENABLE(option, desc) -+AC_DEFUN([AX_ARG_ENABLE], -+ [ desc_$1="$2" -+ AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [do not include $2])) ]) -+dnl AX_ARG_WITH(option) -+AC_DEFUN([AX_ARG_WITH], -+ [ desc_$1="$2" -+ AC_ARG_WITH([$1], AS_HELP_STRING([--without-$1], [do not use $2])) ]) -+ -+AX_ARG_ENABLE([opengl], [OpenGL rendering]) -+AX_ARG_ENABLE([lua], [built-in Lua scripting]) -+ -+AX_ARG_WITH([sdl_image], [SDL_image support]) -+AX_ARG_WITH([ffmpeg], [FFmpeg playback and film export]) -+AX_ARG_WITH([mad], [libmad MP3 playback]) -+AX_ARG_WITH([sndfile], [libsndfile audio decoding]) -+AX_ARG_WITH([vorbis], [libvorbis Ogg/Vorbis music playback]) -+AX_ARG_WITH([smpeg], [SMPEG movie playback]) -+AX_ARG_WITH([speex], [Speex net mic playback]) -+AX_ARG_WITH([alsa], [ALSA net mic transmission]) -+AX_ARG_WITH([zzip], [zziplib support]) -+AX_ARG_WITH([png], [libpng PNG screenshot support]) -+ -+ -+dnl Check for programs. - AC_PROG_CC - AC_PROG_CPP - AC_PROG_CXX - AC_PROG_CXXCPP -+AC_PROG_OBJCXX - AC_PROG_INSTALL - AC_PROG_RANLIB - --dnl some platform specific stuff --case $target in --*-*-mingw32*) -- AC_CHECK_TOOL(WINDRES, windres, :) -- ;; --*-*-netbsd*) -- CPPFLAGS="$CPPFLAGS -I/usr/pkg/include" -- ;; --*) -- ;; --esac -+dnl Some platform specific stuff. -+AS_CASE([$target], -+ [*-*-mingw32*], -+ [ make_windows=true -+ AC_CHECK_TOOL([WINDRES], [windres], [:]) -+ AC_DEFINE([WIN32_DISABLE_MUSIC], [1], [Win32 music disabled]) -+ LIBS="$LIBS -ldsound -lwsock32" ], -+ [*-*-netbsd*], -+ [CPPFLAGS="$CPPFLAGS -I/usr/pkg/include"]) -+AM_CONDITIONAL([MAKE_WINDOWS], [test "x$make_windows" = "xtrue"]) - --dnl Checks for headers. --AC_CHECK_HEADERS(unistd.h) --AC_CHECK_HEADERS(pwd.h) -+dnl Set target system name. -+AC_DEFINE_UNQUOTED([TARGET_PLATFORM], ["$target_os $target_cpu"], [Target platform name]) - --dnl Checks for library functions. --AC_CHECK_FUNC(snprintf, [ -- AC_DEFINE(HAVE_SNPRINTF, 1, [snprintf() is available]) --]) --AC_CHECK_FUNC(vsnprintf, [ -- AC_DEFINE(HAVE_VSNPRINTF, 1, [vsnprintf() is available]) --]) -+dnl Check for headers. -+AC_CHECK_HEADERS([unistd.h pwd.h]) - --AC_CHECK_FUNC(mkstemp, [ -- AC_DEFINE(LUA_USE_MKSTEMP, 1, [mkstemp() is available]) --]) --AC_CHECK_FUNC(sysconf, [ -- AC_DEFINE(HAVE_SYSCONF, 1, [sysconf() is available]) --]) --AC_CHECK_FUNC(sysctlbyname, [ -- AC_DEFINE(HAVE_SYSCTLBYNAME, 1, [sysctlbyname() is available]) --]) -+dnl Check for boost functions. -+AC_LANG_PUSH(C++) -+AC_CHECK_HEADER([boost/bind.hpp], -+ , -+ [AC_MSG_ERROR([You need boost/bind.hpp from the boost library to run Aleph One.])]) -+AC_CHECK_HEADER([boost/function.hpp], -+ , -+ [AC_MSG_ERROR([You need boost/function.hpp from the boost library to run Aleph One.])]) -+AC_LANG_POP(C++) - --dnl Check for SDL. --AM_PATH_SDL(1.2.0, , AC_MSG_ERROR([You need SDL 1.2 to run Aleph One.])) --CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -DSDL" --LIBS="$LIBS $SDL_LIBS" -+dnl Check for library functions. -+AC_CHECK_FUNCS([snprintf vsnprintf sysconf sysctlbyname]) -+AC_CHECK_FUNC([mkstemp], -+ [AC_DEFINE([LUA_USE_MKSTEMP], [1], [mkstemp() available])]) - --dnl Check for SDL_image. --AC_CHECK_HEADERS(SDL_image.h, [ -- AC_CHECK_LIB(SDL_image, IMG_Load, [ -- LIBS="-lSDL_image $LIBS" -- AC_DEFINE(HAVE_SDL_IMAGE, 1, [SDL_image support is enabled]) -- ]) --]) -+dnl Check for net functions. -+AC_SEARCH_LIBS([gethostbyname], [nsl]) -+AC_SEARCH_LIBS([socket], [socket], -+ , -+ [AC_CHECK_LIB([nsl], [socket], -+ [ LIBS="$LIBS -lsocket -lnsl" ], -+ , -+ [-lsocket])]) - --AC_CHECK_HEADERS(SDL_ttf.h, [ -- AC_CHECK_LIB(SDL_ttf, TTF_Init, [ -- LIBS="-lSDL_ttf $LIBS" -- AC_DEFINE(HAVE_SDL_TTF, 1, [SDL_TTF support is enabled]) -- ])], -- AC_MSG_ERROR([You need SDL_ttf to run Aleph One.]) --) -+dnl Check for libraries. - --dnl Check for SDL_net. --AC_CHECK_HEADERS(SDL_net.h, [ -- AC_CHECK_LIB(SDL_net, SDLNet_Init, [ -- LIBS="-lSDL_net $LIBS" -- AC_DEFINE(HAVE_SDL_NET, 1, [SDL_net support is enabled]) -- ]) --]) --if [[ "x$ac_cv_lib_SDL_net_SDLNet_Init" != xyes ]]; then -- AC_MSG_ERROR([You need SDL_net to run Aleph One.]) --fi --AM_CONDITIONAL(HAVE_SDL_NET, test x$ac_cv_lib_SDL_net_SDLNet_Init = xyes) -+dnl AX_REQUIRE_LIB(desc, define, header, lib, func) -+AC_DEFUN([AX_REQUIRE_LIB], -+ [ AC_CHECK_HEADERS([$3], [AC_CHECK_LIB([$4], [$5])]) -+ AS_IF([test "x${ac_cv_lib_$4_$5}" = "xyes"], -+ [AC_DEFINE([HAVE_$2], [1], [$1 support enabled])], -+ [AC_MSG_ERROR([You need $1 to run Aleph One.])]) ]) - --AC_SEARCH_LIBS(gethostbyname, nsl) --AC_SEARCH_LIBS(socket, socket, , -- [AC_CHECK_LIB(nsl, socket, LIBS="$LIBS -lsocket -lnsl", , -lsocket)]) -+dnl Check for required SDL dependencies. -+AM_PATH_SDL(1.2.0, , AC_MSG_ERROR([You need SDL 1.2 to run Aleph One.])) -+CPPFLAGS="$CPPFLAGS $SDL_CFLAGS -DSDL" -+LIBS="$LIBS $SDL_LIBS" - -+AX_REQUIRE_LIB([SDL_ttf], [SDL_TTF], -+ [SDL_ttf.h], [SDL_ttf], [TTF_Init]) -+AX_REQUIRE_LIB([SDL_net], [SDL_NET], -+ [SDL_net.h], [SDL_net], [SDLNet_Init]) - --dnl Check for zlib --AC_CHECK_HEADER(zlib.h, , AC_ERROR([Aleph One requires zlib])) --AC_CHECK_LIB(z, zlibVersion, LIBS="-lz $LIBS", AC_ERROR([Aleph One requires zlib])) -+dnl Check for zlib. -+AX_REQUIRE_LIB([zlib], [ZLIB], -+ [zlib.h], [z], [zlibVersion]) - --dnl Check for zziplib --have_zzip=false --if [[ "x$enable_zzip" = "xyes" ]]; then --PKG_CHECK_MODULES([ZZIP], [zziplib >= 0.10.75], [ -- CPPFLAGS="$ZZIP_CFLAGS $CPPFLAGS" -- LIBS="$ZZIP_LIBS $LIBS" -- have_zzip=true -- AC_DEFINE(HAVE_ZZIP, 1, [ZZIP support enabled]) --]) --fi --AM_CONDITIONAL(BUILD_ZZIP_RWOPS, test x$have_zzip = xtrue) -+dnl Check for OpenGL. -+AS_IF([test "x$enable_opengl" != "xno"], -+ [ AC_MSG_CHECKING([for OpenGL support]) -+ compiled_opengl=no -+ AS_CASE([$target], -+ [*-*-cygwin* | *-*-mingw32*], -+ [ SYS_GL_LIBS="-lGLEW -lopengl32 -lglu32" -+ LIBS="$LIBS -lstdc++" ], -+ [*-*-darwin*], -+ [ SYS_GL_LIBS="-F/System/Library/Frameworks -framework AGL -framework OpenGL" -+ CPPFLAGS="$CPPFLAGS -D__DARWIN__ -F/System/Library/Frameworks -I/System/Library/Frameworks/OpenGL.framework/Headers" ], -+ [*-*-linux*], -+ [ SYS_GL_LIBS="-lGL -lpthread" ], -+ [ SYS_GL_LIBS="-lGL" ]) -+ AC_TRY_COMPILE([ -+ #ifndef __DARWIN__ -+ #include -+ #else -+ #include -+ #endif -+ ], -+ , -+ [ compiled_opengl=yes ]) -+ AC_MSG_RESULT($compiled_opengl) -+ AS_IF([test "x$compiled_opengl" = "xyes"], -+ [ have_opengl=true -+ AC_DEFINE([HAVE_OPENGL], [1], [OpenGL support enabled]) -+ AC_CHECK_LIB([GLU], [gluScaleImage], -+ [SYS_GL_LIBS="$SYS_GL_LIBS -lGLU"], -+ , -+ [$SYS_GL_LIBS]) -+ LIBS="$LIBS $SYS_GL_LIBS" -+ AC_CHECK_HEADERS([GL/glext.h], [], [], [#include ]) ], -+ [ AS_IF([test "x$enable_opengl" = "xyes"], -+ [AC_MSG_ERROR([OpenGL support requested but not available])], -+ [AC_MSG_WARN([OpenGL not available])]) ]) ]) -+AM_CONDITIONAL([MAKE_OPENGL], [test "x$have_opengl" = "xtrue" ]) - --have_png=false --if [[ "x$enable_png" = "xyes" ]]; then --PKG_CHECK_MODULES([PNG], [libpng], [ -- CPPFLAGS="$PNG_CFLAGS $CPPFLAGS" -- LIBS="$PNG_LIBS $LIBS" -- have_png=true -- AC_DEFINE(HAVE_PNG, 1, [PNG support enabled])] --) --fi --AM_CONDITIONAL(HAVE_PNG, test x$have_png = xtrue) -+dnl Enable Lua. -+AS_IF([test "x$enable_lua" != "xno"], -+ [ have_lua=true -+ AC_DEFINE([HAVE_LUA], [1], [Lua support enabled]) ]) - --dnl Check for boost/bind --AC_LANG_PUSH(C++) --AC_CHECK_HEADER([boost/bind.hpp], , [AC_MSG_ERROR([You need boost/bind.hpp from the boost library to run Aleph One])]) --AC_LANG_POP(C++) - --dnl Check for boost/function --AC_LANG_PUSH(C++) --AC_CHECK_HEADER([boost/function.hpp], , [AC_MSG_ERROR([You need boost/function.hpp from the boost library to run Aleph One])]) --AC_LANG_POP(C++) -+dnl Check optional packages. - --if [[ "x$enable_smpeg" = "xyes" ]]; then --dnl Check for SMPEG --AC_CHECK_HEADERS([smpeg/smpeg.h], [ -- AC_CHECK_LIB(smpeg, SMPEG_new, [ -- LIBS="-lsmpeg $LIBS" -- AC_DEFINE(HAVE_SMPEG, 1, [SMPEG movie playback is enabled]) -- ]) --]) --fi -+dnl AX_CHECK_FEATURE_LIB(option, define, header, lib, func) -+AC_DEFUN([AX_CHECK_FEATURE_LIB], -+ [ AS_IF([test "x${with_$1}" != "xno"], -+ [ AC_CHECK_HEADERS([$3], [AC_CHECK_LIB([$4], [$5])]) -+ AS_IF([test "x${ac_cv_lib_$4_$5}" = "xyes"], -+ [ have_$1=true -+ AC_DEFINE([HAVE_$2], [1], [${desc_$1} enabled]) ], -+ [AS_IF([test "x${with_$1}" = "xyes"], -+ [AC_MSG_ERROR([${desc_$1} requested but not found])])]) -+ ]) ]) -+dnl AX_CHECK_FEATURE_PKG(option, define, package, lib) -+AC_DEFUN([AX_CHECK_FEATURE_PKG], -+ [ AS_IF([test "x${with_$1}" != "xno"], -+ [ PKG_CHECK_MODULES([$3], [$4], -+ [ CPPFLAGS="${[$3]_CFLAGS} $CPPFLAGS" -+ LIBS="${[$3]_LIBS} $LIBS" -+ have_$1=true -+ AC_DEFINE([HAVE_$2], [1], [${desc_$1} enabled]) ], -+ [AS_IF([test "x${with_$1}" = "xyes"], -+ [AC_MSG_ERROR([${desc_$1} requested but not available])])]) -+ -+ ]) -+ AM_CONDITIONAL([HAVE_$2], [test "x${have_$1}" = "xtrue"]) -+ ]) - --if [[ "x$enable_mad" = "xyes" ]]; then --dnl Check for libmad --AC_CHECK_HEADERS([mad.h], [ -- AC_CHECK_LIB(mad, mad_stream_init, [ -- LIBS="-lmad $LIBS" -- AC_DEFINE(HAVE_MAD, 1, [MAD mp3 playback is enabled]) --]) --]) --fi -+AX_CHECK_FEATURE_LIB([sdl_image], [SDL_IMAGE], -+ [SDL_image.h], [SDL_image], [IMG_Load]) - --if [[ "x$enable_sndfile" = "xyes" ]]; then --dnl Check for libsndfile --AC_CHECK_HEADERS([sndfile.h], [ -- AC_CHECK_LIB(sndfile, sf_open, [ -- LIBS="-lsndfile $LIBS" -- AC_DEFINE(HAVE_SNDFILE, 1, [libsndfile support is enabled]) --]) --]) --fi -+AX_CHECK_FEATURE_PKG([ffmpeg], [FFMPEG], -+ [FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.1]) - --if [[ "x$enable_vorbis" = "xyes" ]]; then --dnl Check for vorbisfile --PKG_CHECK_MODULES([VORBISFILE], [vorbisfile], [ -- CPPFLAGS="$VORBISFILE_CFLAGS $CPPFLAGS" -- LIBS="$VORBISFILE_LIBS $LIBS" -- AC_DEFINE(HAVE_VORBISFILE, 1, [vorbis support enabled]) --]) --fi -+AX_CHECK_FEATURE_LIB([mad], [MAD], -+ [mad.h], [mad], [mad_stream_init]) - --if [[ "x$enable_ffmpeg" = "xyes" ]]; then --dnl Check for libavcodec --PKG_CHECK_MODULES([FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.100], [ -- CPPFLAGS="$FFMPEG_CFLAGS $CPPFLAGS" -- LIBS="$FFMPEG_LIBS $LIBS" -- AC_DEFINE(HAVE_FFMPEG, 1, [ffmpeg support enabled]) -- have_ffmpeg=true --]) --fi --AM_CONDITIONAL(HAVE_FFMPEG, test x$have_ffmpeg = xtrue) -+AX_CHECK_FEATURE_LIB([sndfile], [SNDFILE], -+ [sndfile.h], [sndfile], [sf_open]) - --if [[ "x$enable_lua" = "xyes" ]]; then --AC_DEFINE(HAVE_LUA, 1, [Lua support is enabled]) --fi -+AX_CHECK_FEATURE_PKG([vorbis], [VORBISFILE], -+ [VORBISFILE], [vorbisfile]) - --if [[ "x$enable_speex" = "xyes" ]]; then --dnl Check for Speex --AC_CHECK_HEADERS(speex/speex.h, [ -- AC_CHECK_LIB(speex, speex_decoder_init, [ -- LIBS="-lspeex $LIBS" -- AC_DEFINE(SPEEX, 1, [Speex support is enabled]) -- ]) -- AC_CHECK_LIB(speexdsp, speex_preprocess_state_init, [ -- LIBS="-lspeexdsp $LIBS" --]) --]) --fi -+AX_CHECK_FEATURE_LIB([smpeg], [SMPEG], -+ [smpeg/smpeg.h], [smpeg], [SMPEG_new]) - --if [[ "x$enable_alsa" = "xyes" ]]; then --dnl Check for ALSA --AC_CHECK_HEADERS([alsa/asoundlib.h], [ -- AC_CHECK_LIB(asound, snd_pcm_open, [ -- LIBS="-lasound $LIBS" -- AC_DEFINE(HAVE_ALSA, 1, [ALSA netmic is enabled]) -- ]) --]) --fi -+AX_CHECK_FEATURE_LIB([speex], [SPEEX], -+ [speex/speex.h], [speex], [speex_decoder_init]) -+AS_IF([test "x$have_speex" = "xyes"], -+ [AC_CHECK_LIB([speexdsp], [speex_preprocess_state_init])]) - --dnl Figure out which OpenGL library to use --case "$target" in -- *-*-cygwin* | *-*-mingw32*) -- SYS_GL_LIBS="-lGLEW -lopengl32 -lglu32" -- LIBS="$LIBS -lstdc++" -- ;; -- *-*-darwin*) -- SYS_GL_LIBS="-F/System/Library/Frameworks -framework AGL -framework OpenGL" -- CPPFLAGS="$CPPFLAGS -D__DARWIN__ -F/System/Library/Frameworks -I/System/Library/Frameworks/OpenGL.framework/Headers" -- ;; -- *-*-linux*) -- SYS_GL_LIBS="-lGL -lpthread" -- ;; -- *) -- SYS_GL_LIBS="-lGL" -- ;; --esac -+AX_CHECK_FEATURE_LIB([alsa], [ALSA], -+ [alsa/asoundlib.h], [asound], [snd_pcm_open]) - --dnl Check for OpenGL. --if [[ "x$enable_opengl" = "xyes" ]]; then -- AC_MSG_CHECKING(for OpenGL support) -- have_opengl=no -- AC_TRY_COMPILE([ -- #ifndef __DARWIN__ -- #include -- #else -- #include -- #endif -- ],[ -- ],[ -- have_opengl=yes -- ]) -- AC_MSG_RESULT($have_opengl) -- if test x$have_opengl = xyes; then -- AC_DEFINE(HAVE_OPENGL, 1, [OpenGL support is enabled]) -- AC_CHECK_LIB(GLU, gluScaleImage, [SYS_GL_LIBS="$SYS_GL_LIBS -lGLU"], , $SYS_GL_LIBS) -- LIBS="$LIBS $SYS_GL_LIBS" -- AC_CHECK_HEADERS(GL/glext.h, [], [], [#include ]) -- make_opengl=true -- else -- AC_MSG_WARN([Could not find OpenGL, ignoring --enable-opengl.]) -- make_opengl=false -- fi --fi --AM_CONDITIONAL(MAKE_OPENGL, test x$make_opengl = xtrue) -+AX_CHECK_FEATURE_PKG([zzip], [ZZIP], -+ [ZZIP], [zziplib >= 0.10.75]) -+AM_CONDITIONAL([BUILD_ZZIP_RWOPS], [test "x$have_zzip" = "xtrue"]) - --dnl Set target system name. --AC_DEFINE_UNQUOTED(TARGET_PLATFORM, "$target_os $target_cpu", [Target platform name]) -+AX_CHECK_FEATURE_PKG([png], [PNG], -+ [PNG], [libpng]) - --dnl add some windows goodies --case $target in --*-*-mingw32*) -- make_windows=true -- AC_DEFINE(WIN32_DISABLE_MUSIC, 1, [Win32 music is disabled]) -- LIBS="$LIBS -ldsound -lwsock32" -- ;; --*) -- make_windows=false ;; --esac --AM_CONDITIONAL(MAKE_WINDOWS, test x$make_windows = xtrue) - -- - dnl Generate Makefiles. - AC_CONFIG_FILES([ - Makefile -@@ -321,5 +249,32 @@ - ]) - AC_OUTPUT - --dnl Print summary. --echo "Configuration done. Now type \"make\"." -+dnl Print summary of enabled/disabled options. -+ -+dnl AX_PRINT_SUMMARY(option) -+AC_DEFUN([AX_PRINT_SUMMARY], -+ [ AS_IF([test "x${have_$1}" = "xtrue"], -+ [AS_ECHO([" Enabled: ${desc_$1}"])], -+ [test "x${enable_$1}" = "xno" || -+ test "x${with_$1}" = "xno"], -+ [AS_ECHO([" Disabled: ${desc_$1}"])], -+ [AS_ECHO([" Not found: ${desc_$1}"])]) -+ ]) -+ -+AS_ECHO([""]) -+AS_ECHO(["Summary of optional features:"]) -+AS_ECHO([""]) -+AX_PRINT_SUMMARY([opengl]) -+AX_PRINT_SUMMARY([lua]) -+AX_PRINT_SUMMARY([sdl_image]) -+AX_PRINT_SUMMARY([ffmpeg]) -+AX_PRINT_SUMMARY([mad]) -+AX_PRINT_SUMMARY([sndfile]) -+AX_PRINT_SUMMARY([vorbis]) -+AX_PRINT_SUMMARY([smpeg]) -+AX_PRINT_SUMMARY([speex]) -+AX_PRINT_SUMMARY([alsa]) -+AX_PRINT_SUMMARY([zzip]) -+AX_PRINT_SUMMARY([png]) -+AS_ECHO([""]) -+AS_ECHO(["Configuration done. Now type \"make\"."]) diff --git a/games/alephone/r5037.diff b/games/alephone/r5037.diff deleted file mode 100644 index 852d75245e..0000000000 --- a/games/alephone/r5037.diff +++ /dev/null @@ -1,193 +0,0 @@ -Index: Source_Files/FFmpeg/Movie.cpp -=================================================================== ---- Source_Files/FFmpeg/Movie.cpp (revision 5036) -+++ Source_Files/FFmpeg/Movie.cpp (revision 5037) -@@ -138,6 +138,9 @@ - AVFormatContext *fmt_ctx; - int video_stream_idx; - int audio_stream_idx; -+ -+ size_t video_counter; -+ size_t audio_counter; - }; - typedef struct libav_vars libav_vars_t; - -@@ -495,6 +498,7 @@ - audio_stream->codec->codec_id = audio_codec->id; - audio_stream->codec->codec_type = AVMEDIA_TYPE_AUDIO; - audio_stream->codec->sample_rate = mx->obtained.freq; -+ audio_stream->codec->time_base = (AVRational){1, mx->obtained.freq}; - audio_stream->codec->channels = 2; - - if (av->fmt_ctx->oformat->flags & AVFMT_GLOBALHEADER) -@@ -507,19 +511,8 @@ - audio_stream->codec->global_quality = FF_QP2LAMBDA * (aq / 10); - audio_stream->codec->flags |= CODEC_FLAG_QSCALE; - -- // find correct sample format -- audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_S16; -+ audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_FLTP; - success = (0 <= avcodec_open2(audio_stream->codec, audio_codec, NULL)); -- if (!success) -- { -- audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_FLT; -- success = (0 <= avcodec_open2(audio_stream->codec, audio_codec, NULL)); -- } -- if (!success) -- { -- audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_FLTP; -- success = (0 <= avcodec_open2(audio_stream->codec, audio_codec, NULL)); -- } - if (!success) err_msg = "Could not open audio codec"; - } - if (success) -@@ -568,6 +561,7 @@ - if (success) - { - video_stream->time_base = (AVRational){1, TICKS_PER_SECOND}; -+ audio_stream->time_base = (AVRational){1, mx->obtained.freq}; - avformat_write_header(av->fmt_ctx, NULL); - } - -@@ -625,7 +619,7 @@ - - sws_scale(av->sws_ctx, pdata, pitch, 0, temp_surface->h, - av->video_frame->data, av->video_frame->linesize); -- av->video_frame->pts = vcodec->frame_number; -+ av->video_frame->pts = av->video_counter++; - frame = av->video_frame; - } - -@@ -638,33 +632,22 @@ - pkt.data = av->video_buf; - pkt.size = av->video_bufsize; - --#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54,0,0) -- int vsize = avcodec_encode_video(vcodec, av->video_buf, av->video_bufsize, frame); -- if (vsize > 0) -- { -- if (vcodec->coded_frame->pts != AV_NOPTS_VALUE) -- { -- pkt.pts = av_rescale_q(vcodec->coded_frame->pts, -- vcodec->time_base, -- vstream->time_base); -- } -- if (vcodec->coded_frame->key_frame) -- pkt.flags |= AV_PKT_FLAG_KEY; -- pkt.size = vsize; -- } -- --#else - int got_packet = 0; - int vsize = avcodec_encode_video2(vcodec, &pkt, frame, &got_packet); --#endif -- if (vsize > 0) -+ if (vsize == 0 && got_packet) - { -+ if (pkt.pts != AV_NOPTS_VALUE && pkt.pts < pkt.dts) -+ pkt.pts = pkt.dts; -+ if (pkt.pts != AV_NOPTS_VALUE) -+ pkt.pts = av_rescale_q(pkt.pts, vcodec->time_base, vstream->time_base); -+ if (pkt.dts != AV_NOPTS_VALUE) -+ pkt.dts = av_rescale_q(pkt.dts, vcodec->time_base, vstream->time_base); -+ pkt.duration = av_rescale_q(pkt.duration, vcodec->time_base, vstream->time_base); - pkt.stream_index = vstream->index; - av_interleaved_write_frame(av->fmt_ctx, &pkt); -+ av_free_packet(&pkt); - } -- av_free_packet(&pkt); -- -- if (!last || vsize <= 0) -+ if (!last || vsize < 0 || !got_packet) - done = true; - } - } -@@ -712,6 +695,10 @@ - av_frame_unref(av->audio_frame); - #endif - av->audio_frame->nb_samples = write_samples; -+ av->audio_frame->pts = av_rescale_q(av->audio_counter, -+ (AVRational){1, acodec->sample_rate}, -+ acodec->time_base); -+ av->audio_counter += write_samples; - int asize = avcodec_fill_audio_frame(av->audio_frame, acodec->channels, - acodec->sample_fmt, - av->audio_data_conv, -@@ -726,24 +713,57 @@ - if (0 == avcodec_encode_audio2(acodec, &pkt, av->audio_frame, &got_pkt) - && got_pkt) - { -- if (acodec->coded_frame && acodec->coded_frame->pts != AV_NOPTS_VALUE) -- { -- pkt.pts = av_rescale_q(acodec->coded_frame->pts, -- acodec->time_base, -- astream->time_base); -- } -+ if (pkt.pts != AV_NOPTS_VALUE && pkt.pts < pkt.dts) -+ pkt.pts = pkt.dts; -+ if (pkt.pts != AV_NOPTS_VALUE) -+ pkt.pts = av_rescale_q(pkt.pts, acodec->time_base, astream->time_base); -+ if (pkt.dts != AV_NOPTS_VALUE) -+ pkt.dts = av_rescale_q(pkt.dts, acodec->time_base, astream->time_base); -+ pkt.duration = av_rescale_q(pkt.duration, acodec->time_base, astream->time_base); - pkt.stream_index = astream->index; -- pkt.flags |= AV_PKT_FLAG_KEY; - av_interleaved_write_frame(av->fmt_ctx, &pkt); - av_free_packet(&pkt); - } - } - } -+ if (last) -+ { -+ bool done = false; -+ while (!done) -+ { -+ AVPacket pkt; -+ memset(&pkt, 0, sizeof(AVPacket)); -+ av_init_packet(&pkt); -+ -+ int got_pkt = 0; -+ if (0 == avcodec_encode_audio2(acodec, &pkt, NULL, &got_pkt) -+ && got_pkt) -+ { -+ if (pkt.pts != AV_NOPTS_VALUE && pkt.pts < pkt.dts) -+ pkt.pts = pkt.dts; -+ if (pkt.pts != AV_NOPTS_VALUE) -+ pkt.pts = av_rescale_q(pkt.pts, acodec->time_base, astream->time_base); -+ if (pkt.dts != AV_NOPTS_VALUE) -+ pkt.dts = av_rescale_q(pkt.dts, acodec->time_base, astream->time_base); -+ pkt.duration = av_rescale_q(pkt.duration, acodec->time_base, astream->time_base); -+ pkt.stream_index = astream->index; -+ av_interleaved_write_frame(av->fmt_ctx, &pkt); -+ av_free_packet(&pkt); -+ } -+ else -+ { -+ done = true; -+ } -+ } -+ -+ } - - } - - void Movie::EncodeThread() - { -+ av->video_counter = 0; -+ av->audio_counter = 0; - while (true) - { - SDL_SemWait(encodeReady); -Index: configure.ac -=================================================================== ---- configure.ac (revision 5036) -+++ configure.ac (revision 5037) -@@ -191,7 +191,7 @@ - [SDL_image.h], [SDL_image], [IMG_Load]) - - AX_CHECK_FEATURE_PKG([ffmpeg], [FFMPEG], -- [FFMPEG], [libavcodec >= 53.61.100 libavformat >= 53.32.100 libavutil >= 51.35.100 libswscale >= 2.1.1]) -+ [FFMPEG], [libavcodec >= 54.35.0 libavformat >= 54.20.0 libavutil >= 52.3.0 libswscale >= 2.1.1]) - - AX_CHECK_FEATURE_LIB([mad], [MAD], - [mad.h], [mad], [mad_stream_init]) -- cgit v1.2.3