< prev index next >

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

Print this page
rev 10028 : 8156563: JavaFX Ensemble8 media sample hang and crash
Reviewed-by: almatvee, kcr
   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37 
  38 @interface AVFMediaPlayer : NSObject<OSXPlayerProtocol,AVPlayerItemOutputPullDelegate>
  39 {
  40     CVDisplayLinkRef _displayLink;
  41     CMVideoFormatDescriptionRef _videoFormat;
  42 
  43     dispatch_queue_t playerQueue;
  44 
  45     CJavaPlayerEventDispatcher *eventHandler;
  46 
  47     int requestedState; // 0 - stop, 1 - play, 2 - pause
  48     float requestedRate;
  49 
  50     int previousWidth;
  51     int previousHeight;
  52     int previousPlayerState; // avoid repeated states
  53 
  54     BOOL isDisposed;
  55     NSMutableArray *keyPathsObserved;
  56     NSMutableArray *playerObservers; // player item notification observers
  57 
  58     // placeholders until audio processor is created
  59     float _volume;
  60     float _balance;
  61     int64_t _audioSyncDelay; // delay is time in milliseconds
  62 
  63     AVFAudioSpectrumUnit *_audioSpectrum;
  64     AVFAudioEqualizer *_audioEqualizer;
  65 }
  66 
  67 @property (nonatomic,retain) NSURL *movieURL;
  68 @property (nonatomic,retain) AVPlayer *player;
  69 @property (nonatomic,retain) AVPlayerItem *playerItem;
  70 @property (nonatomic,retain) AVPlayerItemVideoOutput *playerOutput;
  71 @property (nonatomic,retain) AVFAudioProcessor *audioProcessor;
  72 @property (nonatomic,assign) uint64_t lastHostTime;
  73 
  74 @property (nonatomic,assign) int64_t audioSyncDelay;
  75 @property (nonatomic,assign) float balance;
  76 
  77 
  78 @property (nonatomic,assign) BOOL movieReady;   // set to YES the first time we get ready to play state
  79 @property (nonatomic,assign) BOOL isLiveStream; // YES if the stream is indeterminate
  80 
  81 // There's a bug in AVFoundation where when a HLS stream switches to a new
  82 // sub-stream, the call to hasNewPixelBufferForItemTime will begin to return
  83 // NO. So, we'll attempt to detect that case and when we encounter it we'll
  84 // stop asking and always ask for a new frame instead.
  85 // This *should* be fixed in a near-future version of AVFoundation, and it does
  86 // not happen with non HLS sources, so we'll leave the current behavior as the
  87 // default
  88 @property (nonatomic,assign) BOOL buggyHLSSupport;
  89 @property (nonatomic,assign) int hlsBugResetCount;
   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  37 
  38 @interface AVFMediaPlayer : NSObject<OSXPlayerProtocol,AVPlayerItemOutputPullDelegate>
  39 {
  40     CVDisplayLinkRef _displayLink;
  41     CMVideoFormatDescriptionRef _videoFormat;
  42 
  43     dispatch_queue_t playerQueue;
  44 
  45     CJavaPlayerEventDispatcher *eventHandler;
  46 
  47     int requestedState; // 0 - stop, 1 - play, 2 - pause
  48     float requestedRate;
  49 
  50     int previousWidth;
  51     int previousHeight;
  52     int previousPlayerState; // avoid repeated states
  53 
  54     BOOL isDisposed;
  55     NSMutableArray *keyPathsObserved;
  56     NSMutableArray *playerObservers; // player item notification observers








  57 }
  58 
  59 @property (nonatomic,retain) NSURL *movieURL;
  60 @property (nonatomic,retain) AVPlayer *player;

  61 @property (nonatomic,retain) AVPlayerItemVideoOutput *playerOutput;
  62 @property (nonatomic,retain) AVFAudioProcessor *audioProcessor;
  63 @property (nonatomic,assign) uint64_t lastHostTime;
  64 
  65 @property (nonatomic,assign) int64_t audioSyncDelay;
  66 @property (nonatomic,assign) float balance;
  67 
  68 
  69 @property (nonatomic,assign) BOOL movieReady;   // set to YES the first time we get ready to play state
  70 @property (nonatomic,assign) BOOL isLiveStream; // YES if the stream is indeterminate
  71 
  72 // There's a bug in AVFoundation where when a HLS stream switches to a new
  73 // sub-stream, the call to hasNewPixelBufferForItemTime will begin to return
  74 // NO. So, we'll attempt to detect that case and when we encounter it we'll
  75 // stop asking and always ask for a new frame instead.
  76 // This *should* be fixed in a near-future version of AVFoundation, and it does
  77 // not happen with non HLS sources, so we'll leave the current behavior as the
  78 // default
  79 @property (nonatomic,assign) BOOL buggyHLSSupport;
  80 @property (nonatomic,assign) int hlsBugResetCount;
< prev index next >