From patchwork Wed Jul 4 18:35:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baptiste Coudurier X-Patchwork-Id: 9610 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1078749jad; Wed, 4 Jul 2018 11:35:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeE/Kr4702I8eaXw/NhhAwUwgke92Sp8ezICUwsieJrQe3MG0/CkIETozwm0uj4m0J18RQM X-Received: by 2002:adf:a14a:: with SMTP id r10-v6mr2309509wrr.104.1530729352451; Wed, 04 Jul 2018 11:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729352; cv=none; d=google.com; s=arc-20160816; b=azoTSMMAhsn+9tUq8mIJvjdAc2g9tpxmXoNiSIFWbP2RHmj/DMZKui3VLtzPy4motN SR0ZSuWS91gqR2nqBc+rV4af8pBGjnp73HIt5lvaxAvzX/1scKsQ5VvpyWL7odbIKEKg lZKbM6s/935lk0dvh25Xt4+XN3WrP72t7clLWztxHzgtG42Ew0D30nkRw+pOjVrUgtpC Uzl2aseMve5kpqlHV9oYGPAtu5evpD2RfNXbSVrWX+MXoebyAi8pZMTazSEdz7vjKeSb HbJ2CocXNBa/YMeD8iC4C0N5ookE+5gh+wdbL6s8/t6am2dnzevedzPdsDUhbRlsTu71 I18A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=6UZ+gGByjNRqKjx7zf6zSdayDGS+QBR5umwad/OpqmM=; b=QFGooNG0s59Hr9GOV34wWe1bR/2LJ4m1940vz31bR04mqBKyVli7zeleW8wBukPofk m7Mp11zZx1wo6wEDyMFPiUPh86Zg/OO+SqCqK51Plb2Hooff08NE6alEyfsBKnohl88N /UgSd5AyoyQi++SV56T/IHMCb3sS00p/4aSE23QZ4ty2YWFTTpYqFxouw7nTH50XjmBy vLSKQvkg02ljEqDscfryzfp4e4Gu1VmPqV6PffjIdqkSn31H4bow/xX1CBx9VmbbBMWg sxJiz54txxmy6bvHr9rtC/0V2X3GMX16wABK51ifEws7AOX1+OegGfHNhG5nYv/llit/ qupQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=vQZA6tg8; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t81-v6si3266487wmf.30.2018.07.04.11.35.52; Wed, 04 Jul 2018 11:35:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=vQZA6tg8; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3A36768AB06; Wed, 4 Jul 2018 21:35:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 75ECF68A279 for ; Wed, 4 Jul 2018 21:35:16 +0300 (EEST) Received: by mail-pf0-f171.google.com with SMTP id h20-v6so3258190pfn.4 for ; Wed, 04 Jul 2018 11:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=fsBLxPoyywKOo45EahbI3KLwxbLw9Osv4P2hJesCn2s=; b=vQZA6tg8tmWBzjWkiRurviZ9UHAGY7Rg0rsbAnMlRjQDfV+EvPpW/8bDR8tmstETWX WLVTDC9J1f1gfsE9mw7FzwwAkGLeiAFfXvJUdyztpphF7plkpeeiwzR88rThBugw99JA kBelWc91GVrcvRqJJq+MmuaXSft5tdEvx5+aZ7n+YWguSO29wQ15SkG5MCg5bne2h7pt dulnjbZnpLuuYSXAFP6a260vJHU91eEN+YIAGNcVrhn1ynQohLYTnTKyrJrBp45wCPCr eLyQ7jXVwJCauWmq4L5EXoGflJuoZ0z9GUTScbcizhUQLHipQw7C8/oZ8fJHFR9tzlOf ijew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=fsBLxPoyywKOo45EahbI3KLwxbLw9Osv4P2hJesCn2s=; b=uhDqlznVr5//0/+yxzbBY38tlc2nc85dQi0Mzl89TFbzd9VeLhhSnQO5QjsGtD54sU SapUrpTi9deq6lhVVc8gr6sMBGxXMxjczU+gKIInkO10YW1Fqn9T+GsWDuEw44zBQoyY ceT4JNs0dSOKohHPILAPpjS0+2ij4Qyw2hjmPvO1dP+YWwoBxjuPu/8980zA5R3IxmPQ Wke2DTN7LayVoz+P+JNCAJZO66z5fY2iBkRW3K1Ekiz8WWLD4oMArr+oFtDegQynmNrd MQpAo7srt4zrmM9sLgWP+hMcwwPChC4ypv5OTe/BRnDLwG0jAoJFh0QN61MvCokEBGXW JsSw== X-Gm-Message-State: APt69E1OByUbouUvWJFiYvEJWJA+ksvSYqTfjd1EjwwrAtagVnIjDnDh HMdY9QgRY8sYVbIrqap8YGOAxQ== X-Received: by 2002:a65:6109:: with SMTP id z9-v6mr2836265pgu.243.1530729319331; Wed, 04 Jul 2018 11:35:19 -0700 (PDT) Received: from localhost.localdomain (cpe-104-173-251-254.socal.res.rr.com. [104.173.251.254]) by smtp.gmail.com with ESMTPSA id v126-v6sm8591239pgv.39.2018.07.04.11.35.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jul 2018 11:35:18 -0700 (PDT) From: Baptiste Coudurier To: ffmpeg-devel@ffmpeg.org Date: Wed, 4 Jul 2018 11:35:06 -0700 Message-Id: <20180704183514.71654-4-baptiste.coudurier@gmail.com> X-Mailer: git-send-email 2.17.0 (Apple Git-106) Subject: [FFmpeg-devel] [PATCH 04/12] avformat/mxfenc: update body partition with footer offset 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/mxfenc.c | 9 +++++++-- tests/ref/lavf/mxf | 6 +++--- tests/ref/lavf/mxf_d10 | 2 +- tests/ref/lavf/mxf_dv25 | 2 +- tests/ref/lavf/mxf_dvcpro50 | 2 +- tests/ref/lavf/mxf_opatom | 2 +- tests/ref/lavf/mxf_opatom_audio | 2 +- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index b54a94b62e..d13ddaff6d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1908,7 +1908,7 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid, else avio_write(pb, body_partition_key, 16); - klv_encode_ber_length(pb, 88 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); + klv_encode_ber4_length(pb, 88 + 16LL * DESCRIPTOR_COUNT(mxf->essence_container_count)); // write partition value avio_wb16(pb, 1); // majorVersion @@ -2854,7 +2854,7 @@ static int mxf_write_footer(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; - int err = 0; + int i, err = 0; if (!mxf->header_written || (s->oformat == &ff_mxf_opatom_muxer && !mxf->body_partition_offset)) { @@ -2898,6 +2898,11 @@ static int mxf_write_footer(AVFormatContext *s) if ((err = mxf_write_partition(s, 0, 0, header_closed_partition_key, 1)) < 0) goto end; } + // update footer partition offset + for (i = 0; i < mxf->body_partitions_count; i++) { + avio_seek(pb, mxf->body_partition_offset[i]+44, SEEK_SET); + avio_wb64(pb, mxf->footer_partition_offset); + } } end: diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf index 7f6d698855..1971e25fdf 100644 --- a/tests/ref/lavf/mxf +++ b/tests/ref/lavf/mxf @@ -1,9 +1,9 @@ -eea31259441d909fedb9a0e0eb9bbdb2 *./tests/data/lavf/lavf.mxf +649009e3d3d62eb3b6c56334d057cc4d *./tests/data/lavf/lavf.mxf 526393 ./tests/data/lavf/lavf.mxf ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab -2c4a6634f646f7ab76bf2b7e71c8c893 *./tests/data/lavf/lavf.mxf +1ab46fe6d07dc9eeb457772096f3a7db *./tests/data/lavf/lavf.mxf 561721 ./tests/data/lavf/lavf.mxf ./tests/data/lavf/lavf.mxf CRC=0xf21b1b48 -e547b44d71cd5871582522a31511ae9c *./tests/data/lavf/lavf.mxf +02bf8f0cd8951a49e277306691cb1538 *./tests/data/lavf/lavf.mxf 526393 ./tests/data/lavf/lavf.mxf ./tests/data/lavf/lavf.mxf CRC=0x8dddfaab diff --git a/tests/ref/lavf/mxf_d10 b/tests/ref/lavf/mxf_d10 index 0b9f49bb09..856fe9c3e9 100644 --- a/tests/ref/lavf/mxf_d10 +++ b/tests/ref/lavf/mxf_d10 @@ -1,3 +1,3 @@ -9f299fd4da6a20ef93adad7fe6a9f481 *./tests/data/lavf/lavf.mxf_d10 +e597f73ef9c9819710d2f815813eb91f *./tests/data/lavf/lavf.mxf_d10 5332013 ./tests/data/lavf/lavf.mxf_d10 ./tests/data/lavf/lavf.mxf_d10 CRC=0x6c74d488 diff --git a/tests/ref/lavf/mxf_dv25 b/tests/ref/lavf/mxf_dv25 index 200511e164..e94b3ca1ca 100644 --- a/tests/ref/lavf/mxf_dv25 +++ b/tests/ref/lavf/mxf_dv25 @@ -1,3 +1,3 @@ -358791c5468c39673239e038fb64a734 *./tests/data/lavf/lavf.mxf_dv25 +0fc964fa22bc8b3a389b81b9a2efccb3 *./tests/data/lavf/lavf.mxf_dv25 3834413 ./tests/data/lavf/lavf.mxf_dv25 ./tests/data/lavf/lavf.mxf_dv25 CRC=0xbdaf7f52 diff --git a/tests/ref/lavf/mxf_dvcpro50 b/tests/ref/lavf/mxf_dvcpro50 index f212c0321d..514a0475c9 100644 --- a/tests/ref/lavf/mxf_dvcpro50 +++ b/tests/ref/lavf/mxf_dvcpro50 @@ -1,3 +1,3 @@ -fac7c59ea81c752d769335ddaa818f90 *./tests/data/lavf/lavf.mxf_dvcpro50 +aa81ea83af44a69e73849e327cc4bd12 *./tests/data/lavf/lavf.mxf_dvcpro50 7431213 ./tests/data/lavf/lavf.mxf_dvcpro50 ./tests/data/lavf/lavf.mxf_dvcpro50 CRC=0xe3bbe4b4 diff --git a/tests/ref/lavf/mxf_opatom b/tests/ref/lavf/mxf_opatom index 5ea47f4df6..cc4eb519ea 100644 --- a/tests/ref/lavf/mxf_opatom +++ b/tests/ref/lavf/mxf_opatom @@ -1,3 +1,3 @@ -49b0b3dfeb6a9ec024b047fc627b66fd *./tests/data/lavf/lavf.mxf_opatom +06a1816aa91c733e1ef7e45d82e4f1d3 *./tests/data/lavf/lavf.mxf_opatom 4717625 ./tests/data/lavf/lavf.mxf_opatom ./tests/data/lavf/lavf.mxf_opatom CRC=0xf55aa22a diff --git a/tests/ref/lavf/mxf_opatom_audio b/tests/ref/lavf/mxf_opatom_audio index 540f430cda..485964529f 100644 --- a/tests/ref/lavf/mxf_opatom_audio +++ b/tests/ref/lavf/mxf_opatom_audio @@ -1,3 +1,3 @@ -862dc5c9f2c94bd2c545ca64f923d1a1 *./tests/data/lavf/lavf.mxf_opatom_audio +c45bb140605339556a77e751fda2c449 *./tests/data/lavf/lavf.mxf_opatom_audio 102969 ./tests/data/lavf/lavf.mxf_opatom_audio ./tests/data/lavf/lavf.mxf_opatom_audio CRC=0xd155c6ff