Updates for API changes
authorJan Schmidt <thaytan@mad.scientist.com>
Wed, 23 Nov 2005 13:25:54 +0000 (13:25 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Wed, 23 Nov 2005 13:25:54 +0000 (13:25 +0000)
Original commit message from CVS:
* ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
(gst_visual_chain):
* ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
* gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
(gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
(gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
(gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
Updates for API changes

ChangeLog
ext/libvisual/visual.c
ext/theora/theoraenc.c
gst/videorate/gstvideorate.c
gst/videotestsrc/gstvideotestsrc.c
sys/v4l/gstv4lmjpegsrc.c
sys/v4l/v4lsrc_calls.c

index eb24d83..ecca23c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-11-23  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * ext/libvisual/visual.c: (gst_visual_src_setcaps), (get_buffer),
+       (gst_visual_chain):
+       * ext/theora/theoraenc.c: (theora_enc_sink_setcaps):
+       * gst/videorate/gstvideorate.c: (gst_videorate_setcaps),
+       (gst_videorate_chain):
+       * gst/videotestsrc/gstvideotestsrc.c:
+       (gst_videotestsrc_src_fixate), (gst_videotestsrc_create):
+       * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_get_fps),
+       (gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query),
+       (gst_v4lmjpegsrc_get), (gst_v4lmjpegsrc_getcaps):
+       * sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_get_fps),
+       (gst_v4lsrc_get_fps_list), (gst_v4lsrc_buffer_new):
+         Updates for API changes
+
 2005-11-23  Wim Taymans  <wim@fluendo.com>
 
        * gst-libs/gst/audio/gstbaseaudiosink.c:
index e33a309..7ec513b 100644 (file)
@@ -271,7 +271,6 @@ gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
   GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
   GstStructure *structure;
   gint depth;
-  const GValue *fps;
 
   structure = gst_caps_get_structure (caps, 0);
 
@@ -281,13 +280,10 @@ gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
     return FALSE;
   if (!gst_structure_get_int (structure, "bpp", &depth))
     return FALSE;
-  fps = gst_structure_get_value (structure, "framerate");
-  if (fps == NULL || !GST_VALUE_HOLDS_FRACTION (fps))
+  if (!gst_structure_get_fraction (structure, "framerate", &visual->fps_n,
+          &visual->fps_d))
     return FALSE;
 
-  visual->fps_n = gst_value_get_fraction_numerator (fps);
-  visual->fps_d = gst_value_get_fraction_denominator (fps);
-
   visual_video_set_depth (visual->video,
       visual_video_depth_enum_from_value (depth));
   visual_video_set_dimension (visual->video, visual->width, visual->height);
@@ -318,7 +314,6 @@ get_buffer (GstVisual * visual, GstBuffer ** outbuf)
     gint width, height, bpp;
     GstStructure *s;
     GstCaps *caps;
-    GValue target_fps = { 0 };
 
     /* No output caps current set up. Try and pick some */
     caps = gst_pad_get_allowed_caps (visual->srcpad);
@@ -337,9 +332,7 @@ get_buffer (GstVisual * visual, GstBuffer ** outbuf)
 
       gst_structure_fixate_field_nearest_int (s, "width", 320);
       gst_structure_fixate_field_nearest_int (s, "height", 240);
-      g_value_init (&target_fps, GST_TYPE_FRACTION);
-      gst_value_set_fraction (&target_fps, 25, 1);
-      gst_structure_fixate_field_nearest_fraction (s, "framerate", &target_fps);
+      gst_structure_fixate_field_nearest_fraction (s, "framerate", 25, 1);
 
       gst_pad_fixate_caps (visual->srcpad, caps);
     } else
@@ -423,7 +416,7 @@ gst_visual_chain (GstPad * pad, GstBuffer * buffer)
       visual_actor_run (visual->actor, &visual->audio);
 
       GST_BUFFER_TIMESTAMP (outbuf) = visual->next_ts;
-      GST_BUFFER_DURATION (outbuf) = gst_util_clock_time_scale (GST_SECOND,
+      GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale_int (GST_SECOND,
           visual->fps_d, visual->fps_n);
       visual->next_ts += GST_BUFFER_DURATION (outbuf);
       ret = gst_pad_push (visual->srcpad, outbuf);
index 43c757c..4aabdbc 100644 (file)
@@ -244,11 +244,11 @@ theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
   GstStructure *structure = gst_caps_get_structure (caps, 0);
   GstTheoraEnc *enc = GST_THEORA_ENC (gst_pad_get_parent (pad));
   const GValue *par;
-  const GValue *framerate;
+  gint fps_n, fps_d;
 
   gst_structure_get_int (structure, "width", &enc->width);
   gst_structure_get_int (structure, "height", &enc->height);
-  framerate = gst_structure_get_value (structure, "framerate");
+  gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d);
   par = gst_structure_get_value (structure, "pixel-aspect-ratio");
 
   theora_info_init (&enc->info);
@@ -271,9 +271,8 @@ theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
   enc->info.offset_x = enc->offset_x;
   enc->info.offset_y = enc->offset_y;
 
-  enc->info.fps_numerator = gst_value_get_fraction_numerator (framerate);
-  enc->info.fps_denominator = gst_value_get_fraction_denominator (framerate);
-
+  enc->info.fps_numerator = fps_n;
+  enc->info.fps_denominator = fps_d;
   if (par) {
     enc->info.aspect_numerator = gst_value_get_fraction_numerator (par);
     enc->info.aspect_denominator = gst_value_get_fraction_denominator (par);
index f785073..0a17329 100644 (file)
@@ -263,19 +263,15 @@ gst_videorate_setcaps (GstPad * pad, GstCaps * caps)
   GstStructure *structure;
   gboolean ret = TRUE;
   GstPad *otherpad, *opeer;
-  const GValue *rate;
   gint rate_numerator, rate_denominator;
 
   videorate = GST_VIDEORATE (GST_PAD_PARENT (pad));
 
   structure = gst_caps_get_structure (caps, 0);
-  rate = gst_structure_get_value (structure, "framerate");
-  if (!rate)
+  if (!gst_structure_get_fraction (structure, "framerate",
+          &rate_numerator, &rate_denominator))
     goto done;
 
-  rate_numerator = gst_value_get_fraction_numerator (rate);
-  rate_denominator = gst_value_get_fraction_denominator (rate);
-
   if (pad == videorate->srcpad) {
     videorate->to_rate_numerator = rate_numerator;
     videorate->to_rate_denominator = rate_denominator;
@@ -324,12 +320,10 @@ gst_videorate_setcaps (GstPad * pad, GstCaps * caps)
 
       /* and fixate */
       gst_structure_fixate_field_nearest_fraction (structure, "framerate",
-          rate);
-
-      rate = gst_structure_get_value (structure, "framerate");
+          rate_numerator, rate_denominator);
 
-      rate_numerator = gst_value_get_fraction_numerator (rate);
-      rate_denominator = gst_value_get_fraction_denominator (rate);
+      gst_structure_get_fraction (structure, "framerate",
+          &rate_numerator, &rate_denominator);
 
       if (otherpad == videorate->srcpad) {
         videorate->to_rate_numerator = rate_numerator;
@@ -510,7 +504,7 @@ gst_videorate_chain (GstPad * pad, GstBuffer * buffer)
         if (videorate->to_rate_numerator) {
           videorate->next_ts =
               videorate->first_ts +
-              gst_util_clock_time_scale (videorate->out * GST_SECOND,
+              gst_util_uint64_scale_int (videorate->out * GST_SECOND,
               videorate->to_rate_denominator, videorate->to_rate_numerator);
           GST_BUFFER_DURATION (outbuf) =
               videorate->next_ts - GST_BUFFER_TIMESTAMP (outbuf);
index f26c69d..dfd0f9e 100644 (file)
@@ -173,16 +173,12 @@ static void
 gst_videotestsrc_src_fixate (GstPad * pad, GstCaps * caps)
 {
   GstStructure *structure;
-  GValue value = { 0 };
-
-  g_value_init (&value, GST_TYPE_FRACTION);
-  gst_value_set_fraction (&value, 30, 1);
 
   structure = gst_caps_get_structure (caps, 0);
 
   gst_structure_fixate_field_nearest_int (structure, "width", 320);
   gst_structure_fixate_field_nearest_int (structure, "height", 240);
-  gst_structure_fixate_field_nearest_fraction (structure, "framerate", &value);
+  gst_structure_fixate_field_nearest_fraction (structure, "framerate", 30, 1);
 }
 
 static void
@@ -459,13 +455,13 @@ gst_videotestsrc_create (GstPushSrc * psrc, GstBuffer ** buffer)
 
   GST_BUFFER_TIMESTAMP (outbuf) = src->timestamp_offset + src->running_time;
   if (src->rate_numerator != 0) {
-    GST_BUFFER_DURATION (outbuf) = gst_util_clock_time_scale (GST_SECOND,
+    GST_BUFFER_DURATION (outbuf) = gst_util_uint64_scale_int (GST_SECOND,
         src->rate_denominator, src->rate_numerator);
   }
 
   src->n_frames++;
   if (src->rate_numerator != 0) {
-    src->running_time = gst_util_clock_time_scale (src->n_frames * GST_SECOND,
+    src->running_time = gst_util_uint64_scale_int (src->n_frames * GST_SECOND,
         src->rate_denominator, src->rate_numerator);
   }
 
index c4f2429..288be3d 100644 (file)
@@ -330,7 +330,7 @@ gst_v4lmjpegsrc_src_convert (GstPad * pad,
     case GST_FORMAT_DEFAULT:
       switch (*dest_format) {
         case GST_FORMAT_TIME:
-          *dest_value = src_value * gst_util_clock_time_scale (GST_SECOND,
+          *dest_value = src_value * gst_util_uint64_scale_int (GST_SECOND,
               gst_value_get_fraction_denominator (&fps),
               gst_value_get_fraction_numerator (&fps));
           break;
@@ -363,7 +363,7 @@ gst_v4lmjpegsrc_src_query (GstPad * pad,
     case GST_QUERY_POSITION:
       switch (*format) {
         case GST_FORMAT_TIME:
-          *value = v4lmjpegsrc->handled * gst_util_clock_time_scale (GST_SECOND,
+          *value = v4lmjpegsrc->handled * gst_util_uint64_scale_int (GST_SECOND,
               gst_value_get_fraction_denominator (&fps),
               gst_value_get_fraction_numerator (&fps));
           break;
@@ -519,11 +519,11 @@ gst_v4lmjpegsrc_get (GstPad * pad)
 
   if (v4lmjpegsrc->use_fixed_fps) {
     g_value_init (&fps, GST_VALUE_FRACTION);
-    duration = gst_util_clock_time_scale (GST_SECOND,
+    duration = gst_util_uint64_scale_int (GST_SECOND,
         gst_value_get_fraction_denominator (&fps),
         gst_value_get_fraction_numerator (&fps));
     cur_frame_time =
-        gst_util_clock_time_scale (v4lmjpegsrc->handled * GST_SECOND,
+        gst_util_uint64_scale_int (v4lmjpegsrc->handled * GST_SECOND,
         gst_value_get_fraction_denominator (&fps),
         gst_value_get_fraction_numerator (&fps));
 
index 18f07d7..b51d40a 100644 (file)
@@ -713,7 +713,7 @@ gst_v4lsrc_buffer_new (GstV4lSrc * v4lsrc, gint num)
   GST_BUFFER_TIMESTAMP (buf) -= GST_ELEMENT (v4lsrc)->base_time;
   /* FIXME: this is a most ghetto timestamp/duration */
 
-  GST_BUFFER_DURATION (buf) = gst_util_clock_time_scale (GST_SECOND,
+  GST_BUFFER_DURATION (buf) = gst_util_uint64_scale_int (GST_SECOND,
       fps_n, fps_d);
 
   /* the negotiate() method already set caps on the source pad */