- build win libs supporting svc2

This commit is contained in:
Richard Alam 2016-12-20 18:45:08 +00:00
parent af169be2db
commit c27c6cd584
35 changed files with 314 additions and 72 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -12,15 +12,16 @@
<resources>
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="javacv-screenshare-0.0.1.jar" main="true" />
<jar href="ffmpeg.jar" />
</resources>
<resources os="Windows" arch="amd64">
<nativelib href="ffmpeg-windows-x86_64.jar"/>
<nativelib href="ffmpeg-win-x86_64-native-svc2.jar"/>
<jar href="ffmpeg-win-x86_64-svc2.jar" />
</resources>
<resources os="Windows" arch="x86">
<nativelib href="$$jnlpUrl/lib/ffmpeg-windows-x86.jar"/>
<nativelib href="ffmpeg-win-x86-native-svc2.jar"/>
<jar href="ffmpeg-win-x86-svc2.jar" />
</resources>
<resources os="Linux" arch="x86_64 amd64">

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="$$jnlpUrl/lib" href="">
<!--
Keep href empty. Otherwise this jnlp file will always be cached.
http://www.coderanch.com/t/284889/JSP/java/Caching-JNLP
-->
<information>
<title>BigBlueButton Screen Share</title>
<vendor>BigBlueButton</vendor>
</information>
<resources>
<j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="javacv-screenshare-0.0.1.jar" main="true" />
<jar href="ffmpeg.jar" />
</resources>
<resources os="Windows" arch="amd64">
<nativelib href="ffmpeg-windows-x86_64.jar"/>
</resources>
<resources os="Windows" arch="x86">
<nativelib href="$$jnlpUrl/lib/ffmpeg-windows-x86.jar"/>
</resources>
<resources os="Linux" arch="x86_64 amd64">
<nativelib href="ffmpeg-linux-x86_64.jar"/>
</resources>
<resources os="Linux" arch="x86 i386 i486 i586 i686">
<nativelib href="ffmpeg-linux-x86.jar"/>
</resources>
<resources os="Mac OS X">
<nativelib href="ffmpeg-macosx-x86_64.jar"/>
</resources>
<application-desc
name="Desktop Sharing Demo Application"
main-class="org.bigbluebutton.screenshare.client.DeskshareMain">
<argument>$$publishUrl</argument>
<argument>$$serverUrl</argument>
<argument>$$meetingId</argument>
<argument>$$streamId</argument>
<argument>$$fullScreen</argument>
<argument>$$codecOptions</argument>
<argument>$$session</argument>
<argument>$$errorMessage</argument>
</application-desc>
<security><all-permissions/></security>
<update check="always" policy="always"/>
</jnlp>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" ?>
<project name="bbb-deskshare-applet" basedir=".">
<!-- How to sign the applet. From Ant in Action book -->
<!-- Sign jar with Certificate using pkcs12 file -->
<target name="check-certificate">
<input message="Enter cetificate filename:" addproperty="cert.name" />
<input message="Enter cetificate password:" addproperty="cert.password" />
<exec executable="/usr/bin/keytool" outputproperty="cert.info">
<arg line="-list" />
<arg line="-storetype pkcs12" />
<arg line="-keystore ${cert.name}" />
<arg line="-storepass ${cert.password}" />
<arg line="-v" />
</exec>
</target>
<target name="get-alias-name" depends="check-certificate">
<script language="javascript">
<![CDATA[
// getting the value
info = project.getProperty("cert.info");
alias = (info.match(/Alias name:(.*)/)[0]).replace("Alias name: ","");
project.setProperty("cert.alias",alias);
]]>
</script>
</target>
<target name="sign-javacpp-jar" depends="get-alias-name">
<signjar jar="workdir/javacpp.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
<target name="sign-ffmpeg-jar" depends="get-alias-name">
<signjar jar="workdir/ffmpeg.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
<target name="sign-javacv-jar" depends="get-alias-name">
<signjar jar="workdir/javacv.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
</project>

View File

@ -0,0 +1,16 @@
FFMPEG=ffmpeg-3.0.2-1.2-svc2.jar
if [ -d "workdir" ]; then
rm -rf workdir
fi
mkdir workdir
cp $FFMPEG workdir
cd workdir
jar xf $FFMPEG
rm $FFMPEG
rm -rf META-INF
jar cf ffmpeg.jar *
cd ..
ant sign-ffmpeg-jar
cp workdir/ffmpeg.jar ../../../../../app/jws/lib/ffmpeg-win-x86-svc2.jar
rm -rf workdir

