summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-03-09 23:29:15 (GMT)
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2011-03-09 23:29:15 (GMT)
commit1b0a4c38d824231222bd3059a2c8c77920fb7e6c (patch)
tree2fefa321093b14ef37e82cbab2843ab10d70506e
parent1b2baff9fcb93e491a170f15482175cb473b34b3 (diff)
downloadvdr-plugin-live-1b0a4c38d824231222bd3059a2c8c77920fb7e6c.tar.gz
vdr-plugin-live-1b0a4c38d824231222bd3059a2c8c77920fb7e6c.tar.bz2
Added the content type header 'video/mpeg' in the recstream page.
This change was suggested by vdr-portal.de user 'hepi'. See http://www.vdr-portal.de/board/thread.php?threadid=101842
-rw-r--r--pages/recstream.ecpp77
1 files changed, 39 insertions, 38 deletions
diff --git a/pages/recstream.ecpp b/pages/recstream.ecpp
index 015206e..7033518 100644
--- a/pages/recstream.ecpp
+++ b/pages/recstream.ecpp
@@ -15,25 +15,25 @@ using namespace vdrlive;
off_t RecSize(cRecording const * recording)
{
- cFileName recFile(recording->FileName(), false, false);
- off_t recSize = 0;
- for (cUnbufferedFile *recData = recFile.Open(); recData; recData = recFile.NextFile()) {
- struct stat buf;
- if (0 == stat(recFile.Name(), &buf)) {
- recSize += buf.st_size;
- // dsyslog("LIVE: size of recording part %s is %ld", recFile.Name(), buf.st_size);
- }
- else {
- esyslog("LIVE: can't determine size of %s", recFile.Name());
- }
- }
- // dsyslog("LIVE: total size of %s is %ld", recording->FileName(), recSize);
- return recSize;
+ cFileName recFile(recording->FileName(), false, false);
+ off_t recSize = 0;
+ for (cUnbufferedFile *recData = recFile.Open(); recData; recData = recFile.NextFile()) {
+ struct stat buf;
+ if (0 == stat(recFile.Name(), &buf)) {
+ recSize += buf.st_size;
+ // dsyslog("LIVE: size of recording part %s is %ld", recFile.Name(), buf.st_size);
+ }
+ else {
+ esyslog("LIVE: can't determine size of %s", recFile.Name());
+ }
+ }
+ // dsyslog("LIVE: total size of %s is %ld", recording->FileName(), recSize);
+ return recSize;
}
</%pre>
<%args>
- string recid;
+ string recid;
</%args>
<%session scope="global">
bool logged_in(false);
@@ -43,34 +43,35 @@ bool logged_in(false);
cRecording const * recording = LiveRecordingsManager()->GetByMd5Hash(recid);
if (recording) {
+ reply.setContentType("video/mpeg");
reply.setKeepAliveHeader();
reply.setContentLengthHeader(RecSize(recording));
- reply.setDirectMode();
+ reply.setDirectMode();
- cFileName recFile(recording->FileName(), false, false);
- // dsyslog("LIVE: start send video data.");
- for (cUnbufferedFile *recData = recFile.Open(); recData; recData = recFile.NextFile()) {
- char buffer[KILOBYTE(16)];
- ssize_t bytesRead = 0;
- // dsyslog("LIVE: send file %s", recFile->Name());
- while (0 < (bytesRead = recData->Read(buffer, sizeof(buffer)))) {
- // dsyslog("LIVE: copy %zd bytes", bytesRead);
- reply.out().write(buffer, bytesRead);
- if (!reply.out()) {
- return HTTP_GONE;
- }
+ cFileName recFile(recording->FileName(), false, false);
+ // dsyslog("LIVE: start send video data.");
+ for (cUnbufferedFile *recData = recFile.Open(); recData; recData = recFile.NextFile()) {
+ char buffer[KILOBYTE(16)];
+ ssize_t bytesRead = 0;
+ // dsyslog("LIVE: send file %s", recFile->Name());
+ while (0 < (bytesRead = recData->Read(buffer, sizeof(buffer)))) {
+ // dsyslog("LIVE: copy %zd bytes", bytesRead);
+ reply.out().write(buffer, bytesRead);
+ if (!reply.out()) {
+ return HTTP_GONE;
+ }
#if TNT_WATCHDOG_SILENCE
- request.touch(); // retrigger the watchdog.
+ request.touch(); // retrigger the watchdog.
#endif
- }
- // dsyslog("LIVE: bytesRead = %zd", bytesRead);
- if (bytesRead < 0) {
- return HTTP_PARTIAL_CONTENT;
- }
- }
- // dsyslog("LIVE: finished send video data.");
- reply.out() << std::flush;
- return HTTP_OK;
+ }
+ // dsyslog("LIVE: bytesRead = %zd", bytesRead);
+ if (bytesRead < 0) {
+ return HTTP_PARTIAL_CONTENT;
+ }
+ }
+ // dsyslog("LIVE: finished send video data.");
+ reply.out() << std::flush;
+ return HTTP_OK;
}
return DECLINED;
</%cpp>