[FFmpeg-devel] [PATCH] avutil/pixdesc: add av_warn_unused_result to av_pix_fmt_get_chroma_sub_sample

Ganesh Ajjanagadde gajjanag at mit.edu
Thu Oct 29 23:35:56 CET 2015


On Thu, Oct 29, 2015 at 6:13 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Wed, Oct 28, 2015 at 11:03:33PM -0400, Ganesh Ajjanagadde wrote:
>> On Fri, Oct 16, 2015 at 5:17 PM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
>> > On Fri, Oct 16, 2015 at 11:39 AM, Michael Niedermayer
>> > <michael at niedermayer.cc> wrote:
>> >> On Thu, Oct 15, 2015 at 07:20:30PM -0400, Ganesh Ajjanagadde wrote:
>> >>> This will trigger a bunch of warnings (rightfully so). This API has been
>> >>> abused, see the Doxygen comment above for what to do if the error code
>> >>> is not meant to be checked.
>> >>>
>> >>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> >>> ---
>> >>>  libavutil/pixdesc.h | 1 +
>> >>>  1 file changed, 1 insertion(+)
>> >>>
>> >>> diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
>> >>> index a6056fe..975fbf2 100644
>> >>> --- a/libavutil/pixdesc.h
>> >>> +++ b/libavutil/pixdesc.h
>> >>> @@ -297,6 +297,7 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc);
>> >>>   *
>> >>>   * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
>> >>>   */
>> >>> +av_warn_unused_result
>> >>>  int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
>> >>>                                       int *h_shift, int *v_shift);
>> >>
>> >> if the caller knows the pixel format is valid (and non hw accel) then
>> >> there is no need to check the return code
>> >> in many cases this is true, like a decoder that set the pix_fmt itself
>> >> it can be sure all possible values are valid
>> >
>> > See the Doxygen right above (this is why I pointed to it in the commit
>> > message) - you are right, but for such "guaranteed safety" usage there
>> > is a different API in avcodec. It seems to have been created precisely
>> > for this purpose.
>>
>> ping; you don't find the above reasoning satisfying?
>
> avcodec_get_chroma_sub_sample() is part of libavcodec,
> av_pix_fmt_get_chroma_sub_sample is part of libavutil
>
> any code not depending on libavcodec cannot use
> avcodec_get_chroma_sub_sample(), an example might be filters in
> libavfilter which dont otherwise depend on libavcodec

Thanks for the explanation, patch dropped.

>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Freedom in capitalist society always remains about the same as it was in
> ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list