GST_FORMAT_UNITS -> GST_FORMAT_DEFAULT conversion

Original commit message from CVS:
GST_FORMAT_UNITS -> GST_FORMAT_DEFAULT conversion
This commit is contained in:
David Schleef 2003-05-28 06:25:39 +00:00
parent 460d987e0c
commit f460018c84
2 changed files with 8 additions and 13 deletions

2
common

@ -1 +1 @@
Subproject commit 54aa761f9d486bca3ee35029a110386a144340c5 Subproject commit 9a3a505fcc52865de0bedbb3ee1ce0a6dcc9a025

View file

@ -1678,7 +1678,7 @@ gst_alsa_get_formats (GstPad *pad)
{ {
static const GstFormat formats[] = { static const GstFormat formats[] = {
GST_FORMAT_TIME, GST_FORMAT_TIME,
GST_FORMAT_UNITS, GST_FORMAT_DEFAULT,
GST_FORMAT_BYTES, GST_FORMAT_BYTES,
0 0
}; };
@ -1696,8 +1696,7 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
{ {
gboolean res = TRUE; gboolean res = TRUE;
if (src_format == *dest_format || (src_format == GST_FORMAT_UNITS && *dest_format == GST_FORMAT_DEFAULT)) { if (src_format == *dest_format) {
*dest_format = GST_FORMAT_UNITS;
*dest_value = src_value; *dest_value = src_value;
return TRUE; return TRUE;
} }
@ -1708,13 +1707,11 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_UNITS; *dest_value = gst_alsa_bytes_to_samples (this, (guint) src_value);
break;
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*dest_value = gst_alsa_bytes_to_timestamp (this, (guint) src_value); *dest_value = gst_alsa_bytes_to_timestamp (this, (guint) src_value);
break; break;
case GST_FORMAT_UNITS:
*dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value);
break;
default: default:
res = FALSE; res = FALSE;
break; break;
@ -1723,8 +1720,6 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
*dest_format = GST_FORMAT_UNITS;
case GST_FORMAT_UNITS:
*dest_value = gst_alsa_timestamp_to_samples (this, (GstClockTime) src_value); *dest_value = gst_alsa_timestamp_to_samples (this, (GstClockTime) src_value);
break; break;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
@ -1735,7 +1730,7 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
break; break;
} }
break; break;
case GST_FORMAT_UNITS: case GST_FORMAT_DEFAULT:
switch (*dest_format) { switch (*dest_format) {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
*dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value); *dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value);
@ -1777,11 +1772,11 @@ gst_alsa_query_func (GstElement *element, GstQueryType type, GstFormat *format,
case GST_QUERY_LATENCY: { case GST_QUERY_LATENCY: {
snd_pcm_sframes_t delay; snd_pcm_sframes_t delay;
ERROR_CHECK (snd_pcm_delay (this->handle, &delay), "Error getting delay: %s"); ERROR_CHECK (snd_pcm_delay (this->handle, &delay), "Error getting delay: %s");
res = gst_alsa_convert (this, GST_FORMAT_UNITS, (gint64) delay, format, value); res = gst_alsa_convert (this, GST_FORMAT_DEFAULT, (gint64) delay, format, value);
break; break;
} }
case GST_QUERY_POSITION: case GST_QUERY_POSITION:
res = gst_alsa_convert (this, GST_FORMAT_UNITS, this->transmitted, format, value); res = gst_alsa_convert (this, GST_FORMAT_DEFAULT, this->transmitted, format, value);
break; break;
default: default:
break; break;