int main(int argc, char *argv[]) { int i = 0; libtc_init(&argc, &argv); tc_log_info(PACKAGE, "testing frc <=> fps ..."); for (i = 0; i < TABLE_LEN(fps_pairs); i++) { test_autoloop_from_fps(fps_pairs[i].fps); test_autoloop_to_fps(fps_pairs[i].frc); } tc_log_info(PACKAGE, "testing frc <=> ratio ..."); for (i = 0; i < TABLE_LEN(frc_ratios); i++) { test_autoloop_from_ratio(TC_FRC_CODE, frc_ratios[i].ratio); test_autoloop_to_ratio(TC_FRC_CODE, frc_ratios[i].code); } tc_log_info(PACKAGE, "testing asr <=> ratio ..."); for (i = 0; i < TABLE_LEN(asr_ratios); i++) { test_autoloop_from_ratio(TC_ASR_CODE, asr_ratios[i].ratio); test_autoloop_to_ratio(TC_ASR_CODE, asr_ratios[i].code); } tc_log_info(PACKAGE, "testing par <=> ratio ..."); for (i = 0; i < TABLE_LEN(par_ratios); i++) { test_autoloop_from_ratio(TC_PAR_CODE, par_ratios[i].ratio); test_autoloop_to_ratio(TC_PAR_CODE, par_ratios[i].code); } return 0; }
int main(int argc, char *argv[]) { int errors = 0; libtc_init(&argc, &argv); errors = test_registry_all(); putchar('\n'); tc_log_info(__FILE__, "test summary: %i error%s (%s)", errors, (errors > 1) ?"s" :"", (errors > 0) ?"FAILED" :"PASSED"); return (errors > 0) ?1 :0; }
int main(int argc, char *argv[]) { /* needed by filter modules */ TCVHandle tcv_handle = tcv_init(); CmdLet cmdlet = cmdlet_usage; int ch, ret, status, i = 0; CmdLetData cdata = { .modpath = MOD_PATH, .factory = NULL, .modsnum = 0, }; ac_init(AC_ALL); tc_set_config_dir(NULL); libtc_init(&argc, &argv); filter[0].id = 0; /* to make gcc happy */ for (i = 0; i < MAX_MODS; i++) { modrequest_init(&cdata.mods[i]); } while (1) { ch = getopt(argc, argv, "LCd:?vhm:"); if (ch == -1) { break; } switch (ch) { case 'L': cmdlet = cmdlet_list; break; case 'C': cmdlet = cmdlet_check; break; case 'd': if (optarg[0] == '-') { cmdlet_usage(&cdata, argc, argv); return STATUS_BAD_PARAM; } verbose = atoi(optarg); break; case 'm': cdata.modpath = optarg; break; case 'v': version(); return STATUS_OK; case '?': /* fallthrough */ case 'h': /* fallthrough */ default: cmdlet_usage(&cdata, argc, argv); return STATUS_OK; } } /* XXX: watch out here */ argc -= optind; argv += optind; /* * we can't distinguish from OMS and NMS modules at glance, so try * first using new module system */ cdata.factory = tc_new_module_factory(cdata.modpath, verbose); status = cmdlet(&cdata, argc, argv); ret = tc_del_module_factory(cdata.factory); /* XXX: unchecked */ tcv_free(tcv_handle); return status; }
int main(int argc, char *argv[]) { info_t ipipe; int ch, n, user = 0, demux_mode = TC_DEMUX_SEQ_ADJUST; int npass = 0, *pass = NULL, *new_pass = NULL; int keep_initial_seq = 0, hard_fps_flag = 0, pack_sl = PACKAGE_ALL; int unit_seek = 0, resync_seq1 = 0, resync_seq2 = INT_MAX; int a_track = 0, v_track = 0, subid = 0x80; double fps = PAL_FPS; long stream_stype = TC_STYPE_UNKNOWN; long stream_codec = TC_CODEC_UNKNOWN; long stream_magic = TC_MAGIC_UNKNOWN; long x; char *magic = "", *codec = NULL, *name = NULL; char *logfile = SYNC_LOGFILE, *str = NULL, *end = NULL; //defaults: //proper initialization memset(&ipipe, 0, sizeof(info_t)); libtc_init(&argc, &argv); while ((ch = getopt(argc, argv, "A:a:d:x:i:vt:S:M:f:P:WHs:O?h")) != -1) { switch (ch) { case 'i': if (optarg[0] == '-') usage(EXIT_FAILURE); name = optarg; break; case 'O': keep_initial_seq = 1; break; case 'P': if (optarg[0] == '-') usage(EXIT_FAILURE); logfile = optarg; break; case 'S': if (optarg[0] == '-') usage(EXIT_FAILURE); n = sscanf(optarg,"%d,%d-%d", &unit_seek, &resync_seq1, &resync_seq2); if (n < 0) { tc_log_error(EXE, "invalid parameter for option -S"); usage(EXIT_FAILURE); } if (unit_seek < 0) { tc_log_error(EXE, "invalid unit parameter for option -S"); usage(EXIT_FAILURE); } if (resync_seq1 < 0 || resync_seq2 < 0 || resync_seq1 >= resync_seq2) { tc_log_error(EXE, "invalid sequence parameter for option -S"); usage(EXIT_FAILURE); } break; case 'd': if (optarg[0] == '-') usage(EXIT_FAILURE); verbose = atoi(optarg); break; case 'f': if (optarg[0] == '-') usage(EXIT_FAILURE); fps = atof(optarg); break; case 'W': demux_mode = TC_DEMUX_SEQ_LIST; logfile = NULL; break; case 'H': hard_fps_flag = 1; break; case 'x': if (optarg[0] == '-') usage(EXIT_FAILURE); codec = optarg; if (strcmp(codec,"ac3") == 0) { pack_sl = PACKAGE_AUDIO_AC3; stream_codec = TC_CODEC_AC3; } if (strcmp(codec,"mpeg2") == 0) { pack_sl = PACKAGE_VIDEO; stream_codec = TC_CODEC_MPEG2; } if (strcmp(codec,"mp3") == 0) { pack_sl = PACKAGE_AUDIO_MP3; stream_codec = TC_CODEC_MP3; } if (strcmp(codec,"pcm") == 0) { pack_sl = PACKAGE_AUDIO_PCM; stream_codec = TC_CODEC_PCM; } if (strcmp(codec,"ps1") == 0) { pack_sl = PACKAGE_SUBTITLE; stream_codec = TC_CODEC_SUB; } break; case 't': if (optarg[0] == '-') usage(EXIT_FAILURE); magic = optarg; user = 1; break; case 's': if (optarg[0] == '-') usage(EXIT_FAILURE); subid = strtol(optarg, NULL, 16); break; case 'A': if (optarg[0] == '-') usage(EXIT_FAILURE); while (1) { x = strtol(str, &end, 0); if ((end == str) || (x < 1) || (x > 0xff)) { tc_log_error(EXE, "invalid parameter for option -A"); exit(1); } if (*end == '\0') { break; } if (*end != ',') { tc_log_error(EXE, "invalid parameter for option -A"); exit(1); } str = end + 1; new_pass = realloc(pass, (npass + 1) * sizeof (int)); if (new_pass == NULL) { tc_log_error(EXE, "out of memory"); exit(1); } pass = new_pass; pass[npass++] = (int)x; } break; case 'M': if (optarg[0] == '-') usage(EXIT_FAILURE); demux_mode = atoi(optarg); if (demux_mode == TC_DEMUX_OFF) verbose = TC_QUIET; if (demux_mode < 0 || demux_mode > TC_DEMUX_MAX_OPTS) { tc_log_error(EXE, "invalid parameter for option -M"); exit(1); } break; case 'a': if (optarg[0] == '-') usage(EXIT_FAILURE); if ((n = sscanf(optarg,"%d,%d", &a_track, &v_track)) <= 0) { tc_log_error(EXE, "invalid parameter for option -a"); exit(1); } break; case 'v': version(); exit(0); break; case 'h': usage(EXIT_SUCCESS); default: usage(EXIT_FAILURE); } } ac_init(AC_ALL); /* ------------------------------------------------------------ * fill out defaults for info structure * ------------------------------------------------------------*/ // assume defaults if (name == NULL) stream_stype=TC_STYPE_STDIN; // no autodetection yet if (argc == 1) { usage(EXIT_FAILURE); } // do not try to mess with the stream if (stream_stype == TC_STYPE_STDIN) { ipipe.fd_in = STDIN_FILENO; } else { if (tc_file_check(name)) exit(1); ipipe.fd_in = xio_open(name, O_RDONLY); if (ipipe.fd_in < 0) { tc_log_perror(EXE, "open file"); exit(1); } // try to find out the filetype stream_magic = fileinfo(ipipe.fd_in, 0); if (verbose) tc_log_msg(EXE, "(pid=%d) %s", getpid(), filetype(stream_magic)); } // fill out defaults for info structure ipipe.fd_out = STDOUT_FILENO; ipipe.magic = stream_magic; ipipe.stype = stream_stype; ipipe.codec = stream_codec; ipipe.verbose = verbose; ipipe.ps_unit = unit_seek; ipipe.ps_seq1 = resync_seq1; ipipe.ps_seq2 = resync_seq2; ipipe.demux = demux_mode; ipipe.select = pack_sl; ipipe.keep_seq = keep_initial_seq; ipipe.subid = subid; ipipe.fps = fps; ipipe.hard_fps_flag = hard_fps_flag; ipipe.track = a_track; ipipe.name = logfile; //FIXME: video defaults to 0 /* ------------------------------------------------------------ * main processing mode * ------------------------------------------------------------*/ if (npass > 0) tcdemux_pass_through(&ipipe, pass, npass); else tcdemux_thread(&ipipe); return 0; }
int main(int argc, char *argv[]) { int ch; int status = STATUS_OK; int show = SHOW_NONE; if (argc == 1) { usage(); return STATUS_BAD_PARAM; } libtc_init(&argc, &argv); while (1) { ch = getopt(argc, argv, "CFMPRhv?"); if (ch == -1) { break; } switch (ch) { case 'C': show |= SHOW_CODEC_LIST; break; case 'F': show |= SHOW_FORMAT_LIST; break; case 'M': show |= SHOW_MOD_PATH; break; case 'P': show |= SHOW_PROF_PATH; break; case 'R': show |= SHOW_REG_PATH; break; case 'v': version(); return STATUS_OK; case '?': /* fallthrough */ case 'h': /* fallthrough */ default: usage(); return STATUS_OK; } } /* FIXME: should we switch to the *default_path() functions? */ if (show & SHOW_MOD_PATH) { printf("%s\n", tc_module_default_path()); } if (show & SHOW_PROF_PATH) { printf("%s\n", tc_export_profile_default_path()); } if (show & SHOW_REG_PATH) { printf ("%s\n", tc_module_registry_default_path()); } if (show & SHOW_CODEC_LIST) { tc_codec_foreach(show_codec, stdout); } if (show & SHOW_FORMAT_LIST) { tc_format_foreach(show_format, stdout); } return status; }
int main(int argc, char *argv[]) { int ch; const char *filename = NULL; const char *modpath = MOD_PATH; #ifdef ENABLE_EXPERIMENTAL const char *modtype = "filter"; const char *modarg = ""; /* nothing */ const char *modcfg = ""; /* nothing */ #endif const char *socketfile = NULL; char options[OPTS_SIZE] = { '\0', }; int print_mod = 0; int connect_socket = 0; int ret = 0; int status = STATUS_NO_MODULE; /* needed by filter modules */ TCVHandle tcv_handle = tcv_init(); #ifdef ENABLE_EXPERIMENTAL TCFactory factory = NULL; TCModule module = NULL; #endif vframe_list_t ptr; memset(&ptr, 0, sizeof(ptr)); ac_init(AC_ALL); tc_config_set_dir(NULL); if (argc == 1) { usage(); return STATUS_BAD_PARAM; } libtc_init(&argc, &argv); while (1) { #ifdef ENABLE_EXPERIMENTAL ch = getopt(argc, argv, "C:d:i:?vhpm:M:s:t:"); #else /* !ENABLE_EXPERIMENTAL */ ch = getopt(argc, argv, "d:i:?vhps:"); #endif if (ch == -1) { break; } switch (ch) { case 'd': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } verbose = atoi(optarg); break; case 'i': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } filename = optarg; break; #ifdef ENABLE_EXPERIMENTAL case 'C': modcfg = optarg; break; case 'm': modpath = optarg; break; case 'M': modarg = optarg; break; case 't': if (!optarg) { usage(); return STATUS_BAD_PARAM; } if (!strcmp(optarg, "filter") || !strcmp(optarg, "encode") || !strcmp(optarg, "multiplex")) { modtype = optarg; } else { modtype = NULL; } break; #endif case 's': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } connect_socket = 1; socketfile = optarg; break; case 'p': print_mod = 1; break; case 'v': version(); return STATUS_OK; case '?': /* fallthrough */ case 'h': /* fallthrough */ default: usage(); return STATUS_OK; } } if (print_mod) { printf("%s\n", modpath); return STATUS_OK; } if (connect_socket) { do_connect_socket(socketfile); return STATUS_OK; } if (!filename) { usage(); return STATUS_BAD_PARAM; } #ifdef ENABLE_EXPERIMENTAL if (!modtype || !strcmp(modtype, "import")) { tc_log_error(EXE, "Unknown module type (not in filter, encode, multiplex)"); return STATUS_BAD_PARAM; } if (strlen(modcfg) > 0 && strlen(modarg) > 0) { tc_log_error(EXE, "Cannot configure and inspect module on the same time"); return STATUS_BAD_PARAM; } /* * we can't distinguish from OMS and NMS modules at glance, so try * first using new module system */ factory = tc_new_module_factory(modpath, TC_MAX(verbose - 4, 0)); module = tc_new_module(factory, modtype, filename, TC_NONE); if (module != NULL) { const char *answer = NULL; if (verbose >= TC_DEBUG) { tc_log_info(EXE, "using new module system"); } if (strlen(modcfg) > 0) { int ret = tc_module_configure(module, modcfg, tc_get_vob()); if (ret == TC_OK) { status = STATUS_OK; } else { status = STATUS_MODULE_FAILED; tc_log_error(EXE, "configure returned error"); } tc_module_stop(module); } else { if (verbose >= TC_INFO) { /* overview and options */ tc_module_inspect(module, "help", &answer); puts(answer); /* module capabilities */ tc_module_show_info(module, verbose); } if (strlen(modarg) > 0) { tc_log_info(EXE, "informations about '%s' for " "module:", modarg); tc_module_inspect(module, modarg, &answer); puts(answer); } status = STATUS_OK; } tc_del_module(factory, module); } else if (!strcmp(modtype, "filter")) #endif /* ENABLE_EXPERIMENTAL */ { char namebuf[NAME_LEN]; #ifdef ENABLE_EXPERIMENTAL /* compatibility support only for filters */ if (verbose >= TC_DEBUG) { tc_log_info(EXE, "using old module system"); } #endif /* ok, fallback to old module system */ strlcpy(namebuf, filename, NAME_LEN); filter[0].name = namebuf; ret = load_plugin(modpath, 0, verbose); if (ret != 0) { tc_log_error(__FILE__, "unable to load filter `%s' (path=%s)", filter[0].name, modpath); status = STATUS_NO_MODULE; } else { strlcpy(options, "help", OPTS_SIZE); ptr.tag = TC_FILTER_INIT; if ((ret = filter[0].entry(&ptr, options)) != 0) { status = STATUS_MODULE_ERROR; } else { memset(options, 0, OPTS_SIZE); ptr.tag = TC_FILTER_GET_CONFIG; ret = filter[0].entry(&ptr, options); if (ret == 0) { if (verbose >= TC_INFO) { fputs("START\n", stdout); fputs(options, stdout); fputs("END\n", stdout); } status = STATUS_OK; } } } } #ifdef ENABLE_EXPERIMENTAL ret = tc_del_module_factory(factory); #endif tcv_free(tcv_handle); return status; }
int main(int argc, char *argv[]) { int ch; const char *filename = NULL; const char *modpath = tc_module_default_path(); const char *regpath = tc_module_registry_default_path(); const char *modtype = "filter"; const char *modarg = ""; /* nothing */ const char *modcfg = ""; /* nothing */ const char *socketfile = NULL; const char *fmtname = NULL; int print_mod = 0; int connect_socket = 0; int ret = 0; int status = STATUS_NO_MODULE; /* needed by filter modules */ TCVHandle tcv_handle = tcv_init(); TCRegistry registry = NULL; TCFactory factory = NULL; TCModule module = NULL; ac_init(AC_ALL); tc_ext_init(); if (argc == 1) { usage(); return STATUS_BAD_PARAM; } libtc_init(&argc, &argv); while (1) { ch = getopt(argc, argv, "C:F:d:i:?vhpm:M:r:s:t:"); if (ch == -1) { break; } switch (ch) { case 'd': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } verbose = atoi(optarg); break; case 'i': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } filename = optarg; break; case 'C': modcfg = optarg; break; case 'F': fmtname = optarg; break; case 'm': modpath = optarg; break; case 'M': modarg = optarg; break; case 'r': regpath = optarg; break; case 't': if (!optarg) { usage(); return STATUS_BAD_PARAM; } if (!strcmp(optarg, "filter") || !strcmp(optarg, "encode") || !strcmp(optarg, "multiplex")) { modtype = optarg; } else { modtype = NULL; } break; case 's': if (optarg[0] == '-') { usage(); return STATUS_BAD_PARAM; } connect_socket = 1; socketfile = optarg; break; case 'p': print_mod = 1; break; case 'v': version(); return STATUS_OK; case '?': /* fallthrough */ case 'h': /* fallthrough */ default: usage(); return STATUS_OK; } } if (print_mod) { printf("%s\n", modpath); return STATUS_OK; } if (connect_socket) { do_connect_socket(socketfile); return STATUS_OK; } if (!filename && !fmtname) { usage(); return STATUS_BAD_PARAM; } if (!modtype || !strcmp(modtype, "import")) { tc_log_error(EXE, "Unknown module type (not in filter, encode, multiplex)"); return STATUS_BAD_PARAM; } if (strlen(modcfg) > 0 && strlen(modarg) > 0) { tc_log_error(EXE, "Cannot configure and inspect module on the same time"); return STATUS_BAD_PARAM; } /* * we can't distinguish from OMS and NMS modules at glance, so try * first using new module system */ factory = tc_new_module_factory(modpath, TC_MAX(verbose - 4, 0)); /* FIXME */ registry = tc_new_module_registry(factory, regpath, TC_MAX(verbose - 4, 0)); /* FIXME */ if (fmtname) { TCCodecID codec = tc_codec_from_string(fmtname); TCFormatID format = tc_format_from_string(fmtname); if (codec == TC_CODEC_ERROR && format == TC_FORMAT_ERROR) { tc_log_error(EXE, "unrecognized format `%s'", fmtname); } else { const char *modnames = tc_get_module_name_for_format(registry, modtype, fmtname); if (modnames) { puts(modnames); } } } else { module = tc_new_module(factory, modtype, filename, TC_NONE); if (module != NULL) { status = query_new_module(module, modcfg, modarg); tc_del_module(factory, module); } else if (!strcmp(modtype, "filter")) { status = query_old_module(filename, modpath); } } ret = tc_del_module_registry(registry); ret = tc_del_module_factory(factory); tcv_free(tcv_handle); return status; }
int main(int argc, char *argv[]) { info_t ipipe; int user=0; long stream_stype = TC_STYPE_UNKNOWN, stream_magic = TC_MAGIC_UNKNOWN, stream_codec = TC_CODEC_UNKNOWN; int ch, done=0, track=0; char *magic=NULL, *codec=NULL, *name=NULL; //proper initialization memset(&ipipe, 0, sizeof(info_t)); ipipe.frame_limit[0]=0; ipipe.frame_limit[1]=LONG_MAX; libtc_init(&argc, &argv); while ((ch = getopt(argc, argv, "d:x:i:f:a:vt:C:?h")) != -1) { switch (ch) { case 'i': if(optarg[0]=='-') usage(EXIT_FAILURE); name = optarg; break; case 'd': if(optarg[0]=='-') usage(EXIT_FAILURE); verbose = atoi(optarg); break; case 'x': if(optarg[0]=='-') usage(EXIT_FAILURE); codec = optarg; break; case 'f': if(optarg[0]=='-') usage(EXIT_FAILURE); ipipe.nav_seek_file = optarg; break; case 't': if(optarg[0]=='-') usage(EXIT_FAILURE); magic = optarg; user=1; break; case 'a': if(optarg[0]=='-') usage(EXIT_FAILURE); track = strtol(optarg, NULL, 0); break; case 'C': if(optarg[0]=='-') usage(EXIT_FAILURE); if (2 != sscanf(optarg,"%ld-%ld", &ipipe.frame_limit[0], &ipipe.frame_limit[1])) usage(EXIT_FAILURE); if (ipipe.frame_limit[0] > ipipe.frame_limit[1]) { tc_log_error(EXE, "Invalid -C options"); usage(EXIT_FAILURE); } break; case 'v': version(); exit(0); break; case 'h': usage(EXIT_SUCCESS); default: usage(EXIT_FAILURE); } } ac_init(AC_ALL); /* ------------------------------------------------------------ * * fill out defaults for info structure * * ------------------------------------------------------------*/ // assume defaults if(name==NULL) stream_stype=TC_STYPE_STDIN; // no autodetection yet if(codec==NULL && magic==NULL) { tc_log_error(EXE, "invalid codec %s", codec); usage(EXIT_FAILURE); } if(codec==NULL) codec=""; // do not try to mess with the stream if(stream_stype!=TC_STYPE_STDIN) { if(tc_file_check(name)) exit(1); if((ipipe.fd_in = xio_open(name, O_RDONLY))<0) { tc_log_perror(EXE, "file open"); return(-1); } stream_magic = fileinfo(ipipe.fd_in, 0); if(verbose & TC_DEBUG) tc_log_msg(EXE, "(pid=%d) %s", getpid(), filetype(stream_magic)); } else ipipe.fd_in = STDIN_FILENO; if(verbose & TC_DEBUG) tc_log_msg(EXE, "(pid=%d) starting, doing %s", getpid(), codec); // fill out defaults for info structure ipipe.fd_out = STDOUT_FILENO; ipipe.magic = stream_magic; ipipe.stype = stream_stype; ipipe.codec = stream_codec; ipipe.track = track; ipipe.select = TC_VIDEO; ipipe.verbose = verbose; ipipe.name = name; /* ------------------------------------------------------------ * * codec specific section * * note: user provided magic values overwrite autodetection! * * ------------------------------------------------------------*/ if(magic==NULL) magic=""; // OGM if (ipipe.magic == TC_MAGIC_OGG) { // dummy for video if(strcmp(codec, "raw")==0) ipipe.codec = TC_CODEC_RGB24; if((strcmp(codec, "vorbis")==0) || (strcmp(codec, "ogg")==0)) { ipipe.codec = TC_CODEC_VORBIS; ipipe.select = TC_AUDIO; } if(strcmp(codec, "mp3")==0) { ipipe.codec = TC_CODEC_MP3; ipipe.select = TC_AUDIO; } if(strcmp(codec, "pcm")==0) { ipipe.codec = TC_CODEC_PCM; ipipe.select = TC_AUDIO; } extract_ogm(&ipipe); done = 1; } // MPEG2 if(strcmp(codec,"mpeg2")==0) { ipipe.codec = TC_CODEC_MPEG2; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; if(strcmp(magic, "m2v")==0) ipipe.magic = TC_MAGIC_M2V; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; extract_mpeg2(&ipipe); done = 1; } // PCM if(strcmp(codec,"pcm")==0) { ipipe.codec = TC_CODEC_PCM; ipipe.select = TC_AUDIO; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "wav")==0) ipipe.magic = TC_MAGIC_WAV; extract_pcm(&ipipe); done = 1; } // SUBTITLE (private_stream_1) if(strcmp(codec,"ps1")==0) { ipipe.codec = TC_CODEC_PS1; ipipe.select = TC_AUDIO; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; if(strcmp(magic, "vdr")==0) ipipe.magic = TC_MAGIC_VDR; extract_ac3(&ipipe); done = 1; } // DV if(strcmp(codec,"dv")==0) { ipipe.codec = TC_CODEC_DV; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; extract_dv(&ipipe); done = 1; } // RGB if(strcmp(codec,"rgb")==0) { ipipe.codec = TC_CODEC_RGB24; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "wav")==0) ipipe.magic = TC_MAGIC_WAV; extract_rgb(&ipipe); done = 1; } // DTS if(strcmp(codec,"dts")==0) { ipipe.codec = TC_CODEC_DTS; ipipe.select = TC_AUDIO; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; extract_ac3(&ipipe); done = 1; } // AC3 if(strcmp(codec,"ac3")==0) { ipipe.codec = TC_CODEC_AC3; ipipe.select = TC_AUDIO; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; extract_ac3(&ipipe); done = 1; } // MP3 if(strcmp(codec,"mp3")==0 || strcmp(codec,"mp2")==0) { ipipe.codec = TC_CODEC_MP3; ipipe.select = TC_AUDIO; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "vob")==0) ipipe.magic = TC_MAGIC_VOB; extract_mp3(&ipipe); done = 1; } // YUV420P if(strcmp(codec,"yuv420p")==0) { ipipe.codec = TC_CODEC_YUV420P; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "yuv4mpeg")==0) ipipe.magic = TC_MAGIC_YUV4MPEG; extract_yuv(&ipipe); done = 1; } // YUV422P if(strcmp(codec,"yuv422p")==0) { ipipe.codec = TC_CODEC_YUV422P; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; if(strcmp(magic, "yuv4mpeg")==0) ipipe.magic = TC_MAGIC_YUV4MPEG; extract_yuv(&ipipe); done = 1; } // UYVY if(strcmp(codec,"uyvy")==0) { ipipe.codec = TC_CODEC_UYVY; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; extract_yuv(&ipipe); done = 1; } // LZO if(strcmp(codec,"lzo")==0) { ipipe.codec = TC_CODEC_YUV420P; if(strcmp(magic, "avi")==0) ipipe.magic = TC_MAGIC_AVI; if(strcmp(magic, "raw")==0) ipipe.magic = TC_MAGIC_RAW; extract_lzo(&ipipe); done = 1; } // AVI extraction //need to check if there isn't a codec from the input option (if we have a file with TC_MAGIC_AVI and we specify -x pcm we have pcm and rgb output) if ((strcmp(magic, "avi")==0 || ipipe.magic==TC_MAGIC_AVI)&& (codec == NULL)) { ipipe.magic=TC_MAGIC_AVI; extract_avi(&ipipe); done = 1; } if (strcmp(codec, "raw")==0 || strcmp(codec, "video")==0) { ipipe.select=TC_VIDEO-1; ipipe.magic=TC_MAGIC_AVI; extract_avi(&ipipe); done = 1; } if(!done) { tc_log_error(EXE, "(pid=%d) unable to handle codec %s", getpid(), codec); exit(1); } if(ipipe.fd_in != STDIN_FILENO) xio_close(ipipe.fd_in); return(0); }