Browse Source

display-client视频压缩依赖包

1712772270@qq.com 8 years ago
parent
commit
2823dd53e1
36 changed files with 755 additions and 0 deletions
  1. 32 0
      ipu-VideoCompressor/AndroidManifest.xml
  2. BIN
      ipu-VideoCompressor/assets/armeabi-v7a-neon/ffmpeg
  3. BIN
      ipu-VideoCompressor/assets/armeabi-v7a/ffmpeg
  4. BIN
      ipu-VideoCompressor/assets/x86/ffmpeg
  5. 5 0
      ipu-VideoCompressor/bin/jarlist.cache
  6. BIN
      ipu-VideoCompressor/bin/resources.ap_
  7. 35 0
      ipu-VideoCompressor/gen/com/ai/ipu/libffmpeg/R.java
  8. 6 0
      ipu-VideoCompressor/gen/com/ai/ipu/videocompressor/BuildConfig.java
  9. 188 0
      ipu-VideoCompressor/gen/com/ai/ipu/videocompressor/R.java
  10. 94 0
      ipu-VideoCompressor/gen/com/wade/mobile/R.java
  11. 15 0
      ipu-VideoCompressor/jni/Android.mk
  12. 4 0
      ipu-VideoCompressor/jni/Application.mk
  13. 29 0
      ipu-VideoCompressor/jni/armArch.c
  14. BIN
      ipu-VideoCompressor/libs/android-support-v4.jar
  15. BIN
      ipu-VideoCompressor/libs/armeabi-v7a/libARM_ARCH.so
  16. BIN
      ipu-VideoCompressor/libs/armeabi/libARM_ARCH.so
  17. BIN
      ipu-VideoCompressor/libs/x86/libARM_ARCH.so
  18. 20 0
      ipu-VideoCompressor/proguard-project.txt
  19. 17 0
      ipu-VideoCompressor/project.properties
  20. BIN
      ipu-VideoCompressor/res/drawable-hdpi/ic_launcher.png
  21. BIN
      ipu-VideoCompressor/res/drawable-mdpi/ic_launcher.png
  22. BIN
      ipu-VideoCompressor/res/drawable-xhdpi/ic_launcher.png
  23. BIN
      ipu-VideoCompressor/res/drawable-xxhdpi/ic_launcher.png
  24. 12 0
      ipu-VideoCompressor/res/layout/activity_main.xml
  25. 11 0
      ipu-VideoCompressor/res/menu/main.xml
  26. 11 0
      ipu-VideoCompressor/res/values-v11/styles.xml
  27. 12 0
      ipu-VideoCompressor/res/values-v14/styles.xml
  28. 10 0
      ipu-VideoCompressor/res/values-w820dp/dimens.xml
  29. 8 0
      ipu-VideoCompressor/res/values/strings.xml
  30. 20 0
      ipu-VideoCompressor/res/values/styles.xml
  31. 7 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/CompressListener.java
  32. 73 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/Compressor.java
  33. 6 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/InitListener.java
  34. 59 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/MainActivity.java
  35. 33 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/func/MobileVideoCompress.java
  36. 48 0
      ipu-VideoCompressor/src/com/ai/ipu/videocompressor/util/VideoCompressUtil.java

+ 32 - 0
ipu-VideoCompressor/AndroidManifest.xml

@ -0,0 +1,32 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
    package="com.ai.ipu.videocompressor"
4
    android:versionCode="1"
5
    android:versionName="1.0" >
6
7
    <uses-sdk
8
        android:minSdkVersion="16"
9
        android:targetSdkVersion="21" />
10
11
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
12
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
13
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
14
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
15
16
    <application
17
        android:allowBackup="true"
18
        android:icon="@drawable/ic_launcher"
19
        android:label="@string/app_name"
20
        android:theme="@style/AppTheme" >
21
        <activity
22
            android:name="com.ai.ipu.videocompressor.MainActivity"
23
            android:label="@string/app_name" >
24
            <intent-filter>
25
                <action android:name="android.intent.action.MAIN" />
26
27
                <category android:name="android.intent.category.LAUNCHER" />
28
            </intent-filter>
29
        </activity>
30
    </application>
31
32
</manifest>

BIN
ipu-VideoCompressor/assets/armeabi-v7a-neon/ffmpeg


