コード例 #1
0
void CueSplitter::run()
{
	m_bSuccess = false;
	m_bAborted = false;
	m_abortFlag = false;
	m_nTracksSuccess = 0;
	m_nTracksSkipped = 0;
	m_decompressedFiles.clear();
	m_activeFile.clear();
	
	if(!QDir(m_outputDir).exists())
	{
		qWarning("Output directory \"%s\" does not exist!", QUTF8(m_outputDir));
		return;
	}
	
	QStringList inputFileList = m_inputFilesInfo.keys();
	int nInputFiles = inputFileList.count();
	
	emit progressMaxChanged(nInputFiles);
	emit progressValChanged(0);

	//Decompress all input files
	for(int i = 0; i < nInputFiles; i++)
	{
		const AudioFileModel_TechInfo &inputFileInfo = m_inputFilesInfo[inputFileList.at(i)].techInfo();
		if(inputFileInfo.containerType().compare("Wave", Qt::CaseInsensitive) || inputFileInfo.audioType().compare("PCM", Qt::CaseInsensitive))
		{
			AbstractDecoder *decoder = DecoderRegistry::lookup(inputFileInfo.containerType(), inputFileInfo.containerProfile(), inputFileInfo.audioType(), inputFileInfo.audioProfile(), inputFileInfo.audioVersion());
			if(decoder)
			{
				m_activeFile = shortName(QFileInfo(inputFileList.at(i)).fileName());
				
				emit fileSelected(m_activeFile);
				emit progressValChanged(i+1);
				
				QString tempFile = QString("%1/~%2.wav").arg(m_outputDir, lamexp_rand_str());
				connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
				
				if(decoder->decode(inputFileList.at(i), tempFile, &m_abortFlag))
				{
					m_decompressedFiles.insert(inputFileList.at(i), tempFile);
					m_tempFiles.append(tempFile);
				}
				else
				{
					qWarning("Failed to decompress file: <%s>", inputFileList.at(i).toLatin1().constData());
					lamexp_remove_file(tempFile);
				}
				
				m_activeFile.clear();
				LAMEXP_DELETE(decoder);
			}
			else
			{
				qWarning("Unsupported input file: <%s>", inputFileList.at(i).toLatin1().constData());
			}
		}
コード例 #2
0
ファイル: Thread_Process.cpp プロジェクト: arestarh/LameXP
void ProcessThread::processFile()
{
	m_aborted = false;
	bool bSuccess = true;
		
	qDebug("Process thread %s has started.", m_jobId.toString().toLatin1().constData());
	emit processStateInitialized(m_jobId, QFileInfo(m_audioFile.filePath()).fileName(), tr("Starting..."), ProgressModel::JobRunning);
	handleMessage(QString().sprintf("LameXP v%u.%02u (Build #%u), compiled on %s at %s", lamexp_version_major(), lamexp_version_minor(), lamexp_version_build(), lamexp_version_date().toString(Qt::ISODate).toLatin1().constData(), lamexp_version_time()));
	handleMessage("\n-------------------------------\n");

	//Generate output file name
	QString outFileName = generateOutFileName();
	if(outFileName.isEmpty())
	{
		emit processStateChanged(m_jobId, tr("Not found!"), ProgressModel::JobFailed);
		emit processStateFinished(m_jobId, outFileName, false);
		return;
	}

	//Do we need to take care of downsampling the input?
	if(m_encoder->requiresDownsample())
	{
		insertDownsampleFilter();
	}

	//Do we need Stereo downmix?
	if(m_encoder->requiresDownmix())
	{
		insertDownmixFilter();
	}

	QString sourceFile = m_audioFile.filePath();

	//Decode source file
	if(!m_filters.isEmpty() || !m_encoder->isFormatSupported(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion()))
	{
		m_currentStep = DecodingStep;
		AbstractDecoder *decoder = DecoderRegistry::lookup(m_audioFile.formatContainerType(), m_audioFile.formatContainerProfile(), m_audioFile.formatAudioType(), m_audioFile.formatAudioProfile(), m_audioFile.formatAudioVersion());
		
		if(decoder)
		{
			QString tempFile = generateTempFileName();

			connect(decoder, SIGNAL(statusUpdated(int)), this, SLOT(handleUpdate(int)), Qt::DirectConnection);
			connect(decoder, SIGNAL(messageLogged(QString)), this, SLOT(handleMessage(QString)), Qt::DirectConnection);

			bSuccess = decoder->decode(sourceFile, tempFile, &m_aborted);
			LAMEXP_DELETE(decoder);

			if(bSuccess)
			{
				sourceFile = tempFile;
				handleMessage("\n-------------------------------\n");
			}
		}
		else
		{
コード例 #3
0
bool Decoder::can_decode_C_frame_in_vm() {
  assert(_shared_decoder_lock != NULL, "Just check");
  bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
  AbstractDecoder* decoder = error_handling_thread ?
    get_error_handler_instance(): get_shared_instance();
  assert(decoder != NULL, "null decoder");
  return decoder->can_decode_C_frame_in_vm();
}
コード例 #4
0
bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
  assert(_shared_decoder_lock != NULL, "Just check");
  bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
  AbstractDecoder* decoder = error_handling_thread ?
    get_error_handler_instance(): get_shared_instance();
  assert(decoder != NULL, "null decoder");
  return decoder->demangle(symbol, buf, buflen);
}
コード例 #5
0
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
  assert(_shared_decoder_lock != NULL, "Just check");
  bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
  MutexLockerEx locker(error_handling_thread ? NULL : _shared_decoder_lock, true);
  AbstractDecoder* decoder = error_handling_thread ?
    get_error_handler_instance(): get_shared_instance();
  assert(decoder != NULL, "null decoder");

  return decoder->decode(addr, buf, buflen, offset, base);
}
コード例 #6
0
AbstractDecoder* Decoder::create_decoder() {
  AbstractDecoder* decoder;
#if defined(_WINDOWS)
  decoder = new (std::nothrow) WindowsDecoder();
#elif defined (__APPLE__)
  decoder = new (std::nothrow)MachODecoder();
#elif defined(AIX)
  decoder = new (std::nothrow)AIXDecoder();
#else
  decoder = new (std::nothrow)ElfDecoder();
#endif

  if (decoder == NULL || decoder->has_error()) {
    if (decoder != NULL) {
      delete decoder;
    }
    decoder = &_do_nothing_decoder;
  }
  return decoder;
}