| @@ -133,31 +133,31 @@ public: | |||||
| trackUnitsPerFrame = GetMovieTimeScale (movie) * samplesPerFrame | trackUnitsPerFrame = GetMovieTimeScale (movie) * samplesPerFrame | ||||
| / GetMediaTimeScale (media); | / GetMediaTimeScale (media); | ||||
| OSStatus err = MovieAudioExtractionBegin (movie, 0, &extractor); | |||||
| MovieAudioExtractionBegin (movie, 0, &extractor); | |||||
| unsigned long output_layout_size; | unsigned long output_layout_size; | ||||
| err = MovieAudioExtractionGetPropertyInfo (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| 0, &output_layout_size, 0); | |||||
| OSStatus err = MovieAudioExtractionGetPropertyInfo (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| 0, &output_layout_size, 0); | |||||
| if (err != noErr) | if (err != noErr) | ||||
| return; | return; | ||||
| HeapBlock <AudioChannelLayout> qt_audio_channel_layout; | HeapBlock <AudioChannelLayout> qt_audio_channel_layout; | ||||
| qt_audio_channel_layout.calloc (output_layout_size, 1); | qt_audio_channel_layout.calloc (output_layout_size, 1); | ||||
| err = MovieAudioExtractionGetProperty (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| output_layout_size, qt_audio_channel_layout, 0); | |||||
| MovieAudioExtractionGetProperty (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| output_layout_size, qt_audio_channel_layout, 0); | |||||
| qt_audio_channel_layout[0].mChannelLayoutTag = kAudioChannelLayoutTag_Stereo; | qt_audio_channel_layout[0].mChannelLayoutTag = kAudioChannelLayoutTag_Stereo; | ||||
| err = MovieAudioExtractionSetProperty (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| output_layout_size, | |||||
| qt_audio_channel_layout); | |||||
| MovieAudioExtractionSetProperty (extractor, | |||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | |||||
| kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout, | |||||
| output_layout_size, | |||||
| qt_audio_channel_layout); | |||||
| err = MovieAudioExtractionGetProperty (extractor, | err = MovieAudioExtractionGetProperty (extractor, | ||||
| kQTPropertyClass_MovieAudioExtraction_Audio, | kQTPropertyClass_MovieAudioExtraction_Audio, | ||||
| @@ -279,8 +279,7 @@ public: | |||||
| inline ElementType getFirst() const | inline ElementType getFirst() const | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| return (numUsed > 0) ? data.elements [0] | |||||
| : ElementType(); | |||||
| return numUsed > 0 ? data.elements[0] : ElementType(); | |||||
| } | } | ||||
| /** Returns the last element in the array, or a default value if the array is empty. | /** Returns the last element in the array, or a default value if the array is empty. | ||||
| @@ -290,8 +289,7 @@ public: | |||||
| inline ElementType getLast() const | inline ElementType getLast() const | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| return (numUsed > 0) ? data.elements [numUsed - 1] | |||||
| : ElementType(); | |||||
| return numUsed > 0 ? data.elements[numUsed - 1] : ElementType(); | |||||
| } | } | ||||
| /** Returns a pointer to the actual array data. | /** Returns a pointer to the actual array data. | ||||
| @@ -317,6 +315,11 @@ public: | |||||
| */ | */ | ||||
| inline ElementType* end() const noexcept | inline ElementType* end() const noexcept | ||||
| { | { | ||||
| #if JUCE_DEBUG | |||||
| if (data.elements == nullptr || numUsed <= 0) // (to keep static analysers happy) | |||||
| return data.elements; | |||||
| #endif | |||||
| return data.elements + numUsed; | return data.elements + numUsed; | ||||
| } | } | ||||
| @@ -519,6 +522,7 @@ public: | |||||
| if (isPositiveAndBelow (indexToChange, numUsed)) | if (isPositiveAndBelow (indexToChange, numUsed)) | ||||
| { | { | ||||
| jassert (data.elements != nullptr); | |||||
| data.elements [indexToChange] = newValue; | data.elements [indexToChange] = newValue; | ||||
| } | } | ||||
| else if (indexToChange >= 0) | else if (indexToChange >= 0) | ||||
| @@ -167,7 +167,7 @@ public: | |||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| return numUsed > 0 ? data.elements [0] | return numUsed > 0 ? data.elements [0] | ||||
| : static_cast <ObjectClass*> (nullptr); | |||||
| : static_cast<ObjectClass*> (nullptr); | |||||
| } | } | ||||
| /** Returns a pointer to the last object in the array. | /** Returns a pointer to the last object in the array. | ||||
| @@ -179,7 +179,7 @@ public: | |||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| return numUsed > 0 ? data.elements [numUsed - 1] | return numUsed > 0 ? data.elements [numUsed - 1] | ||||
| : static_cast <ObjectClass*> (nullptr); | |||||
| : static_cast<ObjectClass*> (nullptr); | |||||
| } | } | ||||
| /** Returns a pointer to the actual array data. | /** Returns a pointer to the actual array data. | ||||
| @@ -205,6 +205,11 @@ public: | |||||
| */ | */ | ||||
| inline ObjectClass** end() const noexcept | inline ObjectClass** end() const noexcept | ||||
| { | { | ||||
| #if JUCE_DEBUG | |||||
| if (data.elements == nullptr || numUsed <= 0) // (to keep static analysers happy) | |||||
| return data.elements; | |||||
| #endif | |||||
| return data.elements + numUsed; | return data.elements + numUsed; | ||||
| } | } | ||||
| @@ -180,6 +180,7 @@ public: | |||||
| inline ObjectClass* getObjectPointer (const int index) const noexcept | inline ObjectClass* getObjectPointer (const int index) const noexcept | ||||
| { | { | ||||
| const ScopedLockType lock (getLock()); | const ScopedLockType lock (getLock()); | ||||
| jassert (isPositiveAndBelow (index, numUsed)); | |||||
| return isPositiveAndBelow (index, numUsed) ? data.elements [index] | return isPositiveAndBelow (index, numUsed) ? data.elements [index] | ||||
| : nullptr; | : nullptr; | ||||
| } | } | ||||