From patchwork Sat Apr 22 09:04:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Faiz X-Patchwork-Id: 3465 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp650651vsd; Sat, 22 Apr 2017 02:05:19 -0700 (PDT) X-Received: by 10.223.179.24 with SMTP id j24mr825631wrd.172.1492851919000; Sat, 22 Apr 2017 02:05:19 -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 g30si18167563wrb.133.2017.04.22.02.05.18; Sat, 22 Apr 2017 02:05:18 -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 sp=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 B2F1C689A22; Sat, 22 Apr 2017 12:05:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 74B0E68833F for ; Sat, 22 Apr 2017 12:05:08 +0300 (EEST) Received: by mail-it0-f67.google.com with SMTP id z67so3428832itb.0 for ; Sat, 22 Apr 2017 02:05:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IU438pX+xL46hQCzv8C7FU+Str1NvmRrXXi8himiKiM=; b=He9Lv698cOxuvPIXKbqA5MuukHo38IyujjSE4jKIY42nzG0MZaVJmwhzG914iF46YF UXPvypnFBhDw5vHmshbKE8w6+Xdk/SFQWeUy5S4YLVuS7N1PCC/alkWmM4s3nCu7t/up 0Z9rwCX0tW9kvhl804BrUIbm7OFxVWe0JUVB1O/0lcrRBm04lMTKvArpCn/5OT4ktQu7 ye3ra+qJcfgJiAPpPy6AT2vBHkaMVQBnkmSEK6l1+bb2T9HA6v5nYH6f3g7Fcgy1R74K Vfgcr7kiO5tcR5ps29dxrf2EvNUw/fP2bix3Uy860wXWmCyy8X2b86dRffS75lg9BGyf g2DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IU438pX+xL46hQCzv8C7FU+Str1NvmRrXXi8himiKiM=; b=BXED1u7N11YVf6jw5nwoYZF8T+W2D90+29wkJnqbx6W5X4KDPkbn0c1EFXM61gFybw UGlhLerIZ+wlkXiHVAoB9Tpb34dkY7Kp4EXQjFCQRcXmYd2Z+ghmbZWrKhkJ74bWJVvH ycCuLTXg62zUsbC/WR7DteKzyfmDrxfj9FEk+eiCFSryxscbB0pbSFe03byNDdLM1pj0 DhgTy2ZEHzFpDkwO5ZUHrqLy2TxaKIC4qH99qvM0O/9l54m83jXouZUjX39U/GVn2cBC 3GzcyxeCNiR+bT1lV1tadG2jcIXvT4cHlL21OKfs8Au0Z+mnvOERWAhJznFcw0ZorBch TYXw== X-Gm-Message-State: AN3rC/6uUpYU8H//C62MB7XPwooILjloAntvUC0ChcpHKRPCQBzsLGdd BL/4FJePwmSVZw== X-Received: by 10.84.148.203 with SMTP id y11mr20979176plg.10.1492851907242; Sat, 22 Apr 2017 02:05:07 -0700 (PDT) Received: from localhost.localdomain ([114.120.232.5]) by smtp.gmail.com with ESMTPSA id o10sm20296935pgc.18.2017.04.22.02.05.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 02:05:06 -0700 (PDT) From: Muhammad Faiz To: ffmpeg-devel@ffmpeg.org Date: Sat, 22 Apr 2017 16:04:26 +0700 Message-Id: <20170422090428.6459-5-mfcc64@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170422090428.6459-1-mfcc64@gmail.com> References: <20170422090428.6459-1-mfcc64@gmail.com> Subject: [FFmpeg-devel] [PATCH 5/7] ff*: do not use AVFrame accessor 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: Muhammad Faiz MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Muhammad Faiz --- ffmpeg.c | 10 +++++----- ffmpeg_filter.c | 2 +- ffplay.c | 24 ++++++++++++------------ ffprobe.c | 22 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 143322c..156cced 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1062,8 +1062,8 @@ static void do_video_out(OutputFile *of, !ost->filters && next_picture && ist && - lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) { - duration = lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)); + lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) { + duration = lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)); } if (!next_picture) { @@ -1506,7 +1506,7 @@ static int reap_filters(int flush) break; case AVMEDIA_TYPE_AUDIO: if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) && - enc->channels != av_frame_get_channels(filtered_frame)) { + enc->channels != filtered_frame->channels) { av_log(NULL, AV_LOG_ERROR, "Audio filter graph output is not normalized and encoder does not support parameter changes\n"); break; @@ -2118,7 +2118,7 @@ static void check_decode_result(InputStream *ist, int *got_output, int ret) exit_program(1); if (exit_on_error && *got_output && ist) { - if (av_frame_get_decode_error_flags(ist->decoded_frame) || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) { + if (ist->decoded_frame->decode_error_flags || (ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) { av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream %d\n", input_files[ist->file_index]->ctx->filename, ist->st->index); exit_program(1); } @@ -2447,7 +2447,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo } ist->hwaccel_retrieved_pix_fmt = decoded_frame->format; - best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame); + best_effort_timestamp= decoded_frame->best_effort_timestamp; if (ist->framerate.num) best_effort_timestamp = ist->cfr_next_pts++; diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index 219e473..896161a 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -1162,7 +1162,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) ifilter->sample_aspect_ratio = frame->sample_aspect_ratio; ifilter->sample_rate = frame->sample_rate; - ifilter->channels = av_frame_get_channels(frame); + ifilter->channels = frame->channels; ifilter->channel_layout = frame->channel_layout; if (frame->hw_frames_ctx) { diff --git a/ffplay.c b/ffplay.c index 763fd9e..139da9f 100644 --- a/ffplay.c +++ b/ffplay.c @@ -569,7 +569,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub) { ret = avcodec_receive_frame(d->avctx, frame); if (ret >= 0) { if (decoder_reorder_pts == -1) { - frame->pts = av_frame_get_best_effort_timestamp(frame); + frame->pts = frame->best_effort_timestamp; } else if (!decoder_reorder_pts) { frame->pts = frame->pkt_dts; } @@ -1981,11 +1981,11 @@ static int audio_thread(void *arg) tb = (AVRational){1, frame->sample_rate}; #if CONFIG_AVFILTER - dec_channel_layout = get_valid_channel_layout(frame->channel_layout, av_frame_get_channels(frame)); + dec_channel_layout = get_valid_channel_layout(frame->channel_layout, frame->channels); reconfigure = cmp_audio_fmts(is->audio_filter_src.fmt, is->audio_filter_src.channels, - frame->format, av_frame_get_channels(frame)) || + frame->format, frame->channels) || is->audio_filter_src.channel_layout != dec_channel_layout || is->audio_filter_src.freq != frame->sample_rate || is->auddec.pkt_serial != last_serial; @@ -1997,10 +1997,10 @@ static int audio_thread(void *arg) av_log(NULL, AV_LOG_DEBUG, "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n", is->audio_filter_src.freq, is->audio_filter_src.channels, av_get_sample_fmt_name(is->audio_filter_src.fmt), buf1, last_serial, - frame->sample_rate, av_frame_get_channels(frame), av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial); + frame->sample_rate, frame->channels, av_get_sample_fmt_name(frame->format), buf2, is->auddec.pkt_serial); is->audio_filter_src.fmt = frame->format; - is->audio_filter_src.channels = av_frame_get_channels(frame); + is->audio_filter_src.channels = frame->channels; is->audio_filter_src.channel_layout = dec_channel_layout; is->audio_filter_src.freq = frame->sample_rate; last_serial = is->auddec.pkt_serial; @@ -2019,7 +2019,7 @@ static int audio_thread(void *arg) goto the_end; af->pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb); - af->pos = av_frame_get_pkt_pos(frame); + af->pos = frame->pkt_pos; af->serial = is->auddec.pkt_serial; af->duration = av_q2d((AVRational){frame->nb_samples, frame->sample_rate}); @@ -2146,7 +2146,7 @@ static int video_thread(void *arg) #endif duration = (frame_rate.num && frame_rate.den ? av_q2d((AVRational){frame_rate.den, frame_rate.num}) : 0); pts = (frame->pts == AV_NOPTS_VALUE) ? NAN : frame->pts * av_q2d(tb); - ret = queue_picture(is, frame, pts, duration, av_frame_get_pkt_pos(frame), is->viddec.pkt_serial); + ret = queue_picture(is, frame, pts, duration, frame->pkt_pos, is->viddec.pkt_serial); av_frame_unref(frame); #if CONFIG_AVFILTER } @@ -2290,13 +2290,13 @@ static int audio_decode_frame(VideoState *is) frame_queue_next(&is->sampq); } while (af->serial != is->audioq.serial); - data_size = av_samples_get_buffer_size(NULL, av_frame_get_channels(af->frame), + data_size = av_samples_get_buffer_size(NULL, af->frame->channels, af->frame->nb_samples, af->frame->format, 1); dec_channel_layout = - (af->frame->channel_layout && av_frame_get_channels(af->frame) == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ? - af->frame->channel_layout : av_get_default_channel_layout(av_frame_get_channels(af->frame)); + (af->frame->channel_layout && af->frame->channels == av_get_channel_layout_nb_channels(af->frame->channel_layout)) ? + af->frame->channel_layout : av_get_default_channel_layout(af->frame->channels); wanted_nb_samples = synchronize_audio(is, af->frame->nb_samples); if (af->frame->format != is->audio_src.fmt || @@ -2311,13 +2311,13 @@ static int audio_decode_frame(VideoState *is) if (!is->swr_ctx || swr_init(is->swr_ctx) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n", - af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), av_frame_get_channels(af->frame), + af->frame->sample_rate, av_get_sample_fmt_name(af->frame->format), af->frame->channels, is->audio_tgt.freq, av_get_sample_fmt_name(is->audio_tgt.fmt), is->audio_tgt.channels); swr_free(&is->swr_ctx); return -1; } is->audio_src.channel_layout = dec_channel_layout; - is->audio_src.channels = av_frame_get_channels(af->frame); + is->audio_src.channels = af->frame->channels; is->audio_src.freq = af->frame->sample_rate; is->audio_src.fmt = af->frame->format; } diff --git a/ffprobe.c b/ffprobe.c index 72f5ed7..ce964e0 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2049,13 +2049,13 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, print_time("pkt_pts_time", frame->pts, &stream->time_base); print_ts ("pkt_dts", frame->pkt_dts); print_time("pkt_dts_time", frame->pkt_dts, &stream->time_base); - print_ts ("best_effort_timestamp", av_frame_get_best_effort_timestamp(frame)); - print_time("best_effort_timestamp_time", av_frame_get_best_effort_timestamp(frame), &stream->time_base); - print_duration_ts ("pkt_duration", av_frame_get_pkt_duration(frame)); - print_duration_time("pkt_duration_time", av_frame_get_pkt_duration(frame), &stream->time_base); - if (av_frame_get_pkt_pos (frame) != -1) print_fmt ("pkt_pos", "%"PRId64, av_frame_get_pkt_pos(frame)); + print_ts ("best_effort_timestamp", frame->best_effort_timestamp); + print_time("best_effort_timestamp_time", frame->best_effort_timestamp, &stream->time_base); + print_duration_ts ("pkt_duration", frame->pkt_duration); + print_duration_time("pkt_duration_time", frame->pkt_duration, &stream->time_base); + if (frame->pkt_pos != -1) print_fmt ("pkt_pos", "%"PRId64, frame->pkt_pos); else print_str_opt("pkt_pos", "N/A"); - if (av_frame_get_pkt_size(frame) != -1) print_val ("pkt_size", av_frame_get_pkt_size(frame), unit_byte_str); + if (frame->pkt_size != -1) print_val ("pkt_size", frame->pkt_size, unit_byte_str); else print_str_opt("pkt_size", "N/A"); switch (stream->codecpar->codec_type) { @@ -2086,18 +2086,18 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, if (s) print_str ("sample_fmt", s); else print_str_opt("sample_fmt", "unknown"); print_int("nb_samples", frame->nb_samples); - print_int("channels", av_frame_get_channels(frame)); - if (av_frame_get_channel_layout(frame)) { + print_int("channels", frame->channels); + if (frame->channel_layout) { av_bprint_clear(&pbuf); - av_bprint_channel_layout(&pbuf, av_frame_get_channels(frame), - av_frame_get_channel_layout(frame)); + av_bprint_channel_layout(&pbuf, frame->channels, + frame->channel_layout); print_str ("channel_layout", pbuf.str); } else print_str_opt("channel_layout", "unknown"); break; } if (do_show_frame_tags) - show_tags(w, av_frame_get_metadata(frame), SECTION_ID_FRAME_TAGS); + show_tags(w, frame->metadata, SECTION_ID_FRAME_TAGS); if (do_show_log) show_log(w, SECTION_ID_FRAME_LOGS, SECTION_ID_FRAME_LOG, do_show_log); if (frame->nb_side_data) {