File: 020181210~cd1dd6f.patch

package info (click to toggle)
libre 0.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,464 kB
  • sloc: ansic: 38,937; makefile: 132; sh: 4
file content (66 lines) | stat: -rw-r--r-- 1,991 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Description: rtmp: add rtmp_meta() to send metadata on stream
Origin: upstream, https://github.com/creytiv/re/commit/cd1dd6f
Author: Alfred E. Heggestad <alfred.heggestad@gmail.com>
Last-Update: 2019-01-26
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/include/re_rtmp.h
+++ b/include/re_rtmp.h
@@ -99,7 +99,7 @@
 int rtmp_amf_reply(struct rtmp_conn *conn, uint32_t stream_id, bool success,
 		   const struct odict *req,
 		   unsigned body_propc, ...);
-int rtmp_amf_data(struct rtmp_conn *conn, uint32_t stream_id,
+int rtmp_amf_data(const struct rtmp_conn *conn, uint32_t stream_id,
 		  const char *command, unsigned body_propc, ...);
 
 
@@ -125,6 +125,7 @@
 		       void *arg);
 int rtmp_play(struct rtmp_stream *strm, const char *name);
 int rtmp_publish(struct rtmp_stream *strm, const char *name);
+int rtmp_meta(struct rtmp_stream *strm);
 int rtmp_send_audio(struct rtmp_stream *strm, uint32_t timestamp,
 		    const uint8_t *pld, size_t len);
 int rtmp_send_video(struct rtmp_stream *strm, uint32_t timestamp,
--- a/src/rtmp/amf.c
+++ b/src/rtmp/amf.c
@@ -122,7 +122,7 @@
 }
 
 
-int rtmp_amf_data(struct rtmp_conn *conn, uint32_t stream_id,
+int rtmp_amf_data(const struct rtmp_conn *conn, uint32_t stream_id,
 		  const char *command, unsigned body_propc, ...)
 {
 	struct mbuf *mb;
--- a/src/rtmp/stream.c
+++ b/src/rtmp/stream.c
@@ -211,6 +211,27 @@
 
 
 /**
+ * Send metadata on the stream to the RTMP Server
+ *
+ * @param strm RTMP Stream
+ *
+ * @return 0 if success, otherwise errorcode
+ */
+int rtmp_meta(struct rtmp_stream *strm)
+{
+	if (!strm)
+		return EINVAL;
+
+	return rtmp_amf_data(strm->conn, strm->stream_id, "@setDataFrame",
+			     2,
+			     RTMP_AMF_TYPE_STRING, "onMetaData",
+			     RTMP_AMF_TYPE_ECMA_ARRAY, 2,
+			         RTMP_AMF_TYPE_NUMBER, "audiocodecid", 10.0,
+			         RTMP_AMF_TYPE_NUMBER, "videocodecid",  7.0);
+}
+
+
+/**
  * Send audio packet on the RTMP Stream
  *
  * @param strm      RTMP Stream