[FFmpeg-devel] [PATCH] restoring binary compatibility with ffmpeg 0.5
Reinhard Tartler
siretart
Sun Jun 6 19:21:09 CEST 2010
On So, Jun 06, 2010 at 17:17:16 (CEST), Reimar D?ffinger wrote:
> On Sun, Jun 06, 2010 at 05:03:40PM +0200, Reinhard Tartler wrote:
>> +void ff_av_destruct_packet_nofree(AVPacket *pkt)
>> +{
>> + void (*fn)(AVPacket *pkt) = dlsym(avformat_handle, "av_destruct_packet_nofree");
>> + if (!fn)
>> + av_log(NULL, AV_LOG_FATAL, "Failed to locate symbol: av_destruct_nofree\n");
>> + (*fn)(pkt);
>
> And adding and calling a special stub function in lavc certainly is much less hackish than
> this.
I tried this, but applications that have been compiled against ffmpeg
0.5.1 really really hard expect this symbol in avformat with this symbol.
>> +__asm__(".symver ff_av_destruct_packet_nofree,av_destruct_packet_nofree at LIBAVFORMAT_52");
>
> Though I think unless this does not really work right (which means even more problems),
> why is this not just
> void ff_av_destruct_packet_nofree(AVPacket *pkt)
> {
> av_destruct_packet_nofree(pkt);
> }
doh, you're (as always) right, this simplifies my patch a bit. Here is
the updated, simplified patch. It works as well for me.
Index: configure
===================================================================
--- configure (revision 23498)
+++ configure (working copy)
@@ -1086,6 +1086,7 @@
struct_sockaddr_in6
struct_sockaddr_sa_len
struct_sockaddr_storage
+ symbol_versioning
sys_mman_h
sys_resource_h
sys_select_h
@@ -2733,7 +2734,7 @@
echo "X{};" > $TMPV
test_ldflags -Wl,--version-script,$TMPV &&
- append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
+ append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver' && enable symbol_versioning
if enabled small; then
add_cflags $size_cflags
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 23498)
+++ libavformat/utils.c (working copy)
@@ -282,9 +282,53 @@
return NULL;
}
-/* memory handling */
+#if HAVE_SYMBOL_VERSIONING && LIBAVFORMAT_VERSION_MAJOR < 53
+/* compatibility trampolines for packet functions */
+void ff_av_destruct_packet_nofree(AVPacket *pkt);
+void ff_av_destruct_packet_nofree(AVPacket *pkt)
+{
+ av_destruct_packet_nofree(pkt);
+}
+__asm__(".symver ff_av_destruct_packet_nofree,av_destruct_packet_nofree at LIBAVFORMAT_52");
+void ff_av_destruct_packet(AVPacket *pkt);
+void ff_av_destruct_packet(AVPacket *pkt)
+{
+ av_destruct_packet(pkt);
+}
+__asm__(".symver ff_av_destruct_packet,av_destruct_packet at LIBAVFORMAT_52");
+
+int ff_av_new_packet(AVPacket *pkt, int size);
+int ff_av_new_packet(AVPacket *pkt, int size)
+{
+ return av_new_packet(pkt, size);
+}
+__asm__(".symver ff_av_new_packet,av_new_packet at LIBAVFORMAT_52");
+
+int ff_av_dup_packet(AVPacket *pkt);
+int ff_av_dup_packet(AVPacket *pkt)
+{
+ return av_dup_packet(pkt);
+}
+__asm__(".symver ff_av_dup_packet,av_dup_packet at LIBAVFORMAT_52");
+
+void ff_av_free_packet(AVPacket *pkt);
+void ff_av_free_packet(AVPacket *pkt)
+{
+ av_free_packet(pkt);
+}
+__asm__(".symver ff_av_free_packet,av_free_packet at LIBAVFORMAT_52");
+
+void ff_av_init_packet(AVPacket *pkt);
+void ff_av_init_packet(AVPacket *pkt)
+{
+ av_log(NULL, AV_LOG_WARNING, "diverting av_*_packet function calls to libavcodec. Recompile to improve performance\n");
+ av_init_packet(pkt);
+}
+__asm__(".symver ff_av_init_packet,av_init_packet at LIBAVFORMAT_52");
+#endif
+
int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
{
int ret= av_new_packet(pkt, size);
--
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4
More information about the ffmpeg-devel
mailing list