vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / media / plugins / musepack / MusePack.cpp
blobf4f6610916a4d817fbbf6e51796e585569706a5c
1 /*
2 ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
7 #include "MusePack.h"
8 #include "MusePackReader.h"
9 #include "MusePackDecoder.h"
12 Reader *
13 MusePackPlugin::NewReader()
15 return new MusePackReader();
18 Decoder *
19 MusePackPlugin::NewDecoder(uint index)
21 return new MusePackDecoder();
24 static media_format muse_pack_formats[1];
26 status_t
27 MusePackPlugin::GetSupportedFormats(media_format ** formats, size_t * count)
29 media_format_description description;
30 description.family = B_MISC_FORMAT_FAMILY;
31 description.u.misc.file_format = 'mpc ';
32 description.u.misc.codec = 'MPC7';
33 // 7 is the most recent stream version
35 media_format format;
36 format.type = B_MEDIA_ENCODED_AUDIO;
37 format.u.encoded_audio = media_encoded_audio_format::wildcard;
39 BMediaFormats mediaFormats;
40 status_t result = mediaFormats.InitCheck();
41 if (result != B_OK) {
42 return result;
44 result = mediaFormats.MakeFormatFor(&description, 1, &format);
45 if (result != B_OK) {
46 return result;
48 muse_pack_formats[0] = format;
50 *formats = muse_pack_formats;
51 *count = 1;
53 return B_OK;
57 // #pragma mark -
60 MediaPlugin *
61 instantiate_plugin()
63 return new MusePackPlugin();