plugins: Use shared function to add fallback name
[platform/upstream/lightmediascanner.git] / src / plugins / asf / asf.c
1 /**
2  * Copyright (C) 2008 by INdT
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * @author Andre Moreira Magalhaes <andre.magalhaes@openbossa.org>
19  */
20
21 /**
22  * @brief
23  *
24  * asf/wma file parser.
25  */
26
27 #include <lightmediascanner_plugin.h>
28 #include <lightmediascanner_db.h>
29 #include <shared/util.h>
30
31 #include <endian.h>
32 #include <errno.h>
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <fcntl.h>
36 #include <stdio.h>
37 #include <stdlib.h>
38 #include <string.h>
39 #include <unistd.h>
40
41 #define NSEC100_PER_SEC  10000000ULL
42 #define MSEC_PER_SEC  1000ULL
43
44 enum StreamTypes {
45     STREAM_TYPE_UNKNOWN = 0,
46     STREAM_TYPE_AUDIO,
47     STREAM_TYPE_VIDEO
48 };
49
50 enum AttributeTypes {
51     ATTR_TYPE_UNICODE = 0,
52     ATTR_TYPE_BYTES,
53     ATTR_TYPE_BOOL,
54     ATTR_TYPE_DWORD,
55     ATTR_TYPE_QWORD,
56     ATTR_TYPE_WORD,
57     ATTR_TYPE_GUID
58 };
59
60 struct asf_info {
61     struct lms_string_size title;
62     struct lms_string_size artist;
63     struct lms_string_size album;
64     struct lms_string_size genre;
65     unsigned char trackno;
66 };
67
68 struct plugin {
69     struct lms_plugin plugin;
70     lms_db_audio_t *audio_db;
71     lms_db_video_t *video_db;
72     lms_charset_conv_t *cs_conv;
73 };
74
75 static const char _name[] = "asf";
76 static const struct lms_string_size _container = LMS_STATIC_STRING_SIZE("asf");
77 static const struct lms_string_size _exts[] = {
78     LMS_STATIC_STRING_SIZE(".wma"),
79     LMS_STATIC_STRING_SIZE(".wmv"),
80     LMS_STATIC_STRING_SIZE(".asf")
81 };
82 static const char *_cats[] = {
83     "multimedia",
84     "audio",
85     NULL
86 };
87 static const char *_authors[] = {
88     "Andre Moreira Magalhaes",
89     NULL
90 };
91
92 struct stream {
93     int id;
94     enum StreamTypes type;
95     struct stream *next;
96     union {
97         struct {
98             uint16_t codec_id;
99             uint16_t channels;
100             uint32_t sampling_rate;
101             uint32_t byterate;
102         } audio;
103     };
104 };
105
106 /* TODO: Add the gazillion of possible codecs -- possibly a task to gperf */
107 static const struct {
108     uint16_t id;
109     struct lms_string_size name;
110 } _codecs[] = {
111     { 0x0160, LMS_STATIC_STRING_SIZE("wmav1") },
112     { 0x0161, LMS_STATIC_STRING_SIZE("wmav2") },
113     { 0x0162, LMS_STATIC_STRING_SIZE("wmavpro") },
114     { 0x0163, LMS_STATIC_STRING_SIZE("wmavlossless") },
115     { 0x1600, LMS_STATIC_STRING_SIZE("aac") },
116     { 0x706d, LMS_STATIC_STRING_SIZE("aac") },
117     { 0x4143, LMS_STATIC_STRING_SIZE("aac") },
118     { 0xA106, LMS_STATIC_STRING_SIZE("aac") },
119     { 0xF1AC, LMS_STATIC_STRING_SIZE("flac") },
120     { 0x0055, LMS_STATIC_STRING_SIZE("mp3") },
121     { }
122 };
123
124 /* ASF GUIDs
125  *
126  * Microsoft defines these 16-byte (128-bit) GUIDs as:
127  * first 8 bytes are in little-endian order
128  * next 8 bytes are in big-endian order
129  *
130  * Eg.: AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp:
131  *
132  * to convert to byte string do as follow:
133  *
134  * $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp
135  *
136  * See http://www.microsoft.com/windows/windowsmedia/forpros/format/asfspec.aspx
137  */
138 static const char header_guid[16] = "\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C";
139 static const char file_properties_guid[16] = "\xA1\xDC\xAB\x8C\x47\xA9\xCF\x11\x8E\xE4\x00\xC0\x0C\x20\x53\x65";
140 static const char stream_properties_guid[16] = "\x91\x07\xDC\xB7\xB7\xA9\xCF\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65";
141 static const char stream_type_audio_guid[16] = "\x40\x9E\x69\xF8\x4D\x5B\xCF\x11\xA8\xFD\x00\x80\x5F\x5C\x44\x2B";
142 static const char stream_type_video_guid[16] = "\xC0\xEF\x19\xBC\x4D\x5B\xCF\x11\xA8\xFD\x00\x80\x5F\x5C\x44\x2B";
143 static const char content_description_guid[16] = "\x33\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C";
144 static const char extended_content_description_guid[16] = "\x40\xA4\xD0\xD2\x07\xE3\xD2\x11\x97\xF0\x00\xA0\xC9\x5E\xA8\x50";
145 static const char header_extension_guid[16] = "\xb5\x03\xbf_.\xa9\xcf\x11\x8e\xe3\x00\xc0\x0c Se";
146 static const char metadata_guid[16] = "\xEA\xCB\xF8\xC5\xAF[wH\204g\xAA\214D\xFAL\xCA";
147 static const char metadata_library_guid[16] = "\224\034#D\230\224\321I\241A\x1d\x13NEpT";
148 static const char content_encryption_object_guid[16] = "\xFB\xB3\x11\x22\x23\xBD\xD2\x11\xB4\xB7\x00\xA0\xC9\x55\xFC\x6E";
149 static const char extended_content_encryption_object_guid[16] = "\x14\xE6\x8A\x29\x22\x26\x17\x4C\xB9\x35\xDA\xE0\x7E\xE9\x28\x9C";
150
151 static const char attr_name_wm_album_artist[28] = "\x57\x00\x4d\x00\x2f\x00\x41\x00\x6c\x00\x62\x00\x75\x00\x6d\x00\x41\x00\x72\x00\x74\x00\x69\x00\x73\x00\x74\x00";
152 static const char attr_name_wm_album_title[26] = "\x57\x00\x4d\x00\x2f\x00\x41\x00\x6c\x00\x62\x00\x75\x00\x6d\x00\x54\x00\x69\x00\x74\x00\x6c\x00\x65\x00";
153 static const char attr_name_wm_genre[16] = "\x57\x00\x4d\x00\x2f\x00\x47\x00\x65\x00\x6e\x00\x72\x00\x65\x00";
154 static const char attr_name_wm_track_number[28] = "\x57\x00\x4d\x00\x2f\x00\x54\x00\x72\x00\x61\x00\x63\x00\x6b\x00\x4e\x00\x75\x00\x6d\x00\x62\x00\x65\x00\x72\x00";
155
156 static long long
157 _to_number(const char *data, unsigned int type_size, unsigned int data_size)
158 {
159     long long sum = 0;
160     unsigned int last, i;
161
162     last = data_size > type_size ? type_size : data_size;
163
164     for (i = 0; i < last; i++)
165         sum |= (unsigned char) (data[i]) << (i * 8);
166
167     return sum;
168 }
169
170 static short
171 _read_word(int fd)
172 {
173     char v[2];
174     if (read(fd, &v, 2) != 2)
175         return 0;
176     return (short) _to_number(v, sizeof(unsigned short), 2);
177 }
178
179 static unsigned int
180 _read_dword(int fd)
181 {
182     char v[4];
183     if (read(fd, &v, 4) != 4)
184         return 0;
185     return (unsigned int) _to_number(v, sizeof(unsigned int), 4);
186 }
187
188 static long long
189 _read_qword(int fd)
190 {
191     char v[8];
192     if (read(fd, &v, 8) != 8)
193         return 0;
194     return _to_number(v, sizeof(unsigned long long), 8);
195 }
196
197 static int
198 _read_string(int fd, size_t count, char **str, unsigned int *len)
199 {
200     char *data;
201     ssize_t data_size, size;
202
203     data = malloc(sizeof(char) * count);
204     data_size = read(fd, data, count);
205     if (data_size == -1) {
206         free(data);
207         return -1;
208     }
209
210     size = data_size;
211     while (size >= 2) {
212         if (data[size - 1] != '\0' || data[size - 2] != '\0')
213             break;
214         size -= 2;
215     }
216
217     *str = data;
218     *len = size;
219
220     return 0;
221 }
222
223 static int
224 _parse_file_properties(lms_charset_conv_t *cs_conv, int fd,
225                        struct lms_audio_info *info)
226 {
227     struct {
228         char fileid[16];
229         uint64_t file_size;
230         uint64_t creation_date;
231         uint64_t data_packets_count;
232         uint64_t play_duration;
233         uint64_t send_duration;
234         uint64_t preroll;
235         uint32_t flags;
236         uint32_t min_data_packet_size;
237         uint32_t max_data_packet_size;
238         uint32_t max_bitrate;
239     } __attribute__((packed)) props;
240     int r;
241
242     r = read(fd, &props, sizeof(props));
243     if (r != sizeof(props))
244         return r;
245
246     /* Broadcast flag */
247     if (le32toh(props.flags) & 0x1)
248         return r;
249
250     /* ASF spec 01.20.06 sec. 3.2: we need to subtract the preroll value from
251      * the duration in order to obtain the real duration */
252     info->length = (unsigned int)((le64toh(props.play_duration) / NSEC100_PER_SEC)
253                                   - le64toh(props.preroll) / MSEC_PER_SEC);
254
255     return r;
256 }
257
258 static struct lms_string_size
259 _codec_id_to_str(uint16_t id)
260 {
261     unsigned int i;
262
263     for (i = 0; _codecs[i].name.str != NULL; i++)
264         if (_codecs[i].id == id)
265             return _codecs[i].name;
266
267     return _codecs[i].name;
268 }
269
270 static int
271 _parse_stream_properties(int fd, struct stream **pstream)
272 {
273     struct {
274         char stream_type[16];
275         char error_correction_type[16];
276         uint64_t time_offset;
277         uint32_t type_specific_len;
278         uint32_t error_correction_data_len;
279         uint16_t flags;
280         uint32_t reserved; /* don't use, unaligned */
281     }  __attribute__((packed)) props;
282
283     int r;
284     struct stream *s;
285
286     *pstream = NULL;
287
288     s = calloc(1, sizeof(struct stream));
289     if (!s)
290         return -ENOMEM;
291
292     r = read(fd, &props, sizeof(props));
293     if (r != sizeof(props))
294         goto done;
295
296     if (memcmp(props.stream_type, stream_type_audio_guid, 16) == 0)
297         s->type = STREAM_TYPE_AUDIO;
298     else if (memcmp(props.stream_type, stream_type_video_guid, 16) == 0)
299         s->type = STREAM_TYPE_VIDEO;
300     else {
301         /* ignore stream */
302         goto done;
303     }
304
305     s->id = le16toh(props.flags) & 0x7F;
306     /* Not a valid stream */
307     if (!s->id)
308         goto done;
309
310     if (s->type == STREAM_TYPE_AUDIO) {
311         if (le32toh(props.type_specific_len) < 18)
312             goto done;
313
314         s->audio.codec_id = _read_word(fd);
315         s->audio.channels = _read_word(fd);
316         s->audio.sampling_rate = _read_dword(fd);
317         s->audio.byterate = _read_dword(fd);
318         r += 12;
319     }
320
321     *pstream = s;
322
323     return r;
324
325 done:
326     free(s);
327     return r;
328 }
329
330 static void
331 _parse_content_description(lms_charset_conv_t *cs_conv, int fd, struct asf_info *info)
332 {
333     int title_length = _read_word(fd);
334     int artist_length = _read_word(fd);
335     int copyright_length = _read_word(fd);
336     int comment_length = _read_word(fd);
337     int rating_length = _read_word(fd);
338
339     _read_string(fd, title_length, &info->title.str, &info->title.len);
340     lms_charset_conv_force(cs_conv, &info->title.str, &info->title.len);
341     _read_string(fd, artist_length, &info->artist.str, &info->artist.len);
342     lms_charset_conv_force(cs_conv, &info->artist.str, &info->artist.len);
343     /* ignore copyright, comment and rating */
344     lseek(fd, copyright_length + comment_length + rating_length, SEEK_CUR);
345 }
346
347 static void
348 _parse_attribute_name(int fd,
349                       char **attr_name,
350                       unsigned int *attr_name_len,
351                       int *attr_type,
352                       int *attr_size)
353 {
354     int attr_name_length;
355
356     attr_name_length = _read_word(fd);
357     _read_string(fd, attr_name_length, attr_name, attr_name_len);
358     *attr_type = _read_word(fd);
359     *attr_size = _read_word(fd);
360 }
361
362 static void
363 _parse_attribute_string_data(lms_charset_conv_t *cs_conv,
364                              int fd,
365                              int attr_size,
366                              char **attr_data,
367                              unsigned int *attr_data_len)
368 {
369     _read_string(fd, attr_size, attr_data, attr_data_len);
370     lms_charset_conv_force(cs_conv, attr_data, attr_data_len);
371 }
372
373 static void
374 _skip_attribute_data(int fd, int kind, int attr_type, int attr_size)
375 {
376     switch (attr_type) {
377     case ATTR_TYPE_WORD:
378         lseek(fd, 2, SEEK_CUR);
379         break;
380
381     case ATTR_TYPE_BOOL:
382         if (kind == 0)
383             lseek(fd, 4, SEEK_CUR);
384         else
385             lseek(fd, 2, SEEK_CUR);
386         break;
387
388     case ATTR_TYPE_DWORD:
389         lseek(fd, 4, SEEK_CUR);
390         break;
391
392     case ATTR_TYPE_QWORD:
393         lseek(fd, 8, SEEK_CUR);
394         break;
395
396     case ATTR_TYPE_UNICODE:
397     case ATTR_TYPE_BYTES:
398     case ATTR_TYPE_GUID:
399         lseek(fd, attr_size, SEEK_CUR);
400         break;
401
402     default:
403         break;
404     }
405 }
406
407 static void
408 _parse_extended_content_description_object(lms_charset_conv_t *cs_conv, int fd, struct asf_info *info)
409 {
410     int count = _read_word(fd);
411     char *attr_name;
412     unsigned int attr_name_len;
413     int attr_type, attr_size;
414     while (count--) {
415         attr_name = NULL;
416         _parse_attribute_name(fd,
417                               &attr_name, &attr_name_len,
418                               &attr_type, &attr_size);
419         if (attr_type == ATTR_TYPE_UNICODE) {
420             if (memcmp(attr_name, attr_name_wm_album_title, attr_name_len) == 0)
421                 _parse_attribute_string_data(cs_conv,
422                                              fd, attr_size,
423                                              &info->album.str,
424                                              &info->album.len);
425             else if (memcmp(attr_name, attr_name_wm_genre, attr_name_len) == 0)
426                 _parse_attribute_string_data(cs_conv,
427                                              fd, attr_size,
428                                              &info->genre.str,
429                                              &info->genre.len);
430             else if (memcmp(attr_name, attr_name_wm_album_artist, attr_name_len) == 0)
431                 _parse_attribute_string_data(cs_conv,
432                                              fd, attr_size,
433                                              &info->artist.str,
434                                              &info->artist.len);
435             else if (memcmp(attr_name, attr_name_wm_track_number, attr_name_len) == 0) {
436                 char *trackno;
437                 unsigned int trackno_len;
438                 _parse_attribute_string_data(cs_conv,
439                                              fd, attr_size,
440                                              &trackno,
441                                              &trackno_len);
442                 if (trackno) {
443                     info->trackno = atoi(trackno);
444                     free(trackno);
445                 }
446             }
447             else
448                 _skip_attribute_data(fd, 0, attr_type, attr_size);
449         }
450         else
451             _skip_attribute_data(fd, 0, attr_type, attr_size);
452         free(attr_name);
453     }
454 }
455
456 static void *
457 _match(struct plugin *p, const char *path, int len, int base)
458 {
459     long i;
460
461     i = lms_which_extension(path, len, _exts, LMS_ARRAY_SIZE(_exts));
462     if (i < 0)
463       return NULL;
464     else
465       return (void*)(i + 1);
466 }
467
468 static int
469 _parse(struct plugin *plugin, struct lms_context *ctxt, const struct lms_file_info *finfo, void *match)
470 {
471     struct asf_info info = { };
472     struct lms_audio_info audio_info = { };
473     struct lms_video_info video_info = { };
474     int r, fd, num_objects, i;
475     char guid[16];
476     unsigned int size;
477     int stream_type = STREAM_TYPE_UNKNOWN;
478     struct stream *streams = NULL;
479
480     fd = open(finfo->path, O_RDONLY);
481     if (fd < 0) {
482         perror("open");
483         return -1;
484     }
485
486     if (read(fd, &guid, 16) != 16) {
487         perror("read");
488         r = -2;
489         goto done;
490     }
491     if (memcmp(guid, header_guid, 16) != 0) {
492         fprintf(stderr, "ERROR: invalid header (%s).\n", finfo->path);
493         r = -3;
494         goto done;
495     }
496
497     size = _read_qword(fd);
498     num_objects = _read_dword(fd);
499
500     lseek(fd, 2, SEEK_CUR);
501
502     for (i = 0; i < num_objects; ++i) {
503         read(fd, &guid, 16);
504         size = _read_qword(fd);
505
506         if (memcmp(guid, file_properties_guid, 16) == 0) {
507             r = _parse_file_properties(plugin->cs_conv, fd, &audio_info);
508             if (r < 0)
509                 goto done;
510             lseek(fd, size - (24 + r), SEEK_CUR);
511         } else if (memcmp(guid, stream_properties_guid, 16) == 0) {
512             struct stream *s;
513             r = _parse_stream_properties(fd, &s);
514             if (r < 0)
515                 goto done;
516
517             lseek(fd, size - (24 + r), SEEK_CUR);
518             if (!s)
519                 continue;
520
521             if (stream_type != STREAM_TYPE_VIDEO)
522                 stream_type = s->type;
523
524             s->next = streams;
525             streams = s;
526         } else if (memcmp(guid, content_description_guid, 16) == 0)
527             _parse_content_description(plugin->cs_conv, fd, &info);
528         else if (memcmp(guid, extended_content_description_guid, 16) == 0)
529             _parse_extended_content_description_object(plugin->cs_conv, fd, &info);
530         else if (memcmp(guid, content_encryption_object_guid, 16) == 0 ||
531                  memcmp(guid, extended_content_encryption_object_guid, 16) == 0) {
532             /* ignore DRM'd files */
533             fprintf(stderr, "ERROR: ignoring DRM'd file %s\n", finfo->path);
534             r = -4;
535             goto done;
536         } else
537             lseek(fd, size - 24, SEEK_CUR);
538     }
539
540     /* try to define stream type by extension */
541     if (stream_type == STREAM_TYPE_UNKNOWN) {
542         long ext_idx = ((long)match) - 1;
543         if (strcmp(_exts[ext_idx].str, ".wma") == 0)
544             stream_type = STREAM_TYPE_AUDIO;
545         /* consider wmv and asf as video */
546         else
547             stream_type = STREAM_TYPE_VIDEO;
548     }
549
550     lms_string_size_strip_and_free(&info.title);
551     lms_string_size_strip_and_free(&info.artist);
552     lms_string_size_strip_and_free(&info.album);
553     lms_string_size_strip_and_free(&info.genre);
554
555     if (!info.title.str)
556         info.title = str_extract_name_from_path(finfo->path, finfo->path_len,
557                                                 finfo->base,
558                                                 &_exts[((long) match) - 1],
559                                                 ctxt->cs_conv);
560
561 #if 0
562     fprintf(stderr, "file %s info\n", finfo->path);
563     fprintf(stderr, "\ttitle='%s'\n", info.title.str);
564     fprintf(stderr, "\tartist='%s'\n", info.artist.str);
565     fprintf(stderr, "\talbum='%s'\n", info.album.str);
566     fprintf(stderr, "\tgenre='%s'\n", info.genre.str);
567     fprintf(stderr, "\ttrackno=%d\n", info.trackno);
568 #endif
569
570     audio_info.container = _container;
571
572     if (stream_type == STREAM_TYPE_AUDIO) {
573         audio_info.id = finfo->id;
574         audio_info.title = info.title;
575         audio_info.artist = info.artist;
576         audio_info.album = info.album;
577         audio_info.genre = info.genre;
578         audio_info.trackno = info.trackno;
579
580         audio_info.channels = streams->audio.channels;
581         audio_info.bitrate = streams->audio.byterate * 8;
582         audio_info.sampling_rate = streams->audio.sampling_rate;
583         audio_info.codec = _codec_id_to_str(streams->audio.codec_id);
584
585         r = lms_db_audio_add(plugin->audio_db, &audio_info);
586     } else {
587         video_info.id = finfo->id;
588         video_info.title = info.title;
589         video_info.artist = info.artist;
590         r = lms_db_video_add(plugin->video_db, &video_info);
591     }
592
593 done:
594     while (streams) {
595         struct stream *s = streams;
596         streams = s->next;
597         free(s);
598     }
599
600     free(info.title.str);
601     free(info.artist.str);
602     free(info.album.str);
603     free(info.genre.str);
604
605     posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED);
606     close(fd);
607
608     return r;
609 }
610
611 static int
612 _setup(struct plugin *plugin, struct lms_context *ctxt)
613 {
614     plugin->audio_db = lms_db_audio_new(ctxt->db);
615     if (!plugin->audio_db)
616         return -1;
617     plugin->video_db = lms_db_video_new(ctxt->db);
618     if (!plugin->video_db)
619         return -1;
620     plugin->cs_conv = lms_charset_conv_new();
621     if (!plugin->cs_conv)
622         return -1;
623     lms_charset_conv_add(plugin->cs_conv, "UTF-16LE");
624
625     return 0;
626 }
627
628 static int
629 _start(struct plugin *plugin, struct lms_context *ctxt)
630 {
631     int r;
632     r = lms_db_audio_start(plugin->audio_db);
633     r |= lms_db_video_start(plugin->video_db);
634     return r;
635 }
636
637 static int
638 _finish(struct plugin *plugin, struct lms_context *ctxt)
639 {
640     if (plugin->audio_db)
641         lms_db_audio_free(plugin->audio_db);
642     if (plugin->video_db)
643         lms_db_video_free(plugin->video_db);
644     if (plugin->cs_conv)
645         lms_charset_conv_free(plugin->cs_conv);
646
647     return 0;
648 }
649
650 static int
651 _close(struct plugin *plugin)
652 {
653     free(plugin);
654     return 0;
655 }
656
657 API struct lms_plugin *
658 lms_plugin_open(void)
659 {
660     struct plugin *plugin;
661
662     plugin = (struct plugin *)malloc(sizeof(*plugin));
663     plugin->plugin.name = _name;
664     plugin->plugin.match = (lms_plugin_match_fn_t)_match;
665     plugin->plugin.parse = (lms_plugin_parse_fn_t)_parse;
666     plugin->plugin.close = (lms_plugin_close_fn_t)_close;
667     plugin->plugin.setup = (lms_plugin_setup_fn_t)_setup;
668     plugin->plugin.start = (lms_plugin_start_fn_t)_start;
669     plugin->plugin.finish = (lms_plugin_finish_fn_t)_finish;
670
671     return (struct lms_plugin *)plugin;
672 }
673
674 API const struct lms_plugin_info *
675 lms_plugin_info(void)
676 {
677     static struct lms_plugin_info info = {
678         _name,
679         _cats,
680         "Microsoft WMA, WMV and ASF",
681         PACKAGE_VERSION,
682         _authors,
683         "http://lms.garage.maemo.org"
684     };
685
686     return &info;
687 }