Lines 1-7
Link Here
|
1 |
Support 24bit audio see Comment 6 of |
1 |
Support 24bit audio see Comment 6 of |
2 |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198567 |
2 |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198567 |
3 |
|
3 |
|
4 |
--- src/modules/oss/oss-util.c.orig 2015-09-10 04:51:41 UTC |
4 |
--- src/modules/oss/oss-util.c.orig 2018-07-13 19:06:14 UTC |
5 |
+++ src/modules/oss/oss-util.c |
5 |
+++ src/modules/oss/oss-util.c |
6 |
@@ -39,6 +39,22 @@ |
6 |
@@ -39,6 +39,22 @@ |
7 |
|
7 |
|
Lines 37-39
Link Here
|
37 |
[PA_SAMPLE_S24_32LE] = AFMT_QUERY, /* not supported */ |
37 |
[PA_SAMPLE_S24_32LE] = AFMT_QUERY, /* not supported */ |
38 |
[PA_SAMPLE_S24_32BE] = AFMT_QUERY, /* not supported */ |
38 |
[PA_SAMPLE_S24_32BE] = AFMT_QUERY, /* not supported */ |
39 |
}; |
39 |
}; |
|
|
40 |
@@ -348,7 +364,7 @@ int pa_oss_get_hw_description(const char |
41 |
} |
42 |
|
43 |
while (!feof(f)) { |
44 |
- char line[64]; |
45 |
+ char line[1024]; |
46 |
int device; |
47 |
|
48 |
if (!fgets(line, sizeof(line), f)) |
49 |
@@ -357,26 +373,36 @@ int pa_oss_get_hw_description(const char |
50 |
line[strcspn(line, "\r\n")] = 0; |
51 |
|
52 |
if (!b) { |
53 |
- b = pa_streq(line, "Audio devices:"); |
54 |
+ b = pa_streq(line, "Installed devices:"); |
55 |
continue; |
56 |
} |
57 |
|
58 |
if (line[0] == 0) |
59 |
break; |
60 |
|
61 |
- if (sscanf(line, "%i: ", &device) != 1) |
62 |
+ if (sscanf(line, "%*[a-z]%i: ", &device) != 1) |
63 |
continue; |
64 |
|
65 |
if (device == n) { |
66 |
char *k = strchr(line, ':'); |
67 |
pa_assert(k); |
68 |
+ const size_t klen = strlen(line) - strlen(k) + 1; |
69 |
+ char nameunit[klen + 1]; |
70 |
+ nameunit[klen] = '\0'; |
71 |
+ strncpy(nameunit, line, klen); |
72 |
k++; |
73 |
- k += strspn(k, " "); |
74 |
+ k += strspn(k, " <"); |
75 |
+ const char *e = strrchr(k, '>'); |
76 |
|
77 |
- if (pa_endswith(k, " (DUPLEX)")) |
78 |
- k[strlen(k)-9] = 0; |
79 |
+ if (!e) |
80 |
+ break; |
81 |
|
82 |
- pa_strlcpy(name, k, l); |
83 |
+ const size_t len = strlen(k) - strlen(e); |
84 |
+ char desc[len + 1]; |
85 |
+ desc[len] = '\0'; |
86 |
+ strncpy(desc, k, len); |
87 |
+ |
88 |
+ pa_snprintf(name, l, "%s %s", nameunit, desc); |
89 |
r = 0; |
90 |
break; |
91 |
} |