reverted to 1.1 version.
unfortunately, I thought I had tested 1.2 when I got it about 3 weeks ago, and included it today without further testing. But it turned out that it doesn't even compile and needs to be redone. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1297 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+32
-226
@@ -1,7 +1,7 @@
|
|||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* AUTHOR: John Hedditch <[email protected]>
|
* AUTHOR: Marcus Overhagen
|
||||||
* FILE: MediaFormats.cpp
|
* FILE: MediaFormats.cpp
|
||||||
* DESCR: The BMediaFormats class - doesn't use hash tables yet.
|
* DESCR:
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
status_t get_next_encoder(int32 *cookie,
|
status_t get_next_encoder(int32 *cookie,
|
||||||
const media_file_format *mfi, // this comes from get_next_file_format()
|
const media_file_format *mfi, // this comes from get_next_file_format()
|
||||||
const media_format *input_format, // this is the type of data given to the encoder
|
const media_format *input_format, // this is the type of data given to the encoder
|
||||||
media_format *output_format, // this is the type of data encoder will output
|
media_format *output_format, // this is the type of data encoder will output
|
||||||
media_codec_info *ei) // information about the encoder
|
media_codec_info *ei) // information about the encoder
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED();
|
UNIMPLEMENTED();
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -84,8 +84,6 @@ namespace BPrivate {
|
|||||||
|
|
||||||
class addon_list
|
class addon_list
|
||||||
{
|
{
|
||||||
media_format format;
|
|
||||||
media_format_description format_description;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -135,81 +133,26 @@ BMediaFormats::MakeFormatFor(const media_format_description * descs,
|
|||||||
uint32 flags,
|
uint32 flags,
|
||||||
void * _reserved)
|
void * _reserved)
|
||||||
{
|
{
|
||||||
int32 i,imax;
|
UNIMPLEMENTED();
|
||||||
new BPrivate::addon_list[desc_count] *item;
|
return B_ERROR;
|
||||||
|
|
||||||
CALLED();
|
|
||||||
if( descs == NULL || ioformat==NULL ) return B_BAD_VALUE;
|
|
||||||
if( desc_count < 1) return B_BAD_VALUE;
|
|
||||||
|
|
||||||
if(flags & B_EXCLUSIVE) then
|
|
||||||
{
|
|
||||||
imax=s_formats->CountItems()
|
|
||||||
|
|
||||||
for(i=0;i<imax;i++)
|
|
||||||
{
|
|
||||||
if(((addon_list *)s_formats->ItemAt(i)).format == io_format)
|
|
||||||
{
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
for(i=0;i<desc_count;i++)
|
|
||||||
{
|
|
||||||
item[i].format=io_format;
|
|
||||||
item[i].description = descs[i];
|
|
||||||
s_formats->AddItem( (void *)item[i] );
|
|
||||||
}
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetFormatFor(const media_format_description & desc,
|
BMediaFormats::GetFormatFor(const media_format_description & desc,
|
||||||
media_format * out_format)
|
media_format * out_format)
|
||||||
{
|
{
|
||||||
int32 i,imax;
|
UNIMPLEMENTED();
|
||||||
CALLED();
|
|
||||||
|
|
||||||
imax=s_formats->CountItems()
|
|
||||||
for(i=0;i<imax;i++)
|
|
||||||
{
|
|
||||||
if(((addon_list *)s_formats->ItemAt(i)).description == desc)
|
|
||||||
{
|
|
||||||
out_format=((addon_list *)s_formats->ItemAt(i)).format;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* static */ status_t
|
/* static */ status_t
|
||||||
BMediaFormats::GetBeOSFormatFor(uint32 fourcc,
|
BMediaFormats::GetBeOSFormatFor(uint32 fourcc,
|
||||||
media_format * out_format,
|
media_format * out_format,
|
||||||
media_type type)
|
media_type type)
|
||||||
{
|
{
|
||||||
media_format_description desc;
|
UNIMPLEMENTED();
|
||||||
|
|
||||||
CALLED()
|
|
||||||
memset(desc, 0, sizeof(*desc);
|
|
||||||
desc.family = B_BEOS_FORMAT_FAMILY;
|
|
||||||
desc.u.beos.format=fourcc;
|
|
||||||
switch (GetFormatFor(desc, out_format))
|
|
||||||
{
|
|
||||||
case B_ERROR:
|
|
||||||
{
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_OK:
|
|
||||||
{
|
|
||||||
out_format.type = type;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,55 +162,18 @@ BMediaFormats::GetAVIFormatFor(uint32 fourcc,
|
|||||||
media_format * out_format,
|
media_format * out_format,
|
||||||
media_type type)
|
media_type type)
|
||||||
{
|
{
|
||||||
media_format_description desc;
|
UNIMPLEMENTED();
|
||||||
|
|
||||||
CALLED()
|
|
||||||
memset(desc, 0, sizeof(*desc);
|
|
||||||
desc.family = B_AVI_FORMAT_FAMILY;
|
|
||||||
desc.u.avi.codec=fourcc;
|
|
||||||
switch (GetFormatFor(desc, out_format))
|
|
||||||
{
|
|
||||||
case B_ERROR:
|
|
||||||
{
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_OK:
|
|
||||||
{
|
|
||||||
out_format.type = type;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* static */ status_t
|
/* static */ status_t
|
||||||
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor,
|
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor,
|
||||||
uint32 fourcc,
|
uint32 fourcc,
|
||||||
media_format * out_format,
|
media_format * out_format,
|
||||||
media_type type)
|
media_type type)
|
||||||
{
|
{
|
||||||
media_format_description desc;
|
UNIMPLEMENTED();
|
||||||
|
|
||||||
CALLED()
|
|
||||||
memset(desc, 0, sizeof(*desc);
|
|
||||||
desc.family = B_QUICKTIME_FORMAT_FAMILY;
|
|
||||||
desc.u.quicktime.codec=fourcc;
|
|
||||||
desc.u.quicktime.vendor=vendor;
|
|
||||||
switch (GetFormatFor(desc, out_format))
|
|
||||||
{
|
|
||||||
case B_ERROR:
|
|
||||||
{
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_OK:
|
|
||||||
{
|
|
||||||
out_format.type = type;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,81 +183,39 @@ BMediaFormats::GetCodeFor(const media_format & format,
|
|||||||
media_format_family family,
|
media_format_family family,
|
||||||
media_format_description * out_description)
|
media_format_description * out_description)
|
||||||
{
|
{
|
||||||
int32 i,imax;
|
UNIMPLEMENTED();
|
||||||
CALLED();
|
return B_ERROR;
|
||||||
|
|
||||||
imax=s_formats->CountItems()
|
|
||||||
for(i=0;i<imax;i++)
|
|
||||||
{
|
|
||||||
if(((addon_list *)s_formats->ItemAt(i)).format == format)
|
|
||||||
{
|
|
||||||
if(((addon_list *)s_formats->ItemAt(i)).description.family == family)
|
|
||||||
{
|
|
||||||
out_description = ((addon_list *)s_formats->ItemAt(i)).description;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_MEDIA_BAD_FORMAT;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::RewindFormats()
|
BMediaFormats::RewindFormats()
|
||||||
{
|
{
|
||||||
CALLED();
|
UNIMPLEMENTED();
|
||||||
while(!(s_lock->Lock()))
|
return B_ERROR;
|
||||||
{
|
|
||||||
snooze(1000);
|
|
||||||
}
|
|
||||||
s_cleared=0;
|
|
||||||
s_lock->Unlock();
|
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetNextFormat(media_format * out_format,
|
BMediaFormats::GetNextFormat(media_format * out_format,
|
||||||
media_format_description * out_description)
|
media_format_description * out_description)
|
||||||
{
|
{
|
||||||
CALLED();
|
UNIMPLEMENTED();
|
||||||
while(!(s_lock->Lock()))
|
return B_ERROR;
|
||||||
{
|
|
||||||
snooze(1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
s_cleared++;
|
|
||||||
|
|
||||||
if(s_cleared>(s_formats.CountItems()))
|
|
||||||
{
|
|
||||||
s_lock->Unlock();
|
|
||||||
return B_BAD_INDEX;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out_format = ((addon_list *)s_formats->ItemAt(s_cleared)).format;
|
|
||||||
out_description = ((addon_list *)s_formats->ItemAt(s_cleared)).description;
|
|
||||||
s_lock->Unlock();
|
|
||||||
return B_OK;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// You need to lock/unlock (only) when using RewindFormats()/GetNextFormat()
|
// You need to lock/unlock (only) when using RewindFormats()/GetNextFormat()
|
||||||
bool
|
bool
|
||||||
BMediaFormats::Lock()
|
BMediaFormats::Lock()
|
||||||
{
|
{
|
||||||
CALLED();
|
UNIMPLEMENTED();
|
||||||
return ( !s_lock->IsLocked() && s_lock->Lock() );
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BMediaFormats::Unlock()
|
BMediaFormats::Unlock()
|
||||||
{
|
{
|
||||||
CALLED();
|
UNIMPLEMENTED();
|
||||||
return s_lock->Unlock;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- begin deprecated API --- */
|
/* --- begin deprecated API --- */
|
||||||
@@ -453,60 +317,8 @@ BLocker BMediaFormats::s_lock;
|
|||||||
|
|
||||||
bool operator==(const media_format_description & a, const media_format_description & b)
|
bool operator==(const media_format_description & a, const media_format_description & b)
|
||||||
{
|
{
|
||||||
|
UNIMPLEMENTED();
|
||||||
CALLED();
|
return false;
|
||||||
if (!(a.family == b.family)) return false;
|
|
||||||
switch(a.family)
|
|
||||||
{
|
|
||||||
case B_BEOS_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.beos.format == b.u.beos.format)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_QUICKTIME_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.quicktime.codec == b.u.quicktime.codec)) return false;
|
|
||||||
if(!(a.u.quicktime.vendor == b.u.quicktime.vendor)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_AVI_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.avi.codec == b.u.avi.codec)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_ASF_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.asf.guid == b.u.asf.guid)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_AVR_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.avr.id == b.u.avr.id)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_MPEG_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.mpeg.id == b.u.mpeg.id)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_WAV_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.wav.codec == b.u.wav.codec)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_AIFF_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.aiff.codec == b.u.aiff.codec)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
case B_MISC_FORMAT_FAMILY:
|
|
||||||
{
|
|
||||||
if(!(a.u.misc.file_format == b.u.misc.file_format)) return false;
|
|
||||||
if(!(a.u.misc.codec == b.u.misc.codec)) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const media_format_description & a, const media_format_description & b)
|
bool operator<(const media_format_description & a, const media_format_description & b)
|
||||||
@@ -517,13 +329,8 @@ bool operator<(const media_format_description & a, const media_format_descriptio
|
|||||||
|
|
||||||
bool operator==(const GUID & a, const GUID & b)
|
bool operator==(const GUID & a, const GUID & b)
|
||||||
{
|
{
|
||||||
int indx;
|
UNIMPLEMENTED();
|
||||||
CALLED();
|
return false;
|
||||||
for(indx=0;indx<16;indx++)
|
|
||||||
{
|
|
||||||
if(!(a.data[indx]==b.data[indx])) return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const GUID & a, const GUID & b)
|
bool operator<(const GUID & a, const GUID & b)
|
||||||
@@ -532,4 +339,3 @@ bool operator<(const GUID & a, const GUID & b)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user