GST_FORMAT_UNITS -> GST_FORMAT_DEFAULT conversion
authorDavid Schleef <ds@schleef.org>
Wed, 28 May 2003 06:25:39 +0000 (06:25 +0000)
committerDavid Schleef <ds@schleef.org>
Wed, 28 May 2003 06:25:39 +0000 (06:25 +0000)
Original commit message from CVS:
GST_FORMAT_UNITS -> GST_FORMAT_DEFAULT conversion

common
ext/alsa/gstalsa.c

diff --git a/common b/common
index 54aa761..9a3a505 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 54aa761f9d486bca3ee35029a110386a144340c5
+Subproject commit 9a3a505fcc52865de0bedbb3ee1ce0a6dcc9a025
index a8e12bc..6238b2c 100644 (file)
@@ -1678,7 +1678,7 @@ gst_alsa_get_formats (GstPad *pad)
 {
   static const GstFormat formats[] = {
     GST_FORMAT_TIME,
-    GST_FORMAT_UNITS,
+    GST_FORMAT_DEFAULT,
     GST_FORMAT_BYTES,
     0
   };
@@ -1696,8 +1696,7 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
 {
   gboolean res = TRUE;
 
-  if (src_format == *dest_format || (src_format == GST_FORMAT_UNITS && *dest_format == GST_FORMAT_DEFAULT)) {
-    *dest_format = GST_FORMAT_UNITS;
+  if (src_format == *dest_format) {
     *dest_value = src_value;
     return TRUE;
   }
@@ -1708,13 +1707,11 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
     case GST_FORMAT_BYTES:
       switch (*dest_format) {
         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:
          *dest_value = gst_alsa_bytes_to_timestamp (this, (guint) src_value);
           break;
-        case GST_FORMAT_UNITS:
-         *dest_value = gst_alsa_samples_to_timestamp (this, (guint) src_value);
-          break;
         default:
           res = FALSE;
          break;
@@ -1723,8 +1720,6 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
     case GST_FORMAT_TIME:
       switch (*dest_format) {
         case GST_FORMAT_DEFAULT:
-          *dest_format = GST_FORMAT_UNITS;
-        case GST_FORMAT_UNITS:
          *dest_value = gst_alsa_timestamp_to_samples (this, (GstClockTime) src_value);
           break;
         case GST_FORMAT_BYTES:
@@ -1735,7 +1730,7 @@ gst_alsa_convert (GstAlsa *this, GstFormat src_format, gint64 src_value,
          break;
       }
       break;
-    case GST_FORMAT_UNITS:
+    case GST_FORMAT_DEFAULT:
       switch (*dest_format) {    
         case GST_FORMAT_TIME:
          *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: {
       snd_pcm_sframes_t delay;
       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;
     }
     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;
     default:
       break;