[FFmpeg-devel] lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new

Submitted by Carl Eugen Hoyos on Aug. 25, 2019, 2:55 p.m.

Details

Message ID CAB0OVGp9fE-PjXS_4G4PZUB0O9igV-TnrXsFX7yWV07HUWSUNQ@mail.gmail.com
State New
Headers show

Commit Message

Carl Eugen Hoyos Aug. 25, 2019, 2:55 p.m.
Am So., 25. Aug. 2019 um 16:15 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:
>
> Hi!
>
> x264 removed the usage of strtok(), using FF_CODEC_CAP_INIT_THREADSAFE
> is ok with new libx264.

New patch attached.

Carl Eugen

Comments

James Almer Aug. 25, 2019, 3:48 p.m.
On 8/25/2019 11:55 AM, Carl Eugen Hoyos wrote:
> Am So., 25. Aug. 2019 um 16:15 Uhr schrieb Carl Eugen Hoyos
> <ceffmpeg@gmail.com>:
>> Hi!
>>
>> x264 removed the usage of strtok(), using FF_CODEC_CAP_INIT_THREADSAFE
>> is ok with new libx264.
> New patch attached.
> 
> Carl Eugen
> 
> 
> 0001-lavc-x264-Use-FF_CODEC_CAP_INIT_THREADSAFE-if-x264-i.patch
> 
> From e65319ab33f9cb2cb3d1db45bbc0fc8e69a80535 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Sun, 25 Aug 2019 16:12:28 +0200
> Subject: [PATCH] lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.
> 
> Usage of strtok() was removed from x264, see also b02490a4
> ---
>  libavcodec/libx264.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> index 86e3530e79..1b9043d2cc 100644
> --- a/libavcodec/libx264.c
> +++ b/libavcodec/libx264.c
> @@ -1168,7 +1168,11 @@ AVCodec ff_libx264_encoder = {
>      .priv_class       = &x264_class,
>      .defaults         = x264_defaults,
>      .init_static_data = X264_init_static,
> +#if X264_BUILD >= 158
> +    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> +#else
>      .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
> +#endif
>      .wrapper_name     = "libx264",
>  };
>  #endif
> @@ -1195,7 +1199,11 @@ AVCodec ff_libx264rgb_encoder = {
>      .priv_class     = &rgbclass,
>      .defaults       = x264_defaults,
>      .pix_fmts       = pix_fmts_8bit_rgb,
> +#if X264_BUILD >= 158
> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> +#else
>      .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
> +#endif
>      .wrapper_name   = "libx264",
>  };
>  #endif
> @@ -1222,7 +1230,11 @@ AVCodec ff_libx262_encoder = {

Does this also apply for libx262? Are both codebases in sync?

>      .priv_class       = &X262_class,
>      .defaults         = x264_defaults,
>      .pix_fmts         = pix_fmts_8bit,
> +#if X264_BUILD >= 158
> +    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> +#else
>      .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
> +#endif
>      .wrapper_name     = "libx264",
>  };
>  #endif
> -- 2.22.1
> 
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Carl Eugen Hoyos Aug. 25, 2019, 4:21 p.m.
Am So., 25. Aug. 2019 um 17:48 Uhr schrieb James Almer <jamrial@gmail.com>:
>
> On 8/25/2019 11:55 AM, Carl Eugen Hoyos wrote:
> > Am So., 25. Aug. 2019 um 16:15 Uhr schrieb Carl Eugen Hoyos
> > <ceffmpeg@gmail.com>:
> >> Hi!
> >>
> >> x264 removed the usage of strtok(), using FF_CODEC_CAP_INIT_THREADSAFE
> >> is ok with new libx264.
> > New patch attached.
> >
> > Carl Eugen
> >
> >
> > 0001-lavc-x264-Use-FF_CODEC_CAP_INIT_THREADSAFE-if-x264-i.patch
> >
> > From e65319ab33f9cb2cb3d1db45bbc0fc8e69a80535 Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> > Date: Sun, 25 Aug 2019 16:12:28 +0200
> > Subject: [PATCH] lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.
> >
> > Usage of strtok() was removed from x264, see also b02490a4
> > ---
> >  libavcodec/libx264.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> >
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index 86e3530e79..1b9043d2cc 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -1168,7 +1168,11 @@ AVCodec ff_libx264_encoder = {
> >      .priv_class       = &x264_class,
> >      .defaults         = x264_defaults,
> >      .init_static_data = X264_init_static,
> > +#if X264_BUILD >= 158
> > +    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >      .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif
> >      .wrapper_name     = "libx264",
> >  };
> >  #endif
> > @@ -1195,7 +1199,11 @@ AVCodec ff_libx264rgb_encoder = {
> >      .priv_class     = &rgbclass,
> >      .defaults       = x264_defaults,
> >      .pix_fmts       = pix_fmts_8bit_rgb,
> > +#if X264_BUILD >= 158
> > +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >      .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif
> >      .wrapper_name   = "libx264",
> >  };
> >  #endif
> > @@ -1222,7 +1230,11 @@ AVCodec ff_libx262_encoder = {
>
> Does this also apply for libx262? Are both codebases in sync?
>
> >      .priv_class       = &X262_class,
> >      .defaults         = x264_defaults,
> >      .pix_fmts         = pix_fmts_8bit,
> > +#if X264_BUILD >= 158
> > +    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
> > +#else
> >      .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
> > +#endif
> >      .wrapper_name     = "libx264",
> >  };
> >  #endif

I have no idea, removed locally.

Carl Eugen

Patch hide | download patch | download mbox

From e65319ab33f9cb2cb3d1db45bbc0fc8e69a80535 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 25 Aug 2019 16:12:28 +0200
Subject: [PATCH] lavc/x264: Use FF_CODEC_CAP_INIT_THREADSAFE if x264 is new.

Usage of strtok() was removed from x264, see also b02490a4
---
 libavcodec/libx264.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 86e3530e79..1b9043d2cc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -1168,7 +1168,11 @@  AVCodec ff_libx264_encoder = {
     .priv_class       = &x264_class,
     .defaults         = x264_defaults,
     .init_static_data = X264_init_static,
+#if X264_BUILD >= 158
+    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
+#else
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
+#endif
     .wrapper_name     = "libx264",
 };
 #endif
@@ -1195,7 +1199,11 @@  AVCodec ff_libx264rgb_encoder = {
     .priv_class     = &rgbclass,
     .defaults       = x264_defaults,
     .pix_fmts       = pix_fmts_8bit_rgb,
+#if X264_BUILD >= 158
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
+#else
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
+#endif
     .wrapper_name   = "libx264",
 };
 #endif
@@ -1222,7 +1230,11 @@  AVCodec ff_libx262_encoder = {
     .priv_class       = &X262_class,
     .defaults         = x264_defaults,
     .pix_fmts         = pix_fmts_8bit,
+#if X264_BUILD >= 158
+    .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE,
+#else
     .caps_internal    = FF_CODEC_CAP_INIT_CLEANUP,
+#endif
     .wrapper_name     = "libx264",
 };
 #endif
-- 
2.22.1