Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
a875b83c
Commit
a875b83c
authored
Aug 04, 2003
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tuning succeeds, but have no audio yet. Major cleanup of code.
parent
f853698b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
305 additions
and
210 deletions
+305
-210
modules/access/dvb/access.c
modules/access/dvb/access.c
+44
-52
modules/access/dvb/dvb.c
modules/access/dvb/dvb.c
+252
-144
modules/access/dvb/dvb.h
modules/access/dvb/dvb.h
+6
-10
modules/access/dvb/qpsk.c
modules/access/dvb/qpsk.c
+3
-4
No files found.
modules/access/dvb/access.c
View file @
a875b83c
...
...
@@ -5,7 +5,6 @@
*
* Authors: Johan Bilien <jobi@via.ecp.fr>
* Jean-Paul Saman <saman@natlab.research.philips.com>
* Christopher Ross <ross@natlab.research.philips.com>
*
* 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
...
...
@@ -40,8 +39,11 @@
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_ERRNO_H
# include <string.h>
# include <errno.h>
#endif
#ifdef STRNCASECMP_IN_STRINGS_H
# include <strings.h>
...
...
@@ -84,7 +86,7 @@ int E_(Open) ( vlc_object_t *p_this )
int
i_fec
=
0
;
fe_code_rate_t
fe_fec
=
FEC_NONE
;
vlc_bool_t
b_diseqc
;
vlc_bool_t
b_
no_
probe
;
vlc_bool_t
b_probe
;
int
i_lnb_lof1
;
int
i_lnb_lof2
;
int
i_lnb_slof
;
...
...
@@ -100,20 +102,15 @@ int E_(Open) ( vlc_object_t *p_this )
return
(
-
1
);
}
p_input
->
pf_read
=
SatelliteRead
;
p_input
->
pf_set_program
=
SatelliteSetProgram
;
p_input
->
pf_set_area
=
SatelliteSetArea
;
p_input
->
pf_seek
=
SatelliteSeek
;
// Get adapter and device number to use for this dvb card
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
/* Determine frontend device information and capabilities */
b_
no_probe
=
config_GetInt
(
p_input
,
"no-
probe"
);
if
(
!
b_no
_probe
)
b_
probe
=
config_GetInt
(
p_input
,
"
probe"
);
if
(
b
_probe
)
{
if
(
ioctl_InfoFrontend
(
&
frontend_info
,
u_adapter
,
u_device
)
<
0
)
if
(
ioctl_InfoFrontend
(
p_input
,
&
frontend_info
,
u_adapter
,
u_device
)
<
0
)
{
msg_Err
(
p_input
,
"(access) cannot determine frontend info"
);
return
-
1
;
...
...
@@ -128,14 +125,14 @@ int E_(Open) ( vlc_object_t *p_this )
{
int
i_len
;
msg_Dbg
(
p_input
,
"
U
sing default values for frontend info"
);
msg_Dbg
(
p_input
,
"
u
sing default values for frontend info"
);
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
printf
(
"error:
snprintf() truncated string for FRONTEND"
);
msg_Err
(
p_input
,
"
snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
frontend_info
.
name
=
frontend
;
strncpy
(
frontend_info
.
name
,
frontend
,
128
)
;
frontend_info
.
type
=
FE_QPSK
;
frontend_info
.
frequency_max
=
12999
;
frontend_info
.
frequency_min
=
10000
;
...
...
@@ -144,7 +141,13 @@ int E_(Open) ( vlc_object_t *p_this )
/* b_polarisation */
}
u_freq
=
(
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
/* Register Callback functions */
p_input
->
pf_read
=
SatelliteRead
;
p_input
->
pf_set_program
=
SatelliteSetProgram
;
p_input
->
pf_set_area
=
SatelliteSetArea
;
p_input
->
pf_seek
=
SatelliteSeek
;
u_freq
=
(
unsigned
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
if
(
*
psz_next
)
{
psz_parser
=
psz_next
+
1
;
...
...
@@ -156,7 +159,7 @@ int E_(Open) ( vlc_object_t *p_this )
if
(
*
psz_next
)
{
psz_parser
=
psz_next
+
1
;
u_srate
=
(
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
u_srate
=
(
unsigned
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
}
}
}
...
...
@@ -187,7 +190,7 @@ int E_(Open) ( vlc_object_t *p_this )
}
}
if
(
b_polarisation
&&
b_polarisation
!=
1
)
if
(
b_polarisation
&&
(
b_polarisation
!=
1
)
)
{
msg_Warn
(
p_input
,
"invalid polarization, using default one"
);
b_polarisation
=
config_GetInt
(
p_input
,
"polarization"
);
...
...
@@ -198,11 +201,11 @@ int E_(Open) ( vlc_object_t *p_this )
}
}
if
(
(
i_fec
>
7
)
||
(
i_fec
<
1
)
)
if
(
(
i_fec
>
9
)
||
(
i_fec
<
1
)
)
{
msg_Warn
(
p_input
,
"invalid FEC, using default one"
);
i_fec
=
config_GetInt
(
p_input
,
"fec"
);
if
(
(
i_fec
>
7
)
||
(
i_fec
<
1
)
)
if
(
(
i_fec
>
9
)
||
(
i_fec
<
1
)
)
{
msg_Err
(
p_input
,
"invalid default FEC"
);
return
-
1
;
...
...
@@ -241,6 +244,7 @@ int E_(Open) ( vlc_object_t *p_this )
default:
/* cannot happen */
fe_fec
=
FEC_NONE
;
msg_Err
(
p_input
,
"invalid FEC (unknown)"
);
break
;
}
...
...
@@ -279,7 +283,7 @@ int E_(Open) ( vlc_object_t *p_this )
i_len
=
sizeof
(
DVR
);
if
(
snprintf
(
dvr
,
sizeof
(
DVR
),
DVR
,
u_adapter
,
u_device
)
>=
i_len
)
{
msg_Err
(
p_input
,
"
error:
snprintf() truncated string for DVR"
);
msg_Err
(
p_input
,
"snprintf() truncated string for DVR"
);
dvr
[
sizeof
(
DVR
)]
=
'\0'
;
}
msg_Dbg
(
p_input
,
"opening DVR device '%s'"
,
dvr
);
...
...
@@ -287,7 +291,11 @@ int E_(Open) ( vlc_object_t *p_this )
if
(
(
p_satellite
->
i_handle
=
open
(
dvr
,
/*O_NONBLOCK | O_LARGEFILE*/
0
))
==
(
-
1
)
)
{
# ifdef HAVE_ERRNO_H
msg_Warn
(
p_input
,
"cannot open `%s' (%s)"
,
dvr
,
strerror
(
errno
)
);
# else
msg_Warn
(
p_input
,
"cannot open `%s'"
,
dvr
);
# endif
free
(
p_satellite
);
return
-
1
;
}
...
...
@@ -299,13 +307,10 @@ int E_(Open) ( vlc_object_t *p_this )
i_lnb_slof
=
config_GetInt
(
p_input
,
"lnb-slof"
);
/* Initialize the Satellite Card */
msg_Dbg
(
p_input
,
"initializing Sat Card with Freq: %
d
, Pol: %d, "
"FEC: %d, Srate: %
d
"
,
u_freq
,
b_polarisation
,
fe_fec
,
u_srate
);
msg_Dbg
(
p_input
,
"initializing Sat Card with Freq: %
u
, Pol: %d, "
"FEC: %d, Srate: %
u
"
,
u_freq
,
b_polarisation
,
fe_fec
,
u_srate
);
msg_Dbg
(
p_input
,
"initializing frontend device"
);
// switch (ioctl_SetQPSKFrontend ( u_freq * 1000, i_srate* 1000, fe_fec,
// i_lnb_lof1 * 1000, i_lnb_lof2 * 1000, i_lnb_slof * 1000))
switch
(
ioctl_SetQPSKFrontend
(
fep
,
b_polarisation
,
u_adapter
,
u_device
))
switch
(
ioctl_SetQPSKFrontend
(
p_input
,
fep
,
b_polarisation
,
u_adapter
,
u_device
))
{
case
-
2
:
msg_Err
(
p_input
,
"frontend returned an unexpected event"
);
...
...
@@ -336,18 +341,20 @@ int E_(Open) ( vlc_object_t *p_this )
break
;
}
msg_Dbg
(
p_input
,
"setting filter on PAT
\n
"
);
msg_Dbg
(
p_input
,
"setting filter on PAT"
);
if
(
ioctl_SetDMXFilter
(
0
,
&
i_fd
,
3
,
u_adapter
,
u_device
)
<
0
)
if
(
ioctl_SetDMXFilter
(
p_input
,
0
,
&
i_fd
,
3
,
u_adapter
,
u_device
)
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"an error occured when setting filter on PAT (%s)"
,
strerror
(
errno
)
);
# else
msg_Err
(
p_input
,
"an error occured when setting filter on PAT"
);
# endif
close
(
p_satellite
->
i_handle
);
free
(
p_satellite
);
return
-
1
;
}
msg_Dbg
(
p_input
,
"@@@ Initialising input stream
\n
"
);
if
(
input_InitStream
(
p_input
,
sizeof
(
stream_ts_data_t
)
)
==
-
1
)
{
msg_Err
(
p_input
,
"could not initialize stream structure"
);
...
...
@@ -367,7 +374,6 @@ int E_(Open) ( vlc_object_t *p_this )
p_input
->
i_mtu
=
SATELLITE_READ_ONCE
*
TS_PACKET_SIZE
;
p_input
->
stream
.
i_method
=
INPUT_METHOD_SATELLITE
;
msg_Dbg
(
p_input
,
"@@@ Leaving E_(Open)
\n
"
);
return
0
;
}
...
...
@@ -389,7 +395,7 @@ void E_(Close) ( vlc_object_t *p_this )
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if
(
p_es
->
p_decoder_fifo
)
{
ioctl_UnsetDMXFilter
(
p_es
->
i_demux_fd
);
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
}
#undef p_es
}
...
...
@@ -409,11 +415,8 @@ static ssize_t SatelliteRead( input_thread_t * p_input, byte_t * p_buffer,
ssize_t
i_ret
;
unsigned
int
u_adapter
=
1
;
unsigned
int
u_device
=
0
;
unsigned
int
i
;
msg_Dbg
(
p_input
,
"@@@ SatelliteRead seeking for %d program
\n
"
,
p_input
->
stream
.
i_pgrm_number
);
// Get adapter and device number to use for this dvb card
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
...
...
@@ -421,15 +424,9 @@ static ssize_t SatelliteRead( input_thread_t * p_input, byte_t * p_buffer,
/* if not set, set filters to the PMTs */
for
(
i
=
0
;
i
<
p_input
->
stream
.
i_pgrm_number
;
i
++
)
{
msg_Dbg
(
p_input
,
"@@@ trying to set filter on pmt pid %d"
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
);
if
(
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
==
0
)
{
msg_Dbg
(
p_input
,
"setting filter on pmt pid %d"
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
);
ioctl_SetDMXFilter
(
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
,
ioctl_SetDMXFilter
(
p_input
,
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_id
,
&
p_input
->
stream
.
pp_programs
[
i
]
->
pp_es
[
0
]
->
i_demux_fd
,
3
,
u_adapter
,
u_device
);
}
...
...
@@ -446,8 +443,6 @@ static ssize_t SatelliteRead( input_thread_t * p_input, byte_t * p_buffer,
# endif
}
msg_Dbg
(
p_input
,
"@@@ Searched all, returning %d
\n
"
,
i_ret
);
return
i_ret
;
}
...
...
@@ -471,8 +466,6 @@ int SatelliteSetProgram( input_thread_t * p_input,
unsigned
int
u_adapter
=
1
;
unsigned
int
u_device
=
0
;
msg_Dbg
(
p_input
,
"@@@ SatelliteSetProgram enter
\n
"
);
// Get adapter and device number to use for this dvb card
u_adapter
=
config_GetInt
(
p_input
,
"adapter"
);
u_device
=
config_GetInt
(
p_input
,
"device"
);
...
...
@@ -490,7 +483,7 @@ int SatelliteSetProgram( input_thread_t * p_input,
}
if
(
p_es
->
i_demux_fd
)
{
ioctl_UnsetDMXFilter
(
p_es
->
i_demux_fd
);
ioctl_UnsetDMXFilter
(
p_input
,
p_es
->
i_demux_fd
);
p_es
->
i_demux_fd
=
0
;
}
#undef p_es
...
...
@@ -506,19 +499,19 @@ int SatelliteSetProgram( input_thread_t * p_input,
case
MPEG2_VIDEO_ES
:
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
{
ioctl_SetDMXFilter
(
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
1
,
u_adapter
,
u_device
);
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
1
,
u_adapter
,
u_device
);
}
break
;
case
MPEG1_AUDIO_ES
:
case
MPEG2_AUDIO_ES
:
if
(
input_SelectES
(
p_input
,
p_es
)
==
0
)
{
ioctl_SetDMXFilter
(
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
2
,
u_adapter
,
u_device
);
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
2
,
u_adapter
,
u_device
);
input_SelectES
(
p_input
,
p_es
);
}
break
;
default:
ioctl_SetDMXFilter
(
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
3
,
u_adapter
,
u_device
);
ioctl_SetDMXFilter
(
p_input
,
p_es
->
i_id
,
&
p_es
->
i_demux_fd
,
3
,
u_adapter
,
u_device
);
input_SelectES
(
p_input
,
p_es
);
break
;
#undef p_es
...
...
@@ -527,7 +520,6 @@ int SatelliteSetProgram( input_thread_t * p_input,
p_input
->
stream
.
p_selected_program
=
p_new_prg
;
msg_Dbg
(
p_input
,
"@@@ SatelliteSetProgram exit
\n
"
);
return
0
;
}
...
...
modules/access/dvb/dvb.c
View file @
a875b83c
...
...
@@ -24,11 +24,15 @@
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.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
...
...
@@ -49,12 +53,39 @@
#include "dvb.h"
static
int
ioctl_CheckQPSK
(
int
);
struct
diseqc_cmd_t
{
struct
dvb_diseqc_master_cmd
cmd
;
uint32_t
wait
;
};
struct
diseqc_cmd_t
switch_cmds
[]
=
{
{
{
{
0xe0
,
0x10
,
0x38
,
0xf0
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf2
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf1
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf3
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf4
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf6
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf5
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf7
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf8
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfa
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf9
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfb
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfc
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfe
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfd
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xff
,
0x00
,
0x00
},
4
},
0
}
};
static
int
ioctl_CheckQPSK
(
input_thread_t
*
p_input
,
int
front
);
/*****************************************************************************
* ioctl_FrontendControl : commands the SEC device
*****************************************************************************/
int
ioctl_FrontendControl
(
int
freq
,
int
pol
,
int
lnb_slof
,
int
diseqc
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
int
ioctl_FrontendControl
(
input_thread_t
*
p_input
,
int
freq
,
int
pol
,
int
lnb_slof
,
int
diseqc
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
struct
dvb_diseqc_master_cmd
cmd
;
fe_sec_tone_mode_t
tone
;
...
...
@@ -63,17 +94,21 @@ int ioctl_FrontendControl( int freq, int pol, int lnb_slof, int diseqc, unsigned
char
front
[]
=
FRONTEND
;
int
i_len
;
printf
(
"ioclt_FrontEndControl: enter
\n
"
);
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
front
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
printf
(
"error:
snprintf() truncated string for FRONTEND"
);
msg_Err
(
p_input
,
"
snprintf() truncated string for FRONTEND"
);
front
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
printf
(
"ioclt_FrontEndControl: Opening frontend %s
\n
"
,
front
);
msg_Dbg
(
p_input
,
"Opening frontend %s
"
,
front
);
if
((
frontend
=
open
(
front
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_FrontEndControl: Opening frontend failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_FrontEndControl: Opening frontend failed"
);
# endif
return
-
1
;
}
...
...
@@ -94,18 +129,27 @@ int ioctl_FrontendControl( int freq, int pol, int lnb_slof, int diseqc, unsigned
cmd
.
msg_len
=
4
;
/* Reset everything before sending. */
#define CHECK_IOCTL(X) if(X<0) \
#ifdef HAVE_ERRNO_H
# define CHECK_IOCTL(X) if(X<0) \
{ \
msg_Err( p_input, "InfoFrontend: ioctl failed (%s)", strerror(errno)); \
close(frontend); \
return -1;
\
return -1; \
}
#else
# define CHECK_IOCTL(X) if(X<0) \
{ \
msg_Err( p_input, "InfoFrontend: ioctl failed"); \
close(frontend); \
return -1; \
}
#endif
CHECK_IOCTL
(
ioctl
(
frontend
,
FE_SET_TONE
,
SEC_TONE_OFF
));
CHECK_IOCTL
(
ioctl
(
frontend
,
FE_SET_VOLTAGE
,
voltage
));
msleep
(
15
);
/* Send the data to the SEC device to prepare the LNB for tuning */
/*intf_Msg("Sec: Sending data\n");*/
CHECK_IOCTL
(
ioctl
(
frontend
,
FE_DISEQC_SEND_MASTER_CMD
,
&
cmd
));
msleep
(
15
);
CHECK_IOCTL
(
ioctl
(
frontend
,
FE_DISEQC_SEND_BURST
,
&
cmd
));
...
...
@@ -114,41 +158,50 @@ int ioctl_FrontendControl( int freq, int pol, int lnb_slof, int diseqc, unsigned
#undef CHECK_IOCTL
close
(
frontend
);
printf
(
"ioclt_FrontEndControl: exit
\n
"
);
return
0
;
}
/*****************************************************************************
* ioctl_InfoFrontend : return information about given frontend
*****************************************************************************/
int
ioctl_InfoFrontend
(
struct
dvb_frontend_info
*
info
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
int
front
;
int
ret
;
char
frontend
[]
=
FRONTEND
;
int
i_len
;
printf
(
"ioclt_InfoFrontEnd: enter
\n
"
);
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
printf
(
"error:
snprintf() truncated string for FRONTEND"
);
msg_Err
(
p_input
,
"
snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
printf
(
"ioclt_InfoFrontEnd: Opening device %s
\n
"
,
frontend
);
msg_Dbg
(
p_input
,
"Opening device %s
"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
return
-
1
;
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_InfoFrontEnd: opening device failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_InfoFrontEnd: opening device failed"
);
# endif
return
-
1
;
}
/* Determine type of frontend */
if
(
ioctl
(
front
,
FE_GET_INFO
,
info
)
<
0
)
if
(
(
ret
=
ioctl
(
front
,
FE_GET_INFO
,
info
)
)
<
0
)
{
close
(
front
);
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_GET_INFO failed (%d) %s"
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl FE_GET_INFO failed (%d)"
,
ret
);
# endif
return
-
1
;
}
#if 1
printf
(
"Frontend Info:
\t
name = %s
\n\t\t
frequency_min = %d
\n\t\t
frequency_max = %d
\n\t\t
frequency_stepsize = %d
\n\t\t
frequency_tolerance = %d
\n\t\t
symbol_rate_min = %d
\n\t\t
symbol_rate_max = %d
\n\t\t
symbol_rate_tolerance (ppm) = %d
\n\t\t
notifier_delay (ms)= %d
\n
"
,
msg_Dbg
(
p_input
,
"Frontend Info:
\t
name = %s
\n\t\t
frequency_min = %d
\n\t\t
frequency_max = %d
\n\t\t
frequency_stepsize = %d
\n\t\t
frequency_tolerance = %d
\n\t\t
symbol_rate_min = %d
\n\t\t
symbol_rate_max = %d
\n\t\t
symbol_rate_tolerance (ppm) = %d
\n\t\t
notifier_delay (ms)= %d
\n
"
,
info
->
name
,
info
->
frequency_min
,
info
->
frequency_max
,
...
...
@@ -158,101 +211,110 @@ int ioctl_InfoFrontend(struct dvb_frontend_info *info, unsigned int u_adapter, u
info
->
symbol_rate_max
,
info
->
symbol_rate_tolerance
,
info
->
notifier_delay
);
#endif
close
(
front
);
printf
(
"ioclt_InfoFrontEnd: exit
\n
"
);
return
0
;
}
// CPR ---> ===================================================================
struct
diseqc_cmd
{
struct
dvb_diseqc_master_cmd
cmd
;
uint32_t
wait
;
};
struct
diseqc_cmd
switch_cmds
[]
=
{
{
{
{
0xe0
,
0x10
,
0x38
,
0xf0
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf2
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf1
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf3
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf4
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf6
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf5
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf7
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf8
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfa
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xf9
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfb
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfc
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfe
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xfd
,
0x00
,
0x00
},
4
},
0
},
{
{
{
0xe0
,
0x10
,
0x38
,
0xff
,
0x00
,
0x00
},
4
},
0
}
};
int
diseqc_send_msg
(
int
fd
,
fe_sec_voltage_t
v
,
struct
diseqc_cmd
**
cmd
,
int
ioctl_DiseqcSendMsg
(
input_thread_t
*
p_input
,
int
fd
,
fe_sec_voltage_t
v
,
struct
diseqc_cmd_t
**
cmd
,
fe_sec_tone_mode_t
t
,
fe_sec_mini_cmd_t
b
)
{
int
err
;
printf
(
"diseqc_send_msg: enter
\n
"
);
if
((
err
=
ioctl
(
fd
,
FE_SET_TONE
,
SEC_TONE_OFF
)))
return
err
;
if
((
err
=
ioctl
(
fd
,
FE_SET_VOLTAGE
,
v
)))
return
err
;
msleep
(
15
);
while
(
*
cmd
)
{
printf
(
"msg: %02x %02x %02x %02x %02x %02x
\n
"
,
(
*
cmd
)
->
cmd
.
msg
[
0
],
(
*
cmd
)
->
cmd
.
msg
[
1
],
(
*
cmd
)
->
cmd
.
msg
[
2
],
(
*
cmd
)
->
cmd
.
msg
[
3
],
(
*
cmd
)
->
cmd
.
msg
[
4
],
(
*
cmd
)
->
cmd
.
msg
[
5
]);
int
err
;
if
((
err
=
ioctl
(
fd
,
FE_SET_TONE
,
SEC_TONE_OFF
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d) %s"
,
SEC_TONE_ON
?
"on"
:
"off"
,
err
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioclt FE_SET_TONE failed, tone=%s (%d)"
,
SEC_TONE_ON
?
"on"
:
"off"
,
err
);
# endif
return
err
;
}
if
((
err
=
ioctl
(
fd
,
FE_SET_VOLTAGE
,
v
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d) %s"
,
v
,
err
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioclt FE_SET_VOLTAGE failed, voltage=%d (%d)"
,
v
,
err
);
# endif
return
err
;
}
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_MASTER_CMD
,
&
(
*
cmd
)
->
cmd
)))
return
err
;
msleep
(
15
);
while
(
*
cmd
)
{
msg_Dbg
(
p_input
,
"msg: %02x %02x %02x %02x %02x %02x"
,
(
*
cmd
)
->
cmd
.
msg
[
0
],
(
*
cmd
)
->
cmd
.
msg
[
1
],
(
*
cmd
)
->
cmd
.
msg
[
2
],
(
*
cmd
)
->
cmd
.
msg
[
3
],
(
*
cmd
)
->
cmd
.
msg
[
4
],
(
*
cmd
)
->
cmd
.
msg
[
5
]);
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_MASTER_CMD
,
&
(
*
cmd
)
->
cmd
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d) %s"
,
err
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioclt FE_DISEQC_SEND_MASTER_CMD failed (%d)"
,
err
);
# endif
return
err
;
}
msleep
((
*
cmd
)
->
wait
);
cmd
++
;
}
msleep
((
*
cmd
)
->
wait
);
cmd
++
;
}
msleep
(
15
);
msleep
(
15
);
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_BURST
,
b
)))
return
err
;
if
((
err
=
ioctl
(
fd
,
FE_DISEQC_SEND_BURST
,
b
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d) %s"
,
b
,
err
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl FE_DISEQC_SEND_BURST failed, burst=%d (%d)"
,
b
,
err
);
# endif
return
err
;
}
msleep
(
15
);
msleep
(
15
);
printf
(
"diseqc_send_msg: exit
\n
"
);
return
ioctl
(
fd
,
FE_SET_TONE
,
t
);
if
((
err
=
ioctl
(
fd
,
FE_SET_TONE
,
t
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d) %s"
,
t
,
err
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl FE_SET_TONE failed, tone=%d (%d)"
,
t
,
err
);
# endif
return
err
;
}
return
err
;
}
int
setup_switch
(
int
frontend_fd
,
int
switch_pos
,
int
voltage_18
,
int
hiband
)
int
ioctl_SetupSwitch
(
input_thread_t
*
p_input
,
int
frontend_fd
,
int
switch_pos
,
int
voltage_18
,
int
hiband
)
{
struct
diseqc_cmd
*
cmd
[
2
]
=
{
NULL
,
NULL
};
int
i
=
4
*
switch_pos
+
2
*
hiband
+
(
voltage_18
?
1
:
0
);
printf
(
"setup_switch: enter
\n
"
);
printf
(
"switch pos %i, %sV, %sband
\n
"
,
switch_pos
,
voltage_18
?
"18"
:
"13"
,
hiband
?
"hi"
:
"lo"
);
printf
(
"index %i
\n
"
,
i
);
if
(
i
<
0
||
i
>=
(
int
)(
sizeof
(
switch_cmds
)
/
sizeof
(
struct
diseqc_cmd
)))
return
-
EINVAL
;
cmd
[
0
]
=
&
switch_cmds
[
i
];
printf
(
"setup_switch: exit
\n
"
);
return
diseqc_send_msg
(
frontend_fd
,
i
%
2
?
SEC_VOLTAGE_18
:
SEC_VOLTAGE_13
,
cmd
,
(
i
/
2
)
%
2
?
SEC_TONE_ON
:
SEC_TONE_OFF
,
(
i
/
4
)
%
2
?
SEC_MINI_B
:
SEC_MINI_A
);
int
ret
;
struct
diseqc_cmd_t
*
cmd
[
2
]
=
{
NULL
,
NULL
};
int
i
=
4
*
switch_pos
+
2
*
hiband
+
(
voltage_18
?
1
:
0
);
msg_Dbg
(
p_input
,
"ioctl_SetupSwitch: switch pos %i, %sV, %sband"
,
switch_pos
,
voltage_18
?
"18"
:
"13"
,
hiband
?
"hi"
:
"lo"
);
msg_Dbg
(
p_input
,
"ioctl_SetupSwitch: index %i"
,
i
);
if
((
i
<
0
)
||
(
i
>=
(
int
)(
sizeof
(
switch_cmds
)
/
sizeof
(
struct
diseqc_cmd_t
))))
return
-
EINVAL
;
cmd
[
0
]
=
&
switch_cmds
[
i
];
if
((
ret
=
ioctl_DiseqcSendMsg
(
p_input
,
frontend_fd
,
(
i
%
2
)
?
SEC_VOLTAGE_18
:
SEC_VOLTAGE_13
,
cmd
,
(
i
/
2
)
%
2
?
SEC_TONE_ON
:
SEC_TONE_OFF
,
(
i
/
4
)
%
2
?
SEC_MINI_B
:
SEC_MINI_A
))
<
0
)
{
msg_Err
(
p_input
,
"ioctl_DiseqcSendMsg() failed (%d)"
,
ret
);
return
ret
;
}
return
ret
;
}
// <--- CPR ===================================================================
#define SWITCHFREQ 11700000
#define LOF_HI 10600000
#define LOF_LO 9750000
...
...
@@ -260,34 +322,43 @@ int setup_switch (int frontend_fd, int switch_pos, int voltage_18, int hiband)
/*****************************************************************************
* ioctl_SetQPSKFrontend : controls the FE device
*****************************************************************************/
int
ioctl_SetQPSKFrontend
(
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
int
front
;
int
r
c
;
int
r
et
;
int
i
;
int
hiband
;
char
frontend
[]
=
FRONTEND
;
int
i_len
;
printf
(
"ioctl_SetQPSKFrontend: enter
\n
"
);
i_len
=
sizeof
(
FRONTEND
);
if
(
snprintf
(
frontend
,
sizeof
(
FRONTEND
),
FRONTEND
,
u_adapter
,
u_device
)
>=
i_len
)
{
printf
(
"error: snprintf() truncated string for FRONTEND"
);
msg_Err
(
p_input
,
"error: snprintf() truncated string for FRONTEND"
);
frontend
[
sizeof
(
FRONTEND
)]
=
'\0'
;
}
printf
(
"ioctl_SetQPSKFrontend: Opening frontend %s
\n
"
,
frontend
);
/* Open the frontend device */
msg_Dbg
(
p_input
,
"Opening frontend %s"
,
frontend
);
if
((
front
=
open
(
frontend
,
O_RDWR
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"failed to open frontend (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"failed to open frontend"
);
# endif
return
-
1
;
}
/* Set the frequency of the transponder, taking into account the
local frequencies of the LNB */
hiband
=
(
fep
.
frequency
>=
SWITCHFREQ
);
setup_switch
(
front
,
0
,
b_polarisation
,
hiband
);
if
((
ret
=
ioctl_SetupSwitch
(
p_input
,
front
,
0
,
b_polarisation
,
hiband
))
<
0
)
{
msg_Err
(
p_input
,
"ioctl_SetupSwitch failed (%d)"
,
ret
);
return
-
1
;
}
if
(
hiband
)
fep
.
frequency
-=
LOF_HI
;
...
...
@@ -295,107 +366,127 @@ int ioctl_SetQPSKFrontend ( struct dvb_frontend_parameters fep, int b_polarisati
fep
.
frequency
-=
LOF_LO
;
/* Now send it all to the frontend device */
if
(
ioctl
(
front
,
FE_SET_FRONTEND
,
&
fep
)
<
0
)
if
(
(
ret
=
ioctl
(
front
,
FE_SET_FRONTEND
,
&
fep
)
)
<
0
)
{
printf
(
"ioctl_SetQPSKFrontend: ioctl FE_SET_FRONTEND failed
\n
"
);
close
(
front
);
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_SetQPSKFrontend: ioctl FE_SET_FRONTEND failed (%d) %s"
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_SetQPSKFrontend: ioctl FE_SET_FRONTEND failed (%d)"
,
ret
);
# endif
return
-
1
;
}
for
(
i
=
0
;
i
<
3
;
i
++
)
{
fe_status_t
s
;
ioctl
(
front
,
FE_READ_STATUS
,
&
s
);
printf
(
"ioctl_SetQPSKFrontend: tuning status == 0x%02x!!! ..."
,
s
);
if
((
ret
=
ioctl
(
front
,
FE_READ_STATUS
,
&
s
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl FE_READ_STATUS failed (%d) %s"
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl FE_READ_STATUS failed (%d)"
,
ret
);
# endif
}
if
(
s
&
FE_HAS_LOCK
)
{
printf
(
"tuning succeeded
\n
"
);
rc
=
0
;
msg_Dbg
(
p_input
,
"ioctl_SetQPSKFrontend: tuning status == 0x%02x!!! ..."
"tuning succeeded"
,
s
);
ret
=
0
;
}
else
{
printf
(
"tuning failed
\n
"
);
rc
=
-
1
;
msg_Dbg
(
p_input
,
"ioctl_SetQPSKFrontend: tuning status == 0x%02x!!! ..."
"tuning failed"
,
s
);
ret
=
-
1
;
}
usleep
(
500000
);
}
/* Close front end device */
close
(
front
);
printf
(
"ioctl_SetQPSKFrontend: exit
\n
"
);
return
rc
;
return
ret
;
}
/******************************************************************
* Check completion of the frontend control sequence
******************************************************************/
static
int
ioctl_CheckQPSK
(
int
front
)
static
int
ioctl_CheckQPSK
(
in
put_thread_t
*
p_input
,
in
t
front
)
{
int
ret
;
struct
pollfd
pfd
[
1
];
struct
dvb_frontend_event
event
;
/* poll for QPSK event to check if tuning worked */
pfd
[
0
].
fd
=
front
;
pfd
[
0
].
events
=
POLLIN
;
printf
(
"ioctl_CheckQPSK: enter
\n
"
);
if
(
poll
(
pfd
,
1
,
3000
))
{
if
(
pfd
[
0
].
revents
&
POLLIN
)
{
if
(
ioctl
(
front
,
FE_GET_EVENT
,
&
event
)
<
0
)
if
(
(
ret
=
ioctl
(
front
,
FE_GET_EVENT
,
&
event
)
)
<
0
)
{
printf
(
"ioctl_CheckQPSK: ioctl FE_GET_EVENT failed
\n
"
);
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_CheckQPSK: ioctl FE_GET_EVENT failed (%d) %s"
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_CheckQPSK: ioctl FE_GET_EVENT failed (%d)"
,
ret
);
# endif
return
-
5
;
}
switch
(
event
.
status
)
{
case
FE_HAS_SIGNAL
:
/* found something above the noise level */
printf
(
"ioctl_CheckQPSK: FE_HAS_SIGNAL
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_HAS_SIGNAL
"
);
break
;
case
FE_HAS_CARRIER
:
/* found a DVB signal */
printf
(
"ioctl_CheckQPSK: FE_HAS_CARRIER
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_HAS_CARRIER
"
);
break
;
case
FE_HAS_VITERBI
:
/* FEC is stable */
printf
(
"ioctl_CheckQPSK: FE_HAS_VITERBI
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_HAS_VITERBI
"
);
break
;
case
FE_HAS_SYNC
:
/* found sync bytes */
printf
(
"ioctl_CheckQPSK: FE_HAS_SYNC
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_HAS_SYNC
"
);
break
;
case
FE_HAS_LOCK
:
/* everything's working... */
printf
(
"ioctl_CheckQPSK: FE_HAS_LOCK
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_HAS_LOCK
"
);
break
;
case
FE_TIMEDOUT
:
/* no lock within the last ~2 seconds */
printf
(
"ioctl_CheckQPSK: FE_TIMEDOUT
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_TIMEDOUT
"
);
return
-
2
;
case
FE_REINIT
:
/* frontend was reinitialized, */
/* application is recommned to reset */
/* DiSEqC, tone and parameters */
printf
(
"ioctl_CheckQPSK: FE_REINIT
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_CheckQPSK: FE_REINIT
"
);
return
-
1
;
}
}
else
{
/* should come here */
printf
(
"ioctl_CheckQPSK: event() failed
\n
"
);
msg_Err
(
p_input
,
"ioctl_CheckQPSK: event() failed
"
);
return
-
3
;
}
}
else
{
printf
(
"ioctl_CheckQPSK: poll() failed
\n
"
);
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_CheckQPSK: poll() failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_CheckQPSK: poll() failed"
);
# endif
return
-
4
;
}
printf
(
"ioctl_CheckQPSK: exit
\n
"
);
return
0
;
}
/*****************************************************************************
* ioctl_SetDMXFilter : controls the demux to add a filter
*****************************************************************************/
int
ioctl_SetDMXFilter
(
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
unsigned
int
u_adapter
,
unsigned
int
u_device
)
{
struct
dmx_pes_filter_params
s_filter_params
;
char
dmx
[]
=
DMX
;
...
...
@@ -403,21 +494,24 @@ int ioctl_SetDMXFilter( int i_pid, int * pi_fd , int i_type, unsigned int u_adap
int
result
;
/* We first open the device */
printf
(
"ioctl_SetDMXFIlter: enter
\n
"
);
i_len
=
sizeof
(
DMX
);
if
(
snprintf
(
dmx
,
sizeof
(
DMX
),
DMX
,
u_adapter
,
u_device
)
>=
i_len
)
{
printf
(
"error:
snprintf() truncated string for DMX"
);
msg_Err
(
p_input
,
"
snprintf() truncated string for DMX"
);
dmx
[
sizeof
(
DMX
)]
=
'\0'
;
}
printf
(
"ioctl_SetDMXFIlter: Opening demux device %s
\n
"
,
dmx
);
msg_Dbg
(
p_input
,
"Opening demux device %s
"
,
dmx
);
if
((
*
pi_fd
=
open
(
dmx
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_SetDMXFIlter: opening device failed (%s)"
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_SetDMXFIlter: opening device failed"
);
# endif
return
-
1
;
}
printf
(
"@@@ Trying to set PMT id to=%d for type %d
\n
"
,
i_pid
,
i_type
);
/* We fill the DEMUX structure : */
s_filter_params
.
pid
=
i_pid
;
s_filter_params
.
input
=
DMX_IN_FRONTEND
;
...
...
@@ -425,38 +519,52 @@ int ioctl_SetDMXFilter( int i_pid, int * pi_fd , int i_type, unsigned int u_adap
switch
(
i_type
)
{
case
1
:
printf
(
"ioctl_SetDMXFIlter: DMX_PES_VIDEO
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_SetDMXFIlter: DMX_PES_VIDEO for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_VIDEO
;
break
;
case
2
:
printf
(
"ioctl_SetDMXFIlter: DMX_PES_AUDIO
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_SetDMXFIlter: DMX_PES_AUDIO for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_AUDIO
;
break
;
case
3
:
printf
(
"ioctl_SetDMXFIlter: DMX_PES_OTHER
\n
"
);
msg_Dbg
(
p_input
,
"ioctl_SetDMXFIlter: DMX_PES_OTHER for PMT %d"
,
i_pid
);
s_filter_params
.
pes_type
=
DMX_PES_OTHER
;
break
;
default:
msg_Err
(
p_input
,
"trying to set PMT id to=%d for unknown type %d"
,
i_pid
,
i_type
);
break
;
}
s_filter_params
.
flags
=
DMX_IMMEDIATE_START
;
/* We then give the order to the device : */
if
(
result
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
)
<
0
)
if
(
(
result
=
ioctl
(
*
pi_fd
,
DMX_SET_PES_FILTER
,
&
s_filter_params
)
)
<
0
)
{
printf
(
"ioctl_SetDMXFIlter: ioctl failed with %d (%s)
\n
"
,
result
,
strerror
(
errno
));
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl_SetDMXFIlter: ioctl failed with %d (%s)"
,
result
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl_SetDMXFIlter: ioctl failed with %d"
,
result
);
# endif
return
-
1
;
}
printf
(
"ioctl_SetDMXFIlter: exit
\n
"
);
return
0
;
}
/*****************************************************************************
* ioctl_UnsetDMXFilter : removes a filter
*****************************************************************************/
int
ioctl_UnsetDMXFilter
(
int
demux
)
int
ioctl_UnsetDMXFilter
(
in
put_thread_t
*
p_input
,
in
t
demux
)
{
printf
(
"ioctl_UnsetDMXFIlter: enter
\n
"
);
ioctl
(
demux
,
DMX_STOP
);
int
ret
;
if
((
ret
=
ioctl
(
demux
,
DMX_STOP
))
<
0
)
{
# ifdef HAVE_ERRNO_H
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d) %s"
,
demux
,
ret
,
strerror
(
errno
));
# else
msg_Err
(
p_input
,
"ioctl DMX_STOP failed for demux %d (%d)"
,
demux
,
ret
);
# endif
return
-
1
;
}
close
(
demux
);
printf
(
"ioctl_UnsetDMXFIlter: exit
\n
"
);
return
0
;
}
modules/access/dvb/dvb.h
View file @
a875b83c
...
...
@@ -26,11 +26,6 @@
/*****************************************************************************
* Devices location
*****************************************************************************/
/*
#define DMX "/dev/dvb/adapter1/demux0"
#define FRONTEND "/dev/dvb/adapter1/frontend0"
#define DVR "/dev/dvb/adapter1/dvr0"
*/
#define DMX "/dev/dvb/adapter%d/demux%d"
#define FRONTEND "/dev/dvb/adapter%d/frontend%d"
#define DVR "/dev/dvb/adapter%d/dvr%d"
...
...
@@ -38,8 +33,9 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int
ioctl_FrontendControl
(
int
freq
,
int
pol
,
int
lnb_slof
,
int
diseqc
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetQPSKFrontend
(
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetDMXFilter
(
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_UnsetDMXFilter
(
int
);
int
ioctl_InfoFrontend
(
struct
dvb_frontend_info
*
info
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_FrontendControl
(
input_thread_t
*
p_input
,
int
freq
,
int
pol
,
int
lnb_slof
,
int
diseqc
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetQPSKFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_parameters
fep
,
int
b_polarisation
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_SetDMXFilter
(
input_thread_t
*
p_input
,
int
i_pid
,
int
*
pi_fd
,
int
i_type
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
int
ioctl_UnsetDMXFilter
(
input_thread_t
*
p_input
,
int
);
int
ioctl_InfoFrontend
(
input_thread_t
*
p_input
,
struct
dvb_frontend_info
*
info
,
unsigned
int
u_adapter
,
unsigned
int
u_device
);
modules/access/dvb/qpsk.c
View file @
a875b83c
...
...
@@ -70,8 +70,8 @@ void E_(Close) ( vlc_object_t * );
#define LNB_SLOF_TEXT N_("antenna lnb_slof (kHz)")
#define LNB_SLOF_LONGTEXT ""
#define
NO_PROBE_TEXT N_("do not probe the dvb card for capabilities
")
#define
NO_
PROBE_LONGTEXT N_("some dvb cards do not like to be probed for their capabilities")
#define
PROBE_TEXT N_("probe the dvb card for capabilities (default disabled)
")
#define PROBE_LONGTEXT N_("some dvb cards do not like to be probed for their capabilities")
vlc_module_begin
();
add_category_hint
(
N_
(
"Input"
),
NULL
,
VLC_FALSE
);
...
...
@@ -88,10 +88,9 @@ vlc_module_begin();
LNB_LOF2_TEXT
,
LNB_LOF2_LONGTEXT
,
VLC_FALSE
);
add_integer
(
"lnb-slof"
,
11700
,
NULL
,
LNB_SLOF_TEXT
,
LNB_SLOF_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"
no-probe"
,
1
,
NULL
,
NO_PROBE_TEXT
,
NO_
PROBE_LONGTEXT
,
VLC_FALSE
);
add_bool
(
"
probe"
,
0
,
NULL
,
PROBE_TEXT
,
PROBE_LONGTEXT
,
VLC_FALSE
);
set_description
(
_
(
"DVB input module with v4l2 support"
)
);
set_capability
(
"access"
,
0
);
// add_shortcut( "satellite" );
add_shortcut
(
"qpsk"
);
// add_shortcut( "cable" );
// add_shortcut( "terrestrial" );
...
...
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