From patchwork Fri Jun 12 14:31:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20312 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 86587449555 for ; Fri, 12 Jun 2020 17:32:35 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6488E68B66B; Fri, 12 Jun 2020 17:32:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E696E68AF26 for ; Fri, 12 Jun 2020 17:32:28 +0300 (EEST) Received: by mail-pl1-f196.google.com with SMTP id n2so3797017pld.13 for ; Fri, 12 Jun 2020 07:32:28 -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; bh=cAI948lxBSJA0PHSw/AYYT8EfGVlU2y0EYB6Pik7Avc=; b=rynvAkvRzxfWSq0pb6/+X+8zRy06IB1SsWWlUo2m60vE58mEFboMfTsQ4FwtYzxAP5 MXAf04pQr24BEqgYgIRqOhZAtI5WZCLWU0af98pxyhKnPices11VLU6sGjv9+X8cV9y+ Kfdo2PAULlZWc8YeDSEpxA2lnJUakcJQJjn6ac9zyE6yOWqs9wZh6ECfWfnpW7iSMcjC LEIkKZAR/Y3NOOa33tczPQ1VVkkw6OuFxIMwVRhAZJD2HUnFqqC5w0W+AXsDNvpPVYve BcDjq7lqQZq7LoHO7Ga38da2lHWK93RlHpjHNQYbWfub/cqYDQ/6aioqY6BqO1cuymXR SgCA== 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; bh=cAI948lxBSJA0PHSw/AYYT8EfGVlU2y0EYB6Pik7Avc=; b=AhxD3+HS764KdbJSnUn8UqwKE5IklVBkhK6LblcQHZ/b1e8N5Y3WCuNpY7eo5PaIrN UTRyIKVz878UZuYeZwtv3SnNcADDohukJst/yii8s2l/UfW+rJ6Y50E0J47jfsDRlYs5 pgOlzK1peWexAvl+AW2MSh294Gg95nBS0JaKAfNMnIQrx6fck+hBS0PY6CXRLdxekD7u iNMLVBZWkTenXWmnURGdEW0q/h9mexN+U8KXmlK0f1GpX8osrTaF9o9eh8rSgl3nGqK8 XWxRKGiGX8A1XRESKf5+wChkRuKVaDSh9uCjzg0vfJLC6v65TTFYAdgcWdnFTMZkjzDd Klag== X-Gm-Message-State: AOAM533w5lLbicmIkVhnU9GQwTcZfhPZkf70aYFQiilcr7u0UF6S2F8g 1jcjFxT6V3p/09L0i7WWhATpk4U4 X-Google-Smtp-Source: ABdhPJyGImcvidvu5jXVa3GqQ6H7hCKggj/YhPrSGQiFhZVy789SZPtXC0Zf8hoy8JHxXylAHWPRBg== X-Received: by 2002:a17:90b:3614:: with SMTP id ml20mr12747022pjb.41.1591972346579; Fri, 12 Jun 2020 07:32:26 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id p30sm5453323pgn.58.2020.06.12.07.32.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2020 07:32:26 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Jun 2020 22:31:56 +0800 Message-Id: <1591972317-29664-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/2] avformat/dvenc: return error code of dv_assemble_frame() 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavformat/dvenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index c71e532..b04d604 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -406,9 +406,10 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt) fsize = dv_assemble_frame(s, s->priv_data, s->streams[pkt->stream_index], pkt->data, pkt->size, &frame); - if (fsize > 0) { - avio_write(s->pb, frame, fsize); + if (fsize < 0) { + return fsize; } + avio_write(s->pb, frame, fsize); return 0; } From patchwork Fri Jun 12 14:31:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 20313 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8797F44A292 for ; Fri, 12 Jun 2020 17:33:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66D2B68B68A; Fri, 12 Jun 2020 17:33:09 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 521C968B5B3 for ; Fri, 12 Jun 2020 17:33:03 +0300 (EEST) Received: by mail-pl1-f171.google.com with SMTP id j4so562299plk.3 for ; Fri, 12 Jun 2020 07:33:03 -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=LMWoYjFeUnd56WA0dNryDpdkzNqiZYZIIZUy0IgkvVk=; b=SdiJ7f02IvPdbZ0LYGZ8iOxn1xD361pzWAhiq8DCTXvmj6TsNDphZUydodinVUFy4v aSeN2UAj7G6aZs/Pg5KKhRCm8W3r2c3XpYRXbCwb9+VmZzhL6P6kuoH/xaLfoiIVpejK 4BWVJH9uAGRxWLzSBpLJLkIBT8OiuTICukCUzEtMTmg9wUj7ZaV53s9vI7X6wWrfB/as Z7YR2ZyzyzbNRTDvB3ykn/07zmnRJrpIYWH6yeY3+rEER0I5V8jmnhoq4rqYmzyjjqXp aIOri9exSCW7cHA0UpsD7D1hDQiwl+ADOD1+1AQoY2JGfCmGPIGDm/wjxmdk2RmKAUD0 16ng== 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=LMWoYjFeUnd56WA0dNryDpdkzNqiZYZIIZUy0IgkvVk=; b=Nx5lKbBjs0Yk91QqgSHxwmhwdUn0rmq6A72cbj9V66RgqTgN73RwxUrwJ42Qm7hSH1 i5KO4F6qYpdLa1T0oQb+ql/FrwFmxiEVF3muP33T2kXBTURVSeb7AbuIFCvOg3tQIfGP lzbJSGZ9bVxqIc7r7KPzHe5W1WGG3ANcLF9AN2m1/AdK71Fqi0ecijAldY1LMU140ApI O797BVpRS9wLINEhCRN8P7i5pkzw7pybGna7iaSZ1PGcBLjetGpAzVZasJp+f0fMb5hs c25a0oM4EhfhizQa4rUwAplnIo+eBAgfEwj2lewNxXD6NgFpZuutfFU00hIKkbJLU8PY TyuA== X-Gm-Message-State: AOAM530lNxu4ojNAMlDccfl+DQ2Oyyfi4367YfLKg9AhSExvgVd5HuVp I59+8Xrcgt0To45oBv+ZjwIDiLY/ X-Google-Smtp-Source: ABdhPJyseWPNit6hYib5t6o9MmfCSJv1JBPDEZRKw0DZBicwwdwmZFmr6o8LBYzjBMCOph+CNMmnFg== X-Received: by 2002:a17:902:6bc1:: with SMTP id m1mr11943159plt.158.1591972381253; Fri, 12 Jun 2020 07:33:01 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id p30sm5453323pgn.58.2020.06.12.07.32.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jun 2020 07:33:00 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Fri, 12 Jun 2020 22:31:57 +0800 Message-Id: <1591972317-29664-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1591972317-29664-1-git-send-email-lance.lmwang@gmail.com> References: <1591972317-29664-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/2] avfilter: add D2TS, TS2D, TS2T as a common macro in internal.h 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: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/aeval.c | 2 -- libavfilter/af_volume.c | 4 ---- libavfilter/f_select.c | 3 --- libavfilter/f_sendcmd.c | 3 --- libavfilter/internal.h | 4 ++++ libavfilter/setpts.c | 4 ---- libavfilter/vf_delogo.c | 1 - libavfilter/vf_eq.c | 2 -- libavfilter/vf_hue.c | 3 --- libavfilter/vf_rotate.c | 2 -- libavfilter/vf_scale.c | 2 -- libavfilter/vf_vignette.c | 3 --- 12 files changed, 4 insertions(+), 29 deletions(-) diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 32cd6de..855dc00 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -416,8 +416,6 @@ static int aeval_config_output(AVFilterLink *outlink) return 0; } -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb)) - static int filter_frame(AVFilterLink *inlink, AVFrame *in) { EvalContext *eval = inlink->dst->priv; diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c index 213c571..5fc00d8 100644 --- a/libavfilter/af_volume.c +++ b/libavfilter/af_volume.c @@ -335,10 +335,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar return ret; } -#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb)) - static int filter_frame(AVFilterLink *inlink, AVFrame *buf) { AVFilterContext *ctx = inlink->dst; diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 755e10a..92938c3 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -325,9 +325,6 @@ static double get_concatdec_select(AVFrame *frame, int64_t pts) return NAN; } -#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) - static void select_frame(AVFilterContext *ctx, AVFrame *frame) { SelectContext *select = ctx->priv; diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c index 0ac87e0..6b02669 100644 --- a/libavfilter/f_sendcmd.c +++ b/libavfilter/f_sendcmd.c @@ -475,9 +475,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->intervals); } -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb)) - static int filter_frame(AVFilterLink *inlink, AVFrame *ref) { AVFilterContext *ctx = inlink->dst; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index abe7537..6cb601f 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -234,6 +234,10 @@ void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts void ff_command_queue_pop(AVFilterContext *filter); +#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) +#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) +#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) + /* misc trace functions */ #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func) diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c index c7c3836..6506653 100644 --- a/libavfilter/setpts.c +++ b/libavfilter/setpts.c @@ -142,10 +142,6 @@ static int config_input(AVFilterLink *inlink) return 0; } -#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d)) -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb)) - #define BUF_SIZE 64 static inline char *double2int64str(char *buf, double v) diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index e55673d..6069c30 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -55,7 +55,6 @@ enum var_name { VAR_T, VAR_VARS_NB }; -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) static int set_expr(AVExpr **pexpr, const char *expr, const char *option, void *log_ctx) { diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c index c8c3d5b..114781f 100644 --- a/libavfilter/vf_eq.c +++ b/libavfilter/vf_eq.c @@ -249,8 +249,6 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_formats(ctx, fmts_list); } -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) - static int filter_frame(AVFilterLink *inlink, AVFrame *in) { AVFilterContext *ctx = inlink->dst; diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c index b75ef21..1499c05 100644 --- a/libavfilter/vf_hue.c +++ b/libavfilter/vf_hue.c @@ -363,9 +363,6 @@ static void apply_lut10(HueContext *s, } } -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) - static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) { HueContext *hue = inlink->dst->priv; diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c index 02f56c6..65c6cc4 100644 --- a/libavfilter/vf_rotate.c +++ b/libavfilter/vf_rotate.c @@ -415,8 +415,6 @@ static av_always_inline void simple_rotate(uint8_t *dst, const uint8_t *src, int } } -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb)) - static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) { ThreadData *td = arg; diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index f92529e..ff69bb1 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -647,8 +647,6 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s out,out_stride); } -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) - static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out) { AVFilterContext *ctx = link->dst; diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c index 47b59e5..ecb04a9 100644 --- a/libavfilter/vf_vignette.c +++ b/libavfilter/vf_vignette.c @@ -155,9 +155,6 @@ static double get_natural_factor(const VignetteContext *s, int x, int y) } } -#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)) -#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb)) - static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *frame) { int x, y;