| | |
| | | ,io_ctx_(NULL) |
| | | ,read_io_buff_(NULL) |
| | | ,read_io_buff_size_(32768) |
| | | #ifdef GB28181 |
| | | ,handle_gb28181(NULL) |
| | | #endif |
| | | ,fps_(25.0) |
| | | {} |
| | | |
| | |
| | | ,io_ctx_(NULL) |
| | | ,read_io_buff_(NULL) |
| | | ,read_io_buff_size_(32768) |
| | | #ifdef GB28181 |
| | | ,handle_gb28181(NULL) |
| | | #endif |
| | | ,fps_(25.0) |
| | | { |
| | | prop_ = new VideoProp; |
| | |
| | | ctx_ = NULL; |
| | | } |
| | | |
| | | #ifdef GB28181 |
| | | if (handle_gb28181){ |
| | | delete handle_gb28181; |
| | | } |
| | | #endif |
| | | |
| | | if(io_ctx_){ |
| | | av_freep(&io_ctx_->buffer); |
| | |
| | | return 0; |
| | | } |
| | | |
| | | #ifdef GB28181 |
| | | int FormatIn::openGb28181(const char *filename, AVDictionary **options){ |
| | | |
| | | std::string fn = filename; |
| | |
| | | |
| | | return ret; |
| | | } |
| | | |
| | | #endif |
| | | ///////////////////////////////////////////////////////////////////////// |
| | | int FormatIn::open(const char *filename, AVDictionary **options){ |
| | | |
| | |
| | | fps_ = av_q2d(in->avg_frame_rate); |
| | | } |
| | | logIt("in stream video fps %f, time_base: %d : %d, size: %dx%d", fps_, in->time_base.num, in->time_base.den, in->codecpar->width, in->codecpar->height); |
| | | |
| | | |
| | | } |
| | | if (type == AVMEDIA_TYPE_AUDIO){ |
| | | auto in = ctx_->streams[i]; |
| | |
| | | return ctx_->streams[vs_idx_]->codecpar->codec_id == AV_CODEC_ID_HEVC; |
| | | } |
| | | |
| | | const bool FormatIn::isAVC1()const{ |
| | | const bool FormatIn::IsAVC1()const{ |
| | | if (IsHEVC()) return false; |
| | | |
| | | char p[100] = {0}; |
| | |
| | | int FormatIn::readPacket(AVPacket *pkt_out){ |
| | | |
| | | auto flag = av_read_frame(ctx_, pkt_out); |
| | | |
| | | return flag; |
| | | } |
| | | |
| | |
| | | av_packet_rescale_ts(pkt, in->time_base, in->codec->time_base); |
| | | int ret = avcodec_send_packet(dec_ctx_, pkt); |
| | | if(ret < 0){ |
| | | logIt("avcodec_send_packet error : %s", getAVErrorDesc(ret).c_str()); |
| | | logIt("pkt size %d avcodec_send_packet error : %s", pkt->size, getAVErrorDesc(ret).c_str()); |
| | | return -1; |
| | | } |
| | | while (ret >= 0) { |