mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 04:05:34 +00:00
audio: add GST_AUDIO_INFO_IS_VALID macro and use in audio decoder base class
API: GST_AUDIO_INFO_IS_VALID
This commit is contained in:
parent
12aab2cdcc
commit
cd21e69913
2 changed files with 5 additions and 0 deletions
|
@ -250,6 +250,8 @@ struct _GstAudioInfo {
|
|||
GstAudioChannelPosition position[64];
|
||||
};
|
||||
|
||||
#define GST_AUDIO_INFO_IS_VALID(i) ((i)->finfo != NULL && (i)->rate > 0 && (i)->channels > 0 && (i)->bpf > 0)
|
||||
|
||||
#define GST_AUDIO_INFO_FORMAT(i) (GST_AUDIO_FORMAT_INFO_FORMAT((i)->finfo))
|
||||
#define GST_AUDIO_INFO_NAME(i) (GST_AUDIO_FORMAT_INFO_NAME((i)->finfo))
|
||||
#define GST_AUDIO_INFO_WIDTH(i) (GST_AUDIO_FORMAT_INFO_WIDTH((i)->finfo))
|
||||
|
|
|
@ -722,6 +722,9 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
|||
priv = dec->priv;
|
||||
ctx = &dec->priv->ctx;
|
||||
|
||||
/* must know the output format by now */
|
||||
g_return_val_if_fail (GST_AUDIO_INFO_IS_VALID (&ctx->info), GST_FLOW_ERROR);
|
||||
|
||||
GST_LOG_OBJECT (dec, "accepting %d bytes == %d samples for %d frames",
|
||||
buf ? GST_BUFFER_SIZE (buf) : -1,
|
||||
buf ? GST_BUFFER_SIZE (buf) / ctx->info.bpf : -1, frames);
|
||||
|
|
Loading…
Reference in a new issue