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