BIN
ipu-VideoCompressor/assets/armeabi-v7a/ffmpeg


BIN
ipu-VideoCompressor/assets/x86/ffmpeg


+ 5 - 0
ipu-VideoCompressor/bin/jarlist.cache

@ -0,0 +1,5 @@
1
# cache for current jar dependency. DO NOT EDIT.
2
# format is <lastModified> <length> <SHA-1> <path>
3
# Encoding is UTF-8
4
1473816918000 1364299 b6c138ba72ce38beda559df33d369856854fd6f5 D:\www\androidshare\ipu-ffmpeg\libs\android-support-v4.jar
5
1473733114000 1364299 b6c138ba72ce38beda559df33d369856854fd6f5 D:\www\androidshare\Android-Video-Compressor\libs\android-support-v4.jar

BIN
ipu-VideoCompressor/bin/resources.ap_


+ 35 - 0
ipu-VideoCompressor/gen/com/ai/ipu/libffmpeg/R.java

@ -0,0 +1,35 @@
1
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
2
 *
3
 * This class was automatically generated by the
4
 * aapt tool from the resource data it found.  It
5
 * should not be modified by hand.
6
 */
7
package com.ai.ipu.libffmpeg;
8
9
public final class R {
10
	public static final class dimen {
11
		public static final int activity_horizontal_margin = 0x7f080000;
12
	}
13
	public static final class drawable {
14
		public static final int ic_launcher = 0x7f020001;
15
	}
16
	public static final class id {
17
		public static final int action_settings = 0x7f0a000d;
18
	}
19
	public static final class layout {
20
		public static final int activity_main = 0x7f030000;
21
	}
22
	public static final class menu {
23
		public static final int main = 0x7f090000;
24
	}
25
	public static final class string {
26
		public static final int action_settings = 0x7f06000d;
27
		public static final int app_name = 0x7f060000;
28
		public static final int hello_world = 0x7f06000c;
29
		public static final int shipped_ffmpeg_version = 0x7f06000e;
30
	}
31
	public static final class style {
32
		public static final int AppBaseTheme = 0x7f070004;
33
		public static final int AppTheme = 0x7f070005;
34
	}
35
}

+ 6 - 0
ipu-VideoCompressor/gen/com/ai/ipu/videocompressor/BuildConfig.java

@ -0,0 +1,6 @@
1
/** Automatically generated file. DO NOT MODIFY */
2
package com.ai.ipu.videocompressor;
3
4
public final class BuildConfig {
5
    public final static boolean DEBUG = true;
6
}

+ 188 - 0
ipu-VideoCompressor/gen/com/ai/ipu/videocompressor/R.java

@ -0,0 +1,188 @@
1
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
2
 *
3
 * This class was automatically generated by the
4
 * aapt tool from the resource data it found.  It
5
 * should not be modified by hand.
6
 */
