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
a970fb75
Commit
a970fb75
authored
Mar 25, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DTV: pass FEC parameters as integers internally
parent
223d4246
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
57 deletions
+61
-57
modules/access/dtv/access.c
modules/access/dtv/access.c
+31
-29
modules/access/dtv/dtv.h
modules/access/dtv/dtv.h
+6
-5
modules/access/dtv/linux.c
modules/access/dtv/linux.c
+24
-23
No files found.
modules/access/dtv/access.c
View file @
a970fb75
...
...
@@ -91,7 +91,7 @@ static const char *const auto_off_on_user[] = { N_("Automatic"),
#define CODE_RATE_LONGTEXT N_( \
"The code rate for Forward Error Correction can be specified.")
static
const
char
*
const
code_rate_vlc
[]
=
{
""
,
"
none
"
,
/*"1/4", "1/3",*/
"1/2"
,
"3/5"
,
"2/3"
,
"3/4"
,
"
0
"
,
/*"1/4", "1/3",*/
"1/2"
,
"3/5"
,
"2/3"
,
"3/4"
,
"4/5"
,
"5/6"
,
"6/7"
,
"7/8"
,
"8/9"
,
"9/10"
,
};
static
const
char
*
const
code_rate_user
[]
=
{
N_
(
"Automatic"
),
...
...
@@ -252,13 +252,9 @@ vlc_module_begin ()
add_integer
(
"dvb-srate"
,
0
,
SRATE_TEXT
,
SRATE_LONGTEXT
,
false
)
change_integer_range
(
0
,
UINT64_C
(
0xffffffff
))
change_safe
()
add_string
(
"dvb-
code-rate
"
,
""
,
CODE_RATE_TEXT
,
CODE_RATE_LONGTEXT
,
true
)
add_string
(
"dvb-
fec
"
,
""
,
CODE_RATE_TEXT
,
CODE_RATE_LONGTEXT
,
true
)
change_string_list
(
code_rate_vlc
,
code_rate_user
,
NULL
)
change_safe
()
add_integer
(
"dvb-fec"
,
9
,
" "
,
" "
,
true
)
change_integer_range
(
0
,
9
)
change_private
()
change_safe
()
set_section
(
N_
(
"DVB-S2 parameters"
),
NULL
)
add_integer
(
"dvb-pilot"
,
-
1
,
PILOT_TEXT
,
PILOT_TEXT
,
true
)
change_integer_list
(
auto_off_on_vlc
,
auto_off_on_user
)
...
...
@@ -533,23 +529,34 @@ static unsigned var_InheritFrequency (vlc_object_t *obj)
return
freq
;
}
static
char
*
var_InheritCodeRate
(
vlc_object_t
*
obj
)
static
uint32_t
var_InheritCodeRate
(
vlc_object_t
*
obj
,
const
char
*
varname
)
{
char
*
code_rate
=
var_InheritString
(
obj
,
"dvb-code-rate"
);
if
(
code_rate
!
=
NULL
)
return
code_rate
;
char
*
code_rate
=
var_InheritString
(
obj
,
varname
);
if
(
code_rate
=
=
NULL
)
return
VLC_FEC_AUTO
;
uint16_t
a
,
b
;
int
v
=
sscanf
(
code_rate
,
"%"
SCNu16
"/%"
SCNu16
,
&
a
,
&
b
);
free
(
code_rate
);
switch
(
v
)
{
case
2
:
return
VLC_FEC
(
a
,
b
);
case
1
:
if
(
a
==
0
)
return
0
;
/* Backward compatibility with VLC < 1.2 (= Linux DVBv3 enum) */
unsigned
fec
=
var_InheritInteger
(
obj
,
"dvb-fec"
);
if
(
fec
<
9
)
if
(
a
<
9
)
{
static
const
char
linux_dvb
[
9
][
5
]
=
{
"none"
,
"1/2"
,
"2/3"
,
"3/4"
,
"4/5"
,
"5/6"
,
"6/7"
,
"7/8"
};
msg_Warn
(
obj
,
"
\"
fec=%u
\"
option is obsolete. "
"Use
\"
code-rate=%s
\"
instead."
,
fec
,
linux_dvb
[
fec
]);
return
strdup
(
linux_dvb
[
fec
]);
msg_Warn
(
obj
,
"
\"
%s=%"
PRIu16
"
\"
option is obsolete. "
"Use
\"
%s=%"
PRIu16
"/%"
PRIu16
"
\"
instead."
,
varname
+
4
,
a
,
varname
+
4
,
a
,
a
+
1
);
return
VLC_FEC
(
a
,
a
+
1
);
}
return
NULL
;
else
msg_Warn
(
obj
,
"
\"
fec=9
\"
option is obsolete."
);
}
return
VLC_FEC_AUTO
;
}
static
char
*
var_InheritModulation
(
vlc_object_t
*
obj
)
...
...
@@ -637,11 +644,10 @@ const delsys_t cqam = { .setup = cqam_setup };
static
int
dvbc_setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
unsigned
freq
)
{
char
*
mod
=
var_InheritModulation
(
obj
);
char
*
fec
=
var_InheritCodeRate
(
obj
);
uint32_t
fec
=
var_InheritCodeRate
(
obj
,
"dvb-fec"
);
unsigned
srate
=
var_InheritInteger
(
obj
,
"dvb-srate"
);
int
ret
=
dvb_set_dvbc
(
dev
,
freq
,
mod
,
srate
,
fec
);
free
(
fec
);
free
(
mod
);
return
ret
;
}
...
...
@@ -689,11 +695,10 @@ static int sec_setup (vlc_object_t *obj, dvb_device_t *dev, unsigned freq)
static
int
dvbs_setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
unsigned
freq
)
{
char
*
fec
=
var_InheritCodeRate
(
obj
);
uint32_t
fec
=
var_InheritCodeRate
(
obj
,
"dvb-fec"
);
uint32_t
srate
=
var_InheritInteger
(
obj
,
"dvb-srate"
);
int
ret
=
dvb_set_dvbs
(
dev
,
freq
,
srate
,
fec
);
free
(
fec
);
if
(
ret
==
0
)
ret
=
sec_setup
(
obj
,
dev
,
freq
);
return
ret
;
...
...
@@ -702,13 +707,12 @@ static int dvbs_setup (vlc_object_t *obj, dvb_device_t *dev, unsigned freq)
static
int
dvbs2_setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
unsigned
freq
)
{
char
*
mod
=
var_InheritModulation
(
obj
);
char
*
fec
=
var_InheritCodeRate
(
obj
);
uint32_t
fec
=
var_InheritCodeRate
(
obj
,
"dvb-fec"
);
uint32_t
srate
=
var_InheritInteger
(
obj
,
"dvb-srate"
);
int
pilot
=
var_InheritInteger
(
obj
,
"dvb-pilot"
);
int
rolloff
=
var_InheritInteger
(
obj
,
"dvb-rolloff"
);
int
ret
=
dvb_set_dvbs2
(
dev
,
freq
,
mod
,
srate
,
fec
,
pilot
,
rolloff
);
free
(
fec
);
free
(
mod
);
if
(
ret
==
0
)
ret
=
sec_setup
(
obj
,
dev
,
freq
);
...
...
@@ -723,16 +727,14 @@ const delsys_t dvbs2 = { .setup = dvbs2_setup };
static
int
dvbt_setup
(
vlc_object_t
*
obj
,
dvb_device_t
*
dev
,
unsigned
freq
)
{
char
*
mod
=
var_InheritModulation
(
obj
);
char
*
fec_hp
=
var_InheritString
(
obj
,
"dvb-code-rate-hp"
);
char
*
fec_lp
=
var_InheritString
(
obj
,
"dvb-code-rate-lp"
);
uint32_t
fec_hp
=
var_InheritCodeRate
(
obj
,
"dvb-code-rate-hp"
);
uint32_t
fec_lp
=
var_InheritCodeRate
(
obj
,
"dvb-code-rate-lp"
);
uint32_t
guard
=
var_InheritGuardInterval
(
obj
);
uint32_t
bw
=
var_InheritInteger
(
obj
,
"dvb-bandwidth"
);
int
tx
=
var_InheritInteger
(
obj
,
"dvb-transmission"
);
int
h
=
var_InheritInteger
(
obj
,
"dvb-hierarchy"
);
int
ret
=
dvb_set_dvbt
(
dev
,
freq
,
mod
,
fec_hp
,
fec_lp
,
bw
,
tx
,
guard
,
h
);
free
(
fec_lp
);
free
(
fec_hp
);
free
(
mod
);
return
ret
;
}
...
...
modules/access/dtv/dtv.h
View file @
a970fb75
...
...
@@ -40,24 +40,25 @@ float dvb_get_snr (dvb_device_t *);
int
dvb_set_inversion
(
dvb_device_t
*
,
int
);
int
dvb_tune
(
dvb_device_t
*
);
#define VLC_FEC(a,b) (((a) << 16u) | (b))
#define VLC_FEC_AUTO 0xFFFFFFFF
#define VLC_GUARD(a,b) (((a) << 16u) | (b))
#define VLC_GUARD_AUTO 0xFFFFFFFF
/* DVB-C */
int
dvb_set_dvbc
(
dvb_device_t
*
,
uint32_t
freq
,
const
char
*
mod
,
uint32_t
srate
,
const
char
*
fec
);
uint32_t
srate
,
uint32_t
fec
);
/* DVB-S */
int
dvb_set_dvbs
(
dvb_device_t
*
,
uint32_t
freq
,
uint32_t
srate
,
const
char
*
fec
);
int
dvb_set_dvbs
(
dvb_device_t
*
,
uint32_t
freq
,
uint32_t
srate
,
uint32_t
fec
);
int
dvb_set_dvbs2
(
dvb_device_t
*
,
uint32_t
freq
,
const
char
*
mod
,
uint32_t
srate
,
const
char
*
fec
,
int
pilot
,
int
rolloff
);
uint32_t
srate
,
uint32_t
fec
,
int
pilot
,
int
rolloff
);
int
dvb_set_sec
(
dvb_device_t
*
,
uint32_t
freq
,
char
pol
,
uint32_t
lowf
,
uint32_t
highf
,
uint32_t
switchf
);
/* DVB-T */
int
dvb_set_dvbt
(
dvb_device_t
*
,
uint32_t
freq
,
const
char
*
mod
,
const
char
*
fec_hp
,
const
char
*
fec_lp
,
uint32_t
bandwidth
,
uint32_t
fec_hp
,
uint32_t
fec_lp
,
uint32_t
bandwidth
,
int
transmission
,
uint32_t
guard
,
int
hierarchy
);
/* ATSC */
...
...
modules/access/dtv/linux.c
View file @
a970fb75
...
...
@@ -140,24 +140,26 @@ static int dvb_parse_modulation (const char *str, int def)
return
dvb_parse_str
(
str
,
mods
,
sizeof
(
mods
)
/
sizeof
(
*
mods
),
def
);
}
static
int
dvb_parse_fec
(
const
char
*
str
)
static
int
dvb_parse_fec
(
uint32_t
fec
)
{
static
const
dvb_
str
_map_t
rates
[]
=
static
const
dvb_
int
_map_t
rates
[]
=
{
{
""
,
FEC_AUTO
},
{
"1/2"
,
FEC_1_2
},
{
0
,
FEC_NONE
},
{
VLC_FEC
(
1
,
2
)
,
FEC_1_2
},
// TODO: 1/3
// TODO: 1/4
{
"2/3"
,
FEC_2_3
},
{
"3/4"
,
FEC_3_4
},
{
"4/5"
,
FEC_4_5
},
{
"5/6"
,
FEC_5_6
},
{
"6/7"
,
FEC_6_7
},
{
"7/8"
,
FEC_7_8
},
{
"8/9"
,
FEC_8_9
},
{
"9/10"
,
FEC_9_10
},
{
VLC_FEC
(
2
,
3
),
FEC_2_3
},
{
VLC_FEC
(
3
,
4
),
FEC_3_4
},
{
VLC_FEC
(
3
,
5
),
FEC_3_5
},
{
VLC_FEC
(
4
,
5
),
FEC_4_5
},
{
VLC_FEC
(
5
,
6
),
FEC_5_6
},
{
VLC_FEC
(
6
,
7
),
FEC_6_7
},
{
VLC_FEC
(
7
,
8
),
FEC_7_8
},
{
VLC_FEC
(
8
,
9
),
FEC_8_9
},
{
VLC_FEC
(
9
,
10
),
FEC_9_10
},
{
VLC_FEC_AUTO
,
FEC_AUTO
},
};
return
dvb_parse_
str
(
str
,
rates
,
sizeof
(
rates
)
/
sizeof
(
*
rates
),
return
dvb_parse_
int
(
fec
,
rates
,
sizeof
(
rates
)
/
sizeof
(
*
rates
),
FEC_AUTO
);
}
...
...
@@ -531,10 +533,10 @@ int dvb_tune (dvb_device_t *d)
/*** DVB-C ***/
int
dvb_set_dvbc
(
dvb_device_t
*
d
,
uint32_t
freq
,
const
char
*
modstr
,
uint32_t
srate
,
const
char
*
fecstr
)
uint32_t
srate
,
uint32_t
fec
)
{
unsigned
mod
=
dvb_parse_modulation
(
modstr
,
QAM_AUTO
);
unsigned
fec
=
dvb_parse_fec
(
fecstr
);
fec
=
dvb_parse_fec
(
fec
);
return
dvb_set_props
(
d
,
6
,
DTV_CLEAR
,
0
,
DTV_DELIVERY_SYSTEM
,
SYS_DVBC_ANNEX_AC
,
...
...
@@ -655,10 +657,9 @@ known:
return
dvb_set_props
(
d
,
2
,
DTV_FREQUENCY
,
freq
,
DTV_TONE
,
tone
);
}
int
dvb_set_dvbs
(
dvb_device_t
*
d
,
uint32_t
freq
,
uint32_t
srate
,
const
char
*
fecstr
)
int
dvb_set_dvbs
(
dvb_device_t
*
d
,
uint32_t
freq
,
uint32_t
srate
,
uint32_t
fec
)
{
unsigned
fec
=
dvb_parse_fec
(
fecstr
);
fec
=
dvb_parse_fec
(
fec
);
return
dvb_set_props
(
d
,
5
,
DTV_CLEAR
,
0
,
DTV_DELIVERY_SYSTEM
,
SYS_DVBS
,
DTV_FREQUENCY
,
freq
,
DTV_SYMBOL_RATE
,
srate
,
...
...
@@ -666,10 +667,10 @@ int dvb_set_dvbs (dvb_device_t *d, uint32_t freq,
}
int
dvb_set_dvbs2
(
dvb_device_t
*
d
,
uint32_t
freq
,
const
char
*
modstr
,
uint32_t
srate
,
const
char
*
fecstr
,
int
pilot
,
int
rolloff
)
uint32_t
srate
,
uint32_t
fec
,
int
pilot
,
int
rolloff
)
{
unsigned
mod
=
dvb_parse_modulation
(
modstr
,
QPSK
);
unsigned
fec
=
dvb_parse_fec
(
fecstr
);
fec
=
dvb_parse_fec
(
fec
);
switch
(
pilot
)
{
...
...
@@ -742,12 +743,12 @@ static int dvb_parse_hierarchy (int i)
}
int
dvb_set_dvbt
(
dvb_device_t
*
d
,
uint32_t
freq
,
const
char
*
modstr
,
const
char
*
fechstr
,
const
char
*
feclstr
,
uint32_t
bandwidth
,
uint32_t
fec_hp
,
uint32_t
fec_lp
,
uint32_t
bandwidth
,
int
transmit_mode
,
uint32_t
guard
,
int
hierarchy
)
{
uint32_t
mod
=
dvb_parse_modulation
(
modstr
,
QAM_AUTO
);
uint32_t
fec_hp
=
dvb_parse_fec
(
fechstr
);
uint32_t
fec_lp
=
dvb_parse_fec
(
feclstr
);
fec_hp
=
dvb_parse_fec
(
fec_hp
);
fec_lp
=
dvb_parse_fec
(
fec_lp
);
bandwidth
*=
1000000
;
transmit_mode
=
dvb_parse_transmit_mode
(
transmit_mode
);
guard
=
dvb_parse_guard
(
guard
);
...
...
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