Skip to content

Commit

Permalink
forceably remove ubuntu patch as the revert seems to have not worked …
Browse files Browse the repository at this point in the history
…correctly.
  • Loading branch information
Rob Savoye committed Sep 19, 2011
1 parent 3d9edb9 commit 426c9de
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 214 deletions.
47 changes: 25 additions & 22 deletions libmedia/ffmpeg/AudioDecoderFfmpeg.cpp
Expand Up @@ -30,9 +30,9 @@
//#define GNASH_DEBUG_AUDIO_DECODING

#if LIBAVCODEC_VERSION_MAJOR >= 53
# define AVCODEC_DECODE_AUDIO avcodec_decode_audio3
#define AVCODEC_DECODE_AUDIO avcodec_decode_audio3
#else
# define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
#define AVCODEC_DECODE_AUDIO avcodec_decode_audio2
#endif

namespace gnash {
Expand Down Expand Up @@ -504,22 +504,21 @@ AudioDecoderFfmpeg::decodeFrame(const boost::uint8_t* input,
#endif

// older ffmpeg versions didn't accept a const input..
#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53
int tmp = avcodec_decode_audio2(_audioCodecCtx, outPtr, &outSize,
input, inputSize);
#if LIBAVCODEC_VERSION_MAJOR >= 53
AVPacket pkt;
av_init_packet(&pkt);
pkt.data = (uint8_t*) input;
pkt.size = inputSize;
#endif
int tmp = AVCODEC_DECODE_AUDIO(_audioCodecCtx, outPtr, &outSize,
#if LIBAVCODEC_VERSION_MAJOR >= 53
&pkt);
#else
AVPacket packet;
av_init_packet(&packet);
// avcodec_decode_audio3 doesn't actually change packet.data
packet.data = const_cast<boost::uint8_t*>(input);
packet.size = inputSize;
int tmp = avcodec_decode_audio3(_audioCodecCtx, outPtr, &outSize, &packet);
packet.data = NULL;
av_free_packet(&packet);
input, inputSize);
#endif

#ifdef GNASH_DEBUG_AUDIO_DECODING
log_debug(" avcodec_decode_audio[23](ctx, bufptr, %d, input, %d) "
log_debug(" avcodec_decode_audio[2](ctx, bufptr, %d, input, %d) "
"returned %d; set frame_size=%d",
bufsize, inputSize, tmp, outSize);
#endif
Expand Down Expand Up @@ -622,22 +621,26 @@ AudioDecoderFfmpeg::parseInput(const boost::uint8_t* input,
boost::uint32_t inputSize,
boost::uint8_t const ** outFrame, int* outFrameSize)
{
if ( _needsParsing ) {
#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 53
return av_parser_parse(_parser, _audioCodecCtx,
reinterpret_cast<boost::uint8_t**>(outFrameSize),
outFrameSize, input, inputSize,
0, 0); // pts & dts
#else
if ( _needsParsing )
{
#if LIBAVCODEC_VERSION_MAJOR >= 53
return av_parser_parse2(_parser, _audioCodecCtx,
#else
return av_parser_parse(_parser, _audioCodecCtx,
#endif
// as of 2008-10-28 SVN, ffmpeg doesn't
// accept a pointer to pointer to const..
const_cast<boost::uint8_t**>(outFrame),
outFrameSize,
input, inputSize,
#if LIBAVCODEC_VERSION_MAJOR >= 53
0, 0, AV_NOPTS_VALUE); // pts, dts, pos
#else
0, 0); // pts & dts
#endif
} else {
}
else
{
// democratic value for a chunk to decode...
// @todo this might be constrained by codec id, check that !

Expand Down
15 changes: 4 additions & 11 deletions libmedia/ffmpeg/AudioResamplerFfmpeg.cpp
Expand Up @@ -18,19 +18,12 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//

#ifdef HAVE_CONFIG_H
#include "gnashconfig.h"
#endif

#include "AudioResamplerFfmpeg.h"
#include "log.h"

#include <cmath>
#include <vector>
#include <boost/scoped_array.hpp>
#ifdef HAVE_FFMPEG_AVCODEC_H
# include <avcodec.h>
#endif

namespace gnash {
namespace media {
Expand All @@ -53,14 +46,14 @@ AudioResamplerFfmpeg::init( AVCodecContext* ctx )
{
if ( (ctx->sample_rate != 44100) || (ctx->channels != 2) ) {
if ( ! _context ) {
#if !defined (LIBAVFORMAT_VERSION_MAJOR) || LIBAVFORMAT_VERSION_MAJOR < 53
_context = audio_resample_init(
2, ctx->channels, 44100, ctx->sample_rate
#else
#if LIBAVCODEC_VERSION_MAJOR >= 53
_context = av_audio_resample_init(
2, ctx->channels, 44100, ctx->sample_rate,
AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16,
16, 10, 0, 0.8
#else
_context = audio_resample_init(
2, ctx->channels, 44100, ctx->sample_rate
#endif
);
}
Expand Down

0 comments on commit 426c9de

Please sign in to comment.