Exemplo n.º 1
0
std::auto_ptr<AudioDecoder>
MediaHandlerGst::createAudioDecoder(const AudioInfo& info)
{
    std::auto_ptr<AudioDecoder> ret;

#ifdef DECODING_SPEEX
    if (info.codec == AUDIO_CODEC_SPEEX) {
        assert(info.type == CODEC_TYPE_FLASH);
        ret.reset(new AudioDecoderSpeex);
    } else
#endif
    {
        try {
            ret.reset(new AudioDecoderGst(info));
        }
        catch (const MediaException& ex) {

            if (info.type != CODEC_TYPE_FLASH) throw;

            try {
                ret = createFlashAudioDecoder(info);
            } 
            catch (const MediaException& ex2) {
                boost::format err = boost::format(
                    _("MediaHandlerGst::createAudioDecoder: %s "
                      "-- %s")) % ex.what() % ex2.what();
                throw MediaException(err.str());
            }
        }
    
    }

    return ret;
}
Exemplo n.º 2
0
std::auto_ptr<AudioDecoder>
MediaHandlerFfmpeg::createAudioDecoder(const AudioInfo& info)
{

	std::auto_ptr<AudioDecoder> ret;

    try {
        ret.reset(new AudioDecoderFfmpeg(info));
    }
    catch (const MediaException& ex) {

        if (info.type != CODEC_TYPE_FLASH) throw;

        try {
            ret = createFlashAudioDecoder(info);
        } 
        catch (const MediaException& ex2) {
            boost::format err = boost::format(
                _("MediaHandlerFfmpeg::createAudioDecoder: %s "
                  "-- %s")) % ex.what() % ex2.what();
            throw MediaException(err.str());
        }
    }

	return ret;
}