Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
44fdf553
Commit
44fdf553
authored
Mar 20, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DTV: factorize tuning and add spectral inversion
parent
c7438b1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
58 deletions
+70
-58
modules/access/dtv/access.c
modules/access/dtv/access.c
+70
-58
No files found.
modules/access/dtv/access.c
View file @
44fdf553
...
...
@@ -81,9 +81,6 @@ static const char *const modulation_user[] = { N_("Undefined"),
#define INVERSION_LONGTEXT N_( \
"If the demodulator cannot detect spectral inversion correctly, " \
"it needs to be configured manually.")
//TODO const int inversion_linux[] = { INVERSION_AUTO,
// INVERSION_OFF, INVERSION_ON,
//};
const
int
inversion_vlc
[]
=
{
-
1
,
0
,
1
};
static
const
char
*
const
auto_off_on
[]
=
{
N_
(
"Automatic"
),
N_
(
"Off"
),
N_
(
"On"
)
};
...
...
@@ -247,49 +244,14 @@ struct access_sys_t
struct
delsys
{
int
(
*
tune
)
(
vlc_object_t
*
,
dvb_device_t
*
,
uint64_t
freq
);
int
(
*
setup
)
(
vlc_object_t
*
,
dvb_device_t
*
,
uint64_t
freq
);
/* TODO: scan stuff */
};
static
block_t
*
Read
(
access_t
*
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
static
const
delsys_t
*
GuessSystem
(
const
char
*
scheme
,
dvb_device_t
*
dev
)
{
/* NOTE: We should guess the delivery system for the "cable", "satellite"
* and "terrestrial" shortcuts (i.e. DVB, ISDB, ATSC...). But there is
* seemingly no sane way to do get the info with Linux DVB version 5.2.
* In particular, the frontend infos distinguish only the modulator class
* (QPSK, QAM, OFDM or ATSC).
*
* Furthermore, if the demodulator supports 2G, we cannot guess whether
* 1G or 2G is intended. For backward compatibility, 1G is assumed
* (this is not a limitation of Linux DVB). We will probably need something
* smarter when 2G (semi automatic) scanning is implemented. */
if
(
!
strcasecmp
(
scheme
,
"cable"
))
scheme
=
"dvb-c"
;
else
if
(
!
strcasecmp
(
scheme
,
"satellite"
))
scheme
=
"dvb-s"
;
else
if
(
!
strcasecmp
(
scheme
,
"terrestrial"
))
scheme
=
"dvb-t"
;
if
(
!
strcasecmp
(
scheme
,
"atsc"
))
return
&
atsc
;
if
(
!
strcasecmp
(
scheme
,
"dvb-c"
))
return
&
dvbc
;
if
(
!
strcasecmp
(
scheme
,
"dvb-s"
))
return
&
dvbs
;
if
(
!
strcasecmp
(
scheme
,
"dvb-s2"
))
return
&
dvbs2
;
if
(
!
strcasecmp
(
scheme
,
"dvb-t"
))
return
&
dvbt
;
return
dvb_guess_system
(
dev
);
}
static
const
delsys_t
*
GuessSystem
(
const
char
*
,
dvb_device_t
*
);
static
int
Tune
(
vlc_object_t
*
,
dvb_device_t
*
,
const
delsys_t
*
,
uint64_t
);
static
int
Open
(
vlc_object_t
*
obj
)
{
...
...
@@ -314,12 +276,12 @@ static int Open (vlc_object_t *obj)
if
(
freq
!=
0
)
{
const
delsys_t
*
delsys
=
GuessSystem
(
access
->
psz_access
,
dev
);
if
(
delsys
==
NULL
||
delsys
->
tune
(
obj
,
dev
,
freq
))
if
(
delsys
==
NULL
||
Tune
(
obj
,
dev
,
delsys
,
freq
))
{
msg_Err
(
obj
,
"tuning to %"
PRIu64
" Hz failed"
,
freq
);
dialog_Fatal
(
obj
,
N_
(
"Digital broadcasting"
),
N_
(
"The selected digital tuner does not support "
"the specified parameters.
"
"the specified parameters.
\n
"
"Please check the preferences."
));
goto
error
;
}
...
...
@@ -447,23 +409,71 @@ static int Control (access_t *access, int query, va_list args)
}
/*** Generic tuning ***/
/** Determines which delivery system to use. */
static
const
delsys_t
*
GuessSystem
(
const
char
*
scheme
,
dvb_device_t
*
dev
)
{
/* NOTE: We should guess the delivery system for the "cable", "satellite"
* and "terrestrial" shortcuts (i.e. DVB, ISDB, ATSC...). But there is
* seemingly no sane way to do get the info with Linux DVB version 5.2.
* In particular, the frontend infos distinguish only the modulator class
* (QPSK, QAM, OFDM or ATSC).
*
* Furthermore, if the demodulator supports 2G, we cannot guess whether
* 1G or 2G is intended. For backward compatibility, 1G is assumed
* (this is not a limitation of Linux DVB). We will probably need something
* smarter when 2G (semi automatic) scanning is implemented. */
if
(
!
strcasecmp
(
scheme
,
"cable"
))
scheme
=
"dvb-c"
;
else
if
(
!
strcasecmp
(
scheme
,
"satellite"
))
scheme
=
"dvb-s"
;
else
if
(
!
strcasecmp
(
scheme
,
"terrestrial"
))
scheme
=
"dvb-t"
;
if
(
!
strcasecmp
(
scheme
,
"atsc"
))
return
&
atsc
;
if
(
!
strcasecmp
(
scheme
,
"dvb-c"
))
return
&
dvbc
;
if
(
!
strcasecmp
(
scheme
,
"dvb-s"
))
return
&
dvbs
;
if
(
!
strcasecmp
(
scheme
,
"dvb-s2"
))
return
&
dvbs2
;
if
(
!
strcasecmp
(
scheme
,
"dvb-t"
))
return
&
dvbt
;
return
dvb_guess_system
(
dev
);
}
/** Set parameters and tune the device */
static
int
Tune
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
const
delsys_t
*
delsys
,
uint64_t
freq
)
{
if
(
delsys
->
setup
(
obj
,
dev
,
freq
)
||
dvb_set_inversion
(
dev
,
var_InheritInteger
(
obj
,
"dvb-inversion"
))
||
dvb_tune
(
dev
))
return
VLC_EGENERIC
;
return
VLC_SUCCESS
;
}
/*** ATSC ***/
static
int
atsc_
tune
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
static
int
atsc_
setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
{
char
*
mod
=
var_InheritString
(
obj
,
"dvb-modulation"
);
int
ret
=
dvb_set_atsc
(
dev
,
freq
,
mod
);
free
(
mod
);
if
(
ret
==
0
)
ret
=
dvb_tune
(
dev
);
return
ret
;
}
const
delsys_t
atsc
=
{
.
tune
=
atsc_tune
};
const
delsys_t
atsc
=
{
.
setup
=
atsc_setup
};
/*** DVB-C ***/
static
int
dvbc_
tune
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
static
int
dvbc_
setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
{
char
*
mod
=
var_InheritString
(
obj
,
"dvb-modulation"
);
char
*
fec
=
var_InheritString
(
obj
,
"dvb-code-rate"
);
...
...
@@ -472,29 +482,33 @@ static int dvbc_tune (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq)
int
ret
=
dvb_set_dvbc
(
dev
,
freq
,
mod
,
srate
,
fec
);
free
(
fec
);
free
(
mod
);
if
(
ret
==
0
)
ret
=
dvb_tune
(
dev
);
return
ret
;
}
const
delsys_t
dvbc
=
{
.
tune
=
dvbc_tune
};
const
delsys_t
dvbc
=
{
.
setup
=
dvbc_setup
};
/*** DVB-S ***/
static
int
dvbs_
tune
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
static
int
dvbs_
setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
{
(
void
)
dev
;
(
void
)
freq
;
msg_Err
(
obj
,
"DVB-S not implemented"
);
return
-
1
;
}
static
int
dvbs2_setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
{
(
void
)
dev
;
(
void
)
freq
;
msg_Err
(
obj
,
"DVB-S2 not implemented"
);
return
-
1
;
}
const
delsys_t
dvbs
=
{
.
tune
=
dvbs_tune
};
const
delsys_t
dvbs2
=
{
.
tune
=
dvbs_tune
};
const
delsys_t
dvbs
=
{
.
setup
=
dvbs_setup
};
const
delsys_t
dvbs2
=
{
.
setup
=
dvbs2_setup
};
/*** DVB-T ***/
static
int
dvbt_
tune
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
static
int
dvbt_
setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
uint64_t
freq
)
{
char
*
mod
=
var_InheritString
(
obj
,
"dvb-modulation"
);
char
*
fec_hp
=
var_InheritString
(
obj
,
"dvb-code-rate-hp"
);
...
...
@@ -509,9 +523,7 @@ static int dvbt_tune (vlc_object_t *obj, dvb_device_t *dev, uint64_t freq)
free
(
fec_lp
);
free
(
fec_hp
);
free
(
mod
);
if
(
ret
==
0
)
ret
=
dvb_tune
(
dev
);
return
ret
;
}
const
delsys_t
dvbt
=
{
.
tune
=
dvbt_tune
};
const
delsys_t
dvbt
=
{
.
setup
=
dvbt_setup
};
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