added the new media_meta_description and changed codec API to use it
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -599,8 +599,8 @@ typedef enum {
|
|||||||
B_WAV_FORMAT_FAMILY = 6,
|
B_WAV_FORMAT_FAMILY = 6,
|
||||||
B_AIFF_FORMAT_FAMILY = 7,
|
B_AIFF_FORMAT_FAMILY = 7,
|
||||||
B_AVR_FORMAT_FAMILY = 8,
|
B_AVR_FORMAT_FAMILY = 8,
|
||||||
|
B_MISC_FORMAT_FAMILY = 99999,
|
||||||
B_MISC_FORMAT_FAMILY = 99999
|
B_META_FORMAT_FAMILY = 100000
|
||||||
} media_format_family;
|
} media_format_family;
|
||||||
|
|
||||||
struct media_file_format {
|
struct media_file_format {
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ typedef struct {
|
|||||||
uint32 codec;
|
uint32 codec;
|
||||||
} media_misc_description;
|
} media_misc_description;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char description[48];
|
||||||
|
} media_meta_description;
|
||||||
|
|
||||||
typedef struct _media_format_description {
|
typedef struct _media_format_description {
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
_media_format_description();
|
_media_format_description();
|
||||||
@@ -137,6 +141,7 @@ typedef struct _media_format_description {
|
|||||||
media_aiff_description aiff;
|
media_aiff_description aiff;
|
||||||
media_misc_description misc;
|
media_misc_description misc;
|
||||||
media_avr_description avr;
|
media_avr_description avr;
|
||||||
|
media_meta_description meta;
|
||||||
uint32 _reserved_[12];
|
uint32 _reserved_[12];
|
||||||
} u;
|
} u;
|
||||||
} media_format_description;
|
} media_format_description;
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ public:
|
|||||||
|
|
||||||
virtual Decoder *NewDecoder() = 0;
|
virtual Decoder *NewDecoder() = 0;
|
||||||
|
|
||||||
status_t PublishDecoder(const char *short_name, const char *pretty_name, const media_format_description &fmt_desc, media_type fmt_type);
|
status_t PublishDecoder(const char *meta_description, const char *short_name, const char *pretty_name, const char *default_mapping = 0);
|
||||||
status_t PublishDecoder(const char *short_name, const char *pretty_name, const media_format &fmt);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} } // namespace BPrivate::media
|
} } // namespace BPrivate::media
|
||||||
|
|||||||
@@ -105,27 +105,15 @@ mp3DecoderPlugin::NewDecoder()
|
|||||||
status_t
|
status_t
|
||||||
mp3DecoderPlugin::RegisterPlugin()
|
mp3DecoderPlugin::RegisterPlugin()
|
||||||
{
|
{
|
||||||
struct {
|
PublishDecoder("audiocodec/mpeg1layer1", "mp3", "MPEG 1 audio layer 1 decoder, based on mpeg123 mpglib");
|
||||||
const char *short_name;
|
PublishDecoder("audiocodec/mpeg1layer2", "mp3", "MPEG 1 audio layer 2 decoder, based on mpeg123 mpglib");
|
||||||
const char *pretty_name;
|
PublishDecoder("audiocodec/mpeg1layer3", "mp3", "MPEG 1 audio layer 3 decoder, based on mpeg123 mpglib");
|
||||||
uint32 id;
|
PublishDecoder("audiocodec/mpeg2layer1", "mp3", "MPEG 2 audio layer 1 decoder, based on mpeg123 mpglib");
|
||||||
} descs[] = {
|
PublishDecoder("audiocodec/mpeg2layer2", "mp3", "MPEG 2 audio layer 2 decoder, based on mpeg123 mpglib");
|
||||||
{ "mpeg1 audio layer1", "MPEG 1 audio layer 1 decoder, based on mpeg123 mpglib", B_MPEG_1_AUDIO_LAYER_1 },
|
PublishDecoder("audiocodec/mpeg2layer3", "mp3", "MPEG 2 audio layer 3 decoder, based on mpeg123 mpglib");
|
||||||
{ "mpeg1 audio layer2", "MPEG 1 audio layer 2 decoder, based on mpeg123 mpglib", B_MPEG_1_AUDIO_LAYER_2 },
|
PublishDecoder("audiocodec/mpeg2.5layer1", "mp3", "MPEG 2.5 audio layer 1 decoder, based on mpeg123 mpglib");
|
||||||
{ "mpeg1 audio layer3", "MPEG 1 audio layer 3 decoder, based on mpeg123 mpglib", B_MPEG_1_AUDIO_LAYER_3 },
|
PublishDecoder("audiocodec/mpeg2.5layer2", "mp3", "MPEG 2.5 audio layer 2 decoder, based on mpeg123 mpglib");
|
||||||
{ "mpeg2 audio layer1", "MPEG 2 audio layer 1 decoder, based on mpeg123 mpglib", B_MPEG_2_AUDIO_LAYER_1 },
|
PublishDecoder("audiocodec/mpeg2.5layer3", "mp3", "MPEG 2.5 audio layer 3 decoder, based on mpeg123 mpglib");
|
||||||
{ "mpeg2 audio layer2", "MPEG 2 audio layer 2 decoder, based on mpeg123 mpglib", B_MPEG_2_AUDIO_LAYER_2 },
|
|
||||||
{ "mpeg2 audio layer3", "MPEG 2 audio layer 3 decoder, based on mpeg123 mpglib", B_MPEG_2_AUDIO_LAYER_3 },
|
|
||||||
{ "mpeg2.5 audio layer1", "MPEG 2.5 audio layer 1 decoder, based on mpeg123 mpglib", B_MPEG_2_5_AUDIO_LAYER_1 },
|
|
||||||
{ "mpeg2.5 audio layer2", "MPEG 2.5 audio layer 2 decoder, based on mpeg123 mpglib", B_MPEG_2_5_AUDIO_LAYER_2 },
|
|
||||||
{ "mpeg2.5 audio layer3", "MPEG 2.5 audio layer 3 decoder, based on mpeg123 mpglib", B_MPEG_2_5_AUDIO_LAYER_3 }
|
|
||||||
};
|
|
||||||
for (int i = 0; i < (int)(sizeof(descs) / sizeof(descs[i])); i++) {
|
|
||||||
media_format_description fmt_desc;
|
|
||||||
fmt_desc.family = B_MPEG_FORMAT_FAMILY;
|
|
||||||
fmt_desc.u.mpeg.id = descs[i].id;
|
|
||||||
PublishDecoder(descs[i].short_name, descs[i].pretty_name, fmt_desc, B_MEDIA_ENCODED_AUDIO);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,12 +63,8 @@ RawDecoderPlugin::NewDecoder()
|
|||||||
status_t
|
status_t
|
||||||
RawDecoderPlugin::RegisterPlugin()
|
RawDecoderPlugin::RegisterPlugin()
|
||||||
{
|
{
|
||||||
media_format fmt;
|
PublishDecoder("audiocodec/raw", "raw", "RAW audio decoder", "{ WAV : 0x1 }, { QT : 0x20776172, 0x736f7774, 0x74776f73 }");
|
||||||
memset(&fmt, 0, sizeof(fmt));
|
PublishDecoder("videocodec/raw", "raw", "RAW video decoder");
|
||||||
fmt.type = B_MEDIA_RAW_AUDIO;
|
|
||||||
PublishDecoder("raw audio", "RAW audio decoder", fmt);
|
|
||||||
fmt.type = B_MEDIA_RAW_VIDEO;
|
|
||||||
PublishDecoder("raw video", "RAW video decoder", fmt);
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,25 +30,23 @@ DecoderPlugin::DecoderPlugin()
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
DecoderPlugin::PublishDecoder(const char *short_name, const char *pretty_name, const media_format_description &fmt_desc, media_type fmt_type)
|
DecoderPlugin::PublishDecoder(const char *meta_description,
|
||||||
|
const char *short_name,
|
||||||
|
const char *pretty_name,
|
||||||
|
const char *default_mapping /* = 0 */)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
media_format fmt;
|
media_format fmt;
|
||||||
memset(&fmt, 0, sizeof(fmt));
|
memset(&fmt, 0, sizeof(fmt));
|
||||||
fmt.type = fmt_type;
|
fmt.type = fmt_type;
|
||||||
BMediaFormats formats;
|
BMediaFormats formats;
|
||||||
if (B_OK != formats.MakeFormatFor(&fmt_desc, 1, &fmt))
|
if (B_OK != formats.MakeFormatFor(&fmt_desc, 1, &fmt))
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
return PublishDecoder(short_name, pretty_name, fmt);
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t
|
|
||||||
DecoderPlugin::PublishDecoder(const char *short_name, const char *pretty_name, const media_format &fmt)
|
|
||||||
{
|
|
||||||
char s[1024];
|
char s[1024];
|
||||||
string_for_format(fmt, s, sizeof(s));
|
string_for_format(fmt, s, sizeof(s));
|
||||||
printf("DecoderPlugin::PublishDecoder: short_name \"%s\", pretty_name \"%s\", format %s\n",
|
printf("DecoderPlugin::PublishDecoder: short_name \"%s\", pretty_name \"%s\", format %s\n",
|
||||||
short_name, pretty_name, s);
|
short_name, pretty_name, s);
|
||||||
|
*/
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,9 @@ MediaExtractor::GetNextChunk(int32 stream,
|
|||||||
media_header *mediaHeader)
|
media_header *mediaHeader)
|
||||||
{
|
{
|
||||||
// get buffered chunk
|
// get buffered chunk
|
||||||
return B_OK;
|
|
||||||
|
// XXX this should be done in a different thread, and double buffered for each stream
|
||||||
|
return fReader->GetNextChunk(fStreamInfo[stream].cookie, chunkBuffer, chunkSize, mediaHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
*
|
*
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user