Re: GStreamer 0.01



On Thu, 2005-05-26 at 19:05 +0200, Torsten Schoenfeld wrote:

The GStreamer bindings will probably have to depend on Math::BigInt  
for these numbers.

The perl-xs guys suggested converting numbers to/from PVs (Perl strings)
and tell users to use Math::BigInt for calculations.  I'll see if this
works out.

I just committed an initial implementation of that approach.  The
converters look like this:

  SV *
  newSVGstInt64 (gint64 value)
  {
        char string[100];
        STRLEN length;
        SV *sv;

        /* newSVpvf doesn't seem to work correctly. */
        length = sprintf(string, "%lli", value);
        sv = newSVpv (string, length);

        return sv;
  }

  gint64
  SvGstInt64 (SV *sv)
  {
        return atoll (SvPV_nolen (sv));
  }

  SV *
  newSVGstUInt64 (guint64 value)
  {
        char string[100];
        STRLEN length;
        SV *sv;

        /* newSVpvf doesn't seem to work correctly. */
        length = sprintf(string, "%llu", value);
        sv = newSVpv (string, length);

        return sv;
  }

  guint64
  SvGstUInt64 (SV *sv)
  {
        return atoll (SvPV_nolen (sv));
  }

In my minimal testing, it seems to work.  It doesn't look like you need
Math::BigInt to do calculations with these numbers.  This worked for me:

  Glib::Timeout -> add(5000, sub {
    my ($format, $pos) = $spider -> query("position", "time");

    $sink -> seek([qw/method-set flag-flush time/], $pos + 5 * GST_SECOND);

    return TRUE;
  });

-- 
Bye,
-Torsten




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]