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
dd34b12f
Commit
dd34b12f
authored
Jan 27, 2014
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/dump_pids.c:
Dump packet nr, PID and CC to stdout.
parent
d9bf9c75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
1 deletion
+62
-1
examples/Makefile.am
examples/Makefile.am
+5
-1
examples/dump_pids.c
examples/dump_pids.c
+57
-0
No files found.
examples/Makefile.am
View file @
dd34b12f
...
...
@@ -3,7 +3,11 @@
SUBDIRS
=
dvbinfo
DIST_SUBDIRS
=
$(SUBDIRS)
noinst_PROGRAMS
=
decode_pat decode_pmt get_pcr_pid decode_sdt decode_mpeg decode_bat
noinst_PROGRAMS
=
decode_pat decode_pmt get_pcr_pid decode_sdt decode_mpeg decode_bat dump_pids
dump_pids_SOURCES
=
dump_pids.c
dump_pids_CPPFLAGS
=
dump_pids_LDFLAGS
=
decode_pat_SOURCES
=
decode_pat.c
decode_pat_CPPFLAGS
=
-DDVBPSI_DIST
...
...
examples/dump_pids.c
0 → 100644
View file @
dd34b12f
#include "config.h"
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
static
inline
uint32_t
ts_getcc
(
uint8_t
*
packet
)
{
return
(
packet
[
3
]
&
0x0f
);
}
static
inline
uint32_t
ts_getpid
(
uint8_t
*
packet
)
{
assert
(
packet
[
0
]
==
0x47
);
return
((
uint16_t
)(
packet
[
1
]
&
0x1f
)
<<
8
)
+
packet
[
2
];
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
file
=
open
(
argv
[
1
],
O_RDONLY
|
O_NONBLOCK
);
if
(
file
<
0
)
{
perror
(
argv
[
1
]);
printf
(
"error opening %s
\n
"
,
argv
[
1
]);
return
-
1
;
}
int32_t
s
=
188
;
/* COULD ALSO BE 192 */
uint8_t
p
[
188
]
=
{
0
};
int64_t
n
=
0
;
size_t
len
=
0
;
for
(;;)
{
/* slow read */
len
=
read
(
file
,
&
p
[
0
],
s
);
if
(
len
==
0
)
break
;
uint32_t
pid
=
ts_getpid
(
&
p
[
0
]);
uint32_t
cc
=
ts_getcc
(
&
p
[
0
]);
n
++
;
printf
(
"packet %ld, pid %u, cc %d
\n
"
,
n
,
pid
,
cc
);
}
close
(
file
);
return
0
;
}
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