Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2010-08-03 12:07:21 +0400
committerJoerg Mueller <nexyon@gmail.com>2010-08-03 12:07:21 +0400
commitce44d63ae1e6e76545bacd87ca8402b35a0317a0 (patch)
tree8f209fdbd889cee39f700cf092b0045f1f87ec3a /intern/audaspace/ffmpeg
parent8baeb4393c281b5c6765aa5ce4708a8221123b34 (diff)
Audaspace:
* Added an error string for audaspace exceptions. * Fixed PyAPI exceptions. * Minor bugfixes. * Added a name parameter to the Jack device, so that one can define an own name via Python.
Diffstat (limited to 'intern/audaspace/ffmpeg')
-rw-r--r--intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
index 717838bc982..b9d5d304368 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp
@@ -77,13 +77,24 @@ int AUD_FFMPEGReader::decode(AVPacket* packet, AUD_Buffer& buffer)
return buf_pos;
}
+static const char* streaminfo_error = "AUD_FFMPEGReader: Stream info couldn't "
+ "be found.";
+static const char* noaudio_error = "AUD_FFMPEGReader: File doesn't include an "
+ "audio stream.";
+static const char* nodecoder_error = "AUD_FFMPEGReader: No decoder found for "
+ "the audio stream.";
+static const char* codecopen_error = "AUD_FFMPEGReader: Codec couldn't be "
+ "opened.";
+static const char* format_error = "AUD_FFMPEGReader: Unsupported sample "
+ "format.";
+
void AUD_FFMPEGReader::init()
{
m_position = 0;
m_pkgbuf_left = 0;
if(av_find_stream_info(m_formatCtx)<0)
- AUD_THROW(AUD_ERROR_FFMPEG);
+ AUD_THROW(AUD_ERROR_FFMPEG, streaminfo_error);
// find audio stream and codec
m_stream = -1;
@@ -99,17 +110,17 @@ void AUD_FFMPEGReader::init()
}
if(m_stream == -1)
- AUD_THROW(AUD_ERROR_FFMPEG);
+ AUD_THROW(AUD_ERROR_FFMPEG, noaudio_error);
m_codecCtx = m_formatCtx->streams[m_stream]->codec;
// get a decoder and open it
AVCodec *aCodec = avcodec_find_decoder(m_codecCtx->codec_id);
if(!aCodec)
- AUD_THROW(AUD_ERROR_FFMPEG);
+ AUD_THROW(AUD_ERROR_FFMPEG, nodecoder_error);
if(avcodec_open(m_codecCtx, aCodec)<0)
- AUD_THROW(AUD_ERROR_FFMPEG);
+ AUD_THROW(AUD_ERROR_FFMPEG, codecopen_error);
// XXX this prints file information to stdout:
//dump_format(m_formatCtx, 0, NULL, 0);
@@ -139,19 +150,22 @@ void AUD_FFMPEGReader::init()
m_specs.format = AUD_FORMAT_FLOAT64;
break;
default:
- AUD_THROW(AUD_ERROR_FILE);
+ AUD_THROW(AUD_ERROR_FFMPEG, format_error);
}
m_specs.rate = (AUD_SampleRate) m_codecCtx->sample_rate;
}
+static const char* fileopen_error = "AUD_FFMPEGReader: File couldn't be "
+ "opened.";
+
AUD_FFMPEGReader::AUD_FFMPEGReader(std::string filename) :
m_pkgbuf(AVCODEC_MAX_AUDIO_FRAME_SIZE<<1),
m_byteiocontext(NULL)
{
// open file
if(av_open_input_file(&m_formatCtx, filename.c_str(), NULL, 0, NULL)!=0)
- AUD_THROW(AUD_ERROR_FILE);
+ AUD_THROW(AUD_ERROR_FILE, fileopen_error);
try
{
@@ -164,6 +178,9 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(std::string filename) :
}
}
+static const char* streamopen_error = "AUD_FFMPEGReader: Stream couldn't be "
+ "opened.";
+
AUD_FFMPEGReader::AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer) :
m_pkgbuf(AVCODEC_MAX_AUDIO_FRAME_SIZE<<1),
m_membuffer(buffer)
@@ -174,7 +191,7 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer) :
buffer.get()->getSize(), 0, NULL, NULL, NULL, NULL) != 0)
{
av_free(m_byteiocontext);
- AUD_THROW(AUD_ERROR_FILE);
+ AUD_THROW(AUD_ERROR_FILE, fileopen_error);
}
AVProbeData probe_data;
@@ -187,7 +204,7 @@ AUD_FFMPEGReader::AUD_FFMPEGReader(AUD_Reference<AUD_Buffer> buffer) :
if(av_open_input_stream(&m_formatCtx, m_byteiocontext, "", fmt, NULL)!=0)
{
av_free(m_byteiocontext);
- AUD_THROW(AUD_ERROR_FILE);
+ AUD_THROW(AUD_ERROR_FILE, streamopen_error);
}
try