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