From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 07D9F4CAF3 for ; Thu, 26 Jun 2025 19:35:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 44A8768E4AD; Thu, 26 Jun 2025 22:35:19 +0300 (EEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id E7C7C68E283 for ; Thu, 26 Jun 2025 22:35:12 +0300 (EEST) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-235ea292956so16012215ad.1 for ; Thu, 26 Jun 2025 12:35:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750966511; x=1751571311; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=wPjOwOfCi+qTiBZLm+QtjzVRu+8aOw7xLOW6XCuRu+s=; b=AsBS6N8wvpnXg07snHDsxGIn+JH1ZQqrHYwaClNaA7FWN1CGazVCyQPxRpDtzA7vUY XUKQP85cEM7TPURqMkMUR7xIxdZfXE2onbCnX4u8qNE/1wy170VCNC4hnneqfwgJ5yby Sqvb6rt8YuQxcevet8pA+oJ3hezcIhPTVL6469ls6PojgYq418Qe1lEIp225WYtjYkz9 T3bucFplfpife8mDMRru2P31t25I+W1AW3QQYf8g5NhUju8O1vvTqgBAejWAAPCDbrt5 GC2HtzssfKzCVCc8h9PqW+P1u9aNH4gRwToTfGNPpWL237w4bkrXkZRR21uUMRCuishG kRyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750966511; x=1751571311; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wPjOwOfCi+qTiBZLm+QtjzVRu+8aOw7xLOW6XCuRu+s=; b=QQ7pkRSgkS5jjgiq6IBh5xfNy1U4SkhCjwTIgxjcnWh7Qaw/G2WwMncCkM42mowrz9 zJbASJ9R6DGIo87iU2Oh1kh8xpGnxZbQFDtUp+YBP4xHwOYeoWOvrFbu07W9613fas/a afGi4rubg/tGGaCT4geBSRChHNUDPYot8T82nqJWwx6g6JCSup+IJt/lwyt4Uf6Rn55A QWZlYziLKS6uXdy40lOuMM+c1tKX67EqK3CUfB1M1iLOOyFsGlSXLZN1aT9urjogUgQg O9bTM6At38evEMsIXZav7FtR6XRYY2atLGFwlBayyvMWtHaoLgz/cR6Ac2IgCeoYooNj FufQ== X-Gm-Message-State: AOJu0Yy4Jz8xOsM8Y6LV9oJ9maaUR/7d5QX9MsZxG7UlMYW3wANCl8Sy 9h9EfBe7aT0v0eBErPnVXFWF67TOVNp855/d7RlgcxYkntyihSF5xKYJo4Ml6A== X-Gm-Gg: ASbGnctHhp4VRvI44p4zOWSvKbbaI5rM48xBdzB6PcS554gZNfrO3KF4tDHNFbg6pES KOkiyqfcqBzY3PwNTIJFT0G+ZQARnuYPjNsdC4kceTJ598Bs97UrAaPmBcOQuw/b7wiqYXriAi8 38PP+BwNM0Jtp3rgDUwVs0ra64gAnjfb54824LrvrGtT7dSgVqDOT9DJSi330ImcLAvQIwvxWs0 7/OFNLuHtMfYyILs+jLVew5jZssUBx6zAdApTiWFbAKBqFnpQdVRVxCBp8DJqO9WUfRJuASyiyk vl+qKphlwkqsn22itLqCbrVNuCv8I++KY3yh7nFyx5zv1J2ch8U08PHwmOk= X-Google-Smtp-Source: AGHT+IFV4Y6gnIO4TStdA4kvKN9gaDm9CyjWrTGDJjHzocbQ22uQDB3NabbL+9lnejSgPTqwAau5QA== X-Received: by 2002:a17:903:2ecd:b0:236:9d66:ff24 with SMTP id d9443c01a7336-23ac3dec4a2mr6469525ad.8.1750966510648; Thu, 26 Jun 2025 12:35:10 -0700 (PDT) Received: from Gryph ([2800:2121:b000:82e:48f7:957:cd0d:fa11]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23abe312998sm4975045ad.21.2025.06.26.12.35.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jun 2025 12:35:10 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 26 Jun 2025 16:34:53 -0300 Message-ID: <20250626193453.2391-1-jamrial@gmail.com> X-Mailer: git-send-email 2.50.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/apvdec: add framerate option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Based on code from rawvideo demuxer. Signed-off-by: James Almer --- libavformat/apvdec.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libavformat/apvdec.c b/libavformat/apvdec.c index 1e5497bcd3..70f6babbb7 100644 --- a/libavformat/apvdec.c +++ b/libavformat/apvdec.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/opt.h" + #include "libavcodec/apv.h" #include "libavcodec/bytestream.h" @@ -24,6 +26,10 @@ #include "demux.h" #include "internal.h" +typedef struct APVDemuxerContext { + const AVClass *class; /**< Class for private options. */ + AVRational frame_rate; /**< AVRational describing framerate, set by a private option. */ +} APVDemuxerContext; typedef struct APVHeaderInfo { uint8_t pbu_type; @@ -145,6 +151,7 @@ static int apv_probe(const AVProbeData *p) static int apv_read_header(AVFormatContext *s) { + APVDemuxerContext *apv = s->priv_data; AVStream *st; GetByteContext gbc; uint8_t buffer[12]; @@ -184,8 +191,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 = apv->frame_rate; + avpriv_set_pts_info(st, 64, apv->frame_rate.den, apv->frame_rate.num); avio_seek(s->pb, -size, SEEK_CUR); @@ -221,11 +228,27 @@ static int apv_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +#define OFFSET(x) offsetof(APVDemuxerContext, x) +#define DEC AV_OPT_FLAG_DECODING_PARAM +static const AVOption apv_options[] = { + { "framerate", "set frame rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, { .str = "30" }, 0, INT_MAX, DEC }, + { NULL }, +}; + +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(APVDemuxerContext), .read_probe = apv_probe, .read_header = apv_read_header, .read_packet = apv_read_packet, -- 2.50.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".