desc:声光报警器gpio改为140

main
xiaowusky 1 year ago
parent 833d1c434c
commit 97c16ab735

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

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

@ -40,14 +40,14 @@ object SoundUtils {
if (soundPlaying) {
return
}
GPIOUtils.setGpioDirection(152, "out")
GPIOUtils.setGpioDirection(140, "out")
var gpioValue = 0
soundPlaying = true
GlobalScope.launch(Dispatchers.IO) {
while (soundPlaying) {
gpioValue = if (gpioValue > 0) 0 else 1
LogUtils.w("cyy gpioValue ${gpioValue}")
GPIOUtils.setGpioValue(152, gpioValue)
GPIOUtils.setGpioValue(140, gpioValue)
delay(500)
}
}
@ -55,6 +55,6 @@ object SoundUtils {
fun stopSoundIo() {
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) {
super(muxer);
prepareEncoder(width, height);
PushHelper.INSTANCE.startStream(false);
}
private void prepareEncoder(int width, int height) {

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

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

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

Loading…
Cancel
Save