diff --git a/.gitignore b/.gitignore index 12f6ddb2..3f7d7d59 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,8 @@ gen/ local.properties custom_rules.xml ant.properties -*~ \ No newline at end of file +*~ +.gradle/ +.idea/ +build/ +*.iml diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..d0a36567 --- /dev/null +++ b/build.gradle @@ -0,0 +1,50 @@ +apply plugin: 'com.android.library' +apply plugin: 'maven' + + +group = 'net.majorkernelpanic' +version = '3.0' + +description = """libstreaming""" + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + } +} + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.1" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 21 + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } +} + +repositories { + mavenCentral() +} + + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) +} + +uploadArchives { + repositories { + mavenDeployer { + repository url: 'file://' + new File(System.getProperty('user.home'), '.m3/repository').absolutePath + } + } +} +task install(dependsOn: uploadArchives) \ No newline at end of file diff --git a/AndroidManifest.xml b/src/main/AndroidManifest.xml similarity index 100% rename from AndroidManifest.xml rename to src/main/AndroidManifest.xml diff --git a/src/net/majorkernelpanic/streaming/MediaStream.java b/src/main/java/net/majorkernelpanic/streaming/MediaStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/MediaStream.java rename to src/main/java/net/majorkernelpanic/streaming/MediaStream.java diff --git a/src/net/majorkernelpanic/streaming/Session.java b/src/main/java/net/majorkernelpanic/streaming/Session.java similarity index 100% rename from src/net/majorkernelpanic/streaming/Session.java rename to src/main/java/net/majorkernelpanic/streaming/Session.java diff --git a/src/net/majorkernelpanic/streaming/SessionBuilder.java b/src/main/java/net/majorkernelpanic/streaming/SessionBuilder.java similarity index 100% rename from src/net/majorkernelpanic/streaming/SessionBuilder.java rename to src/main/java/net/majorkernelpanic/streaming/SessionBuilder.java diff --git a/src/net/majorkernelpanic/streaming/Stream.java b/src/main/java/net/majorkernelpanic/streaming/Stream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/Stream.java rename to src/main/java/net/majorkernelpanic/streaming/Stream.java diff --git a/src/net/majorkernelpanic/streaming/audio/AACStream.java b/src/main/java/net/majorkernelpanic/streaming/audio/AACStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/audio/AACStream.java rename to src/main/java/net/majorkernelpanic/streaming/audio/AACStream.java diff --git a/src/net/majorkernelpanic/streaming/audio/AMRNBStream.java b/src/main/java/net/majorkernelpanic/streaming/audio/AMRNBStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/audio/AMRNBStream.java rename to src/main/java/net/majorkernelpanic/streaming/audio/AMRNBStream.java diff --git a/src/net/majorkernelpanic/streaming/audio/AudioQuality.java b/src/main/java/net/majorkernelpanic/streaming/audio/AudioQuality.java similarity index 100% rename from src/net/majorkernelpanic/streaming/audio/AudioQuality.java rename to src/main/java/net/majorkernelpanic/streaming/audio/AudioQuality.java diff --git a/src/net/majorkernelpanic/streaming/audio/AudioStream.java b/src/main/java/net/majorkernelpanic/streaming/audio/AudioStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/audio/AudioStream.java rename to src/main/java/net/majorkernelpanic/streaming/audio/AudioStream.java diff --git a/src/net/majorkernelpanic/streaming/exceptions/CameraInUseException.java b/src/main/java/net/majorkernelpanic/streaming/exceptions/CameraInUseException.java similarity index 100% rename from src/net/majorkernelpanic/streaming/exceptions/CameraInUseException.java rename to src/main/java/net/majorkernelpanic/streaming/exceptions/CameraInUseException.java diff --git a/src/net/majorkernelpanic/streaming/exceptions/ConfNotSupportedException.java b/src/main/java/net/majorkernelpanic/streaming/exceptions/ConfNotSupportedException.java similarity index 100% rename from src/net/majorkernelpanic/streaming/exceptions/ConfNotSupportedException.java rename to src/main/java/net/majorkernelpanic/streaming/exceptions/ConfNotSupportedException.java diff --git a/src/net/majorkernelpanic/streaming/exceptions/InvalidSurfaceException.java b/src/main/java/net/majorkernelpanic/streaming/exceptions/InvalidSurfaceException.java similarity index 100% rename from src/net/majorkernelpanic/streaming/exceptions/InvalidSurfaceException.java rename to src/main/java/net/majorkernelpanic/streaming/exceptions/InvalidSurfaceException.java diff --git a/src/net/majorkernelpanic/streaming/exceptions/StorageUnavailableException.java b/src/main/java/net/majorkernelpanic/streaming/exceptions/StorageUnavailableException.java similarity index 100% rename from src/net/majorkernelpanic/streaming/exceptions/StorageUnavailableException.java rename to src/main/java/net/majorkernelpanic/streaming/exceptions/StorageUnavailableException.java diff --git a/src/net/majorkernelpanic/streaming/gl/SurfaceManager.java b/src/main/java/net/majorkernelpanic/streaming/gl/SurfaceManager.java similarity index 100% rename from src/net/majorkernelpanic/streaming/gl/SurfaceManager.java rename to src/main/java/net/majorkernelpanic/streaming/gl/SurfaceManager.java diff --git a/src/net/majorkernelpanic/streaming/gl/SurfaceView.java b/src/main/java/net/majorkernelpanic/streaming/gl/SurfaceView.java similarity index 100% rename from src/net/majorkernelpanic/streaming/gl/SurfaceView.java rename to src/main/java/net/majorkernelpanic/streaming/gl/SurfaceView.java diff --git a/src/net/majorkernelpanic/streaming/gl/TextureManager.java b/src/main/java/net/majorkernelpanic/streaming/gl/TextureManager.java similarity index 100% rename from src/net/majorkernelpanic/streaming/gl/TextureManager.java rename to src/main/java/net/majorkernelpanic/streaming/gl/TextureManager.java diff --git a/src/net/majorkernelpanic/streaming/hw/CodecManager.java b/src/main/java/net/majorkernelpanic/streaming/hw/CodecManager.java similarity index 100% rename from src/net/majorkernelpanic/streaming/hw/CodecManager.java rename to src/main/java/net/majorkernelpanic/streaming/hw/CodecManager.java diff --git a/src/net/majorkernelpanic/streaming/hw/EncoderDebugger.java b/src/main/java/net/majorkernelpanic/streaming/hw/EncoderDebugger.java similarity index 95% rename from src/net/majorkernelpanic/streaming/hw/EncoderDebugger.java rename to src/main/java/net/majorkernelpanic/streaming/hw/EncoderDebugger.java index f11d3d81..ca188d71 100644 --- a/src/net/majorkernelpanic/streaming/hw/EncoderDebugger.java +++ b/src/main/java/net/majorkernelpanic/streaming/hw/EncoderDebugger.java @@ -525,14 +525,22 @@ private void convertToNV21(int k) { * Instantiates and starts the encoder. */ private void configureEncoder() { - mEncoder = MediaCodec.createByCodecName(mEncoderName); - MediaFormat mediaFormat = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight); - mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, BITRATE); - mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, FRAMERATE); - mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, mEncoderColorFormat); - mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1); - mEncoder.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); - mEncoder.start(); + + try{ + mEncoder = MediaCodec.createByCodecName(mEncoderName); + MediaFormat mediaFormat = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight); + mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, BITRATE); + mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, FRAMERATE); + mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, mEncoderColorFormat); + mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1); + mEncoder.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); + mEncoder.start(); + } + catch (Exception e) { + Log.e(getClass().getSimpleName(),"configureEncoder"); + Log.e(getClass().getSimpleName(), e.getStackTrace().toString()); + } + } private void releaseEncoder() { @@ -558,12 +566,18 @@ private void configureDecoder() { csd0.put(new byte[] {0x00,0x00,0x00,0x01}); csd0.put(mPPS); - mDecoder = MediaCodec.createByCodecName(mDecoderName); - MediaFormat mediaFormat = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight); - mediaFormat.setByteBuffer("csd-0", csd0); - mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, mDecoderColorFormat); - mDecoder.configure(mediaFormat, null, null, 0); - mDecoder.start(); + try{ + mDecoder = MediaCodec.createByCodecName(mDecoderName); + MediaFormat mediaFormat = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight); + mediaFormat.setByteBuffer("csd-0", csd0); + mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, mDecoderColorFormat); + mDecoder.configure(mediaFormat, null, null, 0); + mDecoder.start(); + } + catch (Exception e) { + Log.e(getClass().getSimpleName(),"configureDecoder"); + Log.e(getClass().getSimpleName(), e.getStackTrace().toString()); + } ByteBuffer[] decInputBuffers = mDecoder.getInputBuffers(); diff --git a/src/net/majorkernelpanic/streaming/hw/NV21Convertor.java b/src/main/java/net/majorkernelpanic/streaming/hw/NV21Convertor.java similarity index 100% rename from src/net/majorkernelpanic/streaming/hw/NV21Convertor.java rename to src/main/java/net/majorkernelpanic/streaming/hw/NV21Convertor.java diff --git a/src/net/majorkernelpanic/streaming/mp4/MP4Config.java b/src/main/java/net/majorkernelpanic/streaming/mp4/MP4Config.java similarity index 100% rename from src/net/majorkernelpanic/streaming/mp4/MP4Config.java rename to src/main/java/net/majorkernelpanic/streaming/mp4/MP4Config.java diff --git a/src/net/majorkernelpanic/streaming/mp4/MP4Parser.java b/src/main/java/net/majorkernelpanic/streaming/mp4/MP4Parser.java similarity index 100% rename from src/net/majorkernelpanic/streaming/mp4/MP4Parser.java rename to src/main/java/net/majorkernelpanic/streaming/mp4/MP4Parser.java diff --git a/src/net/majorkernelpanic/streaming/rtcp/SenderReport.java b/src/main/java/net/majorkernelpanic/streaming/rtcp/SenderReport.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtcp/SenderReport.java rename to src/main/java/net/majorkernelpanic/streaming/rtcp/SenderReport.java diff --git a/src/net/majorkernelpanic/streaming/rtp/AACADTSPacketizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/AACADTSPacketizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/AACADTSPacketizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/AACADTSPacketizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/AACLATMPacketizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/AACLATMPacketizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/AACLATMPacketizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/AACLATMPacketizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/AMRNBPacketizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/AMRNBPacketizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/AMRNBPacketizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/AMRNBPacketizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/AbstractPacketizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/H263Packetizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/H263Packetizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/H263Packetizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/H263Packetizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/H264Packetizer.java b/src/main/java/net/majorkernelpanic/streaming/rtp/H264Packetizer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/H264Packetizer.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/H264Packetizer.java diff --git a/src/net/majorkernelpanic/streaming/rtp/MediaCodecInputStream.java b/src/main/java/net/majorkernelpanic/streaming/rtp/MediaCodecInputStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/MediaCodecInputStream.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/MediaCodecInputStream.java diff --git a/src/net/majorkernelpanic/streaming/rtp/RtpSocket.java b/src/main/java/net/majorkernelpanic/streaming/rtp/RtpSocket.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtp/RtpSocket.java rename to src/main/java/net/majorkernelpanic/streaming/rtp/RtpSocket.java diff --git a/src/net/majorkernelpanic/streaming/rtsp/RtcpDeinterleaver.java b/src/main/java/net/majorkernelpanic/streaming/rtsp/RtcpDeinterleaver.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtsp/RtcpDeinterleaver.java rename to src/main/java/net/majorkernelpanic/streaming/rtsp/RtcpDeinterleaver.java diff --git a/src/net/majorkernelpanic/streaming/rtsp/RtspClient.java b/src/main/java/net/majorkernelpanic/streaming/rtsp/RtspClient.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtsp/RtspClient.java rename to src/main/java/net/majorkernelpanic/streaming/rtsp/RtspClient.java diff --git a/src/net/majorkernelpanic/streaming/rtsp/RtspServer.java b/src/main/java/net/majorkernelpanic/streaming/rtsp/RtspServer.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtsp/RtspServer.java rename to src/main/java/net/majorkernelpanic/streaming/rtsp/RtspServer.java diff --git a/src/net/majorkernelpanic/streaming/rtsp/UriParser.java b/src/main/java/net/majorkernelpanic/streaming/rtsp/UriParser.java similarity index 100% rename from src/net/majorkernelpanic/streaming/rtsp/UriParser.java rename to src/main/java/net/majorkernelpanic/streaming/rtsp/UriParser.java diff --git a/src/net/majorkernelpanic/streaming/video/CodecManager.java b/src/main/java/net/majorkernelpanic/streaming/video/CodecManager.java similarity index 100% rename from src/net/majorkernelpanic/streaming/video/CodecManager.java rename to src/main/java/net/majorkernelpanic/streaming/video/CodecManager.java diff --git a/src/net/majorkernelpanic/streaming/video/H263Stream.java b/src/main/java/net/majorkernelpanic/streaming/video/H263Stream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/video/H263Stream.java rename to src/main/java/net/majorkernelpanic/streaming/video/H263Stream.java diff --git a/src/net/majorkernelpanic/streaming/video/H264Stream.java b/src/main/java/net/majorkernelpanic/streaming/video/H264Stream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/video/H264Stream.java rename to src/main/java/net/majorkernelpanic/streaming/video/H264Stream.java diff --git a/src/net/majorkernelpanic/streaming/video/VideoQuality.java b/src/main/java/net/majorkernelpanic/streaming/video/VideoQuality.java similarity index 100% rename from src/net/majorkernelpanic/streaming/video/VideoQuality.java rename to src/main/java/net/majorkernelpanic/streaming/video/VideoQuality.java diff --git a/src/net/majorkernelpanic/streaming/video/VideoStream.java b/src/main/java/net/majorkernelpanic/streaming/video/VideoStream.java similarity index 100% rename from src/net/majorkernelpanic/streaming/video/VideoStream.java rename to src/main/java/net/majorkernelpanic/streaming/video/VideoStream.java