From patchwork Thu Sep 14 14:12:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Rapp X-Patchwork-Id: 5140 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp749385jaa; Thu, 14 Sep 2017 07:13:02 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCc4iQPAVpsevIEZkDsCnLN3av1iVUDSPsZYFBRrnIaSIuyFqR+/G1Ila1ZZh/f7FF6H3Vv X-Received: by 10.28.145.129 with SMTP id t123mr142872wmd.69.1505398382646; Thu, 14 Sep 2017 07:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505398382; cv=none; d=google.com; s=arc-20160816; b=AU42QaEbYExI6iagiVOgfkyCEMJIKLQPuSjRuJ2vG7Ii0oOx5pTeAwKnTpIu2uYZea xdxarI1iAbVPY3oj3BAjo0l1u8NZZltQwx9WsO21Hqw/kCCbW29GMPNx56h2iJcWwG1h zVXima75flSgKiwD2sYuPazji4jXpDfLc9MjOb378GcdcAN6iK1n/jWIsGc6WHvd+jWJ /OH2wM6HBbrKN2L5K5wN7lxk63A5KT2rb4HbnFvdyb3glLyfMchOC0EfKQs37tXkY30x 3jwq59h4IJ44IGXMtIsrfjizkinILk5lviphmqYvixJ+TpRLZC8dZD96VqwLumavyIss EVNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:delivered-to :arc-authentication-results; bh=ueZ7VYF+lIhrGgpQCfoK/ra05fARIMAp70wE50Hsa28=; b=PNn4xhn/MSkaq070Rp7Vn3KEOP6yWwBCETm2p8DHsYOZgPjWemqbotBXsHCc1+c8NG CFS2JizKe66PSNGhytvF6vXGbB+AHQTdhrrkvDCfQrH08Xri/7NxnFILR9udcVwrg8Bh eR0cXa+ocmNSv7nldQsYxr12twWa5d1EXL/DuH+Broz+AmnHYxmKAIpri1Y2n0FpsDnt izY3FXkGfQ/kcwdUORswQM+YSGFLiTPb9r/NOUE58PHAynI91yoZwRG3X1PBYBOOuJ8R P5P5KN1rXHI7enpOI60xSSBPaxC0glJo2jd4QIevzyt2Xbmn2PSaMxuyzQuivS1sb+lR rpUQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id e44si13198594wre.413.2017.09.14.07.13.01; Thu, 14 Sep 2017 07:13:02 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A7DE9689ED2; Thu, 14 Sep 2017 17:12:53 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mx01.mail.netstorage.at (mx01.mail.netstorage.at [89.207.144.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4F1E7689C1D for ; Thu, 14 Sep 2017 17:12:47 +0300 (EEST) Received: from p1002.netstorage.at (p1002.netstorage.at [89.207.146.186]) by mx01.mail.netstorage.at (Postfix) with ESMTPS id A1553A03B6 for ; Thu, 14 Sep 2017 16:12:41 +0200 (CEST) Received: from mailix (noaport.de [46.237.252.213]) by p1002.netstorage.at (Postfix) with ESMTPA id 4EACA818D0 for ; Thu, 14 Sep 2017 16:12:41 +0200 (CEST) Received: from [127.0.0.1] (HSI-KBW-46-237-252-214.hsi.kabel-badenwuerttemberg.de [46.237.252.214]) by mailix with ESMTPSA (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128) ; Thu, 14 Sep 2017 16:12:41 +0200 To: ffmpeg-devel@ffmpeg.org References: <1505396682-24879-1-git-send-email-t.rapp@noa-archive.com> <2445049c-8ea9-71f3-f37d-8d16c65ec63a@acc.umu.se> From: Tobias Rapp Organization: NOA GmbH Message-ID: <2c065ee5-6455-9af8-9ae6-7d223a15e375@noa-archive.com> Date: Thu, 14 Sep 2017 16:12:40 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <2445049c-8ea9-71f3-f37d-8d16c65ec63a@acc.umu.se> Content-Language: en-US X-PPP-Message-ID: <20170914141241.442.89063@p1002.netstorage.at> X-PPP-Vhost: noa-archive.com X-NetStorage-MailScanner-Information: Please contact the ISP for more information X-NetStorage-MailScanner-ID: A1553A03B6.A518E X-NetStorage-MailScanner: Found to be clean X-NetStorage-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (nicht zwischen gespeichert, Wertung=-0.5, benoetigt 6, autolearn=not spam, BAYES_00 -0.50) X-NetStorage-MailScanner-From: t.rapp@noa-archive.com X-Spam-Status: No Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxfenc: fix aspect ratio when writing 16:9 DV frames 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" On 14.09.2017 15:55, Tomas Härdin wrote: > On 2017-09-14 15:44, Tobias Rapp wrote: >> Signed-off-by: Tobias Rapp >> --- >>   libavformat/mxfenc.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c >> index 7289e0b..da4d7b4 100644 >> --- a/libavformat/mxfenc.c >> +++ b/libavformat/mxfenc.c >> @@ -1810,7 +1810,7 @@ static int mxf_parse_dv_frame(AVFormatContext >> *s, AVStream *st, AVPacket *pkt) >>       stype    = vs_pack[3] & 0x1f; >>       pal      = (vs_pack[3] >> 5) & 0x1; >> -    if ((vs_pack[2] & 0x07) == 0x02) >> +    if ((vsc_pack[2] & 0x07) == 0x02) >>           sc->aspect_ratio = (AVRational){ 16, 9 }; >>       else >>           sc->aspect_ratio = (AVRational){ 4, 3 }; > > Might want to add some { } around those two cases while you're at it Added to the list of cosmetic changes that I'll apply after this patch is accepted. See attached file for reference. Regards, Tobias From 2a4a95b4d930bb5b511576ab2932969a37766adf Mon Sep 17 00:00:00 2001 From: Tobias Rapp Date: Thu, 14 Sep 2017 16:05:31 +0200 Subject: [PATCH] avformat/mxfenc: cosmetic changes Signed-off-by: Tobias Rapp --- libavformat/mxfenc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index da4d7b4..b8d3030 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -846,7 +846,7 @@ static void mxf_write_track(AVFormatContext *s, AVStream *st, enum MXFMetadataSe // write edit rate mxf_write_local_tag(pb, 8, 0x4B01); - if (st == mxf->timecode_track && s->oformat == &ff_mxf_opatom_muxer){ + if (st == mxf->timecode_track && s->oformat == &ff_mxf_opatom_muxer) { avio_wb32(pb, mxf->tc.rate.num); avio_wb32(pb, mxf->tc.rate.den); } else { @@ -882,7 +882,7 @@ static void mxf_write_common_fields(AVFormatContext *s, AVStream *st) // write duration mxf_write_local_tag(pb, 8, 0x0202); - if (st != mxf->timecode_track && s->oformat == &ff_mxf_opatom_muxer && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO){ + if (st != mxf->timecode_track && s->oformat == &ff_mxf_opatom_muxer && st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wb64(pb, mxf->body_offset / mxf->edit_unit_byte_count); } else { avio_wb64(pb, mxf->duration); @@ -1194,7 +1194,7 @@ static void mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st, con mxf_write_generic_desc(s, st, key, size+duration_size+5+12+8+8); - if (duration_size > 0){ + if (duration_size > 0) { mxf_write_local_tag(pb, 8, 0x3002); avio_wb64(pb, mxf->body_offset / mxf->edit_unit_byte_count); } @@ -1328,7 +1328,7 @@ static void mxf_write_package(AVFormatContext *s, enum MXFMetadataSetType type, // write uid mxf_write_local_tag(pb, 16, 0x3C0A); mxf_write_uuid(pb, type, 0); - av_log(s,AV_LOG_DEBUG, "package type:%d\n", type); + av_log(s, AV_LOG_DEBUG, "package type:%d\n", type); PRINT_KEY(s, "package uid", pb->buf_ptr - 16); // write package umid @@ -1770,7 +1770,7 @@ AVPacket *pkt) sc->codec_ul = &mxf_essence_container_uls[sc->index].codec_ul; sc->aspect_ratio = (AVRational){ 16, 9 }; - if(s->oformat == &ff_mxf_opatom_muxer){ + if (s->oformat == &ff_mxf_opatom_muxer) { mxf->edit_unit_byte_count = frame_size; return 1; } @@ -1810,10 +1810,11 @@ static int mxf_parse_dv_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt) stype = vs_pack[3] & 0x1f; pal = (vs_pack[3] >> 5) & 0x1; - if ((vsc_pack[2] & 0x07) == 0x02) + if ((vsc_pack[2] & 0x07) == 0x02) { sc->aspect_ratio = (AVRational){ 16, 9 }; - else + } else { sc->aspect_ratio = (AVRational){ 4, 3 }; + } sc->interlaced = (vsc_pack[3] >> 4) & 0x01; // TODO: fix dv encoder to set proper FF/FS value in VSC pack @@ -2097,7 +2098,7 @@ static int mxf_write_header(AVFormatContext *s) if (!s->nb_streams) return -1; - if (s->oformat == &ff_mxf_opatom_muxer && s->nb_streams !=1){ + if (s->oformat == &ff_mxf_opatom_muxer && s->nb_streams !=1) { av_log(s, AV_LOG_ERROR, "there must be exactly one stream for mxf opatom\n"); return -1; } @@ -2212,7 +2213,7 @@ static int mxf_write_header(AVFormatContext *s) } spf = ff_mxf_get_samples_per_frame(s, tbc); - if (!spf){ + if (!spf) { av_log(s, AV_LOG_ERROR, "Unsupported timecode frame rate %d/%d\n", tbc.den, tbc.num); return AVERROR(EINVAL); } @@ -2605,7 +2606,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf_write_random_index_pack(s); if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { - if (s->oformat == &ff_mxf_opatom_muxer){ + if (s->oformat == &ff_mxf_opatom_muxer) { /* rewrite body partition to update lengths */ avio_seek(pb, mxf->body_partition_offset[0], SEEK_SET); if ((err = mxf_write_opatom_body_partition(s)) < 0)