some more changes, no longer using BMediaFormats
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5522 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -66,6 +66,10 @@ typedef struct {
|
||||
uint8 data[16];
|
||||
} GUID;
|
||||
|
||||
enum beos_format {
|
||||
B_BEOS_FORMAT_RAW_AUDIO = 'rawa',
|
||||
B_BEOS_FORMAT_RAW_VIDEO = 'rawv'
|
||||
};
|
||||
typedef struct {
|
||||
int32 format;
|
||||
} media_beos_description;
|
||||
@@ -146,19 +150,15 @@ typedef struct _media_format_description {
|
||||
} u;
|
||||
} media_format_description;
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
namespace BPrivate {
|
||||
class addon_list;
|
||||
void dec_load_hook(void *arg, image_id imgid);
|
||||
void extractor_load_hook(void *arg, image_id imgid);
|
||||
class Extractor;
|
||||
}
|
||||
// temporary functionality, will go away...
|
||||
status_t _get_format_for_description(media_format *out_format, const media_format_description &in_desc);
|
||||
status_t _get_meta_description_for_format(media_format_description *out_desc, const media_format &in_format);
|
||||
|
||||
class BMediaFormats {
|
||||
public:
|
||||
BMediaFormats();
|
||||
BMediaFormats();
|
||||
virtual ~BMediaFormats();
|
||||
|
||||
status_t InitCheck();
|
||||
@@ -213,41 +213,9 @@ virtual ~BMediaFormats();
|
||||
const media_format & in_format,
|
||||
media_format * out_format);
|
||||
private:
|
||||
friend class BPrivate::addon_list;
|
||||
friend void BPrivate::dec_load_hook(void *arg, image_id imgid);
|
||||
friend void BPrivate::extractor_load_hook(void * arg, image_id imgid);
|
||||
friend class BMediaDecoder;
|
||||
friend class BMediaTrack;
|
||||
friend class BPrivate::Extractor;
|
||||
|
||||
char _reserved_messenger[24]; // sizeof(BMessenger) 24
|
||||
char _reserved_list[28]; // sizeof(BList) 28
|
||||
char _reserved_locker[32]; // sizeof(BLocker) 36
|
||||
int32 m_lock_count;
|
||||
static int32 s_cleared;
|
||||
static BMessenger s_server;
|
||||
static BList s_formats;
|
||||
static BLocker s_lock;
|
||||
int32 m_index;
|
||||
|
||||
void clear_formats();
|
||||
static void ex_clear_formats_imp();
|
||||
static void clear_formats_imp();
|
||||
status_t get_formats();
|
||||
static status_t get_formats_imp();
|
||||
static BMessenger & get_server();
|
||||
|
||||
static status_t bind_addon(
|
||||
const char * addon,
|
||||
const media_format * formats,
|
||||
int32 count);
|
||||
static bool is_bound(
|
||||
const char * addon,
|
||||
const media_format * formats,
|
||||
int32 count);
|
||||
static status_t find_addons(
|
||||
const media_format * format,
|
||||
BPrivate::addon_list & addons);
|
||||
BLocker * fLocker;
|
||||
int32 fIndex;
|
||||
uint32 _reserved[21];
|
||||
};
|
||||
|
||||
_IMPEXP_MEDIA bool operator==(const media_format_description & a, const media_format_description & b);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef _DATA_EXCHANGE_H
|
||||
#define _DATA_EXCHANGE_H
|
||||
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaFormats.h>
|
||||
#include <MediaNode.h>
|
||||
#include <MediaAddOn.h>
|
||||
#include <Messenger.h>
|
||||
@@ -105,6 +105,8 @@ enum {
|
||||
SERVER_SETREFFOR,
|
||||
SERVER_REMOVEREFFOR,
|
||||
SERVER_REMOVEITEM,
|
||||
SERVER_GET_FORMAT_FOR_DESCRIPTION,
|
||||
SERVER_GET_META_DESCRIPTION_FOR_FORMAT,
|
||||
SERVER_MESSAGE_END,
|
||||
NODE_MESSAGE_START = 0x200,
|
||||
|
||||
@@ -876,6 +878,26 @@ struct server_removeitem_reply : public reply_data
|
||||
{
|
||||
};
|
||||
|
||||
struct server_get_format_for_description_request : public request_data
|
||||
{
|
||||
media_format_description description;
|
||||
};
|
||||
|
||||
struct server_get_format_for_description_reply : public reply_data
|
||||
{
|
||||
media_format format;
|
||||
};
|
||||
|
||||
struct server_get_meta_description_for_format_request : public request_data
|
||||
{
|
||||
media_format format;
|
||||
};
|
||||
|
||||
struct server_get_meta_description_for_format_reply : public reply_data
|
||||
{
|
||||
media_format_description description;
|
||||
};
|
||||
|
||||
struct node_request_completed_command : public command_data
|
||||
{
|
||||
media_request_info info;
|
||||
|
||||
@@ -200,11 +200,13 @@ mp3Reader::AllocateCookie(int32 streamNumber, void **cookie)
|
||||
data->framePosition = 0;
|
||||
data->framesPerFrame = frame_sample_count_table[layer_index];
|
||||
|
||||
BMediaFormats formats;
|
||||
// BMediaFormats formats;
|
||||
media_format_description description;
|
||||
description.family = B_MPEG_FORMAT_FAMILY;
|
||||
description.u.mpeg.id = b_mpeg_id_table[mpeg_version_index][layer_index];
|
||||
formats.GetFormatFor(description, &data->format);
|
||||
// formats.GetFormatFor(description, &data->format);
|
||||
|
||||
_get_format_for_description(&data->format, description);
|
||||
|
||||
data->format.u.encoded_audio.encoding = media_encoded_audio_format::B_ANY;
|
||||
data->format.u.encoded_audio.bit_rate = bit_rate;
|
||||
|
||||
@@ -120,7 +120,14 @@ WavReader::AllocateCookie(int32 streamNumber, void **cookie)
|
||||
TRACE(" framecount %Ld\n", data->framecount);
|
||||
TRACE(" duration %Ld\n", data->duration);
|
||||
|
||||
memset(&data->format, 0, sizeof(data->format));
|
||||
// BMediaFormats formats;
|
||||
media_format_description description;
|
||||
description.family = B_BEOS_FORMAT_FAMILY;
|
||||
description.u.beos.format = B_BEOS_FORMAT_RAW_AUDIO;
|
||||
// formats.GetFormatFor(description, &data->format);
|
||||
|
||||
_get_format_for_description(&data->format, description);
|
||||
|
||||
data->format.type = B_MEDIA_RAW_AUDIO;
|
||||
data->format.u.raw_audio.frame_rate = data->fps;
|
||||
data->format.u.raw_audio.channel_count = B_LENDIAN_TO_HOST_INT16(fRawHeader.common.channels);
|
||||
|
||||
+70
-128
@@ -5,6 +5,7 @@
|
||||
***********************************************************************/
|
||||
#include <MediaFormats.h>
|
||||
#include <string.h>
|
||||
#include "DataExchange.h"
|
||||
#include "debug.h"
|
||||
|
||||
/*************************************************************
|
||||
@@ -74,54 +75,25 @@ _media_format_description::operator=(const _media_format_description & other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class addon_list
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
void dec_load_hook(void *arg, image_id imgid)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
};
|
||||
|
||||
void extractor_load_hook(void *arg, image_id imgid)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
};
|
||||
|
||||
class Extractor
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* public BMediaFormats
|
||||
*************************************************************/
|
||||
|
||||
BMediaFormats::BMediaFormats()
|
||||
: fLocker(new BLocker("some BMediaFormats locker")),
|
||||
fIndex(0)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
BMediaFormats::~BMediaFormats()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
delete fLocker;
|
||||
}
|
||||
|
||||
status_t
|
||||
BMediaFormats::InitCheck()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -132,7 +104,10 @@ BMediaFormats::MakeFormatFor(const media_format_description * descs,
|
||||
uint32 flags,
|
||||
void * _reserved)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (descs == 0 || desc_count < 1 || io_format == 0)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -141,8 +116,9 @@ status_t
|
||||
BMediaFormats::GetFormatFor(const media_format_description & desc,
|
||||
media_format * out_format)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
// set to wildcard, as MakeFormatFor wants an in/out format...
|
||||
memset(out_format, 0, sizeof(*out_format));
|
||||
return MakeFormatFor(&desc, 1, out_format);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +127,12 @@ BMediaFormats::GetBeOSFormatFor(uint32 fourcc,
|
||||
media_format * out_format,
|
||||
media_type type)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
media_format_description mfd;
|
||||
mfd.family = B_BEOS_FORMAT_FAMILY;
|
||||
mfd.u.beos.format = fourcc;
|
||||
memset(out_format, 0, sizeof(*out_format));
|
||||
out_format->type = type;
|
||||
// return MakeFormatFor(&mfd, 1, out_format);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -161,7 +142,12 @@ BMediaFormats::GetAVIFormatFor(uint32 fourcc,
|
||||
media_format * out_format,
|
||||
media_type type)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
media_format_description mfd;
|
||||
mfd.family = B_AVI_FORMAT_FAMILY;
|
||||
mfd.u.avi.codec = fourcc;
|
||||
memset(out_format, 0, sizeof(*out_format));
|
||||
out_format->type = type;
|
||||
// return MakeFormatFor(&mfd, 1, out_format);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -172,7 +158,13 @@ BMediaFormats::GetQuicktimeFormatFor(uint32 vendor,
|
||||
media_format * out_format,
|
||||
media_type type)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
media_format_description mfd;
|
||||
mfd.family = B_QUICKTIME_FORMAT_FAMILY;
|
||||
mfd.u.quicktime.codec = fourcc;
|
||||
mfd.u.quicktime.vendor = vendor;
|
||||
memset(out_format, 0, sizeof(*out_format));
|
||||
out_format->type = type;
|
||||
// return MakeFormatFor(&mfd, 1, out_format);
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
@@ -190,8 +182,10 @@ BMediaFormats::GetCodeFor(const media_format & format,
|
||||
status_t
|
||||
BMediaFormats::RewindFormats()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
if (!fLocker->IsLocked())
|
||||
return B_NOT_ALLOWED;
|
||||
fIndex = 0;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +193,9 @@ status_t
|
||||
BMediaFormats::GetNextFormat(media_format * out_format,
|
||||
media_format_description * out_description)
|
||||
{
|
||||
if (!fLocker->IsLocked())
|
||||
return B_NOT_ALLOWED;
|
||||
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
}
|
||||
@@ -207,14 +204,13 @@ BMediaFormats::GetNextFormat(media_format * out_format,
|
||||
bool
|
||||
BMediaFormats::Lock()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return true;
|
||||
return fLocker->Lock();
|
||||
}
|
||||
|
||||
void
|
||||
BMediaFormats::Unlock()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
fLocker->Unlock();
|
||||
}
|
||||
|
||||
/* --- begin deprecated API --- */
|
||||
@@ -223,93 +219,10 @@ BMediaFormats::MakeFormatFor(const media_format_description & desc,
|
||||
const media_format & in_format,
|
||||
media_format * out_format)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
*out_format = in_format;
|
||||
return MakeFormatFor(&desc, 1, out_format);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* private BMediaFormats
|
||||
*************************************************************/
|
||||
|
||||
void
|
||||
BMediaFormats::clear_formats()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
BMediaFormats::ex_clear_formats_imp()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
BMediaFormats::clear_formats_imp()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
status_t
|
||||
BMediaFormats::get_formats()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
/* static */ status_t
|
||||
BMediaFormats::get_formats_imp()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
/* static */ BMessenger &
|
||||
BMediaFormats::get_server()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
static BMessenger dummy;
|
||||
return dummy;
|
||||
}
|
||||
|
||||
/* static */ status_t
|
||||
BMediaFormats::bind_addon(
|
||||
const char * addon,
|
||||
const media_format * formats,
|
||||
int32 count)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
BMediaFormats::is_bound(
|
||||
const char * addon,
|
||||
const media_format * formats,
|
||||
int32 count)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* static */ status_t
|
||||
BMediaFormats::find_addons(
|
||||
const media_format * format,
|
||||
BPrivate::addon_list & addons)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* static BMediaFormats variables
|
||||
*************************************************************/
|
||||
|
||||
int32 BMediaFormats::s_cleared;
|
||||
BMessenger BMediaFormats::s_server;
|
||||
BList BMediaFormats::s_formats;
|
||||
BLocker BMediaFormats::s_lock("BMediaFormats locker");
|
||||
|
||||
/*************************************************************
|
||||
*
|
||||
*************************************************************/
|
||||
@@ -384,3 +297,32 @@ bool operator<(const GUID & a, const GUID & b)
|
||||
return memcmp(&a, &b, sizeof(a)) < 0;
|
||||
}
|
||||
|
||||
status_t
|
||||
_get_format_for_description(media_format *out_format, const media_format_description &in_desc)
|
||||
{
|
||||
server_get_format_for_description_request request;
|
||||
server_get_format_for_description_reply reply;
|
||||
|
||||
request.description = in_desc;
|
||||
|
||||
if (B_OK != QueryServer(SERVER_GET_FORMAT_FOR_DESCRIPTION, &request, sizeof(request), &reply, sizeof(reply)))
|
||||
return B_ERROR;
|
||||
|
||||
*out_format = reply.format;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
_get_meta_description_for_format(media_format_description *out_desc, const media_format &in_format)
|
||||
{
|
||||
server_get_meta_description_for_format_request request;
|
||||
server_get_meta_description_for_format_reply reply;
|
||||
|
||||
request.format = in_format;
|
||||
|
||||
if (B_OK != QueryServer(SERVER_GET_META_DESCRIPTION_FOR_FORMAT, &request, sizeof(request), &reply, sizeof(reply)))
|
||||
return B_ERROR;
|
||||
|
||||
*out_desc = reply.description;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user