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
457a994e
Commit
457a994e
authored
Aug 21, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v4l2: revector tuner setup
So the code is reusable for radio device nodes.
parent
0db42003
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
28 deletions
+25
-28
modules/access/v4l2/video.c
modules/access/v4l2/video.c
+25
-28
No files found.
modules/access/v4l2/video.c
View file @
457a994e
...
...
@@ -116,28 +116,13 @@ static int SetupAudio (vlc_object_t *obj, int fd,
return
0
;
}
static
int
SetupTuner
(
vlc_object_t
*
obj
,
int
fd
,
const
struct
v4l2_input
*
restrict
input
)
static
int
SetupTuner
(
vlc_object_t
*
obj
,
int
fd
,
uint32_t
idx
)
{
switch
(
input
->
type
)
{
case
V4L2_INPUT_TYPE_TUNER
:
msg_Dbg
(
obj
,
"tuning required: tuner %"
PRIu32
,
input
->
tuner
);
break
;
case
V4L2_INPUT_TYPE_CAMERA
:
msg_Dbg
(
obj
,
"no tuning required (analog baseband input)"
);
return
0
;
default:
msg_Err
(
obj
,
"unknown input tuning type %"
PRIu32
,
input
->
type
);
return
0
;
// hopefully we can stream regardless...
}
struct
v4l2_tuner
tuner
=
{
.
index
=
input
->
tuner
};
struct
v4l2_tuner
tuner
=
{
.
index
=
idx
};
if
(
v4l2_ioctl
(
fd
,
VIDIOC_G_TUNER
,
&
tuner
)
<
0
)
{
msg_Err
(
obj
,
"cannot get tuner %"
PRIu32
" properties: %m"
,
input
->
tuner
);
msg_Err
(
obj
,
"cannot get tuner %"
PRIu32
" properties: %m"
,
idx
);
return
-
1
;
}
...
...
@@ -194,31 +179,29 @@ static int SetupTuner (vlc_object_t *obj, int fd,
if
(
v4l2_ioctl
(
fd
,
VIDIOC_S_TUNER
,
&
tuner
)
<
0
)
{
msg_Err
(
obj
,
"cannot set tuner %"
PRIu32
" audio mode: %m"
,
input
->
tuner
);
msg_Err
(
obj
,
"cannot set tuner %"
PRIu32
" audio mode: %m"
,
idx
);
return
-
1
;
}
msg_Dbg
(
obj
,
"tuner %"
PRIu32
" audio mode %u set"
,
input
->
tuner
,
tuner
.
audmode
);
msg_Dbg
(
obj
,
"tuner %"
PRIu32
" audio mode %u set"
,
idx
,
tuner
.
audmode
);
/* Tune to the requested frequency */
uint32_t
freq
=
var_InheritInteger
(
obj
,
CFG_PREFIX
"tuner-frequency"
);
if
(
freq
!=
(
uint32_t
)
-
1
)
{
struct
v4l2_frequency
frequency
=
{
.
tuner
=
i
nput
->
tuner
,
.
type
=
V4L2_TUNER_ANALOG_TV
,
.
tuner
=
i
dx
,
.
type
=
tuner
.
type
,
.
frequency
=
freq
*
125
/
2
};
if
(
v4l2_ioctl
(
fd
,
VIDIOC_S_FREQUENCY
,
&
frequency
)
<
0
)
{
msg_Err
(
obj
,
"cannot tune tuner %
u to frequency %u %sHz: %m"
,
input
->
tuner
,
freq
,
mult
);
msg_Err
(
obj
,
"cannot tune tuner %
"
PRIu32
" to frequency %u %sHz: %m"
,
idx
,
freq
,
mult
);
return
-
1
;
}
msg_Dbg
(
obj
,
"tuner %"
PRIu32
" tuned to frequency %"
PRIu32
" %sHz"
,
i
nput
->
tuner
,
freq
,
mult
);
i
dx
,
freq
,
mult
);
}
else
msg_Dbg
(
obj
,
"tuner not tuned"
);
...
...
@@ -285,7 +268,21 @@ int SetupInput (vlc_object_t *obj, int fd)
msg_Dbg
(
obj
,
"selected input %"
PRIu32
,
input
.
index
);
SetupStandard
(
obj
,
fd
,
&
input
);
SetupTuner
(
obj
,
fd
,
&
input
);
switch
(
input
.
type
)
{
case
V4L2_INPUT_TYPE_TUNER
:
msg_Dbg
(
obj
,
"tuning required: tuner %"
PRIu32
,
input
.
tuner
);
SetupTuner
(
obj
,
fd
,
input
.
tuner
);
break
;
case
V4L2_INPUT_TYPE_CAMERA
:
msg_Dbg
(
obj
,
"no tuning required (analog baseband input)"
);
break
;
default:
msg_Err
(
obj
,
"unknown input tuning type %"
PRIu32
,
input
.
type
);
break
;
// hopefully we can stream regardless...
}
SetupAudio
(
obj
,
fd
,
&
input
);
return
0
;
}
...
...
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