Skip to content

play,player: Add missing nullable annotations

Somewhere last year we expected to trust nullability annotations in GStreamer-rs, but they don't seem to be complete yet. Following gstreamer-rs#300 (comment 895349) let's get this addressed. For these changes the diff in https://gitlab.freedesktop.org/MarijnS95/gstreamer-rs/-/compare/master...player-nonnull was used to find functions that change after removing all our overrides and trusting exactly what's written in gir. Note that these gir files were generated from 1.18.4 and may be somewhat incomplete. Thorough review and suggestions on the functions listed below is appreciated.

Unchanged

  • gst_player_color_balance_type_get_name: g_return_val_if_fail wasn't considered a valid NULL case. If the input argument is a valid enum variant (undoubtedly is in Rust, unlikely to get different library versions linked together) this function never returns NULL;
  • gst_player_error_get_name, gst_player_state_get_name: NULL is supposed to be unreachable;
  • gst_player_get_media_info: NULL should crash in the function body already.

Unknown

gst_play_media_info_copy/gst_play_stream_info_copy seem to indicate that all these are optional:

  • gst_player_media_info_get_container_format/gst_play_media_info_get_container_format;
  • gst_player_media_info_get_image_sample/gst_play_media_info_get_image_sample;
  • gst_player_media_info_get_tags/gst_play_media_info_get_tags;
  • gst_player_media_info_get_title/gst_play_media_info_get_title;
  • gst_player_stream_info_get_caps/gst_play_stream_info_get_caps;
  • gst_player_stream_info_get_codec/gst_play_stream_info_get_codec;
  • gst_player_stream_info_get_tags/gst_play_stream_info_get_tags
  • gst_player_subtitle_info_get_language/gst_play_subtitle_info_get_language.

CC @slomo

Edited by Marijn Suijten

Merge request reports

Loading