diff mbox

[FFmpeg-devel,1/3] avcodec/av1_parser: export stream dimensions in avctx

Message ID 20191118144810.1287-1-jamrial@gmail.com
State Accepted
Commit 378065f08fbcbadf7c17bbd97b07c52692f1b471
Headers show

Commit Message

James Almer Nov. 18, 2019, 2:48 p.m. UTC
This is required to demux annexb samples when a decoder isn't available.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/av1_parser.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

James Almer Nov. 29, 2019, 10:02 p.m. UTC | #1
On 11/18/2019 11:48 AM, James Almer wrote:
> This is required to demux annexb samples when a decoder isn't available.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/av1_parser.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
> index 510cad987b..08721c356a 100644
> --- a/libavcodec/av1_parser.c
> +++ b/libavcodec/av1_parser.c
> @@ -23,6 +23,7 @@
>  #include "av1_parse.h"
>  #include "cbs.h"
>  #include "cbs_av1.h"
> +#include "internal.h"
>  #include "parser.h"
>  
>  typedef struct AV1ParseContext {
> @@ -155,6 +156,12 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
>              break;
>          }
>          av_assert2(ctx->format != AV_PIX_FMT_NONE);
> +
> +        if (ctx->width != avctx->width || ctx->height != avctx->height) {
> +            ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
> +            if (ret < 0)
> +                goto end;
> +        }
>      }
>  
>      if (avctx->framerate.num)

Pushed.
diff mbox

Patch

diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 510cad987b..08721c356a 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -23,6 +23,7 @@ 
 #include "av1_parse.h"
 #include "cbs.h"
 #include "cbs_av1.h"
+#include "internal.h"
 #include "parser.h"
 
 typedef struct AV1ParseContext {
@@ -155,6 +156,12 @@  static int av1_parser_parse(AVCodecParserContext *ctx,
             break;
         }
         av_assert2(ctx->format != AV_PIX_FMT_NONE);
+
+        if (ctx->width != avctx->width || ctx->height != avctx->height) {
+            ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
+            if (ret < 0)
+                goto end;
+        }
     }
 
     if (avctx->framerate.num)