Skip to content

Commit

Permalink
Bump to verion 4.1.0 full version
Browse files Browse the repository at this point in the history
  • Loading branch information
Crossle Song committed Aug 30, 2013
1 parent 6163853 commit 4db7eae
Show file tree
Hide file tree
Showing 24 changed files with 1,012 additions and 131 deletions.
2 changes: 1 addition & 1 deletion vitamio-sample/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:versionName="0.0.2" >

<uses-sdk
android:minSdkVersion="14"
android:minSdkVersion="7"
android:targetSdkVersion="18" />

<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down
Binary file modified vitamio/libs/armeabi-v7a/libvinit.so
Binary file not shown.
Binary file modified vitamio/libs/armeabi/libvinit.so
Binary file not shown.
Binary file added vitamio/libs/x86/libvinit.so
Binary file not shown.
2 changes: 1 addition & 1 deletion vitamio/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-17
target=android-18
android.library=true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vitamio/res/drawable-xhdpi/scrubber_primary_holo.9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions vitamio/res/drawable/scrubber_control_selector_holo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011 The Android Open Source Project 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/scrubber_control_disabled_holo" android:state_enabled="false"/>
<item android:drawable="@drawable/scrubber_control_pressed_holo" android:state_pressed="true"/>
<item android:drawable="@drawable/scrubber_control_focused_holo" android:state_selected="true"/>
<item android:drawable="@drawable/scrubber_control_normal_holo"/>

</selector>
28 changes: 28 additions & 0 deletions vitamio/res/drawable/scrubber_progress_horizontal_holo_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 The Android Open Source Project 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.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item
android:id="@android:id/background"
android:drawable="@drawable/scrubber_secondary_holo"/>
<item android:id="@android:id/secondaryProgress">
<scale
android:drawable="@drawable/scrubber_secondary_holo"
android:scaleWidth="100%" />
</item>
<item android:id="@android:id/progress">
<scale
android:drawable="@drawable/scrubber_primary_holo"
android:scaleWidth="100%" />
</item>

</layer-list>
108 changes: 54 additions & 54 deletions vitamio/res/layout/mediacontroller.xml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="74dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0.0dip"
android:layout_marginLeft="0.0dip"
android:layout_marginRight="0.0dip"
android:background="@drawable/mediacontroller_bg"
android:orientation="horizontal">
android:layout_width="match_parent"
android:layout_height="74dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0.0dip"
android:layout_marginLeft="0.0dip"
android:layout_marginRight="0.0dip"
android:background="@drawable/mediacontroller_bg"
android:orientation="horizontal" >

<ImageButton
android:id="@+id/mediacontroller_play_pause"
android:layout_width="54.6dip"
android:layout_height="32dip"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="7.0dip"
android:background="#00000000"
android:contentDescription="@string/mediacontroller_play_pause"
android:gravity="center"
android:src="@drawable/mediacontroller_pause_button"/>
android:id="@+id/mediacontroller_play_pause"
android:layout_width="54.6dip"
android:layout_height="32dip"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="7.0dip"
android:background="#00000000"
android:contentDescription="@string/mediacontroller_play_pause"
android:gravity="center"
android:src="@drawable/mediacontroller_pause_button" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dip"
android:layout_marginLeft="7.0dip"
android:layout_marginRight="7.0dip"
android:layout_marginTop="2dip"
android:layout_toLeftOf="@+id/mediacontroller_play_pause">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="2dip"
android:layout_marginLeft="7.0dip"
android:layout_marginRight="7.0dip"
android:layout_marginTop="2dip"
android:layout_toLeftOf="@+id/mediacontroller_play_pause" >

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/mediacontroller_time_current"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
android:id="@+id/mediacontroller_time_current"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />

<TextView
android:id="@+id/mediacontroller_time_total"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"/>
android:id="@+id/mediacontroller_time_total"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</RelativeLayout>

<SeekBar
android:id="@+id/mediacontroller_seekbar"
style="@style/MediaController_SeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:focusable="true"
android:max="1000"/>
android:id="@+id/mediacontroller_seekbar"
style="@style/MediaController_SeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:focusable="true"
android:max="1000" />

<TextView
android:id="@+id/mediacontroller_file_name"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:ellipsize="marquee"
android:singleLine="true"/>
android:id="@+id/mediacontroller_file_name"
style="@style/MediaController_Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:ellipsize="marquee"
android:singleLine="true" />
</RelativeLayout>

</RelativeLayout>
Binary file modified vitamio/res/raw/libarm.so
Binary file not shown.
15 changes: 10 additions & 5 deletions vitamio/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>

<style name="MediaController_SeekBar">
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
<item name="android:progressDrawable">@drawable/mediacontroller_seekbar</item>
<item name="android:thumb">@drawable/mediacontroller_seekbar_thumb</item>

<style name="MediaController_SeekBar" parent="android:Widget.SeekBar">
<item name="android:progressDrawable">@drawable/scrubber_progress_horizontal_holo_dark</item>
<item name="android:indeterminateDrawable">@drawable/scrubber_progress_horizontal_holo_dark</item>
<item name="android:minHeight">13dip</item>
<item name="android:maxHeight">13dip</item>
<item name="android:thumb">@drawable/scrubber_control_selector_holo</item>
<item name="android:thumbOffset">16dip</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
</style>

