avformat: add AV_STREAM_GROUP_PARAMS_DOLBY_VISION

This uses existing AVStreamGroupLayeredVideo.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow 2026-05-16 19:46:53 +02:00 committed by James Almer
parent 1e3883df9f
commit d7c7ee4e2e
6 changed files with 38 additions and 2 deletions

View file

@ -5,6 +5,7 @@ API changes, most recent first:
2026-05-xx - xxxxxxxxxx - lavf 62.19.100 - avformat.h
Add AVStreamGroupLayeredVideo
Add AVStreamGroup.params.layered_video
Add AV_STREAM_GROUP_PARAMS_DOLBY_VISION
2026-05-xx - xxxxxxxxxx - lavc 62.35.100 - packet.h
Add AV_PKT_DATA_HEVC_CONF side data type.

View file

@ -2557,6 +2557,7 @@ static int of_map_group(Muxer *mux, AVDictionary **dict, AVBPrint *bp, const cha
}
case AV_STREAM_GROUP_PARAMS_LCEVC:
case AV_STREAM_GROUP_PARAMS_TREF:
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION:
break;
default:
av_log(mux, AV_LOG_ERROR, "Unsupported mapped group type %d.\n", stg->type);

View file

@ -110,6 +110,10 @@ void ff_free_stream_group(AVStreamGroup **pstg)
av_opt_free(stg->params.tref);
av_freep(&stg->params.tref);
break;
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION:
av_opt_free(stg->params.layered_video);
av_freep(&stg->params.layered_video);
break;
default:
break;
}
@ -269,6 +273,7 @@ const char *avformat_stream_group_name(enum AVStreamGroupParamsType type)
case AV_STREAM_GROUP_PARAMS_TILE_GRID: return "Tile Grid";
case AV_STREAM_GROUP_PARAMS_LCEVC: return "LCEVC (Split video and enhancement)";
case AV_STREAM_GROUP_PARAMS_TREF: return "Track Reference";
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION: return "Dolby Vision (Split base and enhancement layer)";
}
return NULL;
}

View file

@ -1126,6 +1126,7 @@ enum AVStreamGroupParamsType {
AV_STREAM_GROUP_PARAMS_TILE_GRID,
AV_STREAM_GROUP_PARAMS_LCEVC,
AV_STREAM_GROUP_PARAMS_TREF,
AV_STREAM_GROUP_PARAMS_DOLBY_VISION,
};
struct AVIAMFAudioElement;

View file

@ -380,6 +380,22 @@ static const AVClass tref_class = {
.option = tref_options,
};
#define OFFSET(x) offsetof(AVStreamGroupLayeredVideo, x)
static const AVOption layered_video_options[] = {
{ "el_index", "Index of the enhancement layer stream within the group", OFFSET(el_index),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "video_size", "size of the final layered video presentation", OFFSET(width),
AV_OPT_TYPE_IMAGE_SIZE, { .str = NULL }, 0, INT_MAX, FLAGS },
{ NULL },
};
#undef OFFSET
static const AVClass layered_video_class = {
.class_name = "AVStreamGroupLayeredVideo",
.version = LIBAVUTIL_VERSION_INT,
.option = layered_video_options,
};
static void *stream_group_child_next(void *obj, void *prev)
{
AVStreamGroup *stg = obj;
@ -395,6 +411,8 @@ static void *stream_group_child_next(void *obj, void *prev)
return stg->params.lcevc;
case AV_STREAM_GROUP_PARAMS_TREF:
return stg->params.tref;
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION:
return stg->params.layered_video;
default:
break;
}
@ -428,6 +446,9 @@ static const AVClass *stream_group_child_iterate(void **opaque)
case AV_STREAM_GROUP_PARAMS_TREF:
ret = &tref_class;
break;
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION:
ret = &layered_video_class;
break;
default:
break;
}
@ -511,6 +532,13 @@ AVStreamGroup *avformat_stream_group_create(AVFormatContext *s,
stg->params.tref->av_class = &tref_class;
av_opt_set_defaults(stg->params.tref);
break;
case AV_STREAM_GROUP_PARAMS_DOLBY_VISION:
stg->params.layered_video = av_mallocz(sizeof(*stg->params.layered_video));
if (!stg->params.layered_video)
goto fail;
stg->params.layered_video->av_class = &layered_video_class;
av_opt_set_defaults(stg->params.layered_video);
break;
default:
goto fail;
}

View file

@ -31,8 +31,8 @@
#include "version_major.h"
#define LIBAVFORMAT_VERSION_MINOR 18
#define LIBAVFORMAT_VERSION_MICRO 101
#define LIBAVFORMAT_VERSION_MINOR 19
#define LIBAVFORMAT_VERSION_MICRO 100
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \