Triode,
On reflection, I think your dsd.c code does what it should, except for
the belief that the actual number of sample_bytes per track for each
channel must be even. When the source of the DSD is a DSF file rather
than a DoP-encoded PCM file, there is no such constraint (the record
companies had no concept of DoP encoding or its constraints when they
authored the tracks). Thus the error trap as you have it is currently a
bit trigger happy, and will give errors and warnings whenever there
happens to be an odd number of sample_bytes, which should occur with 50%
probability.
If I am right in my analysis, you might want to silently accept the case
of one sample byte left over, but still trap the zero case.
Just to illustrate my meaning:
Code:
--------------------
diff --git a/dsd.c b/dsd.c
index 691d9cc..d1c9102 100644
--- a/dsd.c
+++ b/dsd.c
@@ -249,9 +249,18 @@ static decode_state _decode_dsf(void) {
frames = min(bytes, d->sample_bytes) / bytes_per_frame;
if (frames == 0) {
- // /2 for dop should never result in 0 as header len
is always even
- LOG_WARN("frames got to zero");
- return DECODE_ERROR;
+ if (d->sample_bytes == 1) {
+ LOG_INFO("had one Byte left over,
insufficient to DOP encode");
+ LOG_INFO("sample bytes: " FMT_u64,
d->sample_bytes);
+ return DECODE_COMPLETE;
+ }
+ else {
+ // we really did get to zero, shouldn't happen
+ LOG_WARN("frames got to zero");
+ LOG_WARN("sample bytes: " FMT_u64,
d->sample_bytes);
+ LOG_WARN("bytes: %u", bytes);
+ return DECODE_ERROR;
+ }
}
frames = min(frames, out);
--------------------
----------------------
"Dreamer, easy in the chair that really fits you..."
------------------------------------------------------------------------
dsdreamer's Profile: http://forums.slimdevices.com/member.php?userid=12588
View this thread: http://forums.slimdevices.com/showthread.php?t=99395
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix