Prevent crashes with 8 channel sound assets.
authorCarl Hetherington <cth@carlh.net>
Mon, 3 Dec 2012 14:18:44 +0000 (14:18 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 3 Dec 2012 14:18:44 +0000 (14:18 +0000)
src/sound_asset.cc
src/types.h

index 0d0e1cd4e7408c0ebe09af61dee2aeb262edbe72..500a72e5c09e73219aa01b82a6474d4add87fb46 100644 (file)
@@ -115,9 +115,14 @@ SoundAsset::construct (boost::function<string (Channel)> get_path)
                CENTRE,
                LFE,
                LS,
-               RS
+               RS,
+               /* XXX: not quite sure what these should be yet */
+               CHANNEL_7,
+               CHANNEL_8
        };
 
+       assert (int(_channels) <= int(sizeof(channels) / sizeof(Channel)));
+
        ASDCP::PCM::FrameBuffer frame_buffer_channel[_channels];
        ASDCP::PCM::AudioDescriptor audio_desc_channel[_channels];
 
index 133c229d44819cac404268878d6a0db24480da63..433a910cddf9423ca9d63281f881a2419beaa9dc 100644 (file)
@@ -29,12 +29,14 @@ namespace libdcp
 
 /** Identifier for a sound channel */
 enum Channel {
-       LEFT = 0,    ///< left
-       RIGHT = 1,   ///< right
-       CENTRE = 2,  ///< centre
-       LFE = 3,     ///< low-frequency effects (sub)
-       LS = 4,      ///< left surround
-       RS = 5       ///< right surround
+       LEFT = 0,      ///< left
+       RIGHT = 1,     ///< right
+       CENTRE = 2,    ///< centre
+       LFE = 3,       ///< low-frequency effects (sub)
+       LS = 4,        ///< left surround
+       RS = 5,        ///< right surround
+       CHANNEL_7 = 6, ///< channel 7; not sure what this should be called
+       CHANNEL_8 = 7  ///< channel 8; not sure what this should be called
 };
 
 enum ContentKind