Indent activity.c

This commit is contained in:
Anshul Maheshwari 2015-05-19 11:37:41 +05:30
parent 2ed9789f9c
commit f9c26d8684

View File

@ -7,53 +7,54 @@ relevant events. */
static int credits_shown=0; static int credits_shown=0;
unsigned long net_activity_gui=0; unsigned long net_activity_gui=0;
/* Print current progress. For percentaje, -1 -> streaming mode */ /* Print current progress. For percentage, -1 -> streaming mode */
void activity_progress (int percentaje, int cur_min, int cur_sec) void activity_progress (int percentage, int cur_min, int cur_sec)
{ {
if (!ccx_options.no_progress_bar) if (!ccx_options.no_progress_bar)
{ {
if (percentaje==-1) if (percentage==-1)
mprint ("\rStreaming | %02d:%02d", cur_min, cur_sec); mprint ("\rStreaming | %02d:%02d", cur_min, cur_sec);
else else
mprint ("\r%3d%% | %02d:%02d",percentaje, cur_min, cur_sec); mprint ("\r%3d%% | %02d:%02d",percentage, cur_min, cur_sec);
} }
fflush (stdout); fflush (stdout);
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###PROGRESS#%d#%d#%d\n", percentaje, cur_min, cur_sec); fprintf (stderr, "###PROGRESS#%d#%d#%d\n", percentage, cur_min, cur_sec);
fflush (stderr); fflush (stderr);
} }
} }
void activity_input_file_open (const char *filename) void activity_input_file_open (const char *filename)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###INPUTFILEOPEN#%s\n", filename); fprintf (stderr, "###INPUTFILEOPEN#%s\n", filename);
fflush (stderr); fflush (stderr);
} }
} }
void activity_library_process(enum ccx_common_logging_gui message_type, ...){ void activity_library_process(enum ccx_common_logging_gui message_type, ...)
{
if (ccx_options.gui_mode_reports){ if (ccx_options.gui_mode_reports){
va_list args; va_list args;
va_start(args, message_type); va_start(args, message_type);
switch (message_type) switch (message_type)
{ {
case CCX_COMMON_LOGGING_GUI_XDS_CALL_LETTERS: case CCX_COMMON_LOGGING_GUI_XDS_CALL_LETTERS:
vfprintf(stderr, "###XDSNETWORKCALLLETTERS#%s\n",args); vfprintf(stderr, "###XDSNETWORKCALLLETTERS#%s\n",args);
break; break;
case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_DESCRIPTION: case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_DESCRIPTION:
vfprintf(stderr, "###XDSPROGRAMDESC#%d#%s\n", args); vfprintf(stderr, "###XDSPROGRAMDESC#%d#%s\n", args);
break; break;
case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_ID_NR: case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_ID_NR:
vfprintf(stderr, "###XDSPROGRAMIDENTIFICATIONNUMBER#%u#%u#%u#%u\n", args); vfprintf(stderr, "###XDSPROGRAMIDENTIFICATIONNUMBER#%u#%u#%u#%u\n", args);
break; break;
case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_NAME: case CCX_COMMON_LOGGING_GUI_XDS_PROGRAM_NAME:
vfprintf(stderr, "###XDSPROGRAMNAME#%s\n", args); vfprintf(stderr, "###XDSPROGRAMNAME#%s\n", args);
break; break;
default: default:
break; break;
} }
fflush(stderr); fflush(stderr);
va_end(args); va_end(args);
@ -61,65 +62,65 @@ void activity_library_process(enum ccx_common_logging_gui message_type, ...){
} }
void activity_video_info (int hor_size,int vert_size, void activity_video_info (int hor_size,int vert_size,
const char *aspect_ratio, const char *framerate) const char *aspect_ratio, const char *framerate)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###VIDEOINFO#%u#%u#%s#%s\n", fprintf (stderr, "###VIDEOINFO#%u#%u#%s#%s\n",
hor_size,vert_size, aspect_ratio, framerate); hor_size,vert_size, aspect_ratio, framerate);
fflush (stderr); fflush (stderr);
} }
} }
void activity_message (const char *fmt, ...) void activity_message (const char *fmt, ...)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
va_list args; va_list args;
fprintf (stderr, "###MESSAGE#"); fprintf (stderr, "###MESSAGE#");
va_start(args, fmt); va_start(args, fmt);
fprintf(stderr, fmt, args); fprintf(stderr, fmt, args);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
va_end(args); va_end(args);
fflush (stderr); fflush (stderr);
} }
} }
void activity_input_file_closed (void) void activity_input_file_closed (void)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###INPUTFILECLOSED\n"); fprintf (stderr, "###INPUTFILECLOSED\n");
fflush (stderr); fflush (stderr);
} }
} }
void activity_program_number (unsigned program_number) void activity_program_number (unsigned program_number)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###TSPROGRAMNUMBER#%u\n",program_number); fprintf (stderr, "###TSPROGRAMNUMBER#%u\n", program_number);
fflush (stderr); fflush (stderr);
} }
} }
void activity_report_version (void) void activity_report_version (void)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###VERSION#CCExtractor#%s\n",VERSION); fprintf (stderr, "###VERSION#CCExtractor#%s\n", VERSION);
fflush (stderr); fflush (stderr);
} }
} }
void activity_report_data_read (void) void activity_report_data_read (void)
{ {
if (ccx_options.gui_mode_reports) if (ccx_options.gui_mode_reports)
{ {
fprintf (stderr, "###DATAREAD#%lu\n",net_activity_gui/1000); fprintf (stderr, "###DATAREAD#%lu\n", net_activity_gui/1000);
fflush (stderr); fflush (stderr);
} }
} }
@ -127,7 +128,7 @@ void activity_header (void)
{ {
if (!credits_shown) if (!credits_shown)
{ {
credits_shown=1; credits_shown = 1;
mprint ("CCExtractor %s, Carlos Fernandez Sanz, Volker Quetschke.\n", VERSION); mprint ("CCExtractor %s, Carlos Fernandez Sanz, Volker Quetschke.\n", VERSION);
mprint ("Teletext portions taken from Petr Kutalek's telxcc\n"); mprint ("Teletext portions taken from Petr Kutalek's telxcc\n");
mprint ("--------------------------------------------------------------------------\n"); mprint ("--------------------------------------------------------------------------\n");