Feature #447 ยป muggle-0.2.3-add-span-0.0.7-support.diff
| muggle.c | ||
|---|---|---|
|
#include "vdr_setup.h"
|
||
|
#include "vdr_player.h"
|
||
|
#include "mg_tools.h"
|
||
|
#include "pcmplayer.h"
|
||
|
#include <vdr/i18n.h>
|
||
|
#define __STL_CONFIG_H
|
||
| ... | ... | |
|
bool mgMuggle::Service( const char *Id, void *Data ) {
|
||
|
bool result = false;
|
||
|
if( !strcmp( Id, "ReplayDirectoryImages" ) ) {
|
||
|
if (strcmp(Id, SPAN_PROVIDER_CHECK_ID) == 0) {
|
||
|
if(Data) {
|
||
|
*((Span_Provider_Check_1_0*)Data)->isActive = true;
|
||
|
}
|
||
|
result = true;
|
||
|
}
|
||
|
else if( !strcmp( Id, "ReplayDirectoryImages" ) ) {
|
||
|
if( Data ) {
|
||
|
// check whether there is a current player and signal the new image playlist to it
|
||
|
mgPlayerControl *c = PlayerControl();
|
||
| pcmplayer.c | ||
|---|---|---|
|
#ifdef DEBUGPES
|
||
|
FILE *peslog = fopen( "pes.dump", "w" );
|
||
|
#endif
|
||
|
bool spanFrameIncomplete = true;
|
||
|
int spanFrameIndex = 0;
|
||
|
dsyslog ("muggle: player thread started (pid=%d)", getpid ());
|
||
| ... | ... | |
|
case dsPlay:
|
||
|
{
|
||
|
pcm = ds->pcm;
|
||
|
spanFrameIndex = ds->index;
|
||
|
m_index = ds->index / 1000;
|
||
|
m_state = msNormalize;
|
||
|
}
|
||
| ... | ... | |
|
the_setup.AudioMode ?
|
||
|
amDither : amRound );
|
||
|
if (outlen) {
|
||
|
/****************************************************************/
|
||
|
// Spectrum Analyzer: Hand over the PCM16-data to SpAn
|
||
|
cPlugin *Plugin = cPluginManager::CallFirstService(SPAN_SET_PCM_DATA_ID, NULL);
|
||
|
if (Plugin) {
|
||
|
Span_SetPcmData_1_0 SetPcmData;
|
||
|
SetPcmData.length = outlen;
|
||
|
// the timestamp (ms) of the frame(s) to be visualized:
|
||
|
SetPcmData.index = spanFrameIndex;
|
||
|
// tell SpAn the ringbuffer's size for it's internal bookkeeping of the data to be visualized:
|
||
|
SetPcmData.bufferSize = MP3BUFSIZE;
|
||
|
SetPcmData.data = lpcmFrame.Data; // get rid of the header
|
||
|
SetPcmData.bigEndian = false;
|
||
|
cPluginManager::CallFirstService(SPAN_SET_PCM_DATA_ID, &SetPcmData);
|
||
|
}
|
||
|
/****************************************************************/
|
||
|
outlen += sizeof (lpcmFrame.LPCM) + LEN_CORR;
|
||
|
lpcmFrame.PES[4] = outlen >> 8;
|
||
|
lpcmFrame.PES[5] = outlen;
|
||
| ... | ... | |
|
int w = PlayVideo (p, pc);
|
||
|
#endif
|
||
|
if (w > 0) {
|
||
|
/****************************************************************/
|
||
|
// Spectrum Analyzer: Tell SpAn which timestamp is currently playing
|
||
|
if ( spanFrameIncomplete ) {
|
||
|
Span_SetPlayindex_1_0 SetPlayindexData;
|
||
|
cPlugin *Plugin = cPluginManager::CallFirstService(SPAN_SET_PLAYINDEX_ID, NULL);
|
||
|
if (Plugin) {
|
||
|
SetPlayindexData.index = spanFrameIndex;
|
||
|
cPluginManager::CallFirstService(SPAN_SET_PLAYINDEX_ID, &SetPlayindexData);
|
||
|
}
|
||
|
spanFrameIncomplete = false;
|
||
|
}
|
||
|
/****************************************************************/
|
||
|
p += w;
|
||
|
pc -= w;
|
||
|
if (pc <= 0) {
|
||
|
m_ringbuffer->Drop (m_pframe);
|
||
|
m_pframe = 0;
|
||
|
spanFrameIncomplete = true;
|
||
|
}
|
||
|
}
|
||
|
else if (w < 0 && FATALERRNO) {
|
||
| pcmplayer.h | ||
|---|---|---|
|
}
|
||
|
};
|
||
|
/****************************************************************/
|
||
|
|
||
|
#define SPAN_PROVIDER_CHECK_ID "Span-ProviderCheck-v1.0"
|
||
|
#define SPAN_SET_PCM_DATA_ID "Span-SetPcmData-v1.1"
|
||
|
#define SPAN_SET_PLAYINDEX_ID "Span-SetPlayindex-v1.0"
|
||
|
//Span requests to collect possible providers / clients
|
||
|
struct Span_Provider_Check_1_0 {
|
||
|
bool *isActive;
|
||
|
bool *isRunning;
|
||
|
};
|
||
|
// SpanData
|
||
|
struct Span_SetPcmData_1_0 {
|
||
|
unsigned int length; // the length of the PCM-data
|
||
|
const unsigned char *data; // the PCM-Data
|
||
|
int index; // the timestamp (ms) of the frame(s) to be visualized
|
||
|
unsigned int bufferSize; // for span-internal bookkeeping of the data to be visualized
|
||
|
bool bigEndian; // are the pcm16-data coded bigEndian?
|
||
|
};
|
||
|
struct Span_SetPlayindex_1_0 {
|
||
|
int index; // the timestamp (ms) of the frame(s) being currently played
|
||
|
};
|
||
|
/****************************************************************/
|
||
| vdr_player.c | ||
|---|---|---|
|
#include "mg_tools.h"
|
||
|
char coverpicture[256];
|
||
|
#define SPAN_PROVIDER_CHECK_ID "Span-ProviderCheck-v1.0"
|
||
|
#define SPAN_CLIENT_CHECK_ID "Span-ClientCheck-v1.0"
|
||
|
#define SPAN_SET_PCM_DATA_ID "Span-SetPcmData-v1.1"
|
||
|
#define SPAN_SET_PLAYINDEX_ID "Span-SetPlayindex-v1.0"
|
||
|
#define SPAN_GET_BAR_HEIGHTS_ID "Span-GetBarHeights-v1.0"
|
||
|
#include "symbols/shuffle.xpm"
|
||
|
#include "symbols/loop.xpm"
|
||