Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libdvbpsi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
libdvbpsi
Commits
f11c0a31
Commit
f11c0a31
authored
Jun 28, 2015
by
Daniel Kamil Kozar
Committed by
Jean-Paul Saman
Jan 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement array checks for CA descriptor
Signed-off-by:
Jean-Paul Saman
<
jpsaman@videolan.org
>
parent
99536307
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
7 deletions
+72
-7
misc/dr.dtd
misc/dr.dtd
+6
-1
misc/dr.xml
misc/dr.xml
+1
-0
misc/dr.xsl
misc/dr.xsl
+13
-0
misc/test_dr.c
misc/test_dr.c
+18
-6
misc/test_dr.h
misc/test_dr.h
+34
-0
No files found.
misc/dr.dtd
View file @
f11c0a31
<!ELEMENT dr (descriptor*)>
<!ELEMENT descriptor (integer | boolean | insert)*>
<!ELEMENT descriptor (integer | boolean | insert
| array
)*>
<!ELEMENT integer EMPTY>
<!ELEMENT boolean EMPTY>
<!ELEMENT array EMPTY>
<!ELEMENT insert (begin? | check? | end?)>
<!ELEMENT begin (#PCDATA)>
...
...
@@ -23,3 +25,6 @@
<!ATTLIST boolean name CDATA #IMPLIED>
<!ATTLIST boolean default CDATA #IMPLIED>
<!ATTLIST array name CDATA #IMPLIED>
<!ATTLIST array len_name CDATA #IMPLIED>
misc/dr.xml
View file @
f11c0a31
...
...
@@ -71,6 +71,7 @@
</insert>
<integer
name=
"i_ca_system_id"
bitcount=
"16"
default=
"0"
/>
<integer
name=
"i_ca_pid"
bitcount=
"13"
default=
"0"
/>
<array
name=
"i_private_data"
len_name=
"i_private_length"
/>
</descriptor>
<descriptor
name=
"system clock"
sname=
"system_clock"
fname=
"SystemClock"
>
...
...
misc/dr.xsl
View file @
f11c0a31
...
...
@@ -15,6 +15,9 @@
#include
<
stdio.h
>
#include
<
stdbool.h
>
#include
<
stdlib.h
>
#include
<
string.h
>
#include
<
time.h
>
#if defined(HAVE_INTTYPES_H)
#include
<
inttypes.h
>
...
...
@@ -43,6 +46,7 @@
int main(void)
{
int i_err = 0;
srand(time(NULL));
<xsl:apply-templates
mode=
"main"
/>
if(i_err)
...
...
@@ -116,6 +120,15 @@ static int main_<xsl:value-of select="@sname" />_<xsl:value-of select="@msuffix"
BOZO_end_boolean(
<xsl:value-of
select=
"@name"
/>
)
</xsl:template>
<xsl:template
match=
"array"
mode=
"check"
>
/* check
<xsl:value-of
select=
"@name"
/>
*/
<xsl:apply-templates
select=
".."
mode=
"init"
/>
BOZO_begin_array(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
)
BOZO_DOJOB(
<xsl:value-of
select=
"../@fname"
/>
);
BOZO_check_array(
<xsl:value-of
select=
"@name"
/>
,
<xsl:value-of
select=
"@len_name"
/>
)
BOZO_CLEAN();
BOZO_end_array(
<xsl:value-of
select=
"@name"
/>
)
</xsl:template>
<xsl:template
match=
"insert"
mode=
"check"
>
<xsl:value-of
select=
"check"
/>
</xsl:template>
...
...
misc/test_dr.c
View file @
f11c0a31
...
...
@@ -6,6 +6,9 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#if defined(HAVE_INTTYPES_H)
#include <inttypes.h>
...
...
@@ -13,8 +16,6 @@
#include <stdint.h>
#endif
#include <sys/types.h>
/* the libdvbpsi distribution defines DVBPSI_DIST */
#ifdef DVBPSI_DIST
#include "../src/dvbpsi.h"
...
...
@@ -39,7 +40,7 @@ static int main_vstream_1(void)
/* check b_multiple_frame_rate */
BOZO_init_boolean
(
b_multiple_frame_rate
,
0
);
BOZO_init_integer
(
i_frame_rate_code
,
0
);
s_decoded
.
b_mpeg2
=
0
;
s_decoded
.
b_mpeg2
=
false
;
BOZO_init_boolean
(
b_constrained_parameter
,
0
);
BOZO_init_boolean
(
b_still_picture
,
0
);
BOZO_begin_boolean
(
b_multiple_frame_rate
)
...
...
@@ -51,7 +52,7 @@ static int main_vstream_1(void)
/* check i_frame_rate_code */
BOZO_init_boolean
(
b_multiple_frame_rate
,
0
);
BOZO_init_integer
(
i_frame_rate_code
,
0
);
s_decoded
.
b_mpeg2
=
0
;
s_decoded
.
b_mpeg2
=
false
;
BOZO_init_boolean
(
b_constrained_parameter
,
0
);
BOZO_init_boolean
(
b_still_picture
,
0
);
BOZO_begin_integer
(
i_frame_rate_code
,
4
)
...
...
@@ -63,7 +64,7 @@ static int main_vstream_1(void)
/* check b_constrained_parameter */
BOZO_init_boolean
(
b_multiple_frame_rate
,
0
);
BOZO_init_integer
(
i_frame_rate_code
,
0
);
s_decoded
.
b_mpeg2
=
0
;
s_decoded
.
b_mpeg2
=
false
;
BOZO_init_boolean
(
b_constrained_parameter
,
0
);
BOZO_init_boolean
(
b_still_picture
,
0
);
BOZO_begin_boolean
(
b_constrained_parameter
)
...
...
@@ -75,7 +76,7 @@ static int main_vstream_1(void)
/* check b_still_picture */
BOZO_init_boolean
(
b_multiple_frame_rate
,
0
);
BOZO_init_integer
(
i_frame_rate_code
,
0
);
s_decoded
.
b_mpeg2
=
0
;
s_decoded
.
b_mpeg2
=
false
;
BOZO_init_boolean
(
b_constrained_parameter
,
0
);
BOZO_init_boolean
(
b_still_picture
,
0
);
BOZO_begin_boolean
(
b_still_picture
)
...
...
@@ -464,6 +465,16 @@ static int main_ca_(void)
BOZO_CLEAN
();
BOZO_end_integer
(
i_ca_pid
,
13
)
/* check i_private_data */
s_decoded
.
i_private_length
=
0
;
BOZO_init_integer
(
i_ca_system_id
,
0
);
BOZO_init_integer
(
i_ca_pid
,
0
);
BOZO_begin_array
(
i_private_data
,
i_private_length
)
BOZO_DOJOB
(
CA
);
BOZO_check_array
(
i_private_data
,
i_private_length
)
BOZO_CLEAN
();
BOZO_end_array
(
i_private_data
)
BOZO_END
(
conditional
access
);
...
...
@@ -648,6 +659,7 @@ static int main_service_(void)
int
main
(
void
)
{
int
i_err
=
0
;
srand
(
time
(
NULL
));
i_err
|=
main_vstream_1
();
i_err
|=
main_vstream_2
();
...
...
misc/test_dr.h
View file @
f11c0a31
...
...
@@ -120,3 +120,37 @@
s_decoded.name, p_new_decoded->name); \
i_err = 1; \
}
/* array */
#define BOZO_begin_array(name, len_name) \
if(!i_err) \
{ \
fprintf(stdout, " \"%s\" array check\n", #name); \
i_loop_count = 0; \
do \
{ \
for(size_t i = 0 ; i < i_loop_count ; ++i) s_decoded.name[i] = rand(); \
s_decoded.len_name = i_loop_count;
#define BOZO_end_array(name) \
} while(!i_err && i_loop_count < sizeof(s_decoded.name)); \
fprintf(stdout, "\r iteration count: %22"PRI64d, i_loop_count); \
if(i_err) \
fprintf(stdout, " FAILED !!!\n"); \
else \
fprintf(stdout, " Ok.\n"); \
}
#define BOZO_check_array(name, len_name) \
if( !i_err \
&& (memcmp(s_decoded.name, p_new_decoded->name, s_decoded.len_name) != 0)) \
{ \
fprintf(stderr, "\nError: array %s not equal\n", #name); \
i_err = 1; \
} \
else if(!i_err && s_decoded.len_name != p_new_decoded->len_name) \
{ \
fprintf(stderr, "\nError : array %s sizes not equal : %d -> %d\n", \
#name, s_decoded.len_name, p_new_decoded->len_name); \
i_err = 1; \
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment