[FFmpeg-devel] [RFC] Windows issues with av_destruct_packet_nofree
Thu Feb 19 19:22:32 CET 2009
> 10min later, maybe theres a better solution, read my reply to reimar
Doh! And I just finished the patch (attached just for posterity). Where's
your reply to reimar?
xu?ggle (z?' gl) v. To freely encode, decode, and experience audio and
Use Xuggle to get the power of FFMPEG in Java.
-------------- next part --------------
--- libavformat/avformat.h (revision 17458)
+++ libavformat/avformat.h (working copy)
@@ -153,10 +153,31 @@
#define PKT_FLAG_KEY 0x0001
+ * Alternate packet destructor that clears out the data in a AVPacket
+ * without freeing the memory.
+ * Use this destructor if you create your own AVPacket values and
+ * want to ensure libavformat doesn't call avfree(void*) on your
+ * underlying data.
+ * WARNING: Function pointers to this method cannot be used reliably
+ * from a Microsoft Windows program that dynamically loads AVFORMAT.DLL,
+ * because Windows C Compilers (gcc or MSVC) will resolve this declaration
+ * to a stub function inside your executable, not the one in AVFORMAT.DLL.
+ * Do not assign it directly to AVPacket->destruct in those cases.
+ * Instead, you can call (assuming AVPacket* your_packet):
+ * av_init_packet(&fake_packet);
+ * your_packet->destruct = fake_packet.destruct
+ * to work around the issue.
void av_destruct_packet_nofree(AVPacket *pkt);
- * Default packet destructor.
+ * Default AVPacket destructor. Clears out the data in a AVPacket
+ * and calls av_free(void*) on the underlying memory.
void av_destruct_packet(AVPacket *pkt);
More information about the ffmpeg-devel