7
8
package com.ai.ipu.videocompressor;
9
10
public final class R {
11
    public static final class anim {
12
        public static final int hyperspace_in=0x7f040000;
13
        public static final int hyperspace_out=0x7f040001;
14
        public static final int push_left_in=0x7f040002;
15
        public static final int push_left_out=0x7f040003;
16
        public static final int push_right_in=0x7f040004;
17
        public static final int push_right_out=0x7f040005;
18
        public static final int scale_action=0x7f040006;
19
        public static final int shut_open_in=0x7f040007;
20
        public static final int shut_open_out=0x7f040008;
21
    }
22
    public static final class attr {
23
    }
24
    public static final class dimen {
25
        /** 
26
         Example customization of dimensions originally defined in res/values/dimens.xml
27
         (such as screen margins) for screens with more than 820dp of available width. This
28
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
29
    
30
31
         Example customization of dimensions originally defined in res/values/dimens.xml
32
         (such as screen margins) for screens with more than 820dp of available width. This
33
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
34
    
35
         */
36
        public static final int activity_horizontal_margin=0x7f080000;
37
    }
38
    public static final class drawable {
39
        public static final int audio_activity_dialog=0x7f020000;
40
        public static final int ic_launcher=0x7f020001;
41
        public static final int keyboard_key=0x7f020002;
42
        public static final int keyboard_normal_bg=0x7f020003;
43
        public static final int keyboard_normal_hl_bg=0x7f020004;
44
        public static final int keyboard_qwerty=0x7f020005;
45
        public static final int keyboard_sym_delete=0x7f020006;
46
        public static final int keyboard_sym_shift=0x7f020007;
47
        public static final int keyboard_sym_space=0x7f020008;
48
        public static final int keyboard_symbols=0x7f020009;
49
        public static final int nfc_bg=0x7f02000a;
50
        public static final int record_mic_normal=0x7f02000b;
51
        public static final int record_mic_press=0x7f02000c;
52
        public static final int screenlock_arrow=0x7f02000d;
53
        public static final int screenlock_line=0x7f02000e;
54
        public static final int screenlock_line_error=0x7f02000f;
55
        public static final int screenlock_line_semicircle=0x7f020010;
56
        public static final int screenlock_line_semicircle_error=0x7f020011;
57
        public static final int screenlock_round_click=0x7f020012;
58
        public static final int screenlock_round_click_error=0x7f020013;
59
        public static final int screenlock_round_original=0x7f020014;
60
        public static final int screenlock_welcome_bg=0x7f020015;
61
        public static final int share_apk_activity_dialog=0x7f020016;
62
    }
63
    public static final class id {
64
        public static final int action_settings=0x7f0a000d;
65
        public static final int deviceListView=0x7f0a0008;
66
        public static final int deviceNameTV=0x7f0a000b;
67
        public static final int exit=0x7f0a0009;
68
        public static final int forget_btn=0x7f0a0005;
69
        public static final int keyboard_view=0x7f0a0002;
70
        public static final int lock_view=0x7f0a0003;
71
        public static final int macAddressTV=0x7f0a000c;
72
        public static final int micButton=0x7f0a0001;
73
        public static final int notify=0x7f0a0004;
74
        public static final int recordLabel=0x7f0a0000;
75
        public static final int reset_btn=0x7f0a0006;
76
        public static final int search=0x7f0a000a;
77
        public static final int share=0x7f0a0007;
78
    }
79
    public static final class layout {
80
        public static final int activity_main=0x7f030000;
81
        public static final int audio_recorder=0x7f030001;
82
        public static final int keyboard=0x7f030002;
83
        public static final int nfcard=0x7f030003;
84
        public static final int screenlock_login_layout2=0x7f030004;
85
        public static final int screenlock_reset_lock_layout=0x7f030005;
86
        public static final int share_apk_activity=0x7f030006;
87
        public static final int share_apk_device_list_item=0x7f030007;
88
    }
89
    public static final class menu {
90
        public static final int main=0x7f090000;
91
    }
92
    public static final class raw {
93
        public static final int beep=0x7f050000;
94
    }
95
    public static final class string {
96
        public static final int action_settings=0x7f06000d;
97
        public static final int app_name=0x7f060000;
98
        public static final int hello_world=0x7f06000c;
99
        public static final int imgContentDesc=0x7f060003;
100
        public static final int pressTip=0x7f060002;
101
        public static final int recording=0x7f060001;
102
        public static final int sa_confirm_share=0x7f06000a;
103
        public static final int sa_exit=0x7f060009;
104
        public static final int sa_mac_address=0x7f060006;
105
        public static final int sa_search=0x7f060007;
106
        public static final int sa_searching=0x7f060008;
107
        public static final int sa_share=0x7f060005;
108
        public static final int sa_tip=0x7f06000b;
109
        public static final int shipped_ffmpeg_version=0x7f06000e;
110
        public static final int tips=0x7f060004;
111
    }
112
    public static final class style {
113
        /** 
114
        Base application theme, dependent on API level. This theme is replaced
115
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
116
    
117
118
            Theme customizations available in newer API levels can go in
119
            res/values-vXX/styles.xml, while customizations related to
120
            backward-compatibility can go here.
121
        
122
123
        Base application theme for API 11+. This theme completely replaces
124
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
125
    
126
 API 11 theme customizations can go here. 
127
128
        Base application theme for API 14+. This theme completely replaces
129
        AppBaseTheme from BOTH res/values/styles.xml and
130
        res/values-v11/styles.xml on API 14+ devices.
131
    
132
 API 14 theme customizations can go here. 
133
134
        Base application theme, dependent on API level. This theme is replaced
135
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
136
    
137
138
            Theme customizations available in newer API levels can go in
139
            res/values-vXX/styles.xml, while customizations related to
140
            backward-compatibility can go here.
141
        
142
143
        Base application theme for API 11+. This theme completely replaces
144
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
145
    
146
 API 11 theme customizations can go here. 
147
148
        Base application theme for API 14+. This theme completely replaces
149
        AppBaseTheme from BOTH res/values/styles.xml and
150
        res/values-v11/styles.xml on API 14+ devices.
151
    
152
 API 14 theme customizations can go here. 
153
154
        Base application theme, dependent on API level. This theme is replaced
155
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
156
    
157
158
            Theme customizations available in newer API levels can go in
159
            res/values-vXX/styles.xml, while customizations related to
160
            backward-compatibility can go here.
161
        
162
163
        Base application theme for API 11+. This theme completely replaces
164
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
165
    
166
 API 11 theme customizations can go here. 
167
168
        Base application theme for API 14+. This theme completely replaces
169
        AppBaseTheme from BOTH res/values/styles.xml and
170
        res/values-v11/styles.xml on API 14+ devices.
171
    
172
 API 14 theme customizations can go here. 
173
         */
174
        public static final int AppBaseTheme=0x7f070004;
175
        /**  Application theme. 
176
 All customizations that are NOT specific to a particular API-level can go here. 
177
 Application theme. 
178
 All customizations that are NOT specific to a particular API-level can go here. 
179
 Application theme. 
180
 All customizations that are NOT specific to a particular API-level can go here. 
181
         */
182
        public static final int AppTheme=0x7f070005;
183
        public static final int AudioDialogTheme=0x7f070000;
184
        public static final int CustomDialogTheme=0x7f070001;
185
        public static final int ShareApkDialogTheme=0x7f070002;
186
        public static final int SlidingMenuTheme=0x7f070003;
187
    }
188
}

