path: root/demux/demux_raw.c
diff options
authorwm4 <wm4@nowhere>2014-09-23 22:44:54 +0200
committerwm4 <wm4@nowhere>2014-09-23 23:11:54 +0200
commit81bf9a196303f9d7a37db9365fc75022cb1eff19 (patch)
treeaea2758408e4fd1599cb34a7030f87f50f5d125c /demux/demux_raw.c
parent308d72a02ee673fc56b637b6134dd63ea258580c (diff)
audio: cleanup spdif format definitions
Before this commit, there was AF_FORMAT_AC3 (the original spdif format, used for AC3 and DTS core), and AF_FORMAT_IEC61937 (used for AC3, DTS and DTS-HD), which was handled as some sort of superset for AF_FORMAT_AC3. There also was AF_FORMAT_MPEG2, which used IEC61937-framing, but still was handled as something "separate". Technically, all of them are pretty similar, but may use different bitrates. Since digital passthrough pretends to be PCM (just with special headers that wrap digital packets), this is easily detectable by the higher samplerate or higher number of channels, so I don't know why you'd need a separate "class" of sample formats (AF_FORMAT_AC3 vs. AF_FORMAT_IEC61937) to distinguish them. Actually, this whole thing is just a mess. Simplify this by handling all these formats the same way. AF_FORMAT_IS_IEC61937() now returns 1 for all spdif formats (even MP3). All AOs just accept all spdif formats now - whether that works or not is not really clear (seems inconsistent due to earlier attempts to make DTS-HD work). But on the other hand, enabling spdif requires manual user interaction, so it doesn't matter much if initialization fails in slightly less graceful ways if it can't work at all. At a later point, we will support passthrough with ao_pulse. It seems the PulseAudio API wants to know the codec type (or maybe not - feeding it DTS while telling it it's AC3 works), add separate formats for each codecs. While this reminds of the earlier chaos, it's stricter, and most code just uses AF_FORMAT_IS_IEC61937(). Also, modify AF_FORMAT_TYPE_MASK (renamed from AF_FORMAT_POINT_MASK) to include special formats, so that it always describes the fundamental sample format type. This also ensures valid AF formats are never 0 (this was probably broken in one of the earlier commits from today).
Diffstat (limited to 'demux/demux_raw.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux_raw.c b/demux/demux_raw.c
index 5dae30308a..552c74a2a3 100644
--- a/demux/demux_raw.c
+++ b/demux/demux_raw.c
@@ -110,7 +110,7 @@ static int demux_rawaudio_open(demuxer_t *demuxer, enum demux_check check)
return -1;
- if ((opts->aformat & AF_FORMAT_SPECIAL_MASK) != 0)
+ if (AF_FORMAT_IS_SPECIAL(opts->aformat))
return -1;
sh = new_sh_stream(demuxer, STREAM_AUDIO);