Exemple #1
0
void K3b::TRM::start( const K3b::Msf& length )
{
    if( KProtocolManager::useProxy() ) {
        QUrl proxy( KProtocolManager::proxyFor("http") );
        trm_SetProxy( d->trm, const_cast<char*>(proxy.host().toLatin1().constData()), short(proxy.port()) );
    }

    trm_SetPCMDataInfo( d->trm, 44100, 2, 16 );
    trm_SetSongLength( d->trm, length.totalFrames()/75 );
}
Exemple #2
0
static gboolean
gst_trm_setcaps (GstPad * pad, GstCaps * caps)
{
  GstTRM *trm;
  GstStructure *structure;
  const gchar *mimetype;
  gint width;

  trm = GST_TRM (gst_pad_get_parent (pad));

  if (!gst_pad_set_caps (trm->srcpad, caps))
    return FALSE;

  structure = gst_caps_get_structure (caps, 0);
  mimetype = gst_structure_get_name (structure);

  if (!gst_structure_get_int (structure, "depth", &trm->depth) ||
      !gst_structure_get_int (structure, "width", &width) ||
      !gst_structure_get_int (structure, "channels", &trm->channels) ||
      !gst_structure_get_int (structure, "rate", &trm->rate)) {
    GST_DEBUG_OBJECT (trm, "failed to extract depth, width, channels or rate");
    goto failure;
  }

  if (trm->depth != width) {
    GST_DEBUG_OBJECT (trm, "depth != width (%d != %d)", trm->depth, width);
    goto failure;
  }

  trm_SetPCMDataInfo (trm->trm, trm->rate, trm->channels, trm->depth);

  gst_object_unref (trm);
  return TRUE;

/* ERRORS */
failure:
  {
    GST_WARNING_OBJECT (trm, "FAILED with caps %" GST_PTR_FORMAT, caps);
    gst_object_unref (trm);
    return FALSE;
  }
}