Permalink
Browse files

Initial commit from old darcs repo

  • Loading branch information...
0 parents commit 9735b9d81143630bb9904dd5fe7c30667341aa34 @tonyg committed Apr 5, 2009
Showing with 7,784 additions and 0 deletions.
  1. +10 −0 camcaptureJMF/bin/camcaptureJMF
  2. +10 −0 camcaptureJMF/bin/camcaptureJMF.bat
  3. +17 −0 camcaptureJMF/bin/camcaptureJMF.jnlp
  4. +94 −0 camcaptureJMF/build.xml
  5. BIN camcaptureJMF/lib/jmf-2.1.1e.jar
  6. +123 −0 camcaptureJMF/src/net/lshift/camcapture/jmf/Main.java
  7. +4 −0 camcaptureLinux/bin/camcaptureLinux
  8. +93 −0 camcaptureLinux/build.xml
  9. +174 −0 camcaptureLinux/native/jv4l.c
  10. +101 −0 camcaptureLinux/src/net/lshift/camcapture/v4l/Driver.java
  11. +7 −0 camcaptureLinux/src/net/lshift/camcapture/v4l/DriverException.java
  12. +84 −0 camcaptureLinux/src/net/lshift/camcapture/v4l/Main.java
  13. +46 −0 camcaptureLinux/src/net/lshift/camcapture/v4l/VideoPicture.java
  14. +83 −0 camcaptureLinux/src/net/lshift/camcapture/v4l/VideoWindow.java
  15. +2 −0 camcaptureOSX/bin/camcaptureOSX
  16. +73 −0 camcaptureOSX/build.xml
  17. +111 −0 camcaptureOSX/src/net/lshift/camcapture/quicktime/Main.java
  18. +37 −0 camcapturecommon/src/net/lshift/camcapture/AMQAudio.java
  19. +114 −0 camcapturecommon/src/net/lshift/camcapture/AMQAudioDecoder.java
  20. +130 −0 camcapturecommon/src/net/lshift/camcapture/AMQAudioSender.java
  21. +79 −0 camcapturecommon/src/net/lshift/camcapture/AMQPacketProducer.java
  22. +45 −0 camcapturecommon/src/net/lshift/camcapture/AMQVideo.java
  23. +148 −0 camcapturecommon/src/net/lshift/camcapture/AMQVideoDecoder.java
  24. +146 −0 camcapturecommon/src/net/lshift/camcapture/AMQVideoSender.java
  25. +67 −0 camcapturecommon/src/net/lshift/camcapture/ArgumentDialog.java
  26. +80 −0 camcapturecommon/src/net/lshift/camcapture/CaptureBase.java
  27. +20 −0 camcapturecommon/src/net/lshift/camcapture/SwingUtil.java
  28. +274 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Add.java
  29. +599 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Encoder.java
  30. +804 −0 camcapturecommon/src/net/lshift/camcapture/gsm/GSMDecoder.java
  31. +118 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Gsm_Def.java
  32. +293 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Gsm_State.java
  33. +38 −0 camcapturecommon/src/net/lshift/camcapture/gsm/InvalidGSMFrameException.java
  34. +390 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Long_term.java
  35. +448 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Lpc.java
  36. +11 −0 camcapturecommon/src/net/lshift/camcapture/gsm/README
  37. +556 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Rpe.java
  38. +378 −0 camcapturecommon/src/net/lshift/camcapture/gsm/Short_term.java
  39. +2 −0 camdisplay/bin/camdisplay
  40. +10 −0 camdisplay/bin/camdisplay.bat
  41. +17 −0 camdisplay/bin/camdisplay.jnlp
  42. +83 −0 camdisplay/build.xml
  43. +78 −0 camdisplay/src/net/lshift/camdisplay/CamstreamComponent.java
  44. +230 −0 camdisplay/src/net/lshift/camdisplay/Main.java
  45. +20 −0 licenses/LICENSE
  46. +202 −0 licenses/LICENSE-APACHE2
  47. +339 −0 licenses/LICENSE-GPL2
  48. +463 −0 licenses/LICENSE-MPL-Camstream
  49. +467 −0 licenses/LICENSE-MPL-RabbitMQ
  50. +66 −0 package.sh
  51. BIN resources/RabbitMQLogo.png
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ ! -e "$JMFHOME/lib/jmf.jar" ]
+then
+ echo 'Please set $JMFHOME such that $JMFHOME/lib/jmf.jar exists'
+ exit 1
+fi
+
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JMFHOME/lib
+exec java -server -cp $(for d in *.jar; do echo -n "$d":; done)$JMFHOME/lib/jmf.jar net.lshift.camcapture.jmf.Main "$@"
@@ -0,0 +1,10 @@
+@echo off
+
+setlocal EnableDelayedExpansion
+
+set CP=
+for %%F in (*.jar) do set CP=!CP!;%%F
+
+start javaw -cp %CP% net.lshift.camcapture.jmf.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
+
+endlocal
@@ -0,0 +1,17 @@
+<jnlp spec="1.0" codebase="@BASEURL@">
+ <information>
+ <title>CamcaptureJMF</title>
+ <vendor>LShift Ltd</vendor>
+ <description>CamcaptureJMF</description>
+ </information>
+ <security>
+ <j2ee-application-client-permissions/>
+ </security>
+ <resources>
+ <j2se href="http://java.sun.com/products/autodl/j2se" version="1.5+"/>
+ <jar href="camcapturejmf.jar"/>
+ <jar href="commons-io-1.2.jar"/>
+ <jar href="rabbitmq-client.jar"/>
+ </resources>
+ <application-desc main-class="net.lshift.camcapture.jmf.Main"/>
+</jnlp>
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<project default="build">
+ <property name="build.out" location="build"/>
+ <property name="lib.out" location="${build.out}/lib"/>
+ <property name="dist.out" location="${build.out}/dist"/>
+ <property name="javac.debug" value="true"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.out" location="${build.out}/classes"/>
+
+ <property name="rabbitmq.dist" value="../../AMQ/java/build/dist"/>
+
+ <property environment="env"/>
+
+ <path id="javac.classpath">
+ <fileset dir="${rabbitmq.dist}">
+ <include name="rabbitmq-client.jar"/>
+ <include name="commons-io-1.2.jar"/>
+ </fileset>
+ <fileset dir="lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </path>
+
+ <path id="test.classpath">
+ <path refid="javac.classpath"/>
+ <pathelement path="${javac.out}"/>
+ </path>
+
+ <target name="build">
+ <mkdir dir="${javac.out}"/>
+ <javac destdir="${javac.out}"
+ classpathref="javac.classpath"
+ source="${javac.source}"
+ target="${javac.target}"
+ debug="${javac.debug}">
+ <src path="src"/>
+ <src path="../camcapturecommon/src"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="build">
+ <mkdir dir="${lib.out}"/>
+ <jar destfile="${lib.out}/camcapturejmf.jar" basedir="${javac.out}"/>
+ </target>
+
+ <target name="dist" depends="jar">
+ <mkdir dir="${dist.out}"/>
+ <copy todir="${dist.out}">
+ <fileset dir="${rabbitmq.dist}">
+ <include name="rabbitmq-client.jar"/>
+ <include name="commons-io-1.2.jar"/>
+ </fileset>
+ <fileset dir="${lib.out}">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="bin">
+ <exclude name="**/*.jnlp"/>
+ </fileset>
+ <fileset dir="../licenses" includes="*"/>
+ </copy>
+ <copy todir="${dist.out}">
+ <fileset dir="bin">
+ <include name="**/*.jnlp"/>
+ </fileset>
+ <filterset>
+ <filter token="BASEURL" value="${base.url}/camcapturejmf/"/>
+ </filterset>
+ </copy>
+ <exec dir="${dist.out}" executable="chmod">
+ <arg line="a+x"/>
+ <arg line="camcaptureJMF"/>
+ </exec>
+ </target>
+
+ <target name="sign-dist" depends="dist">
+ <copy todir="${dist.out}">
+ <fileset dir="lib">
+ <include name="**/*.jar"/>
+ </fileset>
+ </copy>
+ <signjar alias="${signing.alias}"
+ storepass="${signing.storepass}"
+ keystore="${signing.keystore}">
+ <fileset dir="${dist.out}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </signjar>
+ </target>
+
+ <target name="clean">
+ <delete dir="build"/>
+ </target>
+</project>
Binary file not shown.
@@ -0,0 +1,123 @@
+package net.lshift.camcapture.jmf;
+
+import java.io.IOException;
+
+import java.util.Vector;
+import java.util.Iterator;
+
+import javax.media.Buffer;
+import javax.media.CaptureDeviceInfo;
+import javax.media.CaptureDeviceManager;
+import javax.media.Format;
+import javax.media.Manager;
+import javax.media.MediaException;
+import javax.media.MediaLocator;
+import javax.media.Player;
+
+import javax.media.control.FormatControl;
+import javax.media.control.FrameGrabbingControl;
+
+import javax.media.protocol.CaptureDevice;
+import javax.media.protocol.DataSource;
+
+import javax.media.format.VideoFormat;
+import javax.media.format.RGBFormat;
+
+import javax.media.util.BufferToImage;
+
+import java.awt.Dimension;
+import java.awt.image.BufferedImage;
+
+import net.lshift.camcapture.CaptureBase;
+import net.lshift.camcapture.SwingUtil;
+
+public class Main extends CaptureBase {
+ public static void main (String[] args) {
+ try {
+ new Main(args);
+ } catch (Exception e) {
+ SwingUtil.complainFatal("Error", null, e);
+ }
+ }
+
+ public Main(String[] args)
+ throws Exception
+ {
+ super("camcaptureJMF", args);
+ }
+
+ public MediaLocator selectedDeviceLocator = null;
+ public RGBFormat selectedFormat = null;
+
+ public java.util.Iterator buildFrameIterator(int desiredWidth,
+ int desiredHeight)
+ throws Exception
+ {
+ selectDeviceAndFormat(desiredWidth, desiredHeight);
+ System.out.println("Chose device: " + selectedDeviceLocator);
+ System.out.println("Chose format: " + selectedFormat);
+
+ if (selectedDeviceLocator == null ||
+ selectedFormat == null) {
+ throw new Exception("No device selected - is your camera plugged in? " +
+ "Does JMF recognise it?");
+ }
+
+ DataSource dataSource = Manager.createDataSource(selectedDeviceLocator);
+ CaptureDevice dataSourceDev = (CaptureDevice) dataSource;
+ FormatControl[] formatControls = dataSourceDev.getFormatControls();
+ for (int i = 0; i < formatControls.length; i++) {
+ formatControls[i].setFormat(selectedFormat);
+ }
+ Player player = Manager.createRealizedPlayer(dataSource);
+ player.start();
+
+ final FrameGrabbingControl grabber =
+ (FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");
+
+ return new java.util.Iterator() {
+ public boolean hasNext() { return true; }
+ public Object next() {
+ Buffer buf = grabber.grabFrame();
+ BufferToImage bufferConverter =
+ new BufferToImage((VideoFormat) buf.getFormat());
+ BufferedImage i =
+ (BufferedImage) bufferConverter.createImage(buf);
+ return i;
+ }
+ public void remove() {}
+ };
+ }
+
+ public void selectDeviceAndFormat(int desiredWidth, int desiredHeight) {
+ Dimension desiredSize = new Dimension(desiredWidth, desiredHeight);
+
+ Vector captureDeviceInfos = CaptureDeviceManager.getDeviceList(new RGBFormat());
+ for (Iterator i = captureDeviceInfos.iterator(); i.hasNext();) {
+ CaptureDeviceInfo info = (CaptureDeviceInfo) i.next();
+ Format[] formats = info.getFormats();
+ for (int j = 0; j < formats.length; j++) {
+ Format format = formats[j];
+ if (format instanceof RGBFormat) {
+ RGBFormat r = (RGBFormat) format;
+ //System.out.println("Examining: " + r);
+ if (selectedFormat == null) {
+ selectedDeviceLocator = info.getLocator();
+ selectedFormat = r;
+ }
+ if (r.getSize().equals(desiredSize) && (r.getRedMask() != 1)) {
+ selectedDeviceLocator = info.getLocator();
+ selectedFormat = r;
+ }
+ /* // Uncomment to choose highest bits-per-pixel on offer
+ if ((selectedFormat != null) &&
+ (r.getBitsPerPixel() > selectedFormat.getBitsPerPixel())) {
+ selectedDeviceLocator = info.getLocator();
+ selectedFormat = r;
+ }
+ */
+ }
+ }
+ }
+ }
+}
@@ -0,0 +1,4 @@
+#!/bin/sh
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
+export LD_LIBRARY_PATH
+exec java -server -cp $(for d in *.jar; do echo -n "$d":; done) net.lshift.camcapture.v4l.Main "$@"
@@ -0,0 +1,93 @@
+<?xml version="1.0"?>
+<project default="build">
+ <property name="build.out" location="build"/>
+ <property name="javah.out" location="${build.out}/javah"/>
+ <property name="lib.out" location="${build.out}/lib"/>
+ <property name="dist.out" location="${build.out}/dist"/>
+ <property name="javac.debug" value="true"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="javac.out" location="${build.out}/classes"/>
+
+ <property name="rabbitmq.dist" value="../../AMQ/java/build/dist"/>
+
+ <property name="jdk_home" location="${java.home}/.."/>
+
+ <path id="javac.classpath">
+ <fileset dir="${rabbitmq.dist}">
+ <include name="rabbitmq-client.jar"/>
+ <include name="commons-io-1.2.jar"/>
+ </fileset>
+ <pathelement path="${javah.out}"/>
+ </path>
+
+ <path id="test.classpath">
+ <path refid="javac.classpath"/>
+ <pathelement path="${javac.out}"/>
+ </path>
+
+ <target name="libjv4l" depends="build">
+ <exec dir="native" executable="javah">
+ <arg line="-jni"/>
+ <arg line="-o jv4l.h"/>
+ <arg line="-classpath ${javac.out}"/>
+ <arg line="net.lshift.camcapture.v4l.Driver"/>
+ </exec>
+ <exec dir="native" executable="gcc">
+ <arg line="-o libjv4l.so"/>
+ <arg line="-Wall"/>
+ <arg line="-I${jdk_home}/include"/>
+ <arg line="-I${jdk_home}/include/linux"/>
+ <arg line="-shared"/>
+ <arg line="jv4l.c" />
+ </exec>
+ </target>
+
+ <target name="build">
+ <mkdir dir="${javac.out}"/>
+ <javac destdir="${javac.out}"
+ classpathref="javac.classpath"
+ source="${javac.source}"
+ target="${javac.target}"
+ debug="${javac.debug}">
+ <src path="src"/>
+ <src path="../camcapturecommon/src"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="build">
+ <mkdir dir="${lib.out}"/>
+ <jar destfile="${lib.out}/camcapturelinux.jar" basedir="${javac.out}"/>
+ </target>
+
+ <target name="dist" depends="jar, libjv4l">
+ <mkdir dir="${dist.out}"/>
+ <copy todir="${dist.out}">
+ <fileset dir="${rabbitmq.dist}">
+ <include name="rabbitmq-client.jar"/>
+ <include name="commons-io-1.2.jar"/>
+ </fileset>
+ <fileset dir="${lib.out}">
+ <include name="**/*.jar"/>
+ </fileset>
+ <fileset dir="bin"/>
+ <fileset dir="native">
+ <include name="**/*.so"/>
+ </fileset>
+ <fileset dir="../licenses" includes="*"/>
+ </copy>
+ <exec dir="${dist.out}" executable="chmod">
+ <arg line="a+x"/>
+ <arg line="camcaptureLinux"/>
+ <arg line="libjv4l.so"/>
+ </exec>
+ </target>
+
+ <target name="sign-dist" depends="dist"/>
+
+ <target name="clean">
+ <delete dir="build"/>
+ <delete file="native/jv4l.h"/>
+ <delete file="native/libjv4l.so"/>
+ </target>
+</project>
Oops, something went wrong.

0 comments on commit 9735b9d

Please sign in to comment.