diff --git a/avs2bdnxml.c b/avs2bdnxml.c index fa3205b..cd94005 100644 --- a/avs2bdnxml.c +++ b/avs2bdnxml.c @@ -327,7 +327,7 @@ void get_dir_path(char *filename, char *dir_path) /* Get absolute path of output XML file */ if (_fullpath(abs_path, filename, MAX_PATH) == NULL) { - fprintf(stderr, "Cannot determine absolute path for: %s\n", filename); + printf( "Cannot determine absolute path for: %s\n", filename); exit(1); } @@ -338,7 +338,7 @@ void get_dir_path(char *filename, char *dir_path) if (strlen(dir_path) > MAX_PATH - 16) { - fprintf(stderr, "Path for PNG files too long.\n"); + printf( "Path for PNG files too long.\n"); exit(1); } } @@ -372,7 +372,7 @@ void write_png(char *dir, int file_id, uint8_t *image, int w, int h, int graphic png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - fprintf(stderr, "Cannot create png_ptr.\n"); + printf( "Cannot create png_ptr.\n"); exit(1); } @@ -381,7 +381,7 @@ void write_png(char *dir, int file_id, uint8_t *image, int w, int h, int graphic if (info_ptr == NULL) { png_destroy_write_struct(&png_ptr, (png_infopp)NULL); - fprintf(stderr, "Cannot create info_ptr.\n"); + printf( "Cannot create info_ptr.\n"); exit(1); } @@ -390,7 +390,7 @@ void write_png(char *dir, int file_id, uint8_t *image, int w, int h, int graphic { png_destroy_write_struct(&png_ptr, &info_ptr); fclose(fh); - fprintf(stderr, "Error while writing PNG file: %s\n", filename); + printf( "Error while writing PNG file: %s\n", filename); exit(1); } @@ -536,9 +536,9 @@ int detect_sse2 () detection = (edx & 0x04000000) ? 1 : 0; if (detection) - fprintf(stderr, "CPU: Using SSE2 optimized functions.\n"); + printf( "CPU: Using SSE2 optimized functions.\n"); else - fprintf(stderr, "CPU: Using pure C functions.\n"); + printf( "CPU: Using pure C functions.\n"); return detection; } @@ -592,20 +592,20 @@ void mk_timecode (int frame, int fps, char *buf) /* buf must have length 12 (inc if (h > 99) { - fprintf(stderr, "Timecodes above 99:59:59:99 not supported: %u:%02u:%02u:%02u\n", h, m, s, frames); + printf( "Timecodes above 99:59:59:99 not supported: %u:%02u:%02u:%02u\n", h, m, s, frames); exit(1); } if (snprintf(buf, 12, "%02d:%02d:%02d:%02d", h, m, s, frames) != 11) { - fprintf(stderr, "Timecode lead to invalid format: %s\n", buf); + printf( "Timecode lead to invalid format: %s\n", buf); exit(1); } } void print_usage () { - fprintf(stderr, + printf( "avs2bdnxml 2.09\n\n" "Usage: avs2bdnxml [options] -o output input\n\n" "Input has to be an AviSynth script with RGBA as output colorspace\n\n" @@ -674,7 +674,7 @@ int parse_int(char *in, char *name, int *error) *error = 1; if (name != NULL) { - fprintf(stderr, "Error: Failed to parse integer (%s): %s\n", name, in); + printf( "Error: Failed to parse integer (%s): %s\n", name, in); exit(1); } } @@ -694,7 +694,7 @@ int parse_tc(char *in, int fps) if (strlen(in) != 2 * 4 + 3 || in[2] != ':' || in[5] != ':' || in[8] != ':') { - fprintf(stderr, "Error: Invalid timecode offset. Expected FRAMENUMBER or HH:MM:SS:FF, but got: %s\n", in); + printf( "Error: Invalid timecode offset. Expected FRAMENUMBER or HH:MM:SS:FF, but got: %s\n", in); exit(1); } in[2] = 0; @@ -912,7 +912,7 @@ int main (int argc, char *argv[]) out_filename[out_filename_idx++] = optarg; else { - fprintf(stderr, "No more than two output filenames allowed.\nIf more than one is used, the other must have a\ndifferent output format.\n"); + printf( "No more than two output filenames allowed.\nIf more than one is used, the other must have a\ndifferent output format.\n"); exit(0); } break; @@ -983,7 +983,7 @@ int main (int argc, char *argv[]) avs_filename = argv[optind]; else { - fprintf(stderr, "Only a single input file allowed.\n"); + printf( "Only a single input file allowed.\n"); return 1; } @@ -1016,13 +1016,13 @@ int main (int argc, char *argv[]) } else { - fprintf(stderr, "Output file extension must be \".xml\", \".sup\" or \".pgs\".\n"); + printf( "Output file extension must be \".xml\", \".sup\" or \".pgs\".\n"); return 1; } } if (sup_output > 1 || xml_output > 1) { - fprintf(stderr, "If more than one output filename is used, they must have\ndifferent output formats.\n"); + printf( "If more than one output filename is used, they must have\ndifferent output formats.\n"); exit(0); } @@ -1062,7 +1062,7 @@ int main (int argc, char *argv[]) } if (!have_fps) { - fprintf(stderr, "Error: Invalid framerate (%s).\n", frame_rate); + printf( "Error: Invalid framerate (%s).\n", frame_rate); return 1; } @@ -1085,7 +1085,7 @@ int main (int argc, char *argv[]) /* Check minimum size */ if (s_info->i_width < 8 || s_info->i_height < 8) { - fprintf(stderr, "Error: Video dimensions below 8x8 (%dx%d).\n", s_info->i_width, s_info->i_height); + printf( "Error: Video dimensions below 8x8 (%dx%d).\n", s_info->i_width, s_info->i_height); return 1; } @@ -1117,7 +1117,7 @@ int main (int argc, char *argv[]) /* No frames mean nothing to do */ if (count_frames < 1) { - fprintf(stderr, "No frames found.\n"); + printf( "No frames found.\n"); return 0; } @@ -1141,7 +1141,7 @@ int main (int argc, char *argv[]) { if (read_frame_avis(in_img, avis_hnd, i)) { - fprintf(stderr, "Error reading frame.\n"); + printf( "Error reading frame.\n"); return 1; } checked_empty = 0; @@ -1149,7 +1149,7 @@ int main (int argc, char *argv[]) /* Progress indicator */ if (i % (count_frames / progress_step) == 0) { - printf(stderr, "Progress: %d/%d - Lines: %d\r\n", i - init_frame, count_frames, num_of_events); + printf( "Progress: %d/%d - Lines: %d\r\n", i - init_frame, count_frames, num_of_events); } /* If we are outside any lines, check for empty frames first */ @@ -1230,7 +1230,7 @@ int main (int argc, char *argv[]) old_img = tmp; } - fprintf(stderr, "\rProgress: %d/%d - Lines: %d - Done\n", i - init_frame, count_frames, num_of_events); + printf( "\rProgress: %d/%d - Lines: %d - Done\n", i - init_frame, count_frames, num_of_events); /* Add last event, if available */ if (have_line) @@ -1265,7 +1265,7 @@ int main (int argc, char *argv[]) { if (!allow_empty) { - fprintf(stderr, "No events detected. Cowardly refusing to write XML file.\n"); + printf( "No events detected. Cowardly refusing to write XML file.\n"); return 0; } else @@ -1341,7 +1341,7 @@ int main (int argc, char *argv[]) /* Give runtime */ if (0) - fprintf(stderr, "Time elapsed: %lu\n", time(NULL) - bench_start); + printf( "Time elapsed: %lu\n", time(NULL) - bench_start); return 0; }