Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mqa
Manage
Activity
Members
Labels
Plan
Issues
6
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mans Rullgard
mqa
Commits
c4d34b41
Commit
c4d34b41
authored
7 years ago
by
Mans Rullgard
Browse files
Options
Downloads
Patches
Plain Diff
mqadec: detect bluos api version
parent
d44e5a57
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bluos_ssc.h
+1
-0
1 addition, 0 deletions
bluos_ssc.h
mqadec.c
+35
-3
35 additions, 3 deletions
mqadec.c
with
36 additions
and
3 deletions
bluos_ssc.h
+
1
−
0
View file @
c4d34b41
...
...
@@ -26,6 +26,7 @@ struct ssc_decode *ssc_decode_open(int *channels, int *rate1,
int
*
fd
,
void
**
cb_data
,
int
options
,
const
char
*
device
);
int
ssc_decode_read
(
struct
ssc_decode
*
);
const
char
*
ssc_decode_device
(
struct
ssc_decode
*
);
const
char
*
ssc_decode_status
(
struct
ssc_decode
*
);
void
ssc_decode_close
(
struct
ssc_decode
*
);
...
...
This diff is collapsed.
Click to expand it.
mqadec.c
+
35
−
3
View file @
c4d34b41
...
...
@@ -35,6 +35,8 @@
#define BUF_SIZE 4096
static
int
bluos_api
;
static
SNDFILE
*
infile
;
static
SF_INFO
infmt
;
static
uint8_t
buf
[
BUF_SIZE
];
...
...
@@ -85,7 +87,10 @@ static int get_samples(int frame_size, uint8_t **samples, int eof, int *end)
*
samples
=
&
buf
[
buf_pos
];
return
size
/
frame_size
;
if
(
bluos_api
>
0
)
size
/=
frame_size
;
return
size
;
}
static
void
consume
(
int
len
)
...
...
@@ -97,8 +102,12 @@ static void consume(int len)
static
size_t
write_samples
(
void
*
p
,
void
*
buf
,
size_t
len
)
{
int32_t
*
s
=
buf
;
size_t
ret
;
int
i
;
if
(
bluos_api
<
1
)
len
/=
8
;
samples_out
+=
len
;
if
(
!
outfile
)
{
...
...
@@ -120,17 +129,23 @@ static size_t write_samples(void *p, void *buf, size_t len)
for
(
i
=
0
;
i
<
len
*
2
;
i
++
)
s
[
i
]
<<=
8
;
return
sf_writef_int
(
outfile
,
s
,
len
);
ret
=
sf_writef_int
(
outfile
,
s
,
len
);
if
(
bluos_api
<
1
)
ret
*=
8
;
return
ret
;
}
static
int
write_size
(
void
*
p
)
{
return
BUF_SIZE
;
return
bluos_api
<
1
?
BUF_SIZE
*
8
:
BUF_SIZE
;
}
int
main
(
int
argc
,
char
**
argv
)
{
struct
ssc_decode
*
sscd
;
const
char
*
dev
;
int
dummy
=
0
;
int
channels
=
2
;
int
rate1
=
0
;
...
...
@@ -138,6 +153,7 @@ int main(int argc, char **argv)
int
bits
=
32
;
int
options
=
0
;
int
mqa
=
0
;
int
nc
=
0
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"o:r:"
))
!=
-
1
)
{
...
...
@@ -180,6 +196,22 @@ int main(int argc, char **argv)
return
1
;
}
dev
=
ssc_decode_device
(
sscd
);
while
((
dev
=
strchr
(
dev
,
','
)))
{
dev
++
;
nc
++
;
}
if
(
nc
==
2
)
{
bluos_api
=
0
;
}
else
if
(
nc
==
3
)
{
bluos_api
=
1
;
}
else
{
fprintf
(
stderr
,
"warning: unknown libbluos_ssc version
\n
"
);
bluos_api
=
1
;
}
while
(
ssc_decode_read
(
sscd
)
>
0
)
{
if
(
!
mqa
)
{
const
char
*
s
=
ssc_decode_status
(
sscd
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment