Wav play added - not ok, have bugs; Fixes for webif radio streaming bouquets/channels lists; Mute after standby fix; Hack to read 2x sdp on cable, for testing; Restore analog audio stereo/mono mode on zap

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@238 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 529b5dce7c
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2010-01-31 (Sun, 31 Jan 2010)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2010-01-31 16:27:23 +00:00
parent c26c998bd9
commit a03f1b05be
6 changed files with 38 additions and 11 deletions

View File

@@ -37,6 +37,9 @@
#include <sstream>
#include <driver/audioplay.h>
#include <linux/soundcard.h>
#include <audio_cs.h>
extern cAudio * audioDecoder;
#define ProgName "WavDec"
// nr of msecs to skip in ff/rev mode
@@ -47,7 +50,7 @@
struct WavHeader
{
char ChunkID[4];
int ChunkSize;
int ChunkSize;
char Format[4];
char Subchunk1ID[4];
int Subchunk1Size;
@@ -73,7 +76,7 @@ int endianTest=1;
((((l) & 0xff00) >> 8) | \
(((l) & 0x00ff) << 8)))
#define MAX_OUTPUT_SAMPLES 1022 /* AVIA_GT_PCM_MAX_SAMPLES-1 */
#define MAX_OUTPUT_SAMPLES 2048 /* AVIA_GT_PCM_MAX_SAMPLES-1 */
CBaseDec::RetCode CWavDec::Decoder(FILE *in, int OutputFd, State* state, CAudioMetaData* meta_data, time_t* time_played, unsigned int* secondsToSkip)
{
@@ -98,12 +101,15 @@ CBaseDec::RetCode CWavDec::Decoder(FILE *in, int OutputFd, State* state, CAudioM
Status=DATA_ERR;
return Status;
}
#if 0
if (SetDSP(OutputFd, fmt, meta_data->samplerate , mChannels))
{
Status=DSPSET_ERR;
return Status;
}
#endif
audioDecoder->PrepareClipPlay(mChannels, meta_data->samplerate, mBitsPerSample, fmt == AFMT_S16_LE ? 1 : 0);
int actSecsToSkip = (*secondsToSkip != 0) ? *secondsToSkip : MSECS_TO_SKIP / 1000;
unsigned int oldSecsToSkip = *secondsToSkip;
int jumppos=0;
@@ -154,13 +160,15 @@ CBaseDec::RetCode CWavDec::Decoder(FILE *in, int OutputFd, State* state, CAudioM
}
bytes = fread(buffer, 1, buffersize, in);
if (write(OutputFd, buffer, bytes) != bytes)
//if (write(OutputFd, buffer, bytes) != bytes)
if(audioDecoder->WriteClip((unsigned char*) buffer, bytes) != bytes)
{
fprintf(stderr,"%s: PCM write error (%s).\n", ProgName, strerror(errno));
Status=WRITE_ERR;
}
*time_played = (meta_data->bitrate!=0) ? (ftell(in)-header_size)*8/meta_data->bitrate : 0;
} while (bytes > 0 && *state!=STOP_REQ && Status==OK);
audioDecoder->StopClip();
free(buffer);
return Status;
}

View File

@@ -456,7 +456,7 @@ int CAudioPlayerGui::show()
clear_before_update = true;
update = true;
}
else if (msg == CRCInput::RC_home)
else if (msg == CRCInput::RC_home || msg == CRCInput::RC_stop)
{
if (m_state != CAudioPlayerGui::STOP)
stop();

View File

@@ -3874,7 +3874,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff )
} else {
tvMode( false );
}
AudioMute(current_muted, false );
AudioMute(current_muted, true);
if((mode == mode_tv) && wasshift) {
startAutoRecord(true);
}

View File

@@ -210,9 +210,11 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler */*hh
if(nr_str != "")
nr = atoi(nr_str.c_str());
int mode = NeutrinoAPI->Zapit->getMode();
for (int i = 0; i < (int) g_bouquetManager->Bouquets.size(); i++) {
ZapitChannelList * channels = mode == CZapitClient::MODE_RADIO ? &g_bouquetManager->Bouquets[i]->radioChannels : &g_bouquetManager->Bouquets[i]->tvChannels;
sel=(nr==(i+1)) ? "selected=\"selected\"" : "";
if(!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true")
if(!channels->empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true"))
yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(),
(encodeString(std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
//yresult += string_printf("<option value=%u %s>%s</option>\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str());
@@ -282,7 +284,8 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler */*hh
std::string abouquet, achannel_id, yresult, sel, sid;
int bnumber = 1;
int mode = CZapitClient::MODE_CURRENT;
//int mode = CZapitClient::MODE_CURRENT;
int mode = NeutrinoAPI->Zapit->getMode();
ySplitString(para," ",abouquet, achannel_id);
if(abouquet != "")

View File

@@ -29,6 +29,7 @@
#include <zapit/settings.h> // DEMUX_DEVICE
#include <zapit/types.h>
#include <zapit/bouquets.h>
#include <zapit/frontend_c.h>
#include <dmx_cs.h>
#define SDT_SIZE 1026
@@ -135,6 +136,7 @@ int nvod_service_ids(
return -1;
}
extern CFrontend *frontend;
int parse_sdt(
t_transport_stream_id *p_transport_stream_id,
t_original_network_id *p_original_network_id,
@@ -170,6 +172,8 @@ int parse_sdt(
unsigned char mask[DMX_FILTER_SIZE];
int flen;
bool cable_hack_done = false;
bool cable = (frontend->getInfo()->type == FE_QAM);
#if 1
flen = 5;
memset(filter, 0x00, DMX_FILTER_SIZE);
@@ -206,6 +210,7 @@ int parse_sdt(
return -1;
}
do {
_repeat:
if (dmx->Read(buffer, SDT_SIZE) < 0) {
delete dmx;
return -1;
@@ -215,8 +220,14 @@ int parse_sdt(
section_length = ((buffer[1] & 0x0F) << 8) | buffer[2];
transport_stream_id = (buffer[3] << 8) | buffer[4];
original_network_id = (buffer[8] << 8) | buffer[9];
if(cable_hack_done) {
if( (transport_stream_id == ((buffer[3] << 8) | buffer[4])) &&
(original_network_id == ((buffer[8] << 8) | buffer[9])))
break;
} else {
transport_stream_id = (buffer[3] << 8) | buffer[4];
original_network_id = (buffer[8] << 8) | buffer[9];
}
unsigned char secnum = buffer[6];
printf("[SDT] section %X last %X tsid 0x%x onid 0x%x -> %s\n", buffer[6], buffer[7], transport_stream_id, original_network_id, secdone[secnum] ? "skip" : "use");
@@ -342,6 +353,11 @@ int parse_sdt(
}
} while(sectotal < buffer[7]);
//while (filter[4]++ != buffer[7]);
if(cable && !cable_hack_done && sectotal == 0) {
cable_hack_done = true;
secdone[0] = 0;
goto _repeat;
}
delete dmx;
return 0;

View File

@@ -514,7 +514,7 @@ printf("[zapit] saving channel, apid %x sub pid %x mode %d volume %d\n", channel
}
if(audioDecoder) {
//audioDecoder->setVolume(volume_left, volume_right);
//audioDecoder->setChannel(audio_mode); //FIXME
audioDecoder->setChannel(audio_mode);
}
if (!we_playing)