Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
a1a15a99
Commit
a1a15a99
authored
May 23, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sndio: add channels and sample_rate private options.
parent
fb37d573
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
sndio_common.h
libavdevice/sndio_common.h
+2
-0
sndio_dec.c
libavdevice/sndio_dec.c
+19
-5
No files found.
libavdevice/sndio_common.h
View file @
a1a15a99
...
@@ -26,8 +26,10 @@
...
@@ -26,8 +26,10 @@
#include <sndio.h>
#include <sndio.h>
#include "libavformat/avformat.h"
#include "libavformat/avformat.h"
#include "libavutil/log.h"
typedef
struct
{
typedef
struct
{
AVClass
*
class
;
struct
sio_hdl
*
hdl
;
struct
sio_hdl
*
hdl
;
enum
CodecID
codec_id
;
enum
CodecID
codec_id
;
int64_t
hwpos
;
int64_t
hwpos
;
...
...
libavdevice/sndio_dec.c
View file @
a1a15a99
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <sndio.h>
#include <sndio.h>
#include "libavformat/avformat.h"
#include "libavformat/avformat.h"
#include "libavutil/opt.h"
#include "sndio_common.h"
#include "sndio_common.h"
...
@@ -33,16 +34,15 @@ static av_cold int audio_read_header(AVFormatContext *s1,
...
@@ -33,16 +34,15 @@ static av_cold int audio_read_header(AVFormatContext *s1,
AVStream
*
st
;
AVStream
*
st
;
int
ret
;
int
ret
;
if
(
ap
->
sample_rate
<=
0
||
ap
->
channels
<=
0
)
if
(
ap
->
sample_rate
>
0
)
return
AVERROR
(
EINVAL
);
s
->
sample_rate
=
ap
->
sample_rate
;
if
(
ap
->
channels
>
0
)
s
->
channels
=
ap
->
channels
;
st
=
av_new_stream
(
s1
,
0
);
st
=
av_new_stream
(
s1
,
0
);
if
(
!
st
)
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
s
->
sample_rate
=
ap
->
sample_rate
;
s
->
channels
=
ap
->
channels
;
ret
=
ff_sndio_open
(
s1
,
0
,
s1
->
filename
);
ret
=
ff_sndio_open
(
s1
,
0
,
s1
->
filename
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -97,6 +97,19 @@ static av_cold int audio_read_close(AVFormatContext *s1)
...
@@ -97,6 +97,19 @@ static av_cold int audio_read_close(AVFormatContext *s1)
return
0
;
return
0
;
}
}
static
const
AVOption
options
[]
=
{
{
"sample_rate"
,
""
,
offsetof
(
SndioData
,
sample_rate
),
FF_OPT_TYPE_INT
,
{.
dbl
=
48000
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
"channels"
,
""
,
offsetof
(
SndioData
,
channels
),
FF_OPT_TYPE_INT
,
{.
dbl
=
2
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
NULL
},
};
static
const
AVClass
sndio_demuxer_class
=
{
.
class_name
=
"sndio indev"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVInputFormat
ff_sndio_demuxer
=
{
AVInputFormat
ff_sndio_demuxer
=
{
.
name
=
"sndio"
,
.
name
=
"sndio"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"sndio audio capture"
),
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"sndio audio capture"
),
...
@@ -105,4 +118,5 @@ AVInputFormat ff_sndio_demuxer = {
...
@@ -105,4 +118,5 @@ AVInputFormat ff_sndio_demuxer = {
.
read_packet
=
audio_read_packet
,
.
read_packet
=
audio_read_packet
,
.
read_close
=
audio_read_close
,
.
read_close
=
audio_read_close
,
.
flags
=
AVFMT_NOFILE
,
.
flags
=
AVFMT_NOFILE
,
.
priv_class
=
&
sndio_demuxer_class
,
};
};
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