Movie Class Reference

This class is used to store a movie. More...

#include <Movie.hpp>

List of all members.


Public Member Functions

 Movie ()
 default constructor
 ~Movie ()
 default destructor
 Movie (string name, string id, string description, string image, string url)
 constructor
string getName ()
string getId ()
string getDescription ()
string getImage ()
string getUrl (uint userId, uint profileId)
string getUrl ()
string getHTMLRepresentation (char *imgPath, uint userId=0, uint profileId=0, uint linktype=1, uint qtewidth=0, uint qteheight=0, bool fakeRtspServer=false, char *sphost=NULL, char *spport=NULL)
 Get the HTML representation of a movie.
void setName (string n)
 set name of movie
void setId (string id)
 set internal id of movie
void setDescription (string desc)
 set description of movie
void setImage (string img)
 set image file-path of movie
void setUrl (string u)
 set Rtsp-URI of movie

Detailed Description

This class is used to store a movie.

Author:
Klaus Schoeffmann

Definition at line 70 of file Movie.hpp.


Member Function Documentation

string Movie::getDescription  ) 
 

Returns:
description of movie
Definition at line 86 of file Movie.cpp.

Referenced by getHTMLRepresentation().

00087 { 00088 return description; 00089 }

string Movie::getHTMLRepresentation char *  imgPath,
uint  userId = 0,
uint  profileId = 0,
uint  linktype = 1,
uint  qtewidth = 0,
uint  qteheight = 0,
bool  fakeRtspServer = false,
char *  sphost = NULL,
char *  spport = NULL
 

Get the HTML representation of a movie.

This representation contains the name, the image, the description and the Rtsp-URI.

Parameters:
userId user-id which should be added to the Rtsp-Link
profileId profile-id which should be added to the Rtsp-Link
linktype identifies, which link type should be used
qtewidth when QTE is used as link type: width for the new window
qteheight when QTE is used as link type: for the new window
fakeRtspServer flag which must be true if client does not support an RTSP Proxy
sphost address of semiproxy (if fakeRtspServer == true)
spport port number of semiproxy (if fakeRtspServer == true)
Definition at line 175 of file Movie.cpp.

References semifunc::createSDPFile(), Globals::getAbsoluteSDPFilePath(), getDescription(), getId(), getImage(), getName(), Globals::getRelativeSDPFilePath(), and getUrl().

Referenced by MovieList::getHTMLRepresentation().

00177 { 00178 ostringstream buf; 00179 00180 //output image (must have a fixed size of 94 x 140 pixel) 00181 buf << "<tr>" << endl 00182 << "<td valign=\"top\">" << endl 00183 << "<img width=\"94\" height=\"140\" src=\"" << imgPath << this->getImage() << "\">" 00184 << "</td>" << endl; 00185 00186 //output name of movie 00187 buf << "<td valign=\"top\">" 00188 << "<a class=\"moviehdr\" name=\"" << this->getId() << "\">" << this->getName() << "</a><br>" << endl; 00189 00190 //output description 00191 buf << "<font class=\"moviedesc\">" << this->getDescription() << "</font><br><br>" << endl; 00192 00193 00194 string url = this->getUrl(userId, profileId); 00195 unsigned int hostStart = url.find("rtsp://") + 7; 00196 unsigned int hostEnd = url.find("/", hostStart); 00197 unsigned int filePathStart = hostEnd; 00198 unsigned int portStart = url.find(":", hostStart) + 1; 00199 if (portStart != string::npos && portStart < hostEnd) hostEnd = portStart-1; 00200 if (fakeRtspServer) { 00201 if (portStart != string::npos) { 00202 unsigned int slashPos = filePathStart; 00203 string portNr = url.substr(portStart, slashPos-portStart); 00204 url.insert(filePathStart,"/port="); 00205 url.insert(filePathStart+strlen("/port="),portNr); 00206 url.erase(portStart, slashPos-portStart); 00207 url.insert(portStart, spport); 00208 } 00209 00210 //change host 00211 string hostAdr = url.substr(hostStart, hostEnd-hostStart); 00212 if (hostAdr.compare(sphost) != 0) { 00213 url.erase(hostStart, hostEnd-hostStart); 00214 url.insert(hostStart, sphost); 00215 filePathStart = url.find("/", hostStart); //may have changed 00216 url.insert(filePathStart, "/host="); 00217 url.insert(filePathStart+strlen("/host="), hostAdr); 00218 } 00219 } 00220 00221 00222 00223 //output link 00224 if (linktype == LINK_RTSP) 00225 { 00226 //***common RTSP*** 00227 buf << "<a href=\"" << url << "\">Start</a>"; 00228 } 00229 else if (linktype == LINK_SDP) 00230 { 00231 //***for SDP files*** 00232 ostringstream tmpName; 00233 //add user_id and profile_id (otherwise files from different users would be overwritten) 00234 tmpName << "movie_" << this->getId() << "_u" << userId << "_p" << profileId; 00235 buf << "<a href=\"" 00236 << semifunc::createSDPFile(tmpName.str(), 00237 url, 00238 Globals::getRelativeSDPFilePath(), 00239 Globals::getAbsoluteSDPFilePath()) 00240 << "\">Start</a>" << endl; 00241 } 00242 else if (linktype == LINK_QTE) 00243 { 00244 //***for QuickTime embedded*** 00245 buf << "<form name=\"frmStart" << this->getId() << "\"" 00246 << " action=\"embedded.cgi\" method=\"post\" target=\"frmStart" << this->getId() << "\">" << endl 00247 << "<input type=\"hidden\" name=\"uri\" value=\"" << url << "\">" << endl 00248 << "<input type=\"hidden\" name=\"width\" value=\"" << qtewidth << "\">" << endl 00249 << "<input type=\"hidden\" name=\"height\" value=\"" << qteheight << "\">" << endl 00250 << "</form>" << endl 00251 << "<a href=\"javascript:submitFormInWindow('frmStart" << this->getId() << "');\">Start</a>"; 00252 } 00253 00254 buf << "</td></tr>" << endl; 00255 00256 return buf.str(); 00257 }

string Movie::getId  ) 
 

