clib/dvb_ts_lib/descriptors/parse_desc_stuffing.c

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 24 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« clib/dvb_ts_lib/descriptors/parse_desc_stream_identifier.c ↑ Summary clib/dvb_ts_lib/descriptors/parse_desc_subtitling.c »
1 /*
2 * parse_desc_stuffing.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_stuffing.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 // stuffing_descriptor(){
43 // descriptor_tag 8 uimsbf
44 // descriptor_length 8 uimsbf
45 // for (i= 0;i<N;i++){
46 // stuffing_byte 8 bslbf
47 // }
48 // }
49 // stuffing_section(){
50 // table_id 8 uimsbf
51 // section_syntax_indicator 1 bslbf
52 // reserved_future_use 1 bslbf
53 // reserved 2 bslbf
54 // section_length 12 uimsbf
55 // for (i=0;i<N;i++){
56 // data_byte 8 uimsbf
57 // }
58 // }
59
60
61 /* ----------------------------------------------------------------------- */
62 0 void print_stuffing(struct Descriptor_stuffing *sd, int level)
63 {
64 struct list_head *item, *safe;
65
66 0 printf(" Descriptor: stuffing [0x%02x]\n", sd->descriptor_tag) ;
67 0 printf(" Length: %d\n", sd->descriptor_length) ;
68
69 0 printf(" stuffing = \"%s\"\n", sd->stuffing) ;
70 0 }
71
72 /* ----------------------------------------------------------------------- */
73 0 struct Descriptor *parse_stuffing(struct TS_bits *bits, unsigned tag, unsigned len)
74 {
75 struct Descriptor_stuffing *sd ;
76 unsigned byte ;
77 int end_buff_len ;
78
79 0 sd = (struct Descriptor_stuffing *)malloc( sizeof(*sd) ) ;
80 0 memset(sd,0,sizeof(*sd));
81
82 //== Parse data ==
83 0 INIT_LIST_HEAD(&sd->next);
84 0 sd->descriptor_tag = tag ; // already extracted by parse_desc()
85 0 sd->descriptor_length = len ; // already extracted by parse_desc()
86
87 0 end_buff_len = bits_len_calc(bits, -sd->descriptor_length) ;
88 0 sd->stuffing[0] = 0 ;
89 0 ▶ for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_STUFFING_LEN); ++byte)
Branch: 2 branches
BranchTrueFalseTotal
for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_STUFFING_LEN); ++byte) 0 0 0
for (byte=0; (bits->buff_len > end_buff_len) && (byte < MAX_STUFFING_LEN); ++byte) 0 0 0
90 {
91 0 sd->stuffing[byte] = bits_get(bits, 8) ;
92 0 sd->stuffing[byte+1] = 0 ;
93 }
94
95
96 0 return (struct Descriptor *)sd ;
97 }
98
99 /* ----------------------------------------------------------------------- */
100 0 void free_stuffing(struct Descriptor_stuffing *sd)
101 {
102 struct list_head *item, *safe;
103
104 0 free(sd) ;
105 0 }
« clib/dvb_ts_lib/descriptors/parse_desc_stream_identifier.c ↑ Summary clib/dvb_ts_lib/descriptors/parse_desc_subtitling.c »