+ 94 - 0
ipu-VideoCompressor/gen/com/wade/mobile/R.java

@ -0,0 +1,94 @@
1
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
2
 *
3
 * This class was automatically generated by the
4
 * aapt tool from the resource data it found.  It
5
 * should not be modified by hand.
6
 */
7
package com.wade.mobile;
8
9
public final class R {
10
	public static final class anim {
11
		public static final int hyperspace_in = 0x7f040000;
12
		public static final int hyperspace_out = 0x7f040001;
13
		public static final int push_left_in = 0x7f040002;
14
		public static final int push_left_out = 0x7f040003;
15
		public static final int push_right_in = 0x7f040004;
16
		public static final int push_right_out = 0x7f040005;
17
		public static final int scale_action = 0x7f040006;
18
		public static final int shut_open_in = 0x7f040007;
19
		public static final int shut_open_out = 0x7f040008;
20
	}
21
	public static final class drawable {
22
		public static final int audio_activity_dialog = 0x7f020000;
23
		public static final int keyboard_key = 0x7f020002;
24
		public static final int keyboard_normal_bg = 0x7f020003;
25
		public static final int keyboard_normal_hl_bg = 0x7f020004;
26
		public static final int keyboard_qwerty = 0x7f020005;
27
		public static final int keyboard_sym_delete = 0x7f020006;
28
		public static final int keyboard_sym_shift = 0x7f020007;
29
		public static final int keyboard_sym_space = 0x7f020008;
30
		public static final int keyboard_symbols = 0x7f020009;
31
		public static final int nfc_bg = 0x7f02000a;
32
		public static final int record_mic_normal = 0x7f02000b;
33
		public static final int record_mic_press = 0x7f02000c;
34
		public static final int screenlock_arrow = 0x7f02000d;
35
		public static final int screenlock_line = 0x7f02000e;
36
		public static final int screenlock_line_error = 0x7f02000f;
37
		public static final int screenlock_line_semicircle = 0x7f020010;
38
		public static final int screenlock_line_semicircle_error = 0x7f020011;
39
		public static final int screenlock_round_click = 0x7f020012;
40
		public static final int screenlock_round_click_error = 0x7f020013;
41
		public static final int screenlock_round_original = 0x7f020014;
42
		public static final int screenlock_welcome_bg = 0x7f020015;
43
		public static final int share_apk_activity_dialog = 0x7f020016;
44
	}
45
	public static final class id {
46
		public static final int deviceListView = 0x7f0a0008;
47
		public static final int deviceNameTV = 0x7f0a000b;
48
		public static final int exit = 0x7f0a0009;
49
		public static final int forget_btn = 0x7f0a0005;
50
		public static final int keyboard_view = 0x7f0a0002;
51
		public static final int lock_view = 0x7f0a0003;
52
		public static final int macAddressTV = 0x7f0a000c;
53
		public static final int micButton = 0x7f0a0001;
54
		public static final int notify = 0x7f0a0004;
55
		public static final int recordLabel = 0x7f0a0000;
56
		public static final int reset_btn = 0x7f0a0006;
57
		public static final int search = 0x7f0a000a;
58
		public static final int share = 0x7f0a0007;
59
	}
60
	public static final class layout {
61
		public static final int audio_recorder = 0x7f030001;
62
		public static final int keyboard = 0x7f030002;
63
		public static final int nfcard = 0x7f030003;
64
		public static final int screenlock_login_layout2 = 0x7f030004;
65
		public static final int screenlock_reset_lock_layout = 0x7f030005;
66
		public static final int share_apk_activity = 0x7f030006;
67
		public static final int share_apk_device_list_item = 0x7f030007;
68
	}
69
	public static final class raw {
70
		public static final int beep = 0x7f050000;
71
	}
72
	public static final class string {
73
		public static final int app_name = 0x7f060000;
74
		public static final int imgContentDesc = 0x7f060003;
75
		public static final int pressTip = 0x7f060002;
76
		public static final int recording = 0x7f060001;
77
		public static final int sa_confirm_share = 0x7f06000a;
78
		public static final int sa_exit = 0x7f060009;
79
		public static final int sa_mac_address = 0x7f060006;
80
		public static final int sa_search = 0x7f060007;
81
		public static final int sa_searching = 0x7f060008;
82
		public static final int sa_share = 0x7f060005;
83
		public static final int sa_tip = 0x7f06000b;
84
		public static final int tips = 0x7f060004;
85
	}
86
	public static final class style {
87
		public static final int AppBaseTheme = 0x7f070004;
88
		public static final int AppTheme = 0x7f070005;
89
		public static final int AudioDialogTheme = 0x7f070000;
90
		public static final int CustomDialogTheme = 0x7f070001;
91
		public static final int ShareApkDialogTheme = 0x7f070002;
92
		public static final int SlidingMenuTheme = 0x7f070003;
93
	}
94
}

