static void* stream_thread_main(void *args) { int status; thread_args_t *thread_args; fprintf(stderr, "start streaming thread\n"); /* initialize global state variables used in this thread */ g_busy = 1; g_stop = 0; g_paused = 0; thread_args = (thread_args_t*)args; /* go into loop which reads from connection and parses it to dev */ status = stream_loop(thread_args->mh, thread_args->stream_socket); fprintf(stderr, "close stream_thread\n"); fprintf(stderr, "%s\n", mpg123_plain_strerror(status)); close(thread_args->stream_socket); write(g_cmd_sock, REMOTE_CMD_DONE, strlen(REMOTE_CMD_DONE)); close_cmd_sock(); free(thread_args); g_busy = 0; return NULL; }
//respond to user clicks void Stream::on_pushButton_clicked() { QString text = uiStream->pushButton->text(); if(text == "Start") { uiStream->pushButton->setText("Stop"); uiStream->pushButton->setStyleSheet("QPushButton { background-color:" "rgb(19,235,67,255); }"); loop = true; } else { uiStream->pushButton->setText("Start"); uiStream->pushButton->setStyleSheet("QPushButton { background-color: red; }"); loop = false; } stream_loop(); }
int main (int argc, char ** argv) { vbi_bool success; if (!init_window (argc, argv)) exit (EXIT_FAILURE); vbi = vbi_decoder_new (); assert (NULL != vbi); success = vbi_event_handler_add (vbi, VBI_EVENT_CAPTION, cc_handler, /* used_data */ NULL); assert (success); if (isatty (STDIN_FILENO)) { hello_world (); } else { struct stream *st; st = read_stream_new (/* filename: stdin */ NULL, FILE_FORMAT_SLICED, /* ts_pid */ 0, decode_frame); stream_loop (st); stream_delete (st); } printf ("Done.\n"); for (;;) xevent (33333); vbi_decoder_delete (vbi); exit (EXIT_SUCCESS); }
int main (int argc, char ** argv) { const char *module_name; unsigned int n_pages; vbi_bool all_pages; init_helpers (argc, argv); option_in_file_format = FILE_FORMAT_SLICED; option_default_fg = (vbi_rgba) 0xFFFFFF; option_default_bg = (vbi_rgba) 0x000000; all_pages = FALSE; for (;;) { int c; c = getopt_long (argc, argv, short_options, long_options, &option_index); if (-1 == c) break; switch (c) { case 0: /* getopt_long() flag */ break; case '1': /* Compatibility (used to be pgno -1). */ all_pages = TRUE; break; case 'a': /* For debugging. */ assert (NULL != optarg); option_target = strtoul (optarg, NULL, 0); break; case 'c': option_dcc = TRUE; break; case 'd': option_padding = TRUE; break; case 'e': option_pdc_enum = TRUE; break; case 'f': option_fast = TRUE; break; case 'g': option_dump_pg = TRUE; break; case 'h': usage (stdout); exit (EXIT_SUCCESS); case 'i': assert (NULL != optarg); option_in_file_name = optarg; break; case 'l': option_hyperlinks = TRUE; break; case 'm': list_modules (); exit (EXIT_SUCCESS); case 'n': option_navigation = TRUE; break; case 'o': parse_output_option (); break; case 'p': option_pdc_links = TRUE; break; case 'q': parse_option_quiet (); break; case 'r': option_row_update = TRUE; break; case 's': option_subtitles = TRUE; break; case 'v': parse_option_verbose (); break; case 'w': option_delay += 1; break; case 'A': option_panels = TRUE; break; case 'B': assert (NULL != optarg); option_default_bg = strtoul (optarg, NULL, 0); break; case 'C': assert (NULL != optarg); option_default_cs = strtoul (optarg, NULL, 0); have_option_default_cs = TRUE; break; case 'F': assert (NULL != optarg); option_default_fg = strtoul (optarg, NULL, 0); break; case 'H': option_header_only = TRUE; break; case 'O': assert (NULL != optarg); option_override_cs = strtoul (optarg, NULL, 0); break; case 'P': option_in_file_format = FILE_FORMAT_DVB_PES; break; case 'T': option_in_ts_pid = parse_option_ts (); option_in_file_format = FILE_FORMAT_DVB_TS; break; case 'V': printf (PROGRAM_NAME " " VERSION "\n"); exit (EXIT_SUCCESS); default: usage (stderr); exit (EXIT_FAILURE); } } option_pdc_links |= option_pdc_enum; if (argc - optind < 1) { usage (stderr); exit (EXIT_FAILURE); } module_name = argv[optind++]; pt = vbi_page_table_new (); if (NULL == pt) no_mem_exit (); if (all_pages) { /* Compatibility. */ out_file_name_prefix = strdup ("test"); if (NULL == out_file_name_prefix) no_mem_exit (); } else { parse_page_numbers (argc - optind, &argv[optind]); } n_pages = vbi_page_table_num_pages (pt); if (1 != n_pages && option_delay > 0) { error_exit (_("The --wait option requires " "a single page number.")); } if (NULL == out_file_name_prefix) { switch (n_pages) { case 0: /* all pages? */ error_exit (_("No page number or " "output file name specified.")); break; case 1: /* one page to stdout */ break; default: /* multiple pages */ error_exit (_("No output file name specified.")); break; } } init_export_module (module_name); init_vbi_decoder (); cr = isatty (STDERR_FILENO) ? '\r' : '\n'; rst = read_stream_new (option_in_file_name, option_in_file_format, option_in_ts_pid, decode_frame); stream_loop (rst); stream_delete (rst); rst = NULL; vbi_decoder_delete (vbi); vbi = NULL; finalize (); free (out_file_name_prefix); out_file_name_prefix = NULL; free (out_file_name_suffix); out_file_name_suffix = NULL; if (!option_subtitles) { n_pages = vbi_page_table_num_pages (pt); if (1 == n_pages) { vbi_pgno pgno = 0; vbi_page_table_next_page (pt, &pgno); error_exit (_("End of stream. Page %03x not found."), pgno); } else if (n_pages > 0) { error_exit (_("End of stream. %u pages not found.")); } } vbi_page_table_delete (pt); pt = NULL; vbi_export_delete (ex); ex = NULL; exit (EXIT_SUCCESS); }
int main (int argc, char ** argv) { init_helpers (argc, argv); option_in_file_format = FILE_FORMAT_SLICED; option_start_time = 0.0; option_end_time = 1e30; for (;;) { int c; c = getopt_long (argc, argv, short_options, long_options, &option_index); if (-1 == c) break; switch (c) { case 0: /* getopt_long() flag */ break; case 'a': option_abort_on_error = TRUE; break; case 'h': usage (stdout); exit (EXIT_SUCCESS); case 'i': assert (NULL != optarg); option_in_file_name = optarg; break; case 'o': assert (NULL != optarg); option_out_file_name = optarg; break; case 'q': parse_option_quiet (); break; case 's': option_keep_ttx_system_pages = TRUE; break; case 't': parse_option_time (); break; case 'v': parse_option_verbose (); break; case 'x': option_experimental_output = TRUE; break; case 'P': option_in_file_format = FILE_FORMAT_DVB_PES; break; case 'T': option_in_ts_pid = parse_option_ts (); option_in_file_format = FILE_FORMAT_DVB_TS; break; case 'V': printf (PROGRAM_NAME " " VERSION "\n"); exit (EXIT_SUCCESS); default: usage (stderr); exit (EXIT_FAILURE); } } sf = vbi_sliced_filter_new (/* callback */ NULL, /* user_data */ NULL); if (NULL == sf) no_mem_exit (); vbi_sliced_filter_keep_ttx_system_pages (sf, option_keep_ttx_system_pages); assert (argc >= optind); parse_page_numbers (argc - optind, &argv[optind]); sliced_blank.id = VBI_SLICED_TELETEXT_B_L10_625; sliced_blank.line = 7; if (option_experimental_output) { wst = write_stream_new (option_out_file_name, FILE_FORMAT_XML, /* ts_pid */ 0, /* system */ 625); } else { wst = write_stream_new (option_out_file_name, FILE_FORMAT_SLICED, /* ts_pid */ 0, /* system */ 625); } rst = read_stream_new (option_in_file_name, option_in_file_format, option_in_ts_pid, filter_frame); stream_loop (rst); stream_delete (rst); rst = NULL; stream_delete (wst); wst = NULL; error_msg (_("End of stream.")); exit (EXIT_SUCCESS); return 0; }