From patchwork Sat Nov 5 16:38:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 1311 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp372565vsb; Sat, 5 Nov 2016 09:39:25 -0700 (PDT) X-Received: by 10.28.168.137 with SMTP id r131mr2328348wme.16.1478363965545; Sat, 05 Nov 2016 09:39:25 -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 g142si2471052wmg.53.2016.11.05.09.39.24; Sat, 05 Nov 2016 09:39:25 -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 9E990689EB8; Sat, 5 Nov 2016 18:39:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from webmail.tpnet.fi (webmail.tpnet.fi [62.106.63.33]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 27FB1680C95 for ; Sat, 5 Nov 2016 18:39:11 +0200 (EET) Received: from mail.onse.fi (host-109-204-145-182.tp-fne.tampereenpuhelin.net [109.204.145.182]) by webmail.tpnet.fi (Postfix) with ESMTPS id 5037524CF4; Sat, 5 Nov 2016 18:39:14 +0200 (EET) Received: by mail.onse.fi (Postfix, from userid 501) id 3156440487; Sat, 5 Nov 2016 18:39:14 +0200 (EET) From: Anssi Hannula To: ffmpeg-devel@ffmpeg.org Date: Sat, 5 Nov 2016 18:38:59 +0200 Message-Id: <1478363940-21822-2-git-send-email-anssi.hannula@iki.fi> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478363940-21822-1-git-send-email-anssi.hannula@iki.fi> References: <2a3ab49d-6854-df7b-139c-cc5af823f7fb@googlemail.com> <1478363940-21822-1-git-send-email-anssi.hannula@iki.fi> Subject: [FFmpeg-devel] [PATCH 1/2] avformat/hls: Factor copying stream info to a separate function 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 Cc: Andreas Cadhalpun MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Anssi Hannula --- libavformat/hls.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index 3c09dd8..6fb652c 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1528,6 +1528,16 @@ static void add_stream_to_programs(AVFormatContext *s, struct playlist *pls, AVS av_dict_set_int(&stream->metadata, "variant_bitrate", bandwidth, 0); } +static void set_stream_info_from_input_stream(AVStream *st, struct playlist *pls, AVStream *ist) +{ + avcodec_parameters_copy(st->codecpar, ist->codecpar); + + if (pls->is_id3_timestamped) /* custom timestamps via id3 */ + avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE); + else + avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, ist->time_base.den); +} + /* add new subdemuxer streams to our context, if any */ static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *pls) { @@ -1540,13 +1550,7 @@ static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *p return AVERROR(ENOMEM); st->id = pls->index; - - avcodec_parameters_copy(st->codecpar, ist->codecpar); - - if (pls->is_id3_timestamped) /* custom timestamps via id3 */ - avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE); - else - avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, ist->time_base.den); + set_stream_info_from_input_stream(st, pls, ist); dynarray_add(&pls->main_streams, &pls->n_main_streams, st);