mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-03 15:32:54 +01:00
Huawei: Use default value for channels. Parse sample rates.
This commit is contained in:
parent
d23c931f95
commit
3bb44d8050
@ -24,6 +24,7 @@ import android.text.TextUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
@ -91,7 +92,7 @@ public class HuaweiInstallHandler implements InstallHandler {
|
||||
LOG.info("bitrate {}", restrictions.bitrate);
|
||||
LOG.info("channels {}", restrictions.channels);
|
||||
LOG.info("musicEncode {}", restrictions.musicEncode);
|
||||
LOG.info("sampleRate {}", restrictions.sampleRate);
|
||||
LOG.info("sampleRate {}", Arrays.toString(restrictions.sampleRates));
|
||||
LOG.info("unknownBitrate {}", restrictions.unknownBitrate);
|
||||
|
||||
if(currentMusicInfo.getChannels() > restrictions.channels) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.devices.huawei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class HuaweiMusicUtils {
|
||||
@ -32,10 +33,10 @@ public class HuaweiMusicUtils {
|
||||
|
||||
public static class FormatRestrictions {
|
||||
public byte formatIdx = -1;
|
||||
public int sampleRate = -1; // TODO: not sure
|
||||
public String[] sampleRates = null;
|
||||
public byte musicEncode = -1; // TODO: not sure
|
||||
public short bitrate = -1;
|
||||
public byte channels = -1;
|
||||
public byte channels = 2;
|
||||
public short unknownBitrate = -1; // TODO: not sure
|
||||
|
||||
// TODO: I am not sure about this. Most of formats unknown for me.
|
||||
@ -49,7 +50,7 @@ public class HuaweiMusicUtils {
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("FormatRestrictions{");
|
||||
sb.append("formatIdx=").append(formatIdx);
|
||||
sb.append(", sampleRate=").append(sampleRate);
|
||||
sb.append(", sampleRates=").append(Arrays.toString(sampleRates));
|
||||
sb.append(", musicEncode=").append(musicEncode);
|
||||
sb.append(", bitrate=").append(bitrate);
|
||||
sb.append(", channels=").append(channels);
|
||||
|
@ -343,8 +343,10 @@ public class MusicControl {
|
||||
HuaweiMusicUtils.FormatRestrictions restriction = new HuaweiMusicUtils.FormatRestrictions();
|
||||
if (subTlv.contains(0x08))
|
||||
restriction.formatIdx = subTlv.getByte(0x08);
|
||||
if (subTlv.contains(0x09))
|
||||
restriction.sampleRate = subTlv.getInteger(0x09);
|
||||
if (subTlv.contains(0x09)) {
|
||||
String sampleRates = subTlv.getString(0x09);
|
||||
restriction.sampleRates = sampleRates.split(",");
|
||||
}
|
||||
if (subTlv.contains(0x0a))
|
||||
restriction.musicEncode = subTlv.getByte(0x0a);
|
||||
if (subTlv.contains(0x0b))
|
||||
|
Loading…
Reference in New Issue
Block a user