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