added Jamfile for dvb.media_addon and fixed compilation problems after refactoring

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20780 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2007-04-23 19:03:05 +00:00
parent 175eb4f0de
commit fcb9bdc0c9
10 changed files with 41 additions and 137 deletions
+1
View File
@@ -3,6 +3,7 @@ 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 demultiplexer ;
# SubInclude HAIKU_TOP src add-ons media media-add-ons reader ; # SubInclude HAIKU_TOP src add-ons media media-add-ons reader ;
# SubInclude HAIKU_TOP src add-ons media media-add-ons writer ; # 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 esound_sink ; SubInclude HAIKU_TOP src add-ons media media-add-ons esound_sink ;
SubInclude HAIKU_TOP src add-ons media media-add-ons legacy ; SubInclude HAIKU_TOP src add-ons media media-add-ons legacy ;
SubInclude HAIKU_TOP src add-ons media media-add-ons mixer ; SubInclude HAIKU_TOP src add-ons media media-add-ons mixer ;
@@ -25,7 +25,7 @@
#ifndef __DVB_CARD_H #ifndef __DVB_CARD_H
#define __DVB_CARD_H #define __DVB_CARD_H
#include "../drivers/cx23882/dvb.h" #include "dvb.h"
class DVBCard class DVBCard
{ {
@@ -42,7 +42,6 @@ struct device_info
char info[200]; char info[200];
media_format formats[5]; media_format formats[5];
flavor_info flavor; flavor_info flavor;
bool active; // workaround for zeta
}; };
@@ -107,16 +106,7 @@ DVBMediaAddon::InstantiateNodeFor(const flavor_info * info, BMessage * config, s
} }
*out_error = B_OK; *out_error = B_OK;
// workaround for Zeta return new DVBMediaNode(this, dev->name, dev->flavor.internal_id, dev->card);
if (dev->active) {
printf("DVB: max instances violation!!!\n");
*out_error = B_ERROR;
return NULL;
} else {
dev->active = true;
}
return new DVBMediaNode(this, dev->name, dev->flavor.internal_id, dev->card, &dev->active);
} }
@@ -149,19 +139,8 @@ DVBMediaAddon::AutoStart(int index, BMediaNode **outNode, int32 *outInternalID,
} }
*outHasMore = fDeviceList.ItemAt(index + 1) ? true : false; *outHasMore = fDeviceList.ItemAt(index + 1) ? true : false;
// workaround for Zeta
if (dev->active) {
printf("DVB: max instances violation!!!\n");
*outInternalID = -1;
*outNode = NULL;
return B_MEDIA_ADDON_FAILED;
}
dev->active = true;
*outInternalID = dev->flavor.internal_id; *outInternalID = dev->flavor.internal_id;
*outNode = new DVBMediaNode(this, dev->name, dev->flavor.internal_id, dev->card, &dev->active); *outNode = new DVBMediaNode(this, dev->name, dev->flavor.internal_id, dev->card);
printf("DVB: DVBMediaAddon::AutoStart, success\n"); printf("DVB: DVBMediaAddon::AutoStart, success\n");
@@ -234,8 +213,6 @@ DVBMediaAddon::AddDevice(DVBCard *card, const char *path)
dev->card = card; dev->card = card;
dev->active = false; // workaround for Zeta
// setup name and info, it's important that name starts with "DVB" // setup name and info, it's important that name starts with "DVB"
// snprintf(dev->name, sizeof(dev->name), "DVB-%s %s (%s)", dvbtype, dvbnumber, name); // snprintf(dev->name, sizeof(dev->name), "DVB-%s %s (%s)", dvbtype, dvbnumber, name);
// strlcpy(dev->info, info, sizeof(dev->info)); // strlcpy(dev->info, info, sizeof(dev->info));
@@ -44,12 +44,10 @@
#include <Entry.h> #include <Entry.h>
#include <Path.h> #include <Path.h>
#include "DefaultDecoder.h" #include "MediaFormat.h"
#include "Support.h" #include "Packet.h"
#include "HeaderFormat.h" #include "PacketQueue.h"
#include "packet.h" #include "pes.h"
#include "packet_queue.h"
#include "pes_extract.h"
#include "media_header_ex.h" #include "media_header_ex.h"
#include "config.h" #include "config.h"
@@ -113,11 +111,11 @@
DVBMediaNode::DVBMediaNode( DVBMediaNode::DVBMediaNode(
BMediaAddOn *addon, const char *name, BMediaAddOn *addon, const char *name,
int32 internal_id, DVBCard *card, bool *active) // bool *active is a workaround for Zeta int32 internal_id, DVBCard *card)
: BMediaNode(name) : BMediaNode(name)
, BMediaEventLooper()
, BBufferProducer(B_MEDIA_RAW_VIDEO) , BBufferProducer(B_MEDIA_RAW_VIDEO)
, BControllable() , BControllable()
, BMediaEventLooper()
, fStopDisabled(false) , fStopDisabled(false)
, fOutputEnabledRawVideo(false) , fOutputEnabledRawVideo(false)
, fOutputEnabledRawAudio(false) , fOutputEnabledRawAudio(false)
@@ -140,7 +138,7 @@ DVBMediaNode::DVBMediaNode(
, fThreadIdEncVideo(-1) , fThreadIdEncVideo(-1)
, fThreadIdMpegTS(-1) , fThreadIdMpegTS(-1)
, fTerminateThreads(false) , fTerminateThreads(false)
, fDemux(new TSDemux(fRawVideoQueue, fRawAudioQueue, fEncVideoQueue, fEncAudioQueue, fMpegTsQueue)) , fDemux(new TransportStreamDemux(fRawVideoQueue, fRawAudioQueue, fEncVideoQueue, fEncAudioQueue, fMpegTsQueue))
, fBufferGroupRawVideo(0) , fBufferGroupRawVideo(0)
, fBufferGroupRawAudio(0) , fBufferGroupRawAudio(0)
, fInterfaceType(DVB_TYPE_UNKNOWN) , fInterfaceType(DVB_TYPE_UNKNOWN)
@@ -163,15 +161,6 @@ DVBMediaNode::DVBMediaNode(
, fAudioDecoder(0) , fAudioDecoder(0)
, fCurrentVideoPacket(0) , fCurrentVideoPacket(0)
, fCurrentAudioPacket(0) , fCurrentAudioPacket(0)
, fMpeg2VideoDecoderImage(-1)
, fMpeg2AudioDecoderImage(-1)
, fAC3DecoderImage(-1)
, fDeinterlaceFilterImage(-1)
, instantiate_mpeg2_video_decoder(NULL)
, instantiate_mpeg2_audio_decoder(NULL)
, instantiate_ac3_audio_decoder(NULL)
, instantiate_deinterlace_filter(NULL)
, fActive(active)
{ {
TRACE("DVBMediaNode::DVBMediaNode\n"); TRACE("DVBMediaNode::DVBMediaNode\n");
@@ -182,8 +171,6 @@ DVBMediaNode::DVBMediaNode(
fInitStatus = B_OK; fInitStatus = B_OK;
LoadAddons();
InitDefaultFormats(); InitDefaultFormats();
// in the beginning, the required formats are the same as the defaults // in the beginning, the required formats are the same as the defaults
@@ -244,8 +231,6 @@ printf("deleting audio buffer group done\n");
delete fChannelList; delete fChannelList;
delete fAudioList; delete fAudioList;
UnloadAddons();
#ifdef DUMP_VIDEO #ifdef DUMP_VIDEO
close(fVideoFile); close(fVideoFile);
#endif #endif
@@ -256,59 +241,6 @@ printf("deleting audio buffer group done\n");
close(fRawAudioFile); close(fRawAudioFile);
#endif #endif
*fActive = false; // workaround for zeta
}
image_id
DVBMediaNode::LoadAddon(const char *path, const char *name, void **ptr)
{
image_id id = load_add_on(path);
if (id <= 0) {
*ptr = NULL;
printf("loading addon '%s' failed\n", path);
return -1;
}
status_t s = get_image_symbol(id, name, B_SYMBOL_TYPE_TEXT, ptr);
if (s < B_OK) {
unload_add_on(id);
*ptr = NULL;
printf("locating function '%s' in addon '%s' failed\n", name, path);
return -1;
}
return id;
}
void
DVBMediaNode::LoadAddons()
{
fMpeg2VideoDecoderImage = LoadAddon(MPEG2_VIDEO_DECODER_PATH,
"instantiate_mpeg2_video_decoder",
(void **)&instantiate_mpeg2_video_decoder);
fMpeg2AudioDecoderImage = LoadAddon(MPEG2_AUDIO_DECODER_PATH,
"instantiate_mpeg2_audio_decoder",
(void **)&instantiate_mpeg2_audio_decoder);
fAC3DecoderImage = LoadAddon(AC3_AUDIO_DECODER_PATH,
"instantiate_ac3_audio_decoder",
(void **)&instantiate_ac3_audio_decoder);
fDeinterlaceFilterImage = LoadAddon(DEINTERLACE_FILTER_PATH,
"instantiate_deinterlace_filter",
(void **)&instantiate_deinterlace_filter);
}
void
DVBMediaNode::UnloadAddons()
{
if (fMpeg2VideoDecoderImage >= 0)
unload_add_on(fMpeg2VideoDecoderImage);
if (fMpeg2AudioDecoderImage >= 0)
unload_add_on(fMpeg2AudioDecoderImage);
if (fAC3DecoderImage >= 0)
unload_add_on(fAC3DecoderImage);
if (fDeinterlaceFilterImage >= 0)
unload_add_on(fDeinterlaceFilterImage);
} }
@@ -1593,10 +1525,7 @@ DVBMediaNode::raw_audio_thread()
// create decoder interface // create decoder interface
if (instantiate_mpeg2_audio_decoder) fAudioDecoder = new MediaStreamDecoder(&_GetNextAudioChunk, this);
fAudioDecoder = (*instantiate_mpeg2_audio_decoder)(&_GetNextAudioChunk, this, "");
else
fAudioDecoder = new DefaultDecoder(&_GetNextAudioChunk, this);
err = fAudioDecoder->SetInputFormat(format); err = fAudioDecoder->SetInputFormat(format);
if (err) { if (err) {
@@ -1771,10 +1700,7 @@ DVBMediaNode::raw_video_thread()
// create decoder interface // create decoder interface
if (instantiate_mpeg2_video_decoder) fVideoDecoder = new MediaStreamDecoder(&_GetNextVideoChunk, this);
fVideoDecoder = (*instantiate_mpeg2_video_decoder)(&_GetNextVideoChunk, this, "");
else
fVideoDecoder = new DefaultDecoder(&_GetNextVideoChunk, this);
err = fVideoDecoder->SetInputFormat(format); err = fVideoDecoder->SetInputFormat(format);
if (err) { if (err) {
@@ -33,10 +33,10 @@
#include <media/MediaNode.h> #include <media/MediaNode.h>
#include <support/Locker.h> #include <support/Locker.h>
#include "ts_demux.h" #include "TransportStreamDemux.h"
#include "MediaStreamDecoder.h"
#include "DVBCard.h" #include "DVBCard.h"
#include "StringList.h" #include "StringList.h"
#include "DecoderInterface.h"
class BDiscreteParameter; class BDiscreteParameter;
class PacketQueue; class PacketQueue;
@@ -49,7 +49,7 @@ class DVBMediaNode :
{ {
public: public:
DVBMediaNode(BMediaAddOn *addon, DVBMediaNode(BMediaAddOn *addon,
const char *name, int32 internal_id, DVBCard *card, bool *active); // bool *active is a workaround for Zeta const char *name, int32 internal_id, DVBCard *card);
virtual ~DVBMediaNode(); virtual ~DVBMediaNode();
virtual status_t InitCheck() const { return fInitStatus; } virtual status_t InitCheck() const { return fInitStatus; }
@@ -149,10 +149,6 @@ private:
void LoadSettings(); void LoadSettings();
void LoadAddons();
void UnloadAddons();
image_id LoadAddon(const char *path, const char *name, void **ptr);
void AddStateItems(BDiscreteParameter *param); void AddStateItems(BDiscreteParameter *param);
void AddRegionItems(BDiscreteParameter *param); void AddRegionItems(BDiscreteParameter *param);
void AddChannelItems(BDiscreteParameter *param); void AddChannelItems(BDiscreteParameter *param);
@@ -247,7 +243,7 @@ private:
volatile bool fTerminateThreads; volatile bool fTerminateThreads;
TSDemux * fDemux; TransportStreamDemux * fDemux;
BBufferGroup * fBufferGroupRawVideo; BBufferGroup * fBufferGroupRawVideo;
BBufferGroup * fBufferGroupRawAudio; BBufferGroup * fBufferGroupRawAudio;
@@ -277,26 +273,14 @@ private:
StringList * fChannelList; StringList * fChannelList;
StringList * fAudioList; StringList * fAudioList;
DecoderInterface * fVideoDecoder; MediaStreamDecoder *fVideoDecoder;
DecoderInterface * fAudioDecoder; MediaStreamDecoder *fAudioDecoder;
Packet * fCurrentVideoPacket; Packet * fCurrentVideoPacket;
Packet * fCurrentAudioPacket; Packet * fCurrentAudioPacket;
image_id fMpeg2VideoDecoderImage;
image_id fMpeg2AudioDecoderImage;
image_id fAC3DecoderImage;
image_id fDeinterlaceFilterImage;
DecoderInterface * (*instantiate_mpeg2_video_decoder)(get_next_chunk_func, void *, const char *);
DecoderInterface * (*instantiate_mpeg2_audio_decoder)(get_next_chunk_func, void *, const char *);
DecoderInterface * (*instantiate_ac3_audio_decoder)(get_next_chunk_func, void *, const char *);
DecoderInterface * (*instantiate_deinterlace_filter)(get_next_chunk_func, void *, const char *);
BLocker lock; BLocker lock;
bool * fActive; // workaround for Zeta
// used only for debugging: // used only for debugging:
int fVideoFile; int fVideoFile;
int fAudioFile; int fAudioFile;
@@ -0,0 +1,16 @@
SubDir HAIKU_TOP src add-ons media media-add-ons dvb ;
UsePrivateHeaders drivers ;
Addon dvb.media_addon :
DVBCard.cpp
DVBMediaAddon.cpp
DVBMediaNode.cpp
MediaFormat.cpp
MediaStreamDecoder.cpp
Packet.cpp
PacketQueue.cpp
pes.cpp
TransportStreamDemux.cpp
: be media
;
@@ -23,6 +23,7 @@
*/ */
#include <media/MediaFormats.h> #include <media/MediaFormats.h>
#include <media/MediaNode.h>
#include <stdio.h> #include <stdio.h>
#include "MediaFormat.h" #include "MediaFormat.h"
@@ -28,7 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "packet.h" #include "Packet.h"
#define PACKET #define PACKET
#ifdef PACKET #ifdef PACKET
@@ -28,9 +28,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ts_demux.h" #include "TransportStreamDemux.h"
#include "packet.h" #include "Packet.h"
#include "packet_queue.h" #include "PacketQueue.h"
#define TRACE_TS_DEMUX #define TRACE_TS_DEMUX
#ifdef TRACE_TS_DEMUX #ifdef TRACE_TS_DEMUX
+1 -2
View File
@@ -25,8 +25,7 @@
#ifndef _DVB_MEDIA_ADDON_CONFIG_H_ #ifndef _DVB_MEDIA_ADDON_CONFIG_H_
#define _DVB_MEDIA_ADDON_CONFIG_H_ #define _DVB_MEDIA_ADDON_CONFIG_H_
#include "revision.h" #define REVISION "unknown"
#define VERSION "1.0" #define VERSION "1.0"
#define BUILD __DATE__ " "__TIME__ #define BUILD __DATE__ " "__TIME__