Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 01/11] avformat/mov: add support for lhvC box parsing
Date: Sun, 7 Jul 2024 13:18:54 -0300
Message-ID: <f16de032-0f9e-481f-bf4d-db837a35d664@gmail.com> (raw)
In-Reply-To: <AS8P250MB074457582832CC7046D57C118FD92@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>

On 7/7/2024 12:43 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavformat/mov.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 48 insertions(+)
>>
>> diff --git a/libavformat/mov.c b/libavformat/mov.c
>> index a3951a6942..30e8086855 100644
>> --- a/libavformat/mov.c
>> +++ b/libavformat/mov.c
>> @@ -8157,6 +8157,53 @@ static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>>       return ff_isom_parse_dvcc_dvvc(c->fc, st, buf, read_size);
>>   }
>>   
>> +static int mov_read_lhvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>> +{
>> +    AVStream *st;
>> +    uint8_t *buf;
>> +    int ret, old_size, num_arrays;
>> +
>> +    if (c->fc->nb_streams < 1)
>> +        return 0;
>> +    st = c->fc->streams[c->fc->nb_streams-1];
>> +
>> +    if (!st->codecpar->extradata_size)
>> +        // TODO: handle lhvC when present before hvcC
>> +        return 0;
>> +
>> +    if (atom.size < 6 || st->codecpar->extradata_size < 23)
>> +        return AVERROR_INVALIDDATA;
>> +
>> +    buf = av_malloc(atom.size + AV_INPUT_BUFFER_PADDING_SIZE);
>> +    if (!buf)
>> +        return AVERROR(ENOMEM);
>> +    memset(buf + atom.size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>> +
>> +    ret = ffio_read_size(pb, buf, atom.size);
>> +    if (ret < 0) {
>> +        av_free(buf);
>> +        av_log(c->fc, AV_LOG_WARNING, "lhvC atom truncated\n");
>> +        return 0;
>> +    }
>> +
>> +    num_arrays = buf[5];
>> +    old_size = st->codecpar->extradata_size;
>> +    atom.size -= 8 /* account for mov_realloc_extradata offseting */
>> +               + 6 /* lhvC bytes before the arrays*/;
>> +
>> +    ret = mov_realloc_extradata(st->codecpar, atom);
>> +    if (ret < 0) {
>> +        av_free(buf);
>> +        return ret;
>> +    }
>> +
>> +    st->codecpar->extradata[22] += num_arrays;
>> +    memcpy(st->codecpar->extradata + old_size, buf + 6, atom.size + 8);
>> +
>> +    av_free(buf);
>> +    return 0;
>> +}
>> +
>>   static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>>   {
>>       AVFormatContext *ctx = c->fc;
>> @@ -8943,6 +8990,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = {
>>   { MKTAG('i','p','r','p'), mov_read_iprp },
>>   { MKTAG('i','i','n','f'), mov_read_iinf },
>>   { MKTAG('a','m','v','e'), mov_read_amve }, /* ambient viewing environment box */
>> +{ MKTAG('l','h','v','C'), mov_read_lhvc },
>>   #if CONFIG_IAMFDEC
>>   { MKTAG('i','a','c','b'), mov_read_iacb },
>>   #endif
> 
> Could this also explain what this box is supposed to be good for?

It contains the global nuh_layer_id > 0 PS NALUs to handle L-HEVC 
(layered) streams. It's described in ISO 14496-15 section 9.4.3.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2024-07-07 16:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 21:26 James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 02/11] avformat: Add a new stream disposition for multilayer video James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 03/11] avformat/mov: Mark streams with a layered HEVC box as multilayer James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 04/11] avformat/hevc: don't write NALUs with nuh_layer_id > 0 in hvcC boxes James Almer
2024-07-07 15:46   ` Andreas Rheinhardt
2024-07-07 16:09     ` James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 05/11] avformat/hevc: don't write the same array values per nal addition James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 06/11] avformat/hevc: use a single array for per-PS NALUs James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 07/11] avformat/hevc: store parameter set and layer IDs in HVCCNALUnit James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 08/11] avformat/hevc: add a function to write a lhvC box James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 09/11] avformat/movenc: add support for writing lhvC boxes James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 10/11] avformat/movenc: add support for writting vexu boxes James Almer
2024-07-03 21:26 ` [FFmpeg-devel] [PATCH 11/11] avformat/movenc: add support for writting hfov boxes James Almer
2024-07-07 15:21 ` [FFmpeg-devel] [PATCH 01/11] avformat/mov: add support for lhvC box parsing James Almer
2024-07-07 15:43 ` Andreas Rheinhardt
2024-07-07 16:18   ` James Almer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f16de032-0f9e-481f-bf4d-db837a35d664@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git