正在显示
10 个修改的文件
包含
142 行增加
和
168 行删除
@@ -46,8 +46,8 @@ SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h | @@ -46,8 +46,8 @@ SRS_LIBRTMP_I = $(SRS_OBJS)/include/srs_librtmp.h | ||
46 | SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a | 46 | SRS_LIBRTMP_L = $(SRS_OBJS)/lib/srs_librtmp.a |
47 | # openssl for complex handshake, built by srs. | 47 | # openssl for complex handshake, built by srs. |
48 | SRS_LIBSSL_L = | 48 | SRS_LIBSSL_L = |
49 | -# the research public headers | ||
50 | -SRS_RESEARCH_DEPS = Makefile srs_research_public.h | 49 | +# public depends, the Makefile or public headers. |
50 | +SRS_RESEARCH_DEPS = Makefile | ||
51 | 51 | ||
52 | # for x86/x64 platform | 52 | # for x86/x64 platform |
53 | ifeq ($(GCC), gcc) | 53 | ifeq ($(GCC), gcc) |
@@ -33,7 +33,6 @@ gcc srs_flv_injecter.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_flv_i | @@ -33,7 +33,6 @@ gcc srs_flv_injecter.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_flv_i | ||
33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
34 | 34 | ||
35 | #include "../../objs/include/srs_librtmp.h" | 35 | #include "../../objs/include/srs_librtmp.h" |
36 | -#include "srs_research_public.h" | ||
37 | 36 | ||
38 | #define ERROR_INJECTED 10000 | 37 | #define ERROR_INJECTED 10000 |
39 | 38 | ||
@@ -73,12 +72,12 @@ int main(int argc, char** argv) | @@ -73,12 +72,12 @@ int main(int argc, char** argv) | ||
73 | tmp_file = (char*)malloc(tmp_file_size); | 72 | tmp_file = (char*)malloc(tmp_file_size); |
74 | snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file); | 73 | snprintf(tmp_file, tmp_file_size, "%s.tmp", out_flv_file); |
75 | 74 | ||
76 | - trace("inject flv file keyframes to metadata."); | ||
77 | - trace("srs(simple-rtmp-server) client librtmp library."); | ||
78 | - trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
79 | - trace("input: %s", in_flv_file); | ||
80 | - trace("output: %s", out_flv_file); | ||
81 | - trace("tmp_file: %s", tmp_file); | 75 | + srs_trace("inject flv file keyframes to metadata."); |
76 | + srs_trace("srs(simple-rtmp-server) client librtmp library."); | ||
77 | + srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
78 | + srs_trace("input: %s", in_flv_file); | ||
79 | + srs_trace("output: %s", out_flv_file); | ||
80 | + srs_trace("tmp_file: %s", tmp_file); | ||
82 | 81 | ||
83 | ret = process(in_flv_file, tmp_file, &ic, &oc); | 82 | ret = process(in_flv_file, tmp_file, &ic, &oc); |
84 | 83 | ||
@@ -89,13 +88,13 @@ int main(int argc, char** argv) | @@ -89,13 +88,13 @@ int main(int argc, char** argv) | ||
89 | unlink(tmp_file); | 88 | unlink(tmp_file); |
90 | if (ret == ERROR_INJECTED) { | 89 | if (ret == ERROR_INJECTED) { |
91 | ret = 0; | 90 | ret = 0; |
92 | - trace("file already injected."); | 91 | + srs_trace("file already injected."); |
93 | } else { | 92 | } else { |
94 | - trace("error, remove tmp file."); | 93 | + srs_trace("error, remove tmp file."); |
95 | } | 94 | } |
96 | } else { | 95 | } else { |
97 | rename(tmp_file, out_flv_file); | 96 | rename(tmp_file, out_flv_file); |
98 | - trace("completed, rename to %s", out_flv_file); | 97 | + srs_trace("completed, rename to %s", out_flv_file); |
99 | } | 98 | } |
100 | 99 | ||
101 | free(tmp_file); | 100 | free(tmp_file); |
@@ -123,14 +122,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s | @@ -123,14 +122,14 @@ int process(const char* in_flv_file, const char* out_flv_file, srs_flv_t* pic, s | ||
123 | 122 | ||
124 | if ((ic = srs_flv_open_read(in_flv_file)) == NULL) { | 123 | if ((ic = srs_flv_open_read(in_flv_file)) == NULL) { |
125 | ret = 2; | 124 | ret = 2; |
126 | - trace("open input flv file failed. ret=%d", ret); | 125 | + srs_trace("open input flv file failed. ret=%d", ret); |
127 | return ret; | 126 | return ret; |
128 | } | 127 | } |
129 | *pic = ic; | 128 | *pic = ic; |
130 | 129 | ||
131 | if ((oc = srs_flv_open_write(out_flv_file)) == NULL) { | 130 | if ((oc = srs_flv_open_write(out_flv_file)) == NULL) { |
132 | ret = 2; | 131 | ret = 2; |
133 | - trace("open output flv file failed. ret=%d", ret); | 132 | + srs_trace("open output flv file failed. ret=%d", ret); |
134 | return ret; | 133 | return ret; |
135 | } | 134 | } |
136 | *poc = oc; | 135 | *poc = oc; |
@@ -164,13 +163,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata) | @@ -164,13 +163,13 @@ int parse_metadata(char* data, int size, srs_amf0_t* pname, srs_amf0_t* pdata) | ||
164 | *pname = srs_amf0_parse(data, size, &nparsed); | 163 | *pname = srs_amf0_parse(data, size, &nparsed); |
165 | 164 | ||
166 | if (*pname == NULL || nparsed >= size) { | 165 | if (*pname == NULL || nparsed >= size) { |
167 | - trace("invalid amf0 name data."); | 166 | + srs_trace("invalid amf0 name data."); |
168 | return -1; | 167 | return -1; |
169 | } | 168 | } |
170 | 169 | ||
171 | *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); | 170 | *pdata = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); |
172 | if (*pdata == NULL || nparsed > size) { | 171 | if (*pdata == NULL || nparsed > size) { |
173 | - trace("invalid amf0 value data"); | 172 | + srs_trace("invalid amf0 value data"); |
174 | return -1; | 173 | return -1; |
175 | } | 174 | } |
176 | 175 | ||
@@ -206,22 +205,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0 | @@ -206,22 +205,22 @@ int build_keyframes(srs_flv_t ic, srs_amf0_t *pname, srs_amf0_t* pdata, srs_amf0 | ||
206 | return ret; | 205 | return ret; |
207 | } | 206 | } |
208 | 207 | ||
209 | - trace("build keyframe infos from flv"); | 208 | + srs_trace("build keyframe infos from flv"); |
210 | for (;;) { | 209 | for (;;) { |
211 | offset = srs_flv_tellg(ic); | 210 | offset = srs_flv_tellg(ic); |
212 | 211 | ||
213 | // tag header | 212 | // tag header |
214 | if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) { | 213 | if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) { |
215 | if (srs_flv_is_eof(ret)) { | 214 | if (srs_flv_is_eof(ret)) { |
216 | - trace("parse completed."); | 215 | + srs_trace("parse completed."); |
217 | return 0; | 216 | return 0; |
218 | } | 217 | } |
219 | - trace("flv get packet failed. ret=%d", ret); | 218 | + srs_trace("flv get packet failed. ret=%d", ret); |
220 | return ret; | 219 | return ret; |
221 | } | 220 | } |
222 | 221 | ||
223 | if (size <= 0) { | 222 | if (size <= 0) { |
224 | - trace("invalid size=%d", size); | 223 | + srs_trace("invalid size=%d", size); |
225 | return ret; | 224 | return ret; |
226 | } | 225 | } |
227 | 226 | ||
@@ -343,20 +342,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a | @@ -343,20 +342,20 @@ int do_inject_flv(srs_flv_t ic, srs_flv_t oc, srs_amf0_t amf0_name, srs_amf0_t a | ||
343 | free(data); | 342 | free(data); |
344 | } | 343 | } |
345 | 344 | ||
346 | - trace("build keyframe infos from flv"); | 345 | + srs_trace("build keyframe infos from flv"); |
347 | for (;;) { | 346 | for (;;) { |
348 | // tag header | 347 | // tag header |
349 | if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) { | 348 | if ((ret = srs_flv_read_tag_header(ic, &type, &size, ×tamp)) != 0) { |
350 | if (srs_flv_is_eof(ret)) { | 349 | if (srs_flv_is_eof(ret)) { |
351 | - trace("parse completed."); | 350 | + srs_trace("parse completed."); |
352 | return 0; | 351 | return 0; |
353 | } | 352 | } |
354 | - trace("flv get packet failed. ret=%d", ret); | 353 | + srs_trace("flv get packet failed. ret=%d", ret); |
355 | return ret; | 354 | return ret; |
356 | } | 355 | } |
357 | 356 | ||
358 | if (size <= 0) { | 357 | if (size <= 0) { |
359 | - trace("invalid size=%d", size); | 358 | + srs_trace("invalid size=%d", size); |
360 | break; | 359 | break; |
361 | } | 360 | } |
362 | 361 |
@@ -25,6 +25,7 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | @@ -25,6 +25,7 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | ||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <stdio.h> | 27 | #include <stdio.h> |
28 | +#include <string.h> | ||
28 | #include <stdlib.h> | 29 | #include <stdlib.h> |
29 | #include <unistd.h> | 30 | #include <unistd.h> |
30 | 31 | ||
@@ -33,7 +34,6 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | @@ -33,7 +34,6 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | ||
33 | #include <fcntl.h> | 34 | #include <fcntl.h> |
34 | 35 | ||
35 | #include "../../objs/include/srs_librtmp.h" | 36 | #include "../../objs/include/srs_librtmp.h" |
36 | -#include "srs_research_public.h" | ||
37 | 37 | ||
38 | int parse_flv(srs_flv_t flv); | 38 | int parse_flv(srs_flv_t flv); |
39 | int main(int argc, char** argv) | 39 | int main(int argc, char** argv) |
@@ -59,14 +59,14 @@ int main(int argc, char** argv) | @@ -59,14 +59,14 @@ int main(int argc, char** argv) | ||
59 | 59 | ||
60 | in_flv_file = argv[1]; | 60 | in_flv_file = argv[1]; |
61 | 61 | ||
62 | - trace("parse and show flv file detail."); | ||
63 | - trace("srs(simple-rtmp-server) client librtmp library."); | ||
64 | - trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
65 | - trace("input: %s", in_flv_file); | 62 | + srs_trace("parse and show flv file detail."); |
63 | + srs_trace("srs(simple-rtmp-server) client librtmp library."); | ||
64 | + srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
65 | + srs_trace("input: %s", in_flv_file); | ||
66 | 66 | ||
67 | if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { | 67 | if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { |
68 | ret = 2; | 68 | ret = 2; |
69 | - trace("open flv file failed. ret=%d", ret); | 69 | + srs_trace("open flv file failed. ret=%d", ret); |
70 | return ret; | 70 | return ret; |
71 | } | 71 | } |
72 | 72 | ||
@@ -148,12 +148,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset) | @@ -148,12 +148,12 @@ int parse_script_data(u_int32_t timestamp, char* data, int size, int64_t offset) | ||
148 | // amf0 | 148 | // amf0 |
149 | amf0_name = srs_amf0_parse(data, size, &nparsed); | 149 | amf0_name = srs_amf0_parse(data, size, &nparsed); |
150 | if (amf0_name == NULL || nparsed >= size) { | 150 | if (amf0_name == NULL || nparsed >= size) { |
151 | - trace("invalid amf0 name data."); | 151 | + srs_trace("invalid amf0 name data."); |
152 | return -1; | 152 | return -1; |
153 | } | 153 | } |
154 | amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); | 154 | amf0_data = srs_amf0_parse(data + nparsed, size - nparsed, &nparsed); |
155 | 155 | ||
156 | - trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" | 156 | + srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" |
157 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s", | 157 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n%s%s", |
158 | srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size, | 158 | srs_type2string(SRS_RTMP_TYPE_SCRIPT), timestamp, size + FLV_HEADER_SIZE, size, |
159 | (int)offset, hbuf, tbuf, | 159 | (int)offset, hbuf, tbuf, |
@@ -179,7 +179,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset) | @@ -179,7 +179,7 @@ int parse_audio_data(u_int32_t timestamp, char* data, int size, int64_t offset) | ||
179 | // bytes | 179 | // bytes |
180 | parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); | 180 | parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); |
181 | 181 | ||
182 | - trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" | 182 | + srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" |
183 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", | 183 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", |
184 | srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size, | 184 | srs_type2string(SRS_RTMP_TYPE_AUDIO), timestamp, size + FLV_HEADER_SIZE, size, |
185 | (int)offset, hbuf, tbuf); | 185 | (int)offset, hbuf, tbuf); |
@@ -197,7 +197,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset) | @@ -197,7 +197,7 @@ int parse_video_data(u_int32_t timestamp, char* data, int size, int64_t offset) | ||
197 | // bytes | 197 | // bytes |
198 | parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); | 198 | parse_bytes(data, size, hbuf, sizeof(hbuf), tbuf, sizeof(tbuf), 16); |
199 | 199 | ||
200 | - trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" | 200 | + srs_trace("packet type=%s, time=%d, size=%d, data-size=%d, \n" |
201 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", | 201 | "offset=%d\n[+00, +15] %s\n[-15, EOF] %s\n", |
202 | srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size, | 202 | srs_type2string(SRS_RTMP_TYPE_VIDEO), timestamp, size + FLV_HEADER_SIZE, size, |
203 | (int)offset, hbuf, tbuf); | 203 | (int)offset, hbuf, tbuf); |
@@ -222,22 +222,22 @@ int parse_flv(srs_flv_t flv) | @@ -222,22 +222,22 @@ int parse_flv(srs_flv_t flv) | ||
222 | return ret; | 222 | return ret; |
223 | } | 223 | } |
224 | 224 | ||
225 | - trace("start parse flv"); | 225 | + srs_trace("start parse flv"); |
226 | for (;;) { | 226 | for (;;) { |
227 | offset = srs_flv_tellg(flv); | 227 | offset = srs_flv_tellg(flv); |
228 | 228 | ||
229 | // tag header | 229 | // tag header |
230 | if ((ret = srs_flv_read_tag_header(flv, &type, &size, ×tamp)) != 0) { | 230 | if ((ret = srs_flv_read_tag_header(flv, &type, &size, ×tamp)) != 0) { |
231 | if (srs_flv_is_eof(ret)) { | 231 | if (srs_flv_is_eof(ret)) { |
232 | - trace("parse completed."); | 232 | + srs_trace("parse completed."); |
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | - trace("flv get packet failed. ret=%d", ret); | 235 | + srs_trace("flv get packet failed. ret=%d", ret); |
236 | return ret; | 236 | return ret; |
237 | } | 237 | } |
238 | 238 | ||
239 | if (size <= 0) { | 239 | if (size <= 0) { |
240 | - trace("invalid size=%d", size); | 240 | + srs_trace("invalid size=%d", size); |
241 | break; | 241 | break; |
242 | } | 242 | } |
243 | 243 |
@@ -35,8 +35,6 @@ gcc srs_h264_raw_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_h | @@ -35,8 +35,6 @@ gcc srs_h264_raw_publish.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_h | ||
35 | 35 | ||
36 | #include "../../objs/include/srs_librtmp.h" | 36 | #include "../../objs/include/srs_librtmp.h" |
37 | 37 | ||
38 | -#define srs_trace(msg, ...) printf(msg, ##__VA_ARGS__);printf("\n") | ||
39 | - | ||
40 | int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fps, | 38 | int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fps, |
41 | char** frame, int* frame_size, int* dts, int* pts) | 39 | char** frame, int* frame_size, int* dts, int* pts) |
42 | { | 40 | { |
@@ -80,18 +78,18 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp | @@ -80,18 +78,18 @@ int read_h264_frame(char* data, int size, char** pp, int* pnb_start_code, int fp | ||
80 | 78 | ||
81 | int main(int argc, char** argv) | 79 | int main(int argc, char** argv) |
82 | { | 80 | { |
83 | - srs_trace("publish raw h.264 as rtmp stream to server like FMLE/FFMPEG/Encoder"); | ||
84 | - srs_trace("srs(simple-rtmp-server) client librtmp library."); | ||
85 | - srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | 81 | + printf("publish raw h.264 as rtmp stream to server like FMLE/FFMPEG/Encoder\n"); |
82 | + printf("SRS(simple-rtmp-server) client librtmp library.\n"); | ||
83 | + printf("version: %d.%d.%d\n", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
86 | 84 | ||
87 | if (argc <= 2) { | 85 | if (argc <= 2) { |
88 | - srs_trace("Usage: %s <h264_raw_file> <rtmp_publish_url>", argv[0]); | ||
89 | - srs_trace(" h264_raw_file: the h264 raw steam file."); | ||
90 | - srs_trace(" rtmp_publish_url: the rtmp publish url."); | ||
91 | - srs_trace("For example:"); | ||
92 | - srs_trace(" %s ./720p.h264.raw rtmp://127.0.0.1:1935/live/livestream", argv[0]); | ||
93 | - srs_trace("Where the file: http://winlinvip.github.io/srs.release/3rdparty/720p.h264.raw"); | ||
94 | - srs_trace("See: https://github.com/winlinvip/simple-rtmp-server/issues/66"); | 86 | + printf("Usage: %s <h264_raw_file> <rtmp_publish_url>\n", argv[0]); |
87 | + printf(" h264_raw_file: the h264 raw steam file.\n"); | ||
88 | + printf(" rtmp_publish_url: the rtmp publish url.\n"); | ||
89 | + printf("For example:\n"); | ||
90 | + printf(" %s ./720p.h264.raw rtmp://127.0.0.1:1935/live/livestream\n", argv[0]); | ||
91 | + printf("Where the file: http://winlinvip.github.io/srs.release/3rdparty/720p.h264.raw\n"); | ||
92 | + printf("See: https://github.com/winlinvip/simple-rtmp-server/issues/66\n"); | ||
95 | exit(-1); | 93 | exit(-1); |
96 | } | 94 | } |
97 | 95 |
@@ -33,7 +33,6 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | @@ -33,7 +33,6 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | ||
33 | #include <fcntl.h> | 33 | #include <fcntl.h> |
34 | 34 | ||
35 | #include "../../objs/include/srs_librtmp.h" | 35 | #include "../../objs/include/srs_librtmp.h" |
36 | -#include "srs_research_public.h" | ||
37 | 36 | ||
38 | int proxy(srs_flv_t flv, srs_rtmp_t ortmp); | 37 | int proxy(srs_flv_t flv, srs_rtmp_t ortmp); |
39 | int connect_oc(srs_rtmp_t ortmp); | 38 | int connect_oc(srs_rtmp_t ortmp); |
@@ -87,22 +86,22 @@ int main(int argc, char** argv) | @@ -87,22 +86,22 @@ int main(int argc, char** argv) | ||
87 | } | 86 | } |
88 | } | 87 | } |
89 | 88 | ||
90 | - trace("ingest flv file and publish to RTMP server like FFMPEG."); | ||
91 | - trace("srs(simple-rtmp-server) client librtmp library."); | ||
92 | - trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
93 | - trace("input: %s", in_flv_file); | ||
94 | - trace("output: %s", out_rtmp_url); | 89 | + srs_trace("ingest flv file and publish to RTMP server like FFMPEG."); |
90 | + srs_trace("srs(simple-rtmp-server) client librtmp library."); | ||
91 | + srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
92 | + srs_trace("input: %s", in_flv_file); | ||
93 | + srs_trace("output: %s", out_rtmp_url); | ||
95 | 94 | ||
96 | if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { | 95 | if ((flv = srs_flv_open_read(in_flv_file)) == NULL) { |
97 | ret = 2; | 96 | ret = 2; |
98 | - trace("open flv file failed. ret=%d", ret); | 97 | + srs_trace("open flv file failed. ret=%d", ret); |
99 | return ret; | 98 | return ret; |
100 | } | 99 | } |
101 | 100 | ||
102 | ortmp = srs_rtmp_create(out_rtmp_url); | 101 | ortmp = srs_rtmp_create(out_rtmp_url); |
103 | 102 | ||
104 | ret = proxy(flv, ortmp); | 103 | ret = proxy(flv, ortmp); |
105 | - trace("ingest flv to RTMP completed"); | 104 | + srs_trace("ingest flv to RTMP completed"); |
106 | 105 | ||
107 | srs_rtmp_destroy(ortmp); | 106 | srs_rtmp_destroy(ortmp); |
108 | srs_flv_close(flv); | 107 | srs_flv_close(flv); |
@@ -119,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) | @@ -119,20 +118,20 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) | ||
119 | int size; | 118 | int size; |
120 | char* data = NULL; | 119 | char* data = NULL; |
121 | 120 | ||
122 | - trace("start ingest flv to RTMP stream"); | 121 | + srs_trace("start ingest flv to RTMP stream"); |
123 | for (;;) { | 122 | for (;;) { |
124 | // tag header | 123 | // tag header |
125 | if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) { | 124 | if ((ret = srs_flv_read_tag_header(flv, &type, &size, ptimestamp)) != 0) { |
126 | if (srs_flv_is_eof(ret)) { | 125 | if (srs_flv_is_eof(ret)) { |
127 | - trace("parse completed."); | 126 | + srs_trace("parse completed."); |
128 | return 0; | 127 | return 0; |
129 | } | 128 | } |
130 | - trace("flv get packet failed. ret=%d", ret); | 129 | + srs_trace("flv get packet failed. ret=%d", ret); |
131 | return ret; | 130 | return ret; |
132 | } | 131 | } |
133 | 132 | ||
134 | if (size <= 0) { | 133 | if (size <= 0) { |
135 | - trace("invalid size=%d", size); | 134 | + srs_trace("invalid size=%d", size); |
136 | break; | 135 | break; |
137 | } | 136 | } |
138 | 137 | ||
@@ -143,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) | @@ -143,10 +142,10 @@ int do_proxy(srs_flv_t flv, srs_rtmp_t ortmp, int64_t re, u_int32_t* ptimestamp) | ||
143 | } | 142 | } |
144 | 143 | ||
145 | if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) { | 144 | if ((ret = srs_write_packet(ortmp, type, *ptimestamp, data, size)) != 0) { |
146 | - trace("irtmp get packet failed. ret=%d", ret); | 145 | + srs_trace("irtmp get packet failed. ret=%d", ret); |
147 | return ret; | 146 | return ret; |
148 | } | 147 | } |
149 | - verbose("ortmp sent packet: type=%s, time=%d, size=%d", | 148 | + srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", |
150 | srs_type2string(type), *ptimestamp, size); | 149 | srs_type2string(type), *ptimestamp, size); |
151 | 150 | ||
152 | re_update(re, *ptimestamp); | 151 | re_update(re, *ptimestamp); |
@@ -183,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp) | @@ -183,22 +182,22 @@ int connect_oc(srs_rtmp_t ortmp) | ||
183 | int ret = 0; | 182 | int ret = 0; |
184 | 183 | ||
185 | if ((ret = srs_simple_handshake(ortmp)) != 0) { | 184 | if ((ret = srs_simple_handshake(ortmp)) != 0) { |
186 | - trace("ortmp simple handshake failed. ret=%d", ret); | 185 | + srs_trace("ortmp simple handshake failed. ret=%d", ret); |
187 | return ret; | 186 | return ret; |
188 | } | 187 | } |
189 | - trace("ortmp simple handshake success"); | 188 | + srs_trace("ortmp simple handshake success"); |
190 | 189 | ||
191 | if ((ret = srs_connect_app(ortmp)) != 0) { | 190 | if ((ret = srs_connect_app(ortmp)) != 0) { |
192 | - trace("ortmp connect vhost/app failed. ret=%d", ret); | 191 | + srs_trace("ortmp connect vhost/app failed. ret=%d", ret); |
193 | return ret; | 192 | return ret; |
194 | } | 193 | } |
195 | - trace("ortmp connect vhost/app success"); | 194 | + srs_trace("ortmp connect vhost/app success"); |
196 | 195 | ||
197 | if ((ret = srs_publish_stream(ortmp)) != 0) { | 196 | if ((ret = srs_publish_stream(ortmp)) != 0) { |
198 | - trace("ortmp publish stream failed. ret=%d", ret); | 197 | + srs_trace("ortmp publish stream failed. ret=%d", ret); |
199 | return ret; | 198 | return ret; |
200 | } | 199 | } |
201 | - trace("ortmp publish stream success"); | 200 | + srs_trace("ortmp publish stream success"); |
202 | 201 | ||
203 | return ret; | 202 | return ret; |
204 | } | 203 | } |
@@ -210,16 +209,16 @@ int64_t re_create() | @@ -210,16 +209,16 @@ int64_t re_create() | ||
210 | 209 | ||
211 | // use the starttime to get the deviation | 210 | // use the starttime to get the deviation |
212 | int64_t deviation = re - tools_main_entrance_startup_time; | 211 | int64_t deviation = re - tools_main_entrance_startup_time; |
213 | - trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS)); | 212 | + srs_trace("deviation is %d ms, pulse is %d ms", (int)(deviation), (int)(RE_PULSE_MS)); |
214 | 213 | ||
215 | // so, we adjust time to max(0, deviation) | 214 | // so, we adjust time to max(0, deviation) |
216 | // because the last pulse, we already sleeped | 215 | // because the last pulse, we already sleeped |
217 | int adjust = (int)(deviation); | 216 | int adjust = (int)(deviation); |
218 | if (adjust > 0) { | 217 | if (adjust > 0) { |
219 | - trace("adjust re time for %d ms", adjust); | 218 | + srs_trace("adjust re time for %d ms", adjust); |
220 | re -= adjust; | 219 | re -= adjust; |
221 | } else { | 220 | } else { |
222 | - trace("no need to adjust re time"); | 221 | + srs_trace("no need to adjust re time"); |
223 | } | 222 | } |
224 | 223 | ||
225 | return re; | 224 | return re; |
@@ -240,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time) | @@ -240,7 +239,7 @@ void re_cleanup(int64_t re, u_int32_t time) | ||
240 | int64_t now = srs_get_time_ms(); | 239 | int64_t now = srs_get_time_ms(); |
241 | int64_t diff = time - (now -re); | 240 | int64_t diff = time - (now -re); |
242 | if (diff > 0) { | 241 | if (diff > 0) { |
243 | - trace("re_cleanup sleep for the last pulse for %d ms", (int)diff); | 242 | + srs_trace("re_cleanup sleep for the last pulse for %d ms", (int)diff); |
244 | usleep(diff * 1000); | 243 | usleep(diff * 1000); |
245 | } | 244 | } |
246 | } | 245 | } |
@@ -29,7 +29,6 @@ gcc srs_ingest_rtmp.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest | @@ -29,7 +29,6 @@ gcc srs_ingest_rtmp.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest | ||
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | 30 | ||
31 | #include "../../objs/include/srs_librtmp.h" | 31 | #include "../../objs/include/srs_librtmp.h" |
32 | -#include "srs_research_public.h" | ||
33 | 32 | ||
34 | int connect_ic(srs_rtmp_t irtmp); | 33 | int connect_ic(srs_rtmp_t irtmp); |
35 | int connect_oc(srs_rtmp_t ortmp); | 34 | int connect_oc(srs_rtmp_t ortmp); |
@@ -73,17 +72,17 @@ int main(int argc, char** argv) | @@ -73,17 +72,17 @@ int main(int argc, char** argv) | ||
73 | } | 72 | } |
74 | } | 73 | } |
75 | 74 | ||
76 | - trace("ingest RTMP and publish to RTMP server like edge."); | ||
77 | - trace("srs(simple-rtmp-server) client librtmp library."); | ||
78 | - trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
79 | - trace("input: %s", in_rtmp_url); | ||
80 | - trace("output: %s", out_rtmp_url); | 75 | + srs_trace("ingest RTMP and publish to RTMP server like edge."); |
76 | + srs_trace("srs(simple-rtmp-server) client librtmp library."); | ||
77 | + srs_trace("version: %d.%d.%d", srs_version_major(), srs_version_minor(), srs_version_revision()); | ||
78 | + srs_trace("input: %s", in_rtmp_url); | ||
79 | + srs_trace("output: %s", out_rtmp_url); | ||
81 | 80 | ||
82 | irtmp = srs_rtmp_create(in_rtmp_url); | 81 | irtmp = srs_rtmp_create(in_rtmp_url); |
83 | ortmp = srs_rtmp_create(out_rtmp_url); | 82 | ortmp = srs_rtmp_create(out_rtmp_url); |
84 | 83 | ||
85 | ret = proxy(irtmp, ortmp); | 84 | ret = proxy(irtmp, ortmp); |
86 | - trace("proxy completed"); | 85 | + srs_trace("proxy completed"); |
87 | 86 | ||
88 | srs_rtmp_destroy(irtmp); | 87 | srs_rtmp_destroy(irtmp); |
89 | srs_rtmp_destroy(ortmp); | 88 | srs_rtmp_destroy(ortmp); |
@@ -107,20 +106,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) | @@ -107,20 +106,20 @@ int proxy(srs_rtmp_t irtmp, srs_rtmp_t ortmp) | ||
107 | return ret; | 106 | return ret; |
108 | } | 107 | } |
109 | 108 | ||
110 | - trace("start proxy RTMP stream"); | 109 | + srs_trace("start proxy RTMP stream"); |
111 | for (;;) { | 110 | for (;;) { |
112 | if ((ret = srs_read_packet(irtmp, &type, ×tamp, &data, &size)) != 0) { | 111 | if ((ret = srs_read_packet(irtmp, &type, ×tamp, &data, &size)) != 0) { |
113 | - trace("irtmp get packet failed. ret=%d", ret); | 112 | + srs_trace("irtmp get packet failed. ret=%d", ret); |
114 | return ret; | 113 | return ret; |
115 | } | 114 | } |
116 | - verbose("irtmp got packet: type=%s, time=%d, size=%d", | 115 | + srs_verbose("irtmp got packet: type=%s, time=%d, size=%d", |
117 | srs_type2string(type), timestamp, size); | 116 | srs_type2string(type), timestamp, size); |
118 | 117 | ||
119 | if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) { | 118 | if ((ret = srs_write_packet(ortmp, type, timestamp, data, size)) != 0) { |
120 | - trace("irtmp get packet failed. ret=%d", ret); | 119 | + srs_trace("irtmp get packet failed. ret=%d", ret); |
121 | return ret; | 120 | return ret; |
122 | } | 121 | } |
123 | - verbose("ortmp sent packet: type=%s, time=%d, size=%d", | 122 | + srs_verbose("ortmp sent packet: type=%s, time=%d, size=%d", |
124 | srs_type2string(type), timestamp, size); | 123 | srs_type2string(type), timestamp, size); |
125 | } | 124 | } |
126 | 125 | ||
@@ -132,22 +131,22 @@ int connect_ic(srs_rtmp_t irtmp) | @@ -132,22 +131,22 @@ int connect_ic(srs_rtmp_t irtmp) | ||
132 | int ret = 0; | 131 | int ret = 0; |
133 | 132 | ||
134 | if ((ret = srs_simple_handshake(irtmp)) != 0) { | 133 | if ((ret = srs_simple_handshake(irtmp)) != 0) { |
135 | - trace("irtmp simple handshake failed. ret=%d", ret); | 134 | + srs_trace("irtmp simple handshake failed. ret=%d", ret); |
136 | return ret; | 135 | return ret; |
137 | } | 136 | } |
138 | - trace("irtmp simple handshake success"); | 137 | + srs_trace("irtmp simple handshake success"); |
139 | 138 | ||
140 | if ((ret = srs_connect_app(irtmp)) != 0) { | 139 | if ((ret = srs_connect_app(irtmp)) != 0) { |
141 | - trace("irtmp connect vhost/app failed. ret=%d", ret); | 140 | + srs_trace("irtmp connect vhost/app failed. ret=%d", ret); |
142 | return ret; | 141 | return ret; |
143 | } | 142 | } |
144 | - trace("irtmp connect vhost/app success"); | 143 | + srs_trace("irtmp connect vhost/app success"); |
145 | 144 | ||
146 | if ((ret = srs_play_stream(irtmp)) != 0) { | 145 | if ((ret = srs_play_stream(irtmp)) != 0) { |
147 | - trace("irtmp play stream failed. ret=%d", ret); | 146 | + srs_trace("irtmp play stream failed. ret=%d", ret); |
148 | return ret; | 147 | return ret; |
149 | } | 148 | } |
150 | - trace("irtmp play stream success"); | 149 | + srs_trace("irtmp play stream success"); |
151 | 150 | ||
152 | return ret; | 151 | return ret; |
153 | } | 152 | } |
@@ -157,22 +156,22 @@ int connect_oc(srs_rtmp_t ortmp) | @@ -157,22 +156,22 @@ int connect_oc(srs_rtmp_t ortmp) | ||
157 | int ret = 0; | 156 | int ret = 0; |
158 | 157 | ||
159 | if ((ret = srs_simple_handshake(ortmp)) != 0) { | 158 | if ((ret = srs_simple_handshake(ortmp)) != 0) { |
160 | - trace("ortmp simple handshake failed. ret=%d", ret); | 159 | + srs_trace("ortmp simple handshake failed. ret=%d", ret); |
161 | return ret; | 160 | return ret; |
162 | } | 161 | } |
163 | - trace("ortmp simple handshake success"); | 162 | + srs_trace("ortmp simple handshake success"); |
164 | 163 | ||
165 | if ((ret = srs_connect_app(ortmp)) != 0) { | 164 | if ((ret = srs_connect_app(ortmp)) != 0) { |
166 | - trace("ortmp connect vhost/app failed. ret=%d", ret); | 165 | + srs_trace("ortmp connect vhost/app failed. ret=%d", ret); |
167 | return ret; | 166 | return ret; |
168 | } | 167 | } |
169 | - trace("ortmp connect vhost/app success"); | 168 | + srs_trace("ortmp connect vhost/app success"); |
170 | 169 | ||
171 | if ((ret = srs_publish_stream(ortmp)) != 0) { | 170 | if ((ret = srs_publish_stream(ortmp)) != 0) { |
172 | - trace("ortmp publish stream failed. ret=%d", ret); | 171 | + srs_trace("ortmp publish stream failed. ret=%d", ret); |
173 | return ret; | 172 | return ret; |
174 | } | 173 | } |
175 | - trace("ortmp publish stream success"); | 174 | + srs_trace("ortmp publish stream success"); |
176 | 175 | ||
177 | return ret; | 176 | return ret; |
178 | } | 177 | } |
1 | -/* | ||
2 | -The MIT License (MIT) | ||
3 | - | ||
4 | -Copyright (c) 2013-2014 winlin | ||
5 | - | ||
6 | -Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
7 | -this software and associated documentation files (the "Software"), to deal in | ||
8 | -the Software without restriction, including without limitation the rights to | ||
9 | -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
10 | -the Software, and to permit persons to whom the Software is furnished to do so, | ||
11 | -subject to the following conditions: | ||
12 | - | ||
13 | -The above copyright notice and this permission notice shall be included in all | ||
14 | -copies or substantial portions of the Software. | ||
15 | - | ||
16 | -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
18 | -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
19 | -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
20 | -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
21 | -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
22 | -*/ | ||
23 | - | ||
24 | -#ifndef SRS_RESEARH_PUBLIC_HPP | ||
25 | -#define SRS_RESEARH_PUBLIC_HPP | ||
26 | - | ||
27 | -/* | ||
28 | -#include "srs_research_public.h" | ||
29 | -*/ | ||
30 | - | ||
31 | -#include <string.h> | ||
32 | -#include <time.h> | ||
33 | - | ||
34 | -char* format_time() | ||
35 | -{ | ||
36 | - struct timeval tv; | ||
37 | - static char buf[23]; | ||
38 | - | ||
39 | - memset(buf, 0, sizeof(buf)); | ||
40 | - | ||
41 | - // clock time | ||
42 | - if (gettimeofday(&tv, NULL) == -1) { | ||
43 | - return buf; | ||
44 | - } | ||
45 | - | ||
46 | - // to calendar time | ||
47 | - struct tm* tm; | ||
48 | - if ((tm = localtime(&tv.tv_sec)) == NULL) { | ||
49 | - return buf; | ||
50 | - } | ||
51 | - | ||
52 | - snprintf(buf, sizeof(buf), | ||
53 | - "%d-%02d-%02d %02d:%02d:%02d.%03d", | ||
54 | - 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, | ||
55 | - tm->tm_hour, tm->tm_min, tm->tm_sec, | ||
56 | - (int)(tv.tv_usec / 1000)); | ||
57 | - | ||
58 | - return buf; | ||
59 | -} | ||
60 | -#define trace(msg, ...) printf("[%s]", format_time());printf(msg, ##__VA_ARGS__);printf("\n") | ||
61 | -#define verbose(msg, ...) printf("[%s]", format_time());printf(msg, ##__VA_ARGS__);printf("\n") | ||
62 | -#if 1 | ||
63 | -#undef verbose | ||
64 | -#define verbose(msg, ...) (void)0 | ||
65 | -#endif | ||
66 | - | ||
67 | -#endif |
@@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
24 | #include <srs_librtmp.hpp> | 24 | #include <srs_librtmp.hpp> |
25 | 25 | ||
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | +#include <sys/time.h> | ||
27 | 28 | ||
28 | #include <string> | 29 | #include <string> |
29 | #include <sstream> | 30 | #include <sstream> |
@@ -32,7 +33,6 @@ using namespace std; | @@ -32,7 +33,6 @@ using namespace std; | ||
32 | #include <srs_kernel_error.hpp> | 33 | #include <srs_kernel_error.hpp> |
33 | #include <srs_protocol_rtmp.hpp> | 34 | #include <srs_protocol_rtmp.hpp> |
34 | #include <srs_lib_simple_socket.hpp> | 35 | #include <srs_lib_simple_socket.hpp> |
35 | -#include <srs_kernel_log.hpp> | ||
36 | #include <srs_protocol_utility.hpp> | 36 | #include <srs_protocol_utility.hpp> |
37 | #include <srs_core_autofree.hpp> | 37 | #include <srs_core_autofree.hpp> |
38 | #include <srs_protocol_stack.hpp> | 38 | #include <srs_protocol_stack.hpp> |
@@ -531,6 +531,33 @@ int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp) | @@ -531,6 +531,33 @@ int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp) | ||
531 | return context->rtmp->get_recv_bytes(); | 531 | return context->rtmp->get_recv_bytes(); |
532 | } | 532 | } |
533 | 533 | ||
534 | +const char* srs_format_time() | ||
535 | +{ | ||
536 | + struct timeval tv; | ||
537 | + static char buf[23]; | ||
538 | + | ||
539 | + memset(buf, 0, sizeof(buf)); | ||
540 | + | ||
541 | + // clock time | ||
542 | + if (gettimeofday(&tv, NULL) == -1) { | ||
543 | + return buf; | ||
544 | + } | ||
545 | + | ||
546 | + // to calendar time | ||
547 | + struct tm* tm; | ||
548 | + if ((tm = localtime(&tv.tv_sec)) == NULL) { | ||
549 | + return buf; | ||
550 | + } | ||
551 | + | ||
552 | + snprintf(buf, sizeof(buf), | ||
553 | + "%d-%02d-%02d %02d:%02d:%02d.%03d", | ||
554 | + 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, | ||
555 | + tm->tm_hour, tm->tm_min, tm->tm_sec, | ||
556 | + (int)(tv.tv_usec / 1000)); | ||
557 | + | ||
558 | + return buf; | ||
559 | +} | ||
560 | + | ||
534 | struct FlvContext | 561 | struct FlvContext |
535 | { | 562 | { |
536 | SrsFileReader reader; | 563 | SrsFileReader reader; |
@@ -209,6 +209,8 @@ extern const char* srs_type2string(int type); | @@ -209,6 +209,8 @@ extern const char* srs_type2string(int type); | ||
209 | * | 209 | * |
210 | * @remark: for read, user must free the data. | 210 | * @remark: for read, user must free the data. |
211 | * @remark: for write, user should never free the data, even if error. | 211 | * @remark: for write, user should never free the data, even if error. |
212 | +* @example /trunk/research/librtmp/srs_play.c | ||
213 | +* @example /trunk/research/librtmp/srs_publish.c | ||
212 | * | 214 | * |
213 | * @return 0, success; otherswise, failed. | 215 | * @return 0, success; otherswise, failed. |
214 | */ | 216 | */ |
@@ -232,11 +234,22 @@ extern int srs_version_revision(); | @@ -232,11 +234,22 @@ extern int srs_version_revision(); | ||
232 | extern int64_t srs_get_time_ms(); | 234 | extern int64_t srs_get_time_ms(); |
233 | extern int64_t srs_get_nsend_bytes(srs_rtmp_t rtmp); | 235 | extern int64_t srs_get_nsend_bytes(srs_rtmp_t rtmp); |
234 | extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp); | 236 | extern int64_t srs_get_nrecv_bytes(srs_rtmp_t rtmp); |
235 | - | 237 | +// log to console. |
238 | +extern const char* srs_format_time(); | ||
239 | +#ifndef srs_trace | ||
240 | + #define srs_trace(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") | ||
241 | +#endif | ||
242 | +#ifndef srs_verbose | ||
243 | + #define srs_verbose(msg, ...) printf("[%s]", srs_format_time());printf(msg, ##__VA_ARGS__);printf("\n") | ||
244 | +#endif | ||
236 | 245 | ||
237 | /************************************************************* | 246 | /************************************************************* |
238 | ************************************************************** | 247 | ************************************************************** |
239 | * flv codec | 248 | * flv codec |
249 | +* @example /trunk/research/librtmp/srs_flv_injecter.c | ||
250 | +* @example /trunk/research/librtmp/srs_flv_parser.c | ||
251 | +* @example /trunk/research/librtmp/srs_ingest_flv.c | ||
252 | +* @example /trunk/research/librtmp/srs_ingest_rtmp.c | ||
240 | ************************************************************** | 253 | ************************************************************** |
241 | *************************************************************/ | 254 | *************************************************************/ |
242 | typedef void* srs_flv_t; | 255 | typedef void* srs_flv_t; |
@@ -276,6 +289,8 @@ extern flv_bool srs_flv_is_keyframe(char* data, int32_t size); | @@ -276,6 +289,8 @@ extern flv_bool srs_flv_is_keyframe(char* data, int32_t size); | ||
276 | /************************************************************* | 289 | /************************************************************* |
277 | ************************************************************** | 290 | ************************************************************** |
278 | * amf0 codec | 291 | * amf0 codec |
292 | +* @example /trunk/research/librtmp/srs_ingest_flv.c | ||
293 | +* @example /trunk/research/librtmp/srs_ingest_rtmp.c | ||
279 | ************************************************************** | 294 | ************************************************************** |
280 | *************************************************************/ | 295 | *************************************************************/ |
281 | /* the output handler. */ | 296 | /* the output handler. */ |
@@ -351,6 +366,8 @@ extern char* srs_amf0_human_print(srs_amf0_t amf0, char** pdata, int* psize); | @@ -351,6 +366,8 @@ extern char* srs_amf0_human_print(srs_amf0_t amf0, char** pdata, int* psize); | ||
351 | * @remark, user should free the frames. | 366 | * @remark, user should free the frames. |
352 | * @remark, the tbn of dts/pts is 1/1000 for RTMP, that is, in ms. | 367 | * @remark, the tbn of dts/pts is 1/1000 for RTMP, that is, in ms. |
353 | * @remark, cts = pts - dts | 368 | * @remark, cts = pts - dts |
369 | +* @remark, use srs_h264_startswith_annexb to check whether frame is annexb format. | ||
370 | +* @example /trunk/research/librtmp/srs_h264_raw_publish.c | ||
354 | * | 371 | * |
355 | * @return 0, success; otherswise, failed. | 372 | * @return 0, success; otherswise, failed. |
356 | */ | 373 | */ |
@@ -394,6 +411,9 @@ extern int srs_write_h264_raw_frames(srs_rtmp_t rtmp, | @@ -394,6 +411,9 @@ extern int srs_write_h264_raw_frames(srs_rtmp_t rtmp, | ||
394 | * @param pnb_start_code output the size of start code, must >=3. | 411 | * @param pnb_start_code output the size of start code, must >=3. |
395 | * NULL to ignore. | 412 | * NULL to ignore. |
396 | * | 413 | * |
414 | +* @reamrk used to check whether current frame is in annexb format. | ||
415 | +* @example /trunk/research/librtmp/srs_h264_raw_publish.c | ||
416 | +* | ||
397 | * @return 0 false; otherwise, true. | 417 | * @return 0 false; otherwise, true. |
398 | */ | 418 | */ |
399 | extern int srs_h264_startswith_annexb( | 419 | extern int srs_h264_startswith_annexb( |
@@ -137,7 +137,6 @@ file | @@ -137,7 +137,6 @@ file | ||
137 | ..\..\research\librtmp\srs_ingest_rtmp.c, | 137 | ..\..\research\librtmp\srs_ingest_rtmp.c, |
138 | ..\..\research\librtmp\srs_play.c, | 138 | ..\..\research\librtmp\srs_play.c, |
139 | ..\..\research\librtmp\srs_publish.c, | 139 | ..\..\research\librtmp\srs_publish.c, |
140 | - ..\..\research\librtmp\srs_research_public.h, | ||
141 | ..\..\research\hls\ts_info.cc; | 140 | ..\..\research\hls\ts_info.cc; |
142 | 141 | ||
143 | mainconfig | 142 | mainconfig |
-
请 注册 或 登录 后发表评论