Skip to content

Commit

Permalink
MediaCodec API support on the way. Important changes in RtpSocket. Ne…
Browse files Browse the repository at this point in the history
…w RtspClient class for wowza users.
  • Loading branch information
fyhertz committed Aug 20, 2013
1 parent dcc9143 commit 18a826c
Show file tree
Hide file tree
Showing 23 changed files with 1,483 additions and 427 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.majorkernelpanic.spydroid"
android:versionCode="810"
android:versionName="8.1" >
android:versionCode="900"
android:versionName="9.0" >

<uses-sdk
android:minSdkVersion="9"
Expand Down
2 changes: 1 addition & 1 deletion assets/www/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h2>You must leave the screen of your smartphone on !</h2>
</div>

<div class="popup" id="error-noplugin">
<h2>You need to install or update VLC and the VLC mozilla plugin ! qsdqs qsdqs qsdqs</h2>
<h2>You need to install or update VLC and the VLC mozilla plugin !</h2>
<h3>Get VLC: <a href="http://www.videolan.org/vlc/#download" target="_blank">Linux</a> <a href="http://www.videolan.org/vlc/download-windows.html" target="_blank">Windows</a> <a href="http://www.videolan.org/vlc/download-macosx.html" target="_blank">MacOSX</a></h3>
<div id="content"><h3>During the installation make sure to check the mozilla plugin !</h3></div>
<img src="images/install.jpg" width="316px" height="243px" alt="Install VLC and the mozilla plugin" />
Expand Down
32 changes: 25 additions & 7 deletions res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,34 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TextView
<LinearLayout
android:id="@+id/streaming"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_gravity="top"
android:gravity="center"
android:text="@string/streaming"
android:textColor="#11FF11"
android:textSize="20sp"
android:visibility="gone" />
android:orientation="vertical"
android:visibility="gone" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/streaming"
android:textColor="#11FF11"
android:textSize="20sp" />

<TextView
android:id="@+id/bitrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/bitrate"
android:textColor="#11FF11"
android:textSize="16sp" />
</LinearLayout>

<TextView
android:id="@+id/advice"
Expand Down
1 change: 1 addition & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<string name="options_activity_title">Settings</string>
<string name="warning">Turn on wifi or tethering !</string>
<string name="streaming">Streaming !</string>
<string name="bitrate">0 kbps</string>
<string name="notification_title">Spydroid</string>
<string name="notification_content">Beware ! Spydroid is running ;)</string>
<string name="preview">Start a stream to enable the preview !</string>
Expand Down
10 changes: 10 additions & 0 deletions src/net/majorkernelpanic/spydroid/api/CustomHttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ public boolean isStreaming() {
return false;
}

public long getBitrate() {
long bitrate = 0;
for ( Session session : mSessions.keySet() ) {
if ( session != null ) {
if (session.isStreaming()) bitrate += session.getBitrate();
}
}
return bitrate;
}

class CustomRequestHandler implements HttpRequestHandler {

public CustomRequestHandler() {}
Expand Down
28 changes: 25 additions & 3 deletions src/net/majorkernelpanic/spydroid/ui/HandsetFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
Expand All @@ -50,8 +51,10 @@

public class HandsetFragment extends Fragment {

private TextView mDescription1, mDescription2, mLine1, mLine2, mVersion, mSignWifi, mSignStreaming;
private LinearLayout mSignInformation;
public final static String TAG = "HandsetFragment";

private TextView mDescription1, mDescription2, mLine1, mLine2, mVersion, mSignWifi, mTextBitrate;
private LinearLayout mSignInformation, mSignStreaming;
private Animation mPulseAnimation;

private SpydroidApplication mApplication;
Expand All @@ -74,9 +77,10 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
mDescription2 = (TextView)rootView.findViewById(R.id.line2_description);
mVersion = (TextView)rootView.findViewById(R.id.version);
mSignWifi = (TextView)rootView.findViewById(R.id.advice);
mSignStreaming = (TextView)rootView.findViewById(R.id.streaming);
mSignStreaming = (LinearLayout)rootView.findViewById(R.id.streaming);
mSignInformation = (LinearLayout)rootView.findViewById(R.id.information);
mPulseAnimation = AnimationUtils.loadAnimation(mApplication.getApplicationContext(), R.anim.pulse);
mTextBitrate = (TextView)rootView.findViewById(R.id.bitrate);
return rootView ;
}

Expand Down Expand Up @@ -152,6 +156,7 @@ private void streamingState(int state) {
mSignWifi.clearAnimation();
mSignStreaming.setVisibility(View.VISIBLE);
mSignStreaming.startAnimation(mPulseAnimation);
mHandler.post(mUpdateBitrate);
mSignInformation.setVisibility(View.INVISIBLE);
mSignWifi.setVisibility(View.GONE);
} else if (state==2) {
Expand Down Expand Up @@ -228,5 +233,22 @@ public void onReceive(Context context, Intent intent) {
}
}
};

private final Handler mHandler = new Handler();

private Runnable mUpdateBitrate = new Runnable() {
@Override
public void run() {
if ((mRtspServer != null && mRtspServer.isStreaming()) || (mHttpServer != null && mHttpServer.isStreaming())) {
long bitrate = 0;
bitrate += mRtspServer!=null?mRtspServer.getBitrate():0;
bitrate += mHttpServer!=null?mHttpServer.getBitrate():0;
mTextBitrate.setText(""+bitrate/1000+" kbps");
mHandler.postDelayed(mUpdateBitrate, 1000);
} else {
mTextBitrate.setText("0 kbps");
}
}
};

}
Loading

0 comments on commit 18a826c

Please sign in to comment.