]> git.sesse.net Git - nageru/blobdiff - nageru/kaeru.cpp
Stop using av_init_packet().
[nageru] / nageru / kaeru.cpp
index 9ff672d0f16ab946f1b7e03dce85f068af67f01d..1699d243491900f45a1c1fdfb8f0db7bc3efc874 100644 (file)
@@ -162,10 +162,8 @@ void filter_packet_callback(Mux *mux, int stream_index, AVBSFContext *bsfctx, co
                fprintf(stderr, "av_bsf_send_packet() failed with %d, ignoring\n", err);
        }
        for ( ;; ) {
-               AVPacket out_pkt;
-               unique_ptr<AVPacket, decltype(av_packet_unref) *> pkt_cleanup(&out_pkt, av_packet_unref);
-               av_init_packet(&out_pkt);
-               err = av_bsf_receive_packet(bsfctx, &out_pkt);
+               AVPacketWithDeleter out_pkt = av_packet_alloc_unique();
+               err = av_bsf_receive_packet(bsfctx, out_pkt.get());
                if (err == AVERROR(EAGAIN)) {
                        break;
                }
@@ -173,7 +171,7 @@ void filter_packet_callback(Mux *mux, int stream_index, AVBSFContext *bsfctx, co
                        fprintf(stderr, "av_bsf_receive_packet() failed with %d, ignoring\n", err);
                        return;
                }
-               mux->add_packet(out_pkt, out_pkt.pts, out_pkt.dts == AV_NOPTS_VALUE ? out_pkt.pts : out_pkt.dts, timebase, stream_index);
+               mux->add_packet(*out_pkt, out_pkt->pts, out_pkt->dts == AV_NOPTS_VALUE ? out_pkt->pts : out_pkt->dts, timebase, stream_index);
        }
 }