Skip to content

Commit ce6c5de

Browse files
committed
Implement FLV support and the assorted RTMP module, live streaming working on YouTube
1 parent 316b9a6 commit ce6c5de

16 files changed

Lines changed: 1359 additions & 52 deletions

File tree

doc/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This document describes the fields that can be found within a configuration file
6767

6868
- **enable**: Boolean to turn on special streaming methods (default: `false`).
6969
- **udp_srcport**: Source port for UDP streaming (default: `5600`).
70-
- **dest**: List of destination URLs for streaming (e.g., `udp://239.255.255.0:5600`).
70+
- **dest**: List of destination URLs for streaming (e.g., `- udp://239.255.255.0:5600 or - rtmp://myserver/path/mykey`).
7171

7272
## Audio section
7373

src/fmt/bitbuf.c

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,36 @@ enum BufError put_u16_le(struct BitBuf *ptr, const uint16_t val) {
108108
return BUF_OK;
109109
}
110110

111+
enum BufError put_u24_be_to_offset(
112+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val) {
113+
chk_ptr uint32_t pos = offset + 3;
114+
if (pos >= ptr->size)
115+
chk_realloc ptr->buf[offset + 0] = (val >> 16) & 0xff;
116+
ptr->buf[offset + 1] = (val >> 8) & 0xff;
117+
ptr->buf[offset + 2] = (val >> 0) & 0xff;
118+
return BUF_OK;
119+
}
120+
enum BufError put_u24_be(struct BitBuf *ptr, const uint32_t val) {
121+
chk_ptr enum BufError err = put_u24_be_to_offset(ptr, ptr->offset, val);
122+
chk_err ptr->offset += 3;
123+
return BUF_OK;
124+
}
125+
126+
enum BufError put_u24_le_to_offset(
127+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val) {
128+
chk_ptr uint32_t pos = offset + 3;
129+
if (pos >= ptr->size)
130+
chk_realloc ptr->buf[offset + 0] = (val >> 0) & 0xff;
131+
ptr->buf[offset + 1] = (val >> 8) & 0xff;
132+
ptr->buf[offset + 2] = (val >> 16) & 0xff;
133+
return BUF_OK;
134+
}
135+
enum BufError put_u24_le(struct BitBuf *ptr, const uint32_t val) {
136+
chk_ptr enum BufError err = put_u24_le_to_offset(ptr, ptr->offset, val);
137+
chk_err ptr->offset += 3;
138+
return BUF_OK;
139+
}
140+
111141
enum BufError put_u32_be_to_offset(
112142
struct BitBuf *ptr, const uint32_t offset, const uint32_t val) {
113143
chk_ptr uint32_t pos = offset + sizeof(uint32_t);
@@ -123,6 +153,23 @@ enum BufError put_u32_be(struct BitBuf *ptr, const uint32_t val) {
123153
chk_err ptr->offset += sizeof(uint32_t);
124154
return BUF_OK;
125155
}
156+
157+
enum BufError put_u32_le_to_offset(
158+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val) {
159+
chk_ptr uint32_t pos = offset + 4;
160+
if (pos >= ptr->size)
161+
chk_realloc ptr->buf[offset + 0] = (val >> 0) & 0xff;
162+
ptr->buf[offset + 1] = (val >> 8) & 0xff;
163+
ptr->buf[offset + 2] = (val >> 16) & 0xff;
164+
ptr->buf[offset + 3] = (val >> 24) & 0xff;
165+
return BUF_OK;
166+
}
167+
enum BufError put_u32_le(struct BitBuf *ptr, const uint32_t val) {
168+
chk_ptr enum BufError err = put_u32_le_to_offset(ptr, ptr->offset, val);
169+
chk_err ptr->offset += sizeof(uint32_t);
170+
return BUF_OK;
171+
}
172+
126173
enum BufError put_i32_be(struct BitBuf *ptr, const int32_t val) {
127174
chk_ptr enum BufError err = put_u32_be_to_offset(ptr, ptr->offset, val);
128175
chk_err ptr->offset += sizeof(int32_t);
@@ -149,22 +196,6 @@ enum BufError put_u64_be(struct BitBuf *ptr, const uint64_t val) {
149196
return BUF_OK;
150197
}
151198

152-
enum BufError put_u32_le_to_offset(
153-
struct BitBuf *ptr, const uint32_t offset, const uint32_t val) {
154-
chk_ptr uint32_t pos = offset + 4;
155-
if (pos >= ptr->size)
156-
chk_realloc ptr->buf[offset + 0] = (val >> 0) & 0xff;
157-
ptr->buf[offset + 1] = (val >> 8) & 0xff;
158-
ptr->buf[offset + 2] = (val >> 16) & 0xff;
159-
ptr->buf[offset + 3] = (val >> 24) & 0xff;
160-
return BUF_OK;
161-
}
162-
enum BufError put_u32_le(struct BitBuf *ptr, const uint32_t val) {
163-
chk_ptr enum BufError err = put_u32_le_to_offset(ptr, ptr->offset, val);
164-
chk_err ptr->offset += sizeof(uint32_t);
165-
return BUF_OK;
166-
}
167-
168199
enum BufError put_str4_to_offset(
169200
struct BitBuf *ptr, const uint32_t offset, const char str[4]) {
170201
chk_ptr uint32_t pos = offset + 4;

src/fmt/bitbuf.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,22 @@ enum BufError put_u16_be(struct BitBuf *ptr, const uint16_t val);
4747
enum BufError put_u16_le_to_offset(
4848
struct BitBuf *ptr, const uint32_t offset, const uint16_t val);
4949
enum BufError put_u16_le(struct BitBuf *ptr, const uint16_t val);
50+
enum BufError put_u24_be_to_offset(
51+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val);
52+
enum BufError put_u24_be(struct BitBuf *ptr, const uint32_t val);
53+
enum BufError put_u24_le_to_offset(
54+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val);
55+
enum BufError put_u24_le(struct BitBuf *ptr, const uint32_t val);
5056
enum BufError put_u32_be_to_offset(
5157
struct BitBuf *ptr, const uint32_t offset, const uint32_t val);
5258
enum BufError put_u32_be(struct BitBuf *ptr, const uint32_t val);
59+
enum BufError put_u32_le_to_offset(
60+
struct BitBuf *ptr, const uint32_t offset, const uint32_t val);
61+
enum BufError put_u32_le(struct BitBuf *ptr, const uint32_t val);
5362
enum BufError put_i32_be(struct BitBuf *ptr, const int32_t val);
5463
enum BufError put_u64_be_to_offset(
5564
struct BitBuf *ptr, const uint32_t offset, const uint64_t val);
5665
enum BufError put_u64_be(struct BitBuf *ptr, const uint64_t val);
57-
enum BufError put_u32_le_to_offset(
58-
struct BitBuf *ptr, const uint32_t offset, const uint32_t val);
59-
enum BufError put_u32_le(struct BitBuf *ptr, const uint32_t val);
6066
enum BufError put_str4_to_offset(
6167
struct BitBuf *ptr, const uint32_t offset, const char str[4]);
6268
enum BufError put_str4(struct BitBuf *ptr, const char str[4]);

0 commit comments

Comments
 (0)