Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dvblast
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
dvblast
Commits
55f1b12a
Commit
55f1b12a
authored
Aug 26, 2011
by
Georgi Chorbadzhiyski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvblastctl: Add get_pids and get_pid <pid> commands.
parent
f55287c1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
119 additions
and
1 deletion
+119
-1
NEWS
NEWS
+1
-0
comm.c
comm.c
+28
-0
comm.h
comm.h
+9
-0
dvblastctl.c
dvblastctl.c
+81
-1
No files found.
NEWS
View file @
55f1b12a
...
@@ -20,6 +20,7 @@ Changes between 1.2 and 2.0:
...
@@ -20,6 +20,7 @@ Changes between 1.2 and 2.0:
* Add detailed information for TS errors
* Add detailed information for TS errors
* Add support for getting PAT/CAT/NIT/SDT tables in dvblastctl
* Add support for getting PAT/CAT/NIT/SDT tables in dvblastctl
* Add support for getting PMT table for chosen service in dvblastctl
* Add support for getting PMT table for chosen service in dvblastctl
* Add support for getting PID information (bps, error counters and more)
Changes between 1.1 and 1.2:
Changes between 1.1 and 1.2:
----------------------------
----------------------------
...
...
comm.c
View file @
55f1b12a
...
@@ -80,6 +80,7 @@ void comm_Read( void )
...
@@ -80,6 +80,7 @@ void comm_Read( void )
uint8_t
*
p_packed_section
;
uint8_t
*
p_packed_section
;
unsigned
int
i_packed_section_size
;
unsigned
int
i_packed_section_size
;
uint8_t
*
p_input
=
p_buffer
+
COMM_HEADER_SIZE
;
uint8_t
*
p_input
=
p_buffer
+
COMM_HEADER_SIZE
;
uint8_t
*
p_output
=
p_answer
+
COMM_HEADER_SIZE
;
i_size
=
recvfrom
(
i_comm_fd
,
p_buffer
,
COMM_BUFFER_SIZE
,
0
,
i_size
=
recvfrom
(
i_comm_fd
,
p_buffer
,
COMM_BUFFER_SIZE
,
0
,
(
struct
sockaddr
*
)
&
sun_client
,
&
sun_length
);
(
struct
sockaddr
*
)
&
sun_client
,
&
sun_length
);
...
@@ -219,6 +220,33 @@ void comm_Read( void )
...
@@ -219,6 +220,33 @@ void comm_Read( void )
break
;
break
;
}
}
case
CMD_GET_PIDS
:
{
i_answer
=
RET_PIDS
;
i_answer_size
=
sizeof
(
struct
cmd_pid_info
);
demux_get_PIDS_info
(
p_output
);
break
;
}
case
CMD_GET_PID
:
{
if
(
i_size
<
COMM_HEADER_SIZE
+
2
)
{
msg_Err
(
NULL
,
"command packet is too short (%zd)
\n
"
,
i_size
);
return
;
}
uint16_t
i_pid
=
(
uint16_t
)((
p_input
[
0
]
<<
8
)
|
p_input
[
1
]);
if
(
i_pid
>=
MAX_PIDS
)
{
i_answer
=
RET_NODATA
;
}
else
{
i_answer
=
RET_PID
;
i_answer_size
=
sizeof
(
ts_pid_info_t
);
demux_get_PID_info
(
i_pid
,
p_output
);
}
break
;
}
default:
default:
msg_Err
(
NULL
,
"wrong command %u"
,
i_command
);
msg_Err
(
NULL
,
"wrong command %u"
,
i_command
);
i_answer
=
RET_HUH
;
i_answer
=
RET_HUH
;
...
...
comm.h
View file @
55f1b12a
...
@@ -41,6 +41,8 @@
...
@@ -41,6 +41,8 @@
#define CMD_GET_NIT 12
#define CMD_GET_NIT 12
#define CMD_GET_SDT 13
#define CMD_GET_SDT 13
#define CMD_GET_PMT 14
/* arg: service_id (uint16_t) */
#define CMD_GET_PMT 14
/* arg: service_id (uint16_t) */
#define CMD_GET_PIDS 15
#define CMD_GET_PID 16
/* arg: pid (uint16_t) */
#define RET_OK 0
#define RET_OK 0
#define RET_ERR 1
#define RET_ERR 1
...
@@ -55,6 +57,8 @@
...
@@ -55,6 +57,8 @@
#define RET_NIT 10
#define RET_NIT 10
#define RET_SDT 11
#define RET_SDT 11
#define RET_PMT 12
#define RET_PMT 12
#define RET_PIDS 13
#define RET_PID 14
#define RET_HUH 255
#define RET_HUH 255
struct
ret_frontend_status
struct
ret_frontend_status
...
@@ -84,3 +88,8 @@ struct cmd_mmi_send
...
@@ -84,3 +88,8 @@ struct cmd_mmi_send
uint8_t
i_slot
;
uint8_t
i_slot
;
en50221_mmi_object_t
object
;
en50221_mmi_object_t
object
;
};
};
struct
cmd_pid_info
{
ts_pid_info_t
pids
[
MAX_PIDS
];
};
dvblastctl.c
View file @
55f1b12a
...
@@ -53,6 +53,7 @@ int i_verbose = 3;
...
@@ -53,6 +53,7 @@ int i_verbose = 3;
int
i_syslog
=
0
;
int
i_syslog
=
0
;
print_type_t
i_print_type
=
PRINT_TEXT
;
print_type_t
i_print_type
=
PRINT_TEXT
;
mtime_t
now
;
/*****************************************************************************
/*****************************************************************************
* The following two functinos are from biTStream's examples and are under the
* The following two functinos are from biTStream's examples and are under the
...
@@ -83,11 +84,60 @@ char *psi_iconv(void *_unused, const char *psz_encoding,
...
@@ -83,11 +84,60 @@ char *psi_iconv(void *_unused, const char *psz_encoding,
return
iconv_append_null
(
p_string
,
i_length
);
return
iconv_append_null
(
p_string
,
i_length
);
}
}
void
print_pids_header
(
void
)
{
if
(
i_print_type
==
PRINT_XML
)
printf
(
"<PIDS>
\n
"
);
}
void
print_pids_footer
(
void
)
{
if
(
i_print_type
==
PRINT_XML
)
printf
(
"</PIDS>
\n
"
);
}
void
print_pid
(
uint16_t
i_pid
,
ts_pid_info_t
*
p_info
)
{
if
(
p_info
->
i_packets
==
0
)
return
;
if
(
i_print_type
==
PRINT_TEXT
)
printf
(
"pid %d packn %lu ccerr %lu tserr %lu scramble %d Bps %lu seen %"
PRId64
"
\n
"
,
i_pid
,
p_info
->
i_packets
,
p_info
->
i_cc_errors
,
p_info
->
i_transport_errors
,
p_info
->
i_scrambling
,
p_info
->
i_bytes_per_sec
,
now
-
p_info
->
i_last_packet_ts
);
else
printf
(
"<PID pid=
\"
%d
\"
packn=
\"
%lu
\"
ccerr=
\"
%lu
\"
tserr=
\"
%lu
\"
scramble=
\"
%d
\"
Bps=
\"
%lu
\"
seen=
\"
%"
PRId64
"
\"
/>
\n
"
,
i_pid
,
p_info
->
i_packets
,
p_info
->
i_cc_errors
,
p_info
->
i_transport_errors
,
p_info
->
i_scrambling
,
p_info
->
i_bytes_per_sec
,
now
-
p_info
->
i_last_packet_ts
);
}
void
print_pids
(
uint8_t
*
p_data
)
{
int
i_pid
;
print_pids_header
();
for
(
i_pid
=
0
;
i_pid
<
MAX_PIDS
;
i_pid
++
)
{
ts_pid_info_t
*
p_info
=
(
ts_pid_info_t
*
)(
p_data
+
i_pid
*
sizeof
(
ts_pid_info_t
));
print_pid
(
i_pid
,
p_info
);
}
print_pids_footer
();
}
void
usage
()
void
usage
()
{
{
msg_Raw
(
NULL
,
"DVBlastctl %d.%d.%d (%s)"
,
VERSION_MAJOR
,
VERSION_MINOR
,
msg_Raw
(
NULL
,
"DVBlastctl %d.%d.%d (%s)"
,
VERSION_MAJOR
,
VERSION_MINOR
,
VERSION_REVISION
,
VERSION_EXTRA
);
VERSION_REVISION
,
VERSION_EXTRA
);
msg_Raw
(
NULL
,
"Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice|get_pat|get_cat|get_nit|get_sdt|get_pmt [<ServiceID>] [<CAM slot>] [-x <text|xml>] [<text/choice>]"
);
msg_Raw
(
NULL
,
"Usage: dvblastctl -r <remote socket> reload|shutdown|fe_status|mmi_status|mmi_open|mmi_close|mmi_get|mmi_send_text|mmi_send_choice|get_pat|get_cat|get_nit|get_sdt|get_pmt
|get_pids|get_pid [<PID>]
[<ServiceID>] [<CAM slot>] [-x <text|xml>] [<text/choice>]"
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -102,6 +152,7 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -102,6 +152,7 @@ int main( int i_argc, char **ppsz_argv )
struct
sockaddr_un
sun_client
,
sun_server
;
struct
sockaddr_un
sun_client
,
sun_server
;
uint8_t
p_buffer
[
COMM_BUFFER_SIZE
];
uint8_t
p_buffer
[
COMM_BUFFER_SIZE
];
uint8_t
*
p_data
=
p_buffer
+
COMM_HEADER_SIZE
;
uint8_t
*
p_data
=
p_buffer
+
COMM_HEADER_SIZE
;
uint16_t
i_pid
=
0
;
for
(
;
;
)
for
(
;
;
)
{
{
...
@@ -152,6 +203,8 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -152,6 +203,8 @@ int main( int i_argc, char **ppsz_argv )
&&
strcmp
(
ppsz_argv
[
optind
],
"get_nit"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_nit"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_sdt"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_sdt"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_pmt"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_pmt"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_pid"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"get_pids"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_status"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_status"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_slot_status"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_slot_status"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_open"
)
&&
strcmp
(
ppsz_argv
[
optind
],
"mmi_open"
)
...
@@ -163,6 +216,7 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -163,6 +216,7 @@ int main( int i_argc, char **ppsz_argv )
if
(
(
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_slot_status"
)
if
(
(
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_slot_status"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"get_pmt"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"get_pmt"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"get_pid"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_open"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_open"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_close"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_close"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_get"
)
||
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_get"
)
...
@@ -242,6 +296,14 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -242,6 +296,14 @@ int main( int i_argc, char **ppsz_argv )
i_size
=
COMM_HEADER_SIZE
+
2
;
i_size
=
COMM_HEADER_SIZE
+
2
;
p_data
[
0
]
=
(
uint8_t
)((
i_sid
>>
8
)
&
0xff
);
p_data
[
0
]
=
(
uint8_t
)((
i_sid
>>
8
)
&
0xff
);
p_data
[
1
]
=
(
uint8_t
)(
i_sid
&
0xff
);
p_data
[
1
]
=
(
uint8_t
)(
i_sid
&
0xff
);
}
else
if
(
!
strcmp
(
ppsz_argv
[
optind
],
"get_pids"
)
)
p_buffer
[
1
]
=
CMD_GET_PIDS
;
else
if
(
!
strcmp
(
ppsz_argv
[
optind
],
"get_pid"
)
)
{
i_pid
=
(
uint16_t
)
atoi
(
ppsz_argv
[
optind
+
1
]);
p_buffer
[
1
]
=
CMD_GET_PID
;
i_size
=
COMM_HEADER_SIZE
+
2
;
p_data
[
0
]
=
(
uint8_t
)((
i_pid
>>
8
)
&
0xff
);
p_data
[
1
]
=
(
uint8_t
)(
i_pid
&
0xff
);
}
else
if
(
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_status"
)
)
}
else
if
(
!
strcmp
(
ppsz_argv
[
optind
],
"mmi_status"
)
)
p_buffer
[
1
]
=
CMD_MMI_STATUS
;
p_buffer
[
1
]
=
CMD_MMI_STATUS
;
else
else
...
@@ -340,6 +402,8 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -340,6 +402,8 @@ int main( int i_argc, char **ppsz_argv )
exit
(
255
);
exit
(
255
);
}
}
now
=
mdate
();
switch
(
p_buffer
[
1
]
)
switch
(
p_buffer
[
1
]
)
{
{
case
RET_OK
:
case
RET_OK
:
...
@@ -395,6 +459,22 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -395,6 +459,22 @@ int main( int i_argc, char **ppsz_argv )
break
;
break
;
}
}
case
RET_PID
:
{
print_pids_header
();
print_pid
(
i_pid
,
(
ts_pid_info_t
*
)
p_data
);
print_pids_footer
();
exit
(
0
);
break
;
}
case
RET_PIDS
:
{
print_pids
(
p_data
);
exit
(
0
);
break
;
}
case
RET_FRONTEND_STATUS
:
case
RET_FRONTEND_STATUS
:
{
{
struct
ret_frontend_status
*
p_ret
=
struct
ret_frontend_status
*
p_ret
=
...
...
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