| | |
| | | var l C.int |
| | | |
| | | p := C.wrap_fn_info_recorder(h.ffmpeg, &i, &l) |
| | | if i == -1 { |
| | | if p == nil { |
| | | return -1, "" |
| | | } |
| | | defer C.free(unsafe.Pointer(p)) |
| | | C.free(unsafe.Pointer(p)) |
| | | |
| | | return int(i), C.GoString(p) |
| | | } |
| | |
| | | //callback to frame index and path |
| | | if(func_rec_info_){ |
| | | func_rec_info_(file_frame_index_, file_path_); |
| | | logIt("recoder index %d, file name %s\n", file_frame_index_, file_path_.c_str()); |
| | | }else{ |
| | | logIt("recorder has no func_rec_info"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | void Recorder::maybe_dump_gop(){ |
| | | //超过min/2,丢弃gop |
| | | while (list_pkt_.size() > minduration) { |
| | | while (list_pkt_.size() > maxduration) { |
| | | list_pkt_.pop_front(); |
| | | while(!list_pkt_.empty()){ |
| | | auto &cache = list_pkt_.front(); |
| | |
| | | int i; |
| | | std::string p; |
| | | s->GetInfoRecorder(i, p); |
| | | if(i < 0){ |
| | | if(p.empty()){ |
| | | return NULL; |
| | | } |
| | | *index = i; |
| | |
| | | info.file_frame_index = index; |
| | | info.file_path = path; |
| | | list_rec_.emplace_back(info); |
| | | logIt("list rec files count : %d", list_rec_.size()); |
| | | } |
| | | } |
| | | |