+// for get_initial_timecode auto deletes
+class avFrame {
+ AVFrame *frm;
+public:
+ avFrame() { frm = av_frame_alloc(); }
+ ~avFrame() { av_frame_free(&frm); }
+ operator AVFrame *() { return frm; }
+ AVFrame *operator ->() { return frm; }
+};
+
+class avPacket {
+ AVPacket pkt;
+public:
+ avPacket() {
+ av_init_packet(&pkt);
+ pkt.data = 0; pkt.size = 0;
+ }
+ ~avPacket() { av_packet_unref(&pkt); }
+ operator AVPacket *() { return &pkt; }
+ AVPacket *operator ->() { return &pkt; }
+};
+
+class avCodecContext {
+ AVCodecContext *avctx;
+public:
+ avCodecContext(AVCodecContext *ctx) { avctx = ctx; }
+ ~avCodecContext() { avcodec_free_context(&avctx); }
+ operator AVCodecContext *() { return avctx; }
+ AVCodecContext *operator ->() { return avctx; }
+};
+
+