From a8b447be656145c9ba2a2d8319a10ae8f726de1f Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 09 十月 2020 18:20:46 +0800 Subject: [PATCH] h264 mp4 --- csrc/ffmpeg/format/FormatOut.cpp | 34 ---------------------------------- 1 files changed, 0 insertions(+), 34 deletions(-) diff --git a/csrc/ffmpeg/format/FormatOut.cpp b/csrc/ffmpeg/format/FormatOut.cpp index d686d8e..4d6ce60 100644 --- a/csrc/ffmpeg/format/FormatOut.cpp +++ b/csrc/ffmpeg/format/FormatOut.cpp @@ -33,16 +33,12 @@ ,format_name_("mp4") ,in_v_stream_(NULL) ,in_a_stream_(NULL) - ,bsf_h264(NULL) - ,bsf_hevc(NULL) {} FormatOut::~FormatOut() { clear(); - if (bsf_h264) av_bsf_free(&bsf_h264); - if (bsf_hevc) av_bsf_free(&bsf_hevc); } void FormatOut::clear(){ @@ -355,22 +351,6 @@ av_dict_free(&avdic); } - if (v){ - if (v->codecpar->codec_id == AV_CODEC_ID_H264){ - char p[100] = {0}; - char *sub = av_fourcc_make_string(p, v->codecpar->codec_tag); - if (strcmp(sub, "avc1") == 0){ - const AVBitStreamFilter *f = av_bsf_get_by_name("h264_mp4toannexb"); - if (f){ - if (av_bsf_alloc(f, &bsf_h264) >= 0){ - if (avcodec_parameters_copy(bsf_h264->par_in, v->codecpar) >= 0){ - if (av_bsf_init(bsf_h264) < 0) bsf_h264 = NULL; - } - } - } - } - } - } return flag; } @@ -492,20 +472,6 @@ } bool FormatOut::writeFrameInternal(AVPacket *pkt, bool interleaved){ - - // h264_mp4toanatax - if (bsf_h264){ - if (av_bsf_send_packet(bsf_h264, pkt) < 0){ - logIt("bsf_h264 send packet failed"); - return true; - } - int ret; - while((ret = av_bsf_receive_packet(bsf_h264, pkt)) == 0){ - if (!write_frame(ctx_, pkt, interleaved)) return false; - } - - if (ret == AVERROR(EAGAIN)) return true; - } return write_frame(ctx_, pkt, interleaved); } -- Gitblit v1.8.0