desc:声光报警器gpio改为140

main
xiaowusky 1 year ago
parent 833d1c434c
commit 97c16ab735

@ -120,7 +120,6 @@ class HomeActivity : NoOptionsActivity() {
private fun onCameraOpen() { private fun onCameraOpen() {
// 启动推送 // 启动推送
PushHelper.opSwitch(true) PushHelper.opSwitch(true)
PushHelper.startStream(true)
// 开启GPIO // 开启GPIO
GPIOUtils.openCamera() GPIOUtils.openCamera()
setForCamera() setForCamera()

@ -62,7 +62,6 @@ object LztekUtil {
this.rtspUrl = str this.rtspUrl = str
rtspUrl?.let { rtspUrl?.let {
PushHelper.setPushUrl(it) PushHelper.setPushUrl(it)
PushHelper.startStream(true)
} }
} }

@ -40,14 +40,14 @@ object SoundUtils {
if (soundPlaying) { if (soundPlaying) {
return return
} }
GPIOUtils.setGpioDirection(152, "out") GPIOUtils.setGpioDirection(140, "out")
var gpioValue = 0 var gpioValue = 0
soundPlaying = true soundPlaying = true
GlobalScope.launch(Dispatchers.IO) { GlobalScope.launch(Dispatchers.IO) {
while (soundPlaying) { while (soundPlaying) {
gpioValue = if (gpioValue > 0) 0 else 1 gpioValue = if (gpioValue > 0) 0 else 1
LogUtils.w("cyy gpioValue ${gpioValue}") LogUtils.w("cyy gpioValue ${gpioValue}")
GPIOUtils.setGpioValue(152, gpioValue) GPIOUtils.setGpioValue(140, gpioValue)
delay(500) delay(500)
} }
} }
@ -55,6 +55,6 @@ object SoundUtils {
fun stopSoundIo() { fun stopSoundIo() {
soundPlaying = false soundPlaying = false
GPIOUtils.setGpioValue(152, 0) GPIOUtils.setGpioValue(140, 0)
} }
} }

@ -53,7 +53,6 @@ public class VideoEncoderCoreAvc extends MediaEncoderCore {
public VideoEncoderCoreAvc(AndroidMuxer muxer, int width, int height) { public VideoEncoderCoreAvc(AndroidMuxer muxer, int width, int height) {
super(muxer); super(muxer);
prepareEncoder(width, height); prepareEncoder(width, height);
PushHelper.INSTANCE.startStream(false);
} }
private void prepareEncoder(int width, int height) { private void prepareEncoder(int width, int height) {

@ -53,7 +53,6 @@ public class VideoEncoderCoreHevc extends MediaEncoderCore {
public VideoEncoderCoreHevc(AndroidMuxer muxer, int width, int height) { public VideoEncoderCoreHevc(AndroidMuxer muxer, int width, int height) {
super(muxer); super(muxer);
prepareEncoder(width, height); prepareEncoder(width, height);
PushHelper.INSTANCE.startStream(true);
} }
private void prepareEncoder(int width, int height) { private void prepareEncoder(int width, int height) {

@ -59,13 +59,6 @@ object PushHelper {
} }
} }
fun startStream(hevc: Boolean) {
if (switchOpen) {
stop()
initHelper(hevc)
}
}
fun stop() { fun stop() {
mPusher?.stop() mPusher?.stop()
mInitialized = false mInitialized = false
@ -82,7 +75,7 @@ object PushHelper {
} }
if (!mInitialized) { if (!mInitialized) {
LogUtils.e("PushHelper error, please init first!!") LogUtils.e("PushHelper error, please init first!!")
return initHelper(true)
} }
mPusher?.push(h264, 0, length, timeStamp, type) mPusher?.push(h264, 0, length, timeStamp, type)
} }

@ -130,6 +130,8 @@ public class HWConsumer extends Thread implements VideoConsumer {
if (androidMuxer != null && mTrackIndex != -1) { if (androidMuxer != null && mTrackIndex != -1) {
androidMuxer.writeSampleData(mTrackIndex, outputBuffer, bufferInfo); androidMuxer.writeSampleData(mTrackIndex, outputBuffer, bufferInfo);
} }
outputBuffer.position(bufferInfo.offset);
outputBuffer.limit(bufferInfo.offset + bufferInfo.size);
byte[] outData = new byte[bufferInfo.size]; byte[] outData = new byte[bufferInfo.size];
outputBuffer.get(outData); outputBuffer.get(outData);
int offset = 4; int offset = 4;

Loading…
Cancel
Save