+ 15 - 0
ipu-VideoCompressor/jni/Android.mk

@ -0,0 +1,15 @@
1
LOCAL_PATH := $(call my-dir)
2
3
include $(CLEAR_VARS)
4
5
LOCAL_MODULE := ARM_ARCH
6
7
LOCAL_SRC_FILES := armArch.c
8
9
LOCAL_CFLAGS := -DHAVE_NEON=1
10
LOCAL_STATIC_LIBRARIES := cpufeatures
11
12
LOCAL_LDLIBS := -llog
13
14
include $(BUILD_SHARED_LIBRARY)
15
$(call import-module,cpufeatures)

+ 4 - 0
ipu-VideoCompressor/jni/Application.mk

@ -0,0 +1,4 @@
1
# Build for arm only
2
APP_ABI := armeabi armeabi-v7a x86
3
4
APP_PLATFORM := android-18

+ 29 - 0
ipu-VideoCompressor/jni/armArch.c

@ -0,0 +1,29 @@
1
#include <jni.h>
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <cpu-features.h>
5
6
jstring
7
Java_com_ai_ipu_libffmpeg_ArmArchHelper_cpuArchFromJNI(JNIEnv* env, jobject obj)
8
{
9
    // Maximum we need to store here is ARM v7-neon
10
    // Which is 11 char long, so initializing a character array of length 11
11
	char arch_info[11] = "";
12
13
    // checking if CPU is of ARM family or not
14
	if (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) {
15
		strcpy(arch_info, "ARM");
16
17
		// checking if CPU is ARM v7 or not
18
		uint64_t cpuFeatures = android_getCpuFeatures();
19
		if ((cpuFeatures & ANDROID_CPU_ARM_FEATURE_ARMv7) != 0) {
20
		    strcat(arch_info, " v7");
21
22
			// checking if CPU is ARM v7 Neon
23
			if((cpuFeatures & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
24
			    strcat(arch_info, "-neon");
25
			}
26
		}
27
	}
28
	return (*env)->NewStringUTF(env, arch_info);
29
}

BIN
ipu-VideoCompressor/libs/android-support-v4.jar


BIN
ipu-VideoCompressor/libs/armeabi-v7a/libARM_ARCH.so


BIN
ipu-VideoCompressor/libs/armeabi/libARM_ARCH.so


BIN
ipu-VideoCompressor/libs/x86/libARM_ARCH.so


+ 20 - 0
ipu-VideoCompressor/proguard-project.txt

@ -0,0 +1,20 @@
1
# To enable ProGuard in your project, edit project.properties
2
# to define the proguard.config property as described in that file.
3
#
4
# Add project specific ProGuard rules here.
5
# By default, the flags in this file are appended to flags specified
6
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7
# You can edit the include path and order by changing the ProGuard
8
# include property in project.properties.
9
#
10
# For more details, see
11
#   http://developer.android.com/guide/developing/tools/proguard.html
12
13
# Add any project specific keep options here:
14
15
# If your project uses WebView with JS, uncomment the following
16
# and specify the fully qualified class name to the JavaScript interface
17
# class:
18
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19
#   public *;
20
#}

+ 17 - 0
ipu-VideoCompressor/project.properties

@ -0,0 +1,17 @@
1
# This file is automatically generated by Android Tools.
2
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3
#
4
# This file must be checked in Version Control Systems.
5
#
6
# To customize properties used by the Ant build system edit
7
# "ant.properties", and override values to adapt the script to your
8
# project structure.
9
#
10
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12
13
# Project target.
14
target=android-18
15
android.library.reference.1=..\\ipu-ffmpeg
16
android.library=false
17
android.library.reference.2=../../androidshare0905/wade-mobile-common

BIN
ipu-VideoCompressor/res/drawable-hdpi/ic_launcher.png


BIN
ipu-VideoCompressor/res/drawable-mdpi/ic_launcher.png


BIN
ipu-VideoCompressor/res/drawable-xhdpi/ic_launcher.png


BIN
ipu-VideoCompressor/res/drawable-xxhdpi/ic_launcher.png


+ 12 - 0
ipu-VideoCompressor/res/layout/activity_main.xml

@ -0,0 +1,12 @@
1
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    android:layout_width="match_parent"
4
    android:layout_height="match_parent"
5
    tools:context="com.ai.ipu.videocompressor.MainActivity" >
6
7
    <TextView
8
        android:layout_width="wrap_content"
9
        android:layout_height="wrap_content"
10
        android:text="@string/hello_world" />
11
12
</RelativeLayout>

+ 11 - 0
ipu-VideoCompressor/res/menu/main.xml

@ -0,0 +1,11 @@
1
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2
    xmlns:tools="http://schemas.android.com/tools"
3
    tools:context="com.example.videocompressor.MainActivity" >
4
5
    <item
6
        android:id="@+id/action_settings"
7
        android:orderInCategory="100"
8
        android:showAsAction="never"
9
        android:title="@string/action_settings"/>
10
11
</menu>

+ 11 - 0
ipu-VideoCompressor/res/values-v11/styles.xml

@ -0,0 +1,11 @@
1
<resources>
2
3
    <!--
4
        Base application theme for API 11+. This theme completely replaces
5
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
6
    -->
7
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
8
        <!-- API 11 theme customizations can go here. -->
9
    </style>
10
11
</resources>

+ 12 - 0
ipu-VideoCompressor/res/values-v14/styles.xml

@ -0,0 +1,12 @@
1
<resources>
2
3
    <!--
4
        Base application theme for API 14+. This theme completely replaces
5
        AppBaseTheme from BOTH res/values/styles.xml and
6
        res/values-v11/styles.xml on API 14+ devices.
7
    -->
8
    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
9
        <!-- API 14 theme customizations can go here. -->
10
    </style>
11
12
</resources>

+ 10 - 0
ipu-VideoCompressor/res/values-w820dp/dimens.xml

@ -0,0 +1,10 @@
1
<resources>
2
3
    <!--
4
         Example customization of dimensions originally defined in res/values/dimens.xml
5
         (such as screen margins) for screens with more than 820dp of available width. This
6
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
7
    -->
8
    <dimen name="activity_horizontal_margin">64dp</dimen>
9
10
</resources>

+ 8 - 0
ipu-VideoCompressor/res/values/strings.xml

@ -0,0 +1,8 @@
1
<?xml version="1.0" encoding="utf-8"?>
2
<resources>
3
4
    <string name="app_name">Android-Video-Compressor</string>
5
    <string name="hello_world">Hello world!</string>
6
    <string name="action_settings">Settings</string>
7
8
</resources>

+ 20 - 0
ipu-VideoCompressor/res/values/styles.xml

@ -0,0 +1,20 @@
1
<resources>
2
3
    <!--
4
        Base application theme, dependent on API level. This theme is replaced
5
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
6
    -->
7
    <style name="AppBaseTheme" parent="android:Theme.Light">
8
        <!--
9
            Theme customizations available in newer API levels can go in
10
            res/values-vXX/styles.xml, while customizations related to
11
            backward-compatibility can go here.
12
        -->
13
    </style>
14
15
    <!-- Application theme. -->
16
    <style name="AppTheme" parent="AppBaseTheme">
17
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
18
    </style>
19
20
</resources>

+ 7 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/CompressListener.java

@ -0,0 +1,7 @@
1
package com.ai.ipu.videocompressor;
2
3
public interface CompressListener {
4
    public void onExecSuccess(String message);
5
    public void onExecFail(String reason);
6
    public void onExecProgress(String message);
7
}

+ 73 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/Compressor.java

@ -0,0 +1,73 @@
1
package com.ai.ipu.videocompressor;
2
3
import android.app.Activity;
4
5
import com.ai.ipu.libffmpeg.ExecuteBinaryResponseHandler;
6
import com.ai.ipu.libffmpeg.FFmpeg;
7
import com.ai.ipu.libffmpeg.LoadBinaryResponseHandler;
8
import com.ai.ipu.libffmpeg.exceptions.FFmpegCommandAlreadyRunningException;
9
import com.ai.ipu.libffmpeg.exceptions.FFmpegNotSupportedException;
10
public class Compressor {
11
12
    public Activity a;
13
    public FFmpeg ffmpeg;
14
    public Compressor(Activity activity){
15
        a = activity;
16
        ffmpeg = FFmpeg.getInstance(a);
17
    }
18
19
    public void loadBinary(final InitListener mListener) {
20
        try {
21
            ffmpeg.loadBinary(new LoadBinaryResponseHandler() {
22
                @Override
23
                public void onStart() {}
24
25
                @Override
26
                public void onFailure() {
27
                    mListener.onLoadFail("incompatible with this device");
28
                }
29
30
                @Override
31
                public void onSuccess() {
32
                    mListener.onLoadSuccess();
33
                }
34
                @Override
35
                public void onFinish() {
36
37
                }
38
            });
39
        } catch (FFmpegNotSupportedException e) {
40
            e.printStackTrace();
41
        }
42
    }
43
44
    public void execCommand(String cmd,final CompressListener mListener){
45
        try {
46
            ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
47
48
                @Override
49
                public void onStart() {}
50
51
                @Override
52
                public void onProgress(String message) { mListener.onExecProgress(message);}
53
54
                @Override
55
                public void onFailure(String message) { mListener.onExecFail(message); }
56
57
                @Override
58
                public void onSuccess(String message) {
59
                    mListener.onExecSuccess(message);
60
                }
61
62
                @Override
63
                public void onFinish() {}
64
            });
65
        } catch (FFmpegCommandAlreadyRunningException e) {
66
            e.printStackTrace();
67
        }
68
    }
