Hi!

First of all, I may say that everything I will mention here is from
reading the code. The only docs I have found on this are:

1. http://www.musicpd.org/doc/developer/ Which gives coding guidelines
2. http://www.musicpd.org/doc/api/html/ Which just documents a part of
the code, nothing directly regarding the plugins
3. http://www.musicpd.org/doc/user/ch05.html Which is much more
complete (for the user).

Having the docs into account, the code I read, and a conversation I
had with cirrus (irc) yesterday, I want to ask, first of all, if there
is any other docs I have missed.

Then, what regards the mpd plugins. Some definitions I have learnt, if
you can confirm or correct them, I would much appreciate it:

- Archive plugin: It is in charge of getting input streams from
compressed blocks
- Database plugin: Is in charge of saving and gathering the Library,
made up of: song meta, song uri, playlists and directories. It is also
used for searching in the Database
- Filter plugin: It is to transform PCM data
- Input plugin: It converts from URIs to real PCM data
- Mixer plugin: It controls the output volume
- Output plugin: It controls the output device and the data it is passed to it
- Playlist plugin: It converts from playlist uri to internal mpd
playlist format, and is able to use that format to gather songs

I haven't understood much about the DatabasePlugin.

What is to Visit()? I thought it was to search, but I was told Visit()
would only sometimes be equivalent. I have tried reading the code but
is not too clear to me.

> /**
> * Visit the selected entities.
> */
> virtual bool Visit(const DatabaseSelection &selection,
>   VisitDirectory visit_directory,
>   VisitSong visit_song,
>   VisitPlaylist visit_playlist,
>   GError **error_r) const = 0;

The definition of Visit() is this (the others are calling this). The
DatabaseSelection is defined like this:

> struct DatabaseSelection {
>  const char *uri;
>  bool recursive;
>  const SongFilter *filter;
>
>  DatabaseSelection(const char *_uri, bool _recursive,
>    const SongFilter *_filter=nullptr)
>   :uri(_uri), recursive(_recursive), filter(_filter) {
>   assert(uri != NULL);
>  }
>
> gcc_pure
> bool Match(const song &song) const;
> };

So If I want to search in that DatabasePlugin, I may create a
SongFilter, with it, create a DatabaseSelection struct, and then I
still have to fill up the Visit* args.

Those Visit* arguments are defined as:

> typedef std::function<bool(const Directory &, GError **)> VisitDirectory;
> typedef std::function<bool(struct song &, GError **)> VisitSong;
> typedef std::function<bool(const PlaylistInfo &, const Directory &,
>   GError **)> VisitPlaylist;
>
> typedef std::function<bool(const char *, GError **)> VisitString;

Which for me mean:
- VisitDirectory: A directory to search on
- VisitSong: I don't understand this arg, because DatabasSelection
already has what to search for
- VisitPlaylist: I don't understand this
- VisitString: Neither understand

I promise I have tried hard trying to understand mpd's internals, but
got stuck here. Really stuck.

Any clarifications you make I would much appreciate them,

Cheers,

Javier Domingo Cansino
Research & Development Junior Engineer
Fon Labs Workgroup, Getxo - Spain.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to