ifdef the libswresample lib stuff
commit
89d4b9fec5
|
@ -78,9 +78,9 @@ $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
|
||||||
if ( $Config{ZM_LD_PRELOAD} ) {
|
if ( $Config{ZM_LD_PRELOAD} ) {
|
||||||
Debug("Adding ENV{LD_PRELOAD} = $Config{ZM_LD_PRELOAD}");
|
Debug("Adding ENV{LD_PRELOAD} = $Config{ZM_LD_PRELOAD}");
|
||||||
$ENV{LD_PRELOAD} = $Config{ZM_LD_PRELOAD};
|
$ENV{LD_PRELOAD} = $Config{ZM_LD_PRELOAD};
|
||||||
foreach my $lib ( split(/\w+/, $ENV{LD_PRELOAD} ) ) {
|
foreach my $lib ( split(/\s+/, $ENV{LD_PRELOAD} ) ) {
|
||||||
if ( ! -e $lib ) {
|
if ( ! -e $lib ) {
|
||||||
Warning("LD_PRELOAD lib $lib does not exist.");
|
Warning("LD_PRELOAD lib $lib does not exist from LD_PRELOAD $ENV{LD_PRELOAD}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
|
||||||
|
|
||||||
Info("Opening video storage stream %s format: %s\n", filename, format);
|
Info("Opening video storage stream %s format: %s\n", filename, format);
|
||||||
|
|
||||||
static char error_buffer[255];
|
|
||||||
//Init everything we need, shouldn't have to do this, ffmpeg_camera or something else will call it.
|
//Init everything we need, shouldn't have to do this, ffmpeg_camera or something else will call it.
|
||||||
//av_register_all();
|
//av_register_all();
|
||||||
|
|
||||||
|
@ -209,12 +208,13 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
|
||||||
|
|
||||||
audio_output_codec = NULL;
|
audio_output_codec = NULL;
|
||||||
audio_input_context = NULL;
|
audio_input_context = NULL;
|
||||||
resample_context = NULL;
|
|
||||||
|
|
||||||
if (audio_input_stream) {
|
if (audio_input_stream) {
|
||||||
audio_input_context = audio_input_stream->codec;
|
audio_input_context = audio_input_stream->codec;
|
||||||
|
|
||||||
if ( audio_input_context->codec_id != AV_CODEC_ID_AAC ) {
|
if ( audio_input_context->codec_id != AV_CODEC_ID_AAC ) {
|
||||||
|
#ifdef HAVE_LIBSWRESAMPLE
|
||||||
|
resample_context = NULL;
|
||||||
avcodec_string(error_buffer, sizeof(error_buffer), audio_input_context, 0 );
|
avcodec_string(error_buffer, sizeof(error_buffer), audio_input_context, 0 );
|
||||||
Debug(3, "Got something other than AAC (%s)", error_buffer );
|
Debug(3, "Got something other than AAC (%s)", error_buffer );
|
||||||
audio_output_stream = NULL;
|
audio_output_stream = NULL;
|
||||||
|
@ -377,7 +377,9 @@ Debug(2, "Have audio_output_context");
|
||||||
} else {
|
} else {
|
||||||
Error( "could not find codec for AAC\n");
|
Error( "could not find codec for AAC\n");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Error("Not build with libswressample library.");
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Debug(3, "Got AAC" );
|
Debug(3, "Got AAC" );
|
||||||
|
|
||||||
|
@ -516,8 +518,10 @@ Debug(2, "writing flushed packet pts(%d) dts(%d) duration(%d)", pkt.pts, pkt.dts
|
||||||
/* free the stream */
|
/* free the stream */
|
||||||
avformat_free_context(oc);
|
avformat_free_context(oc);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSWRESAMPLE
|
||||||
if ( resample_context )
|
if ( resample_context )
|
||||||
swr_free( &resample_context );
|
swr_free( &resample_context );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -724,6 +728,7 @@ Debug(2, "Stream index is %d", opkt.stream_index );
|
||||||
|
|
||||||
if ( audio_output_codec ) {
|
if ( audio_output_codec ) {
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSWRESAMPLE
|
||||||
// Need to re-encode
|
// Need to re-encode
|
||||||
#if 0
|
#if 0
|
||||||
ret = avcodec_send_packet( audio_input_context, ipkt );
|
ret = avcodec_send_packet( audio_input_context, ipkt );
|
||||||
|
@ -888,6 +893,7 @@ Debug(2, "opkt dts (%d) pts(%d) duration:(%d) pos(%d) ", opkt.dts, opkt.pts, opk
|
||||||
//opkt.dts = AV_NOPTS_VALUE;
|
//opkt.dts = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
opkt.data = ipkt->data;
|
opkt.data = ipkt->data;
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "libavutil/audio_fifo.h"
|
#include "libavutil/audio_fifo.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBSWRESAMPLE
|
||||||
#include "libswresample/swresample.h"
|
#include "libswresample/swresample.h"
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LIBAVCODEC
|
#if HAVE_LIBAVCODEC
|
||||||
|
@ -41,7 +43,9 @@ private:
|
||||||
int data_present;
|
int data_present;
|
||||||
AVAudioFifo *fifo;
|
AVAudioFifo *fifo;
|
||||||
int output_frame_size;
|
int output_frame_size;
|
||||||
|
#ifdef HAVE_LIBSWRESAMPLE
|
||||||
SwrContext *resample_context = NULL;
|
SwrContext *resample_context = NULL;
|
||||||
|
#endif
|
||||||
uint8_t *converted_input_samples = NULL;
|
uint8_t *converted_input_samples = NULL;
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
|
|
Loading…
Reference in New Issue