[Redbutton-devel] SF.net SVN: redbutton: [12] redbutton-download/trunk
Brought to you by:
skilvington
|
From: <ski...@us...> - 2006-03-03 12:11:48
|
Revision: 12 Author: skilvington Date: 2006-03-03 04:11:41 -0800 (Fri, 03 Mar 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=12&view=rev Log Message: ----------- find default video and audio PIDs Modified Paths: -------------- redbutton-download/trunk/findmheg.c redbutton-download/trunk/module.h redbutton-download/trunk/rb-download.c Modified: redbutton-download/trunk/findmheg.c =================================================================== --- redbutton-download/trunk/findmheg.c 2006-03-02 17:11:17 UTC (rev 11) +++ redbutton-download/trunk/findmheg.c 2006-03-03 12:11:41 UTC (rev 12) @@ -37,10 +37,13 @@ /* Programme Map Section */ #define TID_PMT 0x02 -/* stream_type we are interested in */ +/* stream_types we are interested in */ +#define STREAM_TYPE_VIDEO 0x02 +#define STREAM_TYPE_AUDIO 0x03 #define STREAM_TYPE_ISO13818_6_B 0x0b /* descriptors we want */ +#define TAG_LANGUAGE_DESCRIPTOR 0x0a #define TAG_CAROUSEL_ID_DESCRIPTOR 0x13 #define TAG_STREAM_ID_DESCRIPTOR 0x52 @@ -55,6 +58,12 @@ uint8_t component_tag; }; +struct language_descriptor +{ + char language_code[3]; + uint8_t audio_type; +} __attribute__((__packed__)); + /* * fills in a struct carousel based on the given service_id * returns a ptr to a static struct that will be overwritten be the next call to this routine @@ -85,6 +94,9 @@ /* unknown */ _car.carousel_id = 0; + _car.audio_pid = 0; + _car.video_pid = 0; + _car.current_pid = 0; /* map between stream_id_descriptors and elementary_PIDs */ init_assoc(&_car.assoc); /* no PIDs yet */ @@ -135,8 +147,7 @@ offset += 2 + info_length; /* - * find the carousel_identification_descriptor - * and the stream_identification_descriptor + * find the Descriptor Tags we are interested in */ while(offset < (section_length - 4)) { @@ -144,6 +155,10 @@ offset += 1; elementary_pid = ((pmt[offset] & 0x1f) << 8) + pmt[offset+1]; offset += 2; + /* is it the default video stream for this service */ + if(stream_type == STREAM_TYPE_VIDEO) + _car.video_pid = elementary_pid; + /* read the descriptors */ info_length = ((pmt[offset] & 0x0f) << 8) + pmt[offset+1]; offset += 2; while(info_length != 0) @@ -171,6 +186,14 @@ // printf("pid=0x%x component_tag=0x%x\n", elementary_pid, component_tag); add_assoc(&_car.assoc, elementary_pid, desc->component_tag); } + else if(desc_tag == TAG_LANGUAGE_DESCRIPTOR && stream_type == STREAM_TYPE_AUDIO) + { + struct language_descriptor *desc; + desc = (struct language_descriptor *) &pmt[offset]; + /* only remember the normal audio stream (not visually impaired stream) */ + if(desc->audio_type == 0) + _car.audio_pid = elementary_pid; + } offset += desc_length; info_length -= desc_length; } Modified: redbutton-download/trunk/module.h =================================================================== --- redbutton-download/trunk/module.h 2006-03-02 17:11:17 UTC (rev 11) +++ redbutton-download/trunk/module.h 2006-03-03 12:11:41 UTC (rev 12) @@ -58,6 +58,8 @@ unsigned int timeout; /* timeout for the demux device */ uint16_t service_id; uint32_t carousel_id; + uint16_t audio_pid; /* PID of default audio stream for this service_id */ + uint16_t video_pid; /* PID of default video stream for this service_id */ uint16_t current_pid; /* PID we downloaded the last table from */ struct assoc assoc; /* map stream_id's to elementary_pid's */ int32_t npids; /* PIDs we are reading data from */ Modified: redbutton-download/trunk/rb-download.c =================================================================== --- redbutton-download/trunk/rb-download.c 2006-03-02 17:11:17 UTC (rev 11) +++ redbutton-download/trunk/rb-download.c 2006-03-03 12:11:41 UTC (rev 12) @@ -131,6 +131,8 @@ service_id = strtoul(argv[optind], NULL, 0); car = find_mheg(device, timeout, service_id, carousel_id); printf("Carousel ID=%u\n", car->carousel_id); + printf("Video PID=%u\n", car->video_pid); + printf("Audio PID=%u\n", car->audio_pid); if(listen) { listen_data.carousel = car; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |