Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
vlc
Commits
e2fc6acb
Commit
e2fc6acb
authored
May 07, 2004
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring of dvb.c and access.c. Coding style and messages cleanup.
parent
82957718
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
607 additions
and
641 deletions
+607
-641
modules/access/dvb/access.c
modules/access/dvb/access.c
+279
-199
modules/access/dvb/dvb.c
modules/access/dvb/dvb.c
+274
-419
modules/access/dvb/dvb.h
modules/access/dvb/dvb.h
+43
-17
modules/access/dvb/qpsk.c
modules/access/dvb/qpsk.c
+11
-6
No files found.
modules/access/dvb/access.c
View file @
e2fc6acb
...
@@ -73,116 +73,73 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -73,116 +73,73 @@ int E_(Open) ( vlc_object_t *p_this )
{
{
struct
dvb_frontend_info
frontend_info
;
struct
dvb_frontend_info
frontend_info
;
struct
dvb_frontend_parameters
fep
;
struct
dvb_frontend_parameters
fep
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_
socket_t
*
p_satellite
;
input_
dvb_t
*
p_dvb
;
char
*
psz_parser
;
char
*
psz_parser
;
char
*
psz_next
;
char
*
psz_next
;
int
i_fd
=
0
;
int
i_fd
=
0
;
unsigned
int
u_adapter
=
1
;
unsigned
int
u_device
=
0
;
unsigned
int
u_freq
=
0
;
unsigned
int
u_srate
=
0
;
unsigned
int
u_lnb_lof1
;
unsigned
int
u_lnb_lof2
;
unsigned
int
u_lnb_slof
;
int
i_bandwidth
=
0
;
int
i_modulation
=
0
;
int
i_guard
=
0
;
int
i_transmission
=
0
;
int
i_hierarchy
=
0
;
int
i_polarisation
=
0
;
int
i_fec
=
0
;
int
i_code_rate_HP
=
0
;
int
i_code_rate_LP
=
0
;
vlc_bool_t
b_diseqc
;
vlc_bool_t
b_probe
;
char
dvr
[]
=
DVR
;
char
dvr
[]
=
DVR
;
char
frontend
[]
=
FRONTEND
;
char
frontend
[]
=
FRONTEND
;
int
i_len
=
0
;
int
i_len
=
0
;
vlc_value_t
val
;
vlc_value_t
val
;
int
i_test
;
int
i_test
;
/* parse the options passed in command line : */
/* parse the options passed in command line : */
psz_parser
=
strdup
(
p_input
->
psz_name
);
psz_parser
=
strdup
(
p_input
->
psz_name
);
if
(
!
psz_parser
)
if
(
!
psz_parser
)
{
{
return
(
-
1
);
return
(
-
1
);
}
}
// Get adapter and device number to use for this dvb card
msg_Dbg
(
p_input
,
"method of access is %s"
,
p_input
->
psz_access
);
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
/* Initialise structure */
p_dvb
=
malloc
(
sizeof
(
input_dvb_t
)
);
/* Get antenna configuration options */
b_diseqc
=
config_GetInt
(
p_input
,
"diseqc"
);
if
(
p_dvb
==
NULL
)
u_lnb_lof1
=
config_GetInt
(
p_input
,
"lnb-lof1"
);
u_lnb_lof2
=
config_GetInt
(
p_input
,
"lnb-lof2"
);
u_lnb_slof
=
config_GetInt
(
p_input
,
"lnb-slof"
);
/*Get modulation parameters*/
i_bandwidth
=
config_GetInt
(
p_input
,
"bandwidth"
);
i_code_rate_HP
=
config_GetInt
(
p_input
,
"code-rate-hp"
);
i_code_rate_LP
=
config_GetInt
(
p_input
,
"code-rate-lp"
);
i_modulation
=
config_GetInt
(
p_input
,
"modulation"
);
i_transmission
=
config_GetInt
(
p_input
,
"transmission"
);
i_guard
=
config_GetInt
(
p_input
,
"guard"
);
i_hierarchy
=
config_GetInt
(
p_input
,
"hierarchy"
);
/* Determine frontend device information and capabilities */
b_probe
=
config_GetInt
(
p_input
,
"probe"
);
if
(
b_probe
)
{
{
if
(
ioctl_InfoFrontend
(
p_input
,
&
frontend_info
,
u_adapter
,
u_device
)
<
0
)
msg_Err
(
p_input
,
"out of memory"
);
{
return
-
1
;
msg_Err
(
p_input
,
"(access) cannot determine frontend info"
);
return
-
1
;
}
}
}
else
/* no frontend probing is done so use default border values. */
{
msg_Dbg
(
p_input
,
"using default values for frontend info"
);
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
strncpy
(
frontend_info
.
name
,
frontend
,
128
);
msg_Dbg
(
p_input
,
"method of access is %s"
,
p_input
->
psz_access
);
p_input
->
p_access_data
=
(
void
*
)
p_dvb
;
frontend_info
.
type
=
FE_QPSK
;
if
(
strncmp
(
p_input
->
psz_access
,
"qpsk"
,
4
)
==
0
)
frontend_info
.
type
=
FE_QPSK
;
else
if
(
strncmp
(
p_input
->
psz_access
,
"cable"
,
5
)
==
0
)
frontend_info
.
type
=
FE_QAM
;
else
if
(
strncmp
(
p_input
->
psz_access
,
"terrestrial"
,
11
)
==
0
)
frontend_info
.
type
=
FE_OFDM
;
frontend_info
.
frequency_max
=
u_lnb_lof2
;
/* in KHz, lnb_lof2 */
/* Get adapter and device number to use for this dvb card */
frontend_info
.
frequency_min
=
u_lnb_lof1
;
/* lnb_lof1 */
p_dvb
->
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
p_dvb
->
u_device
=
config_GetInt
(
p_input
,
"device"
);
p_dvb
->
b_probe
=
config_GetInt
(
p_input
,
"probe"
);
/* Get antenna configuration options */
p_dvb
->
b_diseqc
=
config_GetInt
(
p_input
,
"diseqc"
);
p_dvb
->
u_lnb_lof1
=
config_GetInt
(
p_input
,
"lnb-lof1"
);
p_dvb
->
u_lnb_lof2
=
config_GetInt
(
p_input
,
"lnb-lof2"
);
p_dvb
->
u_lnb_slof
=
config_GetInt
(
p_input
,
"lnb-slof"
);
/* Get modulation parameters */
p_dvb
->
i_bandwidth
=
config_GetInt
(
p_input
,
"bandwidth"
);
p_dvb
->
i_code_rate_HP
=
config_GetInt
(
p_input
,
"code-rate-hp"
);
p_dvb
->
i_code_rate_LP
=
config_GetInt
(
p_input
,
"code-rate-lp"
);
p_dvb
->
i_modulation
=
config_GetInt
(
p_input
,
"modulation"
);
p_dvb
->
i_transmission
=
config_GetInt
(
p_input
,
"transmission"
);
p_dvb
->
i_guard
=
config_GetInt
(
p_input
,
"guard"
);
p_dvb
->
i_hierarchy
=
config_GetInt
(
p_input
,
"hierarchy"
);
frontend_info
.
symbol_rate_max
=
30000000
;
frontend_info
.
symbol_rate_min
=
1000000
;
}
/* Register Callback functions */
/* Register Callback functions */
p_input
->
pf_read
=
SatelliteRead
;
p_input
->
pf_read
=
SatelliteRead
;
p_input
->
pf_set_program
=
SatelliteSetProgram
;
p_input
->
pf_set_program
=
SatelliteSetProgram
;
p_input
->
pf_set_area
=
SatelliteSetArea
;
p_input
->
pf_set_area
=
SatelliteSetArea
;
p_input
->
pf_seek
=
SatelliteSeek
;
p_input
->
pf_seek
=
SatelliteSeek
;
/* Parse commandline */
i_test
=
strtol
(
psz_parser
,
&
psz_next
,
10
);
i_test
=
strtol
(
psz_parser
,
&
psz_next
,
10
);
if
(
psz_next
==
psz_parser
)
if
(
psz_next
==
psz_parser
)
{
{
for
(
;;
)
for
(
;;
)
{
{
if
(
!
strncmp
(
psz_parser
,
"frequency="
,
if
(
!
strncmp
(
psz_parser
,
"frequency="
,
strlen
(
"frequency="
)
)
)
strlen
(
"frequency="
)
)
)
{
{
u_freq
=
p_dvb
->
u_freq
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"frequency="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"frequency="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
...
@@ -196,41 +153,41 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -196,41 +153,41 @@ int E_(Open) ( vlc_object_t *p_this )
{
{
psz_parser
++
;
psz_parser
++
;
}
}
if
(
(
!
strncmp
(
psz_parser_init
,
"V"
,
if
(
(
!
strncmp
(
psz_parser_init
,
"V"
,
psz_parser
-
psz_parser_init
)
)
||
psz_parser
-
psz_parser_init
)
)
||
(
!
strncmp
(
psz_parser_init
,
"V"
,
(
!
strncmp
(
psz_parser_init
,
"V"
,
psz_parser
-
psz_parser_init
)
)
)
psz_parser
-
psz_parser_init
)
)
)
{
{
i_polarisation
=
0
;
//
VLC_FALSE;
p_dvb
->
i_polarisation
=
VLC_FALSE
;
}
}
else
if
(
(
!
strncmp
(
psz_parser_init
,
"H"
,
else
if
(
(
!
strncmp
(
psz_parser_init
,
"H"
,
psz_parser
-
psz_parser_init
)
)
||
psz_parser
-
psz_parser_init
)
)
||
(
!
strncmp
(
psz_parser_init
,
"h"
,
(
!
strncmp
(
psz_parser_init
,
"h"
,
psz_parser
-
psz_parser_init
)
)
)
psz_parser
-
psz_parser_init
)
)
)
{
{
i_polarisation
=
1
;
//
VLC_TRUE;
p_dvb
->
i_polarisation
=
VLC_TRUE
;
}
}
else
if
(
(
!
strncmp
(
psz_parser_init
,
"A"
,
else
if
(
(
!
strncmp
(
psz_parser_init
,
"A"
,
psz_parser
-
psz_parser_init
)
)
||
psz_parser
-
psz_parser_init
)
)
||
(
!
strncmp
(
psz_parser_init
,
"a"
,
(
!
strncmp
(
psz_parser_init
,
"a"
,
psz_parser
-
psz_parser_init
)
)
)
psz_parser
-
psz_parser_init
)
)
)
{
{
i_polarisation
=
2
;
p_dvb
->
i_polarisation
=
2
;
}
}
}
}
else
if
(
!
strncmp
(
psz_parser
,
"fec="
,
else
if
(
!
strncmp
(
psz_parser
,
"fec="
,
strlen
(
"fec="
)
)
)
strlen
(
"fec="
)
)
)
{
{
i_fec
=
p_dvb
->
i_fec
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"fec="
),
(
int
)
strtol
(
psz_parser
+
strlen
(
"fec="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"srate="
,
else
if
(
!
strncmp
(
psz_parser
,
"srate="
,
strlen
(
"srate="
)
)
)
strlen
(
"srate="
)
)
)
{
{
u_srate
=
p_dvb
->
u_srate
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"srate="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"srate="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
...
@@ -245,92 +202,92 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -245,92 +202,92 @@ int E_(Open) ( vlc_object_t *p_this )
strlen
(
"disecq"
)
)
)
strlen
(
"disecq"
)
)
)
{
{
psz_parser
+=
strlen
(
"disecq"
);
psz_parser
+=
strlen
(
"disecq"
);
b_diseqc
=
VLC_TRUE
;
p_dvb
->
b_diseqc
=
VLC_TRUE
;
}
}
else
if
(
!
strncmp
(
psz_parser
,
"lnb-lof1="
,
else
if
(
!
strncmp
(
psz_parser
,
"lnb-lof1="
,
strlen
(
"lnb-lof1="
)
)
)
strlen
(
"lnb-lof1="
)
)
)
{
{
u_lnb_lof1
=
p_dvb
->
u_lnb_lof1
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-lof1="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-lof1="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
frontend_info
.
frequency_min
=
u_lnb_lof1
;
/* lnb_lof1 */
frontend_info
.
frequency_min
=
p_dvb
->
u_lnb_lof1
;
/* lnb_lof1 */
}
}
else
if
(
!
strncmp
(
psz_parser
,
"lnb-lof2="
,
else
if
(
!
strncmp
(
psz_parser
,
"lnb-lof2="
,
strlen
(
"lnb-lof2="
)
)
)
strlen
(
"lnb-lof2="
)
)
)
{
{
u_lnb_lof2
=
p_dvb
->
u_lnb_lof2
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-lof2="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-lof2="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
frontend_info
.
frequency_max
=
u_lnb_lof2
;
/* in KHz, lnb_lof2 */
frontend_info
.
frequency_max
=
p_dvb
->
u_lnb_lof2
;
/* in KHz, lnb_lof2 */
}
}
else
if
(
!
strncmp
(
psz_parser
,
"lnb-slof="
,
else
if
(
!
strncmp
(
psz_parser
,
"lnb-slof="
,
strlen
(
"lnb-slof="
)
)
)
strlen
(
"lnb-slof="
)
)
)
{
{
u_lnb_slof
=
p_dvb
->
u_lnb_slof
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-slof="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"lnb-slof="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"device="
,
else
if
(
!
strncmp
(
psz_parser
,
"device="
,
strlen
(
"device="
)
)
)
strlen
(
"device="
)
)
)
{
{
u_device
=
p_dvb
->
u_device
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"device="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"device="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"adapter="
,
else
if
(
!
strncmp
(
psz_parser
,
"adapter="
,
strlen
(
"adapter="
)
)
)
strlen
(
"adapter="
)
)
)
{
{
u_adapter
=
p_dvb
->
u_adapter
=
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"adapter="
),
(
unsigned
int
)
strtol
(
psz_parser
+
strlen
(
"adapter="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"modulation="
,
else
if
(
!
strncmp
(
psz_parser
,
"modulation="
,
strlen
(
"modulation="
)
)
)
strlen
(
"modulation="
)
)
)
{
{
i_modulation
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"modulation="
),
p_dvb
->
i_modulation
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"modulation="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"bandwidth="
,
else
if
(
!
strncmp
(
psz_parser
,
"bandwidth="
,
strlen
(
"bandwidth="
)
)
)
strlen
(
"bandwidth="
)
)
)
{
{
i_bandwidth
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"bandwidth="
),
p_dvb
->
i_bandwidth
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"bandwidth="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"guard="
,
else
if
(
!
strncmp
(
psz_parser
,
"guard="
,
strlen
(
"guard="
)
)
)
strlen
(
"guard="
)
)
)
{
{
i_guard
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"guard="
),
p_dvb
->
i_guard
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"guard="
),
&
psz_parser
,
0
);
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"transmission="
,
else
if
(
!
strncmp
(
psz_parser
,
"transmission="
,
strlen
(
"transmission="
)
)
)
strlen
(
"transmission="
)
)
)
{
{
i_transmission
=
(
int
)
strtol
(
psz_parser
+
p_dvb
->
i_transmission
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"transmission="
),
&
psz_parser
,
0
);
strlen
(
"transmission="
),
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"hierarchy="
,
else
if
(
!
strncmp
(
psz_parser
,
"hierarchy="
,
strlen
(
"hierarchy="
)
)
)
strlen
(
"hierarchy="
)
)
)
{
{
i_hierarchy
=
(
int
)
strtol
(
psz_parser
+
p_dvb
->
i_hierarchy
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"hierarchy="
),
&
psz_parser
,
0
);
strlen
(
"hierarchy="
),
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"code-rate-HP="
,
else
if
(
!
strncmp
(
psz_parser
,
"code-rate-HP="
,
strlen
(
"code-rate-HP="
)
)
)
strlen
(
"code-rate-HP="
)
)
)
{
{
i_code_rate_HP
=
(
int
)
strtol
(
psz_parser
+
p_dvb
->
i_code_rate_HP
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"code-rate-HP="
),
&
psz_parser
,
0
);
strlen
(
"code-rate-HP="
),
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"code-rate-LP="
,
else
if
(
!
strncmp
(
psz_parser
,
"code-rate-LP="
,
strlen
(
"code-rate-LP="
)
)
)
strlen
(
"code-rate-LP="
)
)
)
{
{
i_code_rate_LP
=
(
int
)
strtol
(
psz_parser
+
p_dvb
->
i_code_rate_LP
=
(
int
)
strtol
(
psz_parser
+
strlen
(
"code-rate-LP="
),
&
psz_parser
,
0
);
strlen
(
"code-rate-LP="
),
&
psz_parser
,
0
);
}
}
else
if
(
!
strncmp
(
psz_parser
,
"probe"
,
else
if
(
!
strncmp
(
psz_parser
,
"probe"
,
strlen
(
"probe"
)
)
)
strlen
(
"probe"
)
)
)
{
{
psz_parser
+=
strlen
(
"probe"
);
psz_parser
+=
strlen
(
"probe"
);
b_probe
=
VLC_TRUE
;
p_dvb
->
b_probe
=
VLC_TRUE
;
}
}
if
(
*
psz_parser
)
if
(
*
psz_parser
)
psz_parser
++
;
psz_parser
++
;
...
@@ -340,51 +297,163 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -340,51 +297,163 @@ int E_(Open) ( vlc_object_t *p_this )
}
}
else
else
{
{
msg_Err
(
p_input
,
"DVB Input old syntax deprecreated, use vlc -p dvb to see an explantion of the new syntax"
);
msg_Err
(
p_input
,
"DVB Input old syntax deprecreated"
);
free
(
p_dvb
);
return
-
1
;
}
/* Determine frontend device */
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
msg_Dbg
(
p_input
,
"Opening device %s"
,
frontend
);
if
(
(
p_dvb
->
i_frontend
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"Opening device failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"Opening device failed"
);
# endif
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
}
/* Determine frontend device information and capabilities */
if
(
p_dvb
->
b_probe
)
{
if
(
ioctl_InfoFrontend
(
p_input
,
&
frontend_info
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
<
0
)
{
msg_Err
(
p_input
,
"(access) cannot determine frontend info"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
}
}
else
/* no frontend probing is done so use default border values. */
{
msg_Dbg
(
p_input
,
"using default values for frontend info"
);
strncpy
(
frontend_info
.
name
,
frontend
,
128
);
frontend_info
.
type
=
FE_QPSK
;
if
(
(
strncmp
(
p_input
->
psz_access
,
"qpsk"
,
4
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-s"
,
5
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"satellite"
,
9
)
==
0
)
)
frontend_info
.
type
=
FE_QPSK
;
else
if
(
(
strncmp
(
p_input
->
psz_access
,
"cable"
,
5
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-c"
,
5
)
==
0
)
)
frontend_info
.
type
=
FE_QAM
;
else
if
(
(
strncmp
(
p_input
->
psz_access
,
"terrestrial"
,
11
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-t"
,
5
)
==
0
)
)
frontend_info
.
type
=
FE_OFDM
;
frontend_info
.
frequency_max
=
p_dvb
->
u_lnb_lof2
;
/* in KHz, lnb_lof2 */
frontend_info
.
frequency_min
=
p_dvb
->
u_lnb_lof1
;
/* lnb_lof1 */
frontend_info
.
symbol_rate_max
=
30000000
;
frontend_info
.
symbol_rate_min
=
1000000
;
}
/* Sanity check */
if
(
((
strncmp
(
p_input
->
psz_access
,
"qpsk"
,
4
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-s"
,
5
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"satellite"
,
9
)
==
0
)
)
&&
(
frontend_info
.
type
!=
FE_QPSK
)
)
{
if
(
frontend_info
.
type
==
FE_OFDM
)
msg_Err
(
p_input
,
"User expects DVB-S card but DVB-T card found."
);
else
if
(
frontend_info
.
type
==
FE_QAM
)
msg_Err
(
p_input
,
"User expects DVB-S card but DVB-C card found."
);
else
msg_Err
(
p_input
,
"User expects DVB-S card but unknown card found."
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
}
if
(
((
strncmp
(
p_input
->
psz_access
,
"cable"
,
5
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-c"
,
5
)
==
0
)
)
&&
(
frontend_info
.
type
!=
FE_QAM
)
)
{
if
(
frontend_info
.
type
==
FE_OFDM
)
msg_Err
(
p_input
,
"User expects DVB-C card but DVB-T card found."
);
else
if
(
frontend_info
.
type
==
FE_QPSK
)
msg_Err
(
p_input
,
"User expects DVB-C card but DVB-S card found."
);
else
msg_Err
(
p_input
,
"User expects DVB-C card but unknown card found."
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
}
if
(
((
strncmp
(
p_input
->
psz_access
,
"terrestrial"
,
11
)
==
0
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-t"
,
5
)
==
0
)
)
&&
(
frontend_info
.
type
!=
FE_OFDM
)
)
{
if
(
frontend_info
.
type
==
FE_QAM
)
msg_Err
(
p_input
,
"User expects DVB-T card but DVB-C card found."
);
else
if
(
frontend_info
.
type
==
FE_QPSK
)
msg_Err
(
p_input
,
"User expects DVB-T card but DVB-S card found."
);
else
msg_Err
(
p_input
,
"User expects DVB-T card but unknown card found."
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
/* Validating input values */
#if 0
if
(
((
u_freq
)
>
frontend_info
.
frequency_max
)
||
/* Validating input values (QPSK in KHz, OFDM/QAM in Hz) */
((
u_freq
)
<
frontend_info
.
frequency_min
)
)
if( ((p_dvb->u_freq) > frontend_info.frequency_max) ||
((p_dvb->u_freq) < frontend_info.frequency_min) )
{
{
if
((
u_freq
)
>
frontend_info
.
frequency_max
)
if
( (p_dvb->u_freq) > frontend_info.frequency_max
)
msg_Err( p_input, "given frequency %u (kHz) > %u (kHz) max. frequency",
msg_Err( p_input, "given frequency %u (kHz) > %u (kHz) max. frequency",
u_freq
,
frontend_info
.
frequency_max
);
p_dvb->
u_freq, frontend_info.frequency_max );
else
else
msg_Err( p_input, "given frequency %u (kHz) < %u (kHz) min.frequency",
msg_Err( p_input, "given frequency %u (kHz) < %u (kHz) min.frequency",
u_freq
,
frontend_info
.
frequency_min
);
p_dvb->u_freq, frontend_info.frequency_min );
msg_Err
(
p_input
,
"baling out given frequency outside specification range for this frontend"
);
msg_Err( p_input, "bailing out given frequency outside specification range for this frontend" );
close( p_dvb->i_frontend );
free( p_dvb );
return -1;
return -1;
}
}
#endif
/* Workaround for backwards compatibility */
/* Workaround for backwards compatibility */
if
(
strncmp
(
p_input
->
psz_access
,
"satellite"
,
9
)
==
0
)
if
(
strncmp
(
p_input
->
psz_access
,
"satellite"
,
9
)
==
0
)
{
{
msg_Warn
(
p_input
,
"invalid symbol rate %d possibly specified in MHz, trying value *1000 KHz"
,
u_freq
);
msg_Warn
(
p_input
,
"invalid symbol rate %d possibly specified in MHz, trying value *1000 KHz"
,
p_dvb
->
u_srate
);
u_srate
*=
1000
;
p_dvb
->
u_srate
*=
1000UL
;
}
}
if
(
((
u_srate
)
>
frontend_info
.
symbol_rate_max
)
||
if
(
((
p_dvb
->
u_srate
)
>
frontend_info
.
symbol_rate_max
)
||
((
u_srate
)
<
frontend_info
.
symbol_rate_min
)
)
((
p_dvb
->
u_srate
)
<
frontend_info
.
symbol_rate_min
)
)
{
{
msg_Warn
(
p_input
,
"invalid symbol rate, using default one"
);
msg_Warn
(
p_input
,
"invalid symbol rate, using default one"
);
u_srate
=
config_GetInt
(
p_input
,
"symbol-rate"
);
p_dvb
->
u_srate
=
config_GetInt
(
p_input
,
"symbol-rate"
);
if
(
((
u_srate
)
>
frontend_info
.
symbol_rate_max
)
||
if
(
((
p_dvb
->
u_srate
)
>
frontend_info
.
symbol_rate_max
)
||
((
u_srate
)
<
frontend_info
.
symbol_rate_min
)
)
((
p_dvb
->
u_srate
)
<
frontend_info
.
symbol_rate_min
)
)
{
{
msg_Err
(
p_input
,
"invalid default symbol rate"
);
msg_Err
(
p_input
,
"invalid default symbol rate"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
}
}
if
(
(
i_fec
>
9
)
||
(
i_fec
<
1
)
)
if
(
(
p_dvb
->
i_fec
>
9
)
||
(
p_dvb
->
i_fec
<
1
)
)
{
{
msg_Warn
(
p_input
,
"invalid FEC, using default one"
);
msg_Warn
(
p_input
,
"invalid FEC, using default one"
);
i_fec
=
config_GetInt
(
p_input
,
"fec"
);
p_dvb
->
i_fec
=
config_GetInt
(
p_input
,
"fec"
);
if
(
(
i_fec
>
9
)
||
(
i_fec
<
1
)
)
if
(
(
p_dvb
->
i_fec
>
9
)
||
(
p_dvb
->
i_fec
<
1
)
)
{
{
msg_Err
(
p_input
,
"invalid default FEC"
);
msg_Err
(
p_input
,
"invalid default FEC"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -395,112 +464,129 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -395,112 +464,129 @@ int E_(Open) ( vlc_object_t *p_this )
{
{
/* DVB-S: satellite and budget cards (nova) */
/* DVB-S: satellite and budget cards (nova) */
case
FE_QPSK
:
case
FE_QPSK
:
fep
.
frequency
=
u_freq
;
/* KHz */
fep
.
frequency
=
p_dvb
->
u_freq
;
/* KHz */
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
i_polarisation
);
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
p_dvb
->
i_polarisation
);
fep
.
u
.
qpsk
.
symbol_rate
=
u_srate
;
fep
.
u
.
qpsk
.
symbol_rate
=
p_dvb
->
u_srate
;
fep
.
u
.
qpsk
.
fec_inner
=
dvb_DecodeFEC
(
p_input
,
i_fec
);
fep
.
u
.
qpsk
.
fec_inner
=
dvb_DecodeFEC
(
p_input
,
p_dvb
->
i_fec
);
msg_Dbg
(
p_input
,
"DVB-S: satellite (QPSK) frontend %s found"
,
frontend_info
.
name
);
msg_Dbg
(
p_input
,
"DVB-S: satellite (QPSK) frontend %s found"
,
frontend_info
.
name
);
if
(
ioctl_SetQPSKFrontend
(
p_input
,
fep
,
i_polarisation
,
if
(
ioctl_SetQPSKFrontend
(
p_input
,
fep
,
p_dvb
->
i_polarisation
,
u_lnb_lof1
,
u_lnb_lof2
,
u_lnb_slof
,
p_dvb
->
u_lnb_lof1
,
p_dvb
->
u_lnb_lof2
,
p_dvb
->
u_lnb_slof
,
u_adapter
,
u_device
)
<
0
)
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
<
0
)
{
{
msg_Err
(
p_input
,
"DVB-S: tuning failed"
);
msg_Err
(
p_input
,
"DVB-S: tuning failed"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
break
;
break
;
/* DVB-C */
/* DVB-C */
case
FE_QAM
:
case
FE_QAM
:
fep
.
frequency
=
u_freq
;
/* in Hz */
fep
.
frequency
=
p_dvb
->
u_freq
;
/* in Hz */
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
i_polarisation
);
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
p_dvb
->
i_polarisation
);
fep
.
u
.
qam
.
symbol_rate
=
u_srate
;
fep
.
u
.
qam
.
symbol_rate
=
p_dvb
->
u_srate
;
fep
.
u
.
qam
.
fec_inner
=
dvb_DecodeFEC
(
p_input
,
i_fec
);
fep
.
u
.
qam
.
fec_inner
=
dvb_DecodeFEC
(
p_input
,
p_dvb
->
i_fec
);
fep
.
u
.
qam
.
modulation
=
dvb_DecodeModulation
(
p_input
,
i_modulation
);
fep
.
u
.
qam
.
modulation
=
dvb_DecodeModulation
(
p_input
,
p_dvb
->
i_modulation
);
msg_Dbg
(
p_input
,
"DVB-C: cable (QAM) frontend %s found"
,
frontend_info
.
name
);
msg_Dbg
(
p_input
,
"DVB-C: cable (QAM) frontend %s found"
,
frontend_info
.
name
);
if
(
ioctl_SetQAMFrontend
(
p_input
,
fep
,
u_adapter
,
u_device
)
<
0
)
if
(
ioctl_SetQAMFrontend
(
p_input
,
fep
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
<
0
)
{
{
msg_Err
(
p_input
,
"DVB-C: tuning failed"
);
msg_Err
(
p_input
,
"DVB-C: tuning failed"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
break
;
break
;
/* DVB-T */
/* DVB-T */
case
FE_OFDM
:
case
FE_OFDM
:
fep
.
frequency
=
u_freq
;
/* in Hz */
fep
.
frequency
=
p_dvb
->
u_freq
;
/* in Hz */
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
i_polarisation
);
fep
.
inversion
=
dvb_DecodeInversion
(
p_input
,
p_dvb
->
i_polarisation
);
fep
.
u
.
ofdm
.
bandwidth
=
dvb_DecodeBandwidth
(
p_input
,
i_bandwidth
);
fep
.
u
.
ofdm
.
bandwidth
=
dvb_DecodeBandwidth
(
p_input
,
p_dvb
->
i_bandwidth
);
fep
.
u
.
ofdm
.
code_rate_HP
=
dvb_DecodeFEC
(
p_input
,
i_code_rate_HP
);
fep
.
u
.
ofdm
.
code_rate_HP
=
dvb_DecodeFEC
(
p_input
,
p_dvb
->
i_code_rate_HP
);
fep
.
u
.
ofdm
.
code_rate_LP
=
dvb_DecodeFEC
(
p_input
,
i_code_rate_LP
);
fep
.
u
.
ofdm
.
code_rate_LP
=
dvb_DecodeFEC
(
p_input
,
p_dvb
->
i_code_rate_LP
);
fep
.
u
.
ofdm
.
constellation
=
dvb_DecodeModulation
(
p_input
,
i_modulation
);
fep
.
u
.
ofdm
.
constellation
=
dvb_DecodeModulation
(
p_input
,
p_dvb
->
i_modulation
);
fep
.
u
.
ofdm
.
transmission_mode
=
dvb_DecodeTransmission
(
p_input
,
i_transmission
);
fep
.
u
.
ofdm
.
transmission_mode
=
dvb_DecodeTransmission
(
p_input
,
p_dvb
->
i_transmission
);
fep
.
u
.
ofdm
.
guard_interval
=
dvb_DecodeGuardInterval
(
p_input
,
i_guard
);
fep
.
u
.
ofdm
.
guard_interval
=
dvb_DecodeGuardInterval
(
p_input
,
p_dvb
->
i_guard
);
fep
.
u
.
ofdm
.
hierarchy_information
=
dvb_DecodeHierarchy
(
p_input
,
i_hierarchy
);
fep
.
u
.
ofdm
.
hierarchy_information
=
dvb_DecodeHierarchy
(
p_input
,
p_dvb
->
i_hierarchy
);
msg_Dbg
(
p_input
,
"DVB-T: terrestrial (OFDM) frontend %s found"
,
frontend_info
.
name
);
msg_Dbg
(
p_input
,
"DVB-T: terrestrial (OFDM) frontend %s found"
,
frontend_info
.
name
);
if
(
ioctl_SetOFDMFrontend
(
p_input
,
fep
,
u_adapter
,
u_device
)
<
0
)
if
(
ioctl_SetOFDMFrontend
(
p_input
,
fep
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
<
0
)
{
{
msg_Err
(
p_input
,
"DVB-T: tuning failed"
);
msg_Err
(
p_input
,
"DVB-T: tuning failed"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
break
;
break
;
default:
default:
msg_Err
(
p_input
,
"Could not determine frontend type on %s"
,
frontend_info
.
name
);
msg_Err
(
p_input
,
"Could not determine frontend type on %s"
,
frontend_info
.
name
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
msg_Dbg
(
p_input
,
"Tuning done."
);
msg_Dbg
(
p_input
,
"Tuning done."
);
/* Initialise structure */
/* Initialise structure */
p_satellite
=
malloc
(
sizeof
(
input_socket_t
)
);
p_
dvb
->
p_
satellite
=
malloc
(
sizeof
(
input_socket_t
)
);
if
(
p_satellite
==
NULL
)
if
(
p_
dvb
->
p_
satellite
==
NULL
)
{
{
msg_Err
(
p_input
,
"out of memory"
);
msg_Err
(
p_input
,
"out of memory"
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
p_input
->
p_access_data
=
(
void
*
)
p_satellite
;
/* Open the DVR device */
/* Open the DVR device */
i_len
=
sizeof
(
DVR
);
i_len
=
sizeof
(
DVR
);
if
(
snprintf
(
dvr
,
sizeof
(
DVR
),
DVR
,
u_adapter
,
u_device
)
>=
i_len
)
if
(
snprintf
(
dvr
,
sizeof
(
DVR
),
DVR
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
>=
i_len
)
{
{
msg_Err
(
p_input
,
"snprintf() truncated string for DVR"
);
msg_Err
(
p_input
,
"snprintf() truncated string for DVR"
);
dvr
[
sizeof
(
DVR
)]
=
'\0'
;
dvr
[
sizeof
(
DVR
)]
=
'\0'
;
}
}
msg_Dbg
(
p_input
,
"opening DVR device '%s'"
,
dvr
);
msg_Dbg
(
p_input
,
"opening DVR device '%s'"
,
dvr
);
if
(
(
p_satellite
->
i_handle
=
open
(
dvr
,
if
(
(
p_
dvb
->
p_
satellite
->
i_handle
=
open
(
dvr
,
/*O_NONBLOCK | O_LARGEFILE*/
0
))
==
(
-
1
)
)
/*O_NONBLOCK | O_LARGEFILE*/
0
)
)
==
(
-
1
)
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Warn
(
p_input
,
"cannot open `%s' (%s)"
,
dvr
,
strerror
(
errno
)
);
msg_Warn
(
p_input
,
"cannot open `%s' (%s)"
,
dvr
,
strerror
(
errno
)
);
# else
# else
msg_Warn
(
p_input
,
"cannot open `%s'"
,
dvr
);
msg_Warn
(
p_input
,
"cannot open `%s'"
,
dvr
);
# endif
# endif
free
(
p_satellite
);
free
(
p_dvb
->
p_satellite
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
msg_Dbg
(
p_input
,
"setting filter on PAT"
);
msg_Dbg
(
p_input
,
"setting filter on PAT"
);
/* Set Filter on PAT packet */
/* Set Filter on PAT packet */
if
(
ioctl_SetDMXFilter
(
p_input
,
0
,
&
i_fd
,
21
,
u_adapter
,
u_device
)
<
0
)
if
(
ioctl_SetDMXFilter
(
p_input
,
0
,
&
i_fd
,
21
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"an error occured when setting filter on PAT (%s)"
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"an error occured when setting filter on PAT (%s)"
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"an error occured when setting filter on PAT"
);
msg_Err
(
p_input
,
"an error occured when setting filter on PAT"
);
# endif
# endif
close
(
p_satellite
->
i_handle
);
close
(
p_dvb
->
p_satellite
->
i_handle
);
free
(
p_satellite
);
free
(
p_dvb
->
p_satellite
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
-
1
;
return
-
1
;
}
}
if
(
input_InitStream
(
p_input
,
sizeof
(
stream_ts_data_t
)
)
==
-
1
)
if
(
input_InitStream
(
p_input
,
sizeof
(
stream_ts_data_t
)
)
==
-
1
)
{
{
msg_Err
(
p_input
,
"could not initialize stream structure"
);
msg_Err
(
p_input
,
"could not initialize stream structure"
);
close
(
p_satellite
->
i_handle
);
close
(
p_dvb
->
p_satellite
->
i_handle
);
free
(
p_satellite
);
free
(
p_dvb
->
p_satellite
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -524,17 +610,17 @@ int E_(Open) ( vlc_object_t *p_this )
...
@@ -524,17 +610,17 @@ int E_(Open) ( vlc_object_t *p_this )
void
E_
(
Close
)
(
vlc_object_t
*
p_this
)
void
E_
(
Close
)
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_
socket_t
*
p_satellite
;
input_
dvb_t
*
p_dvb
;
unsigned
int
i_es_index
;
unsigned
int
i_es_index
;
if
(
p_input
->
stream
.
p_selected_program
)
if
(
p_input
->
stream
.
p_selected_program
)
{
{
for
(
i_es_index
=
1
;
for
(
i_es_index
=
1
;
i_es_index
<
p_input
->
stream
.
p_selected_program
->
i_es_number
;
i_es_index
<
p_input
->
stream
.
p_selected_program
->
i_es_number
;
i_es_index
++
)
i_es_index
++
)
{
{
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if
(
p_es
->
p_dec
)
if
(
p_es
->
p_dec
)
{
{
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
}
}
...
@@ -542,8 +628,13 @@ void E_(Close) ( vlc_object_t *p_this )
...
@@ -542,8 +628,13 @@ void E_(Close) ( vlc_object_t *p_this )
}
}
}
}
p_satellite
=
(
input_socket_t
*
)
p_input
;
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
close
(
p_satellite
->
i_handle
);
close
(
p_dvb
->
p_satellite
->
i_handle
);
free
(
p_dvb
->
p_satellite
);
close
(
p_dvb
->
i_frontend
);
free
(
p_dvb
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -552,28 +643,22 @@ void E_(Close) ( vlc_object_t *p_this )
...
@@ -552,28 +643,22 @@ void E_(Close) ( vlc_object_t *p_this )
static
ssize_t
SatelliteRead
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
static
ssize_t
SatelliteRead
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
size_t
i_len
)
size_t
i_len
)
{
{
input_
socket_t
*
p_access_data
=
(
input_socket
_t
*
)
p_input
->
p_access_data
;
input_
dvb_t
*
p_dvb
=
(
input_dvb
_t
*
)
p_input
->
p_access_data
;
ssize_t
i_ret
;
ssize_t
i_ret
;
unsigned
int
u_adapter
=
1
;
unsigned
int
u_device
=
0
;
unsigned
int
i
;
unsigned
int
i
;
// Get adapter and device number to use for this dvb card
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
/* if not set, set filters to the PMTs */
/* if not set, set filters to the PMTs */
for
(
i
=
0
;
i
<
p_input
->
stream
.
i_pgrm_number
;
i
++
)
for
(
i
=
0
;
i
<
p_input
->
stream
.
i_pgrm_number
;
i
++
)
{
{
if
(
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
==
0
)
if
(
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
==
0
)
{
{
ioctl_SetDMXFilter
(
p_input
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
,
ioctl_SetDMXFilter
(
p_input
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
,
&
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
,
&
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
,
21
,
u_adapter
,
u_device
);
21
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
);
}
}
}
}
i_ret
=
read
(
p_
access_data
->
i_handle
,
p_buffer
,
i_len
);
i_ret
=
read
(
p_
dvb
->
p_satellite
->
i_handle
,
p_buffer
,
i_len
);
if
(
i_ret
<
0
)
if
(
i_ret
<
0
)
{
{
...
@@ -603,29 +688,24 @@ static int SatelliteSetArea( input_thread_t * p_input, input_area_t * p_area )
...
@@ -603,29 +688,24 @@ static int SatelliteSetArea( input_thread_t * p_input, input_area_t * p_area )
int
SatelliteSetProgram
(
input_thread_t
*
p_input
,
int
SatelliteSetProgram
(
input_thread_t
*
p_input
,
pgrm_descriptor_t
*
p_new_prg
)
pgrm_descriptor_t
*
p_new_prg
)
{
{
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
unsigned
int
i_es_index
;
unsigned
int
i_es_index
;
vlc_value_t
val
;
vlc_value_t
val
;
unsigned
int
u_adapter
=
1
;
unsigned
int
u_device
=
0
;
unsigned
int
u_video_type
=
1
;
/* default video type */
unsigned
int
u_video_type
=
1
;
/* default video type */
unsigned
int
u_audio_type
=
2
;
/* default audio type */
unsigned
int
u_audio_type
=
2
;
/* default audio type */
/* Get adapter and device number to use for this dvb card */
if
(
p_input
->
stream
.
p_selected_program
)
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
if
(
p_input
->
stream
.
p_selected_program
)
{
{
for
(
i_es_index
=
1
;
/* 0 should be the PMT */
for
(
i_es_index
=
1
;
/* 0 should be the PMT */
i_es_index
<
p_input
->
stream
.
p_selected_program
->
i_es_number
;
i_es_index
<
p_input
->
stream
.
p_selected_program
->
i_es_number
;
i_es_index
++
)
i_es_index
++
)
{
{
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if
(
p_es
->
p_dec
)
if
(
p_es
->
p_dec
)
{
{
input_UnselectES
(
p_input
,
p_es
);
input_UnselectES
(
p_input
,
p_es
);
}
}
if
(
p_es
->
i_demux_fd
>
0
)
if
(
p_es
->
i_demux_fd
>
0
)
{
{
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
p_es
->
i_demux_fd
=
0
;
p_es
->
i_demux_fd
=
0
;
...
@@ -642,25 +722,25 @@ int SatelliteSetProgram( input_thread_t * p_input,
...
@@ -642,25 +722,25 @@ int SatelliteSetProgram( input_thread_t * p_input,
case
MPEG1_VIDEO_ES
:
case
MPEG1_VIDEO_ES
:
case
MPEG2_VIDEO_ES
:
case
MPEG2_VIDEO_ES
:
case
MPEG2_MOTO_VIDEO_ES
:
case
MPEG2_MOTO_VIDEO_ES
:
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
{
{
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
u_video_type
,
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
u_video_type
,
u_adapter
,
u_device
);
p_dvb
->
u_adapter
,
p_dvb
->
u_device
);
u_video_type
+=
5
;
u_video_type
+=
5
;
}
}
break
;
break
;
case
MPEG1_AUDIO_ES
:
case
MPEG1_AUDIO_ES
:
case
MPEG2_AUDIO_ES
:
case
MPEG2_AUDIO_ES
:
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
{
{
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
u_audio_type
,
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
u_audio_type
,
u_adapter
,
u_device
);
p_dvb
->
u_adapter
,
p_dvb
->
u_device
);
input_SelectES
(
p_input
,
p_es
);
input_SelectES
(
p_input
,
p_es
);
u_audio_type
+=
5
;
u_audio_type
+=
5
;
}
}
break
;
break
;
default:
default:
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
21
,
u_adapter
,
u_device
);
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
21
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
);
input_SelectES
(
p_input
,
p_es
);
input_SelectES
(
p_input
,
p_es
);
msg_Warn
(
p_input
,
"ES streamtype 0x%d found used as DMX_PES_OTHER !!"
,(
int
)
p_es
->
i_cat
);
msg_Warn
(
p_input
,
"ES streamtype 0x%d found used as DMX_PES_OTHER !!"
,(
int
)
p_es
->
i_cat
);
break
;
break
;
...
...
modules/access/dvb/dvb.c
View file @
e2fc6acb
...
@@ -80,537 +80,393 @@ struct diseqc_cmd_t switch_cmds[] =
...
@@ -80,537 +80,393 @@ struct diseqc_cmd_t switch_cmds[] =
{
{
{
0xe0
,
0x10
,
0x38
,
0xff
,
0x00
,
0x00
},
4
},
0
}
{
{
{
0xe0
,
0x10
,
0x38
,
0xff
,
0x00
,
0x00
},
4
},
0
}
};
};
static
int
ioctl_CheckFrontend
(
input_thread_t
*
p_input
,
int
front
);
static
int
ioctl_CheckFrontend
(
input_thread_t
*
p_input
,
fe_type_t
type
);
/*****************************************************************************
/*****************************************************************************
* ioctl_InfoFrontend : return information about given frontend
* ioctl_InfoFrontend : return information about given frontend
*****************************************************************************/
*****************************************************************************/
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
,
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
)
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
{
int
front
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
ret
;
int
fd_front
=
p_dvb
->
i_frontend
;
char
frontend
[]
=
FRONTEND
;
int
i_ret
;
int
i_len
;
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
msg_Dbg
(
p_input
,
"Opening device %s"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_InfoFrontEnd: opening device failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_InfoFrontEnd: opening device failed"
);
# endif
return
-
1
;
}
/* Determine type of frontend */
/* Determine type of frontend */
if
((
ret
=
ioctl
(
front
,
FE_GET_INFO
,
info
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_GET_INFO
,
info
))
<
0
)
{
{
close
(
front
);
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_GET_INFO failed (%d) %s"
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"Getting info from frontend failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl FE_GET_INFO failed (%d)"
,
ret
);
msg_Err
(
p_input
,
"Getting info from frontend failed (%d)"
,
i_ret
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
/* Print out frontend capabilities. */
/* Print out frontend capabilities. */
msg_Dbg
(
p_input
,
"Frontend Info:"
);
msg_Dbg
(
p_input
,
"Frontend Info:"
);
msg_Dbg
(
p_input
,
" name = %s"
,
info
->
name
);
msg_Dbg
(
p_input
,
" name = %s"
,
info
->
name
);
switch
(
info
->
type
)
switch
(
info
->
type
)
{
{
case
FE_QPSK
:
case
FE_QPSK
:
msg_Dbg
(
p_input
,
" type = QPSK (DVB-S)"
);
msg_Dbg
(
p_input
,
" type = QPSK (DVB-S)"
);
break
;
break
;
case
FE_QAM
:
case
FE_QAM
:
msg_Dbg
(
p_input
,
" type = QAM (DVB-C)"
);
msg_Dbg
(
p_input
,
" type = QAM (DVB-C)"
);
break
;
break
;
case
FE_OFDM
:
case
FE_OFDM
:
msg_Dbg
(
p_input
,
" type = OFDM (DVB-T)"
);
msg_Dbg
(
p_input
,
" type = OFDM (DVB-T)"
);
break
;
#if 0 /* DVB_API_VERSION == 3 */
case FE_MEMORY:
msg_Dbg(p_input, " type = MEMORY" );
break
;
break
;
case FE_NET:
msg_Dbg(p_input, " type = NETWORK" );
break;
#endif
default:
default:
msg_Err
(
p_input
,
" unknown frontend found fe_type_t(%d)"
,
info
->
type
);
msg_Err
(
p_input
,
" unknown frontend found fe_type_t(%d)"
,
info
->
type
);
return
-
1
;
return
-
1
;
}
}
msg_Dbg
(
p_input
,
" frequency_min = %u (kHz)"
,
info
->
frequency_min
);
msg_Dbg
(
p_input
,
" frequency_min = %u (kHz)"
,
info
->
frequency_min
);
msg_Dbg
(
p_input
,
" frequency_max = %u (kHz)"
,
info
->
frequency_max
);
msg_Dbg
(
p_input
,
" frequency_max = %u (kHz)"
,
info
->
frequency_max
);
msg_Dbg
(
p_input
,
" frequency_stepsize = %u"
,
info
->
frequency_stepsize
);
msg_Dbg
(
p_input
,
" frequency_stepsize = %u"
,
info
->
frequency_stepsize
);
msg_Dbg
(
p_input
,
" frequency_tolerance = %u"
,
info
->
frequency_tolerance
);
msg_Dbg
(
p_input
,
" frequency_tolerance = %u"
,
info
->
frequency_tolerance
);
msg_Dbg
(
p_input
,
" symbol_rate_min = %u (kHz)"
,
info
->
symbol_rate_min
);
msg_Dbg
(
p_input
,
" symbol_rate_min = %u (kHz)"
,
info
->
symbol_rate_min
);
msg_Dbg
(
p_input
,
" symbol_rate_max = %u (kHz)"
,
info
->
symbol_rate_max
);
msg_Dbg
(
p_input
,
" symbol_rate_max = %u (kHz)"
,
info
->
symbol_rate_max
);
msg_Dbg
(
p_input
,
" symbol_rate_tolerance (ppm) = %u"
,
info
->
symbol_rate_tolerance
);
msg_Dbg
(
p_input
,
" symbol_rate_tolerance (ppm) = %u"
,
info
->
symbol_rate_tolerance
);
msg_Dbg
(
p_input
,
" notifier_delay (ms)= %u"
,
info
->
notifier_delay
);
msg_Dbg
(
p_input
,
" notifier_delay (ms)= %u"
,
info
->
notifier_delay
);
msg_Dbg
(
p_input
,
"Frontend Info capability list:"
);
msg_Dbg
(
p_input
,
"Frontend Info capability list:"
);
if
(
info
->
caps
&
FE_IS_STUPID
)
if
(
info
->
caps
&
FE_IS_STUPID
)
msg_Dbg
(
p_input
,
" no capabilities - frontend is stupid!"
);
msg_Dbg
(
p_input
,
" no capabilities - frontend is stupid!"
);
if
(
info
->
caps
&
FE_CAN_INVERSION_AUTO
)
if
(
info
->
caps
&
FE_CAN_INVERSION_AUTO
)
msg_Dbg
(
p_input
,
" inversion auto"
);
msg_Dbg
(
p_input
,
" inversion auto"
);
if
(
info
->
caps
&
FE_CAN_FEC_1_2
)
if
(
info
->
caps
&
FE_CAN_FEC_1_2
)
msg_Dbg
(
p_input
,
" forward error correction 1/2"
);
msg_Dbg
(
p_input
,
" forward error correction 1/2"
);
if
(
info
->
caps
&
FE_CAN_FEC_2_3
)
if
(
info
->
caps
&
FE_CAN_FEC_2_3
)
msg_Dbg
(
p_input
,
" forward error correction 2/3"
);
msg_Dbg
(
p_input
,
" forward error correction 2/3"
);
if
(
info
->
caps
&
FE_CAN_FEC_3_4
)
if
(
info
->
caps
&
FE_CAN_FEC_3_4
)
msg_Dbg
(
p_input
,
" forward error correction 3/4"
);
msg_Dbg
(
p_input
,
" forward error correction 3/4"
);
if
(
info
->
caps
&
FE_CAN_FEC_4_5
)
if
(
info
->
caps
&
FE_CAN_FEC_4_5
)
msg_Dbg
(
p_input
,
" forward error correction 4/5"
);
msg_Dbg
(
p_input
,
" forward error correction 4/5"
);
if
(
info
->
caps
&
FE_CAN_FEC_5_6
)
if
(
info
->
caps
&
FE_CAN_FEC_5_6
)
msg_Dbg
(
p_input
,
" forward error correction 5/6"
);
msg_Dbg
(
p_input
,
" forward error correction 5/6"
);
if
(
info
->
caps
&
FE_CAN_FEC_6_7
)
if
(
info
->
caps
&
FE_CAN_FEC_6_7
)
msg_Dbg
(
p_input
,
" forward error correction 6/7"
);
msg_Dbg
(
p_input
,
" forward error correction 6/7"
);
if
(
info
->
caps
&
FE_CAN_FEC_7_8
)
if
(
info
->
caps
&
FE_CAN_FEC_7_8
)
msg_Dbg
(
p_input
,
" forward error correction 7/8"
);
msg_Dbg
(
p_input
,
" forward error correction 7/8"
);
if
(
info
->
caps
&
FE_CAN_FEC_8_9
)
if
(
info
->
caps
&
FE_CAN_FEC_8_9
)
msg_Dbg
(
p_input
,
" forward error correction 8/9"
);
msg_Dbg
(
p_input
,
" forward error correction 8/9"
);
if
(
info
->
caps
&
FE_CAN_FEC_AUTO
)
if
(
info
->
caps
&
FE_CAN_FEC_AUTO
)
msg_Dbg
(
p_input
,
" forward error correction auto"
);
msg_Dbg
(
p_input
,
" forward error correction auto"
);
if
(
info
->
caps
&
FE_CAN_QPSK
)
if
(
info
->
caps
&
FE_CAN_QPSK
)
msg_Dbg
(
p_input
,
" card can do QPSK"
);
msg_Dbg
(
p_input
,
" card can do QPSK"
);
if
(
info
->
caps
&
FE_CAN_QAM_16
)
if
(
info
->
caps
&
FE_CAN_QAM_16
)
msg_Dbg
(
p_input
,
" card can do QAM 16"
);
msg_Dbg
(
p_input
,
" card can do QAM 16"
);
if
(
info
->
caps
&
FE_CAN_QAM_32
)
if
(
info
->
caps
&
FE_CAN_QAM_32
)
msg_Dbg
(
p_input
,
" card can do QAM 32"
);
msg_Dbg
(
p_input
,
" card can do QAM 32"
);
if
(
info
->
caps
&
FE_CAN_QAM_64
)
if
(
info
->
caps
&
FE_CAN_QAM_64
)
msg_Dbg
(
p_input
,
" card can do QAM 64"
);
msg_Dbg
(
p_input
,
" card can do QAM 64"
);
if
(
info
->
caps
&
FE_CAN_QAM_128
)
if
(
info
->
caps
&
FE_CAN_QAM_128
)
msg_Dbg
(
p_input
,
" card can do QAM 128"
);
msg_Dbg
(
p_input
,
" card can do QAM 128"
);
if
(
info
->
caps
&
FE_CAN_QAM_256
)
if
(
info
->
caps
&
FE_CAN_QAM_256
)
msg_Dbg
(
p_input
,
" card can do QAM 256"
);
msg_Dbg
(
p_input
,
" card can do QAM 256"
);
if
(
info
->
caps
&
FE_CAN_QAM_AUTO
)
if
(
info
->
caps
&
FE_CAN_QAM_AUTO
)
msg_Dbg
(
p_input
,
" card can do QAM auto"
);
msg_Dbg
(
p_input
,
" card can do QAM auto"
);
if
(
info
->
caps
&
FE_CAN_TRANSMISSION_MODE_AUTO
)
if
(
info
->
caps
&
FE_CAN_TRANSMISSION_MODE_AUTO
)
msg_Dbg
(
p_input
,
" transmission mode auto"
);
msg_Dbg
(
p_input
,
" transmission mode auto"
);
if
(
info
->
caps
&
FE_CAN_BANDWIDTH_AUTO
)
if
(
info
->
caps
&
FE_CAN_BANDWIDTH_AUTO
)
msg_Dbg
(
p_input
,
" bandwidth mode auto"
);
msg_Dbg
(
p_input
,
" bandwidth mode auto"
);
if
(
info
->
caps
&
FE_CAN_GUARD_INTERVAL_AUTO
)
if
(
info
->
caps
&
FE_CAN_GUARD_INTERVAL_AUTO
)
msg_Dbg
(
p_input
,
" guard interval mode auto"
);
msg_Dbg
(
p_input
,
" guard interval mode auto"
);
if
(
info
->
caps
&
FE_CAN_HIERARCHY_AUTO
)
if
(
info
->
caps
&
FE_CAN_HIERARCHY_AUTO
)
msg_Dbg
(
p_input
,
" hierarchy mode auto"
);
msg_Dbg
(
p_input
,
" hierarchy mode auto"
);
if
(
info
->
caps
&
FE_CAN_MUTE_TS
)
if
(
info
->
caps
&
FE_CAN_MUTE_TS
)
msg_Dbg
(
p_input
,
" card can mute TS"
);
msg_Dbg
(
p_input
,
" card can mute TS"
);
if
(
info
->
caps
&
FE_CAN_CLEAN_SETUP
)
if
(
info
->
caps
&
FE_CAN_CLEAN_SETUP
)
msg_Dbg
(
p_input
,
" clean setup"
);
msg_Dbg
(
p_input
,
" clean setup"
);
msg_Dbg
(
p_input
,
"End of capability list"
);
msg_Dbg
(
p_input
,
"End of capability list"
);
close
(
front
);
return
0
;
return
0
;
}
}
/* QPSK only */
/* QPSK only */
int
ioctl_DiseqcSendMsg
(
input_thread_t
*
p_input
,
int
fd
,
fe_sec_voltage_t
v
,
struct
diseqc_cmd_t
**
cmd
,
int
ioctl_DiseqcSendMsg
(
input_thread_t
*
p_input
,
fe_sec_voltage_t
v
,
struct
diseqc_cmd_t
**
cmd
,
fe_sec_tone_mode_t
t
,
fe_sec_mini_cmd_t
b
)
fe_sec_tone_mode_t
t
,
fe_sec_mini_cmd_t
b
)
{
{
int
err
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
fd_front
=
p_dvb
->
i_frontend
;
if
((
err
=
ioctl
(
fd
,
FE_SET_TONE
,
SEC_TONE_OFF
))
<
0
)
int
i_ret
;
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_TONE
,
SEC_TONE_OFF
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d) %s"
,
SEC_TONE_ON
?
"on"
:
"off"
,
err
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d) %s"
,
SEC_TONE_ON
?
"on"
:
"off"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d)"
,
SEC_TONE_ON
?
"on"
:
"off"
,
err
);
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d)"
,
SEC_TONE_ON
?
"on"
:
"off"
,
i_ret
);
# endif
# endif
return
err
;
return
i_ret
;
}
}
if
((
err
=
ioctl
(
fd
,
FE_SET_VOLTAGE
,
v
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_VOLTAGE
,
v
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d) %s"
,
v
,
err
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d) %s"
,
v
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d)"
,
v
,
err
);
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d)"
,
v
,
i_ret
);
# endif
# endif
return
err
;
return
i_ret
;
}
}
msleep
(
15
);
msleep
(
15
);
while
(
*
cmd
)
while
(
*
cmd
)
{
{
msg_Dbg
(
p_input
,
"DiseqcSendMsg(): %02x %02x %02x %02x %02x %02x"
,
msg_Dbg
(
p_input
,
"DiseqcSendMsg(): %02x %02x %02x %02x %02x %02x"
,
(
*
cmd
)
->
cmd
.
msg
[
0
],
(
*
cmd
)
->
cmd
.
msg
[
1
],
(
*
cmd
)
->
cmd
.
msg
[
0
],
(
*
cmd
)
->
cmd
.
msg
[
1
],
(
*
cmd
)
->
cmd
.
msg
[
2
],
(
*
cmd
)
->
cmd
.
msg
[
3
],
(
*
cmd
)
->
cmd
.
msg
[
2
],
(
*
cmd
)
->
cmd
.
msg
[
3
],
(
*
cmd
)
->
cmd
.
msg
[
4
],
(
*
cmd
)
->
cmd
.
msg
[
5
]);
(
*
cmd
)
->
cmd
.
msg
[
4
],
(
*
cmd
)
->
cmd
.
msg
[
5
]
);
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_MASTER_CMD
,
&
(
*
cmd
)
->
cmd
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_DISEQC_SEND_MASTER_CMD
,
&
(
*
cmd
)
->
cmd
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d) %s"
,
err
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d)"
,
err
);
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d)"
,
i_ret
);
# endif
# endif
return
err
;
return
i_ret
;
}
}
msleep
(
(
*
cmd
)
->
wait
);
msleep
(
(
*
cmd
)
->
wait
);
cmd
++
;
cmd
++
;
}
}
msleep
(
15
);
msleep
(
15
);
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_DISEQC_SEND_BURST
,
b
))
<
0
)
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_BURST
,
b
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d) %s"
,
b
,
err
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d) %s"
,
b
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d)"
,
b
,
err
);
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d)"
,
b
,
i_ret
);
# endif
# endif
return
err
;
return
i_ret
;
}
}
msleep
(
15
);
msleep
(
15
);
if
((
err
=
ioctl
(
fd
,
FE_SET_TONE
,
t
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_TONE
,
t
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d) %s"
,
t
,
err
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d) %s"
,
t
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d)"
,
t
,
err
);
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d)"
,
t
,
i_ret
);
# endif
# endif
return
err
;
return
i_ret
;
}
}
return
err
;
return
i_ret
;
}
}
/* QPSK only */
/* QPSK only */
int
ioctl_SetupSwitch
(
input_thread_t
*
p_input
,
int
frontend_fd
,
int
switch_pos
,
int
ioctl_SetupSwitch
(
input_thread_t
*
p_input
,
int
switch_pos
,
int
voltage_18
,
int
hiband
)
int
voltage_18
,
int
hiband
)
{
{
int
ret
;
struct
diseqc_cmd_t
*
cmd
[
2
]
=
{
NULL
,
NULL
};
struct
diseqc_cmd_t
*
cmd
[
2
]
=
{
NULL
,
NULL
};
int
i
=
4
*
switch_pos
+
2
*
hiband
+
(
voltage_18
?
1
:
0
);
int
i
=
4
*
switch_pos
+
2
*
hiband
+
(
voltage_18
?
1
:
0
);
int
i_ret
;
msg_Dbg
(
p_input
,
"ioctl_SetupSwitch: switch pos %i, %sV, %sband"
,
msg_Dbg
(
p_input
,
"DVB-S: setup switch pos %i, %sV, %sband, index %i"
,
switch_pos
,
voltage_18
?
"18"
:
"13"
,
hiband
?
"hi"
:
"lo"
);
switch_pos
,
voltage_18
?
"18"
:
"13"
,
hiband
?
"hi"
:
"lo"
,
i
);
msg_Dbg
(
p_input
,
"ioctl_SetupSwitch: index %i"
,
i
);
if
((
i
<
0
)
||
(
i
>=
(
int
)(
sizeof
(
switch_cmds
)
/
sizeof
(
struct
diseqc_cmd_t
)))
)
if
(
(
i
<
0
)
||
(
i
>=
(
int
)(
sizeof
(
switch_cmds
)
/
sizeof
(
struct
diseqc_cmd_t
)))
)
return
-
EINVAL
;
return
-
EINVAL
;
cmd
[
0
]
=
&
switch_cmds
[
i
];
cmd
[
0
]
=
&
switch_cmds
[
i
];
if
((
ret
=
ioctl_DiseqcSendMsg
(
p_input
,
frontend_fd
,
if
(
(
i_ret
=
ioctl_DiseqcSendMsg
(
p_input
,
(
i
%
2
)
?
SEC_VOLTAGE_18
:
SEC_VOLTAGE_13
,
(
i
%
2
)
?
SEC_VOLTAGE_18
:
SEC_VOLTAGE_13
,
cmd
,
cmd
,
(
i
/
2
)
%
2
?
SEC_TONE_ON
:
SEC_TONE_OFF
,
(
i
/
2
)
%
2
?
SEC_TONE_ON
:
SEC_TONE_OFF
,
(
i
/
4
)
%
2
?
SEC_MINI_B
:
SEC_MINI_A
))
<
0
)
(
i
/
4
)
%
2
?
SEC_MINI_B
:
SEC_MINI_A
))
<
0
)
{
{
msg_Err
(
p_input
,
"ioctl_DiseqcSendMsg() failed (%d)"
,
ret
);
return
i_ret
;
return
ret
;
}
}
return
ret
;
return
i_
ret
;
}
}
/*****************************************************************************
/*****************************************************************************
* ioctl_SetQPSKFrontend : controls the FE device
* ioctl_SetQPSKFrontend : controls the FE device
*****************************************************************************/
*****************************************************************************/
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
)
unsigned
int
u_lnb_lof1
,
unsigned
int
u_lnb_lof2
,
unsigned
int
u_lnb_slof
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
{
int
ret
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
front
;
int
fd_front
=
p_dvb
->
i_frontend
;
int
hiband
;
int
hiband
;
char
frontend
[]
=
FRONTEND
;
int
i_ret
;
int
i_len
;
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"DVB-S: FrontEnd snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
/* Open the frontend device */
msg_Dbg
(
p_input
,
"DVB-S: Opening frontend %s"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-S: failed to open frontend (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"DVB-S: failed to open frontend"
);
# endif
return
-
1
;
}
/* Set the frequency of the transponder, taking into account the
/* Set the frequency of the transponder, taking into account the
local frequencies of the LNB */
local frequencies of the LNB */
hiband
=
(
fep
.
frequency
>=
u_lnb_slof
);
hiband
=
(
fep
.
frequency
>=
p_dvb
->
u_lnb_slof
);
if
((
ret
=
ioctl_SetupSwitch
(
p_input
,
front
,
0
,
b_polarisation
,
hiband
))
<
0
)
if
(
(
i_ret
=
ioctl_SetupSwitch
(
p_input
,
0
,
p_dvb
->
b_polarisation
,
hiband
))
<
0
)
{
{
msg_Err
(
p_input
,
"DVB-S: Setup frontend switch failed (%d)"
,
ret
);
msg_Err
(
p_input
,
"DVB-S: Setup frontend switch failed (%d)"
,
i_ret
);
return
-
1
;
return
-
1
;
}
}
if
(
hiband
)
if
(
hiband
)
fep
.
frequency
-=
u_lnb_lof2
;
fep
.
frequency
-=
p_dvb
->
u_lnb_lof2
;
else
else
fep
.
frequency
-=
u_lnb_lof1
;
fep
.
frequency
-=
p_dvb
->
u_lnb_lof1
;
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
((
ret
=
ioctl
(
front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
close
(
front
);
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-S: setting frontend failed (%d) %s"
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"DVB-S: setting frontend failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"DVB-S: setting frontend failed (%d)"
,
ret
);
msg_Err
(
p_input
,
"DVB-S: setting frontend failed (%d)"
,
i_ret
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
ret
=
ioctl_CheckFrontend
(
p_input
,
front
);
i_ret
=
ioctl_CheckFrontend
(
p_input
,
FE_QPSK
);
/* Fixme: Return this instead of closing it.
return
i_ret
;
Close front end device */
close
(
front
);
return
ret
;
}
}
int
ioctl_SetOFDMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
ioctl_SetOFDMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
)
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
{
int
ret
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
front
;
int
fd_front
=
p_dvb
->
i_frontend
;
char
frontend
[]
=
FRONTEND
;
int
i_ret
;
int
i_len
;
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"DVB-T FrontEnd snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
/* Open the frontend device */
msg_Dbg
(
p_input
,
"DVB-T: Opening frontend %s"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-T: failed to open frontend (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"DVB-T: failed to open frontend"
);
# endif
return
-
1
;
}
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
((
ret
=
ioctl
(
front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
close
(
front
);
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-T: setting frontend failed (%d) %s"
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"DVB-T: setting frontend failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"DVB-T: setting frontend failed (%d)"
,
ret
);
msg_Err
(
p_input
,
"DVB-T: setting frontend failed (%d)"
,
i_ret
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
ret
=
ioctl_CheckFrontend
(
p_input
,
front
);
i_ret
=
ioctl_CheckFrontend
(
p_input
,
FE_OFDM
);
/* Fixme: Return this instead of closing it.
return
i_ret
;
Close front end device */
close
(
front
);
return
ret
;
}
}
int
ioctl_SetQAMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
ioctl_SetQAMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
)
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
{
int
ret
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
front
;
int
fd_front
=
p_dvb
->
i_frontend
;
char
frontend
[]
=
FRONTEND
;
int
i_ret
;
int
i_len
;
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"DVB-C: FrontEnd snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
/* Open the frontend device */
msg_Dbg
(
p_input
,
"DVB-C: Opening frontend %s"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-C: failed to open frontend (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"DVB-C: failed to open frontend"
);
# endif
return
-
1
;
}
/* Show more info on the tuning parameters used. */
/* Show more info on the tuning parameters used. */
msg_Dbg
(
p_input
,
"DVB-C: Tuning with the following paramters:"
);
msg_Dbg
(
p_input
,
"DVB-C: Tuning with the following paramters:"
);
msg_Dbg
(
p_input
,
"DVB-C: Frequency %d KHz"
,
fep
.
frequency
);
msg_Dbg
(
p_input
,
"DVB-C: Frequency %d KHz"
,
fep
.
frequency
);
msg_Dbg
(
p_input
,
"DVB-C: Inversion/polarisation: %d"
,
fep
.
inversion
);
msg_Dbg
(
p_input
,
"DVB-C: Inversion/polarisation: %d"
,
fep
.
inversion
);
msg_Dbg
(
p_input
,
"DVB-C: Symbolrate %d"
,
fep
.
u
.
qam
.
symbol_rate
);
msg_Dbg
(
p_input
,
"DVB-C: Symbolrate %d"
,
fep
.
u
.
qam
.
symbol_rate
);
msg_Dbg
(
p_input
,
"DVB-C: FEC Inner %d"
,
fep
.
u
.
qam
.
fec_inner
);
msg_Dbg
(
p_input
,
"DVB-C: Forward Error Correction Inner %d"
,
fep
.
u
.
qam
.
fec_inner
);
msg_Dbg
(
p_input
,
"DVB-C: Modulation %d"
,
fep
.
u
.
qam
.
modulation
);
msg_Dbg
(
p_input
,
"DVB-C: Modulation %d"
,
fep
.
u
.
qam
.
modulation
);
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
((
ret
=
ioctl
(
front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
close
(
front
);
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"DVB-C: tuning channel failed (frontend returned %d:%s)"
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"DVB-C: tuning channel failed (frontend returned %d:%s)"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"DVB-C: tuning channel failed (frontend returned %d)"
,
ret
);
msg_Err
(
p_input
,
"DVB-C: tuning channel failed (frontend returned %d)"
,
i_ret
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
/* Check Status of frontend */
/* Check Status of frontend */
ret
=
ioctl_CheckFrontend
(
p_input
,
front
);
i_ret
=
ioctl_CheckFrontend
(
p_input
,
FE_QAM
);
/* Fixme: Return this instead of closing it.
return
i_ret
;
Close front end device */
close
(
front
);
return
ret
;
}
}
/******************************************************************
/******************************************************************
* Check completion of the frontend control sequence
* Check completion of the frontend control sequence
******************************************************************/
******************************************************************/
static
int
ioctl_CheckFrontend
(
input_thread_t
*
p_input
,
int
front
)
static
int
ioctl_CheckFrontend
(
input_thread_t
*
p_input
,
fe_type_t
type
)
{
{
int
i
;
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
int
ret
;
int
fd_front
=
p_dvb
->
i_frontend
;
struct
pollfd
pfd
[
1
];
int
i_ret
;
struct
dvb_frontend_event
event
;
/* poll for frontend event to check if tuning worked */
while
(
1
)
pfd
[
0
].
fd
=
front
;
pfd
[
0
].
events
=
POLLIN
;
#if 1
for
(
i
=
0
;
i
<
3
;
i
++
)
{
{
int32_t
value
;
fe_status_t
status
;
fe_status_t
status
;
if
((
ret
=
ioctl
(
front
,
FE_READ_STATUS
,
&
status
))
<
0
)
if
(
(
i_ret
=
ioctl
(
fd_front
,
FE_READ_STATUS
,
&
status
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"reading frontend status failed (%d) %s"
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"reading frontend status failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"reading frontend status failed (%d)"
,
ret
);
msg_Err
(
p_input
,
"reading frontend status failed (%d)"
,
i_ret
);
# endif
# endif
return
-
1
;
}
}
if
(
status
&
FE_HAS_SIGNAL
)
/* found something above the noise level */
if
(
status
&
FE_HAS_SIGNAL
)
/* found something above the noise level */
msg_Dbg
(
p_input
,
"check frontend ... has signal"
);
msg_Dbg
(
p_input
,
"check frontend ... has signal"
);
if
(
status
&
FE_HAS_CARRIER
)
/* found a DVB signal */
if
(
status
&
FE_HAS_CARRIER
)
/* found a DVB signal */
msg_Dbg
(
p_input
,
"check frontend ... has carrier"
);
msg_Dbg
(
p_input
,
"check frontend ... has carrier"
);
if
(
status
&
FE_HAS_VITERBI
)
/* FEC is stable */
if
(
status
&
FE_HAS_VITERBI
)
/* FEC is stable */
msg_Dbg
(
p_input
,
"check frontend ... has stable fec"
);
msg_Dbg
(
p_input
,
"check frontend ... has stable forward error correction"
);
if
(
status
&
FE_HAS_SYNC
)
/* found sync bytes */
if
(
status
&
FE_HAS_SYNC
)
/* found sync bytes */
msg_Dbg
(
p_input
,
"check frontend ... has sync"
);
msg_Dbg
(
p_input
,
"check frontend ... has sync"
);
if
(
status
&
FE_HAS_LOCK
)
/* everything's working... */
if
(
status
&
FE_HAS_LOCK
)
/* everything's working... */
{
{
msg_Dbg
(
p_input
,
"check frontend ... has lock"
);
msg_Dbg
(
p_input
,
"check frontend ... has lock"
);
msg_Dbg
(
p_input
,
"check frontend ... tuning status == 0x%02x!!! ..."
msg_Dbg
(
p_input
,
"check frontend ... tuning status == 0x%02x ... tuning succeeded"
,
status
);
"tuning succeeded"
,
status
);
return
0
;
return
0
;
}
}
if
(
status
&
FE_TIMEDOUT
)
/* no lock within the last ~2 seconds */
if
(
status
&
FE_TIMEDOUT
)
/* no lock within the last ~2 seconds */
{
{
msg_Dbg
(
p_input
,
"check frontend ... tuning status == 0x%02x!!! ..."
msg_Dbg
(
p_input
,
"check frontend ... tuning status == 0x%02x ... timed out"
,
status
);
"tuning failed"
,
status
);
msg_Err
(
p_input
,
"check frontend ... tuning failed"
);
msg_Err
(
p_input
,
"check frontend ... timed out"
);
return
-
2
;
return
-
2
;
}
}
if
(
status
&
FE_REINIT
)
if
(
status
&
FE_REINIT
)
{
{
/* frontend was reinitialized, */
/* frontend was reinitialized, */
/* application is recommned to reset */
/* application is recommned to reset */
/* DiSEqC, tone and parameters */
/* DiSEqC, tone and parameters */
msg_Dbg
(
p_input
,
"DVB-S: tuning status == 0x%02x!!! ..."
switch
(
type
)
"tuning failed"
,
status
);
msg_Err
(
p_input
,
"check frontend ... resend frontend parameters"
);
return
-
1
;
}
usleep
(
500000
);
}
#else
if
(
poll
(
pfd
,
1
,
3000
))
{
if
(
pfd
[
0
].
revents
&
POLLIN
)
{
if
(
(
ret
=
ioctl
(
front
,
FE_GET_EVENT
,
&
event
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"check frontend ... error occured (%d) %s"
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"check frontend ... error occured (%d)"
,
ret
);
# endif
return
-
5
;
}
switch
(
event
.
status
)
{
{
case
FE_
HAS_SIGNAL
:
/* found something above the noise level */
case
FE_
OFDM
:
msg_Dbg
(
p_input
,
"check frontend ... has signal"
);
msg_Dbg
(
p_input
,
"DVB-T: tuning status == 0x%02x"
,
status
);
break
;
break
;
case
FE_
HAS_CARRIER
:
/* found a DVB signal */
case
FE_
QPSK
:
msg_Dbg
(
p_input
,
"check frontend ... has carrier"
);
msg_Dbg
(
p_input
,
"DVB-S: tuning status == 0x%02x"
,
status
);
break
;
break
;
case
FE_
HAS_VITERBI
:
/* FEC is stable */
case
FE_
QAM
:
msg_Dbg
(
p_input
,
"check frontend ... has stable fec"
);
msg_Dbg
(
p_input
,
"DVB-C: tuning status == 0x%02x"
,
status
);
break
;
break
;
case
FE_HAS_SYNC
:
/* found sync bytes */
default:
msg_Dbg
(
p_input
,
"check frontend ... has sync"
);
break
;
break
;
case
FE_HAS_LOCK
:
/* everything's working... */
msg_Dbg
(
p_input
,
"check frontend ... has lock"
);
return
0
;
case
FE_TIMEDOUT
:
/* no lock within the last ~2 seconds */
msg_Err
(
p_input
,
"check frontend ... timed out"
);
return
-
2
;
case
FE_REINIT
:
/* frontend was reinitialized, */
/* application is recommned to reset */
/* DiSEqC, tone and parameters */
msg_Err
(
p_input
,
"check frontend ... resend frontend parameters"
);
return
-
1
;
}
}
msg_Err
(
p_input
,
"check frontend ... resend frontend parameters"
);
msg_Err
(
p_input
,
"check frontend ... tuning failed"
);
return
-
1
;
}
}
else
{
/* Read some statistics */
/* should come here */
value
=
0
;
msg_Err
(
p_input
,
"check frontend ... no event occured"
);
if
(
ioctl
(
fd_front
,
FE_READ_BER
,
&
value
)
>=
0
)
return
-
3
;
msg_Dbg
(
p_input
,
"Bit error rate: %d"
,
value
)
;
}
}
value
=
0
;
else
if
(
ioctl
(
fd_front
,
FE_READ_SIGNAL_STRENGTH
,
&
value
)
>=
0
)
{
msg_Dbg
(
p_input
,
"Signal strength: %d"
,
value
);
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"check frontend ... timeout when polling for event (%s)"
,
strerror
(
errno
))
;
value
=
0
;
# else
if
(
ioctl
(
fd_front
,
FE_READ_SNR
,
&
value
)
>=
0
)
msg_Err
(
p_input
,
"check frontend ... timeout when polling for event "
);
msg_Dbg
(
p_input
,
"SNR: %d"
,
value
);
# endif
return
-
4
;
usleep
(
500000
)
;
}
}
#endif
return
-
1
;
return
-
1
;
}
}
...
@@ -618,9 +474,9 @@ static int ioctl_CheckFrontend(input_thread_t * p_input, int front)
...
@@ -618,9 +474,9 @@ static int ioctl_CheckFrontend(input_thread_t * p_input, int front)
/*****************************************************************************
/*****************************************************************************
* ioctl_SetDMXFilter : controls the demux to add a filter
* ioctl_SetDMXFilter : controls the demux to add a filter
*****************************************************************************/
*****************************************************************************/
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
)
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
{
input_dvb_t
*
p_dvb
=
(
input_dvb_t
*
)
p_input
->
p_access_data
;
struct
dmx_pes_filter_params
s_filter_params
;
struct
dmx_pes_filter_params
s_filter_params
;
char
dmx
[]
=
DMX
;
char
dmx
[]
=
DMX
;
int
i_len
;
int
i_len
;
...
@@ -628,131 +484,131 @@ int ioctl_SetDMXFilter(input_thread_t * p_input, int i_pid, int * pi_fd , int i_
...
@@ -628,131 +484,131 @@ int ioctl_SetDMXFilter(input_thread_t * p_input, int i_pid, int * pi_fd , int i_
/* We first open the device */
/* We first open the device */
i_len
=
sizeof
(
DMX
);
i_len
=
sizeof
(
DMX
);
if
(
snprintf
(
dmx
,
sizeof
(
DMX
),
DMX
,
u_adapter
,
u_device
)
>=
i_len
)
if
(
snprintf
(
dmx
,
sizeof
(
DMX
),
DMX
,
p_dvb
->
u_adapter
,
p_dvb
->
u_device
)
>=
i_len
)
{
{
msg_Err
(
p_input
,
"snprintf() truncated string for DMX"
);
msg_Err
(
p_input
,
"snprintf() truncated string for DMX"
);
dmx
[
sizeof
(
DMX
)]
=
'\0'
;
dmx
[
sizeof
(
DMX
)]
=
'\0'
;
}
}
msg_Dbg
(
p_input
,
"Opening demux device %s"
,
dmx
);
msg_Dbg
(
p_input
,
"Opening demux device %s"
,
dmx
);
if
((
(
*
pi_fd
)
=
open
(
dmx
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
if
(
(
(
*
pi_fd
)
=
open
(
dmx
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_SetDMXFilter: opening device failed (%s)"
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"Demux set filter: opening device failed (%s)"
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl_SetDMXFilter: opening device failed"
);
msg_Err
(
p_input
,
"Demux set filter: opening device failed"
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
/* We fill the DEMUX structure : */
/* We fill the DEMUX structure : */
s_filter_params
.
pid
=
i_pid
;
s_filter_params
.
pid
=
i_pid
;
s_filter_params
.
input
=
DMX_IN_FRONTEND
;
s_filter_params
.
input
=
DMX_IN_FRONTEND
;
s_filter_params
.
output
=
DMX_OUT_TS_TAP
;
s_filter_params
.
output
=
DMX_OUT_TS_TAP
;
switch
(
i_type
)
switch
(
i_type
)
{
/* First device */
{
/* First device */
case
1
:
case
1
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_VIDEO0 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_VIDEO0 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_VIDEO0
;
s_filter_params
.
pes_type
=
DMX_PES_VIDEO0
;
break
;
break
;
case
2
:
case
2
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_AUDIO0 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_AUDIO0 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_AUDIO0
;
s_filter_params
.
pes_type
=
DMX_PES_AUDIO0
;
break
;
break
;
case
3
:
case
3
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_TELETEXT0 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_TELETEXT0 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT0
;
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT0
;
break
;
break
;
case
4
:
case
4
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_SUBTITLE0 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_SUBTITLE0 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE0
;
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE0
;
break
;
break
;
case
5
:
case
5
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_PCR0 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_PCR0 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_PCR0
;
s_filter_params
.
pes_type
=
DMX_PES_PCR0
;
break
;
break
;
/* Second device */
/* Second device */
case
6
:
case
6
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_VIDEO1 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_VIDEO1 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_VIDEO1
;
s_filter_params
.
pes_type
=
DMX_PES_VIDEO1
;
break
;
break
;
case
7
:
case
7
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_AUDIO1 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_AUDIO1 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_AUDIO1
;
s_filter_params
.
pes_type
=
DMX_PES_AUDIO1
;
break
;
break
;
case
8
:
case
8
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_TELETEXT1 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_TELETEXT1 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT1
;
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT1
;
break
;
break
;
case
9
:
case
9
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_SUBTITLE1 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_SUBTITLE1 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE1
;
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE1
;
break
;
break
;
case
10
:
case
10
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_PCR1 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_PCR1 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_PCR1
;
s_filter_params
.
pes_type
=
DMX_PES_PCR1
;
break
;
break
;
/* Third device */
/* Third device */
case
11
:
case
11
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_VIDEO2 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_VIDEO2 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_VIDEO2
;
s_filter_params
.
pes_type
=
DMX_PES_VIDEO2
;
break
;
break
;
case
12
:
case
12
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_AUDIO2 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_AUDIO2 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_AUDIO2
;
s_filter_params
.
pes_type
=
DMX_PES_AUDIO2
;
break
;
break
;
case
13
:
case
13
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_TELETEXT2 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_TELETEXT2 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT2
;
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT2
;
break
;
break
;
case
14
:
case
14
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_SUBTITLE2 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_SUBTITLE2 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE2
;
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE2
;
break
;
break
;
case
15
:
case
15
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_PCR2 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_PCR2 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_PCR2
;
s_filter_params
.
pes_type
=
DMX_PES_PCR2
;
break
;
break
;
/* Forth device */
/* Forth device */
case
16
:
case
16
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_VIDEO3 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_VIDEO3 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_VIDEO3
;
s_filter_params
.
pes_type
=
DMX_PES_VIDEO3
;
break
;
break
;
case
17
:
case
17
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_AUDIO3 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_AUDIO3 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_AUDIO3
;
s_filter_params
.
pes_type
=
DMX_PES_AUDIO3
;
break
;
break
;
case
18
:
case
18
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_TELETEXT3 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_TELETEXT3 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT3
;
s_filter_params
.
pes_type
=
DMX_PES_TELETEXT3
;
break
;
break
;
case
19
:
case
19
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_SUBTITLE3 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_SUBTITLE3 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE3
;
s_filter_params
.
pes_type
=
DMX_PES_SUBTITLE3
;
break
;
break
;
case
20
:
case
20
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_PCR3 for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_PCR3 for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_PCR3
;
s_filter_params
.
pes_type
=
DMX_PES_PCR3
;
break
;
break
;
/* Usually used by Nova cards */
/* Usually used by Nova cards */
case
21
:
case
21
:
msg_Dbg
(
p_input
,
"ioctl_SetDMXFilter: DMX_PES_OTHER for PMT %d"
,
i_pid
);
msg_Dbg
(
p_input
,
"Demux set filter DMX_PES_OTHER for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_OTHER
;
s_filter_params
.
pes_type
=
DMX_PES_OTHER
;
break
;
break
;
/* What to do with i? */
/* What to do with i? */
default:
default:
msg_Err
(
p_input
,
"trying to set PMT id to=%d for unknown type %d"
,
i_pid
,
i_type
);
msg_Err
(
p_input
,
"trying to set PMT id to=%d for unknown type %d"
,
i_pid
,
i_type
);
break
;
break
;
}
}
s_filter_params
.
flags
=
DMX_IMMEDIATE_START
;
s_filter_params
.
flags
=
DMX_IMMEDIATE_START
;
/* We then give the order to the device : */
/* We then give the order to the device : */
if
((
result
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
))
<
0
)
if
(
(
result
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_SetDMXFilter: ioctl failed with %d (%s)"
,
result
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"Demux set filter ioctl failed with %d (%s)"
,
result
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl_SetDMXFilter: ioctl failed with %d"
,
result
);
msg_Err
(
p_input
,
"Demux set filter ioctl failed with %d"
,
result
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
...
@@ -762,32 +618,32 @@ int ioctl_SetDMXFilter(input_thread_t * p_input, int i_pid, int * pi_fd , int i_
...
@@ -762,32 +618,32 @@ int ioctl_SetDMXFilter(input_thread_t * p_input, int i_pid, int * pi_fd , int i_
/*****************************************************************************
/*****************************************************************************
* ioctl_UnsetDMXFilter : removes a filter
* ioctl_UnsetDMXFilter : removes a filter
*****************************************************************************/
*****************************************************************************/
int
ioctl_UnsetDMXFilter
(
input_thread_t
*
p_input
,
int
pi_fd
)
int
ioctl_UnsetDMXFilter
(
input_thread_t
*
p_input
,
int
pi_fd
)
{
{
int
ret
;
int
i_
ret
;
if
((
ret
=
ioctl
(
pi_fd
,
DMX_STOP
))
<
0
)
if
(
(
i_ret
=
ioctl
(
pi_fd
,
DMX_STOP
))
<
0
)
{
{
# ifdef HAVE_ERRNO_H
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d) %s"
,
pi_fd
,
ret
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d) %s"
,
pi_fd
,
i_ret
,
strerror
(
errno
)
);
# else
# else
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d)"
,
pi_fd
,
ret
);
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d)"
,
pi_fd
,
i_ret
);
# endif
# endif
return
-
1
;
return
-
1
;
}
}
msg_Dbg
(
p_input
,
"ioctl_UnsetDMXFilter closing demux %d"
,
pi_fd
);
msg_Dbg
(
p_input
,
"ioctl_UnsetDMXFilter closing demux %d"
,
pi_fd
);
close
(
pi_fd
);
close
(
pi_fd
);
return
0
;
return
0
;
}
}
/*****************************************************************************
/*****************************************************************************
* dvb_DecodeBandwidth : decodes arguments for DVB S/C/T card
* dvb_DecodeBandwidth : decodes arguments for DVB S/C/T card
*****************************************************************************/
*****************************************************************************/
fe_bandwidth_t
dvb_DecodeBandwidth
(
input_thread_t
*
p_input
,
int
bandwidth
)
fe_bandwidth_t
dvb_DecodeBandwidth
(
input_thread_t
*
p_input
,
int
bandwidth
)
{
{
fe_bandwidth_t
fe_bandwidth
=
0
;
fe_bandwidth_t
fe_bandwidth
=
0
;
switch
(
bandwidth
)
switch
(
bandwidth
)
{
{
case
0
:
case
0
:
fe_bandwidth
=
BANDWIDTH_AUTO
;
fe_bandwidth
=
BANDWIDTH_AUTO
;
...
@@ -802,15 +658,14 @@ fe_bandwidth_t dvb_DecodeBandwidth(input_thread_t * p_input, int bandwidth)
...
@@ -802,15 +658,14 @@ fe_bandwidth_t dvb_DecodeBandwidth(input_thread_t * p_input, int bandwidth)
fe_bandwidth
=
BANDWIDTH_8_MHZ
;
fe_bandwidth
=
BANDWIDTH_8_MHZ
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"terrestrial dvb has bandwidth not set, using auto"
);
msg_Dbg
(
p_input
,
"terrestrial dvb has bandwidth not set, using auto"
);
fe_bandwidth
=
BANDWIDTH_AUTO
;
fe_bandwidth
=
BANDWIDTH_AUTO
;
break
;
break
;
}
}
return
fe_bandwidth
;
return
fe_bandwidth
;
}
}
fe_code_rate_t
dvb_DecodeFEC
(
input_thread_t
*
p_input
,
int
fec
)
fe_code_rate_t
dvb_DecodeFEC
(
input_thread_t
*
p_input
,
int
fec
)
{
{
fe_code_rate_t
fe_fec
=
FEC_NONE
;
fe_code_rate_t
fe_fec
=
FEC_NONE
;
...
@@ -846,13 +701,13 @@ fe_code_rate_t dvb_DecodeFEC(input_thread_t * p_input, int fec)
...
@@ -846,13 +701,13 @@ fe_code_rate_t dvb_DecodeFEC(input_thread_t * p_input, int fec)
default:
default:
/* cannot happen */
/* cannot happen */
fe_fec
=
FEC_NONE
;
fe_fec
=
FEC_NONE
;
msg_Err
(
p_input
,
"argument has invalid FEC (%d)"
,
fec
);
msg_Err
(
p_input
,
"argument has invalid FEC (%d)"
,
fec
);
break
;
break
;
}
}
return
fe_fec
;
return
fe_fec
;
}
}
fe_modulation_t
dvb_DecodeModulation
(
input_thread_t
*
p_input
,
int
modulation
)
fe_modulation_t
dvb_DecodeModulation
(
input_thread_t
*
p_input
,
int
modulation
)
{
{
fe_modulation_t
fe_modulation
=
0
;
fe_modulation_t
fe_modulation
=
0
;
...
@@ -880,14 +735,14 @@ fe_modulation_t dvb_DecodeModulation(input_thread_t * p_input, int modulation)
...
@@ -880,14 +735,14 @@ fe_modulation_t dvb_DecodeModulation(input_thread_t * p_input, int modulation)
fe_modulation
=
QAM_256
;
fe_modulation
=
QAM_256
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"terrestrial/cable dvb has constellation/modulation not set, using auto"
);
msg_Dbg
(
p_input
,
"terrestrial/cable dvb has constellation/modulation not set, using auto"
);
fe_modulation
=
QAM_AUTO
;
fe_modulation
=
QAM_AUTO
;
break
;
break
;
}
}
return
fe_modulation
;
return
fe_modulation
;
}
}
fe_transmit_mode_t
dvb_DecodeTransmission
(
input_thread_t
*
p_input
,
int
transmission
)
fe_transmit_mode_t
dvb_DecodeTransmission
(
input_thread_t
*
p_input
,
int
transmission
)
{
{
fe_transmit_mode_t
fe_transmission
=
0
;
fe_transmit_mode_t
fe_transmission
=
0
;
...
@@ -903,14 +758,14 @@ fe_transmit_mode_t dvb_DecodeTransmission(input_thread_t * p_input, int transmis
...
@@ -903,14 +758,14 @@ fe_transmit_mode_t dvb_DecodeTransmission(input_thread_t * p_input, int transmis
fe_transmission
=
TRANSMISSION_MODE_8K
;
fe_transmission
=
TRANSMISSION_MODE_8K
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"terrestrial dvb has transmission mode not set, using auto"
);
msg_Dbg
(
p_input
,
"terrestrial dvb has transmission mode not set, using auto"
);
fe_transmission
=
TRANSMISSION_MODE_AUTO
;
fe_transmission
=
TRANSMISSION_MODE_AUTO
;
break
;
break
;
}
}
return
fe_transmission
;
return
fe_transmission
;
}
}
fe_guard_interval_t
dvb_DecodeGuardInterval
(
input_thread_t
*
p_input
,
int
guard
)
fe_guard_interval_t
dvb_DecodeGuardInterval
(
input_thread_t
*
p_input
,
int
guard
)
{
{
fe_guard_interval_t
fe_guard
=
0
;
fe_guard_interval_t
fe_guard
=
0
;
...
@@ -932,18 +787,18 @@ fe_guard_interval_t dvb_DecodeGuardInterval(input_thread_t * p_input, int guard)
...
@@ -932,18 +787,18 @@ fe_guard_interval_t dvb_DecodeGuardInterval(input_thread_t * p_input, int guard)
fe_guard
=
GUARD_INTERVAL_1_32
;
fe_guard
=
GUARD_INTERVAL_1_32
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"terrestrial dvb has guard interval not set, using auto"
);
msg_Dbg
(
p_input
,
"terrestrial dvb has guard interval not set, using auto"
);
fe_guard
=
GUARD_INTERVAL_AUTO
;
fe_guard
=
GUARD_INTERVAL_AUTO
;
break
;
break
;
}
}
return
fe_guard
;
return
fe_guard
;
}
}
fe_hierarchy_t
dvb_DecodeHierarchy
(
input_thread_t
*
p_input
,
int
hierarchy
)
fe_hierarchy_t
dvb_DecodeHierarchy
(
input_thread_t
*
p_input
,
int
hierarchy
)
{
{
fe_hierarchy_t
fe_hierarchy
=
0
;
fe_hierarchy_t
fe_hierarchy
=
0
;
switch
(
hierarchy
)
switch
(
hierarchy
)
{
{
case
-
1
:
case
-
1
:
fe_hierarchy
=
HIERARCHY_NONE
;
fe_hierarchy
=
HIERARCHY_NONE
;
...
@@ -961,18 +816,18 @@ fe_hierarchy_t dvb_DecodeHierarchy(input_thread_t * p_input, int hierarchy)
...
@@ -961,18 +816,18 @@ fe_hierarchy_t dvb_DecodeHierarchy(input_thread_t * p_input, int hierarchy)
fe_hierarchy
=
HIERARCHY_4
;
fe_hierarchy
=
HIERARCHY_4
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"terrestrial dvb has hierarchy not set, using auto"
);
msg_Dbg
(
p_input
,
"terrestrial dvb has hierarchy not set, using auto"
);
fe_hierarchy
=
HIERARCHY_AUTO
;
fe_hierarchy
=
HIERARCHY_AUTO
;
break
;
break
;
}
}
return
fe_hierarchy
;
return
fe_hierarchy
;
}
}
fe_spectral_inversion_t
dvb_DecodeInversion
(
input_thread_t
*
p_input
,
int
inversion
)
fe_spectral_inversion_t
dvb_DecodeInversion
(
input_thread_t
*
p_input
,
int
inversion
)
{
{
fe_spectral_inversion_t
fe_inversion
=
0
;
fe_spectral_inversion_t
fe_inversion
=
0
;
switch
(
inversion
)
switch
(
inversion
)
{
{
case
0
:
case
0
:
fe_inversion
=
INVERSION_OFF
;
fe_inversion
=
INVERSION_OFF
;
...
@@ -984,7 +839,7 @@ fe_spectral_inversion_t dvb_DecodeInversion(input_thread_t * p_input, int invers
...
@@ -984,7 +839,7 @@ fe_spectral_inversion_t dvb_DecodeInversion(input_thread_t * p_input, int invers
fe_inversion
=
INVERSION_AUTO
;
fe_inversion
=
INVERSION_AUTO
;
break
;
break
;
default:
default:
msg_Dbg
(
p_input
,
"dvb has inversion/polarisation not set, using auto"
);
msg_Dbg
(
p_input
,
"dvb has inversion/polarisation not set, using auto"
);
fe_inversion
=
INVERSION_AUTO
;
fe_inversion
=
INVERSION_AUTO
;
break
;
break
;
}
}
...
...
modules/access/dvb/dvb.h
View file @
e2fc6acb
...
@@ -30,28 +30,54 @@
...
@@ -30,28 +30,54 @@
#define FRONTEND "/dev/dvb/adapter%d/frontend%d"
#define FRONTEND "/dev/dvb/adapter%d/frontend%d"
#define DVR "/dev/dvb/adapter%d/dvr%d"
#define DVR "/dev/dvb/adapter%d/dvr%d"
/*****************************************************************************
* DVB input data structure
*****************************************************************************/
typedef
struct
{
int
i_frontend
;
unsigned
int
u_adapter
;
unsigned
int
u_device
;
unsigned
int
u_freq
;
unsigned
int
u_srate
;
unsigned
int
u_lnb_lof1
;
unsigned
int
u_lnb_lof2
;
unsigned
int
u_lnb_slof
;
int
i_bandwidth
;
int
i_modulation
;
int
i_guard
;
int
i_transmission
;
int
i_hierarchy
;
int
i_polarisation
;
int
i_fec
;
int
i_code_rate_HP
;
int
i_code_rate_LP
;
vlc_bool_t
b_diseqc
;
vlc_bool_t
b_probe
;
input_socket_t
*
p_satellite
;
}
input_dvb_t
;
/*****************************************************************************
/*****************************************************************************
* Prototypes
* Prototypes
*****************************************************************************/
*****************************************************************************/
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
);
unsigned
int
u_lnb_lof1
,
unsigned
int
u_lnb_lof2
,
unsigned
int
u_lnb_slof
,
int
ioctl_SetOFDMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
);
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetQAMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
);
int
ioctl_SetOFDMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
);
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_UnsetDMXFilter
(
input_thread_t
*
p_input
,
int
pi_fd
);
int
ioctl_SetQAMFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
);
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_UnsetDMXFilter
(
input_thread_t
*
p_input
,
int
pi_fd
);
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
/*****************************************************************************
/*****************************************************************************
* dvb argument helper functions
* dvb argument helper functions
*****************************************************************************/
*****************************************************************************/
fe_bandwidth_t
dvb_DecodeBandwidth
(
input_thread_t
*
p_input
,
int
bandwidth
);
fe_bandwidth_t
dvb_DecodeBandwidth
(
input_thread_t
*
p_input
,
int
bandwidth
);
fe_code_rate_t
dvb_DecodeFEC
(
input_thread_t
*
p_input
,
int
fec
);
fe_code_rate_t
dvb_DecodeFEC
(
input_thread_t
*
p_input
,
int
fec
);
fe_modulation_t
dvb_DecodeModulation
(
input_thread_t
*
p_input
,
int
modulation
);
fe_modulation_t
dvb_DecodeModulation
(
input_thread_t
*
p_input
,
int
modulation
);
fe_transmit_mode_t
dvb_DecodeTransmission
(
input_thread_t
*
p_input
,
int
transmission
);
fe_transmit_mode_t
dvb_DecodeTransmission
(
input_thread_t
*
p_input
,
int
transmission
);
fe_guard_interval_t
dvb_DecodeGuardInterval
(
input_thread_t
*
p_input
,
int
guard
);
fe_guard_interval_t
dvb_DecodeGuardInterval
(
input_thread_t
*
p_input
,
int
guard
);
fe_hierarchy_t
dvb_DecodeHierarchy
(
input_thread_t
*
p_input
,
int
hierarchy
);
fe_hierarchy_t
dvb_DecodeHierarchy
(
input_thread_t
*
p_input
,
int
hierarchy
);
fe_spectral_inversion_t
dvb_DecodeInversion
(
input_thread_t
*
p_input
,
int
inversion
);
fe_spectral_inversion_t
dvb_DecodeInversion
(
input_thread_t
*
p_input
,
int
inversion
);
modules/access/dvb/qpsk.c
View file @
e2fc6acb
...
@@ -47,7 +47,7 @@ void E_(Close) ( vlc_object_t * );
...
@@ -47,7 +47,7 @@ void E_(Close) ( vlc_object_t * );
#define DEVICE_TEXT N_("Device number to use on adapter")
#define DEVICE_TEXT N_("Device number to use on adapter")
#define DEVICE_LONGTEXT ""
#define DEVICE_LONGTEXT ""
#define FREQ_TEXT N_("Satellite transponder frequency
in kHz for DVB-S and in Hz for DVB-C/T
")
#define FREQ_TEXT N_("Satellite transponder frequency
for DVB-S (kHz) and for DVB-C/T (Hz)
")
#define FREQ_LONGTEXT ""
#define FREQ_LONGTEXT ""
#define POL_TEXT N_("Satellite transponder polarization")
#define POL_TEXT N_("Satellite transponder polarization")
...
@@ -99,12 +99,14 @@ void E_(Close) ( vlc_object_t * );
...
@@ -99,12 +99,14 @@ void E_(Close) ( vlc_object_t * );
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"DVB input with v4l2 support"
)
);
set_description
(
_
(
"DVB input with v4l2 support"
)
);
/* General options */
add_bool
(
"probe"
,
0
,
NULL
,
PROBE_TEXT
,
PROBE_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"adapter"
,
0
,
NULL
,
ADAPTER_TEXT
,
ADAPTER_LONGTEXT
,
add_integer
(
"adapter"
,
0
,
NULL
,
ADAPTER_TEXT
,
ADAPTER_LONGTEXT
,
VLC_FALSE
);
VLC_FALSE
);
add_integer
(
"device"
,
0
,
NULL
,
DEVICE_TEXT
,
DEVICE_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"device"
,
0
,
NULL
,
DEVICE_TEXT
,
DEVICE_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"frequency"
,
11954000
,
NULL
,
FREQ_TEXT
,
FREQ_LONGTEXT
,
add_integer
(
"frequency"
,
11954000
,
NULL
,
FREQ_TEXT
,
FREQ_LONGTEXT
,
VLC_FALSE
);
VLC_FALSE
);
/* DVB-S (satellite) */
add_integer
(
"polarization"
,
0
,
NULL
,
POL_TEXT
,
POL_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"polarization"
,
0
,
NULL
,
POL_TEXT
,
POL_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"fec"
,
3
,
NULL
,
FEC_TEXT
,
FEC_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"fec"
,
3
,
NULL
,
FEC_TEXT
,
FEC_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"symbol-rate"
,
27500000
,
NULL
,
SRATE_TEXT
,
SRATE_LONGTEXT
,
add_integer
(
"symbol-rate"
,
27500000
,
NULL
,
SRATE_TEXT
,
SRATE_LONGTEXT
,
...
@@ -116,7 +118,7 @@ vlc_module_begin();
...
@@ -116,7 +118,7 @@ vlc_module_begin();
VLC_TRUE
);
VLC_TRUE
);
add_integer
(
"lnb-slof"
,
11700000
,
NULL
,
LNB_SLOF_TEXT
,
LNB_SLOF_LONGTEXT
,
add_integer
(
"lnb-slof"
,
11700000
,
NULL
,
LNB_SLOF_TEXT
,
LNB_SLOF_LONGTEXT
,
VLC_TRUE
);
VLC_TRUE
);
add_bool
(
"probe"
,
0
,
NULL
,
PROBE_TEXT
,
PROBE_LONGTEXT
,
VLC_FALSE
);
/* DVB-T (terrestrial) */
add_integer
(
"code-rate-hp"
,
9
,
NULL
,
CODE_RATE_HP_TEXT
,
add_integer
(
"code-rate-hp"
,
9
,
NULL
,
CODE_RATE_HP_TEXT
,
CODE_RATE_HP_LONGTEXT
,
VLC_TRUE
);
CODE_RATE_HP_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"code-rate-lp"
,
9
,
NULL
,
CODE_RATE_LP_TEXT
,
add_integer
(
"code-rate-lp"
,
9
,
NULL
,
CODE_RATE_LP_TEXT
,
...
@@ -130,12 +132,15 @@ vlc_module_begin();
...
@@ -130,12 +132,15 @@ vlc_module_begin();
TRANSMISSION_LONGTEXT
,
VLC_TRUE
);
TRANSMISSION_LONGTEXT
,
VLC_TRUE
);
add_integer
(
"hierarchy"
,
0
,
NULL
,
HIERARCHY_TEXT
,
HIERARCHY_LONGTEXT
,
add_integer
(
"hierarchy"
,
0
,
NULL
,
HIERARCHY_TEXT
,
HIERARCHY_LONGTEXT
,
VLC_TRUE
);
VLC_TRUE
);
/* short cuts */
set_capability
(
"access"
,
0
);
set_capability
(
"access"
,
0
);
add_shortcut
(
"dvb"
);
/* General DVB-C/S/T MRL */
add_shortcut
(
"dvb-s"
);
/* DVB-S (satillite) */
add_shortcut
(
"qpsk"
);
add_shortcut
(
"qpsk"
);
add_shortcut
(
"dvb-c"
);
/* DVB-C (cable) */
add_shortcut
(
"cable"
);
add_shortcut
(
"cable"
);
add_shortcut
(
"dvb-t"
);
/* DVB-T (terrestrial) */
add_shortcut
(
"terrestrial"
);
add_shortcut
(
"terrestrial"
);
add_shortcut
(
"dvb"
);
add_shortcut
(
"satellite"
);
/* compatibility with the interface. */
add_shortcut
(
"satellite"
);
set_callbacks
(
E_
(
Open
),
E_
(
Close
)
);
set_callbacks
(
E_
(
Open
),
E_
(
Close
)
);
vlc_module_end
();
vlc_module_end
();
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