提交 6a5cae30 编写于 作者: R raymondzheng 提交者: Xinzheng Zhang

ijkplayer-java: add ijkio function

上级 ec442d4e
......@@ -22,6 +22,8 @@ APP_ABI := arm64-v8a
NDK_TOOLCHAIN_VERSION=4.9
APP_PIE := false
APP_STL := stlport_static
APP_CFLAGS := -O3 -Wall -pipe \
-ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
......
......@@ -22,6 +22,8 @@ APP_ABI := armeabi
NDK_TOOLCHAIN_VERSION=4.9
APP_PIE := false
APP_STL := stlport_static
APP_CFLAGS := -O3 -Wall -pipe \
-ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
......
......@@ -22,6 +22,8 @@ APP_ABI := armeabi-v7a
NDK_TOOLCHAIN_VERSION=4.9
APP_PIE := false
APP_STL := stlport_static
APP_CFLAGS := -O3 -Wall -pipe \
-ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
......
......@@ -53,6 +53,7 @@ import java.util.Map;
import tv.danmaku.ijk.media.player.annotations.AccessedByNative;
import tv.danmaku.ijk.media.player.annotations.CalledByNative;
import tv.danmaku.ijk.media.player.misc.IIjkIOHttp;
import tv.danmaku.ijk.media.player.misc.IMediaDataSource;
import tv.danmaku.ijk.media.player.misc.ITrackInfo;
import tv.danmaku.ijk.media.player.misc.IjkTrackInfo;
......@@ -60,7 +61,7 @@ import tv.danmaku.ijk.media.player.pragma.DebugLog;
/**
* @author bbcallen
*
*
* Java wrapper of ffplay.
*/
public final class IjkMediaPlayer extends AbstractMediaPlayer {
......@@ -127,6 +128,10 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
public static final int FFP_PROP_INT64_ASYNC_STATISTIC_BUF_FORWARDS = 20202;
public static final int FFP_PROP_INT64_ASYNC_STATISTIC_BUF_CAPACITY = 20203;
public static final int FFP_PROP_INT64_TRAFFIC_STATISTIC_BYTE_COUNT = 20204;
public static final int FFP_PROP_INT64_CACHE_STATISTIC_PHYSICAL_POS = 20205;
public static final int FFP_PROP_INT64_CACHE_STATISTIC_BUF_FORWARDS = 20206;
public static final int FFP_PROP_INT64_CACHE_STATISTIC_FILE_POS = 20207;
public static final int FFP_PROP_INT64_CACHE_STATISTIC_COUNT_BYTES = 20208;
public static final int FFP_PROP_INT64_BIT_RATE = 20100;
public static final int FFP_PROP_INT64_TCP_SPEED = 20200;
public static final int FFP_PROP_INT64_LATEST_SEEK_LOAD_DURATION = 20300;
......@@ -137,6 +142,9 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
@AccessedByNative
private long mNativeMediaDataSource;
@AccessedByNative
private long mNativeIjkIOHttp;
@AccessedByNative
private int mNativeSurfaceTexture;
......@@ -243,13 +251,13 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
/**
* Sets the {@link SurfaceHolder} to use for displaying the video portion of
* the media.
*
*
* Either a surface holder or surface must be set if a display or video sink
* is needed. Not calling this method or {@link #setSurface(Surface)} when
* playing back a video will result in only the audio track being played. A
* null surface holder or surface will result in only the audio track being
* played.
*
*
* @param sh
* the SurfaceHolder to use for video display
*/
......@@ -272,7 +280,7 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
* does not support {@link #setScreenOnWhilePlaying(boolean)}. Setting a
* Surface will un-set any Surface or SurfaceHolder that was previously set.
* A null surface will result in only the audio track being played.
*
*
* If the Surface sends frames to a {@link SurfaceTexture}, the timestamps
* returned from {@link SurfaceTexture#getTimestamp()} will have an
* unspecified zero point. These timestamps cannot be directly compared
......@@ -280,7 +288,7 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
* source, or multiple runs of the same program. The timestamp is normally
* monotonically increasing and is unaffected by time-of-day adjustments,
* but it is reset when the position is set.
*
*
* @param surface
* The {@link Surface} to be used for the video portion of the
* media.
......@@ -370,13 +378,13 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
/**
* Sets the data source (file-path or http/rtsp URL) to use.
*
*
* @param path
* the path of the file, or the http/rtsp URL of the stream you
* want to play
* @throws IllegalStateException
* if it is called in an invalid state
*
*
* <p>
* When <code>path</code> refers to a local file, the file may
* actually be opened by a process other than the calling
......@@ -472,6 +480,11 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
_setDataSource(mediaDataSource);
}
public void setDataSourceIjkIOHttp(IIjkIOHttp ijkIOHttp)
throws IllegalArgumentException, SecurityException, IllegalStateException {
_setDataSourceIjkIOHttp(ijkIOHttp);
}
private native void _setDataSource(String path, String[] keys, String[] values)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException;
......@@ -481,6 +494,9 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
private native void _setDataSource(IMediaDataSource mediaDataSource)
throws IllegalArgumentException, SecurityException, IllegalStateException;
private native void _setDataSourceIjkIOHttp(IIjkIOHttp ijkIOHttp)
throws IllegalArgumentException, SecurityException, IllegalStateException;
@Override
public String getDataSource() {
return mDataSource;
......@@ -782,6 +798,22 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
return _getPropertyLong(FFP_PROP_INT64_TRAFFIC_STATISTIC_BYTE_COUNT, 0);
}
public long getCacheStatisticPhysicalPos() {
return _getPropertyLong(FFP_PROP_INT64_CACHE_STATISTIC_PHYSICAL_POS, 0);
}
public long getCacheStatisticBufForwards() {
return _getPropertyLong(FFP_PROP_INT64_CACHE_STATISTIC_BUF_FORWARDS, 0);
}
public long getCacheStatisticFilePos() {
return _getPropertyLong(FFP_PROP_INT64_CACHE_STATISTIC_FILE_POS, 0);
}
public long getCacheStatisticCountBytes() {
return _getPropertyLong(FFP_PROP_INT64_CACHE_STATISTIC_COUNT_BYTES, 0);
}
public long getBitRate() {
return _getPropertyLong(FFP_PROP_INT64_BIT_RATE, 0);
}
......
/*
* Copyright (C) 2016 Raymond Zheng <raymondzheng1412@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package tv.danmaku.ijk.media.player.misc;
import java.io.IOException;
@SuppressWarnings("RedundantThrows")
public interface IIjkIOHttp {
int open() throws IOException;
int read(byte[] buffer, int size) throws IOException;
long seek(long offset, int whence) throws IOException;
int close() throws IOException;
}
......@@ -22,6 +22,8 @@ APP_ABI := x86
NDK_TOOLCHAIN_VERSION=4.9
APP_PIE := false
APP_STL := stlport_static
APP_CFLAGS := -O3 -Wall -pipe \
-ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
......
......@@ -22,6 +22,8 @@ APP_ABI := x86_64
NDK_TOOLCHAIN_VERSION=4.9
APP_PIE := false
APP_STL := stlport_static
APP_CFLAGS := -O3 -Wall -pipe \
-ffast-math \
-fstrict-aliasing -Werror=strict-aliasing \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册