View File

@ -0,0 +1,10 @@
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility=1.6
targetCompatibility=1.6
version = '0.0.1'
archivesBaseName = 'ffmpeg-windows-x86'

View File

@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<project name="ffmpeg-win-x86-signing" basedir=".">
<!-- Sign jar with Certificate using pkcs12 file -->
<target name="check-certificate">
<input message="Enter cetificate filename:" addproperty="cert.name" />
<input message="Enter cetificate password:" addproperty="cert.password" />
<exec executable="/usr/bin/keytool" outputproperty="cert.info">
<arg line="-list" />
<arg line="-storetype pkcs12" />
<arg line="-keystore ${cert.name}" />
<arg line="-storepass ${cert.password}" />
<arg line="-v" />
</exec>
</target>
<target name="get-alias-name" depends="check-certificate">
<script language="javascript">
<![CDATA[
// getting the value
info = project.getProperty("cert.info");
alias = (info.match(/Alias name:(.*)/)[0]).replace("Alias name: ","");
project.setProperty("cert.alias",alias);
]]>
</script>
</target>
<target name="sign-jar" depends="get-alias-name">
<signjar jar="build/libs/ffmpeg-windows-x86-0.0.1.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
</project>

View File

@ -0,0 +1,17 @@
FFMPEG=ffmpeg-3.0.2-1.2-windows-x86.jar
mkdir workdir
cp $FFMPEG workdir/ffmpeg-windows-x86.jar
rm -rf src
mkdir -p src/main/resources
mkdir -p src/main/java
cd workdir
jar xvf ffmpeg-windows-x86.jar
cp org/bytedeco/javacpp/windows-x86/*.dll ../src/main/resources
cd ..
rm -rf workdir
gradle jar
cp build/libs/ffmpeg-windows-x86-0.0.1.jar ../../../unsigned-jars/ffmpeg-win-x86-native-svc2-unsigned.jar
ant sign-jar
cp build/libs/ffmpeg-windows-x86-0.0.1.jar ../../../../../app/jws/lib/ffmpeg-win-x86-native-svc2.jar
rm -rf src

View File

@ -10,8 +10,8 @@ cp org/bytedeco/javacpp/windows-x86_64/*.dll ../src/main/resources
cd ..
rm -rf workdir
gradle jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../unsigned-jars/ffmpeg-windows-x86_64-unsigned.jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../unsigned-jars/ffmpeg-win-x86_64-svc2--unsigned.jar
ant sign-jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../../../app/jws/lib/ffmpeg-windows-x86_64.jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../../../app/jws/lib/ffmpeg-win-x86_64-svc2.jar
rm -rf src

View File

@ -0,0 +1,53 @@
<?xml version="1.0" ?>
<project name="bbb-deskshare-applet" basedir=".">
<!-- How to sign the applet. From Ant in Action book -->
<!-- Sign jar with Certificate using pkcs12 file -->
<target name="check-certificate">
<input message="Enter cetificate filename:" addproperty="cert.name" />
<input message="Enter cetificate password:" addproperty="cert.password" />
<exec executable="/usr/bin/keytool" outputproperty="cert.info">
<arg line="-list" />
<arg line="-storetype pkcs12" />
<arg line="-keystore ${cert.name}" />
<arg line="-storepass ${cert.password}" />
<arg line="-v" />
</exec>
</target>
<target name="get-alias-name" depends="check-certificate">
<script language="javascript">
<![CDATA[
// getting the value
info = project.getProperty("cert.info");
alias = (info.match(/Alias name:(.*)/)[0]).replace("Alias name: ","");
project.setProperty("cert.alias",alias);
]]>
</script>
</target>
<target name="sign-javacpp-jar" depends="get-alias-name">
<signjar jar="workdir/javacpp.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
<target name="sign-ffmpeg-jar" depends="get-alias-name">
<signjar jar="workdir/ffmpeg.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
<target name="sign-javacv-jar" depends="get-alias-name">
<signjar jar="workdir/javacv.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
</project>

View File

@ -0,0 +1,16 @@
FFMPEG=ffmpeg-3.0.2-1.2-svc2.jar
if [ -d "workdir" ]; then
rm -rf workdir
fi
mkdir workdir
cp $FFMPEG workdir
cd workdir
jar xf $FFMPEG
rm $FFMPEG
rm -rf META-INF
jar cf ffmpeg.jar *
cd ..
ant sign-ffmpeg-jar
cp workdir/ffmpeg.jar ../../../../../app/jws/lib/ffmpeg-win-x86_64-svc2.jar
rm -rf workdir

View File

@ -0,0 +1,10 @@
apply plugin: 'java'
apply plugin: 'eclipse'
sourceCompatibility=1.6
targetCompatibility=1.6
version = '0.0.1'
archivesBaseName = 'ffmpeg-windows-x86_64'

View File

@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<project name="ffmpeg-win-x86-signing" basedir=".">
<!-- Sign jar with Certificate using pkcs12 file -->
<target name="check-certificate">
<input message="Enter cetificate filename:" addproperty="cert.name" />
<input message="Enter cetificate password:" addproperty="cert.password" />
<exec executable="/usr/bin/keytool" outputproperty="cert.info">
<arg line="-list" />
<arg line="-storetype pkcs12" />
<arg line="-keystore ${cert.name}" />
<arg line="-storepass ${cert.password}" />
<arg line="-v" />
</exec>
</target>
<target name="get-alias-name" depends="check-certificate">
<script language="javascript">
<![CDATA[
// getting the value
info = project.getProperty("cert.info");
alias = (info.match(/Alias name:(.*)/)[0]).replace("Alias name: ","");
project.setProperty("cert.alias",alias);
]]>
</script>
</target>
<target name="sign-jar" depends="get-alias-name">
<signjar jar="build/libs/ffmpeg-windows-x86_64-0.0.1.jar"
storetype="pkcs12"
keystore="${cert.name}"
storepass="${cert.password}"
alias="${cert.alias}" />
</target>
</project>

View File

@ -0,0 +1,17 @@
FFMPEG=ffmpeg-3.0.2-1.2-windows-x86_64.jar
mkdir workdir
cp $FFMPEG workdir/ffmpeg-windows-x86_64.jar
rm -rf src
mkdir -p src/main/resources
mkdir -p src/main/java
cd workdir
jar xvf ffmpeg-windows-x86_64.jar
cp org/bytedeco/javacpp/windows-x86_64/*.dll ../src/main/resources
cd ..
rm -rf workdir
gradle jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../../../unsigned-jars/ffmpeg-win-x86_64-native-svc2-unsigned.jar
ant sign-jar
cp build/libs/ffmpeg-windows-x86_64-0.0.1.jar ../../../../../app/jws/lib/ffmpeg-win-x86_64-native-svc2.jar
rm -rf src

View File

@ -0,0 +1,16 @@
FFMPEG=ffmpeg-3.0.2-1.2-svc2.jar
if [ -d "workdir" ]; then
rm -rf workdir
fi
mkdir workdir
cp $FFMPEG workdir
cd workdir
jar xf $FFMPEG
rm $FFMPEG
rm -rf META-INF
jar cf ffmpeg.jar *
cd ..
ant sign-ffmpeg-jar
cp workdir/ffmpeg.jar ../../../app/jws/lib/ffmpeg-svc2.jar
rm -rf workdir

View File

@ -0,0 +1,2 @@
cp build/libs/javacv-screenshare-0.0.1.jar /usr/share/red5/webapps/screenshare/lib

View File

@ -221,7 +221,7 @@ public class DeskshareMain implements ClientListener, LifeLineListener {
try {
System.out.println("Trigger stop client. " + exitReasonQ.remainingCapacity());
exitReasonQ.put(reason);
System.out.println("Triggered stop client.");
System.out.println("Triggered stop client. reason=" + reason.getExitCode());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();

View File

@ -114,14 +114,14 @@ public class ScreenRegionSharer implements ScreenSharer, NetworkConnectionListen
public void networkConnectionException(ExitCode reason, String streamId) {
if (listener != null) {
if (reason.getExitCode() == ExitCode.PAUSED.getExitCode()) {
//System.out.println(NAME + "Pausing. Reason=" + reason.getExitCode());
System.out.println(NAME + "Pausing. Reason=" + reason.getExitCode());
pause();
} else if (reason.getExitCode() == ExitCode.START.getExitCode()) {
this.streamId = streamId;
//System.out.println(NAME + "starting. StreamId=" + this.streamId + " fullScreen=" + fullScreen);
System.out.println(NAME + "starting. StreamId=" + this.streamId + " fullScreen=" + fullScreen);
start();
} else {
//System.out.println(NAME + "Closing. Reason=" + reason.getExitCode());
System.out.println(NAME + "Closing. Reason=" + reason.getExitCode());
listener.onClientStop(reason);
}
}

View File

@ -39,8 +39,8 @@ public class ScreenSharerRunner {
this.ssi = ssi;
this.listener = listener;
// System.out.println("ScreenSharerRunner[captureWidth=" + ssi.captureWidth + ",captureHeight=" + ssi.captureHeight + "][" + ssi.x + "," + ssi.y +"]"
// + "[scaleWidth=" + ssi.scaleWidth + ",scaleHeight=" + ssi.scaleHeight + "]");
System.out.println("ScreenSharerRunner[captureWidth=" + ssi.captureWidth + ",captureHeight=" + ssi.captureHeight + "][" + ssi.x + "," + ssi.y +"]"
+ "[scaleWidth=" + ssi.scaleWidth + ",scaleHeight=" + ssi.scaleHeight + "]");
jcs = new FfmpegScreenshare(ssi, listener);
}
@ -76,12 +76,12 @@ public class ScreenSharerRunner {
}
public void disconnectSharing(){
//System.out.println(NAME + "Disconnected");
System.out.println(NAME + "Disconnected");
jcs.stop();
}
public void stopSharing() {
//System.out.println(NAME + "Stopping");
System.out.println(NAME + "Stopping");
jcs.stop();
}

View File

@ -101,6 +101,7 @@ public class FfmpegScreenshare {
ignoreDisconnect = false;
grabber.start();
} catch (Exception e) {
System.out.println("Exception starting grabber.");
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
@ -111,6 +112,7 @@ public class FfmpegScreenshare {
try {
mainRecorder.start();
} catch (Exception e) {
System.out.println("Exception starting recorder. \n" + e.toString());
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
}
@ -155,13 +157,14 @@ public class FfmpegScreenshare {
//System.out.println("frame timestamp=[" + frame.timestamp + "] ");
mainRecorder.record(frame);
} catch (Exception e) {
//System.out.println("CaptureScreen Exception 1");
System.out.println("CaptureScreen Exception 1");
if (!ignoreDisconnect) {
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
}
}
} catch (Exception e1) {
System.out.println("Exception grabbing image");
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
@ -183,6 +186,7 @@ public class FfmpegScreenshare {
try{
Thread.sleep(dur);
} catch (Exception e){
System.out.println("Exception pausing screen share.");
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
}
@ -194,28 +198,29 @@ public class FfmpegScreenshare {
while (startBroadcast){
captureScreen();
}
//System.out.println("*******************Stopped screen capture. !!!!!!!!!!!!!!!!!!!");
System.out.println("*******************Stopped screen capture. !!!!!!!!!!!!!!!!!!!");
}
};
startBroadcastExec.execute(startBroadcastRunner);
}
public void stop() {
//System.out.println("Stopping screen capture.");
System.out.println("Stopping screen capture.");
startBroadcast = false;
if (mainRecorder != null) {
try {
ignoreDisconnect = true;
//System.out.println("mainRecorder.stop.");
System.out.println("mainRecorder.stop.");
mainRecorder.stop();
//System.out.println("mainRecorder.release.");
System.out.println("mainRecorder.release.");
mainRecorder.release();
//System.out.println("grabber.stop.");
System.out.println("grabber.stop.");
// Do not invoke grabber.stop as it exits the JWS app.
// Not sure why. (ralam - aug 10, 2016)
//grabber.stop();
//System.out.println("End stop sequence.");
} catch (Exception e) {
System.out.println("Exception stopping screen share.");
listener.networkConnectionException(ExitCode.INTERNAL_ERROR, null);
}
}
@ -291,6 +296,7 @@ private FFmpegFrameRecorder setupWindowsRecorder(String url, int width, int hei
winRecorder.setFormat("flv");
if (useH264) {
System.out.println("Using H264 codec");
// H264
winRecorder.setVideoCodec(AV_CODEC_ID_H264);
winRecorder.setPixelFormat(AV_PIX_FMT_YUV420P);
@ -299,6 +305,7 @@ private FFmpegFrameRecorder setupWindowsRecorder(String url, int width, int hei
winRecorder.setVideoOption("tune", "zerolatency");
winRecorder.setVideoOption("intra-refresh", "1");
} else {
System.out.println("Using SVC2 codec");
// Flash SVC2
winRecorder.setVideoCodec(AV_CODEC_ID_FLASHSV2);
winRecorder.setPixelFormat(AV_PIX_FMT_BGR24);