69
70
71
72
73
}

+ 6 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/InitListener.java

@ -0,0 +1,6 @@
1
package com.ai.ipu.videocompressor;
2
3
public interface InitListener {
4
    public void onLoadSuccess();
5
    public void onLoadFail(String reason);
6
}

+ 59 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/MainActivity.java

@ -0,0 +1,59 @@
1
package com.ai.ipu.videocompressor;
2
3
import android.app.Activity;
4
import android.os.Bundle;
5
import android.os.Environment;
6
import android.util.Log;
7
import com.ai.ipu.videocompressor.R;
8
9
10
public class MainActivity extends Activity {
11
12
    public Compressor com;
13
    String cmd;
14
    @Override
15
    protected void onCreate(Bundle savedInstanceState) {
16
        super.onCreate(savedInstanceState);
17
        setContentView(R.layout.activity_main);
18
        
19
//        String filepath = "/sdcard" + "/video.mp4";
20
//        String decpath = "/sdcard" + "/to.mp4";
21
        
22
23
    	String filepath = "/sdcard" + "/video.3gp";
24
    	
25
    	String decpath = "/sdcard" + "/to.3gp";
26
        
27
        cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
28
        com = new Compressor(this);
29
30
        com.loadBinary(new InitListener() {
31
            @Override
32
            public void onLoadSuccess() {
33
                com.execCommand(cmd,new CompressListener() {
34
                    @Override
35
                    public void onExecSuccess(String message) {
36
                        Log.i("success",message);
37
                    }
38
39
                    @Override
40
                    public void onExecFail(String reason) {
41
                        Log.i("fail",reason);
42
                    }
43
44
                    @Override
45
                    public void onExecProgress(String message) {
46
                        Log.i("progress",message);
47
                    }
48
                });
49
            }
50
51
            @Override
52
            public void onLoadFail(String reason) {
53
                Log.i("fail",reason);
54
            }
55
        });
56
57
    }
58
59
}

