Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tutorials/tcp/rtsp-video-stream/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
PROG ?= example # Program we are building
DELETE = rm -rf # Command to remove files
OUT ?= -o $(PROG) # Compiler argument for output file
SOURCES = main.c mongoose.c rtsp.c # Source code files
CFLAGS = -W -Wall -Wextra -g -I. -include rtsp.h # Build options

# Mongoose build options. See https://mongoose.ws/documentation/#build-options
#CFLAGS_MONGOOSE += -DMG_ENABLE_LINES

ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
PROG ?= example.exe # Use .exe suffix for the binary
CC = gcc # Use MinGW gcc compiler
CFLAGS += -lws2_32 # Link against Winsock library
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
OUT ?= -o $(PROG) # Build output
endif

all: $(PROG) # Default target. Build and run program
$(RUN) ./$(PROG) $(ARGS)

$(PROG): $(SOURCES) # Build program from sources
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)

clean: # Cleanup. Delete built program and all build artifacts
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM
28 changes: 28 additions & 0 deletions tutorials/tcp/rtsp-video-stream/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2026 Cesanta Software Limited
// All rights reserved

#include "mongoose.h"

int main(void) {
struct mg_mgr mgr;

struct mg_rtsp_opts opts = {
0,
0,
0,
mg_rtsp_get_mp4_frame,
(void *) "test.mp4",
mg_rtsp_get_mp4_audio,
(void *) "test.mp4",
{0x12, 0x10},
};

mg_mgr_init(&mgr);
mg_rtsp_listen(&mgr, "rtsp://0.0.0.0:8554/cam", &opts);

while (true) {
mg_mgr_poll(&mgr, 10);
}
mg_mgr_free(&mgr);
return 0;
}
1 change: 1 addition & 0 deletions tutorials/tcp/rtsp-video-stream/mongoose.c
1 change: 1 addition & 0 deletions tutorials/tcp/rtsp-video-stream/mongoose.h
Loading
Loading