ifdef the libswresample lib stuff

This commit is contained in:
Isaac Connor 2016-09-27 13:34:10 -04:00
commit 89d4b9fec5
3 changed files with 15 additions and 5 deletions

View File

@ -78,9 +78,9 @@ $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
if ( $Config{ZM_LD_PRELOAD} ) {
Debug("Adding 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 ) {
Warning("LD_PRELOAD lib $lib does not exist.");
Warning("LD_PRELOAD lib $lib does not exist from LD_PRELOAD $ENV{LD_PRELOAD}.");
}
}
}

View File

@ -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);
static char error_buffer[255];
//Init everything we need, shouldn't have to do this, ffmpeg_camera or something else will call it.
//av_register_all();
@ -209,12 +208,13 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
audio_output_codec = NULL;
audio_input_context = NULL;
resample_context = NULL;
if (audio_input_stream) {
audio_input_context = audio_input_stream->codec;
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 );
Debug(3, "Got something other than AAC (%s)", error_buffer );
audio_output_stream = NULL;
@ -377,7 +377,9 @@ Debug(2, "Have audio_output_context");
} else {
Error( "could not find codec for AAC\n");
}
#else
Error("Not build with libswressample library.");
#endif
} else {
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 */
avformat_free_context(oc);
#ifdef HAVE_LIBSWRESAMPLE
if ( resample_context )
swr_free( &resample_context );
#endif
}
@ -724,6 +728,7 @@ Debug(2, "Stream index is %d", opkt.stream_index );
if ( audio_output_codec ) {
#ifdef HAVE_LIBSWRESAMPLE
// Need to re-encode
#if 0
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;
#endif
#endif
} else {
opkt.data = ipkt->data;

View File

@ -5,7 +5,9 @@
extern "C" {
#include "libavutil/audio_fifo.h"
#ifdef HAVE_LIBSWRESAMPLE
#include "libswresample/swresample.h"
#endif
}
#if HAVE_LIBAVCODEC
@ -41,7 +43,9 @@ private:
int data_present;
AVAudioFifo *fifo;
int output_frame_size;
#ifdef HAVE_LIBSWRESAMPLE
SwrContext *resample_context = NULL;
#endif
uint8_t *converted_input_samples = NULL;
const char *filename;