[FFmpeg-devel] [PATCH] restoring binary compatibility with ffmpeg 0.5

Reinhard Tartler siretart
Fri Jun 11 23:33:41 CEST 2010


On Fri, Jun 11, 2010 at 10:33:05 (CEST), M?ns Rullg?rd wrote:

>> AFAIUI, mans wanted to reconsider the symver tricks if they can be made
>> work with ARM RCVT as well. Mans, is this correct? Are you working on
>> that or do you want me to prepare a patch so that you can test it?
>
> I'm rather busy running around LinuxTag right now.  I'll look into it
> when I get back home, if not sooner.

I've played a bit further around, this should work with both rcvt and
gnu toolchains. Only tested on gnu, since I don't have access to an ARM
RCVT toolchain.


Index: configure
===================================================================
--- configure	(revision 23556)
+++ configure	(working copy)
@@ -1086,6 +1086,8 @@
     struct_sockaddr_in6
     struct_sockaddr_sa_len
     struct_sockaddr_storage
+    gnu_symbol_versioning
+    rcvt_symbol_versioning
     sys_mman_h
     sys_resource_h
     sys_select_h
@@ -2738,9 +2740,32 @@
 check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
 check_ldflags -Wl,-Bsymbolic
 
+check_rcvt_symbol_versioning() {
+    check_cc <<EOF  && return 0;
+int ff_foo() __asm__ ("av_foo at SOME_TAG");
+int ff_foo {}
+EOF
+    return 1;
+}
+
+check_gnu_symbol_versioning() {
+    check_cc <<EOF  && return 0;
+int ff_foo();
+int ff_foo() {}
+__asm__(".symver foo,av_foo at SOME_TAG");
+EOF
+    return 1;
+}
+
 echo "X{};" > $TMPV
-test_ldflags -Wl,--version-script,$TMPV &&
+if test_ldflags -Wl,--version-script,$TMPV ; then
     append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
+    if check_rcvt_symbol_versioning; then
+	enable rcvt_symbol_versioning
+    elif check_gnu_symbol_versioning; then
+	enable gnu_symbol_versioning
+    fi
+fi
 
 if enabled small; then
     add_cflags $size_cflags
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c	(revision 23556)
+++ libavformat/utils.c	(working copy)
@@ -283,9 +283,67 @@
     return NULL;
 }
 
-/* memory handling */
+#if LIBAVFORMAT_VERSION_MAJOR < 53
+/* compatibility trampolines for packet functions */
 
+#if HAVE_RCVT_SYMBOL_VERSIONING
+void ff_av_destruct_packet_nofree(AVPacket *pkt) __asm__ ("av_destruct_packet_nofree at LIBAVFORMAT_52");
+void ff_av_destruct_packet(AVPacket *pkt) __asm__ ("av_destruct_packet at LIBAVFORMAT_52");
+int ff_av_new_packet(AVPacket *pkt, int size) __asm__ ("av_new_packet at LIBAVFORMAT_52");
+int ff_av_dup_packet(AVPacket *pkt) __asm__ ("av_dup_packet at LIBAVFORMAT_52");
+void ff_av_free_packet(AVPacket *pkt) __asm__ ("av_free_packet at LIBAVFORMAT_52");
+void ff_av_init_packet(AVPacket *pkt) __asm__ ("av_init_packet at LIBAVFORMAT_52");
 
+#elif HAVE_GNU_SYMBOL_VERSIONING
+void ff_av_destruct_packet_nofree(AVPacket *pkt);
+void ff_av_destruct_packet(AVPacket *pkt);
+int ff_av_new_packet(AVPacket *pkt, int size);
+int ff_av_dup_packet(AVPacket *pkt);
+void ff_av_free_packet(AVPacket *pkt);
+void ff_av_init_packet(AVPacket *pkt);
+
+__asm__(".symver ff_av_destruct_packet_nofree,av_destruct_packet_nofree at LIBAVFORMAT_52");
+__asm__(".symver ff_av_destruct_packet,av_destruct_packet at LIBAVFORMAT_52");
+__asm__(".symver ff_av_new_packet,av_new_packet at LIBAVFORMAT_52");
+__asm__(".symver ff_av_dup_packet,av_dup_packet at LIBAVFORMAT_52");
+__asm__(".symver ff_av_free_packet,av_free_packet at LIBAVFORMAT_52");
+__asm__(".symver ff_av_init_packet,av_init_packet at LIBAVFORMAT_52");
+#endif
+
+#if HAVE_RCVT_SYMBOL_VERSIONING || HAVE_GNU_SYMBOL_VERSIONING
+void ff_av_destruct_packet_nofree(AVPacket *pkt)
+{
+    av_destruct_packet_nofree(pkt);
+}
+
+void ff_av_destruct_packet(AVPacket *pkt)
+{
+    av_destruct_packet(pkt);
+}
+
+int ff_av_new_packet(AVPacket *pkt, int size)
+{
+    return av_new_packet(pkt, size);
+}
+
+int ff_av_dup_packet(AVPacket *pkt)
+{
+    return av_dup_packet(pkt);
+}
+
+void ff_av_free_packet(AVPacket *pkt)
+{
+    av_free_packet(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);
+}
+#endif
+#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