+ 33 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/func/MobileVideoCompress.java

@ -0,0 +1,33 @@
1
package com.ai.ipu.videocompressor.func;
2
3
4
import org.json.JSONArray;
5
6
import com.ai.ipu.videocompressor.Compressor;
7
import com.ai.ipu.videocompressor.util.VideoCompressUtil;
8
import com.wade.mobile.frame.IWadeMobile;
9
import com.wade.mobile.frame.plugin.Plugin;
10
11
public class MobileVideoCompress extends Plugin {
12
	// String filePath = AppInfoUtil.getSdcardPath() + "/video.mp4";
13
	// String desPath = AppInfoUtil.getSdcardPath() + "/videoto.mp4";
14
//	
15
	String filepath = "/sdcard" + "/video.mp4";
16
	
17
	String decpath = "/sdcard" + "/to.mp4";
18
	
19
	
20
	String cmd = "-y -i " + filepath + " -strict -2 -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 640x352 -aspect 16:9 " + decpath;
21
	private Compressor com;
22
	private VideoCompressUtil vcUtil;
23
24
	public MobileVideoCompress(IWadeMobile wademobile) {
25
		super(wademobile);
26
		vcUtil = new VideoCompressUtil(context);
27
		com = new Compressor(context);
28
	}
29
30
	public void videoCompressor(JSONArray params) {
31
		vcUtil.videoCompressor(com, cmd);
32
	}
33
}

