mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-16 17:41:14 +01:00
More uses of SampleBuffer, eliminating explicit DeleteSamples calls
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
///this->ReadData(sampleData, floatSample, 0, mLen);
|
||||
///This class should call ReadHeader() first, so it knows the length, and can prepare
|
||||
///the file object if it needs to.
|
||||
virtual int Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
|
||||
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
|
||||
|
||||
///This is a must implement abstract virtual in the superclass.
|
||||
///However it doesn't do anything because ImportFFMpeg does all that for us.
|
||||
@@ -296,12 +296,12 @@ ODFFmpegDecoder::~ODFFmpegDecoder()
|
||||
#define kDecodeSampleAllowance 400000
|
||||
//number of jump backwards seeks
|
||||
#define kMaxSeekRewindAttempts 8
|
||||
int ODFFmpegDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)
|
||||
int ODFFmpegDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)
|
||||
{
|
||||
format = mScs[mStreamIndex]->m_osamplefmt;
|
||||
|
||||
data = NewSamples(len, format);
|
||||
samplePtr bufStart = data;
|
||||
data.Allocate(len, format);
|
||||
samplePtr bufStart = data.ptr();
|
||||
streamContext* sc = NULL;
|
||||
|
||||
// printf("start %llu len %llu\n", start, len);
|
||||
|
||||
@@ -166,7 +166,7 @@ FLAC__StreamDecoderWriteStatus ODFLACFile::write_callback(const FLAC__Frame *fra
|
||||
///this->ReadData(sampleData, floatSample, 0, mLen);
|
||||
///This class should call ReadHeader() first, so it knows the length, and can prepare
|
||||
///the file object if it needs to.
|
||||
int ODFlacDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)
|
||||
int ODFlacDecoder::Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)
|
||||
{
|
||||
|
||||
//we need to lock this so the target stays fixed over the seek/write callback.
|
||||
@@ -182,8 +182,8 @@ int ODFlacDecoder::Decode(samplePtr & data, sampleFormat & format, sampleCount s
|
||||
mDecodeBufferWritePosition=0;
|
||||
mDecodeBufferLen = len;
|
||||
|
||||
data = NewSamples(len, mFormat);
|
||||
mDecodeBuffer=data;
|
||||
data.Allocate(len, mFormat);
|
||||
mDecodeBuffer = data.ptr();
|
||||
format = mFormat;
|
||||
|
||||
mTargetChannel=channel;
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
///this->ReadData(sampleData, floatSample, 0, mLen);
|
||||
///This class should call ReadHeader() first, so it knows the length, and can prepare
|
||||
///the file object if it needs to.
|
||||
virtual int Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
|
||||
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel);
|
||||
|
||||
|
||||
///Read header. Subclasses must override. Probably should save the info somewhere.
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
///This class should call ReadHeader() first, so it knows the length, and can prepare
|
||||
///the file object if it needs to.
|
||||
///returns negative value for failure, 0 or positive value for success.
|
||||
virtual int Decode(samplePtr & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)=0;
|
||||
virtual int Decode(SampleBuffer & data, sampleFormat & format, sampleCount start, sampleCount len, unsigned int channel)=0;
|
||||
|
||||
wxString GetFileName(){return mFName;}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user