Buzztard-dec

From Buzztard

(Redirected from Buzztard-bin)
Jump to: navigation, search

Have a gstreamer element that can decode buzztard songs. This would allow to play buzztard songs in all gstreamer media players.

Contents

[edit] Audio sink

Instead of playing the audio ourself we need to output raw audio so that it can be plugged in playbin(2).

[edit] Dummy sink

One way would be to provide a dummy btsinkmachine that it will set as a master. As btsinkmachine always uses btsinkbin, the later needs a pass-through mode (we already have the record modes). I don't see a way to avoid sink-bin right now.

The bin needs to set the src-pad of the sink-bin's last element (input-gain) as a ghost-pad for itself (we could make it a sometimes pad maybe if we want to add a pad-template). Also the actual BtSinkMachine woul need to have such a ghostpad.

[edit] Passthrough mode on sinkbin

We need passthrough mode on sinkbin anyway. Sinkbin would be a sometimes src-pad. In passthrough mode it would add a pad for raw-audio. Also sinkmachine would get such a sometimes pad. It will listen for new pads on sink-bin and add a sometimes pad too.

[edit] Typefinders

We somehow need to wrap the songio-detect mechanism into a typefinder. This is needed so that playbin would actually autoplug this element.

[edit] Loading

We need to check from e.g. timidity/wildmidi as they also need to have the full song loaded. We need API on song-io plugins to load from memory (right now the set the file-name on the song-io object, now they would need to set memory-ptr and length instead (easy doable, see todo: comments in the source) - using a gio stream would be nice too).

We need tu turn bt_song_io_make() into bt_song_io_make_from_file() and add bt_song_io_make_from_memory().

  // prepare song and song-io
  song=bt_song_new(BT_APPLICATION(self));
  if(loader=bt_song_io_make_from_memory(buffer,size)) {
    if(bt_song_io_load(loader,song)) {
      // ...
    }
  }

Right now bt_song_io_make() will run bt_song_io_detect() which again needs a file-name as it only checks extensions. As a hack we could use gst_query_new_uri() in bt_song_io_make_from_memory():

BtSongIO *bt_song_io_make_from_memory(gpointer buf, gsize len) {
  BtSongIO *self=NULL;
  GType type = 0;
 
  // can't query here, as we don't have the bin :/
  type=bt_song_io_detect(file_name);
  if(type) {
    self=BT_SONG_IO(g_object_new(type,NULL));
    if(self) {
      self->priv->buf=buf;
      self->priv->len=len;
    }
  }
  else {
    GST_WARNING("failed to detect type for filename %s",file_name);
  }
  return(self);
}
Personal tools
collaboration

SourceForge Logo

GStreamer Logo

Become a Friend of GNOME

Linux Sound Logo

MediaWiki

Valgrind

GNU Library Public Licence

GNU Free Documentation License 1.2