int media_format_get_type(media_format_h fmt, media_format_type_e *formattype)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(formattype);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
- if (!formattype)
- return MEDIA_FORMAT_ERROR_INVALID_PARAMETER;
-
if (CHECK_IS_AUDIO(fmt_handle->mimetype))
*formattype = MEDIA_FORMAT_AUDIO;
else if (CHECK_IS_VIDEO(fmt_handle->mimetype))
int media_format_get_container_mime(media_format_h fmt, media_format_mimetype_e *mimetype)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(mimetype);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
return MEDIA_FORMAT_ERROR_INVALID_PARAMETER;
}
- if (mimetype)
- *mimetype = fmt_handle->mimetype;
+ *mimetype = fmt_handle->mimetype;
return MEDIA_FORMAT_ERROR_NONE;
}
int media_format_get_text_info(media_format_h fmt, media_format_mimetype_e *mimetype, media_format_text_type_e *type)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(mimetype || type);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_get_video_info(media_format_h fmt, media_format_mimetype_e *mimetype, int *width, int *height, int *avg_bps, int *max_bps)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(mimetype || width || height || avg_bps || max_bps);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_get_audio_info(media_format_h fmt, media_format_mimetype_e *mimetype, int *channel, int *samplerate, int *bit, int *avg_bps)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(mimetype || channel || samplerate || bit || avg_bps);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_get_audio_aac_type(media_format_h fmt, bool *is_adts)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(is_adts);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
return MEDIA_FORMAT_ERROR_INVALID_OPERATION;
}
- if (is_adts)
- *is_adts = fmt_handle->detail.audio.is_adts;
+ *is_adts = fmt_handle->detail.audio.is_adts;
return MEDIA_FORMAT_ERROR_NONE;
}
int media_format_get_audio_aac_header_type(media_format_h fmt, media_format_aac_header_type_e *aac_header_type)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(aac_header_type);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
return MEDIA_FORMAT_ERROR_INVALID_OPERATION;
}
- if (aac_header_type)
- *aac_header_type = fmt_handle->detail.audio.aac_header_type;
+ *aac_header_type = fmt_handle->detail.audio.aac_header_type;
return MEDIA_FORMAT_ERROR_NONE;
}
int media_format_get_video_frame_rate(media_format_h fmt, int *frame_rate)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(frame_rate);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
return MEDIA_FORMAT_ERROR_INVALID_OPERATION;
}
- if (frame_rate)
- *frame_rate = fmt_handle->detail.video.frame_rate;
+ *frame_rate = fmt_handle->detail.video.frame_rate;
return MEDIA_FORMAT_ERROR_NONE;
}
int media_format_is_writable(media_format_h fmt, bool *is_writable)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(is_writable);
+
if (MEDIA_FORMAT_GET_REFCOUNT(fmt) <= 0) {
LOGE("The format ref_count is less than 0..\n."); //LCOV_EXCL_LINE
return MEDIA_FORMAT_ERROR_INVALID_OPERATION;
int media_format_make_writable(media_format_h fmt, media_format_h *out_fmt)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(out_fmt);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
return MEDIA_FORMAT_ERROR_NONE;
}
-int media_format_set_extra(media_format_h fmt, void *extra)
+int media_format_set_extra(media_format_h fmt, void *extra) /* is it nullable? */
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
int media_format_get_extra(media_format_h fmt, void **extra)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(extra);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
- if (extra)
- *extra = fmt_handle->extradata;
+ *extra = fmt_handle->extradata;
return MEDIA_FORMAT_ERROR_NONE;
}
int media_format_get_audio_channel_mask(media_format_h fmt, uint64_t *channel_mask)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(channel_mask);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_is_little_endian(media_format_h fmt, bool *is_little_endian)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(is_little_endian);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_get_audio_bit_depth(media_format_h fmt, int *bit_depth)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
+ MEDIA_FORMAT_NULL_ARG_CHECK(bit_depth);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_channel_positions_from_mask(media_format_h fmt, uint64_t channel_mask, media_format_channel_position_e **position)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
- MEDIA_FORMAT_INSTANCE_CHECK(*position);
+ MEDIA_FORMAT_NULL_ARG_CHECK(position);
media_format_s *fmt_handle;
fmt_handle = (media_format_s *)fmt;
int media_format_channel_positions_to_mask(media_format_h fmt, const media_format_channel_position_e *position, uint64_t *channel_mask_out)
{
MEDIA_FORMAT_INSTANCE_CHECK(fmt);
- MEDIA_FORMAT_INSTANCE_CHECK(position);
+ MEDIA_FORMAT_NULL_ARG_CHECK(position);
+ MEDIA_FORMAT_NULL_ARG_CHECK(channel_mask_out);
int i, j;
uint64_t channel_mask = 0;
}
if (fmt_handle->detail.audio.channel == 1 && position[0] == MEDIA_FORMAT_CHANNEL_POSITION_MONO) {
- if (channel_mask_out)
- *channel_mask_out = 0;
+ *channel_mask_out = 0;
return MEDIA_FORMAT_ERROR_NONE;
}
if (fmt_handle->detail.audio.channel > 0 && position[0] == MEDIA_FORMAT_CHANNEL_POSITION_NONE) {
- if (channel_mask_out)
- *channel_mask_out = 0;
+ *channel_mask_out = 0;
return MEDIA_FORMAT_ERROR_NONE;
}
channel_mask |= (G_GUINT64_CONSTANT(1) << position[i]);
}
- if (channel_mask_out)
- *channel_mask_out = channel_mask;
+ *channel_mask_out = channel_mask;
return MEDIA_FORMAT_ERROR_NONE;
}