From: Sebastian Dröge Date: Wed, 17 Aug 2011 11:03:50 +0000 (+0200) Subject: omxaudioenc: Add vfunc to get the number of samples inside a buffer X-Git-Tag: 1.19.3~501^2~926 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d1e1980e011661db481d89a70f1c695144d76cbc;p=platform%2Fupstream%2Fgstreamer.git omxaudioenc: Add vfunc to get the number of samples inside a buffer --- diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index aad2861..10699b5 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -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)) diff --git a/omx/gstomxaudioenc.h b/omx/gstomxaudioenc.h index 11ebcaf..0918e5f 100644 --- a/omx/gstomxaudioenc.h +++ b/omx/gstomxaudioenc.h @@ -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);