mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 05:06:17 +00:00
Merge commit '4a58223e4c824fedc024af435337a769e8ce593e' into 0.11
This commit is contained in:
commit
0c056a04fe
5 changed files with 48 additions and 8 deletions
|
@ -197,7 +197,8 @@ static GstClockTime
|
||||||
gst_alsasrc_get_timestamp (GstAlsaSrc * src)
|
gst_alsasrc_get_timestamp (GstAlsaSrc * src)
|
||||||
{
|
{
|
||||||
snd_pcm_status_t *status;
|
snd_pcm_status_t *status;
|
||||||
snd_htimestamp_t tstamp;
|
snd_htimestamp_t htstamp;
|
||||||
|
snd_timestamp_t tstamp;
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
snd_pcm_uframes_t availmax;
|
snd_pcm_uframes_t availmax;
|
||||||
gint64 offset;
|
gint64 offset;
|
||||||
|
@ -221,8 +222,19 @@ gst_alsasrc_get_timestamp (GstAlsaSrc * src)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get high resolution time stamp from driver */
|
/* get high resolution time stamp from driver */
|
||||||
snd_pcm_status_get_htstamp (status, &tstamp);
|
snd_pcm_status_get_htstamp (status, &htstamp);
|
||||||
timestamp = GST_TIMESPEC_TO_TIME (tstamp);
|
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_DEBUG_OBJECT (src, "Base ts: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (timestamp));
|
GST_TIME_ARGS (timestamp));
|
||||||
if (timestamp == 0) {
|
if (timestamp == 0) {
|
||||||
|
|
|
@ -744,6 +744,27 @@ again:
|
||||||
return ret;
|
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
|
GstFlowReturn
|
||||||
gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
||||||
gint frames)
|
gint frames)
|
||||||
|
@ -827,15 +848,15 @@ gst_audio_decoder_finish_frame (GstAudioDecoder * dec, GstBuffer * buf,
|
||||||
frames--;
|
frames--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (G_UNLIKELY (!buf))
|
||||||
|
goto exit;
|
||||||
|
|
||||||
/* lock on */
|
/* lock on */
|
||||||
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (priv->base_ts))) {
|
if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (priv->base_ts))) {
|
||||||
priv->base_ts = ts;
|
priv->base_ts = ts;
|
||||||
GST_DEBUG_OBJECT (dec, "base_ts now %" GST_TIME_FORMAT, GST_TIME_ARGS (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 */
|
/* slightly convoluted approach caters for perfect ts if subclass desires */
|
||||||
if (GST_CLOCK_TIME_IS_VALID (ts)) {
|
if (GST_CLOCK_TIME_IS_VALID (ts)) {
|
||||||
if (dec->priv->tolerance > 0) {
|
if (dec->priv->tolerance > 0) {
|
||||||
|
|
|
@ -174,7 +174,9 @@ struct _GstAudioDecoder
|
||||||
* frames as defined by audio format.
|
* frames as defined by audio format.
|
||||||
* @handle_frame: Provides input data (or NULL to clear any remaining data)
|
* @handle_frame: Provides input data (or NULL to clear any remaining data)
|
||||||
* to subclass. Input data ref management is performed by
|
* 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.
|
* @flush: Optional.
|
||||||
* Instructs subclass to clear any codec caches and discard
|
* Instructs subclass to clear any codec caches and discard
|
||||||
* any pending samples and not yet returned encoded data.
|
* any pending samples and not yet returned encoded data.
|
||||||
|
|
|
@ -465,6 +465,9 @@ gst_audio_encoder_finalize (GObject * object)
|
||||||
* are considered discarded, e.g. as a result of discontinuous transmission,
|
* are considered discarded, e.g. as a result of discontinuous transmission,
|
||||||
* and a discontinuity is marked.
|
* 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)
|
* Returns: a #GstFlowReturn that should be escalated to caller (of caller)
|
||||||
*
|
*
|
||||||
* Since: 0.10.36
|
* Since: 0.10.36
|
||||||
|
|
|
@ -133,7 +133,9 @@ struct _GstAudioEncoder {
|
||||||
* @handle_frame: Provides input samples (or NULL to clear any remaining data)
|
* @handle_frame: Provides input samples (or NULL to clear any remaining data)
|
||||||
* according to directions as configured by the subclass
|
* according to directions as configured by the subclass
|
||||||
* using the API. Input data ref management is performed
|
* 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.
|
* @flush: Optional.
|
||||||
* Instructs subclass to clear any codec caches and discard
|
* Instructs subclass to clear any codec caches and discard
|
||||||
* any pending samples and not yet returned encoded data.
|
* any pending samples and not yet returned encoded data.
|
||||||
|
|
Loading…
Reference in a new issue