mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
omxaudioenc: Add vfunc to get the number of samples inside a buffer
This commit is contained in:
parent
92545e554c
commit
d1e1980e01
2 changed files with 7 additions and 1 deletions
|
@ -446,6 +446,11 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
|
|||
flow_ret = GST_FLOW_OK;
|
||||
} else if (buf->omx_buf->nFilledLen > 0) {
|
||||
GstBuffer *outbuf;
|
||||
guint n_samples;
|
||||
|
||||
n_samples =
|
||||
klass->get_num_samples (self, self->out_port,
|
||||
&GST_BASE_AUDIO_ENCODER (self)->ctx->state, buf);
|
||||
|
||||
if (buf->omx_buf->nFilledLen > 0) {
|
||||
outbuf = gst_buffer_new_and_alloc (buf->omx_buf->nFilledLen);
|
||||
|
@ -470,7 +475,7 @@ gst_omx_audio_enc_loop (GstOMXAudioEnc * self)
|
|||
|
||||
flow_ret =
|
||||
gst_base_audio_encoder_finish_frame (GST_BASE_AUDIO_ENCODER (self),
|
||||
outbuf, 1024);
|
||||
outbuf, n_samples);
|
||||
}
|
||||
|
||||
if (flow_ret == GST_FLOW_OK && (buf->omx_buf->nFlags & OMX_BUFFERFLAG_EOS))
|
||||
|
|
|
@ -76,6 +76,7 @@ struct _GstOMXAudioEncClass
|
|||
|
||||
gboolean (*set_format) (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioState * state);
|
||||
GstCaps *(*get_caps) (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioState * state);
|
||||
guint (*get_num_samples) (GstOMXAudioEnc * self, GstOMXPort * port, GstAudioState * state, GstOMXBuffer * buffer);
|
||||
};
|
||||
|
||||
GType gst_omx_audio_enc_get_type (void);
|
||||
|
|
Loading…
Reference in a new issue