正在显示
6 个修改的文件
包含
200 行增加
和
112 行删除
| @@ -5,11 +5,12 @@ GCC = gcc | @@ -5,11 +5,12 @@ GCC = gcc | ||
| 5 | default: help | 5 | default: help |
| 6 | 6 | ||
| 7 | help: | 7 | help: |
| 8 | - @echo "Usage: make <help>|<clean>|<srs_publish_nossl>|<srs_play_nossl>|<srs_ingest_flv_nossl>|<srs_ingest_rtmp_nossl>|<srs_publish_ssl>|<srs_play_ssl>|<srs_ingest_flv_ssl>|<srs_ingest_rtmp_ssl>" | 8 | + @echo "Usage: make <help>|<clean>|<srs_flv_parser>|<srs_publish_nossl>|<srs_play_nossl>|<srs_ingest_flv_nossl>|<srs_ingest_rtmp_nossl>|<srs_publish_ssl>|<srs_play_ssl>|<srs_ingest_flv_ssl>|<srs_ingest_rtmp_ssl>" |
| 9 | @echo " help display this help" | 9 | @echo " help display this help" |
| 10 | @echo " clean cleanup build" | 10 | @echo " clean cleanup build" |
| 11 | - @echo " ssl srs_publish_ssl, srs_play_ssl, srs_ingest_flv, srs_ingest_rtmp" | ||
| 12 | - @echo " nossl srs_publish_nossl, srs_play_nossl, srs_ingest_flv, srs_ingest_rtmp" | 11 | + @echo " ssl srs_flv_parser, srs_publish_ssl, srs_play_ssl, srs_ingest_flv, srs_ingest_rtmp" |
| 12 | + @echo " nossl srs_flv_parser, srs_publish_nossl, srs_play_nossl, srs_ingest_flv, srs_ingest_rtmp" | ||
| 13 | + @echo " srs_flv_parser parse flv file, print detail info." | ||
| 13 | @echo " srs_publish_nossl publish program using srs-librtmp, without ssl(simple handshake)" | 14 | @echo " srs_publish_nossl publish program using srs-librtmp, without ssl(simple handshake)" |
| 14 | @echo " srs_play_nossl play program using srs-librtmp, without ssl(simple handshake)" | 15 | @echo " srs_play_nossl play program using srs-librtmp, without ssl(simple handshake)" |
| 15 | @echo " srs_publish_ssl publish program using srs-librtmp, with ssl(complex handshake)" | 16 | @echo " srs_publish_ssl publish program using srs-librtmp, with ssl(complex handshake)" |
| @@ -26,7 +27,7 @@ help: | @@ -26,7 +27,7 @@ help: | ||
| 26 | @echo "Remark: before make this sample, user must make the srs, with/without ssl" | 27 | @echo "Remark: before make this sample, user must make the srs, with/without ssl" |
| 27 | 28 | ||
| 28 | clean: | 29 | clean: |
| 29 | - @rm -f srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl srs_ingest_flv_nossl srs_ingest_rtmp_nossl | 30 | + @rm -f srs_flv_parser srs_publish_nossl srs_play_nossl srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl srs_ingest_flv_nossl srs_ingest_rtmp_nossl |
| 30 | 31 | ||
| 31 | # srs library root | 32 | # srs library root |
| 32 | SRS_OBJS = ../../objs | 33 | SRS_OBJS = ../../objs |
| @@ -51,6 +52,9 @@ ifeq ($(GCC), mipsel-openwrt-linux-gcc) | @@ -51,6 +52,9 @@ ifeq ($(GCC), mipsel-openwrt-linux-gcc) | ||
| 51 | EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++ -lgcc_eh | 52 | EXTRA_CXX_FLAG = -g -O0 -ldl -lstdc++ -lgcc_eh |
| 52 | endif | 53 | endif |
| 53 | 54 | ||
| 55 | +srs_flv_parser_nossl: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) | ||
| 56 | + $(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_flv_parser_nossl | ||
| 57 | + | ||
| 54 | srs_publish_nossl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) | 58 | srs_publish_nossl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) |
| 55 | $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_publish_nossl | 59 | $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_publish_nossl |
| 56 | 60 | ||
| @@ -63,6 +67,9 @@ srs_ingest_flv_nossl: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(S | @@ -63,6 +67,9 @@ srs_ingest_flv_nossl: srs_ingest_flv.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(S | ||
| 63 | srs_ingest_rtmp_nossl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) | 67 | srs_ingest_rtmp_nossl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) |
| 64 | $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_nossl | 68 | $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_nossl |
| 65 | 69 | ||
| 70 | +srs_flv_parser_ssl: srs_flv_parser.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) | ||
| 71 | + $(GCC) srs_flv_parser.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_flv_parser_ssl | ||
| 72 | + | ||
| 66 | srs_publish_ssl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) | 73 | srs_publish_ssl: srs_publish.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) |
| 67 | $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_publish_ssl | 74 | $(GCC) srs_publish.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_publish_ssl |
| 68 | 75 | ||
| @@ -76,5 +83,5 @@ srs_ingest_rtmp_ssl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(S | @@ -76,5 +83,5 @@ srs_ingest_rtmp_ssl: srs_ingest_rtmp.c $(SRS_RESEARCH_DEPS) $(SRS_LIBRTMP_I) $(S | ||
| 76 | $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_ssl | 83 | $(GCC) srs_ingest_rtmp.c $(SRS_LIBRTMP_L) $(SRS_LIBSSL_L) $(EXTRA_CXX_FLAG) -o srs_ingest_rtmp_ssl |
| 77 | 84 | ||
| 78 | # alias for publish/play with/without ssl | 85 | # alias for publish/play with/without ssl |
| 79 | -ssl: srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl | ||
| 80 | -nossl: srs_publish_nossl srs_play_nossl srs_ingest_flv_nossl srs_ingest_rtmp_nossl | 86 | +ssl: srs_flv_parser_ssl srs_publish_ssl srs_play_ssl srs_ingest_flv_ssl srs_ingest_rtmp_ssl |
| 87 | +nossl: srs_flv_parser_nossl srs_publish_nossl srs_play_nossl srs_ingest_flv_nossl srs_ingest_rtmp_nossl |
trunk/research/librtmp/srs_flv_codec.h
0 → 100644
| 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_FLV_CODEC_HPP | ||
| 25 | +#define SRS_RESEARH_FLV_CODEC_HPP | ||
| 26 | + | ||
| 27 | +/* | ||
| 28 | +#include "srs_flv_codec.h" | ||
| 29 | +*/ | ||
| 30 | + | ||
| 31 | +#include <unistd.h> | ||
| 32 | +#include <fcntl.h> | ||
| 33 | +#include <sys/stat.h> | ||
| 34 | +#include <sys/types.h> | ||
| 35 | + | ||
| 36 | +#define ERROR_FLV_CODEC_EOF 100 | ||
| 37 | + | ||
| 38 | +int open_flv_file(char* in_flv_file) | ||
| 39 | +{ | ||
| 40 | + return open(in_flv_file, O_RDONLY); | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +void close_flv_file(int fd) | ||
| 44 | +{ | ||
| 45 | + if (fd > 0) { | ||
| 46 | + close(fd); | ||
| 47 | + } | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +int flv_open_ic(int flv_fd) | ||
| 51 | +{ | ||
| 52 | + int ret = 0; | ||
| 53 | + | ||
| 54 | + char h[13]; // 9+4 | ||
| 55 | + | ||
| 56 | + if (read(flv_fd, h, sizeof(h)) != sizeof(h)) { | ||
| 57 | + ret = -1; | ||
| 58 | + trace("read flv header failed. ret=%d", ret); | ||
| 59 | + return ret; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + if (h[0] != 'F' || h[1] != 'L' || h[2] != 'V') { | ||
| 63 | + ret = -1; | ||
| 64 | + trace("input is not a flv file. ret=%d", ret); | ||
| 65 | + return ret; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + return ret; | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, int* size) | ||
| 72 | +{ | ||
| 73 | + int ret = 0; | ||
| 74 | + | ||
| 75 | + char th[11]; // tag header | ||
| 76 | + char ts[4]; // tag size | ||
| 77 | + | ||
| 78 | + int32_t data_size = 0; | ||
| 79 | + u_int32_t time = 0; | ||
| 80 | + | ||
| 81 | + char* pp; | ||
| 82 | + | ||
| 83 | + // read tag header | ||
| 84 | + if ((ret = read(flv_fd, th, sizeof(th))) != sizeof(th)) { | ||
| 85 | + if (ret == 0) { | ||
| 86 | + return ERROR_FLV_CODEC_EOF; | ||
| 87 | + } | ||
| 88 | + ret = -1; | ||
| 89 | + trace("read flv tag header failed. ret=%d", ret); | ||
| 90 | + return ret; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + // Reserved UB [2] | ||
| 94 | + // Filter UB [1] | ||
| 95 | + // TagType UB [5] | ||
| 96 | + *type = (int)(th[0] & 0x1F); | ||
| 97 | + | ||
| 98 | + // DataSize UI24 | ||
| 99 | + pp = (char*)&data_size; | ||
| 100 | + pp[2] = th[1]; | ||
| 101 | + pp[1] = th[2]; | ||
| 102 | + pp[0] = th[3]; | ||
| 103 | + | ||
| 104 | + // Timestamp UI24 | ||
| 105 | + pp = (char*)&time; | ||
| 106 | + pp[2] = th[4]; | ||
| 107 | + pp[1] = th[5]; | ||
| 108 | + pp[0] = th[6]; | ||
| 109 | + | ||
| 110 | + // TimestampExtended UI8 | ||
| 111 | + pp[3] = th[7]; | ||
| 112 | + | ||
| 113 | + *timestamp = time; | ||
| 114 | + | ||
| 115 | + // check data size. | ||
| 116 | + if (data_size <= 0) { | ||
| 117 | + ret = -1; | ||
| 118 | + trace("invalid data size. size=%d, ret=%d", data_size, ret); | ||
| 119 | + return ret; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // read tag data. | ||
| 123 | + *size = data_size; | ||
| 124 | + *data = (char*)malloc(data_size); | ||
| 125 | + if ((ret = read(flv_fd, *data, data_size)) != data_size) { | ||
| 126 | + if (ret == 0) { | ||
| 127 | + return ERROR_FLV_CODEC_EOF; | ||
| 128 | + } | ||
| 129 | + ret = -1; | ||
| 130 | + trace("read flv tag data failed. size=%d, ret=%d", data_size, ret); | ||
| 131 | + return ret; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + // ignore 4bytes tag size. | ||
| 135 | + if ((ret = read(flv_fd, ts, sizeof(ts))) != sizeof(ts)) { | ||
| 136 | + if (ret == 0) { | ||
| 137 | + return ERROR_FLV_CODEC_EOF; | ||
| 138 | + } | ||
| 139 | + ret = -1; | ||
| 140 | + trace("read flv tag size failed. ret=%d", ret); | ||
| 141 | + return ret; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + return 0; | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +#endif |
| @@ -34,15 +34,11 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | @@ -34,15 +34,11 @@ gcc srs_ingest_flv.c ../../objs/lib/srs_librtmp.a -g -O0 -lstdc++ -o srs_ingest_ | ||
| 34 | 34 | ||
| 35 | #include "../../objs/include/srs_librtmp.h" | 35 | #include "../../objs/include/srs_librtmp.h" |
| 36 | #include "srs_research_public.h" | 36 | #include "srs_research_public.h" |
| 37 | +#include "srs_flv_codec.h" | ||
| 37 | 38 | ||
| 38 | int proxy(int flv_fd, srs_rtmp_t ortmp); | 39 | int proxy(int flv_fd, srs_rtmp_t ortmp); |
| 39 | int connect_oc(srs_rtmp_t ortmp); | 40 | int connect_oc(srs_rtmp_t ortmp); |
| 40 | 41 | ||
| 41 | -int open_flv_file(char* in_flv_file); | ||
| 42 | -void close_flv_file(int flv_fd); | ||
| 43 | -int flv_open_ic(int flv_fd); | ||
| 44 | -int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, int* size); | ||
| 45 | - | ||
| 46 | #define RE_PULSE_MS 300 | 42 | #define RE_PULSE_MS 300 |
| 47 | int64_t re_create(); | 43 | int64_t re_create(); |
| 48 | void re_update(int64_t re, u_int32_t time); | 44 | void re_update(int64_t re, u_int32_t time); |
| @@ -234,103 +230,3 @@ void re_cleanup(int64_t re, u_int32_t time) | @@ -234,103 +230,3 @@ void re_cleanup(int64_t re, u_int32_t time) | ||
| 234 | usleep(diff * 1000); | 230 | usleep(diff * 1000); |
| 235 | } | 231 | } |
| 236 | } | 232 | } |
| 237 | - | ||
| 238 | -int open_flv_file(char* in_flv_file) | ||
| 239 | -{ | ||
| 240 | - return open(in_flv_file, O_RDONLY); | ||
| 241 | -} | ||
| 242 | - | ||
| 243 | -void close_flv_file(int fd) | ||
| 244 | -{ | ||
| 245 | - if (fd > 0) { | ||
| 246 | - close(fd); | ||
| 247 | - } | ||
| 248 | -} | ||
| 249 | - | ||
| 250 | -int flv_open_ic(int flv_fd) | ||
| 251 | -{ | ||
| 252 | - int ret = 0; | ||
| 253 | - | ||
| 254 | - char h[13]; // 9+4 | ||
| 255 | - | ||
| 256 | - if (read(flv_fd, h, sizeof(h)) != sizeof(h)) { | ||
| 257 | - ret = -1; | ||
| 258 | - trace("read flv header failed. ret=%d", ret); | ||
| 259 | - return ret; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - if (h[0] != 'F' || h[1] != 'L' || h[2] != 'V') { | ||
| 263 | - ret = -1; | ||
| 264 | - trace("input is not a flv file. ret=%d", ret); | ||
| 265 | - return ret; | ||
| 266 | - } | ||
| 267 | - | ||
| 268 | - return ret; | ||
| 269 | -} | ||
| 270 | - | ||
| 271 | -int flv_read_packet(int flv_fd, int* type, u_int32_t* timestamp, char** data, int* size) | ||
| 272 | -{ | ||
| 273 | - int ret = 0; | ||
| 274 | - | ||
| 275 | - char th[11]; // tag header | ||
| 276 | - char ts[4]; // tag size | ||
| 277 | - | ||
| 278 | - int32_t data_size = 0; | ||
| 279 | - u_int32_t time = 0; | ||
| 280 | - | ||
| 281 | - char* pp; | ||
| 282 | - | ||
| 283 | - // read tag header | ||
| 284 | - if (read(flv_fd, th, sizeof(th)) != sizeof(th)) { | ||
| 285 | - ret = -1; | ||
| 286 | - trace("read flv tag header failed. ret=%d", ret); | ||
| 287 | - return ret; | ||
| 288 | - } | ||
| 289 | - | ||
| 290 | - // Reserved UB [2] | ||
| 291 | - // Filter UB [1] | ||
| 292 | - // TagType UB [5] | ||
| 293 | - *type = (int)(th[0] & 0x1F); | ||
| 294 | - | ||
| 295 | - // DataSize UI24 | ||
| 296 | - pp = (char*)&data_size; | ||
| 297 | - pp[2] = th[1]; | ||
| 298 | - pp[1] = th[2]; | ||
| 299 | - pp[0] = th[3]; | ||
| 300 | - | ||
| 301 | - // Timestamp UI24 | ||
| 302 | - pp = (char*)&time; | ||
| 303 | - pp[2] = th[4]; | ||
| 304 | - pp[1] = th[5]; | ||
| 305 | - pp[0] = th[6]; | ||
| 306 | - | ||
| 307 | - // TimestampExtended UI8 | ||
| 308 | - pp[3] = th[7]; | ||
| 309 | - | ||
| 310 | - *timestamp = time; | ||
| 311 | - | ||
| 312 | - // check data size. | ||
| 313 | - if (data_size <= 0) { | ||
| 314 | - ret = -1; | ||
| 315 | - trace("invalid data size. size=%d, ret=%d", data_size, ret); | ||
| 316 | - return ret; | ||
| 317 | - } | ||
| 318 | - | ||
| 319 | - // read tag data. | ||
| 320 | - *size = data_size; | ||
| 321 | - *data = (char*)malloc(data_size); | ||
| 322 | - if (read(flv_fd, *data, data_size) != data_size) { | ||
| 323 | - ret = -1; | ||
| 324 | - trace("read flv tag data failed. size=%d, ret=%d", data_size, ret); | ||
| 325 | - return ret; | ||
| 326 | - } | ||
| 327 | - | ||
| 328 | - // ignore 4bytes tag size. | ||
| 329 | - if (read(flv_fd, ts, sizeof(ts)) != sizeof(ts)) { | ||
| 330 | - ret = -1; | ||
| 331 | - trace("read flv tag size failed. ret=%d", ret); | ||
| 332 | - return ret; | ||
| 333 | - } | ||
| 334 | - | ||
| 335 | - return ret; | ||
| 336 | -} |
| @@ -36,6 +36,8 @@ using namespace std; | @@ -36,6 +36,8 @@ using namespace std; | ||
| 36 | #include <srs_core_autofree.hpp> | 36 | #include <srs_core_autofree.hpp> |
| 37 | #include <srs_protocol_rtmp_stack.hpp> | 37 | #include <srs_protocol_rtmp_stack.hpp> |
| 38 | #include <srs_kernel_utility.hpp> | 38 | #include <srs_kernel_utility.hpp> |
| 39 | +#include <srs_kernel_stream.hpp> | ||
| 40 | +#include <srs_protocol_amf0.hpp> | ||
| 39 | 41 | ||
| 40 | // if user want to define log, define the folowing macro. | 42 | // if user want to define log, define the folowing macro. |
| 41 | #ifndef SRS_RTMP_USER_DEFINED_LOG | 43 | #ifndef SRS_RTMP_USER_DEFINED_LOG |
| @@ -406,6 +408,33 @@ int64_t srs_get_time_ms() | @@ -406,6 +408,33 @@ int64_t srs_get_time_ms() | ||
| 406 | return srs_get_system_time_ms(); | 408 | return srs_get_system_time_ms(); |
| 407 | } | 409 | } |
| 408 | 410 | ||
| 411 | +srs_amf0_t srs_amf0_parse(char* data, int size) | ||
| 412 | +{ | ||
| 413 | + int ret = ERROR_SUCCESS; | ||
| 414 | + | ||
| 415 | + srs_amf0_t amf0 = NULL; | ||
| 416 | + | ||
| 417 | + SrsStream stream; | ||
| 418 | + if ((ret = stream.initialize(data, size)) != ERROR_SUCCESS) { | ||
| 419 | + return amf0; | ||
| 420 | + } | ||
| 421 | + | ||
| 422 | + SrsAmf0Any* any = NULL; | ||
| 423 | + if ((ret = SrsAmf0Any::discovery(&stream, &any)) != ERROR_SUCCESS) { | ||
| 424 | + return amf0; | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + stream.reset(); | ||
| 428 | + if ((ret = any->read(&stream)) != ERROR_SUCCESS) { | ||
| 429 | + srs_freep(any); | ||
| 430 | + return amf0; | ||
| 431 | + } | ||
| 432 | + | ||
| 433 | + amf0 = (srs_amf0_t)any; | ||
| 434 | + | ||
| 435 | + return amf0; | ||
| 436 | +} | ||
| 437 | + | ||
| 409 | #ifdef __cplusplus | 438 | #ifdef __cplusplus |
| 410 | } | 439 | } |
| 411 | #endif | 440 | #endif |
| @@ -157,7 +157,14 @@ int srs_version_revision(); | @@ -157,7 +157,14 @@ int srs_version_revision(); | ||
| 157 | /** | 157 | /** |
| 158 | * utilities | 158 | * utilities |
| 159 | */ | 159 | */ |
| 160 | -extern int64_t srs_get_time_ms(); | 160 | +int64_t srs_get_time_ms(); |
| 161 | + | ||
| 162 | +/** | ||
| 163 | +* amf0 codec | ||
| 164 | +*/ | ||
| 165 | +// the output handler. | ||
| 166 | +typedef void* srs_amf0_t; | ||
| 167 | +srs_amf0_t srs_amf0_parse(char* data, int size); | ||
| 161 | 168 | ||
| 162 | #ifdef __cplusplus | 169 | #ifdef __cplusplus |
| 163 | } | 170 | } |
| @@ -109,6 +109,8 @@ file | @@ -109,6 +109,8 @@ file | ||
| 109 | ..\utest\srs_utest_handshake.hpp, | 109 | ..\utest\srs_utest_handshake.hpp, |
| 110 | ..\utest\srs_utest_handshake.cpp, | 110 | ..\utest\srs_utest_handshake.cpp, |
| 111 | research readonly separator, | 111 | research readonly separator, |
| 112 | + ..\..\research\librtmp\srs_flv_codec.h, | ||
| 113 | + ..\..\research\librtmp\srs_flv_parser.c, | ||
| 112 | ..\..\research\librtmp\srs_ingest_flv.c, | 114 | ..\..\research\librtmp\srs_ingest_flv.c, |
| 113 | ..\..\research\librtmp\srs_ingest_rtmp.c, | 115 | ..\..\research\librtmp\srs_ingest_rtmp.c, |
| 114 | ..\..\research\librtmp\srs_play.c, | 116 | ..\..\research\librtmp\srs_play.c, |
-
请 注册 或 登录 后发表评论