Added some new functions which seem to be required for Xentronics SampleStudio Pro.

Added missing license to implementation files.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8590 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-08-16 12:44:00 +00:00
parent 1b19c97c63
commit e4d07a3e71
4 changed files with 189 additions and 33 deletions
+18 -6
View File
@@ -55,14 +55,19 @@ public:
BMediaFile( BDataIO * source, BMediaFile( BDataIO * source,
int32 flags); // BFile is a BDataIO int32 flags); // BFile is a BDataIO
// these two constructors are for read-write access // these three constructors are for read-write access
BMediaFile(const entry_ref *ref, // these two are write-only BMediaFile(const entry_ref *ref, // these two are write-only
const media_file_format * mfi, const media_file_format * mfi,
int32 flags=0); int32 flags=0);
BMediaFile(BDataIO *destination, // BFile is a BDataIO BMediaFile(BDataIO *destination, // BFile is a BDataIO
const media_file_format * mfi, const media_file_format * mfi,
int32 flags=0); int32 flags=0);
BMediaFile(const media_file_format * mfi, // set file later using SetTo()
int32 flags=0);
status_t SetTo(const entry_ref *ref);
status_t SetTo(BDataIO *destination); // BFile is a BDataIO
virtual ~BMediaFile(); virtual ~BMediaFile();
status_t InitCheck() const; status_t InitCheck() const;
@@ -92,9 +97,9 @@ public:
// Create and add a track to the media file // Create and add a track to the media file
BMediaTrack *CreateTrack(media_format *mf, const media_codec_info *mci); BMediaTrack *CreateTrack(media_format *mf, const media_codec_info *mci, uint32 flags=0);
// Create and add a raw track to the media file (it has no encoder) // Create and add a raw track to the media file (it has no encoder)
BMediaTrack *CreateTrack(media_format *mf); BMediaTrack *CreateTrack(media_format *mf, uint32 flags=0);
// Lets you set the copyright info for the entire file // Lets you set the copyright info for the entire file
status_t AddCopyright(const char *data); status_t AddCopyright(const char *data);
@@ -109,16 +114,23 @@ public:
status_t CloseFile(void); status_t CloseFile(void);
// This is for controlling file format parameters // This is for controlling file format parameters
BParameterWeb *Web();
// returns a copy of the parameter web
status_t GetParameterWeb(BParameterWeb** outWeb);
status_t GetParameterValue(int32 id, void *valu, size_t *size); status_t GetParameterValue(int32 id, void *valu, size_t *size);
status_t SetParameterValue(int32 id, const void *valu, size_t size); status_t SetParameterValue(int32 id, const void *valu, size_t size);
BView *GetParameterView(); BView *GetParameterView();
// For the future... // For the future...
virtual status_t Perform(int32 selector, void * data); virtual status_t Perform(int32 selector, void * data);
private: private:
// deprecated, but for R5 compatibility
BParameterWeb *Web();
// Does nothing, returns B_ERROR, for Zeta compatiblity only
status_t ControlFile(int32 selector, void * io_data, size_t size);
BPrivate::media::MediaExtractor *fExtractor; BPrivate::media::MediaExtractor *fExtractor;
int32 _reserved_BMediaFile_was_fExtractorID; int32 _reserved_BMediaFile_was_fExtractorID;
int32 fTrackNum; int32 fTrackNum;
+9 -6
View File
@@ -81,7 +81,7 @@ public:
// The data returned through ReadFrames() will be in the format that's // The data returned through ReadFrames() will be in the format that's
// returned by this function. // returned by this function.
status_t DecodedFormat(media_format *inout_format, int32 flags = 0); status_t DecodedFormat(media_format *inout_format, uint32 flags = 0);
// CountFrames and Duration return the total number of frame and the // CountFrames and Duration return the total number of frame and the
// total duration (expressed in microseconds) of a track. // total duration (expressed in microseconds) of a track.
@@ -177,7 +177,8 @@ public:
status_t Flush(); status_t Flush();
// These are for controlling the underlying encoder and track parameters // These are for controlling the underlying encoder and track parameters
BParameterWeb *Web(); // returns a copy of the parameter web
status_t GetParameterWeb(BParameterWeb** outWeb);
status_t GetParameterValue(int32 id, void *valu, size_t *size); status_t GetParameterValue(int32 id, void *valu, size_t *size);
status_t SetParameterValue(int32 id, const void *valu, size_t size); status_t SetParameterValue(int32 id, const void *valu, size_t size);
BView *GetParameterView(); BView *GetParameterView();
@@ -196,6 +197,12 @@ virtual status_t Perform(int32 selector, void * data);
private: private:
friend class BMediaFile; friend class BMediaFile;
// deprecated, but for BeOS R5 compatibility
BParameterWeb *Web();
// Does nothing, returns B_ERROR, for Zeta compatiblity only
status_t ControlCodec(int32 selector, void *io_data, size_t size);
// for read-only access to a track // for read-only access to a track
BMediaTrack(BPrivate::media::MediaExtractor *extractor, int32 stream); BMediaTrack(BPrivate::media::MediaExtractor *extractor, int32 stream);
@@ -206,10 +213,6 @@ private:
BPrivate::media::Encoder *encoder, BPrivate::media::Encoder *encoder,
media_codec_info *mci); media_codec_info *mci);
#ifdef __BUILDING_MEDIA_TRACK_CPP
status_t DecodedFormat(media_format *inout_format);
#endif
void SetupWorkaround(); void SetupWorkaround();
bool SetupFormatTranslation(const media_format &from, media_format *to); bool SetupFormatTranslation(const media_format &from, media_format *to);
+115 -10
View File
@@ -1,8 +1,28 @@
/*********************************************************************** /*
* AUTHOR: Marcus Overhagen * Copyright (c) 2002-2004, Marcus Overhagen <[email protected]>
* FILE: MediaFile.cpp * All rights reserved.
* DESCR: *
***********************************************************************/ * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <MediaFile.h> #include <MediaFile.h>
#include <MediaTrack.h> #include <MediaTrack.h>
#include <File.h> #include <File.h>
@@ -15,6 +35,7 @@
* public BMediaFile * public BMediaFile
*************************************************************/ *************************************************************/
BMediaFile::BMediaFile(const entry_ref *ref) BMediaFile::BMediaFile(const entry_ref *ref)
{ {
CALLED(); CALLED();
@@ -23,6 +44,7 @@ BMediaFile::BMediaFile(const entry_ref *ref)
InitReader(new BFile(ref, O_RDONLY)); InitReader(new BFile(ref, O_RDONLY));
} }
BMediaFile::BMediaFile(BDataIO * source) BMediaFile::BMediaFile(BDataIO * source)
{ {
CALLED(); CALLED();
@@ -30,6 +52,7 @@ BMediaFile::BMediaFile(BDataIO * source)
InitReader(source); InitReader(source);
} }
BMediaFile::BMediaFile(const entry_ref * ref, BMediaFile::BMediaFile(const entry_ref * ref,
int32 flags) int32 flags)
{ {
@@ -39,6 +62,7 @@ BMediaFile::BMediaFile(const entry_ref * ref,
InitReader(new BFile(ref, O_RDONLY), flags); InitReader(new BFile(ref, O_RDONLY), flags);
} }
BMediaFile::BMediaFile(BDataIO * source, BMediaFile::BMediaFile(BDataIO * source,
int32 flags) int32 flags)
{ {
@@ -47,6 +71,7 @@ BMediaFile::BMediaFile(BDataIO * source,
InitReader(source, flags); InitReader(source, flags);
} }
BMediaFile::BMediaFile(const entry_ref *ref, BMediaFile::BMediaFile(const entry_ref *ref,
const media_file_format * mfi, const media_file_format * mfi,
int32 flags) int32 flags)
@@ -56,6 +81,7 @@ BMediaFile::BMediaFile(const entry_ref *ref,
fDeleteSource = true; fDeleteSource = true;
InitWriter(new BFile(ref, O_WRONLY), mfi, flags); InitWriter(new BFile(ref, O_WRONLY), mfi, flags);
} }
BMediaFile::BMediaFile(BDataIO *destination, BMediaFile::BMediaFile(BDataIO *destination,
const media_file_format * mfi, const media_file_format * mfi,
@@ -66,6 +92,29 @@ BMediaFile::BMediaFile(BDataIO *destination,
InitWriter(destination, mfi, flags); InitWriter(destination, mfi, flags);
} }
// File will be set later by SetTo()
BMediaFile::BMediaFile(const media_file_format * mfi,
int32 flags)
{
debugger("BMediaFile::BMediaFile not implemented");
}
status_t
BMediaFile::SetTo(const entry_ref *ref)
{
debugger("BMediaFile::SetTo not implemented");
}
status_t
BMediaFile::SetTo(BDataIO *destination)
{
debugger("BMediaFile::SetTo not implemented");
}
/* virtual */ /* virtual */
BMediaFile::~BMediaFile() BMediaFile::~BMediaFile()
{ {
@@ -78,6 +127,7 @@ BMediaFile::~BMediaFile()
delete fSource; delete fSource;
} }
status_t status_t
BMediaFile::InitCheck() const BMediaFile::InitCheck() const
{ {
@@ -85,6 +135,7 @@ BMediaFile::InitCheck() const
return fErr; return fErr;
} }
// Get info about the underlying file format. // Get info about the underlying file format.
status_t status_t
BMediaFile::GetFileFormatInfo(media_file_format *mfi) const BMediaFile::GetFileFormatInfo(media_file_format *mfi) const
@@ -96,6 +147,7 @@ BMediaFile::GetFileFormatInfo(media_file_format *mfi) const
return B_OK; return B_OK;
} }
const char * const char *
BMediaFile::Copyright(void) const BMediaFile::Copyright(void) const
{ {
@@ -103,6 +155,7 @@ BMediaFile::Copyright(void) const
return ""; return "";
} }
int32 int32
BMediaFile::CountTracks() const BMediaFile::CountTracks() const
{ {
@@ -149,6 +202,7 @@ BMediaFile::ReleaseTrack(BMediaTrack *track)
return B_ERROR; return B_ERROR;
} }
status_t status_t
BMediaFile::ReleaseAllTracks(void) BMediaFile::ReleaseAllTracks(void)
{ {
@@ -165,21 +219,48 @@ BMediaFile::ReleaseAllTracks(void)
return B_OK; return B_OK;
} }
// Create and add a track to the media file // Create and add a track to the media file
BMediaTrack * BMediaTrack *
BMediaFile::CreateTrack(media_format *mf, BMediaFile::CreateTrack(media_format *mf,
const media_codec_info *mci) const media_codec_info *mci,
uint32 flags)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return 0; return 0;
} }
// Create and add a raw track to the media file (it has no encoder) // Create and add a raw track to the media file (it has no encoder)
BMediaTrack * BMediaTrack *
BMediaFile::CreateTrack(media_format *mf) BMediaFile::CreateTrack(media_format *mf, uint32 flags)
{ {
UNIMPLEMENTED(); return CreateTrack(mf, NULL, flags);
return 0; }
// For BeOS R5 compatibility
extern "C" BMediaTrack * CreateTrack__10BMediaFileP12media_formatPC16media_codec_info(
BMediaFile *self, media_format *mf, const media_codec_info *mci);
BMediaTrack *
CreateTrack__10BMediaFileP12media_formatPC16media_codec_info(
BMediaFile *self,
media_format *mf,
const media_codec_info *mci)
{
return self->CreateTrack(mf, mci, 0);
}
// For BeOS R5 compatibility
extern "C" BMediaTrack * CreateTrack__10BMediaFileP12media_format(
BMediaFile *self, media_format *mf);
BMediaTrack *
CreateTrack__10BMediaFileP12media_format(
BMediaFile *self,
media_format *mf)
{
return self->CreateTrack(mf, NULL, 0);
} }
@@ -218,8 +299,18 @@ BMediaFile::CloseFile(void)
return B_OK; return B_OK;
} }
// This is for controlling file format parameters // This is for controlling file format parameters
// returns a copy of the parameter web
status_t
BMediaFile::GetParameterWeb(BParameterWeb** outWeb)
{
UNIMPLEMENTED();
return B_ERROR;
}
// deprecated BeOS R5 API
BParameterWeb * BParameterWeb *
BMediaFile::Web() BMediaFile::Web()
{ {
@@ -227,6 +318,7 @@ BMediaFile::Web()
return 0; return 0;
} }
status_t status_t
BMediaFile::GetParameterValue(int32 id, void *valu, size_t *size) BMediaFile::GetParameterValue(int32 id, void *valu, size_t *size)
{ {
@@ -234,6 +326,7 @@ BMediaFile::GetParameterValue(int32 id, void *valu, size_t *size)
return B_OK; return B_OK;
} }
status_t status_t
BMediaFile::SetParameterValue(int32 id, const void *valu, size_t size) BMediaFile::SetParameterValue(int32 id, const void *valu, size_t size)
{ {
@@ -249,6 +342,7 @@ BMediaFile::GetParameterView()
return 0; return 0;
} }
/* virtual */ status_t /* virtual */ status_t
BMediaFile::Perform(int32 selector, void * data) BMediaFile::Perform(int32 selector, void * data)
{ {
@@ -257,10 +351,19 @@ BMediaFile::Perform(int32 selector, void * data)
} }
status_t
BMediaFile::ControlFile(int32 selector, void * io_data, size_t size)
{
UNIMPLEMENTED();
return B_ERROR;
}
/************************************************************* /*************************************************************
* private BMediaFile * private BMediaFile
*************************************************************/ *************************************************************/
void void
BMediaFile::Init() BMediaFile::Init()
{ {
@@ -280,6 +383,7 @@ BMediaFile::Init()
fFileClosed = 0; fFileClosed = 0;
} }
void void
BMediaFile::InitReader(BDataIO *source, int32 flags) BMediaFile::InitReader(BDataIO *source, int32 flags)
{ {
@@ -298,6 +402,7 @@ BMediaFile::InitReader(BDataIO *source, int32 flags)
memset(fTrackList, 0, fTrackNum * sizeof(BMediaTrack *)); memset(fTrackList, 0, fTrackNum * sizeof(BMediaTrack *));
} }
void void
BMediaFile::InitWriter(BDataIO *source, const media_file_format * mfi, int32 flags) BMediaFile::InitWriter(BDataIO *source, const media_file_format * mfi, int32 flags)
{ {
+47 -11
View File
@@ -1,11 +1,28 @@
/*********************************************************************** /*
* AUTHOR: Marcus Overhagen * Copyright (c) 2002-2004, Marcus Overhagen <[email protected]>
* FILE: MediaTrack.cpp * All rights reserved.
* DESCR: *
***********************************************************************/ * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define __BUILDING_MEDIA_TRACK_CPP
#include <MediaTrack.h> #include <MediaTrack.h>
#include <Roster.h> #include <Roster.h>
#include <string.h> #include <string.h>
@@ -104,15 +121,17 @@ BMediaTrack::EncodedFormat(media_format *out_format) const
} }
status_t // for BeOS R5 compatibilitly
BMediaTrack::DecodedFormat(media_format *inout_format) extern "C" status_t DecodedFormat__11BMediaTrackP12media_format(BMediaTrack *self, media_format *inout_format);
status_t DecodedFormat__11BMediaTrackP12media_format(BMediaTrack *self,
media_format *inout_format)
{ {
return DecodedFormat(inout_format, 0); return self->DecodedFormat(inout_format, 0);
} }
status_t status_t
BMediaTrack::DecodedFormat(media_format *inout_format, int32 flags) BMediaTrack::DecodedFormat(media_format *inout_format, uint32 flags)
{ {
CALLED(); CALLED();
if (!inout_format) if (!inout_format)
@@ -513,6 +532,7 @@ BMediaTrack::Flush()
} }
// deprecated BeOS R5 API
BParameterWeb * BParameterWeb *
BMediaTrack::Web() BMediaTrack::Web()
{ {
@@ -521,6 +541,13 @@ BMediaTrack::Web()
} }
// returns a copy of the parameter web
status_t
BMediaTrack::GetParameterWeb(BParameterWeb** outWeb)
{
}
status_t status_t
BMediaTrack::GetParameterValue(int32 id, BMediaTrack::GetParameterValue(int32 id,
void *valu, void *valu,
@@ -638,6 +665,15 @@ BMediaTrack::BMediaTrack(BPrivate::MediaWriter *writer,
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
// Does nothing, returns B_ERROR, for Zeta compatiblity only
status_t
BMediaTrack::ControlCodec(int32 selector, void *io_data, size_t size)
{
return B_ERROR;
}
void void
BMediaTrack::SetupWorkaround() BMediaTrack::SetupWorkaround()
{ {