Skip to content

Commit

Permalink
for #738, add mp4 demuxer to librtmp
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 30, 2017
1 parent 3f3e98e commit 011ac4f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
25 changes: 25 additions & 0 deletions trunk/src/libs/srs_librtmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,31 @@ srs_bool srs_h264_startswith_annexb(char* h264_raw_data, int h264_raw_size, int*

return srs_avc_startswith_annexb(&stream, pnb_start_code);
}

struct Mp4Context
{
SrsFileReader reader;
};

srs_mp4_t srs_mp4_open_read(const char* file)
{
int ret = ERROR_SUCCESS;

Mp4Context* mp4 = new Mp4Context();

if ((ret = mp4->reader.open(file)) != ERROR_SUCCESS) {
srs_freep(mp4);
return NULL;
}

return mp4;
}

void srs_mp4_close(srs_mp4_t mp4)
{
Mp4Context* context = (Mp4Context*)mp4;
srs_freep(context);
}

struct FlvContext
{
Expand Down
11 changes: 11 additions & 0 deletions trunk/src/libs/srs_librtmp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,17 @@ extern srs_bool srs_h264_startswith_annexb(
char* h264_raw_data, int h264_raw_size,
int* pnb_start_code
);

/*************************************************************
*************************************************************
* MP4 muxer and demuxer.
* @example /trunk/research/librtmp/srs_ingest_mp4.c
*************************************************************
*************************************************************/
typedef void* srs_mp4_t;
/* Open mp4 file for muxer(write) or demuxer(read). */
extern srs_mp4_t srs_mp4_open_read(const char* file);
extern void srs_mp4_close(srs_mp4_t mp4);

/*************************************************************
**************************************************************
Expand Down

0 comments on commit 011ac4f

Please sign in to comment.