diff options
author | Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> | 2013-11-23 13:52:37 +0000 |
---|---|---|
committer | Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> | 2013-11-23 13:52:37 +0000 |
commit | 9378b236230b98f54bef5f4c8f9f3eed563a37ce (patch) | |
tree | 8c99ce001e850d7f7db9f8dbacbd9d1e8897920a /www-plugins/lightspark | |
parent | Revision bump to propagate the change to the udev rule. (diff) | |
download | gentoo-2-9378b236230b98f54bef5f4c8f9f3eed563a37ce.tar.gz gentoo-2-9378b236230b98f54bef5f4c8f9f3eed563a37ce.tar.bz2 gentoo-2-9378b236230b98f54bef5f4c8f9f3eed563a37ce.zip |
Add ffmpeg-2 support, bug #492336.
(Portage version: 2.2.7/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'www-plugins/lightspark')
-rw-r--r-- | www-plugins/lightspark/ChangeLog | 6 | ||||
-rw-r--r-- | www-plugins/lightspark/files/lightspark-0.7.2-ffmpeg20.patch | 155 | ||||
-rw-r--r-- | www-plugins/lightspark/lightspark-0.7.2-r1.ebuild | 3 |
3 files changed, 162 insertions, 2 deletions
diff --git a/www-plugins/lightspark/ChangeLog b/www-plugins/lightspark/ChangeLog index c803ad10a7eb..b221af5793e3 100644 --- a/www-plugins/lightspark/ChangeLog +++ b/www-plugins/lightspark/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for www-plugins/lightspark # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/www-plugins/lightspark/ChangeLog,v 1.53 2013/10/04 23:53:41 chithanh Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-plugins/lightspark/ChangeLog,v 1.54 2013/11/23 13:52:37 chithanh Exp $ + + 23 Nov 2013; Chí-Thanh Christopher Nguyễn <chithanh@gentoo.org> + +files/lightspark-0.7.2-ffmpeg20.patch, lightspark-0.7.2-r1.ebuild: + Add ffmpeg-2 support, bug #492336. *lightspark-0.7.2-r1 (04 Oct 2013) diff --git a/www-plugins/lightspark/files/lightspark-0.7.2-ffmpeg20.patch b/www-plugins/lightspark/files/lightspark-0.7.2-ffmpeg20.patch new file mode 100644 index 000000000000..c0a1f5f3610c --- /dev/null +++ b/www-plugins/lightspark/files/lightspark-0.7.2-ffmpeg20.patch @@ -0,0 +1,155 @@ +From fff7e63650c1569908bf80f11a123e051e993f31 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ludger=20Kr=C3=A4mer?= <dbluelle@blau-weissoedingen.de> +Date: Fri, 16 Aug 2013 20:30:28 +0200 +Subject: [PATCH] fix compilation with ffmpeg 2.0 avcodec_decode_audio4 seems + not to deliver data in AV_SAMPLE_FMT_S16 format, so we have to use + libavresample for resampling + +--- + CMakeLists.txt | 2 +- + conf/FindFFMpeg.cmake | 6 ++++- + src/backends/decoder.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++------ + src/backends/decoder.h | 8 ++++++ + 4 files changed, 70 insertions(+), 10 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 33dbb85..d3a964b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -286,7 +286,7 @@ IF(AUDIO_BACKEND) + ENDIF(AUDIO_BACKEND) + + IF(ENABLE_LIBAVCODEC) +- pkg_check_modules(FFMPEG libavcodec libavutil libavformat) ++ pkg_check_modules(FFMPEG libavcodec libavutil libavformat libavresample) + IF(NOT(FFMPEG_FOUND)) + INCLUDE(FindFFMpeg REQUIRED) + ENDIF(NOT(FFMPEG_FOUND)) +diff --git a/conf/FindFFMpeg.cmake b/conf/FindFFMpeg.cmake +index 2b4dd98..8246c15 100644 +--- a/conf/FindFFMpeg.cmake ++++ b/conf/FindFFMpeg.cmake +@@ -23,7 +23,11 @@ FIND_LIBRARY(FFMPEG_AVFORMAT_LIBRARY NAMES + avformat + ) + +-SET(FFMPEG_LIBRARY ${FFMPEG_AVCODEC_LIBRARY} ${FFMPEG_AVUTIL_LIBRARY} ${FFMPEG_AVFORMAT_LIBRARY}) ++FIND_LIBRARY(FFMPEG_AVRESAMPLE_LIBRARY NAMES ++ avresample ++) ++ ++SET(FFMPEG_LIBRARY ${FFMPEG_AVCODEC_LIBRARY} ${FFMPEG_AVUTIL_LIBRARY} ${FFMPEG_AVFORMAT_LIBRARY} ${FFMPEG_AVRESAMPLE_LIBRARY}) + MARK_AS_ADVANCED(FFMPEG_LIBRARY) + + # handle the QUIETLY and REQUIRED arguments and set FFMPEG_FOUND to TRUE if +diff --git a/src/backends/decoder.cpp b/src/backends/decoder.cpp +index 22eac2e..4b3148c 100755 +--- a/src/backends/decoder.cpp ++++ b/src/backends/decoder.cpp +@@ -295,6 +295,8 @@ bool FFMpegVideoDecoder::decodePacket(AVPacket* pkt, uint32_t time) + #else + int ret=avcodec_decode_video(codecContext, frameIn, &frameOk, pkt->data, pkt->size); + #endif ++ if (ret < 0) ++ return false; + + assert_and_throw(ret==(int)pkt->size); + if(frameOk) +@@ -612,10 +614,33 @@ uint32_t FFMpegAudioDecoder::decodeData(uint8_t* data, int32_t datalen, uint32_t + ret=-1; + else + { +- //This is suboptimal but equivalent to what libavcodec +- //does for the compatibility version of avcodec_decode_audio3 +- memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); +- maxLen=frameIn->linesize[0]; ++ if (frameIn->format != AV_SAMPLE_FMT_S16) ++ { ++ AVAudioResampleContext * avr = avresample_alloc_context(); ++ av_opt_set_int(avr, "in_channel_layout", frameIn->channel_layout, 0); ++ av_opt_set_int(avr, "out_channel_layout", frameIn->channel_layout, 0); ++ av_opt_set_int(avr, "in_sample_rate", frameIn->sample_rate, 0); ++ av_opt_set_int(avr, "out_sample_rate", frameIn->sample_rate, 0); ++ av_opt_set_int(avr, "in_sample_fmt", frameIn->format, 0); ++ av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); ++ avresample_open(avr); ++ ++ uint8_t *output; ++ int out_linesize; ++ int out_samples = avresample_available(avr) + av_rescale_rnd(avresample_get_delay(avr) + frameIn->linesize[0], frameIn->sample_rate, frameIn->sample_rate, AV_ROUND_UP); ++ av_samples_alloc(&output, &out_linesize, frameIn->nb_samples, out_samples, AV_SAMPLE_FMT_S16, 0); ++ maxLen = avresample_convert(avr, &output, out_linesize, out_samples, frameIn->extended_data, frameIn->linesize[0], frameIn->nb_samples)*4; ++ memcpy(curTail.samples, output, maxLen); ++ av_freep(&output); ++ avresample_free(&avr); ++ } ++ else ++ { ++ //This is suboptimal but equivalent to what libavcodec ++ //does for the compatibility version of avcodec_decode_audio3 ++ memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); ++ maxLen=frameIn->linesize[0]; ++ } + } + #else + int32_t ret=avcodec_decode_audio3(codecContext, curTail.samples, &maxLen, &pkt); +@@ -660,10 +685,33 @@ uint32_t FFMpegAudioDecoder::decodePacket(AVPacket* pkt, uint32_t time) + ret=-1; + else + { +- //This is suboptimal but equivalent to what libavcodec +- //does for the compatibility version of avcodec_decode_audio3 +- memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); +- maxLen=frameIn->linesize[0]; ++ if (frameIn->format != AV_SAMPLE_FMT_S16) ++ { ++ AVAudioResampleContext * avr = avresample_alloc_context(); ++ av_opt_set_int(avr, "in_channel_layout", frameIn->channel_layout, 0); ++ av_opt_set_int(avr, "out_channel_layout", frameIn->channel_layout, 0); ++ av_opt_set_int(avr, "in_sample_rate", frameIn->sample_rate, 0); ++ av_opt_set_int(avr, "out_sample_rate", frameIn->sample_rate, 0); ++ av_opt_set_int(avr, "in_sample_fmt", frameIn->format, 0); ++ av_opt_set_int(avr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0); ++ avresample_open(avr); ++ ++ uint8_t *output; ++ int out_linesize; ++ int out_samples = avresample_available(avr) + av_rescale_rnd(avresample_get_delay(avr) + frameIn->linesize[0], frameIn->sample_rate, frameIn->sample_rate, AV_ROUND_UP); ++ av_samples_alloc(&output, &out_linesize, frameIn->nb_samples, out_samples, AV_SAMPLE_FMT_S16, 0); ++ maxLen = avresample_convert(avr, &output, out_linesize, out_samples, frameIn->extended_data, frameIn->linesize[0], frameIn->nb_samples)*4; ++ memcpy(curTail.samples, output, maxLen); ++ av_freep(&output); ++ avresample_free(&avr); ++ } ++ else ++ { ++ //This is suboptimal but equivalent to what libavcodec ++ //does for the compatibility version of avcodec_decode_audio3 ++ memcpy(curTail.samples, frameIn->extended_data[0], frameIn->linesize[0]); ++ maxLen=frameIn->linesize[0]; ++ } + } + #elif HAVE_AVCODEC_DECODE_AUDIO3 + int ret=avcodec_decode_audio3(codecContext, curTail.samples, &maxLen, pkt); +diff --git a/src/backends/decoder.h b/src/backends/decoder.h +index 93950ad..28bd232 100644 +--- a/src/backends/decoder.h ++++ b/src/backends/decoder.h +@@ -28,6 +28,14 @@ + { + #include <libavcodec/avcodec.h> + #include <libavformat/avformat.h> ++#include <libavresample/avresample.h> ++#include <libavutil/opt.h> ++#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE ++#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio ++#endif ++#ifndef CodecID ++#define CodecID AVCodecID ++#endif + #define MAX_AUDIO_FRAME_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE + } + #else +-- +1.8.4 + diff --git a/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild b/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild index ad693d192ee7..bdd939568dd8 100644 --- a/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild +++ b/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild,v 1.1 2013/10/04 23:53:41 chithanh Exp $ +# $Header: /var/cvsroot/gentoo-x86/www-plugins/lightspark/lightspark-0.7.2-r1.ebuild,v 1.2 2013/11/23 13:52:37 chithanh Exp $ EAPI=4 inherit cmake-utils nsplugins multilib toolchain-funcs @@ -55,6 +55,7 @@ S=${WORKDIR}/${P/_rc*/} PATCHES=( "${FILESDIR}/${P}-llvm33.patch" + "${FILESDIR}/${P}-ffmpeg20.patch" ) pkg_pretend() { if [[ ${MERGE_TYPE} != binary ]]; then |