Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
a82c7e3e
Commit
a82c7e3e
authored
Aug 24, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* dvn: first pass to port dvb to new api. (it doesn't even yet compile,
I haven't tried :)
parent
299cea2f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
689 additions
and
806 deletions
+689
-806
modules/access/dvb/access.c
modules/access/dvb/access.c
+314
-400
modules/access/dvb/dvb.h
modules/access/dvb/dvb.h
+22
-19
modules/access/dvb/linux_dvb.c
modules/access/dvb/linux_dvb.c
+353
-387
No files found.
modules/access/dvb/access.c
View file @
a82c7e3e
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <jpsaman@wxs.nl>
* Jean-Paul Saman <jpsaman@wxs.nl>
* Christophe Massiot <massiot@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* Laurent Aimar <fenrir@via.ecp.fr>
*
*
* This program is free software; you can redistribute it and/or modify
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
...
@@ -26,14 +27,9 @@
...
@@ -26,14 +27,9 @@
/*****************************************************************************
/*****************************************************************************
* Preamble
* Preamble
*****************************************************************************/
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# include <unistd.h>
#endif
#endif
...
@@ -41,36 +37,16 @@
...
@@ -41,36 +37,16 @@
#include <fcntl.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/types.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
# include <string.h>
# include <errno.h>
#endif
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
#endif
#include "dvb.h"
#include "dvb.h"
#define SATELLITE_READ_ONCE 3
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
);
static
void
Close
(
vlc_object_t
*
p_this
);
static
ssize_t
Read
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
size_t
i_len
);
static
int
SetArea
(
input_thread_t
*
,
input_area_t
*
);
static
int
SetProgram
(
input_thread_t
*
,
pgrm_descriptor_t
*
);
static
void
Seek
(
input_thread_t
*
,
off_t
);
static
void
AllocateDemux
(
input_thread_t
*
p_input
,
int
i_pid
,
int
i_type
);
static
void
CloseProgram
(
input_thread_t
*
p_input
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
p_this
);
static
void
Close
(
vlc_object_t
*
p_this
);
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_TEXT N_("Caching value in ms")
#define CACHING_LONGTEXT N_( \
#define CACHING_LONGTEXT N_( \
"Allows you to modify the default caching value for dvb streams. This " \
"Allows you to modify the default caching value for dvb streams. This " \
...
@@ -206,218 +182,106 @@ vlc_module_begin();
...
@@ -206,218 +182,106 @@ vlc_module_begin();
set_callbacks
(
Open
,
Close
);
set_callbacks
(
Open
,
Close
);
vlc_module_end
();
vlc_module_end
();
/*****************************************************************************
/*****************************************************************************
*
Open: open the frontend device
*
Local prototypes
*****************************************************************************/
*****************************************************************************/
#define GET_OPTION_INT( option ) \
static
block_t
*
Block
(
access_t
*
);
if ( !strncmp( psz_parser, option "=", strlen(option "=") ) ) \
static
int
Control
(
access_t
*
,
int
,
va_list
);
{ \
val.i_int = strtol( psz_parser + strlen(option "="), &psz_parser, \
0 ); \
var_Set( p_input, "dvb-" option, val ); \
}
#define GET_OPTION_BOOL( option ) \
if ( !strncmp( psz_parser, option "=", strlen(option "=") ) ) \
{ \
val.b_bool = strtol( psz_parser + strlen(option "="), &psz_parser, \
0 ); \
var_Set( p_input, "dvb-" option, val ); \
}
static
int
Open
(
vlc_object_t
*
p_this
)
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
thread_dvb_data_t
*
p_dvb
;
char
*
psz_parser
;
char
*
psz_next
;
vlc_value_t
val
;
int
i_test
;
/* Initialize structure */
p_dvb
=
(
thread_dvb_data_t
*
)
malloc
(
sizeof
(
thread_dvb_data_t
)
);
if
(
p_dvb
==
NULL
)
{
msg_Err
(
p_input
,
"out of memory"
);
return
-
1
;
}
memset
(
p_dvb
,
0
,
sizeof
(
thread_dvb_data_t
)
);
p_input
->
p_access_data
=
(
void
*
)
p_dvb
;
/* Register callback functions */
p_input
->
pf_read
=
Read
;
p_input
->
pf_set_program
=
SetProgram
;
p_input
->
pf_set_area
=
SetArea
;
p_input
->
pf_seek
=
Seek
;
/* Parse the options passed in command line */
#define SATELLITE_READ_ONCE 3
#if 0
psz_parser
=
strdup
(
p_input
->
psz_name
);
static ssize_t Read( input_thread_t * p_input, byte_t * p_buffer,
if
(
!
psz_parser
)
size_t i_len);
{
static int SetArea ( input_thread_t *, input_area_t * );
free
(
p_dvb
);
static int SetProgram ( input_thread_t *, pgrm_descriptor_t * );
return
(
-
1
);
static void Seek ( input_thread_t *, off_t );
}
static void AllocateDemux( input_thread_t * p_input, int i_pid,
int i_type );
var_Create
(
p_input
,
"dvb-caching"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
static void CloseProgram( input_thread_t * p_input );
var_Get
(
p_input
,
"dvb-caching"
,
&
val
);
#endif
p_input
->
i_pts_delay
=
val
.
i_int
*
1000
;
var_Create
(
p_input
,
"dvb-adapter"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-device"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-frequency"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-inversion"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-probe"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-lof1"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-lof2"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-slof"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-budget-mode"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
static
void
FilterUnset
(
access_t
*
,
int
i_start
,
int
i_max
);
var_Create
(
p_input
,
"dvb-satno"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
static
void
FilterSet
(
access_t
*
,
int
i_pid
,
int
i_type
);
var_Create
(
p_input
,
"dvb-voltage"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-tone"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-fec"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-srate"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-modulation"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
static
void
VarInit
(
access_t
*
);
static
int
ParseMRL
(
access_t
*
);
var_Create
(
p_input
,
"dvb-code-rate-hp"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-code-rate-lp"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-bandwidth"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-transmission"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-guard"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-hierarchy"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
i_test
=
strtol
(
psz_parser
,
&
psz_next
,
10
);
/*****************************************************************************
if
(
psz_next
==
psz_parser
)
* Open: open the frontend device
{
*****************************************************************************/
for
(
;
;
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
GET_OPTION_INT
(
"adapter"
)
access_t
*
p_access
=
(
access_t
*
)
p_this
;
else
GET_OPTION_INT
(
"device"
)
access_sys_t
*
p_sys
;
else
GET_OPTION_INT
(
"frequency"
)
else
GET_OPTION_INT
(
"inversion"
)
/* Only if selected */
else
GET_OPTION_BOOL
(
"probe"
)
if
(
*
p_access
->
psz_acces
==
'\0'
)
else
GET_OPTION_INT
(
"lnb-lof1"
)
return
VLC_EGENERIC
;
else
GET_OPTION_INT
(
"lnb-lof2"
)
else
GET_OPTION_INT
(
"lnb-slof"
)
/* Set up access */
p_access
->
pf_read
=
NULL
;
else
GET_OPTION_BOOL
(
"budget-mode"
)
p_access
->
pf_block
=
Block
;
else
GET_OPTION_INT
(
"voltage"
)
p_access
->
pf_control
=
Control
;
else
GET_OPTION_INT
(
"tone"
)
p_access
->
pf_seek
=
NULL
;
else
GET_OPTION_INT
(
"fec"
)
p_access
->
info
.
i_update
=
0
;
else
GET_OPTION_INT
(
"srate"
)
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
else
GET_OPTION_INT
(
"modulation"
)
p_access
->
info
.
b_eof
=
VLC_FALSE
;
p_access
->
info
.
i_title
=
0
;
else
GET_OPTION_INT
(
"code-rate-hp"
)
p_access
->
info
.
i_seekpoint
=
0
;
else
GET_OPTION_INT
(
"code-rate-lp"
)
else
GET_OPTION_INT
(
"bandwidth"
)
p_access
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
access_sys_t
)
);
else
GET_OPTION_INT
(
"transmission"
)
memset
(
p_sys
,
0
,
sizeof
(
access_sys_t
)
);
else
GET_OPTION_INT
(
"guard"
)
else
GET_OPTION_INT
(
"hierarchy"
)
/* Create all variables */
VarInit
(
p_access
);
else
if
(
!
strncmp
(
psz_parser
,
"satno="
,
strlen
(
"satno="
)
)
)
/* Parse the command line */
{
if
(
ParseMRL
(
p_access
)
)
psz_parser
+=
strlen
(
"satno="
);
if
(
*
psz_parser
==
'A'
||
*
psz_parser
==
'a'
)
val
.
i_int
=
-
1
;
else
if
(
*
psz_parser
==
'B'
||
*
psz_parser
==
'b'
)
val
.
i_int
=
-
2
;
else
val
.
i_int
=
strtol
(
psz_parser
,
&
psz_parser
,
0
);
var_Set
(
p_input
,
"dvb-satno"
,
val
);
}
/* Redundant with voltage but much easier to use */
else
if
(
!
strncmp
(
psz_parser
,
"polarization="
,
strlen
(
"polarization="
)
)
)
{
psz_parser
+=
strlen
(
"polarization="
);
if
(
*
psz_parser
==
'V'
||
*
psz_parser
==
'v'
)
val
.
i_int
=
13
;
else
if
(
*
psz_parser
==
'H'
||
*
psz_parser
==
'h'
)
val
.
i_int
=
18
;
else
{
msg_Err
(
p_input
,
"illegal polarization %c"
,
*
psz_parser
);
free
(
p_dvb
);
return
-
1
;
}
var_Set
(
p_input
,
"dvb-voltage"
,
val
);
}
if
(
*
psz_parser
)
psz_parser
++
;
else
break
;
}
}
else
{
{
msg_Err
(
p_input
,
"the DVB input old syntax is deprecated, use vlc "
\
free
(
p_sys
);
"-p dvb to see an explanation of the new syntax"
);
return
VLC_EGENERIC
;
free
(
p_dvb
);
return
-
1
;
}
}
/* Getting frontend info */
/* Getting frontend info */
if
(
E_
(
FrontendOpen
)(
p_input
)
<
0
)
if
(
E_
(
FrontendOpen
)(
p_access
)
)
{
{
free
(
p_
dvb
);
free
(
p_
sys
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
/* Setting frontend parameters for tuning the hardware */
/* Setting frontend parameters for tuning the hardware */
msg_Dbg
(
p_
input
,
"trying to tune the frontend..."
);
msg_Dbg
(
p_
access
,
"trying to tune the frontend..."
);
if
(
E_
(
FrontendSet
)(
p_input
)
<
0
)
if
(
E_
(
FrontendSet
)(
p_access
)
<
0
)
{
{
E_
(
FrontendClose
)(
p_
input
);
E_
(
FrontendClose
)(
p_
access
);
free
(
p_
dvb
);
free
(
p_
sys
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
/* Opening DVR device */
/* Opening DVR device */
if
(
E_
(
DVROpen
)(
p_input
)
<
0
)
if
(
E_
(
DVROpen
)(
p_access
)
<
0
)
{
{
E_
(
FrontendClose
)(
p_
input
);
E_
(
FrontendClose
)(
p_
access
);
free
(
p_
dvb
);
free
(
p_
sys
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
var_Get
(
p_input
,
"dvb-budget-mode"
,
&
val
);
p_sys
->
b_budget_mode
=
var_GetBool
(
p_access
,
"dvb-budget-mode"
);
p_dvb
->
b_budget_mode
=
val
.
b_bool
;
if
(
p_sys
->
b_budget_mode
)
if
(
val
.
b_bool
)
{
{
msg_Dbg
(
p_
input
,
"setting filter on all PIDs"
);
msg_Dbg
(
p_
access
,
"setting filter on all PIDs"
);
AllocateDemux
(
p_
input
,
0x2000
,
OTHER_TYPE
);
AllocateDemux
(
p_
access
,
0x2000
,
OTHER_TYPE
);
}
}
else
else
{
{
msg_Dbg
(
p_input
,
"setting filter on PAT"
);
msg_Dbg
(
p_access
,
"setting filter on PAT"
);
AllocateDemux
(
p_input
,
0x0
,
OTHER_TYPE
);
AllocateDemux
(
p_access
,
0x0
,
OTHER_TYPE
);
}
if
(
input_InitStream
(
p_input
,
sizeof
(
stream_ts_data_t
)
)
==
-
1
)
{
msg_Err
(
p_input
,
"could not initialize stream structure"
);
E_
(
FrontendClose
)(
p_input
);
close
(
p_dvb
->
i_handle
);
free
(
p_dvb
);
return
(
-
1
);
}
}
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
return
VLC_SUCCESS
;
p_input
->
stream
.
b_pace_control
=
0
;
p_input
->
stream
.
b_seekable
=
0
;
p_input
->
stream
.
p_selected_area
->
i_tell
=
0
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
p_input
->
i_mtu
=
SATELLITE_READ_ONCE
*
TS_PACKET_SIZE
;
p_input
->
stream
.
i_method
=
INPUT_METHOD_SATELLITE
;
return
0
;
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -425,261 +289,311 @@ static int Open( vlc_object_t *p_this )
...
@@ -425,261 +289,311 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
thread_dvb_data_t
*
p_dvb
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
if
(
!
p_dvb
->
b_budget_mode
)
FilterUnset
(
p_access
,
0
,
p_sys
->
b_budget_mode
?
1
:
MAX_DEMUX
);
{
CloseProgram
(
p_input
);
E_
(
DVRClose
)(
p_access
);
}
E_
(
FrontendClose
)(
p_access
);
if
(
p_dvb
->
p_demux_handles
[
0
].
i_type
)
free
(
p_sys
);
{
E_
(
DMXUnsetFilter
)(
p_input
,
p_dvb
->
p_demux_handles
[
0
].
i_handle
);
p_dvb
->
p_demux_handles
[
0
].
i_type
=
0
;
}
E_
(
DVRClose
)(
p_input
);
E_
(
FrontendClose
)(
p_input
);
free
(
p_dvb
);
}
}
/*****************************************************************************
/*****************************************************************************
*
Read: reads data from the satellite card
*
Block:
*****************************************************************************/
*****************************************************************************/
static
ssize_t
Read
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
static
block_t
*
Block
(
access_t
*
p_access
)
size_t
i_len
)
{
{
thread_dvb_data_t
*
p_dvb
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
ssize_t
i_ret
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
vlc_value_t
val
;
struct
timeval
timeout
;
struct
timeval
timeout
;
fd_set
fds
;
fd_set
fds
;
int
i_ret
;
if
(
!
p_dvb
->
b_budget_mode
&&
!
p_dvb
->
p_demux_handles
[
1
].
i_type
)
block_t
*
p_block
;
{
int
i_program
;
unsigned
int
i
;
var_Get
(
p_input
,
"program"
,
&
val
);
i_program
=
val
.
i_int
;
/* FIXME : this is not demux2-compatible */
for
(
i
=
0
;
i
<
p_input
->
stream
.
i_pgrm_number
;
i
++
)
{
/* Only set a filter on the selected program : some boards
* (read: Dreambox) only have 8 filters, so you don't want to
* spend them on unwanted PMTs. --Meuuh */
if
(
!
i_program
||
p_input
->
stream
.
pp_programs
[
i
]
->
i_number
==
i_program
)
{
msg_Dbg
(
p_input
,
"setting filter on PMT pid %d"
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
);
AllocateDemux
(
p_input
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
,
OTHER_TYPE
);
}
}
}
/* Find if some data is available. This won't work under Windows. */
/* Initialize file descriptor set */
/* Initialize file descriptor set */
FD_ZERO
(
&
fds
);
FD_ZERO
(
&
fds
);
FD_SET
(
p_
dvb
->
i_handle
,
&
fds
);
FD_SET
(
p_
sys
->
i_handle
,
&
fds
);
/* We'll wait 0.5 second if nothing happens */
/* We'll wait 0.5 second if nothing happens */
timeout
.
tv_sec
=
0
;
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
500000
;
timeout
.
tv_usec
=
500000
;
/* Find if some data is available */
/* Find if some data is available */
while
(
(
i_ret
=
select
(
p_dvb
->
i_handle
+
1
,
&
fds
,
while
(
(
i_ret
=
select
(
p_sys
->
i_handle
+
1
,
&
fds
,
NULL
,
NULL
,
&
timeout
))
==
0
||
NULL
,
NULL
,
&
timeout
))
==
0
(
i_ret
<
0
&&
errno
==
EINTR
)
)
||
(
i_ret
<
0
&&
errno
==
EINTR
)
)
{
{
FD_ZERO
(
&
fds
);
FD_ZERO
(
&
fds
);
FD_SET
(
p_
dvb
->
i_handle
,
&
fds
);
FD_SET
(
p_
sys
->
i_handle
,
&
fds
);
timeout
.
tv_sec
=
0
;
timeout
.
tv_sec
=
0
;
timeout
.
tv_usec
=
500000
;
timeout
.
tv_usec
=
500000
;
if
(
p_input
->
b_die
||
p_input
->
b_error
)
if
(
p_access
->
b_die
)
{
return
NULL
;
return
0
;
}
}
}
if
(
i_ret
<
0
)
if
(
i_ret
<
0
)
{
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"select error (%s)"
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"select error (%s)"
,
strerror
(
errno
)
);
#else
return
NULL
;
msg_Err
(
p_input
,
"select error"
);
#endif
return
-
1
;
}
}
i_ret
=
read
(
p_dvb
->
i_handle
,
p_buffer
,
i_len
);
p_block
=
block_New
(
p_access
,
p_sys
->
i_mtu
);
if
(
(
p_block
->
i_buffer
=
read
(
p_sys
->
i_handle
,
p_block
->
p_buffer
,
SATELLITE_READ_ONCE
*
TS_PACKET_SIZE
)
)
<=
0
)
if
(
i_ret
<
0
)
{
{
#ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"read failed (%s)"
,
strerror
(
errno
)
);
msg_Err
(
p_input
,
"read failed (%s)"
,
strerror
(
errno
)
);
#else
block_Release
(
p_block
);
msg_Err
(
p_input
,
"read failed"
);
return
NULL
;
#endif
}
}
return
i_ret
;
return
p_block
;
}
/*****************************************************************************
* SetArea : Does nothing
*****************************************************************************/
static
int
SetArea
(
input_thread_t
*
p_input
,
input_area_t
*
p_area
)
{
return
-
1
;
}
}
/*****************************************************************************
/*****************************************************************************
* SetProgram : Sets the card filters according to the selected program,
* Control:
* and makes the appropriate changes to stream structure.
*****************************************************************************/
*****************************************************************************/
static
int
SetProgram
(
input_thread_t
*
p_input
,
static
int
Control
(
access_t
*
p_access
,
int
i_query
,
va_list
args
)
pgrm_descriptor_t
*
p_new_prg
)
{
{
thread_dvb_data_t
*
p_dvb
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
unsigned
int
i_es_index
;
vlc_bool_t
*
pb_bool
,
b_bool
;
vlc_value_t
val
;
int
*
pi_int
,
i_int
;
int
i_video_type
=
VIDEO0_TYPE
;
int64_t
*
pi_64
;
int
i_audio_type
=
AUDIO0_TYPE
;
vlc_value_t
val
;
if
(
p_input
->
stream
.
p_selected_program
)
{
for
(
i_es_index
=
0
;
/* 0 should be the PMT */
i_es_index
<
p_input
->
stream
.
p_selected_program
->
i_es_number
;
i_es_index
++
)
{
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if
(
p_es
->
p_dec
)
{
input_UnselectES
(
p_input
,
p_es
);
}
#undef p_es
}
}
if
(
!
p_dvb
->
b_budget_mode
)
{
msg_Dbg
(
p_input
,
"unsetting filters on all pids"
);
CloseProgram
(
p_input
);
msg_Dbg
(
p_input
,
"setting filter on PMT pid %d"
,
p_new_prg
->
pp_es
[
0
]
->
i_id
);
AllocateDemux
(
p_input
,
p_new_prg
->
pp_es
[
0
]
->
i_id
,
OTHER_TYPE
);
}
for
(
i_es_index
=
1
;
i_es_index
<
p_new_prg
->
i_es_number
;
switch
(
i_query
)
i_es_index
++
)
{
{
#define p_es p_new_prg->pp_es[i_es_index]
/* */
switch
(
p_es
->
i_cat
)
case
ACCESS_CAN_SEEK
:
{
case
ACCESS_CAN_FASTSEEK
:
case
VIDEO_ES
:
case
ACCESS_CAN_PAUSE
:
if
(
!
p_dvb
->
b_budget_mode
)
case
ACCESS_CAN_CONTROL_PACE
:
{
pb_bool
=
(
vlc_bool_t
*
)
va_arg
(
args
,
vlc_bool_t
*
);
msg_Dbg
(
p_input
,
"setting filter on video ES 0x%x"
,
*
pb_bool
=
VLC_FALSE
;
p_es
->
i_id
);
break
;
/* Always set the filter. This may seem a little odd, but
/* */
* it allows you to stream the video with demuxstream
case
ACCESS_GET_MTU
:
* without having a decoder or a stream output behind.
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
* The result is you'll sometimes filter a PID which you
*
pi_int
=
SATELLITE_READ_ONCE
*
TS_PACKET_SIZE
;
* don't really want, but in the most common cases it
* should be OK. --Meuuh */
AllocateDemux
(
p_input
,
p_es
->
i_id
,
i_video_type
);
i_video_type
+=
TYPE_INTERVAL
;
}
input_SelectES
(
p_input
,
p_es
);
break
;
break
;
case
AUDIO_ES
:
case
ACCESS_GET_PTS_DELAY
:
if
(
!
p_dvb
->
b_budget_mode
)
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
{
*
pi_64
=
var_GetInteger
(
p_access
,
"dvb-caching"
)
*
1000
;
msg_Dbg
(
p_input
,
"setting filter on audio ES 0x%x"
,
p_es
->
i_id
);
AllocateDemux
(
p_input
,
p_es
->
i_id
,
i_audio_type
);
i_audio_type
+=
TYPE_INTERVAL
;
}
input_SelectES
(
p_input
,
p_es
);
break
;
break
;
default:
if
(
!
p_dvb
->
b_budget_mode
)
/* */
case
ACCESS_SET_PAUSE_STATE
:
case
ACCESS_GET_TITLE_INFO
:
case
ACCESS_SET_TITLE
:
case
ACCESS_SET_SEEKPOINT
:
return
VLC_EGENERIC
;
case
ACCESS_SET_PRIVATE_ID_STATE
:
b_bool
=
(
vlc_bool_t
)
va_arg
(
args
,
vlc_bool_t
);
/* b_selected */
i_int
=
(
int
)
va_arg
(
args
,
int
);
/* Private data (pid for now)*/
if
(
!
p_sys
->
b_budget_mode
)
{
{
msg_Dbg
(
p_input
,
"setting filter on other ES 0x%x"
,
/* FIXME we may want to give the real type (me ?, I don't ;) */
p_es
->
i_id
);
if
(
b_bool
)
AllocateDemux
(
p_input
,
p_es
->
i_id
,
OTHER_TYPE
);
FilterSet
(
p_access
,
i_int
,
OTHER_TYPE
);
else
FilterUnset
(
p_access
,
i_int
,
i_int
+
1
);
}
}
input_SelectES
(
p_input
,
p_es
);
break
;
break
;
}
#undef p_es
}
p_input
->
stream
.
p_selected_program
=
p_new_prg
;
/* Update the navigation variables without triggering a callback */
default:
val
.
i_int
=
p_new_prg
->
i_number
;
msg_Err
(
p_access
,
"unimplemented query in control"
)
;
var_Change
(
p_input
,
"program"
,
VLC_VAR_SETVALUE
,
&
val
,
NULL
)
;
return
VLC_EGENERIC
;
return
0
;
}
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
*
Seek: does nothing (not a seekable stream
*
FilterSet/FilterUnset:
*****************************************************************************/
*****************************************************************************/
static
void
Seek
(
input_thread_t
*
p_input
,
off_t
i_off
)
static
void
FilterSet
(
access_t
*
p_access
,
int
i_pid
,
int
i_type
);
{
{
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i
;
/* Find first free slot */
for
(
i
=
0
;
i
<
MAX_DEMUX
;
i
++
)
{
if
(
!
p_sys
->
p_demux_handles
[
i
].
i_type
)
break
;
}
if
(
i
>=
MAX_DEMUX
)
{
msg_Err
(
p_access
,
"no free p_demux_handles !"
);
return
;
}
if
(
E_
(
DMXSetFilter
)(
p_access
,
i_pid
,
&
p_sys
->
p_demux_handles
[
i
].
i_handle
,
i_type
)
)
{
msg_Err
(
p_access
,
"DMXSetFilter failed"
);
return
;
}
p_sys
->
p_demux_handles
[
i
].
i_type
=
i_type
;
p_sys
->
p_demux_handles
[
i
].
i_pid
=
i_pid
;
}
}
/*****************************************************************************
static
void
FilterUnset
(
access_t
*
p_access
,
int
i_start
,
int
i_max
)
* AllocateDemux:
*****************************************************************************/
static
void
AllocateDemux
(
input_thread_t
*
p_input
,
int
i_pid
,
int
i_type
)
{
{
thread_dvb_data_t
*
p_dvb
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
int
i
;
int
i
;
/* Find first free slot */
for
(
i
=
i_start
;
i
<
i_max
;
i
++
)
for
(
i
=
0
;
i
<
MAX_DEMUX
;
i
++
)
{
{
if
(
!
p_dvb
->
p_demux_handles
[
i
].
i_type
)
if
(
p_sys
->
p_demux_handles
[
i
].
i_type
)
{
{
if
(
E_
(
DMXSetFilter
)(
p_input
,
i_pid
,
E_
(
DMXUnsetFilter
)(
p_access
,
p_sys
->
p_demux_handles
[
i
].
i_handle
);
&
p_dvb
->
p_demux_handles
[
i
].
i_handle
,
p_sys
->
p_demux_handles
[
i
].
i_type
=
0
;
i_type
)
<
0
)
{
break
;
}
p_dvb
->
p_demux_handles
[
i
].
i_type
=
i_type
;
p_dvb
->
p_demux_handles
[
i
].
i_pid
=
i_pid
;
break
;
}
}
}
}
}
}
/*****************************************************************************
/*****************************************************************************
*
CloseProgram
:
*
VarInit/ParseMRL
:
*****************************************************************************/
*****************************************************************************/
static
void
CloseProgram
(
input_thread_t
*
p_input
)
static
void
VarInit
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
/* */
int
i
;
var_Create
(
p_input
,
"dvb-caching"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* */
var_Create
(
p_input
,
"dvb-adapter"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-device"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-frequency"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-inversion"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-probe"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-lof1"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-lof2"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-lnb-slof"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* */
var_Create
(
p_input
,
"dvb-budget-mode"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-satno"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-voltage"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-tone"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-fec"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-srate"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* */
var_Create
(
p_input
,
"dvb-modulation"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* */
var_Create
(
p_input
,
"dvb-code-rate-hp"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-code-rate-lp"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-bandwidth"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-transmission"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-guard"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_input
,
"dvb-hierarchy"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
}
/* */
static
int
ParseMRL
(
access_t
*
p_access
)
{
char
*
psz_dup
=
strdup
(
p_input
->
psz_path
);
char
*
psz_parser
=
psz_dup
;
char
*
psz_next
;
vlc_value_t
val
;
#define GET_OPTION_INT( option ) \
if ( !strncmp( psz_parser, option "=", strlen(option "=") ) ) \
{ \
val.i_int = strtol( psz_parser+strlen(option "="), &psz_parser, 0 );\
var_Set( p_access, "dvb-" option, val ); \
}
#define GET_OPTION_BOOL( option ) \
if ( !strncmp( psz_parser, option "=", strlen(option "=") ) ) \
{ \
val.b_bool = strtol( psz_parser + strlen(option "="), &psz_parser, \
0 ); \
var_Set( p_access, "dvb-" option, val ); \
}
for
(
i
=
1
;
i
<
MAX_DEMUX
;
i
++
)
/* Test for old syntax */
strtol
(
psz_parser
,
&
psz_next
,
10
);
if
(
psz_next
!=
psz_parser
)
{
{
if
(
p_dvb
->
p_demux_handles
[
i
].
i_type
)
msg_Err
(
p_access
,
"the DVB input old syntax is deprecated, use vlc "
"-p dvb to see an explanation of the new syntax"
);
free
(
psz_dup
);
return
VLC_EGENERIC
;
}
while
(
*
psz_parser
)
{
GET_OPTION_INT
(
"adapter"
)
else
GET_OPTION_INT
(
"device"
)
else
GET_OPTION_INT
(
"frequency"
)
else
GET_OPTION_INT
(
"inversion"
)
else
GET_OPTION_BOOL
(
"probe"
)
else
GET_OPTION_INT
(
"lnb-lof1"
)
else
GET_OPTION_INT
(
"lnb-lof2"
)
else
GET_OPTION_INT
(
"lnb-slof"
)
else
GET_OPTION_BOOL
(
"budget-mode"
)
else
GET_OPTION_INT
(
"voltage"
)
else
GET_OPTION_INT
(
"tone"
)
else
GET_OPTION_INT
(
"fec"
)
else
GET_OPTION_INT
(
"srate"
)
else
GET_OPTION_INT
(
"modulation"
)
else
GET_OPTION_INT
(
"code-rate-hp"
)
else
GET_OPTION_INT
(
"code-rate-lp"
)
else
GET_OPTION_INT
(
"bandwidth"
)
else
GET_OPTION_INT
(
"transmission"
)
else
GET_OPTION_INT
(
"guard"
)
else
GET_OPTION_INT
(
"hierarchy"
)
else
if
(
!
strncmp
(
psz_parser
,
"satno="
,
strlen
(
"satno="
)
)
)
{
psz_parser
+=
strlen
(
"satno="
);
if
(
*
psz_parser
==
'A'
||
*
psz_parser
==
'a'
)
val
.
i_int
=
-
1
;
else
if
(
*
psz_parser
==
'B'
||
*
psz_parser
==
'b'
)
val
.
i_int
=
-
2
;
else
val
.
i_int
=
strtol
(
psz_parser
,
&
psz_parser
,
0
);
var_Set
(
p_access
,
"dvb-satno"
,
val
);
}
/* Redundant with voltage but much easier to use */
else
if
(
!
strncmp
(
psz_parser
,
"polarization="
,
strlen
(
"polarization="
)
)
)
{
psz_parser
+=
strlen
(
"polarization="
);
if
(
*
psz_parser
==
'V'
||
*
psz_parser
==
'v'
)
val
.
i_int
=
13
;
else
if
(
*
psz_parser
==
'H'
||
*
psz_parser
==
'h'
)
val
.
i_int
=
18
;
else
{
msg_Err
(
p_access
,
"illegal polarization %c"
,
*
psz_parser
);
free
(
psz_dup
);
return
VLC_EGENERIC
;
}
var_Set
(
p_access
,
"dvb-voltage"
,
val
);
}
else
{
{
E_
(
DMXUnsetFilter
)(
p_input
,
p_dvb
->
p_demux_handles
[
i
].
i_handle
);
msg_Err
(
p_access
,
"unknown option (%d)"
,
psz_parser
);
p_dvb
->
p_demux_handles
[
i
].
i_type
=
0
;
free
(
psz_dup
);
return
VLC_EGENERIC
;
}
}
psz_parser
++
;
}
}
}
#undef GET_OPTION_INT
#undef GET_OPTION_BOOL
free
(
psz_dup
);
return
VLC_SUCCESS
;
}
modules/access/dvb/dvb.h
View file @
a82c7e3e
...
@@ -34,40 +34,43 @@
...
@@ -34,40 +34,43 @@
/*****************************************************************************
/*****************************************************************************
* Local structures
* Local structures
*****************************************************************************/
*****************************************************************************/
typedef
struct
demux_handle_t
typedef
struct
{
{
int
i_pid
;
int
i_pid
;
int
i_handle
;
int
i_handle
;
int
i_type
;
int
i_type
;
}
demux_handle_t
;
}
demux_handle_t
;
typedef
struct
frontend_t
frontend_t
;
#define MAX_DEMUX 24
#define MAX_DEMUX 24
typedef
struct
thread_dvb_data
_t
struct
access
_t
{
{
int
i_handle
;
int
i_handle
;
demux_handle_t
p_demux_handles
[
MAX_DEMUX
];
demux_handle_t
p_demux_handles
[
MAX_DEMUX
];
void
*
p_frontend
;
frontend_t
*
p_frontend
;
vlc_bool_t
b_budget_mode
;
vlc_bool_t
b_budget_mode
;
}
thread_dvb_data_t
;
};
#define VIDEO0_TYPE 1
#define VIDEO0_TYPE
1
#define AUDIO0_TYPE 2
#define AUDIO0_TYPE
2
#define TELETEXT0_TYPE 3
#define TELETEXT0_TYPE
3
#define SUBTITLE0_TYPE 4
#define SUBTITLE0_TYPE
4
#define PCR0_TYPE 5
#define PCR0_TYPE
5
#define TYPE_INTERVAL 5
#define TYPE_INTERVAL
5
#define OTHER_TYPE 21
#define OTHER_TYPE
21
/*****************************************************************************
/*****************************************************************************
* Prototypes
* Prototypes
*****************************************************************************/
*****************************************************************************/
int
E_
(
FrontendOpen
)(
input_thread_t
*
p_input
);
int
E_
(
FrontendOpen
)(
access_t
*
);
void
E_
(
FrontendClose
)(
input_thread_t
*
p_input
);
int
E_
(
FrontendSet
)(
access_t
*
);
int
E_
(
FrontendSet
)(
input_thread_t
*
p_input
);
void
E_
(
FrontendClose
)(
access_t
*
);
int
E_
(
DMXSetFilter
)(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
);
int
E_
(
DMXSetFilter
)(
access_t
*
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
);
int
E_
(
DMXUnsetFilter
)(
input_thread_t
*
p_input
,
int
i_fd
);
int
E_
(
DMXUnsetFilter
)(
access_t
*
,
int
i_fd
);
int
E_
(
DVROpen
)(
input_thread_t
*
p_input
);
void
E_
(
DVRClose
)(
input_thread_t
*
p_input
);
int
E_
(
DVROpen
)(
access_t
*
);
void
E_
(
DVRClose
)(
access_t
*
);
modules/access/dvb/linux_dvb.c
View file @
a82c7e3e
...
@@ -28,21 +28,13 @@
...
@@ -28,21 +28,13 @@
#include <vlc/input.h>
#include <vlc/input.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_ERRNO_H
# include <string.h>
# include <errno.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
/* int16_t .. */
#endif
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <fcntl.h>
#include <time.h>
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/poll.h>
#include <sys/poll.h>
...
@@ -55,81 +47,67 @@
...
@@ -55,81 +47,67 @@
#include "dvb.h"
#include "dvb.h"
/*
/*
* Frontends
* Frontends
*/
*/
struct
frontend_t
typedef
struct
frontend_t
{
{
int
i_handle
;
int
i_handle
;
struct
dvb_frontend_info
info
;
struct
dvb_frontend_info
info
;
}
frontend_t
;
};
/* Local prototypes */
/* Local prototypes */
static
int
FrontendInfo
(
input_thread_t
*
p_input
);
static
int
FrontendInfo
(
access_t
*
);
static
int
FrontendSetQPSK
(
input_thread_t
*
p_input
);
static
int
FrontendSetQPSK
(
access_t
*
);
static
int
FrontendSetQAM
(
input_thread_t
*
p_input
);
static
int
FrontendSetQAM
(
access_t
*
);
static
int
FrontendSetOFDM
(
input_thread_t
*
p_input
);
static
int
FrontendSetOFDM
(
access_t
*
);
static
int
FrontendCheck
(
input_thread_t
*
p_input
);
static
int
FrontendCheck
(
access_t
*
);
/*****************************************************************************
/*****************************************************************************
* FrontendOpen : Determine frontend device information and capabilities
* FrontendOpen : Determine frontend device information and capabilities
*****************************************************************************/
*****************************************************************************/
int
E_
(
FrontendOpen
)(
input_thread_t
*
p_input
)
int
E_
(
FrontendOpen
)(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
;
frontend_t
*
p_frontend
;
unsigned
int
i_adapter
,
i_device
;
unsigned
int
i_adapter
,
i_device
;
vlc_bool_t
b_probe
;
vlc_bool_t
b_probe
;
char
frontend
[
128
];
char
frontend
[
128
];
vlc_value_t
val
;
var_Get
(
p_input
,
"dvb-adapter"
,
&
val
);
i_adapter
=
var_GetInteger
(
p_access
,
"dvb-adapter"
);
i_adapter
=
val
.
i_int
;
i_device
=
var_GetInteger
(
p_access
,
"dvb-device"
);
var_Get
(
p_input
,
"dvb-device"
,
&
val
);
b_probe
=
var_GetBool
(
p_access
,
"dvb-probe"
);
i_device
=
val
.
i_int
;
var_Get
(
p_input
,
"dvb-probe"
,
&
val
);
b_probe
=
val
.
b_bool
;
if
(
snprintf
(
frontend
,
sizeof
(
frontend
),
FRONTEND
,
i_adapter
,
i_device
)
if
(
snprintf
(
frontend
,
sizeof
(
frontend
),
FRONTEND
,
i_adapter
,
i_device
)
>=
(
int
)
sizeof
(
frontend
)
)
>=
(
int
)
sizeof
(
frontend
)
)
{
{
msg_Err
(
p_
input
,
"snprintf() truncated string for FRONTEND"
);
msg_Err
(
p_
access
,
"snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
frontend
)
-
1
]
=
'\0'
;
frontend
[
sizeof
(
frontend
)
-
1
]
=
'\0'
;
}
}
p_frontend
=
(
frontend_t
*
)
malloc
(
sizeof
(
frontend_t
));
p_sys
->
p_frontend
=
p_frontend
=
malloc
(
sizeof
(
frontend_t
)
);
if
(
p_frontend
==
NULL
)
{
msg_Err
(
p_input
,
"FrontEndOpen: out of memory"
);
return
-
1
;
}
p_dvb
->
p_frontend
=
p_frontend
;
msg_Dbg
(
p_access
,
"Opening device %s"
,
frontend
);
if
(
(
p_frontend
->
i_handle
=
open
(
frontend
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
msg_Dbg
(
p_input
,
"Opening device %s"
,
frontend
);
if
(
(
p_frontend
->
i_handle
=
open
(
frontend
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
{
{
msg_Err
(
p_
input
,
"FrontEndOpen: opening device failed (%s)"
,
msg_Err
(
p_
access
,
"FrontEndOpen: opening device failed (%s)"
,
strerror
(
errno
)
);
strerror
(
errno
)
);
free
(
p_frontend
);
free
(
p_frontend
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
if
(
b_probe
)
if
(
b_probe
)
{
{
char
*
psz_expected
=
NULL
;
char
*
psz_expected
=
NULL
;
char
*
psz_real
;
char
*
psz_real
;
if
(
FrontendInfo
(
p_input
)
<
0
)
if
(
FrontendInfo
(
p_access
)
<
0
)
{
{
close
(
p_frontend
->
i_handle
);
close
(
p_frontend
->
i_handle
);
free
(
p_frontend
);
free
(
p_frontend
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
switch
(
p_frontend
->
info
.
type
)
switch
(
p_frontend
->
info
.
type
)
{
{
case
FE_OFDM
:
case
FE_OFDM
:
psz_real
=
"DVB-T"
;
psz_real
=
"DVB-T"
;
...
@@ -143,267 +121,264 @@ int E_(FrontendOpen)( input_thread_t * p_input )
...
@@ -143,267 +121,264 @@ int E_(FrontendOpen)( input_thread_t * p_input )
default:
default:
psz_real
=
"unknown"
;
psz_real
=
"unknown"
;
}
}
/* Sanity checks */
/* Sanity checks */
if
(
(
(
strncmp
(
p_input
->
psz_access
,
"qpsk"
,
4
)
==
0
)
||
if
(
(
!
strncmp
(
p_access
->
psz_access
,
"qpsk"
,
4
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-s"
,
5
)
==
0
)
||
!
strncmp
(
p_access
->
psz_access
,
"dvb-s"
,
5
)
||
(
strncmp
(
p_input
->
psz_access
,
"satellite"
,
9
)
==
0
)
)
&&
!
strncmp
(
p_access
->
psz_access
,
"satellite"
,
9
)
)
&&
(
p_frontend
->
info
.
type
!=
FE_QPSK
)
)
(
p_frontend
->
info
.
type
!=
FE_QPSK
)
)
{
{
psz_expected
=
"DVB-S"
;
psz_expected
=
"DVB-S"
;
}
}
if
(
(
(
strncmp
(
p_input
->
psz_access
,
"cable"
,
5
)
==
0
)
||
if
(
(
!
strncmp
(
p_access
->
psz_access
,
"cable"
,
5
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-c"
,
5
)
==
0
)
)
&&
!
strncmp
(
p_access
->
psz_access
,
"dvb-c"
,
5
)
)
&&
(
p_frontend
->
info
.
type
!=
FE_QAM
)
)
(
p_frontend
->
info
.
type
!=
FE_QAM
)
)
{
{
psz_expected
=
"DVB-C"
;
psz_expected
=
"DVB-C"
;
}
}
if
(
(
(
strncmp
(
p_input
->
psz_access
,
"terrestrial"
,
11
)
==
0
)
||
if
(
(
!
strncmp
(
p_access
->
psz_access
,
"terrestrial"
,
11
)
||
(
strncmp
(
p_input
->
psz_access
,
"dvb-t"
,
5
)
==
0
)
)
&&
!
strncmp
(
p_access
->
psz_access
,
"dvb-t"
,
5
)
)
&&
(
p_frontend
->
info
.
type
!=
FE_OFDM
)
)
(
p_frontend
->
info
.
type
!=
FE_OFDM
)
)
{
{
psz_expected
=
"DVB-T"
;
psz_expected
=
"DVB-T"
;
}
}
if
(
psz_expected
!=
NULL
)
if
(
psz_expected
!=
NULL
)
{
{
msg_Err
(
p_
input
,
"the user asked for %s, and the tuner is %s"
,
msg_Err
(
p_
access
,
"the user asked for %s, and the tuner is %s"
,
psz_expected
,
psz_real
);
psz_expected
,
psz_real
);
close
(
p_frontend
->
i_handle
);
close
(
p_frontend
->
i_handle
);
free
(
p_frontend
);
free
(
p_frontend
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
}
}
else
/* no frontend probing is done so use default border values. */
else
/* no frontend probing is done so use default border values. */
{
{
msg_Dbg
(
p_
input
,
"using default values for frontend info"
);
msg_Dbg
(
p_
access
,
"using default values for frontend info"
);
msg_Dbg
(
p_
input
,
"method of access is %s"
,
p_input
->
psz_access
);
msg_Dbg
(
p_
access
,
"method of access is %s"
,
p_access
->
psz_access
);
p_frontend
->
info
.
type
=
FE_QPSK
;
p_frontend
->
info
.
type
=
FE_QPSK
;
if
(
!
strncmp
(
p_input
->
psz_access
,
"qpsk"
,
4
)
||
if
(
!
strncmp
(
p_access
->
psz_access
,
"qpsk"
,
4
)
||
!
strncmp
(
p_input
->
psz_access
,
"dvb-s"
,
5
)
)
!
strncmp
(
p_access
->
psz_access
,
"dvb-s"
,
5
)
)
p_frontend
->
info
.
type
=
FE_QPSK
;
p_frontend
->
info
.
type
=
FE_QPSK
;
else
if
(
!
strncmp
(
p_input
->
psz_access
,
"cable"
,
5
)
||
else
if
(
!
strncmp
(
p_access
->
psz_access
,
"cable"
,
5
)
||
!
strncmp
(
p_input
->
psz_access
,
"dvb-c"
,
5
)
)
!
strncmp
(
p_access
->
psz_access
,
"dvb-c"
,
5
)
)
p_frontend
->
info
.
type
=
FE_QAM
;
p_frontend
->
info
.
type
=
FE_QAM
;
else
if
(
!
strncmp
(
p_input
->
psz_access
,
"terrestrial"
,
11
)
||
else
if
(
!
strncmp
(
p_access
->
psz_access
,
"terrestrial"
,
11
)
||
!
strncmp
(
p_input
->
psz_access
,
"dvb-t"
,
5
)
)
!
strncmp
(
p_access
->
psz_access
,
"dvb-t"
,
5
)
)
p_frontend
->
info
.
type
=
FE_OFDM
;
p_frontend
->
info
.
type
=
FE_OFDM
;
}
}
return
0
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendClose : Close the frontend
* FrontendClose : Close the frontend
*****************************************************************************/
*****************************************************************************/
void
E_
(
FrontendClose
)(
input_thread_t
*
p_input
)
void
E_
(
FrontendClose
)(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
if
(
p_frontend
!=
NULL
)
if
(
p_sys
->
p_frontend
)
{
{
close
(
p_frontend
->
i_handle
);
close
(
p_sys
->
p_frontend
->
i_handle
);
free
(
p_frontend
);
free
(
p_sys
->
p_frontend
);
p_sys
->
p_frontend
=
NULL
;
}
}
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendSet : Tune !
* FrontendSet : Tune !
*****************************************************************************/
*****************************************************************************/
int
E_
(
FrontendSet
)(
input_thread_t
*
p_input
)
int
E_
(
FrontendSet
)(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
switch
(
p_frontend
->
info
.
type
)
switch
(
p_sys
->
p_frontend
->
info
.
type
)
{
{
/* DVB-S: satellite and budget cards (nova) */
/* DVB-S: satellite and budget cards (nova) */
case
FE_QPSK
:
case
FE_QPSK
:
if
(
FrontendSetQPSK
(
p_input
)
<
0
)
if
(
FrontendSetQPSK
(
p_access
)
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-S: tuning failed"
);
msg_Err
(
p_
access
,
"DVB-S: tuning failed"
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
break
;
break
;
/* DVB-C */
/* DVB-C */
case
FE_QAM
:
case
FE_QAM
:
if
(
FrontendSetQAM
(
p_input
)
<
0
)
if
(
FrontendSetQAM
(
p_access
)
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-C: tuning failed"
);
msg_Err
(
p_
access
,
"DVB-C: tuning failed"
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
break
;
break
;
/* DVB-T */
/* DVB-T */
case
FE_OFDM
:
case
FE_OFDM
:
if
(
FrontendSetOFDM
(
p_input
)
<
0
)
if
(
FrontendSetOFDM
(
p_access
)
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-T: tuning failed"
);
msg_Err
(
p_
access
,
"DVB-T: tuning failed"
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
break
;
break
;
default:
default:
msg_Err
(
p_
input
,
"Could not determine frontend type on %s"
,
msg_Err
(
p_
access
,
"Could not determine frontend type on %s"
,
p_frontend
->
info
.
name
);
p_
sys
->
p_
frontend
->
info
.
name
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
return
0
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendInfo : Return information about given frontend
* FrontendInfo : Return information about given frontend
*****************************************************************************/
*****************************************************************************/
static
int
FrontendInfo
(
input_thread_t
*
p_input
)
static
int
FrontendInfo
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
int
i_ret
;
int
i_ret
;
/* Determine type of frontend */
/* Determine type of frontend */
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_GET_INFO
,
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_GET_INFO
,
&
p_frontend
->
info
))
<
0
)
&
p_frontend
->
info
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_GET_INFO failed (%d) %s"
,
i_ret
,
msg_Err
(
p_
access
,
"ioctl FE_GET_INFO failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
/* Print out frontend capabilities. */
/* Print out frontend capabilities. */
msg_Dbg
(
p_
input
,
"Frontend Info:"
);
msg_Dbg
(
p_
access
,
"Frontend Info:"
);
msg_Dbg
(
p_
input
,
" name = %s"
,
p_frontend
->
info
.
name
);
msg_Dbg
(
p_
access
,
" name = %s"
,
p_frontend
->
info
.
name
);
switch
(
p_frontend
->
info
.
type
)
switch
(
p_frontend
->
info
.
type
)
{
{
case
FE_QPSK
:
case
FE_QPSK
:
msg_Dbg
(
p_
input
,
" type = QPSK (DVB-S)"
);
msg_Dbg
(
p_
access
,
" type = QPSK (DVB-S)"
);
break
;
break
;
case
FE_QAM
:
case
FE_QAM
:
msg_Dbg
(
p_
input
,
" type = QAM (DVB-C)"
);
msg_Dbg
(
p_
access
,
" type = QAM (DVB-C)"
);
break
;
break
;
case
FE_OFDM
:
case
FE_OFDM
:
msg_Dbg
(
p_
input
,
" type = OFDM (DVB-T)"
);
msg_Dbg
(
p_
access
,
" type = OFDM (DVB-T)"
);
break
;
break
;
#if 0 /* DVB_API_VERSION == 3 */
#if 0 /* DVB_API_VERSION == 3 */
case FE_MEMORY:
case FE_MEMORY:
msg_Dbg(p_
input
, " type = MEMORY" );
msg_Dbg(p_
access
, " type = MEMORY" );
break;
break;
case FE_NET:
case FE_NET:
msg_Dbg(p_
input
, " type = NETWORK" );
msg_Dbg(p_
access
, " type = NETWORK" );
break;
break;
#endif
#endif
default:
default:
msg_Err
(
p_
input
,
" unknown frontend type (%d)"
,
msg_Err
(
p_
access
,
" unknown frontend type (%d)"
,
p_frontend
->
info
.
type
);
p_frontend
->
info
.
type
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
msg_Dbg
(
p_
input
,
" frequency_min = %u (kHz)"
,
msg_Dbg
(
p_
access
,
" frequency_min = %u (kHz)"
,
p_frontend
->
info
.
frequency_min
);
p_frontend
->
info
.
frequency_min
);
msg_Dbg
(
p_
input
,
" frequency_max = %u (kHz)"
,
msg_Dbg
(
p_
access
,
" frequency_max = %u (kHz)"
,
p_frontend
->
info
.
frequency_max
);
p_frontend
->
info
.
frequency_max
);
msg_Dbg
(
p_
input
,
" frequency_stepsize = %u"
,
msg_Dbg
(
p_
access
,
" frequency_stepsize = %u"
,
p_frontend
->
info
.
frequency_stepsize
);
p_frontend
->
info
.
frequency_stepsize
);
msg_Dbg
(
p_
input
,
" frequency_tolerance = %u"
,
msg_Dbg
(
p_
access
,
" frequency_tolerance = %u"
,
p_frontend
->
info
.
frequency_tolerance
);
p_frontend
->
info
.
frequency_tolerance
);
msg_Dbg
(
p_
input
,
" symbol_rate_min = %u (kHz)"
,
msg_Dbg
(
p_
access
,
" symbol_rate_min = %u (kHz)"
,
p_frontend
->
info
.
symbol_rate_min
);
p_frontend
->
info
.
symbol_rate_min
);
msg_Dbg
(
p_
input
,
" symbol_rate_max = %u (kHz)"
,
msg_Dbg
(
p_
access
,
" symbol_rate_max = %u (kHz)"
,
p_frontend
->
info
.
symbol_rate_max
);
p_frontend
->
info
.
symbol_rate_max
);
msg_Dbg
(
p_
input
,
" symbol_rate_tolerance (ppm) = %u"
,
msg_Dbg
(
p_
access
,
" symbol_rate_tolerance (ppm) = %u"
,
p_frontend
->
info
.
symbol_rate_tolerance
);
p_frontend
->
info
.
symbol_rate_tolerance
);
msg_Dbg
(
p_
input
,
" notifier_delay (ms) = %u"
,
msg_Dbg
(
p_
access
,
" notifier_delay (ms) = %u"
,
p_frontend
->
info
.
notifier_delay
);
p_frontend
->
info
.
notifier_delay
);
msg_Dbg
(
p_
input
,
"Frontend Info capability list:"
);
msg_Dbg
(
p_
access
,
"Frontend Info capability list:"
);
if
(
p_frontend
->
info
.
caps
&
FE_IS_STUPID
)
if
(
p_frontend
->
info
.
caps
&
FE_IS_STUPID
)
msg_Dbg
(
p_
input
,
" no capabilities - frontend is stupid!"
);
msg_Dbg
(
p_
access
,
" no capabilities - frontend is stupid!"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_INVERSION_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_INVERSION_AUTO
)
msg_Dbg
(
p_
input
,
" inversion auto"
);
msg_Dbg
(
p_
access
,
" inversion auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_1_2
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_1_2
)
msg_Dbg
(
p_
input
,
" forward error correction 1/2"
);
msg_Dbg
(
p_
access
,
" forward error correction 1/2"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_2_3
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_2_3
)
msg_Dbg
(
p_
input
,
" forward error correction 2/3"
);
msg_Dbg
(
p_
access
,
" forward error correction 2/3"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_3_4
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_3_4
)
msg_Dbg
(
p_
input
,
" forward error correction 3/4"
);
msg_Dbg
(
p_
access
,
" forward error correction 3/4"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_4_5
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_4_5
)
msg_Dbg
(
p_
input
,
" forward error correction 4/5"
);
msg_Dbg
(
p_
access
,
" forward error correction 4/5"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_5_6
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_5_6
)
msg_Dbg
(
p_
input
,
" forward error correction 5/6"
);
msg_Dbg
(
p_
access
,
" forward error correction 5/6"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_6_7
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_6_7
)
msg_Dbg
(
p_
input
,
" forward error correction 6/7"
);
msg_Dbg
(
p_
access
,
" forward error correction 6/7"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_7_8
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_7_8
)
msg_Dbg
(
p_
input
,
" forward error correction 7/8"
);
msg_Dbg
(
p_
access
,
" forward error correction 7/8"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_8_9
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_8_9
)
msg_Dbg
(
p_
input
,
" forward error correction 8/9"
);
msg_Dbg
(
p_
access
,
" forward error correction 8/9"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_FEC_AUTO
)
msg_Dbg
(
p_
input
,
" forward error correction auto"
);
msg_Dbg
(
p_
access
,
" forward error correction auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QPSK
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QPSK
)
msg_Dbg
(
p_
input
,
" card can do QPSK"
);
msg_Dbg
(
p_
access
,
" card can do QPSK"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_16
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_16
)
msg_Dbg
(
p_
input
,
" card can do QAM 16"
);
msg_Dbg
(
p_
access
,
" card can do QAM 16"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_32
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_32
)
msg_Dbg
(
p_
input
,
" card can do QAM 32"
);
msg_Dbg
(
p_
access
,
" card can do QAM 32"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_64
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_64
)
msg_Dbg
(
p_
input
,
" card can do QAM 64"
);
msg_Dbg
(
p_
access
,
" card can do QAM 64"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_128
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_128
)
msg_Dbg
(
p_
input
,
" card can do QAM 128"
);
msg_Dbg
(
p_
access
,
" card can do QAM 128"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_256
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_256
)
msg_Dbg
(
p_
input
,
" card can do QAM 256"
);
msg_Dbg
(
p_
access
,
" card can do QAM 256"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_QAM_AUTO
)
msg_Dbg
(
p_
input
,
" card can do QAM auto"
);
msg_Dbg
(
p_
access
,
" card can do QAM auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_TRANSMISSION_MODE_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_TRANSMISSION_MODE_AUTO
)
msg_Dbg
(
p_
input
,
" transmission mode auto"
);
msg_Dbg
(
p_
access
,
" transmission mode auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_BANDWIDTH_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_BANDWIDTH_AUTO
)
msg_Dbg
(
p_
input
,
" bandwidth mode auto"
);
msg_Dbg
(
p_
access
,
" bandwidth mode auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_GUARD_INTERVAL_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_GUARD_INTERVAL_AUTO
)
msg_Dbg
(
p_
input
,
" guard interval mode auto"
);
msg_Dbg
(
p_
access
,
" guard interval mode auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_HIERARCHY_AUTO
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_HIERARCHY_AUTO
)
msg_Dbg
(
p_
input
,
" hierarchy mode auto"
);
msg_Dbg
(
p_
access
,
" hierarchy mode auto"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_MUTE_TS
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_MUTE_TS
)
msg_Dbg
(
p_
input
,
" card can mute TS"
);
msg_Dbg
(
p_
access
,
" card can mute TS"
);
if
(
p_frontend
->
info
.
caps
&
FE_CAN_CLEAN_SETUP
)
if
(
p_frontend
->
info
.
caps
&
FE_CAN_CLEAN_SETUP
)
msg_Dbg
(
p_
input
,
" clean setup"
);
msg_Dbg
(
p_
access
,
" clean setup"
);
msg_Dbg
(
p_
input
,
"End of capability list"
);
msg_Dbg
(
p_
access
,
"End of capability list"
);
return
0
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* Decoding the DVB parameters (common)
* Decoding the DVB parameters (common)
*****************************************************************************/
*****************************************************************************/
static
fe_spectral_inversion_t
DecodeInversion
(
input_thread_t
*
p_input
)
static
fe_spectral_inversion_t
DecodeInversion
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_spectral_inversion_t
fe_inversion
=
0
;
fe_spectral_inversion_t
fe_inversion
=
0
;
var_Get
(
p_
input
,
"dvb-inversion"
,
&
val
);
var_Get
(
p_
access
,
"dvb-inversion"
,
&
val
);
msg_Dbg
(
p_
input
,
"using inversion=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using inversion=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_inversion
=
INVERSION_OFF
;
break
;
case
0
:
fe_inversion
=
INVERSION_OFF
;
break
;
case
1
:
fe_inversion
=
INVERSION_ON
;
break
;
case
1
:
fe_inversion
=
INVERSION_ON
;
break
;
case
2
:
fe_inversion
=
INVERSION_AUTO
;
break
;
case
2
:
fe_inversion
=
INVERSION_AUTO
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"dvb has inversion not set, using auto"
);
msg_Dbg
(
p_
access
,
"dvb has inversion not set, using auto"
);
fe_inversion
=
INVERSION_AUTO
;
fe_inversion
=
INVERSION_AUTO
;
break
;
break
;
}
}
return
fe_inversion
;
return
fe_inversion
;
}
}
static
fe_code_rate_t
DecodeFEC
(
input_thread_t
*
p_input
,
int
i_val
)
static
fe_code_rate_t
DecodeFEC
(
access_t
*
p_access
,
int
i_val
)
{
{
fe_code_rate_t
fe_fec
=
FEC_NONE
;
fe_code_rate_t
fe_fec
=
FEC_NONE
;
msg_Dbg
(
p_
input
,
"using fec=%d"
,
i_val
);
msg_Dbg
(
p_
access
,
"using fec=%d"
,
i_val
);
switch
(
i_val
)
switch
(
i_val
)
{
{
case
0
:
fe_fec
=
FEC_NONE
;
break
;
case
0
:
fe_fec
=
FEC_NONE
;
break
;
case
1
:
fe_fec
=
FEC_1_2
;
break
;
case
1
:
fe_fec
=
FEC_1_2
;
break
;
...
@@ -418,20 +393,20 @@ static fe_code_rate_t DecodeFEC( input_thread_t * p_input, int i_val )
...
@@ -418,20 +393,20 @@ static fe_code_rate_t DecodeFEC( input_thread_t * p_input, int i_val )
default:
default:
/* cannot happen */
/* cannot happen */
fe_fec
=
FEC_NONE
;
fe_fec
=
FEC_NONE
;
msg_Err
(
p_
input
,
"argument has invalid FEC (%d)"
,
i_val
);
msg_Err
(
p_
access
,
"argument has invalid FEC (%d)"
,
i_val
);
break
;
break
;
}
}
return
fe_fec
;
return
fe_fec
;
}
}
static
fe_modulation_t
DecodeModulation
(
input_thread_t
*
p_input
)
static
fe_modulation_t
DecodeModulation
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_modulation_t
fe_modulation
=
0
;
fe_modulation_t
fe_modulation
=
0
;
var_Get
(
p_
input
,
"dvb-modulation"
,
&
val
);
var_Get
(
p_
access
,
"dvb-modulation"
,
&
val
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
-
1
:
fe_modulation
=
QPSK
;
break
;
case
-
1
:
fe_modulation
=
QPSK
;
break
;
case
0
:
fe_modulation
=
QAM_AUTO
;
break
;
case
0
:
fe_modulation
=
QAM_AUTO
;
break
;
...
@@ -441,54 +416,54 @@ static fe_modulation_t DecodeModulation( input_thread_t * p_input )
...
@@ -441,54 +416,54 @@ static fe_modulation_t DecodeModulation( input_thread_t * p_input )
case
128
:
fe_modulation
=
QAM_128
;
break
;
case
128
:
fe_modulation
=
QAM_128
;
break
;
case
256
:
fe_modulation
=
QAM_256
;
break
;
case
256
:
fe_modulation
=
QAM_256
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"terrestrial/cable dvb has constellation/modulation not set, using auto"
);
msg_Dbg
(
p_
access
,
"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
;
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendSetQPSK : controls the FE device
* FrontendSetQPSK : controls the FE device
*****************************************************************************/
*****************************************************************************/
static
fe_sec_voltage_t
DecodeVoltage
(
input_thread_t
*
p_input
)
static
fe_sec_voltage_t
DecodeVoltage
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_sec_voltage_t
fe_voltage
;
fe_sec_voltage_t
fe_voltage
;
var_Get
(
p_
input
,
"dvb-voltage"
,
&
val
);
var_Get
(
p_
access
,
"dvb-voltage"
,
&
val
);
msg_Dbg
(
p_
input
,
"using voltage=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using voltage=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_voltage
=
SEC_VOLTAGE_OFF
;
break
;
case
0
:
fe_voltage
=
SEC_VOLTAGE_OFF
;
break
;
case
13
:
fe_voltage
=
SEC_VOLTAGE_13
;
break
;
case
13
:
fe_voltage
=
SEC_VOLTAGE_13
;
break
;
case
18
:
fe_voltage
=
SEC_VOLTAGE_18
;
break
;
case
18
:
fe_voltage
=
SEC_VOLTAGE_18
;
break
;
default:
default:
fe_voltage
=
SEC_VOLTAGE_OFF
;
fe_voltage
=
SEC_VOLTAGE_OFF
;
msg_Err
(
p_
input
,
"argument has invalid voltage (%d)"
,
val
.
i_int
);
msg_Err
(
p_
access
,
"argument has invalid voltage (%d)"
,
val
.
i_int
);
break
;
break
;
}
}
return
fe_voltage
;
return
fe_voltage
;
}
}
static
fe_sec_tone_mode_t
DecodeTone
(
input_thread_t
*
p_input
)
static
fe_sec_tone_mode_t
DecodeTone
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_sec_tone_mode_t
fe_tone
;
fe_sec_tone_mode_t
fe_tone
;
var_Get
(
p_
input
,
"dvb-tone"
,
&
val
);
var_Get
(
p_
access
,
"dvb-tone"
,
&
val
);
msg_Dbg
(
p_
input
,
"using tone=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using tone=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_tone
=
SEC_TONE_OFF
;
break
;
case
0
:
fe_tone
=
SEC_TONE_OFF
;
break
;
case
1
:
fe_tone
=
SEC_TONE_ON
;
break
;
case
1
:
fe_tone
=
SEC_TONE_ON
;
break
;
default:
default:
fe_tone
=
SEC_TONE_OFF
;
fe_tone
=
SEC_TONE_OFF
;
msg_Err
(
p_
input
,
"argument has invalid tone mode (%d)"
,
val
.
i_int
);
msg_Err
(
p_
access
,
"argument has invalid tone mode (%d)"
,
val
.
i_int
);
break
;
break
;
}
}
return
fe_tone
;
return
fe_tone
;
}
}
...
@@ -498,59 +473,58 @@ struct diseqc_cmd_t
...
@@ -498,59 +473,58 @@ struct diseqc_cmd_t
uint32_t
wait
;
uint32_t
wait
;
};
};
static
int
DoDiseqc
(
input_thread_t
*
p_input
)
static
int
DoDiseqc
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
vlc_value_t
val
;
vlc_value_t
val
;
int
i_frequency
,
i_lnb_slof
;
int
i_frequency
,
i_lnb_slof
;
fe_sec_voltage_t
fe_voltage
;
fe_sec_voltage_t
fe_voltage
;
fe_sec_tone_mode_t
fe_tone
;
fe_sec_tone_mode_t
fe_tone
;
int
i_err
;
int
i_err
;
var_Get
(
p_
input
,
"dvb-frequency"
,
&
val
);
var_Get
(
p_
access
,
"dvb-frequency"
,
&
val
);
i_frequency
=
val
.
i_int
;
i_frequency
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-lnb-slof"
,
&
val
);
var_Get
(
p_
access
,
"dvb-lnb-slof"
,
&
val
);
i_lnb_slof
=
val
.
i_int
;
i_lnb_slof
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-tone"
,
&
val
);
var_Get
(
p_
access
,
"dvb-tone"
,
&
val
);
if
(
val
.
i_int
==
-
1
/* auto */
)
if
(
val
.
i_int
==
-
1
/* auto */
)
{
{
if
(
i_frequency
>=
i_lnb_slof
)
if
(
i_frequency
>=
i_lnb_slof
)
val
.
i_int
=
1
;
val
.
i_int
=
1
;
else
else
val
.
i_int
=
0
;
val
.
i_int
=
0
;
var_Set
(
p_
input
,
"dvb-tone"
,
val
);
var_Set
(
p_
access
,
"dvb-tone"
,
val
);
}
}
fe_voltage
=
DecodeVoltage
(
p_
input
);
fe_voltage
=
DecodeVoltage
(
p_
access
);
fe_tone
=
DecodeTone
(
p_
input
);
fe_tone
=
DecodeTone
(
p_
access
);
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_VOLTAGE
,
fe_voltage
))
<
0
)
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_VOLTAGE
,
fe_voltage
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_SET_VOLTAGE failed, voltage=%d (%d) %s"
,
msg_Err
(
p_
access
,
"ioctl FE_SET_VOLTAGE failed, voltage=%d (%d) %s"
,
fe_voltage
,
i_err
,
strerror
(
errno
)
);
fe_voltage
,
i_err
,
strerror
(
errno
)
);
return
i_err
;
return
i_err
;
}
}
var_Get
(
p_
input
,
"dvb-satno"
,
&
val
);
var_Get
(
p_
access
,
"dvb-satno"
,
&
val
);
if
(
val
.
i_int
!=
0
)
if
(
val
.
i_int
!=
0
)
{
{
/* digital satellite equipment control,
/* digital satellite equipment control,
* specification is available from http://www.eutelsat.com/
* specification is available from http://www.eutelsat.com/
*/
*/
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_TONE
,
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_TONE
,
SEC_TONE_OFF
))
<
0
)
SEC_TONE_OFF
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_SET_TONE failed, tone=off (%d) %s"
,
msg_Err
(
p_
access
,
"ioctl FE_SET_TONE failed, tone=off (%d) %s"
,
i_err
,
strerror
(
errno
)
);
i_err
,
strerror
(
errno
)
);
return
i_err
;
return
i_err
;
}
}
msleep
(
15000
);
msleep
(
15000
);
if
(
val
.
i_int
>=
1
&&
val
.
i_int
<=
4
)
if
(
val
.
i_int
>=
1
&&
val
.
i_int
<=
4
)
{
{
/* 1.x compatible equipment */
/* 1.x compatible equipment */
struct
diseqc_cmd_t
cmd
=
{
{{
0xe0
,
0x10
,
0x38
,
0xf0
,
0x00
,
0x00
},
4
},
0
};
struct
diseqc_cmd_t
cmd
=
{
{{
0xe0
,
0x10
,
0x38
,
0xf0
,
0x00
,
0x00
},
4
},
0
};
...
@@ -563,10 +537,10 @@ static int DoDiseqc( input_thread_t * p_input )
...
@@ -563,10 +537,10 @@ static int DoDiseqc( input_thread_t * p_input )
|
(
fe_voltage
==
SEC_VOLTAGE_13
?
0
:
2
)
|
(
fe_voltage
==
SEC_VOLTAGE_13
?
0
:
2
)
|
(
fe_tone
==
SEC_TONE_ON
?
1
:
0
);
|
(
fe_tone
==
SEC_TONE_ON
?
1
:
0
);
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_DISEQC_SEND_MASTER_CMD
,
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_DISEQC_SEND_MASTER_CMD
,
&
cmd
.
cmd
))
<
0
)
&
cmd
.
cmd
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_SEND_MASTER_CMD failed (%d) %s"
,
msg_Err
(
p_
access
,
"ioctl FE_SEND_MASTER_CMD failed (%d) %s"
,
i_err
,
strerror
(
errno
)
);
i_err
,
strerror
(
errno
)
);
return
i_err
;
return
i_err
;
}
}
...
@@ -576,10 +550,10 @@ static int DoDiseqc( input_thread_t * p_input )
...
@@ -576,10 +550,10 @@ static int DoDiseqc( input_thread_t * p_input )
else
else
{
{
/* A or B simple diseqc */
/* A or B simple diseqc */
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_DISEQC_SEND_BURST
,
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_DISEQC_SEND_BURST
,
val
.
i_int
==
-
1
?
SEC_MINI_A
:
SEC_MINI_B
))
<
0
)
val
.
i_int
==
-
1
?
SEC_MINI_A
:
SEC_MINI_B
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_SEND_BURST failed (%d) %s"
,
msg_Err
(
p_
access
,
"ioctl FE_SEND_BURST failed (%d) %s"
,
i_err
,
strerror
(
errno
)
);
i_err
,
strerror
(
errno
)
);
return
i_err
;
return
i_err
;
}
}
...
@@ -588,9 +562,9 @@ static int DoDiseqc( input_thread_t * p_input )
...
@@ -588,9 +562,9 @@ static int DoDiseqc( input_thread_t * p_input )
msleep
(
15000
);
msleep
(
15000
);
}
}
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_TONE
,
fe_tone
))
<
0
)
if
(
(
i_err
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_TONE
,
fe_tone
))
<
0
)
{
{
msg_Err
(
p_
input
,
"ioctl FE_SET_TONE failed, tone=%s (%d) %s"
,
msg_Err
(
p_
access
,
"ioctl FE_SET_TONE failed, tone=%s (%d) %s"
,
fe_tone
==
SEC_TONE_ON
?
"on"
:
"off"
,
i_err
,
fe_tone
==
SEC_TONE_ON
?
"on"
:
"off"
,
i_err
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
i_err
;
return
i_err
;
...
@@ -600,164 +574,161 @@ static int DoDiseqc( input_thread_t * p_input )
...
@@ -600,164 +574,161 @@ static int DoDiseqc( input_thread_t * p_input )
return
0
;
return
0
;
}
}
static
int
FrontendSetQPSK
(
input_thread_t
*
p_input
)
static
int
FrontendSetQPSK
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
struct
dvb_frontend_parameters
fep
;
struct
dvb_frontend_parameters
fep
;
int
i_ret
;
int
i_ret
;
vlc_value_t
val
;
vlc_value_t
val
;
int
i_frequency
,
i_lnb_slof
;
int
i_frequency
,
i_lnb_slof
;
/* Prepare the fep structure */
/* Prepare the fep structure */
var_Get
(
p_access
,
"dvb-frequency"
,
&
val
);
var_Get
(
p_input
,
"dvb-frequency"
,
&
val
);
i_frequency
=
val
.
i_int
;
i_frequency
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-lnb-slof"
,
&
val
);
var_Get
(
p_
access
,
"dvb-lnb-slof"
,
&
val
);
i_lnb_slof
=
val
.
i_int
;
i_lnb_slof
=
val
.
i_int
;
if
(
i_frequency
>=
i_lnb_slof
)
if
(
i_frequency
>=
i_lnb_slof
)
var_Get
(
p_
input
,
"dvb-lnb-lof2"
,
&
val
);
var_Get
(
p_
access
,
"dvb-lnb-lof2"
,
&
val
);
else
else
var_Get
(
p_
input
,
"dvb-lnb-lof1"
,
&
val
);
var_Get
(
p_
access
,
"dvb-lnb-lof1"
,
&
val
);
fep
.
frequency
=
i_frequency
-
val
.
i_int
;
fep
.
frequency
=
i_frequency
-
val
.
i_int
;
fep
.
inversion
=
DecodeInversion
(
p_
input
);
fep
.
inversion
=
DecodeInversion
(
p_
access
);
var_Get
(
p_
input
,
"dvb-srate"
,
&
val
);
var_Get
(
p_
access
,
"dvb-srate"
,
&
val
);
fep
.
u
.
qpsk
.
symbol_rate
=
val
.
i_int
;
fep
.
u
.
qpsk
.
symbol_rate
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-fec"
,
&
val
);
var_Get
(
p_
access
,
"dvb-fec"
,
&
val
);
fep
.
u
.
qpsk
.
fec_inner
=
DecodeFEC
(
p_
input
,
val
.
i_int
);
fep
.
u
.
qpsk
.
fec_inner
=
DecodeFEC
(
p_
access
,
val
.
i_int
);
if
(
DoDiseqc
(
p_input
)
<
0
)
if
(
DoDiseqc
(
p_access
)
<
0
)
{
{
return
-
1
;
return
VLC_EGENERIC
;
}
}
msleep
(
100000
);
msleep
(
100000
);
/* Empty the event queue */
/* Empty the event queue */
for
(
;
;
)
for
(
;
;
)
{
{
struct
dvb_frontend_event
event
;
struct
dvb_frontend_event
event
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
break
;
break
;
}
}
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-S: setting frontend failed (%d) %s"
,
i_ret
,
msg_Err
(
p_
access
,
"DVB-S: setting frontend failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
return
FrontendCheck
(
p_
input
);
return
FrontendCheck
(
p_
access
);
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendSetQAM : controls the FE device
* FrontendSetQAM : controls the FE device
*****************************************************************************/
*****************************************************************************/
static
int
FrontendSetQAM
(
input_thread_t
*
p_input
)
static
int
FrontendSetQAM
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
struct
dvb_frontend_parameters
fep
;
struct
dvb_frontend_parameters
fep
;
vlc_value_t
val
;
vlc_value_t
val
;
int
i_ret
;
int
i_ret
;
/* Prepare the fep structure */
/* Prepare the fep structure */
var_Get
(
p_
input
,
"dvb-frequency"
,
&
val
);
var_Get
(
p_
access
,
"dvb-frequency"
,
&
val
);
fep
.
frequency
=
val
.
i_int
;
fep
.
frequency
=
val
.
i_int
;
fep
.
inversion
=
DecodeInversion
(
p_
input
);
fep
.
inversion
=
DecodeInversion
(
p_
access
);
var_Get
(
p_
input
,
"dvb-srate"
,
&
val
);
var_Get
(
p_
access
,
"dvb-srate"
,
&
val
);
fep
.
u
.
qam
.
symbol_rate
=
val
.
i_int
;
fep
.
u
.
qam
.
symbol_rate
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-fec"
,
&
val
);
var_Get
(
p_
access
,
"dvb-fec"
,
&
val
);
fep
.
u
.
qam
.
fec_inner
=
DecodeFEC
(
p_
input
,
val
.
i_int
);
fep
.
u
.
qam
.
fec_inner
=
DecodeFEC
(
p_
access
,
val
.
i_int
);
fep
.
u
.
qam
.
modulation
=
DecodeModulation
(
p_
input
);
fep
.
u
.
qam
.
modulation
=
DecodeModulation
(
p_
access
);
/* Empty the event queue */
/* Empty the event queue */
for
(
;
;
)
for
(
;
;
)
{
{
struct
dvb_frontend_event
event
;
struct
dvb_frontend_event
event
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
break
;
break
;
}
}
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-C: setting frontend failed (%d) %s"
,
i_ret
,
msg_Err
(
p_
access
,
"DVB-C: setting frontend failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
return
FrontendCheck
(
p_
input
);
return
FrontendCheck
(
p_
access
);
}
}
/*****************************************************************************
/*****************************************************************************
* FrontendSetOFDM : controls the FE device
* FrontendSetOFDM : controls the FE device
*****************************************************************************/
*****************************************************************************/
static
fe_bandwidth_t
DecodeBandwidth
(
input_thread_t
*
p_input
)
static
fe_bandwidth_t
DecodeBandwidth
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_bandwidth_t
fe_bandwidth
=
0
;
fe_bandwidth_t
fe_bandwidth
=
0
;
var_Get
(
p_
input
,
"dvb-bandwidth"
,
&
val
);
var_Get
(
p_
access
,
"dvb-bandwidth"
,
&
val
);
msg_Dbg
(
p_
input
,
"using bandwidth=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using bandwidth=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_bandwidth
=
BANDWIDTH_AUTO
;
break
;
case
0
:
fe_bandwidth
=
BANDWIDTH_AUTO
;
break
;
case
6
:
fe_bandwidth
=
BANDWIDTH_6_MHZ
;
break
;
case
6
:
fe_bandwidth
=
BANDWIDTH_6_MHZ
;
break
;
case
7
:
fe_bandwidth
=
BANDWIDTH_7_MHZ
;
break
;
case
7
:
fe_bandwidth
=
BANDWIDTH_7_MHZ
;
break
;
case
8
:
fe_bandwidth
=
BANDWIDTH_8_MHZ
;
break
;
case
8
:
fe_bandwidth
=
BANDWIDTH_8_MHZ
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"terrestrial dvb has bandwidth not set, using auto"
);
msg_Dbg
(
p_
access
,
"terrestrial dvb has bandwidth not set, using auto"
);
fe_bandwidth
=
BANDWIDTH_AUTO
;
fe_bandwidth
=
BANDWIDTH_AUTO
;
break
;
break
;
}
}
return
fe_bandwidth
;
return
fe_bandwidth
;
}
}
static
fe_transmit_mode_t
DecodeTransmission
(
input_thread_t
*
p_input
)
static
fe_transmit_mode_t
DecodeTransmission
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_transmit_mode_t
fe_transmission
=
0
;
fe_transmit_mode_t
fe_transmission
=
0
;
var_Get
(
p_
input
,
"dvb-transmission"
,
&
val
);
var_Get
(
p_
access
,
"dvb-transmission"
,
&
val
);
msg_Dbg
(
p_
input
,
"using transmission=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using transmission=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_transmission
=
TRANSMISSION_MODE_AUTO
;
break
;
case
0
:
fe_transmission
=
TRANSMISSION_MODE_AUTO
;
break
;
case
2
:
fe_transmission
=
TRANSMISSION_MODE_2K
;
break
;
case
2
:
fe_transmission
=
TRANSMISSION_MODE_2K
;
break
;
case
8
:
fe_transmission
=
TRANSMISSION_MODE_8K
;
break
;
case
8
:
fe_transmission
=
TRANSMISSION_MODE_8K
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"terrestrial dvb has transmission mode not set, using auto"
);
msg_Dbg
(
p_
access
,
"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
;
}
}
static
fe_guard_interval_t
DecodeGuardInterval
(
input_thread_t
*
p_input
)
static
fe_guard_interval_t
DecodeGuardInterval
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_guard_interval_t
fe_guard
=
0
;
fe_guard_interval_t
fe_guard
=
0
;
var_Get
(
p_
input
,
"dvb-guard"
,
&
val
);
var_Get
(
p_
access
,
"dvb-guard"
,
&
val
);
msg_Dbg
(
p_
input
,
"using guard=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using guard=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
0
:
fe_guard
=
GUARD_INTERVAL_AUTO
;
break
;
case
0
:
fe_guard
=
GUARD_INTERVAL_AUTO
;
break
;
case
4
:
fe_guard
=
GUARD_INTERVAL_1_4
;
break
;
case
4
:
fe_guard
=
GUARD_INTERVAL_1_4
;
break
;
...
@@ -765,22 +736,22 @@ static fe_guard_interval_t DecodeGuardInterval( input_thread_t * p_input )
...
@@ -765,22 +736,22 @@ static fe_guard_interval_t DecodeGuardInterval( input_thread_t * p_input )
case
16
:
fe_guard
=
GUARD_INTERVAL_1_16
;
break
;
case
16
:
fe_guard
=
GUARD_INTERVAL_1_16
;
break
;
case
32
:
fe_guard
=
GUARD_INTERVAL_1_32
;
break
;
case
32
:
fe_guard
=
GUARD_INTERVAL_1_32
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"terrestrial dvb has guard interval not set, using auto"
);
msg_Dbg
(
p_
access
,
"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
;
}
}
static
fe_hierarchy_t
DecodeHierarchy
(
input_thread_t
*
p_input
)
static
fe_hierarchy_t
DecodeHierarchy
(
access_t
*
p_access
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
fe_hierarchy_t
fe_hierarchy
=
0
;
fe_hierarchy_t
fe_hierarchy
=
0
;
var_Get
(
p_
input
,
"dvb-hierarchy"
,
&
val
);
var_Get
(
p_
access
,
"dvb-hierarchy"
,
&
val
);
msg_Dbg
(
p_
input
,
"using hierarchy=%d"
,
val
.
i_int
);
msg_Dbg
(
p_
access
,
"using hierarchy=%d"
,
val
.
i_int
);
switch
(
val
.
i_int
)
switch
(
val
.
i_int
)
{
{
case
-
1
:
fe_hierarchy
=
HIERARCHY_NONE
;
break
;
case
-
1
:
fe_hierarchy
=
HIERARCHY_NONE
;
break
;
case
0
:
fe_hierarchy
=
HIERARCHY_AUTO
;
break
;
case
0
:
fe_hierarchy
=
HIERARCHY_AUTO
;
break
;
...
@@ -788,125 +759,123 @@ static fe_hierarchy_t DecodeHierarchy( input_thread_t * p_input )
...
@@ -788,125 +759,123 @@ static fe_hierarchy_t DecodeHierarchy( input_thread_t * p_input )
case
2
:
fe_hierarchy
=
HIERARCHY_2
;
break
;
case
2
:
fe_hierarchy
=
HIERARCHY_2
;
break
;
case
4
:
fe_hierarchy
=
HIERARCHY_4
;
break
;
case
4
:
fe_hierarchy
=
HIERARCHY_4
;
break
;
default:
default:
msg_Dbg
(
p_
input
,
"terrestrial dvb has hierarchy not set, using auto"
);
msg_Dbg
(
p_
access
,
"terrestrial dvb has hierarchy not set, using auto"
);
fe_hierarchy
=
HIERARCHY_AUTO
;
fe_hierarchy
=
HIERARCHY_AUTO
;
break
;
break
;
}
}
return
fe_hierarchy
;
return
fe_hierarchy
;
}
}
static
int
FrontendSetOFDM
(
input_thread_t
*
p_input
)
static
int
FrontendSetOFDM
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
struct
dvb_frontend_parameters
fep
;
struct
dvb_frontend_parameters
fep
;
vlc_value_t
val
;
vlc_value_t
val
;
int
ret
;
int
ret
;
/* Prepare the fep structure */
/* Prepare the fep structure */
var_Get
(
p_
input
,
"dvb-frequency"
,
&
val
);
var_Get
(
p_
access
,
"dvb-frequency"
,
&
val
);
fep
.
frequency
=
val
.
i_int
;
fep
.
frequency
=
val
.
i_int
;
fep
.
inversion
=
DecodeInversion
(
p_
input
);
fep
.
inversion
=
DecodeInversion
(
p_
access
);
fep
.
u
.
ofdm
.
bandwidth
=
DecodeBandwidth
(
p_
input
);
fep
.
u
.
ofdm
.
bandwidth
=
DecodeBandwidth
(
p_
access
);
var_Get
(
p_
input
,
"dvb-code-rate-hp"
,
&
val
);
var_Get
(
p_
access
,
"dvb-code-rate-hp"
,
&
val
);
fep
.
u
.
ofdm
.
code_rate_HP
=
DecodeFEC
(
p_
input
,
val
.
i_int
);
fep
.
u
.
ofdm
.
code_rate_HP
=
DecodeFEC
(
p_
access
,
val
.
i_int
);
var_Get
(
p_
input
,
"dvb-code-rate-lp"
,
&
val
);
var_Get
(
p_
access
,
"dvb-code-rate-lp"
,
&
val
);
fep
.
u
.
ofdm
.
code_rate_LP
=
DecodeFEC
(
p_
input
,
val
.
i_int
);
fep
.
u
.
ofdm
.
code_rate_LP
=
DecodeFEC
(
p_
access
,
val
.
i_int
);
fep
.
u
.
ofdm
.
constellation
=
DecodeModulation
(
p_
input
);
fep
.
u
.
ofdm
.
constellation
=
DecodeModulation
(
p_
access
);
fep
.
u
.
ofdm
.
transmission_mode
=
DecodeTransmission
(
p_
input
);
fep
.
u
.
ofdm
.
transmission_mode
=
DecodeTransmission
(
p_
access
);
fep
.
u
.
ofdm
.
guard_interval
=
DecodeGuardInterval
(
p_
input
);
fep
.
u
.
ofdm
.
guard_interval
=
DecodeGuardInterval
(
p_
access
);
fep
.
u
.
ofdm
.
hierarchy_information
=
DecodeHierarchy
(
p_
input
);
fep
.
u
.
ofdm
.
hierarchy_information
=
DecodeHierarchy
(
p_
access
);
/* Empty the event queue */
/* Empty the event queue */
for
(
;
;
)
for
(
;
;
)
{
{
struct
dvb_frontend_event
event
;
struct
dvb_frontend_event
event
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_GET_EVENT
,
&
event
)
<
0
)
break
;
break
;
}
}
/* Now send it all to the frontend device */
/* Now send it all to the frontend device */
if
(
(
ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
if
(
(
ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_SET_FRONTEND
,
&
fep
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DVB-T: setting frontend failed (%d) %s"
,
ret
,
msg_Err
(
p_
access
,
"DVB-T: setting frontend failed (%d) %s"
,
ret
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
-
1
;
}
}
return
FrontendCheck
(
p_
input
);
return
FrontendCheck
(
p_
access
);
}
}
/******************************************************************
/******************************************************************
* FrontendCheck: Check completion of the frontend control sequence
* FrontendCheck: Check completion of the frontend control sequence
******************************************************************/
******************************************************************/
static
int
FrontendCheck
(
input_thread_t
*
p_input
)
static
int
FrontendCheck
(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
frontend_t
*
p_frontend
=
p_sys
->
p_frontend
;
frontend_t
*
p_frontend
=
(
frontend_t
*
)
p_dvb
->
p_frontend
;
int
i_ret
;
int
i_ret
;
while
(
!
p_
input
->
b_die
&&
!
p_input
->
b_error
)
while
(
!
p_
access
->
b_die
&&
!
p_access
->
b_error
)
{
{
fe_status_t
status
;
fe_status_t
status
;
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_READ_STATUS
,
if
(
(
i_ret
=
ioctl
(
p_frontend
->
i_handle
,
FE_READ_STATUS
,
&
status
))
<
0
)
&
status
))
<
0
)
{
{
msg_Err
(
p_
input
,
"reading frontend status failed (%d) %s"
,
msg_Err
(
p_
access
,
"reading frontend status failed (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
i_ret
,
strerror
(
errno
)
);
return
i_ret
;
return
i_ret
;
}
}
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_
access
,
"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_
access
,
"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 forward error correction"
);
msg_Dbg
(
p_
access
,
"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_
access
,
"check frontend ... has sync"
);
if
(
status
&
FE_HAS_LOCK
)
/* everything's working... */
if
(
status
&
FE_HAS_LOCK
)
/* everything's working... */
{
{
int32_t
value
;
int32_t
value
;
msg_Dbg
(
p_
input
,
"check frontend ... has lock"
);
msg_Dbg
(
p_
access
,
"check frontend ... has lock"
);
msg_Dbg
(
p_
input
,
"tuning succeeded"
);
msg_Dbg
(
p_
access
,
"tuning succeeded"
);
/* Read some statistics */
/* Read some statistics */
value
=
0
;
value
=
0
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_BER
,
&
value
)
>=
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_BER
,
&
value
)
>=
0
)
msg_Dbg
(
p_
input
,
"Bit error rate: %d"
,
value
);
msg_Dbg
(
p_
access
,
"Bit error rate: %d"
,
value
);
value
=
0
;
value
=
0
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_SIGNAL_STRENGTH
,
&
value
)
>=
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_SIGNAL_STRENGTH
,
&
value
)
>=
0
)
msg_Dbg
(
p_
input
,
"Signal strength: %d"
,
value
);
msg_Dbg
(
p_
access
,
"Signal strength: %d"
,
value
);
value
=
0
;
value
=
0
;
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_SNR
,
&
value
)
>=
0
)
if
(
ioctl
(
p_frontend
->
i_handle
,
FE_READ_SNR
,
&
value
)
>=
0
)
msg_Dbg
(
p_
input
,
"SNR: %d"
,
value
);
msg_Dbg
(
p_
access
,
"SNR: %d"
,
value
);
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_Err
(
p_
input
,
"tuning failed ... timed out"
);
msg_Err
(
p_
access
,
"tuning failed ... timed out"
);
return
-
2
;
return
-
2
;
}
}
if
(
status
&
FE_REINIT
)
if
(
status
&
FE_REINIT
)
{
{
/* frontend was reinitialized, */
/* frontend was reinitialized, */
/* application is recommended to reset */
/* application is recommended to reset */
/* DiSEqC, tone and parameters */
/* DiSEqC, tone and parameters */
msg_Err
(
p_
input
,
"tuning failed ... resend frontend parameters"
);
msg_Err
(
p_
access
,
"tuning failed ... resend frontend parameters"
);
return
-
3
;
return
-
3
;
}
}
...
@@ -923,8 +892,7 @@ static int FrontendCheck( input_thread_t * p_input )
...
@@ -923,8 +892,7 @@ static int FrontendCheck( input_thread_t * p_input )
/*****************************************************************************
/*****************************************************************************
* DMXSetFilter : controls the demux to add a filter
* DMXSetFilter : controls the demux to add a filter
*****************************************************************************/
*****************************************************************************/
int
E_
(
DMXSetFilter
)(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
E_
(
DMXSetFilter
)(
access_t
*
p_access
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
)
int
i_type
)
{
{
struct
dmx_pes_filter_params
s_filter_params
;
struct
dmx_pes_filter_params
s_filter_params
;
int
i_ret
;
int
i_ret
;
...
@@ -932,24 +900,24 @@ int E_(DMXSetFilter)( input_thread_t * p_input, int i_pid, int * pi_fd,
...
@@ -932,24 +900,24 @@ int E_(DMXSetFilter)( input_thread_t * p_input, int i_pid, int * pi_fd,
char
dmx
[
128
];
char
dmx
[
128
];
vlc_value_t
val
;
vlc_value_t
val
;
var_Get
(
p_
input
,
"dvb-adapter"
,
&
val
);
var_Get
(
p_
access
,
"dvb-adapter"
,
&
val
);
i_adapter
=
val
.
i_int
;
i_adapter
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-device"
,
&
val
);
var_Get
(
p_
access
,
"dvb-device"
,
&
val
);
i_device
=
val
.
i_int
;
i_device
=
val
.
i_int
;
if
(
snprintf
(
dmx
,
sizeof
(
dmx
),
DMX
,
i_adapter
,
i_device
)
if
(
snprintf
(
dmx
,
sizeof
(
dmx
),
DMX
,
i_adapter
,
i_device
)
>=
(
int
)
sizeof
(
dmx
)
)
>=
(
int
)
sizeof
(
dmx
)
)
{
{
msg_Err
(
p_
input
,
"snprintf() truncated string for DMX"
);
msg_Err
(
p_
access
,
"snprintf() truncated string for DMX"
);
dmx
[
sizeof
(
dmx
)
-
1
]
=
'\0'
;
dmx
[
sizeof
(
dmx
)
-
1
]
=
'\0'
;
}
}
msg_Dbg
(
p_
input
,
"Opening device %s"
,
dmx
);
msg_Dbg
(
p_
access
,
"Opening device %s"
,
dmx
);
if
(
(
*
pi_fd
=
open
(
dmx
,
O_RDWR
))
<
0
)
if
(
(
*
pi_fd
=
open
(
dmx
,
O_RDWR
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DMXSetFilter: opening device failed (%s)"
,
msg_Err
(
p_
access
,
"DMXSetFilter: opening device failed (%s)"
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
/* We fill the DEMUX structure : */
/* We fill the DEMUX structure : */
...
@@ -961,123 +929,123 @@ int E_(DMXSetFilter)( input_thread_t * p_input, int i_pid, int * pi_fd,
...
@@ -961,123 +929,123 @@ int E_(DMXSetFilter)( input_thread_t * p_input, int i_pid, int * pi_fd,
switch
(
i_type
)
switch
(
i_type
)
{
/* First device */
{
/* First device */
case
1
:
case
1
:
msg_Dbg
(
p_
input
,
"DMXSetFilter: DMX_PES_VIDEO0 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_VIDEO0 for PID %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
,
"DMXSetFilter: DMX_PES_AUDIO0 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_AUDIO0 for PID %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
,
"DMXSetFilter: DMX_PES_TELETEXT0 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_TELETEXT0 for PID %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
,
"DMXSetFilter: DMX_PES_SUBTITLE0 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_SUBTITLE0 for PID %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
,
"DMXSetFilter: DMX_PES_PCR0 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_PCR0 for PID %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
,
"DMXSetFilter: DMX_PES_VIDEO1 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_VIDEO1 for PID %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
,
"DMXSetFilter: DMX_PES_AUDIO1 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_AUDIO1 for PID %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
,
"DMXSetFilter: DMX_PES_TELETEXT1 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_TELETEXT1 for PID %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
,
"DMXSetFilter: DMX_PES_SUBTITLE1 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_SUBTITLE1 for PID %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
,
"DMXSetFilter: DMX_PES_PCR1 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_PCR1 for PID %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
,
"DMXSetFilter: DMX_PES_VIDEO2 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_VIDEO2 for PID %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
,
"DMXSetFilter: DMX_PES_AUDIO2 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_AUDIO2 for PID %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
,
"DMXSetFilter: DMX_PES_TELETEXT2 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_TELETEXT2 for PID %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
,
"DMXSetFilter: DMX_PES_SUBTITLE2 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_SUBTITLE2 for PID %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
,
"DMXSetFilter: DMX_PES_PCR2 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_PCR2 for PID %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
,
"DMXSetFilter: DMX_PES_VIDEO3 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_VIDEO3 for PID %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
,
"DMXSetFilter: DMX_PES_AUDIO3 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_AUDIO3 for PID %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
,
"DMXSetFilter: DMX_PES_TELETEXT3 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_TELETEXT3 for PID %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
,
"DMXSetFilter: DMX_PES_SUBTITLE3 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_SUBTITLE3 for PID %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
,
"DMXSetFilter: DMX_PES_PCR3 for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_PCR3 for PID %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
:
default:
default:
msg_Dbg
(
p_
input
,
"DMXSetFilter: DMX_PES_OTHER for PID %d"
,
i_pid
);
msg_Dbg
(
p_
access
,
"DMXSetFilter: DMX_PES_OTHER for PID %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_OTHER
;
s_filter_params
.
pes_type
=
DMX_PES_OTHER
;
break
;
break
;
}
}
/* We then give the order to the device : */
/* We then give the order to the device : */
if
(
(
i_ret
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
))
<
0
)
if
(
(
i_ret
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DMXSetFilter: failed with %d (%s)"
,
i_ret
,
msg_Err
(
p_
access
,
"DMXSetFilter: failed with %d (%s)"
,
i_ret
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
return
0
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* DMXUnsetFilter : removes a filter
* DMXUnsetFilter : removes a filter
*****************************************************************************/
*****************************************************************************/
int
E_
(
DMXUnsetFilter
)(
input_thread_t
*
p_input
,
int
i_fd
)
int
E_
(
DMXUnsetFilter
)(
access_t
*
p_access
,
int
i_fd
)
{
{
int
i_ret
;
int
i_ret
;
if
(
(
i_ret
=
ioctl
(
i_fd
,
DMX_STOP
))
<
0
)
if
(
(
i_ret
=
ioctl
(
i_fd
,
DMX_STOP
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DMX_STOP failed for demux (%d) %s"
,
msg_Err
(
p_
access
,
"DMX_STOP failed for demux (%d) %s"
,
i_ret
,
strerror
(
errno
)
);
i_ret
,
strerror
(
errno
)
);
return
i_ret
;
return
i_ret
;
}
}
msg_Dbg
(
p_
input
,
"DMXUnsetFilter: closing demux %d"
,
i_fd
);
msg_Dbg
(
p_
access
,
"DMXUnsetFilter: closing demux %d"
,
i_fd
);
close
(
i_fd
);
close
(
i_fd
);
return
0
;
return
VLC_SUCCESS
;
}
}
...
@@ -1088,45 +1056,43 @@ int E_(DMXUnsetFilter)( input_thread_t * p_input, int i_fd )
...
@@ -1088,45 +1056,43 @@ int E_(DMXUnsetFilter)( input_thread_t * p_input, int i_fd )
/*****************************************************************************
/*****************************************************************************
* DVROpen :
* DVROpen :
*****************************************************************************/
*****************************************************************************/
int
E_
(
DVROpen
)(
input_thread_t
*
p_input
)
int
E_
(
DVROpen
)(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
unsigned
int
i_adapter
,
i_device
;
unsigned
int
i_adapter
,
i_device
;
char
dvr
[
128
];
char
dvr
[
128
];
vlc_value_t
val
;
vlc_value_t
val
;
var_Get
(
p_
input
,
"dvb-adapter"
,
&
val
);
var_Get
(
p_
access
,
"dvb-adapter"
,
&
val
);
i_adapter
=
val
.
i_int
;
i_adapter
=
val
.
i_int
;
var_Get
(
p_
input
,
"dvb-device"
,
&
val
);
var_Get
(
p_
access
,
"dvb-device"
,
&
val
);
i_device
=
val
.
i_int
;
i_device
=
val
.
i_int
;
if
(
snprintf
(
dvr
,
sizeof
(
dvr
),
DVR
,
i_adapter
,
i_device
)
if
(
snprintf
(
dvr
,
sizeof
(
dvr
),
DVR
,
i_adapter
,
i_device
)
>=
(
int
)
sizeof
(
dvr
)
)
>=
(
int
)
sizeof
(
dvr
)
)
{
{
msg_Err
(
p_
input
,
"snprintf() truncated string for DVR"
);
msg_Err
(
p_
access
,
"snprintf() truncated string for DVR"
);
dvr
[
sizeof
(
dvr
)
-
1
]
=
'\0'
;
dvr
[
sizeof
(
dvr
)
-
1
]
=
'\0'
;
}
}
msg_Dbg
(
p_
input
,
"Opening device %s"
,
dvr
);
msg_Dbg
(
p_
access
,
"Opening device %s"
,
dvr
);
if
(
(
p_dvb
->
i_handle
=
open
(
dvr
,
O_RDONLY
))
<
0
)
if
(
(
p_sys
->
i_handle
=
open
(
dvr
,
O_RDONLY
))
<
0
)
{
{
msg_Err
(
p_
input
,
"DVROpen: opening device failed (%s)"
,
msg_Err
(
p_
access
,
"DVROpen: opening device failed (%s)"
,
strerror
(
errno
)
);
strerror
(
errno
)
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
return
0
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* DVRClose :
* DVRClose :
*****************************************************************************/
*****************************************************************************/
void
E_
(
DVRClose
)(
input_thread_t
*
p_input
)
void
E_
(
DVRClose
)(
access_t
*
p_access
)
{
{
thread_dvb_data_t
*
p_dvb
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
=
(
thread_dvb_data_t
*
)
p_input
->
p_access_data
;
close
(
p_
dvb
->
i_handle
);
close
(
p_
sys
->
i_handle
);
}
}
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