Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Oct 10, 2023
1 parent ac76795 commit 5ec35eb
Show file tree
Hide file tree
Showing 17 changed files with 110 additions and 64 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ allprojects {
}
}
dependencies {
implementation 'com.github.pedroSG94:RTSP-Server:1.1.8'
implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.1.8'
implementation 'com.github.pedroSG94:RTSP-Server:1.1.9'
implementation 'com.github.pedroSG94.RootEncoder:library:2.3.0'
}
```
20 changes: 14 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 32
namespace "com.pedro.sample"
compileSdk 34

defaultConfig {
applicationId "com.pedro.sample"
minSdkVersion 16
targetSdkVersion 32
targetSdkVersion 34
versionCode version_code
versionName version_name
}
Expand All @@ -18,12 +18,20 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
}

dependencies {
implementation project(':rtspserver')
implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.1.8'
implementation 'com.github.pedroSG94.RootEncoder:library:2.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--some devices need read permission to create folders or files-->
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2.full" />
Expand Down
28 changes: 19 additions & 9 deletions app/src/main/java/com/pedro/sample/CameraDemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@ package com.pedro.sample

import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.view.SurfaceHolder
import android.view.SurfaceView
import android.view.View
import android.view.WindowManager
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.pedro.encoder.input.video.CameraOpenException
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import com.pedro.rtspserver.RtspServerCamera1
import kotlinx.android.synthetic.main.activity_camera_demo.*
import java.io.File
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.*
import java.util.Date
import java.util.Locale

class CameraDemoActivity : AppCompatActivity(), ConnectCheckerRtsp, View.OnClickListener,
SurfaceHolder.Callback {

private lateinit var rtspServerCamera1: RtspServerCamera1
private lateinit var button: Button
private lateinit var bRecord: Button
private lateinit var bSwitchCamera: Button
private lateinit var surfaceView: SurfaceView
private lateinit var tvUrl: TextView

private var currentDateAndTime = ""
private lateinit var folder: File
Expand All @@ -31,13 +37,17 @@ class CameraDemoActivity : AppCompatActivity(), ConnectCheckerRtsp, View.OnClick
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setContentView(R.layout.activity_camera_demo)
folder = File(getExternalFilesDir(null)!!.absolutePath + "/rtmp-rtsp-stream-client-java")
val storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES)
folder = File(storageDir.absolutePath + "/RootEncoder")
tvUrl = findViewById(R.id.tv_url)
button = findViewById(R.id.b_start_stop)
button.setOnClickListener(this)
bRecord = findViewById(R.id.b_record)
bRecord.setOnClickListener(this)
switch_camera.setOnClickListener(this)
rtspServerCamera1 = RtspServerCamera1(surfaceView, this, 1935)
bSwitchCamera = findViewById(R.id.switch_camera)
bSwitchCamera.setOnClickListener(this)
surfaceView = findViewById(R.id.surfaceView)
rtspServerCamera1 = RtspServerCamera1(surfaceView = surfaceView, this, 1935)
surfaceView.holder.addCallback(this)
}

Expand Down Expand Up @@ -74,7 +84,7 @@ class CameraDemoActivity : AppCompatActivity(), ConnectCheckerRtsp, View.OnClick
Toast.makeText(this@CameraDemoActivity, "Auth error", Toast.LENGTH_SHORT).show()
rtspServerCamera1.stopStream()
button.setText(R.string.start_button)
tv_url.text = ""
tvUrl.text = ""
}
}

Expand All @@ -90,15 +100,15 @@ class CameraDemoActivity : AppCompatActivity(), ConnectCheckerRtsp, View.OnClick
if (rtspServerCamera1.isRecording || rtspServerCamera1.prepareAudio() && rtspServerCamera1.prepareVideo()) {
button.setText(R.string.stop_button)
rtspServerCamera1.startStream()
tv_url.text = rtspServerCamera1.getEndPointConnection()
tvUrl.text = rtspServerCamera1.getEndPointConnection()
} else {
Toast.makeText(this, "Error preparing stream, This device cant do it", Toast.LENGTH_SHORT)
.show()
}
} else {
button.setText(R.string.start_button)
rtspServerCamera1.stopStream()
tv_url.text = ""
tvUrl.text = ""
}
R.id.switch_camera -> try {
rtspServerCamera1.switchCamera()
Expand Down Expand Up @@ -172,7 +182,7 @@ class CameraDemoActivity : AppCompatActivity(), ConnectCheckerRtsp, View.OnClick
if (rtspServerCamera1.isStreaming) {
rtspServerCamera1.stopStream()
button.text = resources.getString(R.string.start_button)
tv_url.text = ""
tvUrl.text = ""
}
rtspServerCamera1.stopPreview()
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/pedro/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.WindowManager
import android.widget.Button
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

private val PERMISSIONS = arrayOf(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA,
Manifest.permission.WRITE_EXTERNAL_STORAGE)
private val PERMISSIONS = arrayOf(Manifest.permission.RECORD_AUDIO, Manifest.permission.CAMERA)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
setContentView(R.layout.activity_main)
b_camera_demo.setOnClickListener {
val bCameraDemo = findViewById<Button>(R.id.b_camera_demo)
bCameraDemo.setOnClickListener {
if (!hasPermissions(this, *PERMISSIONS)) {
ActivityCompat.requestPermissions(this, PERMISSIONS, 1)
} else {
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '1.9.10'
ext.library_group = "com.github.pedroSG94"
ext.version_code = 118
ext.version_name = "1.1.8"
ext.version_code = 119
ext.version_name = "1.1.9"

repositories {
google()
Expand All @@ -13,7 +13,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:8.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -28,6 +28,6 @@ allprojects {
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed May 26 11:03:20 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion jitpack.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jdk:
- openjdk11
- openjdk17
19 changes: 14 additions & 5 deletions rtspserver/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'maven-publish'

android {
compileSdkVersion 32
namespace "com.pedro.rtspserver"
compileSdk 34

defaultConfig {
minSdkVersion 16
targetSdkVersion 32
targetSdkVersion 34
versionCode version_code
versionName version_name
}
Expand All @@ -19,6 +20,14 @@ android {
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}

publishing {
singleVariant("release")
}
Expand All @@ -42,6 +51,6 @@ afterEvaluate {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.github.pedroSG94.rtmp-rtsp-stream-client-java:rtplibrary:2.1.8'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
implementation 'com.github.pedroSG94.RootEncoder:library:2.3.0'
}
6 changes: 4 additions & 2 deletions rtspserver/src/main/java/com/pedro/rtspserver/RtspServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import java.util.concurrent.TimeUnit
* TODO Use different session per client.
*/

open class RtspServer(private val connectCheckerRtsp: ConnectCheckerRtsp,
val port: Int): ClientListener {
open class RtspServer(
private val connectCheckerRtsp: ConnectCheckerRtsp,
val port: Int
): ClientListener {

private val TAG = "RtspServer"
private var server: ServerSocket? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import android.view.SurfaceView
import android.view.TextureView
import androidx.annotation.RequiresApi
import com.pedro.encoder.utils.CodecUtil
import com.pedro.rtplibrary.base.Camera1Base
import com.pedro.rtplibrary.view.LightOpenGlView
import com.pedro.rtplibrary.view.OpenGlView
import com.pedro.library.base.Camera1Base
import com.pedro.library.view.LightOpenGlView
import com.pedro.library.view.OpenGlView
import com.pedro.rtsp.rtsp.VideoCodec
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import java.nio.ByteBuffer
Expand Down Expand Up @@ -39,7 +39,7 @@ open class RtspServerCamera1 : Camera1Base {

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
constructor(lightOpenGlView: LightOpenGlView, connectCheckerRtsp: ConnectCheckerRtsp,
port: Int) : super(lightOpenGlView) {
port: Int) : super(lightOpenGlView) {
rtspServer = RtspServer(connectCheckerRtsp, port)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import android.media.MediaCodec
import android.os.Build
import androidx.annotation.RequiresApi
import com.pedro.encoder.utils.CodecUtil
import com.pedro.rtplibrary.base.Camera2Base
import com.pedro.rtplibrary.view.LightOpenGlView
import com.pedro.rtplibrary.view.OpenGlView
import com.pedro.library.base.Camera2Base
import com.pedro.library.view.LightOpenGlView
import com.pedro.library.view.OpenGlView
import com.pedro.rtsp.rtsp.VideoCodec
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import java.nio.ByteBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import android.media.MediaCodec
import android.os.Build
import androidx.annotation.RequiresApi
import com.pedro.encoder.utils.CodecUtil
import com.pedro.rtplibrary.base.DisplayBase
import com.pedro.library.base.DisplayBase
import com.pedro.rtsp.rtsp.VideoCodec
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import java.nio.ByteBuffer

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
open class RtspServerDisplay(context: Context, useOpengl: Boolean,
connectCheckerRtsp: ConnectCheckerRtsp, port: Int) : DisplayBase(context, useOpengl) {
open class RtspServerDisplay(
context: Context, useOpengl: Boolean,
connectCheckerRtsp: ConnectCheckerRtsp, port: Int
) : DisplayBase(context, useOpengl) {

private val rtspServer: RtspServer =
RtspServer(connectCheckerRtsp, port)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import androidx.annotation.RequiresApi
import com.pedro.encoder.input.decoder.AudioDecoderInterface
import com.pedro.encoder.input.decoder.VideoDecoderInterface
import com.pedro.encoder.utils.CodecUtil
import com.pedro.rtplibrary.base.FromFileBase
import com.pedro.rtplibrary.view.LightOpenGlView
import com.pedro.rtplibrary.view.OpenGlView
import com.pedro.library.base.FromFileBase
import com.pedro.library.view.LightOpenGlView
import com.pedro.library.view.OpenGlView
import com.pedro.rtsp.rtsp.VideoCodec
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import java.nio.ByteBuffer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package com.pedro.rtspserver

import android.media.MediaCodec
import com.pedro.rtplibrary.base.OnlyAudioBase
import com.pedro.library.base.OnlyAudioBase
import com.pedro.rtsp.utils.ConnectCheckerRtsp
import java.nio.ByteBuffer

/**
* Created by pedro on 17/04/21.
*/
open class RtspServerOnlyAudio(connectCheckerRtsp: ConnectCheckerRtsp, port: Int) : OnlyAudioBase() {
open class RtspServerOnlyAudio(
connectCheckerRtsp: ConnectCheckerRtsp, port: Int
) : OnlyAudioBase() {

private val rtspServer = RtspServer(connectCheckerRtsp, port)

Expand Down
Loading

0 comments on commit 5ec35eb

Please sign in to comment.