00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <ctype.h>
00019 #include <string.h>
00020 #include <stdio.h>
00021 #include <unistd.h>
00022 #include <stdlib.h>
00023 #include <pthread.h>
00024 #include <limits.h>
00025 #include <sys/types.h>
00026 #include <sys/socket.h>
00027 #include <iostream>
00028 using namespace std;
00029
00030 #include "RioMMEmbed.h"
00031
00032
00033 CRioMMEmbed::CRioMMEmbed( char *VideoName, unsigned int blocksize,
00034 RioBlock numBuffers, struct timeval RTT_average )
00035 : CRioMMSlideShow( VideoName, blocksize, numBuffers, RTT_average )
00036 {
00037
00038 Major = 1;
00039 Minor = 0;
00040 Socket = 0;
00041
00042
00043 CommandsList = NULL;
00044 NumberOfCommands = 0;
00045 }
00046
00047
00048 CRioMMEmbed::~CRioMMEmbed( void )
00049 {
00050 Cleanup();
00051 }
00052
00053
00054 int CRioMMEmbed::init( void )
00055 {
00056 return( 1 );
00057 }
00058
00059
00060 void CRioMMEmbed::setSocket( int soc )
00061 {
00062 Socket = soc;
00063 }
00064
00065
00066 void CRioMMEmbed::setPort( int port )
00067 {
00068 Socket = socket( PF_INET, SOCK_DGRAM, 0 );
00069 remoteAddr.sin_port = port;
00070 remoteAddr.sin_family = AF_INET;
00071 remoteAddr.sin_addr.s_addr = INADDR_ANY;
00072 }
00073
00074
00075 int CRioMMEmbed::Cleanup( void )
00076 {
00077 return 1;
00078 }
00079
00080
00081 void CRioMMEmbed::Stop()
00082 {
00083 CRioMMSlideShow::Stop();
00084 }
00085
00086
00087 bool CRioMMEmbed::ChangeContext( const char * file_name, int slide_number )
00088 {
00089 TString NextFileName;
00090
00091 NextFileName = file_name;
00092 if( NextFileName != CurrentFileName )
00093 {
00094 if( NextFileName.BeginsWith( "LOCAL:" ) )
00095 Command = "chgu file://" + TempDirectory + "/" +
00096 NextFileName.Substring( strlen( "LOCAL:" ) );
00097 else
00098 Command = "chgu http://" + NextFileName;
00099
00100 if( Socket )
00101 sendto( Socket, (const char *)Command, Command.Length() + 1, 0,
00102 (struct sockaddr *)&remoteAddr, sizeof( remoteAddr ) );
00103 }
00104
00105 CRioMMSlideShow::ChangeContext( file_name, slide_number );
00106 return true;
00107 }
00108
00109 void CRioMMEmbed::SyncSpecific( void )
00110 {
00111 }