<style name="MediaController_Text">
Expand Down
95 changes: 73 additions & 22 deletions vitamio/src/io/vov/vitamio/MediaPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
import io.vov.vitamio.utils.FileUtils;
import io.vov.vitamio.utils.Log;

import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -191,8 +193,8 @@ public MediaPlayer(Context ctx, boolean preferHWDecoder) {
String LIB_ROOT = Vitamio.getLibraryPath();
if (preferHWDecoder) {
if (!NATIVE_OMX_LOADED.get()) {
if (Build.VERSION.SDK_INT > 15)
loadOMX_native(LIB_ROOT + "libOMX.16.so");
if (Build.VERSION.SDK_INT > 17)
loadOMX_native(LIB_ROOT + "libOMX.18.so");
else if (Build.VERSION.SDK_INT > 13)
loadOMX_native(LIB_ROOT + "libOMX.14.so");
else if (Build.VERSION.SDK_INT > 10)
Expand Down Expand Up @@ -317,7 +319,7 @@ public void setSurface(Surface surface) {
* form {@link #setDataSource(FileDescriptor)}.
*/
public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
_setDataSource(path, null);
_setDataSource(path, null, null);
}

/**
Expand All @@ -328,10 +330,10 @@ public void setDataSource(String path) throws IOException, IllegalArgumentExcept
* @throws IllegalStateException if it is called in an invalid state
*/
public void setDataSource(Context context, Uri uri) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
setDataSource(context, uri, "");
setDataSource(context, uri, null);
}

public void setDataSource(Context context, Uri uri, String headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
public void setDataSource(Context context, Uri uri, Map<String, String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
if (context == null || uri == null)
throw new IllegalArgumentException();
String scheme = uri.getScheme();
Expand All @@ -350,27 +352,68 @@ public void setDataSource(Context context, Uri uri, String headers) throws IOExc
} catch (Exception e) {
closeFD();
}
_setDataSource(uri.toString(), headers);
setDataSource(uri.toString(), headers);
}

/**
* Sets the data source as a content Uri.
* Sets the data source (file-path or http/rtsp URL) to use.
*
* @param context the Context to use when resolving the Uri
* @param uri the Content URI of the data you want to play
* @param headers the headers to be sent together with the request for the data
* @param path the path of the file, or the http/rtsp URL of the stream you want to play
* @param headers the headers associated with the http request for the stream you want to play
* @throws IllegalStateException if it is called in an invalid state
*/
public void setDataSource(Context context, Uri uri, Map<String, String> headers) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
StringBuffer headerBuffer = null;
if (headers != null) {
headerBuffer = new StringBuffer();
for (Map.Entry<String, String> entry : headers.entrySet()) {
headerBuffer.append(entry.getKey()).append(":").append(entry.getValue()).append("\r\n");
public void setDataSource(String path, Map<String, String> headers)
throws IOException, IllegalArgumentException, SecurityException, IllegalStateException
{
String[] keys = null;
String[] values = null;

if (headers != null) {
keys = new String[headers.size()];
values = new String[headers.size()];

int i = 0;
for (Map.Entry<String, String> entry: headers.entrySet()) {
keys[i] = entry.getKey();
values[i] = entry.getValue();
++i;
}
}
}
setDataSource(context, uri, headerBuffer == null ? null : headerBuffer.toString());
return;
setDataSource(path, keys, values);
}

/**
* 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
* @param keys AVOption key
* @param values AVOption value
* @throws IllegalStateException if it is called in an invalid state
*/
public void setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException {
final Uri uri = Uri.parse(path);
if ("file".equals(uri.getScheme())) {
path = uri.getPath();
}

final File file = new File(path);
if (file.exists()) {
FileInputStream is = new FileInputStream(file);
FileDescriptor fd = is.getFD();
setDataSource(fd);
is.close();
} else {
_setDataSource(path, keys, values);
}
}

/**
* Set the segments source url
* @param segments the array path of the url e.g. Segmented video list
* @param cacheDir e.g. getCacheDir().toString()
*/
public void setDataSegments(String[] uris, String cacheDir) {
_setDataSegmentsSource(uris, cacheDir);
}

public void setOnHWRenderFailedListener(OnHWRenderFailedListener l) {
Expand All @@ -382,10 +425,11 @@ public void setOnHWRenderFailedListener(OnHWRenderFailedListener l) {
*
* @param path the path of the file, or the http/rtsp/mms URL of the stream you
* want to play
* @param headers protocol headers, e.g. HTTP header
* @param keys AVOption key
* @param values AVOption value
* @throws IllegalStateException if it is called in an invalid state
*/
public native void _setDataSource(String path, String headers) throws IOException, IllegalArgumentException, IllegalStateException;
private native void _setDataSource(String path, String[] keys, String[] values) throws IOException, IllegalArgumentException, IllegalStateException;

/**
* Sets the data source (FileDescriptor) to use. It is the caller's
Expand All @@ -396,6 +440,13 @@ public void setOnHWRenderFailedListener(OnHWRenderFailedListener l) {
* @throws IllegalStateException if it is called in an invalid state
*/
public native void setDataSource(FileDescriptor fd) throws IOException, IllegalArgumentException, IllegalStateException;

/**
* Set the segments source url
* @param segments the array path of the url
* @param cacheDir e.g. getCacheDir().toString()
*/
private native void _setDataSegmentsSource(String[] segments, String cacheDir);

/**
* Prepares the player for playback, synchronously.
Expand Down
Loading

0 comments on commit 4db7eae

Please sign in to comment.