< prev index next >

modules/javafx.media/src/main/native/jfxmedia/platform/osx/avf/AVFMediaPlayer.mm

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 2014, 2020, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -85,11 +85,11 @@
  #define TRACK_LOG(...) {}
  #endif
  
  @implementation AVFMediaPlayer
  
- static void SpectrumCallbackProc(void *context, double duration);
+ static void SpectrumCallbackProc(void *context, double duration, double timestamp);
  
  static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink,
                                      const CVTimeStamp *inNow,
                                      const CVTimeStamp *inOutputTime,
                                      CVOptionFlags flagsIn,

@@ -649,23 +649,25 @@
          eventHandler->SendFrameSizeChangedEvent(previousWidth, previousHeight);
      }
      eventHandler->SendNewFrameEvent(frame);
  }
  
- - (void) sendSpectrumEventDuration:(double)duration {
+ - (void) sendSpectrumEventDuration:(double)duration timestamp:(double)timestamp {
      if (eventHandler) {
-         double timestamp = self.currentTime;
+         if (timestamp < 0) {
+             timestamp = self.currentTime;
+         }
          eventHandler->SendAudioSpectrumEvent(timestamp, duration);
      }
  }
  
  @end
  
- static void SpectrumCallbackProc(void *context, double duration) {
+ static void SpectrumCallbackProc(void *context, double duration, double timestamp) {
      if (context) {
          AVFMediaPlayer *player = (__bridge AVFMediaPlayer*)context;
-         [player sendSpectrumEventDuration:duration];
+         [player sendSpectrumEventDuration:duration timestamp:timestamp];
      }
  }
  
  static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext)
  {
< prev index next >