Merge commit '4a58223e4c824fedc024af435337a769e8ce593e' into 0.11

This commit is contained in:
Tim-Philipp Müller 2011-11-28 21:20:10 +00:00
commit 0c056a04fe
5 changed files with 48 additions and 8 deletions

View file

@ -197,7 +197,8 @@ static GstClockTime
gst_alsasrc_get_timestamp (GstAlsaSrc * src)
{
snd_pcm_status_t *status;
snd_htimestamp_t tstamp;
snd_htimestamp_t htstamp;
snd_timestamp_t tstamp;
GstClockTime timestamp;
snd_pcm_uframes_t availmax;
gint64 offset;
@ -221,8 +222,19 @@ gst_alsasrc_get_timestamp (GstAlsaSrc * src)
}
/* get high resolution time stamp from driver */
snd_pcm_status_get_htstamp (status, &tstamp);
timestamp = GST_TIMESPEC_TO_TIME (tstamp);
snd_pcm_status_get_htstamp (status, &htstamp);
timestamp = GST_TIMESPEC_TO_TIME (htstamp);
if (timestamp == 0) {
GST_INFO_OBJECT (src,
"This alsa source does support high resolution timestamps");
snd_pcm_status_get_tstamp (status, &tstamp);
timestamp = GST_TIMEVAL_TO_TIME (tstamp);
if (timestamp == 0) {
GST_INFO_OBJECT (src,
"This alsa source does support low resolution timestamps");
timestamp = gst_util_get_timestamp ();
}
}
GST_DEBUG_OBJECT (src, "Base ts: %" GST_TIME_FORMAT,
GST_TIME_ARGS (timestamp));
if (timestamp == 0) {

View file

@ -744,6 +744,27 @@ again:
return ret;
}
/**
* gst_audio_decoder_finish_frame:
* @dec: a #GstAudioDecoder
* @buf: decoded data
* @frames: number of decoded frames represented by decoded data
*
* Collects decoded data and pushes it downstream.
*
* @buf may be NULL in which case the indicated number of frames
* are discarded and considered to have produced no output
* (e.g. lead-in or setup frames).
* Otherwise, source pad caps must be set when it is called with valid
* data in @buf.
*
* Note that a frame received in gst_audio_decoder_handle_frame() may be
* invalidated by a call to this function.
*
* Returns: a #GstFlowReturn that should be escalated to caller (of caller)
*
* Since: 0.10.36
*/
GstFlowReturn
gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
gint frames)
@ -827,15 +848,15 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
frames--;
}
if (G_UNLIKELY (!buf))
goto exit;
/* lock on */
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (priv->base_ts))) {
priv->base_ts = ts;
GST_DEBUG_OBJECT (dec, "base_ts now %" GST_TIME_FORMAT, GST_TIME_ARGS (ts));
}
if (G_UNLIKELY (!buf))
goto exit;
/* slightly convoluted approach caters for perfect ts if subclass desires */
if (GST_CLOCK_TIME_IS_VALID (ts)) {
if (dec->priv->tolerance > 0) {

View file

@ -174,7 +174,9 @@ struct _GstAudioDecoder
* frames as defined by audio format.
* @handle_frame: Provides input data (or NULL to clear any remaining data)
* to subclass. Input data ref management is performed by
* base class, subclass should not care or intervene.
* base class, subclass should not care or intervene,
* and input data is only valid until next call to base class,
* most notably a call to gst_audio_decoder_finish_frame().
* @flush: Optional.
* Instructs subclass to clear any codec caches and discard
* any pending samples and not yet returned encoded data.

View file

@ -465,6 +465,9 @@ gst_audio_encoder_finalize (GObject * object)
* are considered discarded, e.g. as a result of discontinuous transmission,
* and a discontinuity is marked.
*
* Note that samples received in gst_audio_encoder_handle_frame()
* may be invalidated by a call to this function.
*
* Returns: a #GstFlowReturn that should be escalated to caller (of caller)
*
* Since: 0.10.36

View file

@ -133,7 +133,9 @@ struct _GstAudioEncoder {
* @handle_frame: Provides input samples (or NULL to clear any remaining data)
* according to directions as configured by the subclass
* using the API. Input data ref management is performed
* by base class, subclass should not care or intervene.
* by base class, subclass should not care or intervene,
* and input data is only valid until next call to base class,
* most notably a call to gst_audio_encoder_finish_frame().
* @flush: Optional.
* Instructs subclass to clear any codec caches and discard
* any pending samples and not yet returned encoded data.