Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] avcodec: add an APV parser
@ 2025-04-27 21:15 James Almer
  2025-04-27 21:15 ` [FFmpeg-devel] [PATCH 2/2] avformat/apvdec: don't fill container level fields with codec level info James Almer
  2025-04-27 23:39 ` [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser James Almer
  0 siblings, 2 replies; 4+ messages in thread
From: James Almer @ 2025-04-27 21:15 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/Makefile     |   1 +
 libavcodec/apv_parser.c | 165 ++++++++++++++++++++++++++++++++++++++++
 libavcodec/parsers.c    |   1 +
 3 files changed, 167 insertions(+)
 create mode 100644 libavcodec/apv_parser.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e674671460..cc142bbae2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1198,6 +1198,7 @@ OBJS-$(CONFIG_AC3_PARSER)              += aac_ac3_parser.o ac3tab.o \
                                           ac3_channel_layout_tab.o
 OBJS-$(CONFIG_ADX_PARSER)              += adx_parser.o
 OBJS-$(CONFIG_AMR_PARSER)              += amr_parser.o
+OBJS-$(CONFIG_APV_PARSER)              += apv_parser.o
 OBJS-$(CONFIG_AV1_PARSER)              += av1_parser.o av1_parse.o
 OBJS-$(CONFIG_AVS2_PARSER)             += avs2.o avs2_parser.o
 OBJS-$(CONFIG_AVS3_PARSER)             += avs3_parser.o
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
new file mode 100644
index 0000000000..53e5bb0921
--- /dev/null
+++ b/libavcodec/apv_parser.c
@@ -0,0 +1,165 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "apv.h"
+
+typedef struct APVParseContext {
+    uint8_t  profile_idc;
+    uint8_t  level_idc;
+
+    int      frame_width;
+    int      frame_height;
+
+    uint8_t  color_primaries;
+    uint8_t  transfer_characteristics;
+    uint8_t  matrix_coefficients;
+    uint8_t  full_range_flag;
+
+    enum AVPixelFormat pixel_format;
+} APVParseContext;
+
+static const enum AVPixelFormat apv_format_table[5][5] = {
+    { AV_PIX_FMT_GRAY8,    AV_PIX_FMT_GRAY10,     AV_PIX_FMT_GRAY12,     AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16 },
+    { 0 }, // 4:2:0 is not valid.
+    { AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV422P10,  AV_PIX_FMT_YUV422P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV422P16 },
+    { AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV444P10,  AV_PIX_FMT_YUV444P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV444P16 },
+    { AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUVA444P16 },
+};
+
+static int apv_extract_header_info(AVCodecParserContext *s, GetByteContext *gbc)
+{
+    APVParseContext *p = s->priv_data;
+    int pbu_type, chroma_format_idc, bit_depth_minus8;
+    int byte;
+
+    pbu_type = bytestream2_get_byte(gbc);
+    bytestream2_skip(gbc, 2);
+
+    if (bytestream2_get_byte(gbc))
+        return AVERROR_INVALIDDATA;
+
+    if (pbu_type != APV_PBU_PRIMARY_FRAME)
+        return AVERROR_INVALIDDATA;
+
+    p->profile_idc = bytestream2_get_byte(gbc);
+    p->level_idc   = bytestream2_get_byte(gbc);
+
+    if (bytestream2_get_byte(gbc) & 7)
+        return AVERROR_INVALIDDATA;
+
+    p->frame_width  = bytestream2_get_be24(gbc);
+    p->frame_height = bytestream2_get_be24(gbc);
+    if (p->frame_width  < 1 || p->frame_width  > 65536 ||
+        p->frame_height < 1 || p->frame_height > 65536)
+        return AVERROR_INVALIDDATA;
+
+    byte = bytestream2_get_byte(gbc);
+    chroma_format_idc = byte >> 4;
+    bit_depth_minus8  = byte & 0xf;
+
+    if (bit_depth_minus8 > 8)
+        return AVERROR_INVALIDDATA;
+    if (bit_depth_minus8 % 2) {
+        // Odd bit depths are technically valid but not useful here.
+        return AVERROR_INVALIDDATA;
+    }
+
+    switch (chroma_format_idc) {
+    case APV_CHROMA_FORMAT_400:
+    case APV_CHROMA_FORMAT_422:
+    case APV_CHROMA_FORMAT_444:
+    case APV_CHROMA_FORMAT_4444:
+        p->pixel_format = apv_format_table[chroma_format_idc][bit_depth_minus8 / 2];
+        break;
+    default:
+        return AVERROR_INVALIDDATA;
+    }
+
+    bytestream2_skip(gbc, 1);
+
+    if (bytestream2_get_be16(gbc))
+        return AVERROR_INVALIDDATA;
+
+    // color_description_present_flag
+    if (bytestream2_peek_byte(gbc) >> 7) {
+        unsigned color_description;
+
+        color_description           = bytestream2_get_be32(gbc);
+        p->color_primaries          = (color_description >> 23) & 0xff;
+        p->transfer_characteristics = (color_description >> 15) & 0xff;
+        p->matrix_coefficients      = (color_description >>  7) & 0xff;
+        p->full_range_flag          = (color_description >>  6) & 1;
+    } else {
+        p->color_primaries          = AVCOL_PRI_UNSPECIFIED;
+        p->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
+        p->matrix_coefficients      = AVCOL_SPC_UNSPECIFIED;
+        p->full_range_flag          = 0;
+    }
+
+    return 0;
+}
+
+static int parse(AVCodecParserContext *s,
+                 AVCodecContext *avctx,
+                 const uint8_t **poutbuf, int *poutbuf_size,
+                 const uint8_t *buf, int buf_size)
+{
+    APVParseContext *p = s->priv_data;
+    GetByteContext gbc;
+
+    *poutbuf      = buf;
+    *poutbuf_size = buf_size;
+
+    if (buf_size < 29)
+        return buf_size;
+
+    bytestream2_init(&gbc, buf, buf_size);
+
+    if (bytestream2_get_be32(&gbc) != APV_SIGNATURE)
+        return buf_size;
+    if (bytestream2_get_be32(&gbc) < 16) // pbu_size
+        return buf_size;
+    if (apv_extract_header_info(s, &gbc) < 0)
+        return buf_size;
+
+    s->key_frame                  = 1;
+    s->pict_type                  = AV_PICTURE_TYPE_I;
+    s->field_order                = AV_FIELD_UNKNOWN;
+    s->picture_structure          = AV_PICTURE_STRUCTURE_FRAME;
+    s->width                      = p->frame_width;
+    s->height                     = p->frame_height;
+    s->format                     = p->pixel_format;
+    avctx->profile                = p->profile_idc;
+    avctx->level                  = p->level_idc;
+    avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT;
+    avctx->color_primaries        = p->color_primaries;
+    avctx->color_trc              = p->transfer_characteristics;
+    avctx->colorspace             = p->matrix_coefficients;
+    avctx->color_range            = p->full_range_flag ? AVCOL_RANGE_JPEG
+                                                       : AVCOL_RANGE_MPEG;
+
+    return buf_size;
+}
+
+const AVCodecParser ff_apv_parser = {
+    .codec_ids    = { AV_CODEC_ID_APV },
+    .priv_data_size = sizeof(APVParseContext),
+    .parser_parse = parse,
+};
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index 5387351fd0..21164f3751 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -25,6 +25,7 @@ extern const AVCodecParser ff_aac_latm_parser;
 extern const AVCodecParser ff_ac3_parser;
 extern const AVCodecParser ff_adx_parser;
 extern const AVCodecParser ff_amr_parser;
+extern const AVCodecParser ff_apv_parser;
 extern const AVCodecParser ff_av1_parser;
 extern const AVCodecParser ff_avs2_parser;
 extern const AVCodecParser ff_avs3_parser;
-- 
2.49.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] avformat/apvdec: don't fill container level fields with codec level info
  2025-04-27 21:15 [FFmpeg-devel] [PATCH 1/2] avcodec: add an APV parser James Almer
