clib/dvb_ts_lib/descriptors/parse_desc_data_broadcast_id.c

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 26 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/dvb_ts_lib/descriptors/parse_desc_data_broadcast.c ↑ Summary clib/dvb_ts_lib/descriptors/parse_desc_dsng.c »
1 /*
2 * parse_desc_data_broadcast_id.c
3 *
4 * Created by: si_desc.pl
5 * Created on: 20-May-2011
6 * Author: sdprice1
7 */
8
9
10 // VERSION = 1.00
11
12 /*=============================================================================================*/
13 // USES
14 /*=============================================================================================*/
15
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <unistd.h>
19 #include <string.h>
20 #include <errno.h>
21 #include <ctype.h>
22 #include <fcntl.h>
23 #include <inttypes.h>
24
25 #include "parse_desc_data_broadcast_id.h"
26 #include "descriptors/parse_desc.h"
27
28 /*=============================================================================================*/
29 // CONSTANTS
30 /*=============================================================================================*/
31
32 /*=============================================================================================*/
33 // MACROS
34 /*=============================================================================================*/
35
36 /*=============================================================================================*/
37 // FUNCTIONS
38 /*=============================================================================================*/
39
40 /* ----------------------------------------------------------------------- */
41 //
42 // data_broadcast_id_descriptor(){
43 // descriptor_tag 8 uimsbf
44 // descriptor_length 8 uimsbf
45 // data_broadcast_id 16 uimsbf
46 // for(i=0; i < N;i++){
47 // id_selector_byte 8 uimsbf
48 // }
49 // }
50
51
52 /* ----------------------------------------------------------------------- */
53 0 void print_data_broadcast_id(struct Descriptor_data_broadcast_id *dbid, int level)
54 {
55 struct list_head *item, *safe;
56
57 0 printf(" Descriptor: data_broadcast_id [0x%02x]\n", dbid->descriptor_tag) ;
58 0 printf(" Length: %d\n", dbid->descriptor_length) ;
59
60 0 printf(" data_broadcast_id = %d\n", dbid->data_broadcast_id) ;
61 0 printf(" id_selector = \"%s\"\n", dbid->id_selector) ;
62 0 }
63
64 /* ----------------------------------------------------------------------- */
65 0 struct Descriptor *parse_data_broadcast_id(struct TS_bits *bits, unsigned tag, unsigned len)
66 {
67 struct Descriptor_data_broadcast_id *dbid ;
68 unsigned byte ;
69 int end_buff_len ;
70
71 0 dbid = (struct Descriptor_data_broadcast_id *)malloc( sizeof(*dbid) ) ;
72 0 memset(dbid,0,sizeof(*dbid));
73
74 //== Parse data ==
75 0 INIT_LIST_HEAD(&dbid->next);
76 0 dbid->descriptor_tag = tag ; // already extracted by parse_desc()
77 0 dbid->descriptor_length = len ; // already extracted by parse_desc()
78 0 dbid->data_broadcast_id = bits_get(bits, 16) ;
79
80 0 end_buff_len = bits_len_calc(bits, -(dbid->descriptor_length - 2)) ;
81 0 dbid->id_selector[0] = 0 ;
82 0 ▶ for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_ID_SELECTOR_LEN); ++byte)
Branch: 2 branches
BranchTrueFalseTotal
for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_ID_SELECTOR_LEN); ++byte) 0 0 0
for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_ID_SELECTOR_LEN); ++byte) 0 0 0
83 {
84 0 dbid->id_selector[byte] = bits_get(bits, 8) ;
85 0 dbid->id_selector[byte+1] = 0 ;
86 }
87
88
89 0 return (struct Descriptor *)dbid ;
90 }
91
92 /* ----------------------------------------------------------------------- */
93 0 void free_data_broadcast_id(struct Descriptor_data_broadcast_id *dbid)
94 {
95 struct list_head *item, *safe;
96
97 0 free(dbid) ;
98 0 }
« clib/dvb_ts_lib/descriptors/parse_desc_data_broadcast.c ↑ Summary clib/dvb_ts_lib/descriptors/parse_desc_dsng.c »