正在显示
2 个修改的文件
包含
36 行增加
和
0 行删除
| @@ -1544,6 +1544,31 @@ srs_bool srs_h264_startswith_annexb(char* h264_raw_data, int h264_raw_size, int* | @@ -1544,6 +1544,31 @@ srs_bool srs_h264_startswith_annexb(char* h264_raw_data, int h264_raw_size, int* | ||
| 1544 | 1544 | ||
| 1545 | return srs_avc_startswith_annexb(&stream, pnb_start_code); | 1545 | return srs_avc_startswith_annexb(&stream, pnb_start_code); |
| 1546 | } | 1546 | } |
| 1547 | + | ||
| 1548 | +struct Mp4Context | ||
| 1549 | +{ | ||
| 1550 | + SrsFileReader reader; | ||
| 1551 | +}; | ||
| 1552 | + | ||
| 1553 | +srs_mp4_t srs_mp4_open_read(const char* file) | ||
| 1554 | +{ | ||
| 1555 | + int ret = ERROR_SUCCESS; | ||
| 1556 | + | ||
| 1557 | + Mp4Context* mp4 = new Mp4Context(); | ||
| 1558 | + | ||
| 1559 | + if ((ret = mp4->reader.open(file)) != ERROR_SUCCESS) { | ||
| 1560 | + srs_freep(mp4); | ||
| 1561 | + return NULL; | ||
| 1562 | + } | ||
| 1563 | + | ||
| 1564 | + return mp4; | ||
| 1565 | +} | ||
| 1566 | + | ||
| 1567 | +void srs_mp4_close(srs_mp4_t mp4) | ||
| 1568 | +{ | ||
| 1569 | + Mp4Context* context = (Mp4Context*)mp4; | ||
| 1570 | + srs_freep(context); | ||
| 1571 | +} | ||
| 1547 | 1572 | ||
| 1548 | struct FlvContext | 1573 | struct FlvContext |
| 1549 | { | 1574 | { |
| @@ -501,6 +501,17 @@ extern srs_bool srs_h264_startswith_annexb( | @@ -501,6 +501,17 @@ extern srs_bool srs_h264_startswith_annexb( | ||
| 501 | char* h264_raw_data, int h264_raw_size, | 501 | char* h264_raw_data, int h264_raw_size, |
| 502 | int* pnb_start_code | 502 | int* pnb_start_code |
| 503 | ); | 503 | ); |
| 504 | + | ||
| 505 | +/************************************************************* | ||
| 506 | + ************************************************************* | ||
| 507 | + * MP4 muxer and demuxer. | ||
| 508 | + * @example /trunk/research/librtmp/srs_ingest_mp4.c | ||
| 509 | + ************************************************************* | ||
| 510 | + *************************************************************/ | ||
| 511 | +typedef void* srs_mp4_t; | ||
| 512 | +/* Open mp4 file for muxer(write) or demuxer(read). */ | ||
| 513 | +extern srs_mp4_t srs_mp4_open_read(const char* file); | ||
| 514 | +extern void srs_mp4_close(srs_mp4_t mp4); | ||
| 504 | 515 | ||
| 505 | /************************************************************* | 516 | /************************************************************* |
| 506 | ************************************************************** | 517 | ************************************************************** |
-
请 注册 或 登录 后发表评论