@ 2025-04-27 21:15 ` James Almer
  2025-04-27 23:39 ` [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser James Almer
  1 sibling, 0 replies; 4+ messages in thread
From: James Almer @ 2025-04-27 21:15 UTC (permalink / raw)
  To: ffmpeg-devel

This is a raw demuxer, it should not read codec level information and export it
as container level information.
The generic demux code will use the recently introduced parser to take care of
that.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 configure            |  1 +
 libavformat/apvdec.c | 46 ++++++--------------------------------------
 2 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/configure b/configure
index ee270b770c..39e65870a3 100755
--- a/configure
+++ b/configure
@@ -3648,6 +3648,7 @@ act_demuxer_select="riffdec"
 adts_muxer_select="mpeg4audio"
 aiff_muxer_select="iso_media"
 amv_muxer_select="riffenc"
+apv_demuxer_select="apv_parser"
 asf_demuxer_select="riffdec"
 asf_o_demuxer_select="riffdec"
 asf_muxer_select="riffenc"
diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c
index e1ac34b003..4597199970 100644
--- a/libavformat/apvdec.c
+++ b/libavformat/apvdec.c
@@ -36,24 +36,13 @@ typedef struct APVHeaderInfo {
     int      frame_width;
     int      frame_height;
 
-    uint8_t  chroma_format_idc;
     uint8_t  bit_depth_minus8;
-
-    enum AVPixelFormat pixel_format;
 } APVHeaderInfo;
 
-static const enum AVPixelFormat apv_format_table[5][5] = {
-    { AV_PIX_FMT_GRAY8,    AV_PIX_FMT_GRAY10,     AV_PIX_FMT_GRAY12,     AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16 },
-    { 0 }, // 4:2:0 is not valid.
-    { AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV422P10,  AV_PIX_FMT_YUV422P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV422P16 },
-    { AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV444P10,  AV_PIX_FMT_YUV444P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV444P16 },
-    { AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUVA444P16 },
-};
-
-static int apv_extract_header_info(APVHeaderInfo *info,
-                                   GetByteContext *gbc)
+static int apv_extract_header_info(GetByteContext *gbc)
 {
-    int zero, byte, bit_depth_index;
+    APVHeaderInfo header, *info = &header;
+    int zero, byte;
 
     info->pbu_type = bytestream2_get_byte(gbc);
     info->group_id = bytestream2_get_be16(gbc);
@@ -81,7 +70,6 @@ static int apv_extract_header_info(APVHeaderInfo *info,
         return AVERROR_INVALIDDATA;
 
     byte = bytestream2_get_byte(gbc);
-    info->chroma_format_idc = byte >> 4;
     info->bit_depth_minus8  = byte & 0xf;
 
     if (info->bit_depth_minus8 > 8) {
@@ -91,18 +79,6 @@ static int apv_extract_header_info(APVHeaderInfo *info,
         // Odd bit depths are technically valid but not useful here.
         return AVERROR_INVALIDDATA;
     }
-    bit_depth_index = info->bit_depth_minus8 / 2;
-
-    switch (info->chroma_format_idc) {
-    case APV_CHROMA_FORMAT_400:
-    case APV_CHROMA_FORMAT_422:
-    case APV_CHROMA_FORMAT_444:
-    case APV_CHROMA_FORMAT_4444:
-        info->pixel_format = apv_format_table[info->chroma_format_idc][bit_depth_index];
-        break;
-    default:
-        return AVERROR_INVALIDDATA;
-    }
 
     // Ignore capture_time_distance.
     bytestream2_skip(gbc, 1);
@@ -117,7 +93,6 @@ static int apv_extract_header_info(APVHeaderInfo *info,
 static int apv_probe(const AVProbeData *p)
 {
     GetByteContext gbc;
-    APVHeaderInfo header;
     uint32_t au_size, signature, pbu_size;
     int err;
 
@@ -144,7 +119,7 @@ static int apv_probe(const AVProbeData *p)
         return 0;
     }
 
-    err = apv_extract_header_info(&header, &gbc);
+    err = apv_extract_header_info(&gbc);
     if (err < 0) {
         // Header does not look like APV.
         return 0;
@@ -156,8 +131,7 @@ static int apv_read_header(AVFormatContext *s)
 {
     AVStream *st;
     GetByteContext gbc;
-    APVHeaderInfo header;
-    uint8_t buffer[28];
+    uint8_t buffer[12];
     uint32_t au_size, signature, pbu_size;
     int err, size;
 
@@ -186,22 +160,14 @@ static int apv_read_header(AVFormatContext *s)
         return AVERROR_INVALIDDATA;
     }
 
-    err = apv_extract_header_info(&header, &gbc);
-    if (err < 0)
-        return err;
-
     st = avformat_new_stream(s, NULL);
     if (!st)
         return AVERROR(ENOMEM);
 
     st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
     st->codecpar->codec_id   = AV_CODEC_ID_APV;
-    st->codecpar->format     = header.pixel_format;
-    st->codecpar->profile    = header.profile_idc;
-    st->codecpar->level      = header.level_idc;
-    st->codecpar->width      = header.frame_width;
-    st->codecpar->height     = header.frame_height;
 
+    ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS;
     st->avg_frame_rate = (AVRational){ 30, 1 };
     avpriv_set_pts_info(st, 64, 1, 30);
 
-- 
2.49.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser
  2025-04-27 21:15 [FFmpeg-devel] [PATCH 1/2] avcodec: add an APV parser James Almer
  2025-04-27 21:15 ` [FFmpeg-devel] [PATCH 2/2] avformat/apvdec: don't fill container level fields with codec level info James Almer
@ 2025-04-27 23:39 ` James Almer
  2025-05-01 17:23   ` James Almer
  1 sibling, 1 reply; 4+ messages in thread
From: James Almer @ 2025-04-27 23:39 UTC (permalink / raw)
  To: ffmpeg-devel

Signed-off-by: James Almer <jamrial@gmail.com>
---
Now working if the first AU is not a primary frame.

 configure               |   1 +
 libavcodec/Makefile     |   1 +
 libavcodec/apv_parser.c | 133 ++++++++++++++++++++++++++++++++++++++++
 libavcodec/parsers.c    |   1 +
 4 files changed, 136 insertions(+)
 create mode 100644 libavcodec/apv_parser.c

diff --git a/configure b/configure
index ee270b770c..d8c2786dc8 100755
--- a/configure
+++ b/configure
@@ -3483,6 +3483,7 @@ vvc_qsv_decoder_select="vvc_mp4toannexb_bsf qsvdec"
 
 # parsers
 aac_parser_select="adts_header mpeg4audio"
+apv_parser_select="cbs_apv"
 av1_parser_select="cbs_av1"
 evc_parser_select="evcparse"
 ffv1_parser_select="rangecoder"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e674671460..cc142bbae2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1198,6 +1198,7 @@ OBJS-$(CONFIG_AC3_PARSER)              += aac_ac3_parser.o ac3tab.o \
                                           ac3_channel_layout_tab.o
 OBJS-$(CONFIG_ADX_PARSER)              += adx_parser.o
 OBJS-$(CONFIG_AMR_PARSER)              += amr_parser.o
+OBJS-$(CONFIG_APV_PARSER)              += apv_parser.o
 OBJS-$(CONFIG_AV1_PARSER)              += av1_parser.o av1_parse.o
 OBJS-$(CONFIG_AVS2_PARSER)             += avs2.o avs2_parser.o
 OBJS-$(CONFIG_AVS3_PARSER)             += avs3_parser.o
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
new file mode 100644
index 0000000000..bd1894146c
--- /dev/null
+++ b/libavcodec/apv_parser.c
@@ -0,0 +1,133 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "avcodec.h"
+#include "apv.h"
+#include "cbs.h"
+#include "cbs_apv.h"
+
+typedef struct APVParseContext {
+    CodedBitstreamContext *cbc;
+    CodedBitstreamFragment au;
+} APVParseContext;
+
+static const enum AVPixelFormat apv_format_table[5][5] = {
+    { AV_PIX_FMT_GRAY8,    AV_PIX_FMT_GRAY10,     AV_PIX_FMT_GRAY12,     AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16 },
+    { 0 }, // 4:2:0 is not valid.
+    { AV_PIX_FMT_YUV422P,  AV_PIX_FMT_YUV422P10,  AV_PIX_FMT_YUV422P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV422P16 },
+    { AV_PIX_FMT_YUV444P,  AV_PIX_FMT_YUV444P10,  AV_PIX_FMT_YUV444P12,  AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUV444P16 },
+    { AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_YUVA444P16 },
+};
+
+static int parse(AVCodecParserContext *s,
+                 AVCodecContext *avctx,
+                 const uint8_t **poutbuf, int *poutbuf_size,
+                 const uint8_t *buf, int buf_size)
+{
+    APVParseContext *p = s->priv_data;
+    CodedBitstreamFragment *au = &p->au;
+    int ret;
+
+    *poutbuf      = buf;
+    *poutbuf_size = buf_size;
+
+    p->cbc->log_ctx = avctx;
+
+    ret = ff_cbs_read(p->cbc, au, buf, buf_size);
+    if (ret < 0) {
+        av_log(avctx, AV_LOG_ERROR, "Failed to parse access unit.\n");
+        goto end;
+    }
+
+    s->key_frame         = 1;
+    s->pict_type         = AV_PICTURE_TYPE_I;
+    s->field_order       = AV_FIELD_UNKNOWN;
+    s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
+
+    for (int i = 0; i < au->nb_units; i++) {
+        const CodedBitstreamUnit *pbu = &au->units[i];
+
+        switch (pbu->type) {
+        case APV_PBU_PRIMARY_FRAME: {
+            const APVRawFrame *frame        = pbu->content;
+            const APVRawFrameHeader *header = &frame->frame_header;
+            const APVRawFrameInfo *info     = &header->frame_info;
+            int bit_depth = info->bit_depth_minus8 + 8;
+
+            if (bit_depth < 8 || bit_depth > 16 || bit_depth % 2)
+                break;
+
+            s->width                        = info->frame_width;
+            s->height                       = info->frame_height;
+            s->format                       = apv_format_table[info->chroma_format_idc][bit_depth - 4 >> 2];
+            avctx->profile                  = info->profile_idc;
+            avctx->level                    = info->level_idc;
+            avctx->chroma_sample_location   = AVCHROMA_LOC_TOPLEFT;
+            avctx->color_primaries          = header->color_primaries;
+            avctx->color_trc                = header->transfer_characteristics;
+            avctx->colorspace               = header->matrix_coefficients;
+            avctx->color_range              = header->full_range_flag ? AVCOL_RANGE_JPEG
+                                                                      : AVCOL_RANGE_MPEG;
+            goto end;
+        }
+        default:
+            break;
+        }
+    }
+
+end:
+    ff_cbs_fragment_reset(au);
+    p->cbc->log_ctx = NULL;
+
+    return buf_size;
+}
+
+static const CodedBitstreamUnitType decompose_unit_types[] = {
+    APV_PBU_PRIMARY_FRAME,
+};
+
+static av_cold int init(AVCodecParserContext *s)
+{
+    APVParseContext *p = s->priv_data;
+    int ret;
+
+    ret = ff_cbs_init(&p->cbc, AV_CODEC_ID_APV, NULL);
+    if (ret < 0)
+        return ret;
+
+    p->cbc->decompose_unit_types    = decompose_unit_types;
+    p->cbc->nb_decompose_unit_types = FF_ARRAY_ELEMS(decompose_unit_types);
+
+    return 0;
+}
+
+static void close(AVCodecParserContext *s)
+{
+    APVParseContext *p = s->priv_data;
+
+    ff_cbs_fragment_free(&p->au);
+    ff_cbs_close(&p->cbc);
+}
+
+const AVCodecParser ff_apv_parser = {
+    .codec_ids    = { AV_CODEC_ID_APV },
+    .priv_data_size = sizeof(APVParseContext),
+    .parser_init  = init,
+    .parser_parse = parse,
+    .parser_close = close,
+};
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index 5387351fd0..21164f3751 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -25,6 +25,7 @@ extern const AVCodecParser ff_aac_latm_parser;
 extern const AVCodecParser ff_ac3_parser;
 extern const AVCodecParser ff_adx_parser;
 extern const AVCodecParser ff_amr_parser;
+extern const AVCodecParser ff_apv_parser;
 extern const AVCodecParser ff_av1_parser;
 extern const AVCodecParser ff_avs2_parser;
 extern const AVCodecParser ff_avs3_parser;
-- 
2.49.0

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser
  2025-04-27 23:39 ` [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser James Almer
@ 2025-05-01 17:23   ` James Almer
  0 siblings, 0 replies; 4+ messages in thread
From: James Almer @ 2025-05-01 17:23 UTC (permalink / raw)
  To: ffmpeg-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 454 bytes --]

On 4/27/2025 8:39 PM, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> Now working if the first AU is not a primary frame.
> 
>   configure               |   1 +
>   libavcodec/Makefile     |   1 +
>   libavcodec/apv_parser.c | 133 ++++++++++++++++++++++++++++++++++++++++
>   libavcodec/parsers.c    |   1 +
>   4 files changed, 136 insertions(+)
>   create mode 100644 libavcodec/apv_parser.c

Will apply set.


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-01 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-27 21:15 [FFmpeg-devel] [PATCH 1/2] avcodec: add an APV parser James Almer
2025-04-27 21:15 ` [FFmpeg-devel] [PATCH 2/2] avformat/apvdec: don't fill container level fields with codec level info James Almer
2025-04-27 23:39 ` [FFmpeg-devel] [PATCH v2 1/2] avcodec: add an APV parser James Almer
2025-05-01 17:23   ` James Almer

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