From patchwork Sat Feb 10 01:57:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Eugen Hoyos X-Patchwork-Id: 7540 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp1471912jai; Fri, 9 Feb 2018 17:57:53 -0800 (PST) X-Google-Smtp-Source: AH8x224Mn8Zhg58gj/NNQCllcCN8J/wnH5JsbeYB1iGzvV1rrYaT7g6e5Fy8Ym6ufPisIZFlmfkB X-Received: by 10.223.168.120 with SMTP id l111mr4233785wrc.118.1518227873751; Fri, 09 Feb 2018 17:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518227873; cv=none; d=google.com; s=arc-20160816; b=FebqmMttbS0f/quCor7ShwFwtu9LkRmkrDQCtroSRK3Z4eZ65a8ISiLEfRFbbgAFb9 AYi7lkHS1PpIcvAAIR8cMuw3tlPkUFxMIM6vvnPoAP+Kp/TCU6mdwtDO3+WXuwYAGog/ CF/lG8qIFBawIDn9Djnpc+9OJ0vjzWB13Y6j50pbWdIP/L66Szb5689HCCP59RnECxGE lm0Se9g6A0IwNc0DwZ++lkomSTm/sJUlQT1VeoL8GRNg5KGyPQRasyTddVzqdeJkSBOe haHoq7IDinONC/urPP6wwhxwuV/SPgvsIwizxdWOE1ePZjKohgSgQta0rchfILJu1Xkz 40Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to :arc-authentication-results; bh=F6D2h+604j5zscc8LMutwmQ4JEq0/GJop5sUeB6rSgM=; b=jppvla1KWAAEljwD4RBL86+IK89F4tzAvff8HWcVCFLKdc7tekKfTpucha07TuCJ8p g4VvUKGWC6UTaZ3iAJ7dOwx7tszz1FD9gJPj5LN/X2udESACFsBzwpU/V80xj3qfaRNn yVafoBjYshBBF8zYE3U38g5RKyq0WuAK6ujGiZKAhdogBSdfshOT9YOPaeFVuMCvSpvh 6m5IYSqYLNE4Ko40xYc/eVxmBGoCTqLTjnZzBlPC6oEwRp7JoCj4LNbEZSr2BusKGLW3 Vfq3a3U9b0Iq+8KnX7xuaig38HJezxG1pabS+eZ8e+QEIGUG4UO6vOX/bYboYqKDxy2u NfZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=Vy+dFCFp; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p203si244946wmb.197.2018.02.09.17.57.52; Fri, 09 Feb 2018 17:57:53 -0800 (PST) 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 header.s=20161025 header.b=Vy+dFCFp; 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=QUARANTINE 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 9ACC868834A; Sat, 10 Feb 2018 03:57:41 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f49.google.com (mail-it0-f49.google.com [209.85.214.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B1D18680A68 for ; Sat, 10 Feb 2018 03:57:34 +0200 (EET) Received: by mail-it0-f49.google.com with SMTP id x128so601901ite.0 for ; Fri, 09 Feb 2018 17:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=O6f7YQd8o0bH8VaBGFZoLROKDPzSVQ12JI9yzzNWMZ0=; b=Vy+dFCFphWW/CcaI74Lmt9zuF9Ki/oPuoPjuZm3H2sSoko5wW+5Ac+gM0yP9d4OVdF aInXEGYzDRPbVGBMX5LxUG9haubHFDNmw7+mekNDRhsrfhIFQwy8fzp4Nv1C4rnU7imh JwsHkfvpwGgxd9v19+x1edOjb+DIXjT3JYiCi/KolNtPWcQbTojqzIp3TAgkN0uVZF+z JtQzFIkfTXhfzU0QZjq3sj+tYNfGgQMb+7DlyccQeBIFyipJrx+8ULhcvHZO55xur4Pb ta6goDPIvKbkoiUZJSm8ePNbQAUPlPyADeVlzUst46KBbuT24bjSY9GkKIoK19D4DRG7 8Ciw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=O6f7YQd8o0bH8VaBGFZoLROKDPzSVQ12JI9yzzNWMZ0=; b=ftUnGfxbjZpWkPyqAsEJh3VaqtheSXYkSuIv5ZtMBZpoDxhhlg/tTVUNWTiFHYqZwB DDlHZCgX6mRlpwMcQXarwkP4iygX1JO7twJz9tOKZ574f4+s+CgAutVwPx+SycCQIH5r wjI39DwffPOA2PcMKClCM+4SPqcZoFbcT70djzu92Wg0Lwr4vND8+sSGv3m6E1HI3VtN QRE0gNLdJJYNWx3Rw7JcEs846hG0hOo/xF2w3uPtO0bozpj8KrEgASHZ5g+ccUKbkVMI 4WU4SuJQoSAXj/TnakUUGhVz6cVnYJqrV8DnjP3YEc6alQ0zumfnXpdQcYV6mhT2ZaTw ns7Q== X-Gm-Message-State: APf1xPBAckUIGJsBbw95/y6JwfqFhUBGb35kgfH4jEMR8kfZe/tuO0BH L0uv4HPgzmQlyaN7d5fO+PsO0Ezj4BqK4TfpZG3BkQ== X-Received: by 10.36.162.13 with SMTP id j13mr6225755itf.74.1518227862999; Fri, 09 Feb 2018 17:57:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.130.68 with HTTP; Fri, 9 Feb 2018 17:57:22 -0800 (PST) From: Carl Eugen Hoyos Date: Sat, 10 Feb 2018 02:57:22 +0100 Message-ID: To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH]lavf/rtpdec: Constify several pointers 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Hi! Attached patch fixes two warnings. libavformat/rtpdec.c: In function ‘ff_rtp_handler_find_by_name’: libavformat/rtpdec.c:155:20: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] return handler; ^~~~~~~ libavformat/rtpdec.c: In function ‘ff_rtp_handler_find_by_id’: libavformat/rtpdec.c:168:20: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] return handler; ^~~~~~~ Please comment, Carl Eugen From b0383afe16c62fcb0fbc7ea49168edd2f26ac0aa Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 10 Feb 2018 02:54:42 +0100 Subject: [PATCH] lavf/rtpdec: Constify several pointers. Fixes two warnings: libavformat/rtpdec.c:155:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] libavformat/rtpdec.c:168:20: warning: return discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] --- libavformat/rdt.c | 2 +- libavformat/rdt.h | 2 +- libavformat/rtpdec.c | 6 +++--- libavformat/rtpdec.h | 6 +++--- libavformat/rtsp.c | 8 ++++---- libavformat/rtsp.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 31a32ff..60c36f0 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -53,7 +53,7 @@ struct RDTDemuxContext { RDTDemuxContext * ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, - void *priv_data, RTPDynamicProtocolHandler *handler) + void *priv_data, const RTPDynamicProtocolHandler *handler) { RDTDemuxContext *s = av_mallocz(sizeof(RDTDemuxContext)); if (!s) diff --git a/libavformat/rdt.h b/libavformat/rdt.h index 2480565..67fb308 100644 --- a/libavformat/rdt.h +++ b/libavformat/rdt.h @@ -41,7 +41,7 @@ typedef struct RDTDemuxContext RDTDemuxContext; RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic, int first_stream_of_set_idx, void *priv_data, - RTPDynamicProtocolHandler *handler); + const RTPDynamicProtocolHandler *handler); void ff_rdt_parse_close(RDTDemuxContext *s); /** diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index 6499e27..e75a34c 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -143,7 +143,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque) return r; } -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, +const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, enum AVMediaType codec_type) { void *i = 0; @@ -157,7 +157,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, return NULL; } -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, +const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, enum AVMediaType codec_type) { void *i = 0; @@ -572,7 +572,7 @@ RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, } void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, - RTPDynamicProtocolHandler *handler) + const RTPDynamicProtocolHandler *handler) { s->dynamic_protocol_context = ctx; s->handler = handler; diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h index fe726a6..5a47d6f 100644 --- a/libavformat/rtpdec.h +++ b/libavformat/rtpdec.h @@ -43,7 +43,7 @@ typedef struct RTPDemuxContext RTPDemuxContext; RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_type, int queue_size); void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, - RTPDynamicProtocolHandler *handler); + const RTPDynamicProtocolHandler *handler); void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite, const char *params); int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, @@ -208,7 +208,7 @@ const RTPDynamicProtocolHandler *ff_rtp_handler_iterate(void **opaque); * @param name name of the requested rtp dynamic protocol handler * @return A rtp dynamic protocol handler if one was found, NULL otherwise. */ -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, +const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, enum AVMediaType codec_type); /** * Find a registered rtp dynamic protocol handler with a matching codec ID. @@ -216,7 +216,7 @@ RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, * @param id AVCodecID of the requested rtp dynamic protocol handler. * @return A rtp dynamic protocol handler if one was found, NULL otherwise. */ -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, +const RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, enum AVMediaType codec_type); /* from rtsp.c, but used by rtp dynamic protocol handlers. */ diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index b3cfbb8..ceb770a 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -211,7 +211,7 @@ static int get_sockaddr(AVFormatContext *s, } #if CONFIG_RTPDEC -static void init_rtp_handler(RTPDynamicProtocolHandler *handler, +static void init_rtp_handler(const RTPDynamicProtocolHandler *handler, RTSPStream *rtsp_st, AVStream *st) { AVCodecParameters *par = st ? st->codecpar : NULL; @@ -271,7 +271,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s, } if (par->codec_id == AV_CODEC_ID_NONE) { - RTPDynamicProtocolHandler *handler = + const RTPDynamicProtocolHandler *handler = ff_rtp_handler_find_by_name(buf, par->codec_type); init_rtp_handler(handler, rtsp_st, st); /* If no dynamic handler was found, check with the list of standard @@ -495,7 +495,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, if (CONFIG_RTPDEC && !rt->ts) rt->ts = avpriv_mpegts_parse_open(s); } else { - RTPDynamicProtocolHandler *handler; + const RTPDynamicProtocolHandler *handler; handler = ff_rtp_handler_find_by_id( rtsp_st->sdp_payload_type, AVMEDIA_TYPE_DATA); init_rtp_handler(handler, rtsp_st, NULL); @@ -513,7 +513,7 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1, rtsp_st->stream_index = st->index; st->codecpar->codec_type = codec_type; if (rtsp_st->sdp_payload_type < RTP_PT_PRIVATE) { - RTPDynamicProtocolHandler *handler; + const RTPDynamicProtocolHandler *handler; /* if standard payload type, we can find the codec right now */ ff_rtp_get_codec_info(st->codecpar, rtsp_st->sdp_payload_type); if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h index 36fdae4..9a7f366 100644 --- a/libavformat/rtsp.h +++ b/libavformat/rtsp.h @@ -458,7 +458,7 @@ typedef struct RTSPStream { /** The following are used for dynamic protocols (rtpdec_*.c/rdt.c) */ //@{ /** handler structure */ - RTPDynamicProtocolHandler *dynamic_handler; + const RTPDynamicProtocolHandler *dynamic_handler; /** private data associated with the dynamic protocol */ PayloadContext *dynamic_protocol_context; -- 1.7.10.4