|
|
|
@ -4,6 +4,7 @@ |
|
|
|
#include <unistd.h> |
|
|
|
#include <limits.h> |
|
|
|
#include <fcntl.h> |
|
|
|
#include <libavformat/avformat.h> |
|
|
|
#include "metafile.h" |
|
|
|
#include "epoll.h" |
|
|
|
#include "log.h" |
|
|
|
@ -88,6 +89,15 @@ void stream_open(metafile_t *mf, unsigned long id, char *name) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
stream->avinf = av_find_input_format("rtp"); |
|
|
|
ilog(LOG_DEBUG, "avinf %p", stream->avinf); |
|
|
|
|
|
|
|
stream->avfctx = avformat_alloc_context(); |
|
|
|
unsigned char *buf = av_malloc(1024); // ? |
|
|
|
stream->avfctx->pb = avio_alloc_context(buf, 1024, 1, NULL, NULL, NULL, NULL); |
|
|
|
int ret = avformat_open_input(&stream->avfctx, "", stream->avinf, NULL); |
|
|
|
ilog(LOG_DEBUG, "ret %i avfctx %p", ret, stream->avfctx); |
|
|
|
|
|
|
|
// add to epoll |
|
|
|
stream->handler.ptr = stream; |
|
|
|
stream->handler.func = stream_handler; |
|
|
|
|