diff mbox

[FFmpeg-devel] lavc/hevcdec: add ONLY_IF_THREADS_ENABLED where it is missing.

Message ID 1533798413-2439-1-git-send-email-mypopydev@gmail.com
State Accepted
Commit 1581caa7ca6f6be453e2a272df47aef1082d9f0c
Headers show

Commit Message

Jun Zhao Aug. 9, 2018, 7:06 a.m. UTC
add add ONLY_IF_THREADS_ENABLED where it is missing.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
---
 libavcodec/hevcdec.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Comments

James Almer Aug. 9, 2018, 6:58 p.m. UTC | #1
On 8/9/2018 4:06 AM, Jun Zhao wrote:
> add add ONLY_IF_THREADS_ENABLED where it is missing.
> 
> Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> ---
>  libavcodec/hevcdec.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index 409e77f..a3b5c8c 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -3358,6 +3358,7 @@ fail:
>      return AVERROR(ENOMEM);
>  }
>  
> +#if HAVE_THREADS
>  static int hevc_update_thread_context(AVCodecContext *dst,
>                                        const AVCodecContext *src)
>  {
> @@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
>  
>      return 0;
>  }
> +#endif
>  
>  static av_cold int hevc_decode_init(AVCodecContext *avctx)
>  {
> @@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
>      return 0;
>  }
>  
> +#if HAVE_THREADS
>  static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
>  {
>      HEVCContext *s = avctx->priv_data;
> @@ -3491,6 +3494,7 @@ static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
>  
>      return 0;
>  }
> +#endif
>  
>  static void hevc_decode_flush(AVCodecContext *avctx)
>  {
> @@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
>      .close                 = hevc_decode_free,
>      .decode                = hevc_decode_frame,
>      .flush                 = hevc_decode_flush,
> -    .update_thread_context = hevc_update_thread_context,
> -    .init_thread_copy      = hevc_init_thread_copy,
> +    .update_thread_context = ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
> +    .init_thread_copy      = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
>      .capabilities          = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
>                               AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
>      .caps_internal         = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING,

Should be ok.
mypopy@gmail.com Aug. 10, 2018, 1:08 a.m. UTC | #2
On Fri, Aug 10, 2018 at 3:06 AM James Almer <jamrial@gmail.com> wrote:
>
> On 8/9/2018 4:06 AM, Jun Zhao wrote:
> > add add ONLY_IF_THREADS_ENABLED where it is missing.
> >
> > Signed-off-by: Jun Zhao <mypopydev@gmail.com>
> > ---
> >  libavcodec/hevcdec.c |    8 ++++++--
> >  1 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> > index 409e77f..a3b5c8c 100644
> > --- a/libavcodec/hevcdec.c
> > +++ b/libavcodec/hevcdec.c
> > @@ -3358,6 +3358,7 @@ fail:
> >      return AVERROR(ENOMEM);
> >  }
> >
> > +#if HAVE_THREADS
> >  static int hevc_update_thread_context(AVCodecContext *dst,
> >                                        const AVCodecContext *src)
> >  {
> > @@ -3439,6 +3440,7 @@ static int hevc_update_thread_context(AVCodecContext *dst,
> >
> >      return 0;
> >  }
> > +#endif
> >
> >  static av_cold int hevc_decode_init(AVCodecContext *avctx)
> >  {
> > @@ -3478,6 +3480,7 @@ static av_cold int hevc_decode_init(AVCodecContext *avctx)
> >      return 0;
> >  }
> >
> > +#if HAVE_THREADS
> >  static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
> >  {
> >      HEVCContext *s = avctx->priv_data;
> > @@ -3491,6 +3494,7 @@ static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
> >
> >      return 0;
> >  }
> > +#endif
> >
> >  static void hevc_decode_flush(AVCodecContext *avctx)
> >  {
> > @@ -3529,8 +3533,8 @@ AVCodec ff_hevc_decoder = {
> >      .close                 = hevc_decode_free,
> >      .decode                = hevc_decode_frame,
> >      .flush                 = hevc_decode_flush,
> > -    .update_thread_context = hevc_update_thread_context,
> > -    .init_thread_copy      = hevc_init_thread_copy,
> > +    .update_thread_context = ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
> > +    .init_thread_copy      = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
> >      .capabilities          = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
> >                               AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
> >      .caps_internal         = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING,
>
> Should be ok.
>
Will apply with commit message clean (remove the  unnecessary "add" in
commit message) , Thanks
diff mbox

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 409e77f..a3b5c8c 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -3358,6 +3358,7 @@  fail:
     return AVERROR(ENOMEM);
 }
 
+#if HAVE_THREADS
 static int hevc_update_thread_context(AVCodecContext *dst,
                                       const AVCodecContext *src)
 {
@@ -3439,6 +3440,7 @@  static int hevc_update_thread_context(AVCodecContext *dst,
 
     return 0;
 }
+#endif
 
 static av_cold int hevc_decode_init(AVCodecContext *avctx)
 {
@@ -3478,6 +3480,7 @@  static av_cold int hevc_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+#if HAVE_THREADS
 static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
 {
     HEVCContext *s = avctx->priv_data;
@@ -3491,6 +3494,7 @@  static av_cold int hevc_init_thread_copy(AVCodecContext *avctx)
 
     return 0;
 }
+#endif
 
 static void hevc_decode_flush(AVCodecContext *avctx)
 {
@@ -3529,8 +3533,8 @@  AVCodec ff_hevc_decoder = {
     .close                 = hevc_decode_free,
     .decode                = hevc_decode_frame,
     .flush                 = hevc_decode_flush,
-    .update_thread_context = hevc_update_thread_context,
-    .init_thread_copy      = hevc_init_thread_copy,
+    .update_thread_context = ONLY_IF_THREADS_ENABLED(hevc_update_thread_context),
+    .init_thread_copy      = ONLY_IF_THREADS_ENABLED(hevc_init_thread_copy),
     .capabilities          = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
                              AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
     .caps_internal         = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING,