Commit 75fe8bcf authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added missing get_sample_rate and get_nchannels methods to a few filters

parent e998419b
......@@ -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
......
......@@ -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 },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment