fix: gracefully handle unknown file subtypes

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@1491 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 17 years ago
parent bc584d6f8c
commit 9cce3d82c1

@ -359,11 +359,10 @@ int AmAudio::decode(unsigned int size)
amci_codec_t* codec = fmt->getCodec();
long h_codec = fmt->getHCodec();
// if(!codec){
// ERROR("audio format set, but no codec has been loaded\n");
// abort();
// return -1;
// }
if(!codec){
ERROR("audio format set, but no codec has been loaded\n");
return -1;
}
if(codec->decode){
s = (*codec->decode)(samples.back_buffer(),samples,s,

@ -57,20 +57,22 @@ void AmAudioFileFormat::setSubtypeId(int subtype_id) {
amci_subtype_t* AmAudioFileFormat::getSubtype()
{
if(!p_subtype && !name.empty()){
// get file format from file name
amci_inoutfmt_t* iofmt = AmPlugIn::instance()->fileFormat(name.c_str());
if(!iofmt){
ERROR("AmAudioFileFormat::getSubtype: file format '%s' does not exist\n",
name.c_str());
throw string("AmAudioFileFormat::getSubtype: file format '%s' does not exist\n");
return NULL;
}
else {
p_subtype = AmPlugIn::instance()->subtype(iofmt,subtype);
if(!p_subtype)
ERROR("AmAudioFileFormat::getSubtype: subtype %i in format '%s' does not exist\n",
subtype,iofmt->name);
subtype = p_subtype->type;
p_subtype = AmPlugIn::instance()->subtype(iofmt,subtype);
if(!p_subtype) {
ERROR("AmAudioFileFormat::getSubtype: subtype %i in format '%s' does not exist\n",
subtype,iofmt->name);
return NULL;
}
subtype = p_subtype->type;
}
return p_subtype;
}

Loading…
Cancel
Save