Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Dawid Kozinski <d.kozinski@samsung.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Dawid Kozinski <d.kozinski@samsung.com>
Subject: [FFmpeg-devel] [PATCH v1] avformat/apvdec: framerate option added to the APV demuxer
Date: Thu, 26 Jun 2025 08:36:43 +0200
Message-ID: <20250626063643.3770197-1-d.kozinski@samsung.com> (raw)
In-Reply-To: <CGME20250626063647eucas1p2a61a42d32d8f9ed51c9151ec58f7d81c@eucas1p2.samsung.com>

Signed-off-by: Dawid Kozinski <d.kozinski@samsung.com>
---
 libavformat/apvdec.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c
index 1e5497bcd3..420c7196fd 100644
--- a/libavformat/apvdec.c
+++ b/libavformat/apvdec.c
@@ -18,12 +18,17 @@
 
 #include "libavcodec/apv.h"
 #include "libavcodec/bytestream.h"
+#include "libavutil/opt.h"
 
 #include "avformat.h"
 #include "avio_internal.h"
 #include "demux.h"
 #include "internal.h"
 
+typedef struct APVDemuxContext {
+    const AVClass *class;
+    AVRational framerate;
+} APVDemuxContext;
 
 typedef struct APVHeaderInfo {
     uint8_t  pbu_type;
@@ -150,6 +155,7 @@ static int apv_read_header(AVFormatContext *s)
     uint8_t buffer[12];
     uint32_t au_size, signature, pbu_size;
     int err, size;
+    APVDemuxContext *const c = s->priv_data;
 
     err = ffio_ensure_seekback(s->pb, sizeof(buffer));
     if (err < 0)
@@ -184,8 +190,8 @@ static int apv_read_header(AVFormatContext *s)
     st->codecpar->codec_id   = AV_CODEC_ID_APV;
 
     ffstream(st)->need_parsing = AVSTREAM_PARSE_HEADERS;
-    st->avg_frame_rate = (AVRational){ 30, 1 };
-    avpriv_set_pts_info(st, 64, 1, 30);
+    st->avg_frame_rate = c->framerate;
+    avpriv_set_pts_info(st, 64, 1, 25);
 
     avio_seek(s->pb, -size, SEEK_CUR);
 
@@ -220,12 +226,28 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     return 0;
 }
+#define DEC AV_OPT_FLAG_DECODING_PARAM
+#define OFFSET(x) offsetof(APVDemuxContext, x)
+static const AVOption apv_options[] = {
+    { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC},
+    { NULL },
+};
+#undef OFFSET
+
+static const AVClass apv_demuxer_class = {
+    .class_name = "APV demuxer",
+    .item_name  = av_default_item_name,
+    .option     = apv_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
 
 const FFInputFormat ff_apv_demuxer = {
     .p.name         = "apv",
     .p.long_name    = NULL_IF_CONFIG_SMALL("APV raw bitstream"),
     .p.extensions   = "apv",
     .p.flags        = AVFMT_GENERIC_INDEX | AVFMT_NOTIMESTAMPS,
+    .p.priv_class   = &apv_demuxer_class,
+    .priv_data_size = sizeof(APVDemuxContext),
     .read_probe     = apv_probe,
     .read_header    = apv_read_header,
     .read_packet    = apv_read_packet,
-- 
2.34.1

_______________________________________________
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:[~2025-06-26  6:37 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CGME20250626063647eucas1p2a61a42d32d8f9ed51c9151ec58f7d81c@eucas1p2.samsung.com>]

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=20250626063643.3770197-1-d.kozinski@samsung.com \
    --to=d.kozinski@samsung.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