Returns:
internal id of movie
Definition at line 80 of file Movie.cpp.

Referenced by getHTMLRepresentation(), MovieList::getMovieById(), and MovieList::readMoviesFromFile().

00081 { 00082 return id; 00083 }

string Movie::getImage  ) 
 

Returns:
image file-path of movie
Definition at line 92 of file Movie.cpp.

Referenced by getHTMLRepresentation().

00093 { 00094 return image; 00095 }

string Movie::getName  ) 
 

Returns:
name of movie
Definition at line 74 of file Movie.cpp.

Referenced by getHTMLRepresentation(), and SessionList::writeHTMLRepresentation().

00075 { 00076 return name; 00077 }

string Movie::getUrl  ) 
 

Returns:
Rtsp-URI of movie without any (semi-added) parameters
Definition at line 138 of file Movie.cpp.

Referenced by getHTMLRepresentation(), and getUrl().

00139 { 00140 return this->url; 00141 }

string Movie::getUrl uint  userId,
uint  profileId
 

Returns:
Rtsp-URI of movie with added user- and profile-Id (as parameters)
Definition at line 98 of file Movie.cpp.

References getUrl().

Referenced by SessionList::writeHTMLRepresentation().

00099 { 00100 if (userId == 0 && profileId == 0) 00101 { 00102 return getUrl(); 00103 } 00104 else 00105 { 00106 // ostringstream str; 00107 unsigned int hostStart = url.find("rtsp://") + 7; 00108 unsigned int hostEnd = url.find("/", hostStart); 00109 // str << url.substr(0, hostEnd); 00110 00111 ostringstream strU; 00112 strU << "/uid=" << userId; 00113 url.insert(hostEnd, strU.str()); hostEnd += strU.str().length(); 00114 ostringstream strP; 00115 strP << "/proid=" << profileId; 00116 url.insert(hostEnd, strP.str()); hostEnd += strP.str().length(); 00117 ostringstream strI; 00118 strI << "/id=" << id; 00119 url.insert(hostEnd, strI.str()); hostEnd += strI.str().length(); 00120 00121 return url; 00122 00123 // str << strU.str() << strP.str() << strI.str(); 00124 00125 // str << url.substr(hostStart); 00126 00127 /* 00128 //= 00129 ostringstream str; 00130 str << url << "?uid=" << userId << "&proid=" << profileId << "&id=" << id ; 00131 00132 return str.str(); 00133 */ 00134 } 00135 }


The documentation for this class was generated from the following files: