media_reader/media_writer: Fix build

This commit is contained in:
Dario Casalinuovo 2016-02-12 23:00:52 +01:00
parent b1d006d7f8
commit 44200efd5d
14 changed files with 72 additions and 218 deletions

View File

@ -1,8 +1,8 @@
SubDir HAIKU_TOP src add-ons media media-add-ons ;
# SubInclude HAIKU_TOP src add-ons media media-add-ons demultiplexer ;
# SubInclude HAIKU_TOP src add-ons media media-add-ons writer ;
SubInclude HAIKU_TOP src add-ons media media-add-ons dvb ;
SubInclude HAIKU_TOP src add-ons media media-add-ons equalizer ;
SubInclude HAIKU_TOP src add-ons media media-add-ons esound_sink ;
SubInclude HAIKU_TOP src add-ons media media-add-ons firewire_dv ;
SubInclude HAIKU_TOP src add-ons media media-add-ons legacy ;
@ -17,6 +17,5 @@ SubInclude HAIKU_TOP src add-ons media media-add-ons usb_webcam ;
SubInclude HAIKU_TOP src add-ons media media-add-ons video_producer_demo ;
SubInclude HAIKU_TOP src add-ons media media-add-ons videowindow ;
SubInclude HAIKU_TOP src add-ons media media-add-ons video_mixer ;
SubInclude HAIKU_TOP src add-ons media media-add-ons equalizer ;
SubInclude HAIKU_TOP src add-ons media media-add-ons vst_host ;
SubInclude HAIKU_TOP src add-ons media media-add-ons writer ;

View File

@ -25,7 +25,8 @@ void print_multistream_format(media_multistream_format * format) {
}
fprintf(stderr," avg_bit_rate(%f) max_bit_rate(%f)",
format->avg_bit_rate,format->max_bit_rate);
fprintf(stderr," avg_chunk_size(%i) max_chunk_size(%i)",
fprintf(stderr," avg_chunk_size(%" B_PRId32
") max_chunk_size(%" B_PRId32 ")",
format->avg_chunk_size,format->max_chunk_size);
}

View File

@ -8,11 +8,11 @@ local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
Application [ MultiArchDefaultGristFiles reader.media_addon ] :
AbstractFileInterfaceNode.cpp
AbstractFileInterfaceAddOn.cpp
../AbstractFileInterfaceNode.cpp
../AbstractFileInterfaceAddOn.cpp
MediaReader.cpp
MediaReaderAddOn.cpp
misc.cpp
../misc.cpp
: be media [ TargetLibsupc++ ]
;
}

View File

@ -472,7 +472,7 @@ void MediaReader::Connect(
FindLatencyFor(output.destination, &fDownstreamLatency, &id);
// compute the buffer period (must be done before setbuffergroup)
fBufferPeriod = bigtime_t(1000 * 8000000 / 1024
fBufferPeriod = bigtime_t(1000u * 8000000u / 1024u
* output.format.u.multistream.max_chunk_size
/ output.format.u.multistream.max_bit_rate);
@ -645,7 +645,7 @@ void MediaReader::AdditionalBufferRequested( // used to be Reserved 0
PRINT("MediaReader::AdditionalBufferRequested got an error from GetFilledBuffer.\n");
return; // don't send the buffer
}
SendBuffer(buffer,output.destination);
SendBuffer(buffer, output.source, output.destination);
}
}
@ -689,7 +689,7 @@ status_t MediaReader::HandleBuffer(
buffer->Recycle();
} else {
if (fOutputEnabled) {
status = SendBuffer(buffer,output.destination);
status = SendBuffer(buffer, output.source, output.destination);
if (status != B_OK) {
PRINT("MediaReader::HandleEvent got an error from SendBuffer.\n");
buffer->Recycle();

View File

@ -66,6 +66,9 @@ virtual void NodeRegistered(void); /* reserved 2 */
/*****************************/
/* begin from BFileInterface */
protected:
using AbstractFileInterfaceNode::SetRef;
virtual status_t SetRef(
const entry_ref & file,
bool create,

View File

@ -45,6 +45,9 @@ virtual status_t GetFileFormatList(
int32 in_read_items, // this many slots in out_readable_formats
int32 * out_read_items, // set this to actual # available, even if bigger than in count
void * _reserved); // ignore until further notice
using AbstractFileInterfaceAddOn::SniffTypeKind;
virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(s)
const BMimeType & type,
uint64 in_kinds,

View File

@ -2,17 +2,18 @@ SubDir HAIKU_TOP src add-ons media media-add-ons writer ;
UsePrivateHeaders media ;
SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons media media-add-ons ] ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
Addon [ MultiArchDefaultGristFiles writer.media_addon ] :
Application [ MultiArchDefaultGristFiles writer.media_addon ] :
../AbstractFileInterfaceNode.cpp
../AbstractFileInterfaceAddOn.cpp
MediaWriter.cpp
MediaWriterAddOn.cpp
misc.cpp
: be media
: true
../misc.cpp
: be media [ TargetLibsupc++ ]
;
}
}

View File

@ -28,7 +28,7 @@
#include "../AbstractFileInterfaceNode.h"
#include "MediaWriter.h"
#include "misc.h"
#include "../misc.h"
#include <stdio.h>
#include <string.h>
@ -48,14 +48,14 @@ MediaWriter::~MediaWriter(void)
}
MediaWriter::MediaWriter(
size_t defaultChunkSize = 8192,
float defaultBitRate = 800000,
const flavor_info * info = 0,
BMessage * config = 0,
BMediaAddOn * addOn = 0)
size_t defaultChunkSize,
float defaultBitRate,
const flavor_info * info,
BMessage * config,
BMediaAddOn * addOn)
: BMediaNode("MediaWriter"),
AbstractFileInterfaceNode(defaultChunkSize,defaultBitRate,info,config,addOn),
BBufferConsumer(B_MEDIA_MULTISTREAM)
BBufferConsumer(B_MEDIA_MULTISTREAM),
AbstractFileInterfaceNode(defaultChunkSize,defaultBitRate,info,config,addOn)
{
fprintf(stderr,"MediaWriter::MediaWriter\n");
// null some fields
@ -459,7 +459,7 @@ status_t MediaWriter::SeekTagRequested(
status_t MediaWriter::HandleBuffer(
const media_timed_event *event,
bigtime_t lateness,
bool realTimeEvent = false)
bool realTimeEvent)
{
fprintf(stderr,"MediaWriter::HandleBuffer\n");
BBuffer * buffer = const_cast<BBuffer*>((BBuffer*)event->pointer);
@ -479,7 +479,7 @@ status_t MediaWriter::HandleBuffer(
status_t MediaWriter::HandleDataStatus(
const media_timed_event *event,
bigtime_t lateness,
bool realTimeEvent = false)
bool realTimeEvents)
{
fprintf(stderr,"MediaWriter::HandleDataStatus");
// we have no where to send a data status to.
@ -500,8 +500,8 @@ void MediaWriter::GetFlavor(flavor_info * outInfo, int32 id)
return;
}
AbstractFileInterfaceNode::GetFlavor(outInfo,id);
outInfo->name = "OpenBeOS Media Writer";
outInfo->info = "The OpenBeOS Media Writer consumes a multistream and writes a file.";
strcpy(outInfo->name, "OpenBeOS Media Writer");
strcpy(outInfo->info, "The OpenBeOS Media Writer consumes a multistream and writes a file.");
outInfo->kinds |= B_BUFFER_CONSUMER;
outInfo->in_format_count = 1; // 1 input
media_format * formats = new media_format[outInfo->in_format_count];
@ -541,7 +541,7 @@ status_t MediaWriter::WriteFileBuffer(
fprintf(stderr,"<- B_NO_INIT\n");
return B_NO_INIT;
}
fprintf(stderr," writing %i bytes at %i\n",
fprintf(stderr," writing %" B_PRId32 " bytes at %lld\n",
buffer->SizeUsed(),GetCurrentFile()->Position());
ssize_t bytesWriten = GetCurrentFile()->Write(buffer->Data(),buffer->SizeUsed());
if (bytesWriten < 0) {
@ -556,19 +556,19 @@ status_t MediaWriter::WriteFileBuffer(
// stuffing
// -------------------------------------------------------- //
status_t MediaWriter::_Reserved_MediaWriter_0(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_1(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_2(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_3(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_4(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_5(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_6(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_7(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_8(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_9(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_10(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_11(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_12(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_13(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_14(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_15(void *) {}
status_t MediaWriter::_Reserved_MediaWriter_0(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_1(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_2(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_3(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_4(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_5(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_6(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_7(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_8(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_9(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_10(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_11(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_12(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_13(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_14(void *) { return B_ERROR; }
status_t MediaWriter::_Reserved_MediaWriter_15(void *) { return B_ERROR; }

View File

@ -66,6 +66,9 @@ virtual void NodeRegistered(void); /* reserved 2 */
/*****************************/
/* begin from BFileInterface */
protected:
using AbstractFileInterfaceNode::SetRef;
virtual status_t SetRef(
const entry_ref & file,
bool create,

View File

@ -149,19 +149,19 @@ int main(int argc, char *argv[])
// stuffing
// -------------------------------------------------------- //
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_0(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_1(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_2(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_3(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_4(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_5(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_6(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_7(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_8(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_9(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_10(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_11(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_12(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_13(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_14(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_15(void *) {};
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_0(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_1(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_2(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_3(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_4(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_5(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_6(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_7(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_8(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_9(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_10(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_11(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_12(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_13(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_14(void *) { return B_ERROR; };
status_t MediaWriterAddOn::_Reserved_MediaWriterAddOn_15(void *) { return B_ERROR; };

View File

@ -45,6 +45,9 @@ virtual status_t GetFileFormatList(
int32 in_read_items, // this many slots in out_readable_formats
int32 * out_read_items, // set this to actual # available, even if bigger than in count
void * _reserved); // ignore until further notice
using AbstractFileInterfaceAddOn::SniffTypeKind;
virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(s)
const BMimeType & type,
uint64 in_kinds,

View File

@ -1,129 +0,0 @@
// misc.cpp
//
// Andrew Bachmann, 2002
//
// Some functions for general debugging and
// working around be media kit bugs.
#include "misc.h"
#include <stdio.h>
// -------------------------------------------------------- //
// lib functions
// -------------------------------------------------------- //
void print_multistream_format(media_multistream_format * format) {
fprintf(stderr,"[");
switch (format->format) {
case media_multistream_format::B_ANY: fprintf(stderr,"ANY"); break;
case media_multistream_format::B_VID: fprintf(stderr,"VID"); break;
case media_multistream_format::B_AVI: fprintf(stderr,"AVI"); break;
case media_multistream_format::B_MPEG1: fprintf(stderr,"MPEG1"); break;
case media_multistream_format::B_MPEG2: fprintf(stderr,"MPEG2"); break;
case media_multistream_format::B_QUICKTIME: fprintf(stderr,"QUICKTIME"); break;
default: fprintf(stderr,"????"); break;
}
fprintf(stderr," avg_bit_rate(%f) max_bit_rate(%f)",
format->avg_bit_rate,format->max_bit_rate);
fprintf(stderr," avg_chunk_size(%i) max_chunk_size(%i)",
format->avg_chunk_size,format->max_chunk_size);
}
void print_media_format(media_format * format) {
fprintf(stderr,"{");
switch (format->type) {
case B_MEDIA_NO_TYPE: fprintf(stderr,"NO_TYPE"); break;
case B_MEDIA_UNKNOWN_TYPE: fprintf(stderr,"UNKNOWN_TYPE"); break;
case B_MEDIA_RAW_AUDIO: fprintf(stderr,"RAW_AUDIO"); break;
case B_MEDIA_RAW_VIDEO: fprintf(stderr,"RAW_VIDEO"); break;
case B_MEDIA_VBL: fprintf(stderr,"VBL"); break;
case B_MEDIA_TIMECODE: fprintf(stderr,"TIMECODE"); break;
case B_MEDIA_MIDI: fprintf(stderr,"MIDI"); break;
case B_MEDIA_TEXT: fprintf(stderr,"TEXT"); break;
case B_MEDIA_HTML: fprintf(stderr,"HTML"); break;
case B_MEDIA_MULTISTREAM: fprintf(stderr,"MULTISTREAM"); break;
case B_MEDIA_PARAMETERS: fprintf(stderr,"PARAMETERS"); break;
case B_MEDIA_ENCODED_AUDIO: fprintf(stderr,"ENCODED_AUDIO"); break;
case B_MEDIA_ENCODED_VIDEO: fprintf(stderr,"ENCODED_VIDEO"); break;
default: fprintf(stderr,"????"); break;
}
fprintf(stderr,":");
switch (format->type) {
case B_MEDIA_RAW_AUDIO: fprintf(stderr,"RAW_AUDIO"); break;
case B_MEDIA_RAW_VIDEO: fprintf(stderr,"RAW_VIDEO"); break;
case B_MEDIA_MULTISTREAM: print_multistream_format(&format->u.multistream); break;
case B_MEDIA_ENCODED_AUDIO: fprintf(stderr,"ENCODED_AUDIO"); break;
case B_MEDIA_ENCODED_VIDEO: fprintf(stderr,"ENCODED_VIDEO"); break;
default: fprintf(stderr,"????"); break;
}
fprintf(stderr,"}");
}
bool multistream_format_is_acceptible(
const media_multistream_format & producer_format,
const media_multistream_format & consumer_format)
{
// first check the format, if necessary
if (consumer_format.format != media_multistream_format::B_ANY) {
if (consumer_format.format != producer_format.format) {
return false;
}
}
// then check the average bit rate
if (consumer_format.avg_bit_rate != media_multistream_format::wildcard.avg_bit_rate) {
if (consumer_format.avg_bit_rate != producer_format.avg_bit_rate) {
// do they have to match exactly? I don't know. assume yes.
return false;
}
}
// then check the maximum bit rate
if (consumer_format.max_bit_rate != media_multistream_format::wildcard.max_bit_rate) {
if (consumer_format.max_bit_rate != producer_format.max_bit_rate) {
// do they have to match exactly? I don't know. assume yes.
return false;
}
}
// then check the average chunk size
if (consumer_format.avg_chunk_size != media_multistream_format::wildcard.avg_chunk_size) {
if (consumer_format.avg_chunk_size != producer_format.avg_chunk_size) {
// do they have to match exactly? I don't know. assume yes.
return false;
}
}
// then check the maximum bit rate
if (consumer_format.max_chunk_size != media_multistream_format::wildcard.max_chunk_size) {
if (consumer_format.max_chunk_size != producer_format.max_chunk_size) {
// do they have to match exactly? I don't know. assume yes.
return false;
}
}
// should also check format specific fields, and others?
return true;
}
bool format_is_acceptible(
const media_format & producer_format,
const media_format & consumer_format)
{
// first check the type, if necessary
if (consumer_format.type != B_MEDIA_UNKNOWN_TYPE) {
if (consumer_format.type != producer_format.type) {
return false;
}
switch (consumer_format.type) {
case B_MEDIA_MULTISTREAM:
if (!multistream_format_is_acceptible(producer_format.u.multistream,
consumer_format.u.multistream)) {
return false;
}
break;
default:
fprintf(stderr,"format_is_acceptible : unimplemented type.\n");
return format_is_compatible(producer_format,consumer_format);
break;
}
}
// should also check non-type fields?
return true;
}

View File

@ -1,30 +0,0 @@
// misc.h
//
// Andrew Bachmann, 2002
//
// Some functions for general debugging and
// working around be media kit bugs.
#if !defined(_MISC_H)
#define _MISC_H
#include <MediaDefs.h>
// -------------------------------------------------------- //
// lib functions
// -------------------------------------------------------- //
void print_multistream_format(media_multistream_format * format);
void print_media_format(media_format * format);
bool multistream_format_is_acceptible(
const media_multistream_format & producer_format,
const media_multistream_format & consumer_format);
bool format_is_acceptible(
const media_format & producer_format,
const media_format & consumer_format);
#endif // _MISC_H