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
ad961fda
Commit
ad961fda
authored
Nov 09, 2005
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a verbose option that prints PCR statistics in milliseconds.
parent
c0fe1c1b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
13 deletions
+39
-13
examples/decode_mpeg.c
examples/decode_mpeg.c
+39
-13
No files found.
examples/decode_mpeg.c
View file @
ad961fda
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include <fcntl.h>
#include <fcntl.h>
#include <math.h>
#include <math.h>
...
@@ -394,9 +396,9 @@ void usage( char *name )
...
@@ -394,9 +396,9 @@ void usage( char *name )
int
main
(
int
i_argc
,
char
*
pa_argv
[])
int
main
(
int
i_argc
,
char
*
pa_argv
[])
{
{
#ifdef HAVE_SYS_SOCKET_H
#ifdef HAVE_SYS_SOCKET_H
const
char
*
const
short_options
=
"hf:m:p:u:"
;
const
char
*
const
short_options
=
"hf:m:p:u:
v
"
;
#else
#else
const
char
*
const
short_options
=
"hf:"
;
const
char
*
const
short_options
=
"hf:
v
"
;
#endif
#endif
const
struct
option
long_options
[]
=
const
struct
option
long_options
[]
=
{
{
...
@@ -407,6 +409,7 @@ int main(int i_argc, char* pa_argv[])
...
@@ -407,6 +409,7 @@ int main(int i_argc, char* pa_argv[])
{
"port"
,
0
,
NULL
,
'p'
},
{
"port"
,
0
,
NULL
,
'p'
},
{
"udp"
,
0
,
NULL
,
'u'
},
{
"udp"
,
0
,
NULL
,
'u'
},
#endif
#endif
{
"verbose"
,
0
,
NULL
,
'v'
},
{
NULL
,
0
,
NULL
,
0
}
{
NULL
,
0
,
NULL
,
0
}
};
};
int
next_option
=
0
;
int
next_option
=
0
;
...
@@ -416,12 +419,16 @@ int main(int i_argc, char* pa_argv[])
...
@@ -416,12 +419,16 @@ int main(int i_argc, char* pa_argv[])
#ifdef HAVE_SYS_SOCKET_H
#ifdef HAVE_SYS_SOCKET_H
int
i_port
=
0
;
int
i_port
=
0
;
char
*
ipaddress
=
NULL
;
char
*
ipaddress
=
NULL
;
time_t
time_prev
=
0
;
int
i_old_cc
=
-
1
;
mtime_t
i_prev_pcr
=
0
;
/* 33 bits */
#endif
#endif
char
*
filename
=
NULL
;
char
*
filename
=
NULL
;
uint8_t
*
p_data
=
NULL
;
uint8_t
*
p_data
=
NULL
;
ts_stream_t
*
p_stream
=
NULL
;
ts_stream_t
*
p_stream
=
NULL
;
int
b_ok
=
0
;
int
b_ok
=
0
;
int
b_verbose
=
0
;
/* parser commandline arguments */
/* parser commandline arguments */
do
{
do
{
...
@@ -447,6 +454,9 @@ int main(int i_argc, char* pa_argv[])
...
@@ -447,6 +454,9 @@ int main(int i_argc, char* pa_argv[])
ipaddress
=
strdup
(
optarg
);
ipaddress
=
strdup
(
optarg
);
break
;
break
;
#endif
#endif
case
'v'
:
b_verbose
=
1
;
break
;
case
-
1
:
case
-
1
:
break
;
break
;
default:
default:
...
@@ -496,8 +506,6 @@ int main(int i_argc, char* pa_argv[])
...
@@ -496,8 +506,6 @@ int main(int i_argc, char* pa_argv[])
uint8_t
*
p_tmp
=
&
p_data
[
i
];
uint8_t
*
p_tmp
=
&
p_data
[
i
];
uint16_t
i_pid
=
((
uint16_t
)(
p_tmp
[
1
]
&
0x1f
)
<<
8
)
+
p_tmp
[
2
];
uint16_t
i_pid
=
((
uint16_t
)(
p_tmp
[
1
]
&
0x1f
)
<<
8
)
+
p_tmp
[
2
];
int
i_cc
=
(
p_tmp
[
3
]
&
0x0f
);
int
i_cc
=
(
p_tmp
[
3
]
&
0x0f
);
int
i_old_cc
=
-
1
;
mtime_t
i_prev_pcr
=
0
;
/* 33 bits */
vlc_bool_t
b_adaptation
=
(
p_tmp
[
3
]
&
0x20
);
/* adaptation field */
vlc_bool_t
b_adaptation
=
(
p_tmp
[
3
]
&
0x20
);
/* adaptation field */
vlc_bool_t
b_discontinuity_seen
=
VLC_FALSE
;
vlc_bool_t
b_discontinuity_seen
=
VLC_FALSE
;
...
@@ -544,17 +552,35 @@ int main(int i_argc, char* pa_argv[])
...
@@ -544,17 +552,35 @@ int main(int i_argc, char* pa_argv[])
{
{
mtime_t
i_pcr
;
/* 33 bits */
mtime_t
i_pcr
;
/* 33 bits */
mtime_t
i_delta
=
0
;
mtime_t
i_delta
=
0
;
struct
timeval
tv
;
i_pcr
=
(
(
mtime_t
)
p_tmp
[
6
]
<<
25
)
|
i_pcr
=
(
(
(
mtime_t
)
p_tmp
[
6
]
<<
25
)
|
(
(
mtime_t
)
p_tmp
[
7
]
<<
17
)
|
(
(
mtime_t
)
p_tmp
[
7
]
<<
17
)
|
(
(
mtime_t
)
p_tmp
[
8
]
<<
9
)
|
(
(
mtime_t
)
p_tmp
[
8
]
<<
9
)
|
(
(
mtime_t
)
p_tmp
[
9
]
<<
1
)
|
(
(
mtime_t
)
p_tmp
[
9
]
<<
1
)
|
(
(
mtime_t
)
p_tmp
[
10
]
>>
7
)
;
(
(
mtime_t
)
p_tmp
[
10
]
>>
7
)
)
/
90
;
i_prev_pcr
=
p_stream
->
pid
[
i_pid
].
i_pcr
;
i_prev_pcr
=
p_stream
->
pid
[
i_pid
].
i_pcr
;
p_stream
->
pid
[
i_pid
].
i_pcr
=
i_pcr
;
p_stream
->
pid
[
i_pid
].
i_pcr
=
i_pcr
;
i_delta
=
p_stream
->
pid
[
i_pid
].
i_pcr
-
i_prev_pcr
;
i_delta
=
p_stream
->
pid
[
i_pid
].
i_pcr
-
i_prev_pcr
;
printf
(
"PCR "
);
if
(
b_verbose
&&
(
gettimeofday
(
&
tv
,
NULL
)
==
0
)
)
{
time_t
time_current
;
time_t
tv_delta
;
gettimeofday
(
&
tv
,
NULL
);
time_current
=
(
tv
.
tv_sec
*
1000
)
+
(
tv
.
tv_usec
/
1000
);
tv_delta
=
time_current
-
time_prev
;
printf
(
"arrival %.3ld ms "
,
(
long
)
tv_delta
);
time_prev
=
time_current
;
}
if
(
i_delta
<
0
)
if
(
i_delta
<
0
)
printf
(
"Backwards PCR %lld previous %lld, delta %lld
\n
"
,
printf
(
"value %lld previous %lld, delta %lld
\n
"
,
(
long
long
int
)
p_stream
->
pid
[
i_pid
].
i_pcr
,
(
long
long
int
)
i_prev_pcr
,
(
long
long
int
)
i_delta
);
else
if
(
b_verbose
)
printf
(
"value %lld previous %lld, delta %lld
\n
"
,
(
long
long
int
)
p_stream
->
pid
[
i_pid
].
i_pcr
,
(
long
long
int
)
i_prev_pcr
,
(
long
long
int
)
p_stream
->
pid
[
i_pid
].
i_pcr
,
(
long
long
int
)
i_prev_pcr
,
(
long
long
int
)
i_delta
);
(
long
long
int
)
i_delta
);
}
}
...
...
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