From patchwork Fri Oct 9 13:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 22784 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 9B73144A971 for ; Fri, 9 Oct 2020 16:06:43 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 851FC68B9D3; Fri, 9 Oct 2020 16:06:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA67968B9B7 for ; Fri, 9 Oct 2020 16:06:34 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 47528296253 for ; Fri, 9 Oct 2020 15:06:34 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id G78wBNpN0sVS for ; Fri, 9 Oct 2020 15:06:33 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 9756F29625F for ; Fri, 9 Oct 2020 15:06:31 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 8220120E0236; Fri, 9 Oct 2020 15:06:26 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Oct 2020 15:04:21 +0200 Message-Id: <20201009130430.602-9-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009130430.602-1-anton@khirnov.net> References: <20201009130430.602-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/18] lavf: move AVStream.interleaver_chunk_* to AVStreamInternal X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Those are private fields, no reason to have them exposed in a public header. --- libavformat/avformat.h | 3 --- libavformat/internal.h | 3 +++ libavformat/mux.c | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index ed0ed0d3e1..1253021452 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1084,9 +1084,6 @@ typedef struct AVStream { int pmt_version; int pmt_stream_idx; - int64_t interleaver_chunk_size; - int64_t interleaver_chunk_duration; - /** * An opaque field for libavformat internal usage. * Must not be accessed in any way by callers. diff --git a/libavformat/internal.h b/libavformat/internal.h index d8ceebb26e..87d62c51b2 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -225,6 +225,9 @@ struct AVStreamInternal { } *info; + int64_t interleaver_chunk_size; + int64_t interleaver_chunk_duration; + /** * stream probing state * -1 -> probing finished diff --git a/libavformat/mux.c b/libavformat/mux.c index 8a2d6370f6..8a53f0feeb 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -839,19 +839,19 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, if (chunked) { uint64_t max= av_rescale_q_rnd(s->max_chunk_duration, AV_TIME_BASE_Q, st->time_base, AV_ROUND_UP); - st->interleaver_chunk_size += pkt->size; - st->interleaver_chunk_duration += pkt->duration; - if ( (s->max_chunk_size && st->interleaver_chunk_size > s->max_chunk_size) - || (max && st->interleaver_chunk_duration > max)) { - st->interleaver_chunk_size = 0; + st->internal->interleaver_chunk_size += pkt->size; + st->internal->interleaver_chunk_duration += pkt->duration; + if ( (s->max_chunk_size && st->internal->interleaver_chunk_size > s->max_chunk_size) + || (max && st->internal->interleaver_chunk_duration > max)) { + st->internal->interleaver_chunk_size = 0; pkt->flags |= CHUNK_START; - if (max && st->interleaver_chunk_duration > max) { + if (max && st->internal->interleaver_chunk_duration > max) { int64_t syncoffset = (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)*max/2; int64_t syncto = av_rescale(pkt->dts + syncoffset, 1, max)*max - syncoffset; - st->interleaver_chunk_duration += (pkt->dts - syncto)/8 - max; + st->internal->interleaver_chunk_duration += (pkt->dts - syncto)/8 - max; } else - st->interleaver_chunk_duration = 0; + st->internal->interleaver_chunk_duration = 0; } } if (*next_point) {