dropped cServerConnection::m_Pending

This commit is contained in:
Frank Schmirler 2011-10-20 23:45:44 +02:00
parent 6b633dbfa2
commit bdaea38b86
4 changed files with 13 additions and 21 deletions

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
- dropped cServerConnection::m_Pending
- the icy-name HTTP header sent with radio streams makes VLC pick the wrong
demuxer. Send icy-name only for ES audio streams.
- fixed regression of "live TV must be switched in VDR main thread" change:

View File

@ -66,7 +66,6 @@ cServerConnection::cServerConnection(const char *Protocol, int Type):
cTBSocket(Type),
m_Protocol(Protocol),
m_DeferClose(false),
m_Pending(false),
m_ReadBytes(0),
m_WriteBytes(0),
m_WriteIndex(0)
@ -196,8 +195,6 @@ bool cServerConnection::Write(void)
if (m_WriteIndex == m_WriteBytes) {
m_WriteIndex = 0;
m_WriteBytes = 0;
if (m_Pending)
Command(NULL);
if (m_DeferClose)
return false;
Flushed();
@ -205,12 +202,12 @@ bool cServerConnection::Write(void)
return true;
}
bool cServerConnection::Respond(const char *Message, bool Last, ...)
bool cServerConnection::Respond(const char *Message, ...)
{
char *buffer;
int length;
va_list ap;
va_start(ap, Last);
va_start(ap, Message);
length = vasprintf(&buffer, Message, ap);
va_end(ap);
@ -233,7 +230,6 @@ bool cServerConnection::Respond(const char *Message, bool Last, ...)
m_WriteBytes += length;
m_WriteBuffer[m_WriteBytes++] = '\015';
m_WriteBuffer[m_WriteBytes++] = '\012';
m_Pending = !Last;
return true;
}

View File

@ -25,7 +25,6 @@ class cServerConnection: public cListObject, public cTBSocket
private:
const char *m_Protocol;
bool m_DeferClose;
bool m_Pending;
char m_ReadBuffer[MAXPARSEBUFFER];
uint m_ReadBytes;
@ -53,12 +52,8 @@ protected:
virtual bool Command(char *Cmd) = 0;
/* Will put Message into the response queue, which will be sent in the next
server cycle. Note that Message will be line-terminated by Respond.
Only one line at a time may be sent. If there are lines to follow, set
Last to false. Command(NULL) will be called in the next cycle, so you can
post the next line. */
virtual bool Respond(const char *Message, bool Last = true, ...);
//__attribute__ ((format (printf, 2, 4)));
server cycle. Note that Message will be line-terminated by Respond. */
virtual bool Respond(const char *Message, ...);
/* Add a request header */
void SetHeader(const char *Name, const char *Value, const char *Prefix = "") { m_Headers.insert(tStrStr(std::string(Prefix) + Name, Value)); }
@ -87,8 +82,8 @@ public:
virtual bool HasData(void) const;
/* Gets called by server when the socket can accept more data. Writes
the buffer filled up by Respond(). Calls Command(NULL) if there is a
command pending. Returns false in case of an error */
the buffer filled up by Respond(). Returns false in case of an
error */
virtual bool Write(void);
/* Gets called by server when there is incoming data to read. Calls
@ -128,7 +123,7 @@ public:
inline bool cServerConnection::HasData(void) const
{
return m_WriteBytes > 0 || m_Pending || m_DeferClose;
return m_WriteBytes > 0 || m_DeferClose;
}
#endif // VDR_STREAMDEV_SERVER_CONNECTION_H

View File

@ -147,7 +147,7 @@ bool cConnectionHTTP::ProcessRequest(void)
esyslog("streamdev-server connectionHTTP: Missing method or pathinfo");
} else if (it_method->second.compare("GET") == 0 && ProcessURI(it_pathinfo->second)) {
if (m_ChannelList)
return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
return Respond("%s", m_ChannelList->HttpHeader().c_str());
else if (m_Channel != NULL) {
cDevice *device = NULL;
if (ProvidesChannel(m_Channel, 0))
@ -164,7 +164,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (m_StreamType == stES && (m_Apid[0] || m_Dpid[0] || ISRADIO(m_Channel))) {
return Respond("HTTP/1.0 200 OK")
&& Respond("Content-Type: audio/mpeg")
&& Respond("icy-name: %s", true, m_Channel->Name())
&& Respond("icy-name: %s", m_Channel->Name())
&& Respond("");
} else if (ISRADIO(m_Channel)) {
return Respond("HTTP/1.0 200 OK")
@ -190,7 +190,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (it_method->second.compare("HEAD") == 0 && ProcessURI(it_pathinfo->second)) {
DeferClose();
if (m_ChannelList)
return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
return Respond("%s", m_ChannelList->HttpHeader().c_str());
else if (m_Channel != NULL) {
if (ProvidesChannel(m_Channel, 0)) {
if (m_StreamType == stEXT) {
@ -200,7 +200,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (m_StreamType == stES && (m_Apid[0] || m_Dpid[0] || ISRADIO(m_Channel))) {
return Respond("HTTP/1.0 200 OK")
&& Respond("Content-Type: audio/mpeg")
&& Respond("icy-name: %s", true, m_Channel->Name())
&& Respond("icy-name: %s", m_Channel->Name())
&& Respond("");
} else if (ISRADIO(m_Channel)) {
return Respond("HTTP/1.0 200 OK")
@ -235,7 +235,7 @@ void cConnectionHTTP::Flushed(void)
if (m_ChannelList) {
if (m_ChannelList->HasNext()) {
if (!Respond("%s", true, m_ChannelList->Next().c_str()))
if (!Respond("%s", m_ChannelList->Next().c_str()))
DeferClose();
}
else {