Skip to content

Commit

Permalink
rebuild project and update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyang committed May 10, 2016
1 parent 72ff40e commit 5696e75
Show file tree
Hide file tree
Showing 163 changed files with 4,305 additions and 5,095 deletions.
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#built application files
*.apk
*.ap_
*.iml

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Windows thumbnail db
Thumbs.db

# OSX files
.DS_Store

# Eclipse project files
.classpath
.project

# Android Studio
.idea/
#.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
.gradle
build/
Medusa/src/main/res/values/com_crashlytics_export_strings.xml
ThirdLibs/ImageGalleryLibrary/ImageGalleryLibrary.iml
27 changes: 27 additions & 0 deletions IjkplayerLib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'tv.danmaku.ijk.media:ijkplayer-java:0.4.5.1'
compile 'tv.danmaku.ijk.media:ijkplayer-exo:0.4.5.1'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:preference-v7:23.2.1'
}
2 changes: 1 addition & 1 deletion player-java/proguard-rules.pro → IjkplayerLib/proguard-rules.pro
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /opt/android/ADK/tools/proguard/proguard-android.txt
# in /Users/zhangyang/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tv.danmaku.ijk.media.player;
package com.example.zhangyang.ijkplayerlib;

import android.app.Application;
import android.test.ApplicationTestCase;
Expand Down
10 changes: 10 additions & 0 deletions IjkplayerLib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tv.danmaku.ijk.media.playerLib">

<application
android:allowBackup="true"
android:supportsRtl="true">

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2015 Zhang Rui <[email protected]>
*
* 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.services;

import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;

import tv.danmaku.ijk.media.player.IMediaPlayer;

public class MediaPlayerService extends Service {
private static IMediaPlayer sMediaPlayer;

public static Intent newIntent(Context context) {
Intent intent = new Intent(context, MediaPlayerService.class);
return intent;
}

public static void intentToStart(Context context) {
context.startService(newIntent(context));
}

public static void intentToStop(Context context) {
context.stopService(newIntent(context));
}

@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}

public static void setMediaPlayer(IMediaPlayer mp) {
if (sMediaPlayer != null && sMediaPlayer != mp) {
if (sMediaPlayer.isPlaying())
sMediaPlayer.stop();
sMediaPlayer.release();
sMediaPlayer = null;
}
sMediaPlayer = mp;
}

public static IMediaPlayer getMediaPlayer() {
return sMediaPlayer;
}
}
104 changes: 104 additions & 0 deletions IjkplayerLib/src/main/java/tv/danmaku/ijk/media/widget/Settings.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (C) 2015 Zhang Rui <[email protected]>
*
* 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.widget;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import tv.danmaku.ijk.media.playerLib.R;


public class Settings {
private Context mAppContext;
private SharedPreferences mSharedPreferences;

public static final int PV_PLAYER__Auto = 0;
public static final int PV_PLAYER__AndroidMediaPlayer = 1;
public static final int PV_PLAYER__IjkMediaPlayer = 2;
public static final int PV_PLAYER__IjkExoMediaPlayer = 3;

public Settings(Context context) {
mAppContext = context.getApplicationContext();
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(mAppContext);
}

public boolean getEnableBackgroundPlay() {
String key = mAppContext.getString(R.string.pref_key_enable_background_play);
return mSharedPreferences.getBoolean(key, false);
}

public int getPlayer() {
String key = mAppContext.getString(R.string.pref_key_player);
String value = mSharedPreferences.getString(key, "");
try {
return Integer.valueOf(value).intValue();
} catch (NumberFormatException e) {
return 0;
}
}

public boolean getUsingMediaCodec() {
String key = mAppContext.getString(R.string.pref_key_using_media_codec);
return mSharedPreferences.getBoolean(key, false);
}

public boolean getUsingMediaCodecAutoRotate() {
String key = mAppContext.getString(R.string.pref_key_using_media_codec_auto_rotate);
return mSharedPreferences.getBoolean(key, false);
}

public boolean getUsingOpenSLES() {
String key = mAppContext.getString(R.string.pref_key_using_opensl_es);
return mSharedPreferences.getBoolean(key, false);
}

public String getPixelFormat() {
String key = mAppContext.getString(R.string.pref_key_pixel_format);
return mSharedPreferences.getString(key, "");
}

public boolean getEnableNoView() {
String key = mAppContext.getString(R.string.pref_key_enable_no_view);
return mSharedPreferences.getBoolean(key, false);
}

public boolean getEnableSurfaceView() {
String key = mAppContext.getString(R.string.pref_key_enable_surface_view);
return mSharedPreferences.getBoolean(key, false);
}

public boolean getEnableTextureView() {
String key = mAppContext.getString(R.string.pref_key_enable_texture_view);
return mSharedPreferences.getBoolean(key, false);
}

public boolean getEnableDetachedSurfaceTextureView() {
String key = mAppContext.getString(R.string.pref_key_enable_detached_surface_texture);
return mSharedPreferences.getBoolean(key, false);
}

public String getLastDirectory() {
String key = mAppContext.getString(R.string.pref_key_last_directory);
return mSharedPreferences.getString(key, "/");
}

public void setLastDirectory(String path) {
String key = mAppContext.getString(R.string.pref_key_last_directory);
mSharedPreferences.edit().putString(key, path).commit();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2015 Zhang Rui <[email protected]>
*
* 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.widget.media;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.util.AttributeSet;
import android.view.View;

import java.util.ArrayList;

public class AndroidMediaController extends PlayerMediaController implements IMediaController {
private ActionBar mActionBar;

public AndroidMediaController(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}

public AndroidMediaController(Context context, boolean useFastForward) {
super(context);
initView(context);
}

public AndroidMediaController(Context context) {
super(context);
initView(context);
}

protected void initView(Context context) {
}

public void setSupportActionBar(@Nullable ActionBar actionBar) {
mActionBar = actionBar;
if (isShowing()) {
actionBar.show();
} else {
actionBar.hide();
}
}

@Override
public void show() {
super.show();
if (mActionBar != null)
mActionBar.show();
}

@Override
public void hide() {
super.hide();
if (mActionBar != null)
mActionBar.hide();
for (View view : mShowOnceArray)
view.setVisibility(View.GONE);
mShowOnceArray.clear();
}

//----------
// Extends
//----------
private ArrayList<View> mShowOnceArray = new ArrayList<View>();

public void showOnce(@NonNull View view) {
mShowOnceArray.add(view);
view.setVisibility(View.VISIBLE);
show();
}

@Override
public void setAnchorView(View view) {
super.setAnchorView(view);
}

public void setLiveRoomCount(String count) {

}
}
30 changes: 21 additions & 9 deletions ...v/danmaku/ijk/media/player/MediaInfo.java → .../media/widget/media/IMediaController.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2014 Zhang Rui <[email protected]>
* Copyright (C) 2015 Zhang Rui <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,16 +14,28 @@
* limitations under the License.
*/

package tv.danmaku.ijk.media.player;
package tv.danmaku.ijk.media.widget.media;

public class MediaInfo {
public String mMediaPlayerName;
import android.view.View;
import android.widget.MediaController;

public String mVideoDecoder;
public String mVideoDecoderImpl;
public interface IMediaController {
void hide();

public String mAudioDecoder;
public String mAudioDecoderImpl;
boolean isShowing();

public IjkMediaMeta mMeta;
void setAnchorView(View view);

void setEnabled(boolean enabled);

void setMediaPlayer(MediaController.MediaPlayerControl player);

void show(int timeout);

void show();

//----------
// Extends
//----------
void showOnce(View view);
}
Loading

0 comments on commit 5696e75

Please sign in to comment.