Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
I sent out a new patch yesterday under a different subject line, but it looks like it did not make through it. Is this list a moderated one? Anyway, please ignore yesterday's patch if you have not had a chance to look at it. Please use this following patch, which is against 1283. It contains: 1. atsc_epg bug fix: when ETM message gets longer than 256 characters, the last character was chopped, due to incorrect calling to snprintf(). 2. atsc_epg code cleanup: - error report function re-factored. - white space added after keywords; - hard wrap around column 80 removed; - one-line conditional statement now w/o brackets. 3. scan Makefile workaround for building in gcc4.4/kernel 2.6.30 was not picked up yet, include again. Regards, Signed-off-by: Yufei Yuan diff -upr dvb-apps/util/atsc_epg/atsc_epg.c dvb-apps_local/util/atsc_epg/atsc_epg.c --- dvb-apps/util/atsc_epg/atsc_epg.c 2009-06-22 12:13:04.136925772 -0500 +++ dvb-apps_local/util/atsc_epg/atsc_epg.c 2009-06-22 13:17:15.287986505 -0500 @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,18 @@ #define MAX_NUM_CHANNELS 16 #define MAX_NUM_EVENTS_PER_CHANNEL (4 * 24 * 7) +static inline void print_error(const char *s, const char *f, ...) +{ + va_list ap; + + va_start(ap, f); + fprintf(stderr, "%s(): ", s); + vfprintf(stderr, f, ap); + fprintf(stderr, "\n"); +} + +#define error_msg(format, ...) print_error(__FUNCTION__, format, ## __VA_ARGS__) + static int atsc_scan_table(int dmxfd, uint16_t pid, enum atsc_section_tag tag, void **table_section); @@ -168,9 +181,8 @@ void *(*table_callback[16])(struct atsc_ static void int_handler(int sig_num) { - if(SIGINT != sig_num) { + if (SIGINT != sig_num) return; - } ctrl_c = 1; } @@ -219,8 +231,9 @@ static void help(void) static int close_frontend(struct dvbfe_handle *fe) { - if(NULL == fe) { - fprintf(stderr, "%s(): NULL pointer detected\n", __FUNCTION__); + if (NULL == fe) { + error_msg("NULL pointer detected"); + return -1; } dvbfe_close(fe); @@ -232,24 +245,21 @@ static int open_frontend(struct dvbfe_ha { struct dvbfe_info fe_info; - if(NULL == (*fe = dvbfe_open(adapter, 0, 0))) { - fprintf(stderr, "%s(): error calling dvbfe_open()\n", - __FUNCTION__); + if (NULL == (*fe = dvbfe_open(adapter, 0, 0))) { + error_msg("error calling dvbfe_open()"); return -1; } dvbfe_get_info(*fe, 0, &fe_info, DVBFE_INFO_QUERYTYPE_IMMEDIATE, 0); - if(DVBFE_TYPE_ATSC != fe_info.type) { - fprintf(stderr, "%s(): only ATSC frontend supported currently\n", - __FUNCTION__); + if (DVBFE_TYPE_ATSC != fe_info.type) { + error_msg("only ATSC frontend supported currently"); return -1; } fe_info.feparams.frequency = frequency; fe_info.feparams.inversion = DVBFE_INVERSION_AUTO; fe_info.feparams.u.atsc.modulation = DVBFE_ATSC_MOD_VSB_8; fprintf(stdout, "tuning to %d Hz, please wait...\n", frequency); - if(dvbfe_set(*fe, &fe_info.feparams, TIMEOUT * 1000)) { - fprintf(stderr, "%s(): cannot lock to %d Hz in %d seconds\n", - __FUNCTION__, frequency, TIMEOUT); + if (dvbfe_set(*fe, &fe_info.feparams, TIMEOUT * 1000)) { + error_msg("cannot lock to %d Hz in %d seconds", frequency, TIMEOUT); return -1; } fprintf(stdout, "tuner locked.\n"); @@ -257,7 +267,7 @@ static int open_frontend(struct dvbfe_ha return 0; } -#if ENABLE_RRT +#ifdef ENABLE_RRT /* this is untested as since this part of the library is broken */ static int parse_rrt(int dmxfd) { @@ -270,20 +280,18 @@ static int parse_rrt(int dmxfd) i = 0; fprintf(stdout, "waiting for RRT: "); fflush(stdout); - while(i < RRT_TIMEOUT) { + while (i < RRT_TIMEOUT) { ret = atsc_scan_table(dmxfd, ATSC_BASE_PID, tag, (void **)&rrt); - if(0 > ret) { - fprintf(stderr, "%s(): error calling atsc_scan_table()\n", - __FUNCTION__); + if (0 > ret) { + error_msg("error calling atsc_scan_table()"); return -1; } - if(0 == ret) { - if(RRT_TIMEOUT > i) { + if (0 == ret) { + if (RRT_TIMEOUT > i) { fprintf(stdout, ".");
Re: [Patch] dvb-apps: code cleanup and bug fix.
The Makefile part of the last patch was not correct. Please use this one, sorry. --- dvb-apps/util/scan/Makefile 2009-06-20 12:28:52.544986677 -0500 +++ dvb-apps_local/util/scan/Makefile 2009-06-20 12:27:08.597924784 -0500 @@ -14,7 +14,7 @@ inst_bin = $(binaries) removing = atsc_psip_section.c atsc_psip_section.h -CPPFLAGS += -DDATADIR=\"$(prefix)/share\" +CPPFLAGS += -Wno-packed-bitfield-compat -D__KERNEL_STRICT_NAMES -DDATADIR=\"$(prefix)/share\" .PHONY: all On Sat, 2009-06-20 at 12:16 -0500, Yufei Yuan wrote: > This patch is against dvb-apps 1281. Following is what has been done: > > 1. atsc_epg bug fix: when ETM message gets longer than 256 characters, the > last > character was chopped, due to incorrect calling to snprintf(). > 2. atsc_epg code cleanup: > - white space added after keywords; > - hard wrap around column 80 removed; > - one-line conditional statement now w/o brackets. > 3. scan Makefile workaround for building in gcc4.4/kernel 2.6.30 was not > picked up in 1279, include again. > > Regards, > > Signed-off-by: Yufei Yuan > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[Patch] dvb-apps: code cleanup and bug fix.
This patch is against dvb-apps 1281. Following is what has been done: 1. atsc_epg bug fix: when ETM message gets longer than 256 characters, the last character was chopped, due to incorrect calling to snprintf(). 2. atsc_epg code cleanup: - white space added after keywords; - hard wrap around column 80 removed; - one-line conditional statement now w/o brackets. 3. scan Makefile workaround for building in gcc4.4/kernel 2.6.30 was not picked up in 1279, include again. Regards, Signed-off-by: Yufei Yuan diff -upr dvb-apps/util/atsc_epg/atsc_epg.c dvb-apps_local/util/atsc_epg/atsc_epg.c --- dvb-apps/util/atsc_epg/atsc_epg.c 2009-06-20 11:54:20.393986790 -0500 +++ dvb-apps_local/util/atsc_epg/atsc_epg.c 2009-06-20 12:09:08.0 -0500 @@ -168,9 +168,8 @@ void *(*table_callback[16])(struct atsc_ static void int_handler(int sig_num) { - if(SIGINT != sig_num) { + if (SIGINT != sig_num) return; - } ctrl_c = 1; } @@ -219,8 +218,9 @@ static void help(void) static int close_frontend(struct dvbfe_handle *fe) { - if(NULL == fe) { + if (NULL == fe) { fprintf(stderr, "%s(): NULL pointer detected\n", __FUNCTION__); + return -1; } dvbfe_close(fe); @@ -232,22 +232,20 @@ static int open_frontend(struct dvbfe_ha { struct dvbfe_info fe_info; - if(NULL == (*fe = dvbfe_open(adapter, 0, 0))) { - fprintf(stderr, "%s(): error calling dvbfe_open()\n", - __FUNCTION__); + if (NULL == (*fe = dvbfe_open(adapter, 0, 0))) { + fprintf(stderr, "%s(): error calling dvbfe_open()\n", __FUNCTION__); return -1; } dvbfe_get_info(*fe, 0, &fe_info, DVBFE_INFO_QUERYTYPE_IMMEDIATE, 0); - if(DVBFE_TYPE_ATSC != fe_info.type) { - fprintf(stderr, "%s(): only ATSC frontend supported currently\n", - __FUNCTION__); + if (DVBFE_TYPE_ATSC != fe_info.type) { + fprintf(stderr, "%s(): only ATSC frontend supported currently\n", __FUNCTION__); return -1; } fe_info.feparams.frequency = frequency; fe_info.feparams.inversion = DVBFE_INVERSION_AUTO; fe_info.feparams.u.atsc.modulation = DVBFE_ATSC_MOD_VSB_8; fprintf(stdout, "tuning to %d Hz, please wait...\n", frequency); - if(dvbfe_set(*fe, &fe_info.feparams, TIMEOUT * 1000)) { + if (dvbfe_set(*fe, &fe_info.feparams, TIMEOUT * 1000)) { fprintf(stderr, "%s(): cannot lock to %d Hz in %d seconds\n", __FUNCTION__, frequency, TIMEOUT); return -1; @@ -257,7 +255,7 @@ static int open_frontend(struct dvbfe_ha return 0; } -#if ENABLE_RRT +#ifdef ENABLE_RRT /* this is untested as since this part of the library is broken */ static int parse_rrt(int dmxfd) { @@ -270,20 +268,18 @@ static int parse_rrt(int dmxfd) i = 0; fprintf(stdout, "waiting for RRT: "); fflush(stdout); - while(i < RRT_TIMEOUT) { + while (i < RRT_TIMEOUT) { ret = atsc_scan_table(dmxfd, ATSC_BASE_PID, tag, (void **)&rrt); - if(0 > ret) { - fprintf(stderr, "%s(): error calling atsc_scan_table()\n", - __FUNCTION__); + if (0 > ret) { + fprintf(stderr, "%s(): error calling atsc_scan_table()\n", __FUNCTION__); return -1; } - if(0 == ret) { - if(RRT_TIMEOUT > i) { + if (0 == ret) { + if (RRT_TIMEOUT > i) { fprintf(stdout, "."); fflush(stdout); } else { - fprintf(stdout, "\nno RRT in %d seconds\n", - RRT_TIMEOUT); + fprintf(stdout, "\nno RRT in %d seconds\n", RRT_TIMEOUT); return 0; } i += TIMEOUT; @@ -301,14 +297,13 @@ static int parse_rrt(int dmxfd) atsc_text_string_segments_for_each(atsc_str, seg, j) { const char *c; int k; - if(seg->mode < 0x3E) { - fprintf(stderr, "%s(): text mode of 0x%02X " - "not supported yet\n", - __FUNCTION__, seg->mode); + + if (seg->mode < 0x3E) { + fprintf(stderr, "%s(): text mode of 0x%02X not supported yet\n", __FUNCTION__, seg->
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Thanks for the feedback. Will fix the coding style, and send in a new one against the tip. Regards, On Sat, 2009-06-20 at 11:30 +0400, Manu Abraham wrote: > On Fri, Jun 19, 2009 at 5:55 AM, Yufei Yuan wrote: > > Not sure how to make it look right in gmail, but the inline patch does > > not look right to my eyes. I have the patch attached behind as a > > backup. > > You can attach the patch, no worries. > > I have applied the patch, but the CodingStyle is not very nice, mostly > the wrapping to 80 cols is done in a bad way. It makes the code not > easy to read. > > Also have made some comments inline from your patch. Please do fix the > mentioned ones against the dvb-apps head > > > > > diff -uprN dvb-apps/util/atsc_epg/atsc_epg.c > dvb-apps_new/util/atsc_epg/atsc_epg.c > --- dvb-apps/util/atsc_epg/atsc_epg.c 1969-12-31 18:00:00.0 -0600 > +++ dvb-apps_new/util/atsc_epg/atsc_epg.c 2009-06-18 20:17:24.527925142 > -0500 > @@ -0,0 +1,1249 @@ > +/* > + * atsc_epg utility > + * > + * Copyright (C) 2009 Yufei Yuan > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define TIMEOUT 60 > +#define RRT_TIMEOUT 60 > +#define MAX_NUM_EVENT_TABLES 128 > +#define TITLE_BUFFER_LEN 4096 > +#define MESSAGE_BUFFER_LEN (16 * 1024) > +#define MAX_NUM_CHANNELS 16 > +#define MAX_NUM_EVENTS_PER_CHANNEL (4 * 24 * 7) > + > +static int atsc_scan_table(int dmxfd, uint16_t pid, enum atsc_section_tag > tag, > + void **table_section); > + > +static const char *program; > +static int adapter = 0; > +static int period = 12; /* hours */ > +static int frequency; > +static int enable_ett = 0; > +static int ctrl_c = 0; > +static const char *modulation = NULL; > +static char separator[80]; > +void (*old_handler)(int); > + > +struct atsc_string_buffer { > + int buf_len; > + int buf_pos; > + char *string; > +}; > + > +struct atsc_event_info { > + uint16_t id; > + struct tm start; > + struct tm end; > + int title_pos; > + int title_len; > + int msg_pos; > + int msg_len; > +}; > + > +struct atsc_eit_section_info { > + uint8_t section_num; > + uint8_t num_events; > + uint8_t num_etms; > + uint8_t num_received_etms; > + struct atsc_event_info **events; > +}; > + > +struct atsc_eit_info { > + int num_eit_sections; > + struct atsc_eit_section_info *section; > +}; > + > +struct atsc_channel_info { > + uint8_t num_eits; > + uint8_t service_type; > + char short_name[8]; > + uint16_t major_num; > + uint16_t minor_num; > + uint16_t tsid; > + uint16_t prog_num; > + uint16_t src_id; > + struct atsc_eit_info *eit; > + struct atsc_event_info *last_event; > + int event_info_index; > + struct atsc_event_info e[MAX_NUM_EVENTS_PER_CHANNEL]; > + struct atsc_string_buffer title_buf; > + struct atsc_string_buffer msg_buf; > +}; > + > +struct atsc_virtual_channels_info { > + int num_channels; > + uint16_t eit_pid[MAX_NUM_EVENT_TABLES]; > + uint16_t ett_pid[MAX_NUM_EVENT_TABLES]; > + struct atsc_channel_info ch[MAX_NUM_CHANNELS]; > +} guide; > + > +struct mgt_table_name { > + uint16_t range; > + const char *string; > +}; > + > +struct mgt_table_name mgt_tab_name_array[] = { > + {0x, "terrestrial VCT with current_next_indictor=1"}, > + {0x0001, "terrestrial VCT with current_next_indictor=0"}, > + {0x0002, "cable VCT with current_next_indictor=1"}, > + {0x0003, &
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Ok, let me first summarize what I have done in order not to waste your time again. I used Evolution client, used preformatted option, sent it to my other email box, forwarded it back and saved it as text file, then patched the original tree, so far everything looks okay. Hopefully you guys can do start to do next step. I do apologize for your wasted time. Signed-off-by: Yufei Yuan diff -uprN dvb-apps/util/atsc_epg/atsc_epg.c dvb-apps_new/util/atsc_epg/atsc_epg.c --- dvb-apps/util/atsc_epg/atsc_epg.c 1969-12-31 18:00:00.0 -0600 +++ dvb-apps_new/util/atsc_epg/atsc_epg.c 2009-06-19 20:31:17.710924970 -0500 @@ -0,0 +1,1249 @@ +/* + * atsc_epg utility + * + * Copyright (C) 2009 Yufei Yuan + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TIMEOUT60 +#define RRT_TIMEOUT60 +#define MAX_NUM_EVENT_TABLES 128 +#define TITLE_BUFFER_LEN 4096 +#define MESSAGE_BUFFER_LEN (16 * 1024) +#define MAX_NUM_CHANNELS 16 +#define MAX_NUM_EVENTS_PER_CHANNEL (4 * 24 * 7) + +static int atsc_scan_table(int dmxfd, uint16_t pid, enum atsc_section_tag tag, + void **table_section); + +static const char *program; +static int adapter = 0; +static int period = 12; /* hours */ +static int frequency; +static int enable_ett = 0; +static int ctrl_c = 0; +static const char *modulation = NULL; +static char separator[80]; +void (*old_handler)(int); + +struct atsc_string_buffer { + int buf_len; + int buf_pos; + char *string; +}; + +struct atsc_event_info { + uint16_t id; + struct tm start; + struct tm end; + int title_pos; + int title_len; + int msg_pos; + int msg_len; +}; + +struct atsc_eit_section_info { + uint8_t section_num; + uint8_t num_events; + uint8_t num_etms; + uint8_t num_received_etms; + struct atsc_event_info **events; +}; + +struct atsc_eit_info { + int num_eit_sections; + struct atsc_eit_section_info *section; +}; + +struct atsc_channel_info { + uint8_t num_eits; + uint8_t service_type; + char short_name[8]; + uint16_t major_num; + uint16_t minor_num; + uint16_t tsid; + uint16_t prog_num; + uint16_t src_id; + struct atsc_eit_info *eit; + struct atsc_event_info *last_event; + int event_info_index; + struct atsc_event_info e[MAX_NUM_EVENTS_PER_CHANNEL]; + struct atsc_string_buffer title_buf; + struct atsc_string_buffer msg_buf; +}; + +struct atsc_virtual_channels_info { + int num_channels; + uint16_t eit_pid[MAX_NUM_EVENT_TABLES]; + uint16_t ett_pid[MAX_NUM_EVENT_TABLES]; + struct atsc_channel_info ch[MAX_NUM_CHANNELS]; +} guide; + +struct mgt_table_name { + uint16_t range; + const char *string; +}; + +struct mgt_table_name mgt_tab_name_array[] = { + {0x, "terrestrial VCT with current_next_indictor=1"}, + {0x0001, "terrestrial VCT with current_next_indictor=0"}, + {0x0002, "cable VCT with current_next_indictor=1"}, + {0x0003, "cable VCT with current_next_indictor=0"}, + {0x0004, "channel ETT"}, + {0x0005, "DCCSCT"}, + {0x00FF, "reserved for future ATSC use"}, + {0x017F, "EIT"}, + {0x01FF, "reserved for future ATSC use"}, + {0x027F, "event ETT"}, + {0x02FF, "reserved for future ATSC use"}, /* FIXME */ + {0x03FF, "RRT with rating region"}, + {0x0FFF, "user private"}, + {0x13FF, "reserved for future ATSC use"}, + {0x14FF, "DCCT with dcc_id"}, + {0x, "reserved for future ATSC use"} +}; + +const char *channel_modulation_mode[] = { + "", + "analog", + "SCTE mode 1", + "SCTE mode 2", + "ATSC 8VSB", + "ATSC 16VSB" +}; + +const char *channel_service_type[] =
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Thanks for your time. It's my first time to do this, so I have been trying to follow literally on the wiki page to do it right. If you can elaborate a bit about what is broken? Is it the patch created incorrectly, or it is pasted incorrectly, or the style is still problematic? I noticed that cutting and pasting from my console to the gmail compose window does not seem working alright. How do you normally do the inlining? I have a full weekend to do this, and I do realize from the wiki page that it does not appear to be simple, :) I now simply disable the footer, don't worry. Regards, On Fri, Jun 19, 2009 at 7:41 PM, hermann pitton wrote: > > Am Donnerstag, den 18.06.2009, 20:39 -0500 schrieb Yufei Yuan: >> This one is about the utility itself. I do apologize for the length >> here as "inline" patch is preferred according to the guide and I don't >> have any public online storage. Please let me know if this causes any >> inconvenience. >> >> Signed-off-by: Yufei Yuan >> >> diff -uprN dvb-apps/util/atsc_epg/atsc_epg.c >> dvb-apps_new/util/atsc_epg/atsc_epg.c >> --- dvb-apps/util/atsc_epg/atsc_epg.c 1969-12-31 18:00:00.0 >> -0600 >> +++ dvb-apps_new/util/atsc_epg/atsc_epg.c 2009-06-18 >> 20:17:24.527925142 -0500 >> @@ -0,0 +1,1249 @@ >> +/* >> + * atsc_epg utility >> + * >> + * Copyright (C) 2009 Yufei Yuan >> + * This program is free software; you can redistribute it and/or >> modify >> + * it under the terms of the GNU General Public License as published >> by >> + * the Free Software Foundation; either version 2 of the License, or >> + * (at your option) any later version. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * >> + * GNU General Public License for more details. >> + * >> + * You should have received a copy of the GNU General Public License >> + * along with this program; if not, write to the Free Software >> + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define TIMEOUT 60 >> +#define RRT_TIMEOUT 60 >> +#define MAX_NUM_EVENT_TABLES 128 >> +#define TITLE_BUFFER_LEN 4096 >> +#define MESSAGE_BUFFER_LEN (16 * 1024) >> +#define MAX_NUM_CHANNELS 16 >> +#define MAX_NUM_EVENTS_PER_CHANNEL (4 * 24 * 7) >> + >> +static int atsc_scan_table(int dmxfd, uint16_t pid, enum >> atsc_section_tag tag, >> + void **table_section); >> + >> +static const char *program; >> +static int adapter = 0; >> +static int period = 12; /* hours */ >> +static int frequency; >> +static int enable_ett = 0; >> +static int ctrl_c = 0; >> +static const char *modulation = NULL; >> +static char separator[80]; >> +void (*old_handler)(int); >> + >> +struct atsc_string_buffer { >> + int buf_len; >> + int buf_pos; >> + char *string; >> +}; >> + >> +struct atsc_event_info { >> + uint16_t id; >> + struct tm start; >> + struct tm end; >> + int title_pos; >> + int title_len; >> + int msg_pos; >> + int msg_len; >> +}; >> + >> +struct atsc_eit_section_info { >> + uint8_t section_num; >> + uint8_t num_events; >> + uint8_t num_etms; >> + uint8_t num_received_etms; >> + struct atsc_event_info **events; >> +}; >> + >> +struct atsc_eit_info { >> + int num_eit_sections; >> + struct atsc_eit_section_info *section; >> +}; >> + >> +struct atsc_channel_info { >> + uint8_t num_eits; >> + uint8_t service_type; >> + char short_name[8]; >> + uint16_t major_num; >> + uint16_t minor_num; >> + uint16_t tsid; >> + uint16_t prog_num; >> + uint16_t src_id; >> + struct atsc_eit_info *eit; >> + struct atsc_event_info *last_event; >> + int event_info_index; >> +
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
This one is about the utility itself. I do apologize for the length here as "inline" patch is preferred according to the guide and I don't have any public online storage. Please let me know if this causes any inconvenience. Signed-off-by: Yufei Yuan diff -uprN dvb-apps/util/atsc_epg/atsc_epg.c dvb-apps_new/util/atsc_epg/atsc_epg.c --- dvb-apps/util/atsc_epg/atsc_epg.c 1969-12-31 18:00:00.0 -0600 +++ dvb-apps_new/util/atsc_epg/atsc_epg.c 2009-06-18 20:17:24.527925142 -0500 @@ -0,0 +1,1249 @@ +/* + * atsc_epg utility + * + * Copyright (C) 2009 Yufei Yuan + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TIMEOUT60 +#define RRT_TIMEOUT60 +#define MAX_NUM_EVENT_TABLES 128 +#define TITLE_BUFFER_LEN 4096 +#define MESSAGE_BUFFER_LEN (16 * 1024) +#define MAX_NUM_CHANNELS 16 +#define MAX_NUM_EVENTS_PER_CHANNEL (4 * 24 * 7) + +static int atsc_scan_table(int dmxfd, uint16_t pid, enum atsc_section_tag tag, + void **table_section); + +static const char *program; +static int adapter = 0; +static int period = 12; /* hours */ +static int frequency; +static int enable_ett = 0; +static int ctrl_c = 0; +static const char *modulation = NULL; +static char separator[80]; +void (*old_handler)(int); + +struct atsc_string_buffer { + int buf_len; + int buf_pos; + char *string; +}; + +struct atsc_event_info { + uint16_t id; + struct tm start; + struct tm end; + int title_pos; + int title_len; + int msg_pos; + int msg_len; +}; + +struct atsc_eit_section_info { + uint8_t section_num; + uint8_t num_events; + uint8_t num_etms; + uint8_t num_received_etms; + struct atsc_event_info **events; +}; + +struct atsc_eit_info { + int num_eit_sections; + struct atsc_eit_section_info *section; +}; + +struct atsc_channel_info { + uint8_t num_eits; + uint8_t service_type; + char short_name[8]; + uint16_t major_num; + uint16_t minor_num; + uint16_t tsid; + uint16_t prog_num; + uint16_t src_id; + struct atsc_eit_info *eit; + struct atsc_event_info *last_event; + int event_info_index; + struct atsc_event_info e[MAX_NUM_EVENTS_PER_CHANNEL]; + struct atsc_string_buffer title_buf; + struct atsc_string_buffer msg_buf; +}; + +struct atsc_virtual_channels_info { + int num_channels; + uint16_t eit_pid[MAX_NUM_EVENT_TABLES]; + uint16_t ett_pid[MAX_NUM_EVENT_TABLES]; + struct atsc_channel_info ch[MAX_NUM_CHANNELS]; +} guide; + +struct mgt_table_name { + uint16_t range; + const char *string; +}; + +struct mgt_table_name mgt_tab_name_array[] = { + {0x, "terrestrial VCT with current_next_indictor=1"}, + {0x0001, "terrestrial VCT with current_next_indictor=0"}, + {0x0002, "cable VCT with current_next_indictor=1"}, + {0x0003, "cable VCT with current_next_indictor=0"}, + {0x0004, "channel ETT"}, + {0x0005, "DCCSCT"}, + {0x00FF, "reserved for future ATSC use"}, + {0x017F, "EIT"}, + {0x01FF, "reserved for future ATSC use"}, + {0x027F, "event ETT"}, + {0x02FF, "reserved for future ATSC use"}, /* FIXME */ + {0x03FF, "RRT with rating region"}, + {0x0FFF, "user private"}, + {0x13FF, "reserved for future ATSC use"}, + {0x14FF, "DCCT with dcc_id"}, + {0x, "reserved for future ATSC use"} +}; + +const char *channel_modulation_mode[] = { + "", + "analog", + "SCTE mode 1", + "SCTE mode 2", + "ATSC 8VSB", + "ATSC 16VSB" +}; + +const char *channel_service_type[] = { + "", + "analog TV", + "ATSC digital TV", + "
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Okay, this one serves as a test as well. It's a trivial one to fix the broken dvb-apps building process with gcc4.4 on kernel 2.6.30, another way to eliminate the packed bitfield warning is to split the field, but that is unwanted. previous build error: make[2]: Entering directory `/home/alex/source/dvb-apps/util/scan' perl section_generate.pl atsc_psip_section.pl CC scan.o In file included from scan.c:48: atsc_psip_section.h:57: note: Offset of packed bit-field ‘reserved2’ has changed in GCC 4.4 CC atsc_psip_section.o In file included from atsc_psip_section.c:2: atsc_psip_section.h:57: note: Offset of packed bit-field ‘reserved2’ has changed in GCC 4.4 CC diseqc.o In file included from diseqc.c:4: /usr/include/time.h:104: error: conflicting types for ‘timer_t’ /usr/include/linux/types.h:22: note: previous declaration of ‘timer_t’ was here make[2]: *** [diseqc.o] Error 1 make[2]: Leaving directory `/home/alex/source/dvb-apps/util/scan' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/alex/source/dvb-apps/util' make: *** [all] Error 2 --- dvb-apps/util/scan/Makefile.orig2009-06-18 19:43:52.397924757 -0500 +++ dvb-apps/util/scan/Makefile 2009-06-18 19:44:34.764925070 -0500 @@ -14,7 +14,7 @@ inst_bin = $(binaries) removing = atsc_psip_section.c atsc_psip_section.h -CPPFLAGS += -DDATADIR=\"$(prefix)/share\" +CPPFLAGS += -Wno-packed-bitfield-compat -D__KERNEL_STRICT_NAMES -DDATADIR=\"$(prefix)/share\" .PHONY: all -- Even uttering "HI" or "HAO" is offensive, sometime, somewhere. Reader discretion is advised. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Ok, I guess I violated at least coding style rule No.1, :) Will peruse the coding style page tonight and redo the submission. Regards, Yufei On Thu, Jun 18, 2009 at 3:48 AM, Manu Abraham wrote: > On Thu, Jun 18, 2009 at 12:32 PM, Manu Abraham wrote: >> 2009/6/18 Yufei Yuan : >>> Hi, >>> >>> I am not sure if this is the correct mailing list to send this patch. >>> From the LinuxTV website, it seems that currently dvb-apps project has >>> no owner. >>> >>> A new utility atsc_epg is added into the dvb-apps utility suite. It >>> parses PSIP information carried in OTA ATSC channels, and constructs a >>> basic EPG in a terminal window. Changes were also made to files to >>> please GCC4.4. >>> >>> The patch is against latest revision 1278 from the dvb-apps repository. >> >> >> Please do send the patch with tabs instead of spaces for indentation. > > Also: > > * please cleanup the white spaces in the patch, if any. > * please use the unified format, diff -u option. > > Regards, > Manu > -- 好学近乎智,力行近乎仁,知耻近乎勇。 Eagerness in learning is close to intelligence. Commitment in doing is close to nobleness. Realization of shamefulness is close to courageousness. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Patch] New utility program atsc_epg added to dvb-apps utility suite.
Okay, you win. Apology to others in the list who have to endure the garbage talk. Regards, Yufei Yuan On Wed, Jun 17, 2009 at 8:05 PM, hermann pitton wrote: > Am Mittwoch, den 17.06.2009, 19:46 -0500 schrieb Yufei Yuan: >> Age would cure neither naivety nor stupidity. I would imagine only a >> self-important white supremacist would utter such comments in public >> against a total stranger. If you can read the Chinese above, I >> *seriously* doubt that, it's what Confucious said around 500BC, to >> encourage learning and repentance. > > That was of course totally clear and exactly that is the annoyance ! > >> >> I may not do a good job in translation, sorry about that. But blindly >> interpret other's intention based on one's own narrow personal >> experience, or cultural context, is the origin of the trouble between >> groups and nations, in this case, two individuals. > > OK, let's keep the footers uncensored ;) > >> Regards, >> >> On Wed, Jun 17, 2009 at 7:30 PM, hermann pitton >> wrote: >> > >> > Am Mittwoch, den 17.06.2009, 19:20 -0500 schrieb Yufei Yuan: >> >> If you take such an intolerant attitude against what others opinion >> >> might be, your words might just be deemed worthless, or should I say >> >> *bullshit*, by others. It is really sad that this world is never in >> >> shortage of people like you. >> >> >> >> What a shame of humanity. >> >> >> >> Regards, >> > >> > I'm a German born in 1957. >> > >> > If that could help you any further in the future not to claim to have >> > the three golden rules ... >> > >> > Cheers, >> > Hermann >> > >> >> >> >> On Wed, Jun 17, 2009 at 7:14 PM, hermann pitton >> >> wrote: >> >> > Hi, >> >> > >> >> > Am Mittwoch, den 17.06.2009, 19:06 -0500 schrieb Yufei Yuan: >> >> >> Sorry I guess this is about the way the patch was generated? Or about >> >> >> the utility itself? >> >> >> >> >> >> Regards, >> >> > >> >> > most likely. >> >> > >> >> > And that is what I exactly do mean. >> >> > >> >> > Obviously you don't have any control about the footers others provide >> >> > for you, if you go shopping ;) >> >> > >> >> > -- >> >> > 好学近乎智,力行近乎仁,知耻近乎勇。 >> >> > Eagerness in learning is close to intelligence. >> >> > Commitment in doing is close to nobleness. >> >> > Realization of shamefulness is close to courageousness. >> >> > >> >> > :) >> >> > >> >> > what a bullshit. >> >> > >> >> > Cheers, >> >> > Hermann >> >> > >> >> >> >> >> >> On Wed, Jun 17, 2009 at 6:51 PM, hermann >> >> >> pitton wrote: >> >> >> > >> >> >> > Am Mittwoch, den 17.06.2009, 18:18 -0500 schrieb Yufei Yuan: >> >> >> >> Hi, >> >> >> >> >> >> >> >> I am not sure if this is the correct mailing list to send this >> >> >> >> patch. >> >> >> >> >From the LinuxTV website, it seems that currently dvb-apps project >> >> >> >> has >> >> >> >> no owner. >> >> >> >> >> >> >> >> A new utility atsc_epg is added into the dvb-apps utility suite. It >> >> >> >> parses PSIP information carried in OTA ATSC channels, and >> >> >> >> constructs a >> >> >> >> basic EPG in a terminal window. Changes were also made to files to >> >> >> >> please GCC4.4. >> >> >> >> >> >> >> >> The patch is against latest revision 1278 from the dvb-apps >> >> >> >> repository. >> >> >> >> >> >> >> >> Regards, >> >> >> >> Yufei Yuan >> >> >> >> >> >> >> >> -- >> >> >> >> 好学近乎智,力行近乎仁,知耻近乎勇。 >> >> >> >> Eagerness in learning is close to intelligence. >> >> >> >> Commitment in doing is close to nobleness. >> >> >> >> Realization of shamefulness is close to courageousness. >> >> >> > >> >> >> > Getting engaged into footers ... >> >> >> > >> >> >> > The above blindly assumes that there is a balance within that >> >> >> > reduction >> >> >> > to three cases ... (we know two are enough) >> >> >> > >> >> >> > You miss at least several hundred years of history on the other side >> >> >> > of >> >> >> > the planet. >> >> >> > >> >> >> > I totally disagree with that kind of stuff. >> >> >> > >> >> >> > Most explicitly with the third variant. >> >> >> > >> >> >> > That way you can still press any slave into any army ... >> >> >> > >> > >> > >> > >> >> >> > > -- 好学近乎智,力行近乎仁,知耻近乎勇。 Eagerness in learning is close to intelligence. Commitment in doing is close to nobleness. Realization of shamefulness is close to courageousness. -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html