提交 59d3eb08 authored 作者: blu's avatar blu

init

上级 c8fda97d
...@@ -24,8 +24,8 @@ using namespace std; ...@@ -24,8 +24,8 @@ using namespace std;
class EvSlicer: public TinyThread { class EvSlicer: public TinyThread {
private: private:
#define URLOUT_DEFAULT "slices" #define URLOUT_DEFAULT "slices"
#define NUM_DAYS_DEFAULT 2 #define NUM_DAYS_DEFAULT 5
#define MINUTES_PER_SLICE_DEFAULT 1 #define MINUTES_PER_SLICE_DEFAULT 2
// 2 days, 10 minutes per record // 2 days, 10 minutes per record
#define NUM_SLICES_DEFAULT (24 * NUM_DAYS_DEFAULT * 60 / MINUTES_PER_SLICE_DEFAULT) #define NUM_SLICES_DEFAULT (24 * NUM_DAYS_DEFAULT * 60 / MINUTES_PER_SLICE_DEFAULT)
void *pSubCtx = NULL, *pReqCtx = NULL; // for packets relay void *pSubCtx = NULL, *pReqCtx = NULL; // for packets relay
...@@ -211,14 +211,6 @@ private: ...@@ -211,14 +211,6 @@ private:
} }
} }
// ret = avformat_alloc_output_context2(&pAVFormatRemux, NULL, "mpg", urlOut.c_str());
// if (ret < 0) {
// spdlog::error("evslicer {} {} failed create avformatcontext for output: %s", sn, iid, av_err2str(ret));
// exit(1);
// }
//spdlog::info("evslicer {} {} numStreams: {:d}", sn, iid, pAVFormatInput->nb_streams);
int streamIdx = 0; int streamIdx = 0;
// find all video & audio streams for remuxing // find all video & audio streams for remuxing
streamList = (int *)av_mallocz_array(pAVFormatInput->nb_streams, sizeof(*streamList)); streamList = (int *)av_mallocz_array(pAVFormatInput->nb_streams, sizeof(*streamList));
...@@ -263,6 +255,7 @@ protected: ...@@ -263,6 +255,7 @@ protected:
exit(1); exit(1);
} }
// build output avformatctx
for(int i =0; i < pAVFormatInput->nb_streams; i++) { for(int i =0; i < pAVFormatInput->nb_streams; i++) {
if(streamList[i] != -1) { if(streamList[i] != -1) {
out_stream = avformat_new_stream(pAVFormatRemux, NULL); out_stream = avformat_new_stream(pAVFormatRemux, NULL);
...@@ -290,6 +283,7 @@ protected: ...@@ -290,6 +283,7 @@ protected:
spdlog::error("evslicer {} {} error occurred when opening output file", sn, iid); spdlog::error("evslicer {} {} error occurred when opening output file", sn, iid);
} }
// TODO:
if(keyPacket.buf != NULL) { if(keyPacket.buf != NULL) {
ret = av_interleaved_write_frame(pAVFormatRemux, &packet); ret = av_interleaved_write_frame(pAVFormatRemux, &packet);
if (ret < 0) { if (ret < 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论