From patchwork Sat Sep 10 02:07:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 505 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp597569vsd; Fri, 9 Sep 2016 19:08:23 -0700 (PDT) X-Received: by 10.194.200.198 with SMTP id ju6mr5543347wjc.184.1473473303552; Fri, 09 Sep 2016 19:08:23 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bs5si2089152wjc.252.2016.09.09.19.08.22; Fri, 09 Sep 2016 19:08:23 -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; 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 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 16DF1689E60; Sat, 10 Sep 2016 05:07:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oi0-f66.google.com (mail-oi0-f66.google.com [209.85.218.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5403A687ECE for ; Sat, 10 Sep 2016 05:07:48 +0300 (EEST) Received: by mail-oi0-f66.google.com with SMTP id 2so12870476oif.2 for ; Fri, 09 Sep 2016 19:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=IzkLBrY1ryzlb+ZmltnSUx+Oe/NuQcqd9ZehNQ4bO2o=; b=eIkuZBPZUQOMSXBy4ubCeo+nUF37meYEd8YjKjMgncw3N8AxOSw1u+FPDP6GT2YvVV JevqpZg+TT43ApgLtjNsDtSS2EhQKH93HuiKjbuwpTuQcOi9vZnC8mbMJlFqLXsz/+3F FUxHZEWjGK1BWG2hLMHke9o7dOg7TFc9RAo19lBRPe6Otrnah8xetvrbIG5H0p+SCFz1 Hkv0KoKi1gQSvmtulwfX+u+NjRiY4yJxaxzrVHkAnEJS1tQ2cJA+NqZ64/bcceabSGrg OL6yftGejVEDJVYDX62XTH3kIHD+3nVC1gfBSqnKqDqA0UnQ3GBUU5XrHFZzUwa+qiHR Nk/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=IzkLBrY1ryzlb+ZmltnSUx+Oe/NuQcqd9ZehNQ4bO2o=; b=bTvpvtAdNfO3A8ghfz2plneaT09B0PyLFjs0iXjunt+yp7AjCdQo/mIOrxYrLtxeww sqAiqNaWXYtPh1FvWlEdropGDI3A31n8BYKpk6r+dW+S0cvRH33mw3KXb23UVkkwa/+S QQMn//gid6EJrSGIXLC8c8CWUXqQUcaRl8HF7uXI2EOemeP6N3y6PyrIh7Rc7Y6ndFwm Jm3TL354neq1cUISTg0MGXnRQ4qf0Blq3JA3mKY/CqRgGAM57fbIT6F/sATJHdpz85Rt 8+ThVY8IVr7v6RB7j3S9QkXdNWtMtJY6Eqyd1OzN62W52Q2Lya4mfrOHFdyAm8TrYF7n q9SQ== X-Gm-Message-State: AE9vXwMplhnhO1LTf02yAbAlB4JnTc/zbx29e6fQPs/5qoCxwstMMTVFloE0iRA7zrc/eQ== X-Received: by 10.202.117.201 with SMTP id q192mr1211860oic.64.1473473277909; Fri, 09 Sep 2016 19:07:57 -0700 (PDT) Received: from Rodgers-MacBook-Pro.local.net (c-73-209-137-129.hsd1.il.comcast.net. [73.209.137.129]) by smtp.gmail.com with ESMTPSA id h63sm3271182ita.12.2016.09.09.19.07.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 09 Sep 2016 19:07:57 -0700 (PDT) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Sep 2016 21:07:32 -0500 Message-Id: <20160910020732.24359-3-rodger.combs@gmail.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160910020732.24359-1-rodger.combs@gmail.com> References: <20160910020732.24359-1-rodger.combs@gmail.com> Subject: [FFmpeg-devel] [PATCH 3/3] lavf/mov: reindent 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/mov.c | 158 +++++++++++++++++++++++++++--------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 22ca809..b387311 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4655,94 +4655,94 @@ static void mov_read_chapters(AVFormatContext *s) int chapter_track; for (j = 0; j < mov->nb_chapter_tracks; j++) { - chapter_track = mov->chapter_tracks[j]; - st = NULL; - for (i = 0; i < s->nb_streams; i++) - if (s->streams[i]->id == chapter_track) { - st = s->streams[i]; - break; + chapter_track = mov->chapter_tracks[j]; + st = NULL; + for (i = 0; i < s->nb_streams; i++) + if (s->streams[i]->id == chapter_track) { + st = s->streams[i]; + break; + } + if (!st) { + av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); + continue; } - if (!st) { - av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); - continue; - } - sc = st->priv_data; - cur_pos = avio_tell(sc->pb); - - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; - if (st->nb_index_entries) { - // Retrieve the first frame, if possible - AVPacket pkt; - AVIndexEntry *sample = &st->index_entries[0]; - if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { - av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n"); - goto finish; - } + sc = st->priv_data; + cur_pos = avio_tell(sc->pb); + + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; + if (st->nb_index_entries) { + // Retrieve the first frame, if possible + AVPacket pkt; + AVIndexEntry *sample = &st->index_entries[0]; + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n"); + goto finish; + } - if (av_get_packet(sc->pb, &pkt, sample->size) < 0) - goto finish; + if (av_get_packet(sc->pb, &pkt, sample->size) < 0) + goto finish; - st->attached_pic = pkt; - st->attached_pic.stream_index = st->index; - st->attached_pic.flags |= AV_PKT_FLAG_KEY; - } - } else { - st->codec->codec_type = AVMEDIA_TYPE_DATA; - st->codec->codec_id = AV_CODEC_ID_BIN_DATA; - st->discard = AVDISCARD_ALL; - for (i = 0; i < st->nb_index_entries; i++) { - AVIndexEntry *sample = &st->index_entries[i]; - int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; - uint8_t *title; - uint16_t ch; - int len, title_len; - - if (end < sample->timestamp) { - av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); - end = AV_NOPTS_VALUE; - } + st->attached_pic = pkt; + st->attached_pic.stream_index = st->index; + st->attached_pic.flags |= AV_PKT_FLAG_KEY; + } + } else { + st->codec->codec_type = AVMEDIA_TYPE_DATA; + st->codec->codec_id = AV_CODEC_ID_BIN_DATA; + st->discard = AVDISCARD_ALL; + for (i = 0; i < st->nb_index_entries; i++) { + AVIndexEntry *sample = &st->index_entries[i]; + int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; + uint8_t *title; + uint16_t ch; + int len, title_len; + + if (end < sample->timestamp) { + av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); + end = AV_NOPTS_VALUE; + } - if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { - av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); - goto finish; - } + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); + goto finish; + } - // the first two bytes are the length of the title - len = avio_rb16(sc->pb); - if (len > sample->size-2) - continue; - title_len = 2*len + 1; - if (!(title = av_mallocz(title_len))) - goto finish; - - // The samples could theoretically be in any encoding if there's an encd - // atom following, but in practice are only utf-8 or utf-16, distinguished - // instead by the presence of a BOM - if (!len) { - title[0] = 0; - } else { - ch = avio_rb16(sc->pb); - if (ch == 0xfeff) - avio_get_str16be(sc->pb, len, title, title_len); - else if (ch == 0xfffe) - avio_get_str16le(sc->pb, len, title, title_len); - else { - AV_WB16(title, ch); - if (len == 1 || len == 2) - title[len] = 0; - else - avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); + // the first two bytes are the length of the title + len = avio_rb16(sc->pb); + if (len > sample->size-2) + continue; + title_len = 2*len + 1; + if (!(title = av_mallocz(title_len))) + goto finish; + + // The samples could theoretically be in any encoding if there's an encd + // atom following, but in practice are only utf-8 or utf-16, distinguished + // instead by the presence of a BOM + if (!len) { + title[0] = 0; + } else { + ch = avio_rb16(sc->pb); + if (ch == 0xfeff) + avio_get_str16be(sc->pb, len, title, title_len); + else if (ch == 0xfffe) + avio_get_str16le(sc->pb, len, title, title_len); + else { + AV_WB16(title, ch); + if (len == 1 || len == 2) + title[len] = 0; + else + avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); + } + } + + avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); + av_freep(&title); } } - - avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); - av_freep(&title); - } - } finish: - avio_seek(sc->pb, cur_pos, SEEK_SET); + avio_seek(sc->pb, cur_pos, SEEK_SET); } }