示例#1
0
/*------------------------------------------------------------------------------
 *  Start the encoding
 *----------------------------------------------------------------------------*/
bool
ExternalEncoder :: start ( void )           throw ( Exception )
{
    pid_t   pid;

    if ( isRunning() ) {
        return false;
    }

    pid = fork();

    if ( pid == -1 ) {
        throw Exception( __FILE__, __LINE__, "fork error");
    } else if ( pid == 0 ) {
        cout << "wow, I'm a voodoo child!" << endl;

        makeArgs();
        execvp( getEncoderName(), cmdArgs);

        throw Exception( __FILE__, __LINE__, "exec returned");
    } else {
        child = pid;
        cout << "I'm a parent, the child's pid is " << child << endl;

        return true;
    }
}
void SupportedEncodersLoader::parseLine(const std::string& line,
		ConverterOptions::SupportedEncoders& encoders, bool& findMatch){
	RegexTools::Matcher mat = encoderDetector.getMatcher(line);
	if(mat.find()){
		findMatch = true;
//		ConverterOptions::Encoder::Type type;
//		std::string codecType = getCodecType(mat);
//		if (codecType == "V") {
//			type = AVBox::Encoder::VIDEO;
//		}else
//		if(codecType == "A"){
//			type = AVBox::Encoder::AUDIO;
//		}else{
//			type = AVBox::Encoder::UNKNOWN;
//		}

		encoders.addEncoder(getEncoderName(mat), getCodecDescription(mat));
	}
}