4040 float right_pan;
4141};
4242
43- bool MCAVPlayerCreateAudioProcessingTap (MCAVPlayerPanningFilter *p_panning_filter, MTAudioProcessingTapRef &r_tap);
44- bool MCAVPlayerSetupPanningFilter (AVPlayer *p_player, MTAudioProcessingTapRef p_tap);
43+ bool MCAVPlayerSetupPanningFilter (AVPlayer *p_player, MCAVPlayerPanningFilter *p_panning_filter);
4544void MCAVPlayerRemovePanningFilter (AVPlayer *p_player);
4645
4746// //////////////////////////////////////////////////////////////////////////////
@@ -155,7 +154,6 @@ static CVReturn MyDisplayLinkCallback (CVDisplayLinkRef displayLink,
155154 double m_right_balance;
156155 double m_pan;
157156
158- MTAudioProcessingTapRef m_audio_processing_tap;
159157 MCAVPlayerPanningFilter m_panning_filter;
160158
161159 CMTimeScale m_time_scale;
@@ -306,7 +304,6 @@ - (void)setPlayer:(AVPlayer *)player
306304 // an AVPlayer until we load, so that starts off as nil and we create a PlayerView
307305 // with zero frame.
308306 m_player = nil ;
309- m_audio_processing_tap = nil ;
310307 m_view = [[com_runrev_livecode_MCAVFoundationPlayerView alloc ] initWithFrame: NSZeroRect ];
311308 m_observer = [[com_runrev_livecode_MCAVFoundationPlayerObserver alloc ] initWithPlayer: this ];
312309
@@ -395,14 +392,12 @@ - (void)setPlayer:(AVPlayer *)player
395392 [m_view release ];
396393
397394 // Finally we can release the player.
395+ Unload ();
398396 [m_player release ];
399397
400398 // Release the video output
401399 [m_player_item_video_output release ];
402400
403- if (m_audio_processing_tap)
404- CFRelease (m_audio_processing_tap);
405-
406401 MCMemoryDeleteArray (m_markers);
407402
408403 [m_lock release ];
@@ -768,8 +763,6 @@ - (void)setPlayer:(AVPlayer *)player
768763
769764 // Now set the player of the view.
770765 [m_view setPlayer: m_player];
771-
772- MCAVPlayerCreateAudioProcessingTap (&m_panning_filter, m_audio_processing_tap);
773766 }
774767 // Ensure that removing the video source from the property inspector results immediately in empty player with the controller thumb in the beginning
775768 if (MCStringIsEmpty (p_filename_or_url))
@@ -823,7 +816,7 @@ - (void)setPlayer:(AVPlayer *)player
823816 return ;
824817 }
825818
826- /* UNCHECKED */ MCAVPlayerSetupPanningFilter (m_player, m_audio_processing_tap );
819+ /* UNCHECKED */ MCAVPlayerSetupPanningFilter (m_player, &m_panning_filter );
827820
828821 m_has_invalid_filename = false ;
829822
@@ -1023,7 +1016,7 @@ bool MCAVPlayerCreateAudioProcessingTap(MCAVPlayerPanningFilter *p_panning_filte
10231016 return true ;
10241017}
10251018
1026- bool MCAVPlayerSetupPanningFilter (AVPlayer *p_player, MTAudioProcessingTapRef p_tap )
1019+ bool MCAVPlayerSetupPanningFilter (AVPlayer *p_player, MCAVPlayerPanningFilter *p_panning_filter )
10271020{
10281021 AVPlayerItem *t_current_item = [p_player currentItem ];
10291022
@@ -1036,7 +1029,11 @@ bool MCAVPlayerSetupPanningFilter(AVPlayer *p_player, MTAudioProcessingTapRef p_
10361029 {
10371030 AVMutableAudioMixInputParameters *t_inputparams;
10381031 t_inputparams = [AVMutableAudioMixInputParameters audioMixInputParametersWithTrack: t_assettrack];
1039- t_inputparams.audioTapProcessor = p_tap;
1032+
1033+ MTAudioProcessingTapRef t_tap = nil ;
1034+ /* UNCHECKED */ MCAVPlayerCreateAudioProcessingTap (p_panning_filter, t_tap);
1035+ t_inputparams.audioTapProcessor = t_tap;
1036+ CFRelease (t_tap);
10401037
10411038 [t_inputparam_array addObject: t_inputparams];
10421039 }
0 commit comments