From patchwork Sat Jul 22 14:11:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42898 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be1d:b0:130:ccc6:6c4b with SMTP id ge29csp881194pzb; Sat, 22 Jul 2023 07:11:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlH7GRaW4QyQh8dYFj8VMw59V1MJ4CPsDO/TwyTVxuilVRzRErA+xdBGVai3tpuBGp+ns/n5 X-Received: by 2002:a17:906:74d6:b0:993:e695:b589 with SMTP id z22-20020a17090674d600b00993e695b589mr4218122ejl.20.1690035078145; Sat, 22 Jul 2023 07:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690035078; cv=none; d=google.com; s=arc-20160816; b=E1pVSTNBi06RQC8jr5m3CR+HUpNhHFfVZrORJ4jJ3LDcrjjpp7mNgxr31Vxt7QlJ68 K8dthJ0QjU3J0Em78SeNTe4BWIGzEBJEEh/pbSq4kyyG7MmGN4D4UoFuVJEtdCu4/dw2 bYxPOE2y3kyxERZgdzgvodNw+R8SOam3FPmrf0OLCAEDatVS/zQbVRHTDjadxKgxd3/N GoOqU2SVw4jD41iQ83vPjQ9IXR/vp/KHjY33BnhM/J07OnH5jVnoKa9qnMb5h2o3AwIk MGw6jT3uUROTSvTN9wBIVNhaVdNImCImss70TUVB8fZO8DdNT3FzGkSeOtOLzQtIsxEy +yPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=GAaeCO/Zl6KKCI51pwx57SnyhIFHX2yY+5+5YoQLeZo=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=aVY0d/c/urbaMsxxul/56C/R2xbs+Jr5qqS3QDxpSBtt0jqnmAvOwLd6CHGTM4hGTQ A9QokfXlXdvuBVPiDIoBUI9y15tjo8jRNLwNURLJrMEwYG6T0xmqOpYxfyH6NMdVG2j+ npNo1WiXdH2KLfM8kJjjuh3VLEpU1Z8h/PJaONQl7nImvrg2LOt2ZqFHmRwjsbRdtz6w cXZ/TfUUo4RlSHVeXYV0KuYVgU5Oey2WrccWajXDMa1kllWP6hLzgaTXVpCRycp3J9V5 2sklbgxr4apq9CV6RfSbL5i1lPJBeNhk/ENPNDOWFpCJ2/aLTz4ynS1yNI3Y5l9rikrB Ny3w== 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 s6-20020a1709067b8600b00993470737b9si3692858ejo.748.2023.07.22.07.11.17; Sat, 22 Jul 2023 07:11: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; 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 AC1AD68C564; Sat, 22 Jul 2023 17:11:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7BEBE68C28B for ; Sat, 22 Jul 2023 17:11:07 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 7D9C91BF203 for ; Sat, 22 Jul 2023 14:11:06 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 22 Jul 2023 16:11:00 +0200 Message-Id: <20230722141104.3327415-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avradio/vissualize: support simple skiping of chars X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: Q3CqIX+ZsVg/ Signed-off-by: Michael Niedermayer --- libavradio/vissualize.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libavradio/vissualize.c b/libavradio/vissualize.c index a3dcf5801b..2d397546dc 100644 --- a/libavradio/vissualize.c +++ b/libavradio/vissualize.c @@ -81,8 +81,11 @@ static void draw_char(uint8_t *frame_buffer, ptrdiff_t stride, char ch, int x0, } } -static void draw_string(uint8_t *frame_buffer, ptrdiff_t stride, char *str, int x0, int y0, int xd, int yd, int r, int g, int b, int w, int h) +static void draw_string(uint8_t *frame_buffer, ptrdiff_t stride, char *str, int x0, int y0, int xd, int yd, int r, int g, int b, int w, int h, int skipx) { + x0 += xd*9*skipx; + y0 += yd*9*skipx; + while(*str) { draw_char(frame_buffer, stride, *str++, x0, y0, xd, yd, r, g, b, w, h); x0 += xd*9; @@ -206,6 +209,7 @@ int ff_sdr_vissualization(SDRContext *sdr, AVStream *st, AVPacket *pkt) int color = s->stream ? 64 : 32; int size = s->stream ? 181 : 128; int xd = size, yd = size; + int pos; if (!s->in_station_list) continue; @@ -217,14 +221,14 @@ int ff_sdr_vissualization(SDRContext *sdr, AVStream *st, AVPacket *pkt) } av_strlcatf(text, sizeof(text), "%f Mhz %d %d %d", f/1000000, (int)s->score, ff_sdr_histogram_score(s), s->timeout); - draw_string(pkt->data, 4*w, text, xmid + 8*yd, 320*h2, xd, yd, color, color, color, w, h); + draw_string(pkt->data, 4*w, text, xmid + 8*yd, 320*h2, xd, yd, color, color, color, w, h, 0); if (s->radiotext[0]) { - draw_string(pkt->data, 4*w, s->radiotext, xmid + 8*yd, 320*h2 + 24*yd, xd, yd, color, color, color, w, h); + draw_string(pkt->data, 4*w, s->radiotext, xmid + 8*yd, 320*h2 + 24*yd, xd, yd, color, color, color, w, h, 0); } if (s->title[0] || s->artist[0]) { int len = strlen(s->title) + 1; - draw_string(pkt->data, 4*w, s->title , xmid + 8*yd, 320*h2 + 2*24*yd, xd, yd, color, color*1.5, color, w, h); - draw_string(pkt->data, 4*w, s->artist, xmid + 8*yd + 9*xd*len, 320*h2 + 2*24*yd + 9*yd*len, xd, yd, color, color*2, color, w, h); + draw_string(pkt->data, 4*w, s->title , xmid + 8*yd, 320*h2 + 2*24*yd, xd, yd, color, color*1.5, color, w, h, 0); + draw_string(pkt->data, 4*w, s->artist, xmid + 8*yd, 320*h2 + 2*24*yd, xd, yd, color, color*2, color, w, h, len); } } }