+ 48 - 0
ipu-VideoCompressor/src/com/ai/ipu/videocompressor/util/VideoCompressUtil.java

@ -0,0 +1,48 @@
1
package com.ai.ipu.videocompressor.util;
2
3
4
5
import com.ai.ipu.videocompressor.CompressListener;
6
import com.ai.ipu.videocompressor.Compressor;
7
import com.ai.ipu.videocompressor.InitListener;
8
9
import android.content.Context;
10
import android.util.Log;
11
12
13
public class VideoCompressUtil {
14
15
	private Context mContext;
16
	public VideoCompressUtil(Context context){
17
		this.mContext = context;
18
	}
19
	
20
	public void videoCompressor(final Compressor com, final String cmd){
21
		com.loadBinary(new InitListener() {
22
			@Override
23
			public void onLoadSuccess() {
24
				com.execCommand(cmd, new CompressListener() {
25
					@Override
26
					public void onExecSuccess(String message) {
27
						Log.i("success", message);
28
					}
29
30
					@Override
31
					public void onExecFail(String reason) {
32
						Log.i("failcom", reason);
33
					}
34
35
					@Override
36
					public void onExecProgress(String message) {
37
						Log.i("progress", message);
38
					}
39
				});
40
			}
41
			
42
			@Override
43
			public void onLoadFail(String reason) {
44
				Log.i("failinit", reason);
45
			}
46
		});
47
	}
48
}