libdav1d: fix build after a recent API break

Message ID 20181115010454.2028-1-jamrial@gmail.com
State Committed
Commit 56f50183f38087e53c07cb670e5793f200d84d18
Headers show
Series
  • libdav1d: fix build after a recent API break
Related show

Commit Message

James Almer Nov. 15, 2018, 1:04 a.m.
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/libdav1d.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Comments

Luca Barbato Nov. 15, 2018, 12:48 p.m. | #1
On 15/11/2018 02:04, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/libdav1d.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index ad4611fb9..3501c15e2 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -142,12 +142,18 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>               }
>   
>               av_fifo_generic_write(dav1d->cache, &pkt, sizeof(pkt), libdav1d_fifo_write);
> -        } else {
> -            data = NULL;
>           }
>       }
>   
> -    res = dav1d_decode(dav1d->c, data, &p);
> +    res = dav1d_send_data(dav1d->c, data);
> +    if (res < 0) {
> +        if (res == -EINVAL)
> +            res = AVERROR_INVALIDDATA;
> +        if (res != -EAGAIN)
> +            return res;
> +    }
> +
> +    res = dav1d_get_picture(dav1d->c, &p);
>       if (res < 0) {
>           if (res == -EINVAL)
>               res = AVERROR_INVALIDDATA;
> 

dav1d always negate by itself the return values so we are set?

if yes, push anytime.

lu

Patch

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index ad4611fb9..3501c15e2 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -142,12 +142,18 @@  static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
             }
 
             av_fifo_generic_write(dav1d->cache, &pkt, sizeof(pkt), libdav1d_fifo_write);
-        } else {
-            data = NULL;
         }
     }
 
-    res = dav1d_decode(dav1d->c, data, &p);
+    res = dav1d_send_data(dav1d->c, data);
+    if (res < 0) {
+        if (res == -EINVAL)
+            res = AVERROR_INVALIDDATA;
+        if (res != -EAGAIN)
+            return res;
+    }
+
+    res = dav1d_get_picture(dav1d->c, &p);
     if (res < 0) {
         if (res == -EINVAL)
             res = AVERROR_INVALIDDATA;