This is the function that use mapped
Video* Convertir::convertir(Video *v){
if (!v->getError()) {
connect(proceso,SIGNAL(readyReadStandardError()),SLOT(procesarSalida()),Qt::DirectConnection);
connect(this,SIGNAL(valorTotal(int)),v->getProgreso(),SLOT(setMaximum(int)),Qt::DirectConnection);
connect(this,SIGNAL(valorProgreso(int)),v->getProgreso(),SLOT(setValue(int)),Qt::DirectConnection);
if(formato == "avi" && calidad == "Alta"){
parametros << "-i"<< nombre_fichero << "-sameq" << "-vcodec" << "mpeg2video" << "-y" << salida+f_conv;
}else if(formato == "mpg" && calidad == "Alta"){
parametros << "-i"<< nombre_fichero << "-sameq" << "-y" << salida+f_conv;
}else if(formato == "avi" && calidad == "Baja"){
parametros << "-i"<< nombre_fichero << "-vcodec" << "mpeg2video"<< "-y" << salida+f_conv;
}else
parametros << "-i"<< nombre_fichero << "-y" << salida+f_conv;
proceso->start("ffmpeg",parametros);
}
return v;
}
Video* Convertir::convertir(Video *v){
if (!v->getError()) {
QString nombre_fichero = QDir::tempPath()+"/"+QFileInfo(v->getDireccion().path()).fileName();
connect(proceso,SIGNAL(readyReadStandardError()),SLOT(procesarSalida()),Qt::DirectConnection);
connect(this,SIGNAL(valorTotal(int)),v->getProgreso(),SLOT(setMaximum(int)),Qt::DirectConnection);
connect(this,SIGNAL(valorProgreso(int)),v->getProgreso(),SLOT(setValue(int)),Qt::DirectConnection);
QString f_conv = QFileInfo(nombre_fichero).baseName()+"."+formato;
QStringList parametros;
if(formato == "avi" && calidad == "Alta"){
parametros << "-i"<< nombre_fichero << "-sameq" << "-vcodec" << "mpeg2video" << "-y" << salida+f_conv;
}else if(formato == "mpg" && calidad == "Alta"){
parametros << "-i"<< nombre_fichero << "-sameq" << "-y" << salida+f_conv;
}else if(formato == "avi" && calidad == "Baja"){
parametros << "-i"<< nombre_fichero << "-vcodec" << "mpeg2video"<< "-y" << salida+f_conv;
}else
parametros << "-i"<< nombre_fichero << "-y" << salida+f_conv;
proceso->start("ffmpeg",parametros);
}
return v;
}
To copy to clipboard, switch view to plain text mode
This is the function object
class Convierte{
public:
typedef Video* result_type;
Video* operator()(Video *v){
Convertir *conv = new Convertir();
conv->convertir(v);
return v;
}
};
class Convierte{
public:
typedef Video* result_type;
Video* operator()(Video *v){
Convertir *conv = new Convertir();
conv->convertir(v);
return v;
}
};
To copy to clipboard, switch view to plain text mode
The first function belongs to the class Convertir and object function is in the Main Window.
Thanks in advance
Bookmarks