Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
a7c93dae
Commit
a7c93dae
authored
Jul 17, 2011
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jack: add 'channels' private option.
Get rid of AVFormatParameters usage.
parent
0e869655
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
jack_audio.c
libavdevice/jack_audio.c
+18
-6
No files found.
libavdevice/jack_audio.c
View file @
a7c93dae
...
...
@@ -26,6 +26,7 @@
#include "libavutil/log.h"
#include "libavutil/fifo.h"
#include "libavutil/opt.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavformat/timefilter.h"
...
...
@@ -36,6 +37,7 @@
#define FIFO_PACKETS_NUM 16
typedef
struct
{
AVClass
*
class
;
jack_client_t
*
client
;
int
activated
;
sem_t
packet_count
;
...
...
@@ -136,7 +138,7 @@ static int supply_new_packets(JackData *self, AVFormatContext *context)
return
0
;
}
static
int
start_jack
(
AVFormatContext
*
context
,
AVFormatParameters
*
params
)
static
int
start_jack
(
AVFormatContext
*
context
)
{
JackData
*
self
=
context
->
priv_data
;
jack_status_t
status
;
...
...
@@ -153,7 +155,6 @@ static int start_jack(AVFormatContext *context, AVFormatParameters *params)
sem_init
(
&
self
->
packet_count
,
0
,
0
);
self
->
sample_rate
=
jack_get_sample_rate
(
self
->
client
);
self
->
nports
=
params
->
channels
;
self
->
ports
=
av_malloc
(
self
->
nports
*
sizeof
(
*
self
->
ports
));
self
->
buffer_size
=
jack_get_buffer_size
(
self
->
client
);
...
...
@@ -225,10 +226,7 @@ static int audio_read_header(AVFormatContext *context, AVFormatParameters *param
AVStream
*
stream
;
int
test
;
if
(
params
->
sample_rate
<=
0
||
params
->
channels
<=
0
)
return
-
1
;
if
((
test
=
start_jack
(
context
,
params
)))
if
((
test
=
start_jack
(
context
)))
return
test
;
stream
=
av_new_stream
(
context
,
0
);
...
...
@@ -314,6 +312,19 @@ static int audio_read_close(AVFormatContext *context)
return
0
;
}
#define OFFSET(x) offsetof(JackData, x)
static
const
AVOption
options
[]
=
{
{
"channels"
,
"Number of audio channels."
,
OFFSET
(
nports
),
FF_OPT_TYPE_INT
,
{
2
},
1
,
INT_MAX
,
AV_OPT_FLAG_DECODING_PARAM
},
{
NULL
},
};
static
const
AVClass
jack_indev_class
=
{
.
class_name
=
"JACK indev"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
AVInputFormat
ff_jack_demuxer
=
{
"jack"
,
NULL_IF_CONFIG_SMALL
(
"JACK Audio Connection Kit"
),
...
...
@@ -323,4 +334,5 @@ AVInputFormat ff_jack_demuxer = {
audio_read_packet
,
audio_read_close
,
.
flags
=
AVFMT_NOFILE
,
.
priv_class
=
&
jack_indev_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