Skip to content

Commit ac274fd

Browse files
committed
Merge branch 'rtsp_over_http'
* rtsp_over_http: RTSP over HTTPのon/off追加
2 parents fae32a0 + 82c2c67 commit ac274fd

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

configs/overlay_rootfs/scripts/rtspserver.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
#!/bin/sh
22

3-
if [ "$1" = "off" ]; then
3+
if [ "$1" = "off" -o "$1" = "restart" ]; then
44
/scripts/cmd audio off > /dev/null
55
/scripts/cmd video off > /dev/null
66
kill `pidof v4l2rtspserver` > /dev/null 2>&1
7-
exit 0
7+
[ "$1" = "off" ] && exit 0
8+
while pidof v4l2rtspserver > /dev/null ; do
9+
sleep 0.5
10+
done
811
fi
912

1013
HACK_INI=/tmp/hack.ini
14+
RTSP_OVER_HTTP=$(awk -F "=" '/RTSP_OVER_HTTP *=/ {print $2}' $HACK_INI)
1115
RTSP_AUDIO=$(awk -F "=" '/RTSP_AUDIO *=/ {print $2}' $HACK_INI)
1216
RTSPSERVER=$(awk -F "=" '/RTSPSERVER *=/ {print $2}' $HACK_INI)
13-
if [ "$1" = "on" -o "$RTSPSERVER" = "on" ]; then
17+
if [ "$1" = "on" -o "$1" = "restart" -o "$RTSPSERVER" = "on" ]; then
1418
/scripts/cmd video on > /dev/null
1519
/scripts/cmd audio on > /dev/null
1620
if ! pidof v4l2rtspserver > /dev/null ; then
1721
while netstat -ltn 2> /dev/null | egrep ":(8554|8080)"; do
1822
sleep 0.5
1923
done
20-
/usr/bin/v4l2rtspserver -p 8080 -C 1 -a S16_LE -l 0 /dev/video1,hw:Loopback,0 >> /tmp/log/rtspserver.log 2>&1 &
24+
if [ "$RTSP_OVER_HTTP" = "on" ] ; then
25+
/usr/bin/v4l2rtspserver -p 8080 -C 1 -a S16_LE -l 0 /dev/video1,hw:Loopback,0 >> /tmp/log/rtspserver.log 2>&1 &
26+
else
27+
/usr/bin/v4l2rtspserver -C 1 -a S16_LE -l 0 /dev/video1,hw:Loopback,0 >> /tmp/log/rtspserver.log 2>&1 &
28+
fi
2129
fi
2230
if [ "$RTSP_AUDIO" != "on" ] ; then
2331
/scripts/cmd audio off > /dev/null

web/source/vue/Setting.vue

+24-17
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,22 @@
279279
</ElCol>
280280
</ElRow>
281281
</ElTooltip>
282+
<ElTooltip v-if="config.RTSPSERVER === 'on'" :tabindex="-1" placement="top" content="RTSPをHTTP経由で配信します" effect="light" :open-delay="500">
283+
<ElRow>
284+
<ElCol :offset="2" :span="7">
285+
<h4>RTSP over HTTP</h4>
286+
</ElCol>
287+
<ElCol :span="10">
288+
<ElSwitch v-model="config.RTSP_OVER_HTTP" active-value="on" inactive-value="off" />
289+
</ElCol>
290+
</ElRow>
291+
</ElTooltip>
282292
<ElRow v-if="config.RTSPSERVER === 'on'">
283293
<ElCol :offset="2" :span="7">
284-
<h4>RTSP(UDP)</h4>
285-
</ElCol>
286-
<ElCol :span="10">
287-
<ElInput type="text" readonly v-model="RTSP_UDP" />
288-
</ElCol>
289-
</ElRow>
290-
<ElRow v-if="config.RTSPSERVER === 'on'">
291-
<ElCol :offset="2" :span="7">
292-
<h4>RTSP(over HTTP)</h4>
294+
<h4>RTSP URL</h4>
293295
</ElCol>
294296
<ElCol :span="10">
295-
<ElInput type="text" readonly v-model="RTSP_OVER_HTTP" />
297+
<ElInput type="text" readonly :value="RtspUrl" />
296298
</ElCol>
297299
</ElRow>
298300

@@ -588,8 +590,6 @@
588590
},
589591
data() {
590592
return {
591-
RTSP_UDP: '',
592-
RTSP_OVER_HTTP: '',
593593
config: {
594594
appver: '', // ATOMCam app_ver (/atom/config/app.ver)
595595
ATOMHACKVER: '', // AtomHack Ver (/etc/atomhack.ver)
@@ -602,6 +602,7 @@
602602
RECORDING_LOCAL_SCHEDULE: 'off',
603603
RECORDING_LOCAL_SCHEDULE_LIST: '', // -> /media/mmc/local_schedule
604604
RTSPSERVER: 'off',
605+
RTSP_OVER_HTTP: 'off',
605606
RTSP_AUDIO: 'off',
606607
STORAGE_SDCARD: 'on',
607608
STORAGE_SDCARD_PUBLISH: 'off',
@@ -678,6 +679,10 @@
678679
isSwing() {
679680
return !this.rebooting && this.posValid && (this.config.PRODUCT_MODEL === 'ATOM_CAKP1JZJP');
680681
},
682+
RtspUrl() {
683+
const port = (this.config.RTSP_OVER_HTTP === 'on') ? 8080 : 8554;
684+
return `rtsp://${window.location.host}:${port}/unicast`;
685+
},
681686
},
682687
async mounted() {
683688
const res = await axios.get('./cgi-bin/hack_ini.cgi').catch(err => {
@@ -748,9 +753,6 @@
748753
this.reboot.dayOfWeekSelect = days.map(d => this.weekDays[(d + 6) % 7]);
749754
}
750755
751-
this.RTSP_UDP = `rtsp://${window.location.host}:8554/unicast`;
752-
this.RTSP_OVER_HTTP = `rtsp://${window.location.host}:8080/unicast`;
753-
754756
setInterval(async () => {
755757
const res = await axios.get('./cgi-bin/cmd.cgi?name=time').catch(err => {
756758
// eslint-disable-next-line no-console
@@ -911,9 +913,14 @@
911913
execCmds.push(`samba ${this.config.STORAGE_SDCARD_PUBLISH}`);
912914
}
913915
if(((this.config.RTSPSERVER !== this.oldConfig.RTSPSERVER) ||
914-
(this.config.RTSP_AUDIO !== this.oldConfig.RTSP_AUDIO)) &&
916+
(this.config.RTSP_AUDIO !== this.oldConfig.RTSP_AUDIO) ||
917+
(this.config.RTSP_OVER_HTTP !== this.oldConfig.RTSP_OVER_HTTP)) &&
915918
(this.config.RTSPSERVER === "on")) {
916-
execCmds.push(`rtspserver ${this.config.RTSPSERVER}`);
919+
if(this.config.RTSP_OVER_HTTP !== this.oldConfig.RTSP_OVER_HTTP) {
920+
execCmds.push('rtspserver restart');
921+
} else {
922+
execCmds.push('rtspserver on');
923+
}
917924
}
918925
if(Object.keys(this.config).some(prop => (prop.search(/WEBHOOK/) === 0) && (this.config[prop] !== this.oldConfig[prop]))) {
919926
execCmds.push('setwebhook');

0 commit comments

Comments
 (0)