1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Add ODDecodeFFmpegTask to Unix makefile, fix some errors and warnings

This commit is contained in:
BusinessmanProgrammerSteve 2010-03-19 21:41:44 +00:00
parent ece5a9e51e
commit 4cdbbce01f
4 changed files with 11 additions and 12 deletions

View File

@ -158,7 +158,7 @@ void av_log_wx_callback(void* ptr, int level, const char* fmt, va_list vl)
//will crash. //will crash.
//TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print //TODO:find some workaround for the log. perhaps use ODManager as a bridge. for now just print
if(!wxThread::IsMain()) if(!wxThread::IsMain())
printf("%s: %s\n",cpt.c_str(),printstring.c_str()); printf("%s: %s\n",cpt.char_str(),printstring.char_str());
else else
#endif #endif
wxLogMessage(wxT("%s: %s"),cpt.c_str(),printstring.c_str()); wxLogMessage(wxT("%s: %s"),cpt.c_str(),printstring.c_str());

View File

@ -198,6 +198,7 @@ OBJS = \
import/RawAudioGuess.o \ import/RawAudioGuess.o \
ondemand/ODComputeSummaryTask.o \ ondemand/ODComputeSummaryTask.o \
ondemand/ODDecodeTask.o \ ondemand/ODDecodeTask.o \
ondemand/ODDecodeFFmpegTask.o \
ondemand/ODManager.o \ ondemand/ODManager.o \
ondemand/ODTask.o \ ondemand/ODTask.o \
ondemand/ODTaskThread.o \ ondemand/ODTaskThread.o \

View File

@ -156,7 +156,7 @@ static const wxChar *exts[] =
#ifdef EXPERIMENTAL_OD_FFMPEG #ifdef EXPERIMENTAL_OD_FFMPEG
#include "ODDecodeFFMpegTask.h" #include "../ondemand/ODDecodeFFmpegTask.h"
#endif #endif
extern FFmpegLibs *FFmpegLibsInst; extern FFmpegLibs *FFmpegLibsInst;
@ -545,7 +545,6 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
} }
} }
// This is the heart of the importing process // This is the heart of the importing process
streamContext *sc = NULL;
// The result of Import() to be returend. It will be something other than zero if user canceled or some error appears. // The result of Import() to be returend. It will be something other than zero if user canceled or some error appears.
int res = eProgressSuccess; int res = eProgressSuccess;
@ -596,7 +595,7 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
tasks.push_back(odTask); tasks.push_back(odTask);
} }
//Now we add the tasks and let them run, or delete them if the user cancelled //Now we add the tasks and let them run, or delete them if the user cancelled
for(int i=0;i<tasks.size();i++) for(int i=0; i < (int)tasks.size(); i++)
{ {
if(res==eProgressSuccess) if(res==eProgressSuccess)
ODManager::Instance()->AddNewTask(tasks[i]); ODManager::Instance()->AddNewTask(tasks[i]);
@ -606,6 +605,9 @@ int FFmpegImportFileHandle::Import(TrackFactory *trackFactory,
} }
} }
#else //ifndef EXPERIMENTAL_OD_FFMPEG #else //ifndef EXPERIMENTAL_OD_FFMPEG
streamContext *sc = NULL;
// Read next frame. // Read next frame.
while ((sc = ReadNextFrame()) != NULL && (res == eProgressSuccess)) while ((sc = ReadNextFrame()) != NULL && (res == eProgressSuccess))
{ {

View File

@ -58,7 +58,7 @@ public:
///This is a must implement abstract virtual in the superclass. ///This is a must implement abstract virtual in the superclass.
///However it doesn't do anything because ImportFFMpeg does all that for us. ///However it doesn't do anything because ImportFFMpeg does all that for us.
virtual bool ReadHeader(){} virtual bool ReadHeader() {return true;}
private: private:
int FillDataFromCache(samplePtr & data, sampleCount start, sampleCount& len, unsigned int channel); int FillDataFromCache(samplePtr & data, sampleCount start, sampleCount& len, unsigned int channel);
@ -145,8 +145,8 @@ ODFFmpegDecoder::ODFFmpegDecoder(const wxString & fileName, streamContext** scs,
mNumStreams(numStreams), mNumStreams(numStreams),
mScs(scs), mScs(scs),
mFormatContext(formatContext), mFormatContext(formatContext),
mCurrentPos(0), mNumSamplesInCache(0),
mNumSamplesInCache(0) mCurrentPos(0)
{ {
PickFFmpegLibs(); PickFFmpegLibs();
@ -212,8 +212,6 @@ void ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCoun
samplePtr bufStart = data; samplePtr bufStart = data;
streamContext* sc = NULL; streamContext* sc = NULL;
sampleCount origLen=len;
int nChannels; int nChannels;
//TODO update this to work with seek - this only works linearly now. //TODO update this to work with seek - this only works linearly now.
@ -304,7 +302,6 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleCount start, samp
//that has a start time of less than our start sample, but try to get closer with binary search //that has a start time of less than our start sample, but try to get closer with binary search
int searchStart = 0; int searchStart = 0;
int searchEnd = mDecodeCache.size()-1; int searchEnd = mDecodeCache.size()-1;
int mid;
int guess; int guess;
if(searchEnd>kODFFmpegSearchThreshold) if(searchEnd>kODFFmpegSearchThreshold)
{ {
@ -326,7 +323,7 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleCount start, samp
} }
//most recent caches are at the end of the vector, so start there. //most recent caches are at the end of the vector, so start there.
for(int i=searchStart;i<mDecodeCache.size();i++) for(int i=searchStart; i < (int)mDecodeCache.size(); i++)
{ {
//check for a cache hit - be careful to include the first/last sample an nothing more. //check for a cache hit - be careful to include the first/last sample an nothing more.
//we only accept cache hits that touch either end - no piecing out of the middle. //we only accept cache hits that touch either end - no piecing out of the middle.
@ -338,7 +335,6 @@ int ODFFmpegDecoder::FillDataFromCache(samplePtr & data, sampleCount start, samp
int16_t* outBuf; int16_t* outBuf;
outBuf = (int16_t*)data; outBuf = (int16_t*)data;
//for debug //for debug
FFMpegDecodeCache* cache = mDecodeCache[i];
//reject buffers that would split us into two pieces because we don't have //reject buffers that would split us into two pieces because we don't have
//a method of dealing with this yet, and it won't happen very often. //a method of dealing with this yet, and it won't happen very often.
if(start<mDecodeCache[i]->start && start+len > mDecodeCache[i]->start+mDecodeCache[i]->len) if(start<mDecodeCache[i]->start && start+len > mDecodeCache[i]->start+mDecodeCache[i]->len)