]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/gstreamer1/gst1-plugins-ugly/0001-x264enc-fix-build-with-newer-x264-with-support-for-m.patch
gst1-plugins-ugly: fix x264 compile failure
[coffee/buildroot.git] / package / gstreamer1 / gst1-plugins-ugly / 0001-x264enc-fix-build-with-newer-x264-with-support-for-m.patch
1 From ffa7ce1e19ec3930de667f213dcaedb7eb10508e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
3 Date: Wed, 28 Feb 2018 10:07:13 +0000
4 Subject: [PATCH] x264enc: fix build with newer x264 with support for multiple
5  bit depths
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 libx264 used to be built for one specific bit depth, and if we
11 wanted to support multiple bit depths we would have to dynamically
12 load the right .so from different paths. That has changed now, and
13 libx264 can include support for multiple depths in the same lib,
14 so we don't need to do the dlopen() dance any more. We'll keep
15 the vtable stuff around until we can drop support for older x264.
16
17 gstx264enc.c:2927:36: error: ‘x264_bit_depth’ undeclared
18
19 https://bugzilla.gnome.org/show_bug.cgi?id=792111
20
21 Upstream: https://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/patch/ext/x264?id=83c38dc44622611c1f67dd26e4cb383c5aef90f6
22 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
23 ---
24  ext/x264/gstx264enc.c | 35 ++++++++++++++++++++++++++++++++++-
25  1 file changed, 34 insertions(+), 1 deletion(-)
26
27 diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
28 index 4287cf9..d1e4f2b 100644
29 --- a/ext/x264/gstx264enc.c
30 +++ b/ext/x264/gstx264enc.c
31 @@ -117,7 +117,9 @@ struct _GstX264EncVTable
32  {
33    GModule *module;
34  
35 +#if X264_BUILD < 153
36    const int *x264_bit_depth;
37 +#endif
38    const int *x264_chroma_format;
39    void (*x264_encoder_close) (x264_t *);
40    int (*x264_encoder_delayed_frames) (x264_t *);
41 @@ -170,8 +172,9 @@ load_x264 (const gchar * filename)
42          "' from '%s'. Incompatible version?", filename);
43      goto error;
44    }
45 -
46 +#if X264_BUILD < 153
47    LOAD_SYMBOL (x264_bit_depth);
48 +#endif
49    LOAD_SYMBOL (x264_chroma_format);
50    LOAD_SYMBOL (x264_encoder_close);
51    LOAD_SYMBOL (x264_encoder_delayed_frames);
52 @@ -288,6 +291,7 @@ gst_x264_enc_add_x264_chroma_format (GstStructure * s,
53    return ret;
54  }
55  
56 +#if X264_BUILD < 153
57  static gboolean
58  load_x264_libraries (void)
59  {
60 @@ -326,6 +330,33 @@ load_x264_libraries (void)
61    return TRUE;
62  }
63  
64 +#else /* X264_BUILD >= 153 */
65 +
66 +static gboolean
67 +load_x264_libraries (void)
68 +{
69 +#if X264_BIT_DEPTH == 0         /* all */
70 +  vtable_8bit = &default_vtable;
71 +  vtable_10bit = &default_vtable;
72 +#elif X264_BIT_DEPTH == 8
73 +  vtable_8bit = &default_vtable;
74 +#elif X264_BIT_DEPTH == 10
75 +  vtable_10bit = &default_vtable;
76 +#else
77 +#error "unexpected X264_BIT_DEPTH value"
78 +#endif
79 +
80 +#ifdef HAVE_X264_ADDITIONAL_LIBRARIES
81 +  GST_WARNING ("Ignoring configured additional libraries %s, using libx264 "
82 +      "version enabled for multiple bit depths",
83 +      HAVE_X264_ADDITIONAL_LIBRARIES);
84 +#endif
85 +
86 +  return TRUE;
87 +}
88 +
89 +#endif
90 +
91  enum
92  {
93    ARG_0,
94 @@ -2897,7 +2928,9 @@ plugin_init (GstPlugin * plugin)
95     * if needed. We can't initialize statically because these values are not
96     * constant on Windows. */
97    default_vtable.module = NULL;
98 +#if X264_BUILD < 153
99    default_vtable.x264_bit_depth = &x264_bit_depth;
100 +#endif
101    default_vtable.x264_chroma_format = &x264_chroma_format;
102    default_vtable.x264_encoder_close = x264_encoder_close;
103    default_vtable.x264_encoder_delayed_frames = x264_encoder_delayed_frames;
104 -- 
105 2.16.3
106