diff mbox series

[FFmpeg-devel] avcodec/av1_parser: export color information

Message ID 20200126175942.16257-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/av1_parser: export color information
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

James Almer Jan. 26, 2020, 5:59 p.m. UTC
Should fix fate-lavf-fate-av1.mkv failures on builds without an AV1 decoder.

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

Comments

Michael Niedermayer Jan. 26, 2020, 6:29 p.m. UTC | #1
On Sun, Jan 26, 2020 at 02:59:42PM -0300, James Almer wrote:
> Should fix fate-lavf-fate-av1.mkv failures on builds without an AV1 decoder.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/av1_parser.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
> index 131a05fd72..68b7a78abe 100644
> --- a/libavcodec/av1_parser.c
> +++ b/libavcodec/av1_parser.c
> @@ -160,6 +160,11 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
>          }
>          av_assert2(ctx->format != AV_PIX_FMT_NONE);
>  
> +        avctx->colorspace = (enum AVColorSpace) color->matrix_coefficients;
> +        avctx->color_primaries = (enum AVColorPrimaries) color->color_primaries;
> +        avctx->color_trc = (enum AVColorTransferCharacteristic) color->transfer_characteristics;
> +        avctx->color_range = color->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
> +
>          if (ctx->width != avctx->width || ctx->height != avctx->height) {
>              ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
>              if (ret < 0)

i can confirm that this fixes it

thanks

[...]
James Almer Jan. 26, 2020, 6:31 p.m. UTC | #2
On 1/26/2020 3:29 PM, Michael Niedermayer wrote:
> On Sun, Jan 26, 2020 at 02:59:42PM -0300, James Almer wrote:
>> Should fix fate-lavf-fate-av1.mkv failures on builds without an AV1 decoder.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/av1_parser.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
>> index 131a05fd72..68b7a78abe 100644
>> --- a/libavcodec/av1_parser.c
>> +++ b/libavcodec/av1_parser.c
>> @@ -160,6 +160,11 @@ static int av1_parser_parse(AVCodecParserContext *ctx,
>>          }
>>          av_assert2(ctx->format != AV_PIX_FMT_NONE);
>>  
>> +        avctx->colorspace = (enum AVColorSpace) color->matrix_coefficients;
>> +        avctx->color_primaries = (enum AVColorPrimaries) color->color_primaries;
>> +        avctx->color_trc = (enum AVColorTransferCharacteristic) color->transfer_characteristics;
>> +        avctx->color_range = color->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
>> +
>>          if (ctx->width != avctx->width || ctx->height != avctx->height) {
>>              ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
>>              if (ret < 0)
> 
> i can confirm that this fixes it
> 
> thanks

Applied then, thanks.
diff mbox series

Patch

diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 131a05fd72..68b7a78abe 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -160,6 +160,11 @@  static int av1_parser_parse(AVCodecParserContext *ctx,
         }
         av_assert2(ctx->format != AV_PIX_FMT_NONE);
 
+        avctx->colorspace = (enum AVColorSpace) color->matrix_coefficients;
+        avctx->color_primaries = (enum AVColorPrimaries) color->color_primaries;
+        avctx->color_trc = (enum AVColorTransferCharacteristic) color->transfer_characteristics;
+        avctx->color_range = color->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+
         if (ctx->width != avctx->width || ctx->height != avctx->height) {
             ret = ff_set_dimensions(avctx, ctx->width, ctx->height);
             if (ret < 0)