X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Ftool%2Fmain.cpp;h=1bd614eba807095c0f48b7f82deb58e6b02fd17e;hb=1dd5df3c6caf241f4ee42859aa8654b4178d38a1;hp=e3255153dce964ee4435e4044b1bf29340a5fdd7;hpb=e950001a8df0e97b4b0042d174ddb6ff36be38bc;p=synfig.git diff --git a/synfig-core/src/tool/main.cpp b/synfig-core/src/tool/main.cpp index e325515..1bd614e 100644 --- a/synfig-core/src/tool/main.cpp +++ b/synfig-core/src/tool/main.cpp @@ -7,6 +7,7 @@ ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** Copyright (c) 2007, 2008 Chris Moore +** Copyright (c) 2009-2010 Diego Barrios ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -45,55 +46,23 @@ #include #include #include +#include #include #include #include #include #include #include +#include "definitions.h" +#include "progress.h" +#include "renderprogress.h" +#include "job.h" #endif using namespace std; using namespace etl; using namespace synfig; -/* === M A C R O S ========================================================= */ - -#ifdef ENABLE_NLS -#undef _ -#define _(x) gettext(x) -#else -#undef _ -#define _(x) (x) -#endif - -enum exit_code -{ - SYNFIGTOOL_OK = 0, - SYNFIGTOOL_FILENOTFOUND = 1, - SYNFIGTOOL_BORED = 2, - SYNFIGTOOL_HELP = 3, - SYNFIGTOOL_UNKNOWNARGUMENT = 4, - SYNFIGTOOL_UNKNOWNERROR = 5, - SYNFIGTOOL_INVALIDTARGET = 6, - SYNFIGTOOL_RENDERFAILURE = 7, - SYNFIGTOOL_BLANK = 8, - SYNFIGTOOL_BADVERSION = 9, - SYNFIGTOOL_MISSINGARGUMENT =10 -}; - -#ifndef VERSION -#define VERSION "unknown" -#define PACKAGE "synfig-tool" -#endif - -#ifdef DEFAULT_QUALITY -#undef DEFAULT_QUALITY -#endif - -#define DEFAULT_QUALITY 2 -#define VERBOSE_OUT(x) if(verbosity>=(x))std::cerr - /* === G L O B A L S ======================================================= */ const char *progname; @@ -101,182 +70,49 @@ int verbosity=0; bool be_quiet=false; bool print_benchmarks=false; -/* === M E T H O D S ======================================================= */ - -class Progress : public synfig::ProgressCallback +//! Allowed video codecs +/*! \warning This variable is linked to allowed_video_codecs_description, + * if you change this you must change the other acordingly. + * \warning These codecs are linked to the filename extensions for + * mod_ffmpeg. If you change this you must change the others acordingly. + */ +const char* allowed_video_codecs[] = { - const char *program; - -public: - - Progress(const char *name):program(name) { } - - virtual bool - task(const String &task) - { - VERBOSE_OUT(1)<=60) - minutes++,seconds-=60; - while(minutes>=60) - hours++,minutes-=60; - while(hours>=24) - days++,hours-=24; - while(days>=7) - weeks++,days-=7; - - cerr<=-time/(h-clk_scanline) ) - cerr<<">"; - */ - if(delta>=0 && clk()>4.0 && scanline>clk_scanline+200) - { - //cerr<<"reset"< arg_list_t; typedef list job_list_t; +/* === M E T H O D S ======================================================= */ + void guid_test() { cout<<"GUID Test"<", _("Print out layer's description, parameter info, etc.")); display_help_option("--layers", NULL, _("Print out the list of available layers")); display_help_option("--targets", NULL, _("Print out the list of available targets")); + display_help_option("--target-video-codecs", NULL, _("Print out the list of available target video codecs")); display_help_option("--importers", NULL, _("Print out the list of available importers")); display_help_option("--valuenodes", NULL, _("Print out the list of available ValueNodes")); display_help_option("--modules", NULL, _("Print out the list of loaded modules")); @@ -367,6 +204,15 @@ void display_help(bool full) cerr << endl; } +void display_target_video_codecs_help () +{ + for (int i = 0; allowed_video_codecs[i] != NULL && + allowed_video_codecs_description[i] != NULL; i++) + cout << " " << allowed_video_codecs[i] << ": \t" + << allowed_video_codecs_description[i] + << endl; +} + int process_global_flags(arg_list_t &arg_list) { arg_list_t::iterator iter, next; @@ -477,6 +323,13 @@ int process_global_flags(arg_list_t &arg_list) return SYNFIGTOOL_HELP; } + if(*iter == "--target-video-codecs") + { + display_target_video_codecs_help(); + + return SYNFIGTOOL_HELP; + } + if(*iter == "--valuenodes") { Progress p(PACKAGE); @@ -550,7 +403,7 @@ bool flag_requires_value(String flag) flag=="-Q" || flag=="-s" || flag=="-t" || flag=="-T" || flag=="-w" || flag=="--append" || flag=="--begin-time" || flag=="--canvas-info"|| flag=="--dpi" || flag=="--dpi-x" || flag=="--dpi-y" || flag=="--end-time" || flag=="--fps" || flag=="--layer-info" || flag=="--start-time" || - flag=="--time" ); + flag=="--time" || flag=="-vc" || flag=="-vb"); } int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster) @@ -584,6 +437,25 @@ int extract_arg_cluster(arg_list_t &arg_list,arg_list_t &cluster) return SYNFIGTOOL_OK; } +/*! Extract a parameter from the argument list + * + * \param arg_list Argument list from wich the parameter is extracted. + * \param iter Iterator pointing to the argument list parameter to be + * extracted. + * \param next Iterator pointing to the next argument. + */ +string extract_parameter (arg_list_t& arg_list, + arg_list_t::iterator& iter, + arg_list_t::iterator& next) +{ + string parameter; + arg_list.erase(iter); + iter = next++; + parameter = *iter; + arg_list.erase(iter); + return parameter; +} + int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc) { arg_list_t::iterator iter, next; @@ -593,107 +465,74 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc) { if(*iter=="-w") { - arg_list.erase(iter); - iter=next++; - w=atoi(iter->c_str()); - arg_list.erase(iter); + w = atoi(extract_parameter(arg_list, iter, next).c_str()); } else if(*iter=="-h") { - arg_list.erase(iter); - iter=next++; - h=atoi(iter->c_str()); - arg_list.erase(iter); + h = atoi(extract_parameter(arg_list, iter, next).c_str()); } else if(*iter=="-a") { int a; - arg_list.erase(iter); - iter=next++; - a=atoi(iter->c_str()); + a = atoi(extract_parameter(arg_list, iter, next).c_str()); desc.set_antialias(a); VERBOSE_OUT(1)<c_str()); + span = atoi(extract_parameter(arg_list, iter, next).c_str()); VERBOSE_OUT(1)<c_str()); + float fps = atof(extract_parameter(arg_list, iter, next).c_str()); desc.set_frame_rate(fps); - arg_list.erase(iter); VERBOSE_OUT(1)<c_str()); + float dpi = atof(extract_parameter(arg_list, iter, next).c_str()); float dots_per_meter=dpi*39.3700787402; desc.set_x_res(dots_per_meter).set_y_res(dots_per_meter); - arg_list.erase(iter); VERBOSE_OUT(1)<c_str()); + float dpi = atof(extract_parameter(arg_list, iter, next).c_str()); float dots_per_meter=dpi*39.3700787402; desc.set_x_res(dots_per_meter); - arg_list.erase(iter); VERBOSE_OUT(1)<c_str()); + float dpi = atof(extract_parameter(arg_list, iter, next).c_str()); float dots_per_meter=dpi*39.3700787402; desc.set_y_res(dots_per_meter); - arg_list.erase(iter); VERBOSE_OUT(1)<c_str()))); - arg_list.erase(iter); + //desc.set_gamma(Gamma(atoi(extract_parameter(arg_list, iter, next).c_str()))); } else if (flag_requires_value(*iter)) - iter=next++; + iter++; } if (w||h) { @@ -717,14 +556,11 @@ int extract_quality(arg_list_t &arg_list,int &quality) { if(*iter=="-Q") { - arg_list.erase(iter); - iter=next++; - quality=atoi(iter->c_str()); + quality = atoi(extract_parameter(arg_list, iter, next).c_str()); VERBOSE_OUT(1)<c_str()); + threads = atoi(extract_parameter(arg_list, iter, next).c_str()); VERBOSE_OUT(1)<