Skip to content

Commit

Permalink
Merge branch 'release0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
befovy committed Jul 20, 2019
2 parents 39d3cde + f27b66d commit 322f430
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 121 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
tag next
--------------------------------

tag f0.3.1
--------------------------------
- ios: IJKFFMediaPlayer add volume and position api
- android: update Mesage id
- ijkplayer: make sure change to state started

tag f0.3.0
--------------------------------
- change prefix for fijkplayer release tag names `f`
Expand Down
4 changes: 2 additions & 2 deletions android/ijkplayer/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

VERSION_NAME=0.3.0
VERSION_CODE=000300
VERSION_NAME=0.3.1
VERSION_CODE=000301
GROUP=com.befovy.fijkplayer

# http://central.sonatype.org/pages/requirements.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package tv.danmaku.ijk.media.example.activities;

import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
Expand Down Expand Up @@ -46,9 +47,9 @@ protected void onCreate(Bundle savedInstanceState) {

String lastDirectory = mSettings.getLastDirectory();
if (!TextUtils.isEmpty(lastDirectory) && new File(lastDirectory).isDirectory())
doOpenDirectory(lastDirectory, false);
doOpenDirectory(Environment.getExternalStorageDirectory().getPath(), false);
else
doOpenDirectory("/", false);
doOpenDirectory(Environment.getExternalStorageDirectory().getPath(), false);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
import tv.danmaku.ijk.media.player.misc.ITrackInfo;

public interface IMediaPlayer {
/*
/**
* Do not change these values without updating their counterparts in native
*/
* These constant values equal to valued defined in {@link android.media.MediaPlayer}
**/
int MEDIA_INFO_UNKNOWN = 1;
int MEDIA_INFO_STARTED_AS_NEXT = 2;
int MEDIA_INFO_VIDEO_RENDERING_START = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,6 @@
public final class IjkMediaPlayer extends AbstractMediaPlayer {
private final static String TAG = IjkMediaPlayer.class.getName();

private static final int MEDIA_NOP = 0; // interface test message
private static final int MEDIA_PREPARED = 1;
private static final int MEDIA_PLAYBACK_COMPLETE = 2;
private static final int MEDIA_BUFFERING_UPDATE = 3;
private static final int MEDIA_SEEK_COMPLETE = 4;
private static final int MEDIA_SET_VIDEO_SIZE = 5;
private static final int MEDIA_TIMED_TEXT = 99;
private static final int MEDIA_ERROR = 100;
private static final int MEDIA_INFO = 200;

protected static final int MEDIA_SET_VIDEO_SAR = 10001;

//----------------------------------------
// options
public static final int IJK_LOG_UNKNOWN = 0;
Expand All @@ -105,6 +93,33 @@ public final class IjkMediaPlayer extends AbstractMediaPlayer {
public static final int SDL_FCC_RV32 = 0x32335652; // RGBX8888
//----------------------------------------


// IjkMediaPlayer Post Message
public static final int IJK_MSG_NOP = 0;
public static final int IJK_MSG_ERROR = 100;
public static final int IJK_MSG_PREPARED = 200;
public static final int IJK_MSG_COMPLETED = 300;
public static final int IJK_MSG_VIDEO_SIZE_CHANGED = 400;
public static final int IJK_MSG_SAR_CHANGED = 401;
public static final int IJK_MSG_VIDEO_RENDERING_START = 402;
public static final int IJK_MSG_AUDIO_RENDERING_START = 403;
public static final int IJK_MSG_VIDEO_ROTATION_CHANGED = 404;
public static final int IJK_MSG_AUDIO_DECODED_START = 405;
public static final int IJK_MSG_VIDEO_DECODED_START = 406;
public static final int IJK_MSG_OPEN_INPUT = 407;
public static final int IJK_MSG_FIND_STREAM_INFO = 408;
public static final int IJK_MSG_COMPONENT_OPEN = 409;
public static final int IJK_MSG_VIDEO_SEEK_RENDERING_START = 410;
public static final int IJK_MSG_AUDIO_SEEK_RENDERING_START = 411;

public static final int IJK_MSG_BUFFERING_START = 500;
public static final int IJK_MSG_BUFFERING_END = 501;
public static final int IJK_MSG_BUFFERING_UPDATE = 502;
public static final int IJK_MSG_SEEK_COMPLETE = 600;
public static final int IJK_MSG_TIMED_TEXT = 800;
public static final int IJK_MSG_ACCURATE_SEEK_COMPLETE = 900;


//----------------------------------------
// properties
public static final int PROP_FLOAT_VIDEO_DECODE_FRAMES_PER_SECOND = 10001;
Expand Down Expand Up @@ -1001,16 +1016,15 @@ public void handleMessage(Message msg) {
}

switch (msg.what) {
case MEDIA_PREPARED:
case IJK_MSG_PREPARED:
player.notifyOnPrepared();
break;

case MEDIA_PLAYBACK_COMPLETE:
case IJK_MSG_COMPLETED:
player.stayAwake(false);
player.notifyOnCompletion();
break;

case MEDIA_BUFFERING_UPDATE:
case IJK_MSG_BUFFERING_UPDATE:
long bufferPosition = msg.arg1;
if (bufferPosition < 0) {
bufferPosition = 0;
Expand All @@ -1029,50 +1043,81 @@ public void handleMessage(Message msg) {
player.notifyOnBufferingUpdate((int)percent);
break;

case MEDIA_SEEK_COMPLETE:
case IJK_MSG_SEEK_COMPLETE:
player.notifyOnSeekComplete();
break;

case MEDIA_SET_VIDEO_SIZE:
case IJK_MSG_VIDEO_SIZE_CHANGED:
player.mVideoWidth = msg.arg1;
player.mVideoHeight = msg.arg2;
player.notifyOnVideoSizeChanged(player.mVideoWidth, player.mVideoHeight,
player.mVideoSarNum, player.mVideoSarDen);
break;

case MEDIA_ERROR:
case IJK_MSG_SAR_CHANGED:
player.mVideoSarNum = msg.arg1;
player.mVideoSarDen = msg.arg2;
player.notifyOnVideoSizeChanged(player.mVideoWidth, player.mVideoHeight,
player.mVideoSarNum, player.mVideoSarDen);
break;

case IJK_MSG_ERROR:
DebugLog.e(TAG, "Error (" + msg.arg1 + "," + msg.arg2 + ")");
if (!player.notifyOnError(msg.arg1, msg.arg2)) {
player.notifyOnCompletion();
}
player.stayAwake(false);
break;

case MEDIA_INFO:
switch (msg.arg1) {
case MEDIA_INFO_VIDEO_RENDERING_START:
DebugLog.i(TAG, "Info: MEDIA_INFO_VIDEO_RENDERING_START\n");
break;
}
player.notifyOnInfo(msg.arg1, msg.arg2);
// No real default action so far.
case IJK_MSG_VIDEO_RENDERING_START:
player.notifyOnInfo(MEDIA_INFO_VIDEO_RENDERING_START, 0);
DebugLog.i(TAG, "Info: MEDIA_INFO_VIDEO_RENDERING_START\n");
break;
case IJK_MSG_AUDIO_RENDERING_START:
player.notifyOnInfo(MEDIA_INFO_AUDIO_RENDERING_START, 0);
break;
case IJK_MSG_VIDEO_ROTATION_CHANGED:
player.notifyOnInfo(MEDIA_INFO_VIDEO_ROTATION_CHANGED, 0);
break;
case IJK_MSG_AUDIO_DECODED_START:
player.notifyOnInfo(MEDIA_INFO_AUDIO_DECODED_START, 0);
break;
case MEDIA_TIMED_TEXT:
case IJK_MSG_VIDEO_DECODED_START:
player.notifyOnInfo(MEDIA_INFO_VIDEO_DECODED_START, 0);
break;
case IJK_MSG_OPEN_INPUT:
player.notifyOnInfo(MEDIA_INFO_OPEN_INPUT, 0);
break;
case IJK_MSG_FIND_STREAM_INFO:
player.notifyOnInfo(MEDIA_INFO_FIND_STREAM_INFO, 0);
break;
case IJK_MSG_COMPONENT_OPEN:
player.notifyOnInfo(MEDIA_INFO_COMPONENT_OPEN, 0);
break;
case IJK_MSG_BUFFERING_START:
player.notifyOnInfo(MEDIA_INFO_BUFFERING_START, msg.arg1);
break;
case IJK_MSG_BUFFERING_END:
player.notifyOnInfo(MEDIA_INFO_BUFFERING_END, msg.arg1);
break;
case IJK_MSG_VIDEO_SEEK_RENDERING_START:
player.notifyOnInfo(MEDIA_INFO_VIDEO_SEEK_RENDERING_START, msg.arg1);
break;
case IJK_MSG_AUDIO_SEEK_RENDERING_START:
player.notifyOnInfo(MEDIA_INFO_AUDIO_SEEK_RENDERING_START, msg.arg1);
break;
case IJK_MSG_ACCURATE_SEEK_COMPLETE:
player.notifyOnInfo(MEDIA_INFO_MEDIA_ACCURATE_SEEK_COMPLETE, msg.arg1);
break;
case IJK_MSG_TIMED_TEXT:
if (msg.obj == null) {
player.notifyOnTimedText(null);
} else {
IjkTimedText text = new IjkTimedText(new Rect(0, 0, 1, 1), (String)msg.obj);
player.notifyOnTimedText(text);
}
break;
case MEDIA_NOP: // interface test message - ignore
break;

case MEDIA_SET_VIDEO_SAR:
player.mVideoSarNum = msg.arg1;
player.mVideoSarDen = msg.arg2;
player.notifyOnVideoSizeChanged(player.mVideoWidth, player.mVideoHeight,
player.mVideoSarNum, player.mVideoSarDen);
case IJK_MSG_NOP: // interface test message - ignore
break;

default:
Expand Down Expand Up @@ -1100,11 +1145,12 @@ private static void postEventFromNative(Object weakThiz, int what,
return;
}

if (what == MEDIA_INFO && arg1 == MEDIA_INFO_STARTED_AS_NEXT) {
// this acquires the wakelock if needed, and sets the client side
// state
mp.start();
}
// native ijkplayer never post this message
// if (what == MEDIA_INFO && arg1 == MEDIA_INFO_STARTED_AS_NEXT) {
// // this acquires the wakelock if needed, and sets the client side
// // state
// mp.start();
// }
if (mp.mEventHandler != null) {
Message m = mp.mEventHandler.obtainMessage(what, arg1, arg2, obj);
mp.mEventHandler.sendMessage(m);
Expand Down
Loading

0 comments on commit 322f430

Please sign in to comment.