1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.exoplayer2.video; 17 18 import android.media.MediaFormat; 19 import androidx.annotation.Nullable; 20 import com.google.android.exoplayer2.Format; 21 22 /** A listener for metadata corresponding to video frames being rendered. */ 23 public interface VideoFrameMetadataListener { 24 /** 25 * Called on the playback thread when a video frame is about to be rendered. 26 * 27 * @param presentationTimeUs The presentation time of the frame, in microseconds. 28 * @param releaseTimeNs The wallclock time at which the frame should be displayed, in nanoseconds. 29 * If the platform API version of the device is less than 21, then this is a best effort. 30 * @param format The format associated with the frame. 31 * @param mediaFormat The framework media format associated with the frame, or {@code null} if not 32 * known or not applicable (e.g., because the frame was not output by a {@link 33 * android.media.MediaCodec MediaCodec}). 34 */ onVideoFrameAboutToBeRendered( long presentationTimeUs, long releaseTimeNs, Format format, @Nullable MediaFormat mediaFormat)35 void onVideoFrameAboutToBeRendered( 36 long presentationTimeUs, 37 long releaseTimeNs, 38 Format format, 39 @Nullable MediaFormat mediaFormat); 40 } 41