From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 50F55409BD for ; Wed, 2 Feb 2022 02:06:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D415368B341; Wed, 2 Feb 2022 04:06:50 +0200 (EET) Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 368CA68B267 for ; Wed, 2 Feb 2022 04:06:45 +0200 (EET) Received: by mail-oi1-f169.google.com with SMTP id r27so14895293oiw.4 for ; Tue, 01 Feb 2022 18:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to :references:from:subject:in-reply-to:content-transfer-encoding; bh=Ual87/B7/J5kOL3sdAh1o5tzWuWs5kZN/onwl49aHXs=; b=IzUDDwdB6GZV3t/ijqjba3AzrfTPq5aav8LPMIAFYciLOg2iHVjW6WpBpgOsBG2NiN 89m3e5NioCmp3jGPAkve5jroP1iXTiNTzQsvKRA3sk+H3IQ5vfrgJHzM0QnzEwDq9gDK /FotTfvYKwRE/BgaM5p6xXgOy0OcNcVbCrq1LE+ckFISDmExTonc+pa9ee8oVYKj1/7L 128LSfjcBqylrdOXG14CMHipsTsYa0L3CWR4nW4iAjreiVP/GpFN1X/0Lb2DguWMIiCJ 52z2wO27DrBuX2giNX577RJ2ODi7ZlMpxZWt0B7Fq+r9vYTXNQc0Er2UGAV//P5Juaww fdrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:references:from:subject:in-reply-to :content-transfer-encoding; bh=Ual87/B7/J5kOL3sdAh1o5tzWuWs5kZN/onwl49aHXs=; b=B9crK52nKI3GYykuorS9ohtIDzq6YibkHZtwNZnJk1/6KJIrJsDbC75SICcCOy69wa NKK902R0Vn3wbEKM6gke+IEvOSuzoLhd5/al7HZ9VGGNbKLlF5RrD+wq6gTOpJhwpYq5 q+4KSWiobKIe67/qQRdDNRuPuoKJ+yHGFqnczN5qDL65UaoY5LLV6IeAe/OKiGCv2xGb Dl+v/8Le5RnwFGSYT4dvr0dkJ5jvhU6gpuPuQ20X9IzwkkfTk/pPdkeKXLwyQ1Cyb39/ UU7facSgDXM7on19kej4dEMxkkoOSyUQU9SnEYdlw5QvpXJnHi+IQmtcTNGuhjZMuBL5 5Z0w== X-Gm-Message-State: AOAM531E8HHp949c8iCXTjC24N5KI5WSO2JiaEbFwIvAQAd33C+zpkTH uY7atf2wnawp9fvafyyxrkqpL16bB8Q= X-Google-Smtp-Source: ABdhPJw7gvoY+OGyqvGxUPWgpYGfk3b8sOZjsXhFqrqg90+vW1+Vdh3vlMPmLw42+oaS9n0Vb81AqQ== X-Received: by 2002:a05:6808:211f:: with SMTP id r31mr3014087oiw.194.1643767603120; Tue, 01 Feb 2022 18:06:43 -0800 (PST) Received: from [192.168.0.10] ([186.136.131.95]) by smtp.gmail.com with ESMTPSA id d65sm11999114otb.17.2022.02.01.18.06.41 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Feb 2022 18:06:42 -0800 (PST) Message-ID: <5653ed95-8318-d383-d2bd-bf60535743a8@gmail.com> Date: Tue, 1 Feb 2022 23:06:40 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220201223058.31090-1-scott.the.elm@gmail.com> <816bc1cd-db7c-2091-5b13-6c54560110e4@gmail.com> From: James Almer In-Reply-To: <816bc1cd-db7c-2091-5b13-6c54560110e4@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] lavu: make av_get_media_type_string() never return NULL 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/1/2022 10:58 PM, Scott Theisen wrote: > On 2/1/22 17:34, James Almer wrote: >> This is an API breakage, so it's not ok. > I'm new, so would this require a bump to the MINOR or MICRO version number? Making a behavior change like this requires a warning and a period to let library users adapt their code. You can't break it just like that with no warning at all. > >> The doxy states it returns NULL if media_type is unknown, so you're >> expected to check the returned pointer before trying to use it. > > git grep -E --count "av_get_media_type_string" > > doc/APIchanges:1 > doc/examples/demuxing_decoding.c:5 > doc/examples/extract_mvs.c:2 > fftools/cmdutils.c:1 > fftools/cmdutils.h:1 > fftools/ffmpeg.c:5 > fftools/ffmpeg_opt.c:1 > fftools/ffplay.c:2 > fftools/ffprobe.c:3 > libavcodec/avcodec.c:1 > libavcodec/tests/avcodec.c:1 > libavdevice/dshow.c:2 > libavfilter/avfilter.c:2 > libavfilter/avfiltergraph.c:2 > libavfilter/src_movie.c:3 > libavformat/avienc.c:1 > libavformat/flvenc.c:1 > libavformat/framehash.c:1 > libavformat/mov.c:1 > libavformat/mpegenc.c:1 > libavformat/mpegts.c:1 > libavformat/mxfdec.c:1 > libavformat/segment.c:1 > libavformat/tee.c:1 > libavformat/uncodedframecrcenc.c:1 > libavutil/avutil.h:1 > libavutil/utils.c:1 > > 44 total - 1 non-code - 1 prototype - 1 definition + 4 via macro - 1 > macro = 44 uses > > The following uses of av_get_media_type_string() do not check for null: > doc/examples/demuxing_decoding.c: 5 > doc/examples/extract_mvs.c: 2 > fftools/cmdutils.c: 2 via the define in cmdutils.h > fftools/ffmpeg.c: 7, 2 via the define in cmdutils.h > fftools/ffmpeg_opt.c:1 > fftools/ffplay.c:2 > libavfilter/avfiltergraph.c:2 > libavfilter/src_movie.c:3 > libavformat/flvenc.c:1 > libavformat/framehash.c:1 > libavformat/mov.c:1 > libavformat/mpegenc.c:1 > libavformat/mpegts.c:1 > libavformat/mxfdec.c:1 > libavformat/segment.c:1 > libavformat/tee.c:1 > > 32/44 uses do not check for null. But do they need to? Those modules have probably ensured media type is one of the known and supported ones by the time they call this function. Why do you need this function to never return NULL, anyway? If you know any of these calls where media type can be UNKNOWN, then it's easier to just fix them by checking for NULL as per the doxy. > > > libavcodec/tests/avcodec.c: this use is a workaround to > av_get_media_type_string() returning null; checked 3 times > > > Let me know which version number to bump and I will submit a new version > that also removes the now redundant null checks from the rest of the code. > > Thanks, > Scott > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".