Skip to content

Commit

Permalink
Remove useless common header, there's nothing really common between t…
Browse files Browse the repository at this point in the history
…he modules
  • Loading branch information
wberube committed Jul 11, 2024
1 parent d474a29 commit e0fbe9d
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 52 deletions.
4 changes: 0 additions & 4 deletions src/common.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/gpio.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "common.h"
#include "hal/macros.h"

#include <errno.h>
#include <fcntl.h>
Expand Down
2 changes: 1 addition & 1 deletion src/http_post.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "common.h"
#include "hal/macros.h"
#include "hal/tools.h"
#include "jpeg.h"
#include "mp4/mp4.h"
Expand Down
1 change: 0 additions & 1 deletion src/jpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <unistd.h>
#include <sys/select.h>

#include "common.h"
#include "error.h"
#include "hal/types.h"
#include "media.h"
Expand Down
16 changes: 8 additions & 8 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#include "common.h"
#include "app_config.h"
#include "hal/macros.h"
#include "http_post.h"
#include "media.h"
#include "night.h"
#include "rtsp/rtsp_server.h"
#include "server.h"
#include "watchdog.h"

#include <getopt.h>
#include <signal.h>
Expand All @@ -7,13 +14,6 @@
#include <string.h>
#include <unistd.h>

#include "http_post.h"
#include "media.h"
#include "night.h"
#include "rtsp/rtsp_server.h"
#include "server.h"
#include "watchdog.h"

rtsp_handle rtspHandle;

int main(int argc, char *argv[]) {
Expand Down
3 changes: 2 additions & 1 deletion src/media.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include "common.h"
#include "app_config.h"
#include "error.h"
#include "hal/types.h"
#include "http_post.h"
#include "lib/shine/layer3.h"
#include "jpeg.h"
Expand Down
3 changes: 2 additions & 1 deletion src/night.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include "common.h"
#include "app_config.h"
#include "gpio.h"
#include "hal/macros.h"
#include "media.h"

#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/region.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "common.h"
#include "app_config.h"
#include "hal/support.h"
#include "text.h"

Expand Down
52 changes: 22 additions & 30 deletions src/rtsp/rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,28 +260,35 @@ static void __method_describe(struct connection_item_t *p, rtsp_handle h)
{
char sdp[__RTSP_TCP_BUF_SIZE];

const char baseRtp[] =
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
"s=librtsp\r\n"
"c=IN IP4 0.0.0.0\r\n"
"t=0 0\r\n"
"a=tool:libavformat 52.73.0\r\n";
char audioRtp[256] = "\r\n";
char audioRtpfmt[16];

if (h->audioPt != 255) {
switch (h->audioPt) {
case 0:
sprintf(audioRtpfmt, "PCMU");
strncpy(audioRtpfmt, "PCMU", 16 - 1);
break;
case 8:
sprintf(audioRtpfmt, "PCMA");
strncpy(audioRtpfmt, "PCMA", 16 - 1);
break;
case 14:
sprintf(audioRtpfmt, "MPA");
strncpy(audioRtpfmt, "MPA", 16 - 1);
break;
case 18:
sprintf(audioRtpfmt, "G729");
strncpy(audioRtpfmt, "G729", 16 - 1);
break;
case 96:
sprintf(audioRtpfmt, "MPEG4-GENERIC");
strncpy(audioRtpfmt, "MPEG4-GENERIC", 16 - 1);
break;
default:
sprintf(audioRtpfmt, "UNKNOWN");
strncpy(audioRtpfmt, "UNKNOWN", 16 - 1);
break;
}
sprintf(audioRtp,
Expand All @@ -305,18 +312,13 @@ static void __method_describe(struct connection_item_t *p, rtsp_handle h)
DBG("PPS BASE64:%s\n",h->sprop_pps_b64->result);

snprintf(sdp, __RTSP_TCP_BUF_SIZE- 1,
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
"s=librtsp\r\n"
"c=IN IP4 0.0.0.0\r\n"
"t=0 0\r\n"
"a=tool:libavformat 52.73.0\r\n"
"m=video 0 RTP/AVP 96\r\n"
"%sm=video 0 RTP/AVP 96\r\n"
"a=rtpmap:96 H265/90000\r\n"
"a=control:track=0\r\n"
"a=fmtp:96 packetization-mode=1;"
" profile-level-id=%s;"
" sprop-parameter-sets=%s,%s,%s;%s",
" sprop-parameter-sets=%s,%s,%s;%s",
baseRtp,
h->sprop_sps_b16->result,
h->sprop_vps_b64->result,
h->sprop_sps_b64->result,
Expand All @@ -333,34 +335,24 @@ static void __method_describe(struct connection_item_t *p, rtsp_handle h)
DBG("PPS BASE64:%s\n",h->sprop_pps_b64->result);

snprintf(sdp, __RTSP_TCP_BUF_SIZE - 1,
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
"s=librtsp\r\n"
"c=IN IP4 0.0.0.0\r\n"
"t=0 0\r\n"
"a=tool:libavformat 52.73.0\r\n"
"m=video 0 RTP/AVP 96\r\n"
"%sm=video 0 RTP/AVP 96\r\n"
"a=rtpmap:96 H264/90000\r\n"
"a=control:track=0\r\n"
"a=fmtp:96 packetization-mode=1;"
" profile-level-id=%s;"
" sprop-parameter-sets=%s,%s;%s",
" sprop-parameter-sets=%s,%s;%s",
baseRtp,
h->sprop_sps_b16->result,
h->sprop_sps_b64->result,
h->sprop_pps_b64->result,
audioRtp);
} else {
snprintf(sdp, __RTSP_TCP_BUF_SIZE - 1,
"v=0\r\n"
"o=- 0 0 IN IP4 127.0.0.1\r\n"
"s=librtsp\r\n"
"c=IN IP4 0.0.0.0\r\n"
"t=0 0\r\n"
"a=tool:libavformat 52.73.0\r\n"
"m=video 0 RTP/AVP 96\r\n"
"%sm=video 0 RTP/AVP 96\r\n"
"a=rtpmap:96 %s/90000\r\n"
"a=fmtp:96 packetization-mode=1\r\n"
"a=control:track=0%s",
"a=control:track=0%s",
baseRtp,
h->isH265 ? "H265" : "H264",
audioRtp);
}
Expand Down
3 changes: 2 additions & 1 deletion src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#include <time.h>
#include <unistd.h>

#include "common.h"
#include "app_config.h"
#include "hal/types.h"
#include "jpeg.h"
#include "media.h"
#include "mp4/mp4.h"
Expand Down
3 changes: 1 addition & 2 deletions src/text.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#include "common.h"
#include "hal/types.h"
#include "hal/support.h"
#include "lib/schrift.h"

#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion src/watchdog.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "common.h"
#include "hal/macros.h"

#include <fcntl.h>
#include <linux/watchdog.h>
Expand Down

0 comments on commit e0fbe9d

Please sign in to comment.