Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
75fe8bcf
Commit
75fe8bcf
authored
Apr 29, 2016
by
Sylvain Berfini
🐮
Browse files
Added missing get_sample_rate and get_nchannels methods to a few filters
parent
e998419b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
7 deletions
+37
-7
src/audiofilters/l16.c
src/audiofilters/l16.c
+21
-2
src/audiofilters/msfilerec.c
src/audiofilters/msfilerec.c
+16
-5
No files found.
src/audiofilters/l16.c
View file @
75fe8bcf
...
...
@@ -209,6 +209,24 @@ static void dec_process(MSFilter *f)
}
};
static
int
dec_get_sr
(
MSFilter
*
f
,
void
*
arg
){
int
*
sample_rate
=
(
int
*
)
arg
;
*
sample_rate
=
8000
;
return
0
;
}
static
int
dec_get_nchannels
(
MSFilter
*
f
,
void
*
arg
){
int
*
nchannels
=
(
int
*
)
arg
;
*
nchannels
=
1
;
return
0
;
}
static
MSFilterMethod
dec_methods
[]
=
{
{
MS_FILTER_GET_SAMPLE_RATE
,
dec_get_sr
},
{
MS_FILTER_GET_NCHANNELS
,
dec_get_nchannels
},
{
0
,
NULL
}
};
#ifdef _MSC_VER
MSFilterDesc
ms_l16_dec_desc
=
{
...
...
@@ -224,7 +242,7 @@ MSFilterDesc ms_l16_dec_desc={
dec_process
,
NULL
,
dec_uninit
,
NULL
dec_methods
};
#else
...
...
@@ -239,7 +257,8 @@ MSFilterDesc ms_l16_dec_desc={
.
noutputs
=
1
,
.
init
=
dec_init
,
.
process
=
dec_process
,
.
uninit
=
dec_uninit
.
uninit
=
dec_uninit
,
.
methods
=
dec_methods
};
#endif
...
...
src/audiofilters/msfilerec.c
View file @
75fe8bcf
...
...
@@ -203,12 +203,26 @@ static int rec_set_sr(MSFilter *f, void *arg){
return
0
;
}
static
int
rec_get_sr
(
MSFilter
*
f
,
void
*
arg
){
RecState
*
d
=
(
RecState
*
)
f
->
data
;
int
*
sample_rate
=
(
int
*
)
arg
;
*
sample_rate
=
d
->
rate
;
return
0
;
}
static
int
rec_set_nchannels
(
MSFilter
*
f
,
void
*
arg
)
{
RecState
*
s
=
(
RecState
*
)
f
->
data
;
s
->
nchannels
=
*
(
int
*
)
arg
;
return
0
;
}
static
int
rec_get_nchannels
(
MSFilter
*
f
,
void
*
arg
){
RecState
*
d
=
(
RecState
*
)
f
->
data
;
int
*
nchannels
=
(
int
*
)
arg
;
*
nchannels
=
d
->
nchannels
;
return
0
;
}
static
void
rec_uninit
(
MSFilter
*
f
){
RecState
*
s
=
(
RecState
*
)
f
->
data
;
if
(
s
->
fd
!=-
1
)
rec_close
(
f
,
NULL
);
...
...
@@ -229,11 +243,6 @@ static int rec_set_fmtp(MSFilter *f, void *arg){
d
->
rate
=
pinfmt
->
fmt
->
rate
;
d
->
nchannels
=
pinfmt
->
fmt
->
nchannels
;
d
->
mime
=
pinfmt
->
fmt
->
encoding
;
if
(
strcmp
(
d
->
mime
,
"L16"
)
==
0
)
{
d
->
swap
=
TRUE
;
}
else
{
d
->
swap
=
FALSE
;
}
ms_filter_unlock
(
f
);
return
0
;
}
...
...
@@ -241,6 +250,8 @@ static int rec_set_fmtp(MSFilter *f, void *arg){
static
MSFilterMethod
rec_methods
[]
=
{
{
MS_FILTER_SET_SAMPLE_RATE
,
rec_set_sr
},
{
MS_FILTER_SET_NCHANNELS
,
rec_set_nchannels
},
{
MS_FILTER_GET_SAMPLE_RATE
,
rec_get_sr
},
{
MS_FILTER_GET_NCHANNELS
,
rec_get_nchannels
},
{
MS_FILE_REC_OPEN
,
rec_open
},
{
MS_FILE_REC_START
,
rec_start
},
{
MS_FILE_REC_STOP
,
rec_stop
},
...
...
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