summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client
diff options
context:
space:
mode:
authorsumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-03 23:30:17 +0000
committersumedh <sumedh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-04-03 23:30:17 +0000
commitc7e1ae8e18c4039f66ecbca0f2cb6fa63647e006 (patch)
tree344480d792e057fec6111378b005379c65a1e9ff /TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client
parent0317ec5cc67da8a5452657fb5f6cbe43d341c5ac (diff)
downloadATCD-c7e1ae8e18c4039f66ecbca0f2cb6fa63647e006.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp647
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h8
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile194
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp6
4 files changed, 568 insertions, 287 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
index e10ed30f285..d1e8d16f790 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp
@@ -319,301 +319,302 @@ Command_Handler::init_video (void)
int
Command_Handler::init_video_channel (char *phostname, char *videofile)
-{ int dataSocket = -1;
-
- if (ComOpenConnPair(phostname, &videoSocket,
- &dataSocket, &shared->videoMaxPktSize) == -1) {
- return -1;
- }
-
- // Write the CmdINITvideo to tell the server that this is a video
- // client.
- unsigned char tmp;
- tmp = CmdINITvideo;
- VideoWrite(&tmp, 1);
-
- /* Initialize with VS */
- {
- Video_Control::INITvideoPara_var para (new Video_Control::INITvideoPara);
- Video_Control::INITvideoReply_var reply (new Video_Control::INITvideoReply);
-
- para->sn = shared->cmdsn;
- para->version = VERSION;
- para->videofile.length (strlen(videofile));
-
- // string to sequence <char>
- for (int i=0;i<para->videofile.length ();i++)
- para->videofile [i] = videofile [i];
-
- // CORBA call
- TAO_TRY
- {
- CORBA::Boolean result;
- result = this->video_control_->init_video (para.in (),
- reply.out (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
- if (result == (CORBA::B_FALSE))
- return -1;
- else
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_video success \n"));
- }
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("video_control_->init_video (..)");
- return -1;
- }
- TAO_ENDTRY;
- shared->live += reply->live;
- shared->videoFormat = reply->format;
- shared->totalHeaders = reply->totalHeaders;
- shared->totalFrames = reply->totalFrames;
- shared->totalGroups = reply->totalGroups;
- shared->averageFrameSize = reply->averageFrameSize;
- shared->horizontalSize = reply->horizontalSize;
- shared->verticalSize = reply->verticalSize;
- shared->pelAspectRatio = reply->pelAspectRatio;
- shared->pictureRate = ((double)reply->pictureRate1000) / 1000.0;
- shared->vbvBufferSize = reply->vbvBufferSize;
- shared->firstGopFrames = reply->firstGopFrames;
- shared->patternSize = reply->pattern.length ();
- if (shared->patternSize == 0) {
+{
+ int dataSocket = -1;
+
+ // if (ComOpenConnPair(phostname, &videoSocket,
+ // &dataSocket, &shared->videoMaxPktSize) == -1) {
+ // return -1;
+ // }
+ if (this->connect_to_server (phostname,
+ &videoSocket,
+ &dataSocket,
+ &shared->videoMaxPktSize) == -1)
+ return -1;
+
+
+ /* Initialize with VS */
+ {
+ Video_Control::INITvideoPara_var para (new Video_Control::INITvideoPara);
+ Video_Control::INITvideoReply_var reply (new Video_Control::INITvideoReply);
+
+ para->sn = shared->cmdsn;
+ para->version = VERSION;
+ para->videofile.length (strlen(videofile));
+
+ // string to sequence <char>
+ for (int i=0;i<para->videofile.length ();i++)
+ para->videofile [i] = videofile [i];
+
+ // CORBA call
+ TAO_TRY
+ {
+ CORBA::Boolean result;
+ result = this->video_control_->init_video (para.in (),
+ reply.out (),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ if (result == (CORBA::B_FALSE))
+ return -1;
+ else
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_video success \n"));
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("video_control_->init_video (..)");
+ return -1;
+ }
+ TAO_ENDTRY;
+ shared->live += reply->live;
+ shared->videoFormat = reply->format;
+ shared->totalHeaders = reply->totalHeaders;
+ shared->totalFrames = reply->totalFrames;
+ shared->totalGroups = reply->totalGroups;
+ shared->averageFrameSize = reply->averageFrameSize;
+ shared->horizontalSize = reply->horizontalSize;
+ shared->verticalSize = reply->verticalSize;
+ shared->pelAspectRatio = reply->pelAspectRatio;
+ shared->pictureRate = ((double)reply->pictureRate1000) / 1000.0;
+ shared->vbvBufferSize = reply->vbvBufferSize;
+ shared->firstGopFrames = reply->firstGopFrames;
+ shared->patternSize = reply->pattern.length ();
+ if (shared->patternSize == 0) {
- Fprintf(stderr, "CTR warning: patternsize %d\n", shared->patternSize);
+ Fprintf(stderr, "CTR warning: patternsize %d\n", shared->patternSize);
- shared->patternSize = 1;
- shared->pattern[0] = 'I';
- shared->pattern[1] = 0;
- shared->IframeGap = 1;
- }
- else if (shared->patternSize < PATTERN_SIZE)
- {
- int i;
- char * ptr = shared->pattern + shared->patternSize;
- // strncpy(shared->pattern, reply->pattern, shared->patternSize);
- for (i=0;i<shared->patternSize;i++)
- shared->pattern[i] = reply->pattern [i];
- for (i = 1; i < PATTERN_SIZE / shared->patternSize; i ++) {
- // memcpy(ptr, shared->pattern, shared->patternSize);
- for (int j=0; j < shared->patternSize ;j++)
- ptr [j] = shared->pattern [j];
- ptr += shared->patternSize;
- }
- shared->IframeGap = 1;
- while (shared->IframeGap < shared->patternSize)
- {
- if (shared->pattern[shared->IframeGap] == 'I')
- break;
- else
- shared->IframeGap ++;
- }
- }
- else
- {
- fprintf(stderr, "CTR Error: patternSize %d greater than PATTERN_SIZE %d.\n",
- shared->patternSize, PATTERN_SIZE);
- exit(1);
- }
- fprintf(stderr, "Video: %s, %s\n",
- shared->videoFormat == VIDEO_SIF ? "SIF" :
- shared->videoFormat == VIDEO_JPEG ? "JPEG" :
- shared->videoFormat == VIDEO_MPEG1 ? "MPEG1" :
- shared->videoFormat == VIDEO_MPEG2 ? "MPEG2" : "UNKOWN format",
- reply->live ? "live source" : "stored source");
+ shared->patternSize = 1;
+ shared->pattern[0] = 'I';
+ shared->pattern[1] = 0;
+ shared->IframeGap = 1;
+ }
+ else if (shared->patternSize < PATTERN_SIZE)
+ {
+ int i;
+ char * ptr = shared->pattern + shared->patternSize;
+ // strncpy(shared->pattern, reply->pattern, shared->patternSize);
+ for (i=0;i<shared->patternSize;i++)
+ shared->pattern[i] = reply->pattern [i];
+ for (i = 1; i < PATTERN_SIZE / shared->patternSize; i ++) {
+ // memcpy(ptr, shared->pattern, shared->patternSize);
+ for (int j=0; j < shared->patternSize ;j++)
+ ptr [j] = shared->pattern [j];
+ ptr += shared->patternSize;
+ }
+ shared->IframeGap = 1;
+ while (shared->IframeGap < shared->patternSize)
+ {
+ if (shared->pattern[shared->IframeGap] == 'I')
+ break;
+ else
+ shared->IframeGap ++;
+ }
+ }
+ else
+ {
+ fprintf(stderr, "CTR Error: patternSize %d greater than PATTERN_SIZE %d.\n",
+ shared->patternSize, PATTERN_SIZE);
+ exit(1);
+ }
+ fprintf(stderr, "Video: %s, %s\n",
+ shared->videoFormat == VIDEO_SIF ? "SIF" :
+ shared->videoFormat == VIDEO_JPEG ? "JPEG" :
+ shared->videoFormat == VIDEO_MPEG1 ? "MPEG1" :
+ shared->videoFormat == VIDEO_MPEG2 ? "MPEG2" : "UNKOWN format",
+ reply->live ? "live source" : "stored source");
- fprintf(stderr, "Video: numS-%d, numG-%d, numF-%d, aveFrameSize-%d\n",
- reply->totalHeaders, reply->totalGroups, reply->totalFrames,
- reply->averageFrameSize);
- fprintf(stderr, "Video: maxS-%d, maxG-%d, maxI-%d, maxP-%d, maxB-%d\n",
- reply->sizeSystemHeader, reply->sizeGop,
- reply->sizeIFrame, reply->sizePFrame, reply->sizeBFrame);
- fprintf(stderr,
- "Video: SHinfo: hsize-%d, vsize-%d, pelAspect-%d, rate-%f, vbv-%d.\n",
- reply->horizontalSize, reply->verticalSize, reply->pelAspectRatio,
- shared->pictureRate, reply->vbvBufferSize);
- shared->pattern[shared->patternSize] = 0;
- fprintf(stderr, "Video: firstGopFrames %d, IframeGap %d\n",
- reply->firstGopFrames, shared->IframeGap);
- shared->pattern[shared->patternSize] = 'I';
- if (reply->totalFrames > MAX_FRAMES && (!shared->live))
- {
- fprintf(stderr,
- "Error: totalFrames %d > MAX_FRAMES %d, needs change and recompile.\n",
- reply->totalFrames, MAX_FRAMES);
- ComCloseConn(dataSocket);
- ComCloseConn(videoSocket);
- videoSocket = -1;
- return -1;
- }
+ fprintf(stderr, "Video: numS-%d, numG-%d, numF-%d, aveFrameSize-%d\n",
+ reply->totalHeaders, reply->totalGroups, reply->totalFrames,
+ reply->averageFrameSize);
+ fprintf(stderr, "Video: maxS-%d, maxG-%d, maxI-%d, maxP-%d, maxB-%d\n",
+ reply->sizeSystemHeader, reply->sizeGop,
+ reply->sizeIFrame, reply->sizePFrame, reply->sizeBFrame);
+ fprintf(stderr,
+ "Video: SHinfo: hsize-%d, vsize-%d, pelAspect-%d, rate-%f, vbv-%d.\n",
+ reply->horizontalSize, reply->verticalSize, reply->pelAspectRatio,
+ shared->pictureRate, reply->vbvBufferSize);
+ shared->pattern[shared->patternSize] = 0;
+ fprintf(stderr, "Video: firstGopFrames %d, IframeGap %d\n",
+ reply->firstGopFrames, shared->IframeGap);
+ shared->pattern[shared->patternSize] = 'I';
+ if (reply->totalFrames > MAX_FRAMES && (!shared->live))
+ {
+ fprintf(stderr,
+ "Error: totalFrames %d > MAX_FRAMES %d, needs change and recompile.\n",
+ reply->totalFrames, MAX_FRAMES);
+ ComCloseConn(dataSocket);
+ ComCloseConn(videoSocket);
+ videoSocket = -1;
+ return -1;
+ }
- /* create VB, and put INIT frame to VB*/
- {
- int sp[2]; /* sp[0] is for CTR and sp[1] is for VB */
+ /* create VB, and put INIT frame to VB*/
+ {
+ int sp[2]; /* sp[0] is for CTR and sp[1] is for VB */
- /* create command socket pair for sending INIT frame to VB, the pipe
- should be discard/non-discard in consistent with videoSocket*/
- if (socketpair(AF_UNIX,
- shared->videoMaxPktSize >= 0 ? SOCK_STREAM :
- SOCK_DGRAM, 0, sp) == -1)
- {
- perror("CTR error on open CTR-VB socketpair");
- exit(1);
- }
+ /* create command socket pair for sending INIT frame to VB, the pipe
+ should be discard/non-discard in consistent with videoSocket*/
+ if (socketpair(AF_UNIX,
+ shared->videoMaxPktSize >= 0 ? SOCK_STREAM :
+ SOCK_DGRAM, 0, sp) == -1)
+ {
+ perror("CTR error on open CTR-VB socketpair");
+ exit(1);
+ }
- switch (VBpid = fork())
- {
- case -1:
- perror("CTR error on forking VB process");
- exit(1);
- break;
- case 0:
- if (realTimeFlag) {
- SetRTpriority("VB", -1);
- }
- free(vh);
- free(videofile);
- free(ah);
- free(af);
- ::close(sp[0]);
- ComCloseFd(videoSocket);
- if (audioSocket >= 0)
- ComCloseFd(audioSocket);
- ABdeleteBuf();
- VDdeleteBuf();
- if (cmdSocket >= 0)
- ::close(cmdSocket);
- if (realTimeFlag >= 2) {
+ switch (VBpid = fork())
+ {
+ case -1:
+ perror("CTR error on forking VB process");
+ exit(1);
+ break;
+ case 0:
+ if (realTimeFlag) {
+ SetRTpriority("VB", -1);
+ }
+ free(vh);
+ free(videofile);
+ free(ah);
+ free(af);
+ ::close(sp[0]);
+ ComCloseFd(videoSocket);
+ if (audioSocket >= 0)
+ ComCloseFd(audioSocket);
+ ABdeleteBuf();
+ VDdeleteBuf();
+ if (cmdSocket >= 0)
+ ::close(cmdSocket);
+ if (realTimeFlag >= 2) {
#ifdef __svr4__
- if (SetRTpriority("VB", 0)) realTimeFlag = 0;
+ if (SetRTpriority("VB", 0)) realTimeFlag = 0;
#elif defined(_HPUX_SOURCE)
- if (SetRTpriority("VB", 1)) realTimeFlag = 0;
+ if (SetRTpriority("VB", 1)) realTimeFlag = 0;
#endif
- }
- VBprocess(sp[1], dataSocket);
- break;
- default:
- ::close(sp[1]);
- ComCloseFd(dataSocket);
- {
- int bytes, res;
- /* passing all messages of INIT frame to VB here. */
- char * buf = (char *)malloc(INET_SOCKET_BUFFER_SIZE);
- VideoMessage *msg = (VideoMessage *)buf;
- int pkts = 1, msgo = 0, msgs = 0;
+ }
+ VBprocess(sp[1], dataSocket);
+ break;
+ default:
+ ::close(sp[1]);
+ ComCloseFd(dataSocket);
+ {
+ int bytes, res;
+ /* passing all messages of INIT frame to VB here. */
+ char * buf = (char *)malloc(INET_SOCKET_BUFFER_SIZE);
+ VideoMessage *msg = (VideoMessage *)buf;
+ int pkts = 1, msgo = 0, msgs = 0;
- if (buf == NULL) {
- perror("CTR error on malloc() for INIT frame");
- exit(1);
- }
- while (msgo + msgs < pkts) {
- VideoRead(buf, sizeof(*msg));
- pkts = ntohl(msg->packetSize);
- msgo = ntohl(msg->msgOffset);
- msgs = ntohl(msg->msgSize);
- if (shared->videoMaxPktSize >= 0) { /* non-discard mode */
- write_bytes(sp[0], buf, sizeof(*msg));
- bytes = msgs;
- while (bytes > 0) {
- int size = min(bytes, INET_SOCKET_BUFFER_SIZE);
- VideoRead(buf, size);
- write_bytes(sp[0], buf, size);
- bytes -= size;
- }
- }
- else {
- VideoRead(buf + sizeof(*msg), msgs);
- bytes = sizeof(*msg) + msgs;
- while ((res = write(sp[0], buf, bytes)) == -1) {
- if (errno == EINTR || errno == ENOBUFS) continue;
- perror("CTR error on sending INIT frame to VB");
- exit(1);
- }
- if (res < bytes) {
- fprintf(stderr, "CTR warn: send() res %dB < bytes %dB\n", res, bytes);
- }
- /*
- Fprintf(stderr,
- "CTR transferred INIT frame to VB: pkts %d, msgo %d, msgs %d\n",
- pkts, msgo, msgs);
- */
- }
- }
- read(sp[0], buf, 1); /* read a garbage byte, to sync with VB */
- ::close(sp[0]);
- free(buf);
- }
- break;
- }
- }
- }
+ if (buf == NULL) {
+ perror("CTR error on malloc() for INIT frame");
+ exit(1);
+ }
+ while (msgo + msgs < pkts) {
+ VideoRead(buf, sizeof(*msg));
+ pkts = ntohl(msg->packetSize);
+ msgo = ntohl(msg->msgOffset);
+ msgs = ntohl(msg->msgSize);
+ if (shared->videoMaxPktSize >= 0) { /* non-discard mode */
+ write_bytes(sp[0], buf, sizeof(*msg));
+ bytes = msgs;
+ while (bytes > 0) {
+ int size = min(bytes, INET_SOCKET_BUFFER_SIZE);
+ VideoRead(buf, size);
+ write_bytes(sp[0], buf, size);
+ bytes -= size;
+ }
+ }
+ else {
+ VideoRead(buf + sizeof(*msg), msgs);
+ bytes = sizeof(*msg) + msgs;
+ while ((res = write(sp[0], buf, bytes)) == -1) {
+ if (errno == EINTR || errno == ENOBUFS) continue;
+ perror("CTR error on sending INIT frame to VB");
+ exit(1);
+ }
+ if (res < bytes) {
+ fprintf(stderr, "CTR warn: send() res %dB < bytes %dB\n", res, bytes);
+ }
+ /*
+ Fprintf(stderr,
+ "CTR transferred INIT frame to VB: pkts %d, msgo %d, msgs %d\n",
+ pkts, msgo, msgs);
+ */
+ }
+ }
+ read(sp[0], buf, 1); /* read a garbage byte, to sync with VB */
+ ::close(sp[0]);
+ free(buf);
+ }
+ break;
+ }
+ }
+ }
#ifdef STAT
- if (shared->config.collectFrameInfo && (!shared->live))
- {
- int i;
- int count = 0;
- char ch;
- char buf[100];
- FILE *fp;
+ if (shared->config.collectFrameInfo && (!shared->live))
+ {
+ int i;
+ int count = 0;
+ char ch;
+ char buf[100];
+ FILE *fp;
- for (;;)
- {
- sprintf(buf, "struct.%d", count++);
- if (access(buf, 0))
- break;
- if (count > 10000)
- {
- fprintf(stderr, "CTR generating struct file, weired thing happened.\n");
- exit(1);
- }
- }
- fprintf(stderr, "MPEG info collected to %s. . .", buf);
- fp = fopen(buf, "w");
- if (fp == NULL)
- {
- fprintf(stderr, "CTR failed to open %s for write.\n", buf);
- perror("");
- exit(1);
- }
- {
- time_t val = time(NULL);
- get_hostname(buf, 100);
- buf[99] = 0;
- fprintf(fp, "ClientHost: %s\n", buf);
- fprintf(fp, "Date: %s\n", ctime(&val));
- }
- fprintf(fp, "VideoHost: %s\nVideoFile: %s\n", vh, videofile);
- fprintf(fp, "AudioHost: %s\nAudioFile: %s\n\n", ah, af);
- fprintf(fp, "TotalFrames: %d\nTotalGroups: %d\n",
- shared->totalFrames, shared->totalGroups);
- fprintf(fp, "TotalHeaders: %d\n", shared->totalHeaders);
- fprintf(fp, "PictureRate: %f\nPictureSize: %d x %d\n",
- shared->pictureRate, shared->horizontalSize, shared->verticalSize);
- fprintf(fp, "AverageFrameSize: %d\n", shared->averageFrameSize);
- shared->pattern[shared->patternSize] = 0;
- fprintf(fp, "Pattern(%d frames): %s\n\n", shared->patternSize, shared->pattern);
- shared->pattern[shared->patternSize] = 'I';
- {
- fprintf(fp, "FrameInfo:\n ");
- for (i = 0; i < 10; i++)
- fprintf(fp, " %-6d", i);
- fprintf(fp, "\n ----------------------------------------------------");
- ch = CmdSTATstream;
- VideoWrite(&ch, 1);
- for (i = 0; i < shared->totalFrames; i++)
- {
- short size;
- VideoRead(&ch, 1);
- VideoRead((char*)&size, 2);
- size = ntohs(size);
- if (i % 10 == 0)
- fprintf(fp, "\n%4d: ", i / 10);
- fprintf(fp, "%c%-6d", ch, (int)size);
- }
- }
- }
+ for (;;)
+ {
+ sprintf(buf, "struct.%d", count++);
+ if (access(buf, 0))
+ break;
+ if (count > 10000)
+ {
+ fprintf(stderr, "CTR generating struct file, weired thing happened.\n");
+ exit(1);
+ }
+ }
+ fprintf(stderr, "MPEG info collected to %s. . .", buf);
+ fp = fopen(buf, "w");
+ if (fp == NULL)
+ {
+ fprintf(stderr, "CTR failed to open %s for write.\n", buf);
+ perror("");
+ exit(1);
+ }
+ {
+ time_t val = time(NULL);
+ get_hostname(buf, 100);
+ buf[99] = 0;
+ fprintf(fp, "ClientHost: %s\n", buf);
+ fprintf(fp, "Date: %s\n", ctime(&val));
+ }
+ fprintf(fp, "VideoHost: %s\nVideoFile: %s\n", vh, videofile);
+ fprintf(fp, "AudioHost: %s\nAudioFile: %s\n\n", ah, af);
+ fprintf(fp, "TotalFrames: %d\nTotalGroups: %d\n",
+ shared->totalFrames, shared->totalGroups);
+ fprintf(fp, "TotalHeaders: %d\n", shared->totalHeaders);
+ fprintf(fp, "PictureRate: %f\nPictureSize: %d x %d\n",
+ shared->pictureRate, shared->horizontalSize, shared->verticalSize);
+ fprintf(fp, "AverageFrameSize: %d\n", shared->averageFrameSize);
+ shared->pattern[shared->patternSize] = 0;
+ fprintf(fp, "Pattern(%d frames): %s\n\n", shared->patternSize, shared->pattern);
+ shared->pattern[shared->patternSize] = 'I';
+ {
+ fprintf(fp, "FrameInfo:\n ");
+ for (i = 0; i < 10; i++)
+ fprintf(fp, " %-6d", i);
+ fprintf(fp, "\n ----------------------------------------------------");
+ ch = CmdSTATstream;
+ VideoWrite(&ch, 1);
+ for (i = 0; i < shared->totalFrames; i++)
+ {
+ short size;
+ VideoRead(&ch, 1);
+ VideoRead((char*)&size, 2);
+ size = ntohs(size);
+ if (i % 10 == 0)
+ fprintf(fp, "\n%4d: ", i / 10);
+ fprintf(fp, "%c%-6d", ch, (int)size);
+ }
+ }
+ }
#endif
- return 0;
+ return 0;
}
CORBA::Boolean
@@ -1295,6 +1296,90 @@ Command_Handler::stop_playing (void)
}
}
+// connects and handshakes with the server
+int
+Command_Handler::connect_to_server (char *address,
+ int *ctr_fd,
+ int *data_fd,
+ int *max_pkt_size)
+{
+ ::VideoComOpenConnPair (address,
+ ctr_fd,
+ data_fd,
+ max_pkt_size);
+
+ // Write the CmdINITvideo to tell the server that this is a video
+ // client.
+ unsigned char tmp;
+ tmp = CmdINITvideo;
+ ::write (*ctr_fd,
+ &tmp,
+ sizeof (tmp));
+ int ack;
+ ::read (*ctr_fd,
+ &ack,
+ sizeof (ack));
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__));
+
+ // initialize the command handler , ORB
+ if (this->resolve_server_reference () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) command_handler: resolve_server_reference returned -1"),
+ -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__));
+ // Resolve the video control object reference.
+ int i = sizeof (sockaddr_in);
+ struct sockaddr_in addressIn;
+ if (::getsockname(*data_fd,
+ (struct sockaddr *)&addressIn,
+ &i) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) Command_Handler::connect_to_server"
+ " failed to getsocketname on TCP dfd:"),
+ -1);
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__));
+ CORBA::Short server_port;
+ TAO_TRY
+ {
+ CORBA::String client_address_string;
+ ACE_NEW_RETURN (client_address_string,
+ char [BUFSIZ],
+ -1);
+ ::sprintf (client_address_string,
+ "%s:%d",
+ ::inet_ntoa (addressIn.sin_addr),
+ &addressIn.sin_port);
+
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Client string is %s\n",
+ client_address_string));
+
+ server_port = this->video_control_->set_peer (client_address_string,
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+ if (server_port == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) set_peer failed\n"),
+ -1);
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) set_peer done\n"));
+ }
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)");
+ return CORBA::B_FALSE;
+ }
+ TAO_ENDTRY;
+
+ ACE_INET_Addr server_addr (server_port,
+ address);
+
+ this->dgram_.set_handle (*data_fd);
+
+ return this->dgram_.open (server_addr);
+}
+
// ----------------------------------------------------------------------
// Client_Sig_Handler methods
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h
index 54798b1c268..7808b01d59f 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h
@@ -34,6 +34,7 @@
#include "tao/TAO.h"
#include "mpeg_shared/Video_ControlC.h"
#include "orbsvcs/CosNamingC.h"
+#include "ace/SOCK_CODgram.h"
class Command_Handler
: public virtual ACE_Event_Handler
@@ -98,7 +99,14 @@ public:
int stop_playing (void);
+ int connect_to_server (char *address,
+ int *ctr_fd,
+ int *data_fd,
+ int *max_pkt_size);
+
private:
+ ACE_SOCK_CODgram dgram_;
+ // UDP datagram on which to send/recv data
ACE_HANDLE command_handle_;
// The fd for the UNIX command socket
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile
index 43c4264cd4c..88318d56c9b 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile
@@ -316,5 +316,199 @@ realclean: clean
$(ACE_ROOT)/ace/Log_Record.i newproto.h \
$(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
global.h dither.h video.h proto.h ui.h
+.obj/Command_Handler.o .obj/Command_Handler.so .shobj/Command_Handler.o .shobj/Command_Handler.so: Command_Handler.cpp Command_Handler.h \
+ $(ACE_ROOT)/ace/Reactor.h \
+ $(ACE_ROOT)/ace/Handle_Set.h \
+ $(ACE_ROOT)/ace/ACE.h \
+ $(ACE_ROOT)/ace/OS.h \
+ $(ACE_ROOT)/ace/inc_user_config.h \
+ $(ACE_ROOT)/ace/config.h \
+ $(ACE_ROOT)/ace/streams.h \
+ $(ACE_ROOT)/ace/Basic_Types.h \
+ $(ACE_ROOT)/ace/Basic_Types.i \
+ $(ACE_ROOT)/ace/OS.i \
+ $(ACE_ROOT)/ace/Trace.h \
+ $(ACE_ROOT)/ace/Log_Msg.h \
+ $(ACE_ROOT)/ace/Log_Record.h \
+ $(ACE_ROOT)/ace/Log_Priority.h \
+ $(ACE_ROOT)/ace/Log_Record.i \
+ $(ACE_ROOT)/ace/Version.h \
+ $(ACE_ROOT)/ace/ACE.i \
+ $(ACE_ROOT)/ace/Handle_Set.i \
+ $(ACE_ROOT)/ace/Timer_Queue.h \
+ $(ACE_ROOT)/ace/Synch.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \
+ $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \
+ $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \
+ $(ACE_ROOT)/ace/Synch.i \
+ $(ACE_ROOT)/ace/Synch_T.h \
+ $(ACE_ROOT)/ace/Event_Handler.h \
+ $(ACE_ROOT)/ace/Event_Handler.i \
+ $(ACE_ROOT)/ace/Synch_T.i \
+ $(ACE_ROOT)/ace/Thread.h \
+ $(ACE_ROOT)/ace/Thread.i \
+ $(ACE_ROOT)/ace/Atomic_Op.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.h \
+ $(ACE_ROOT)/ace/Free_List.h \
+ $(ACE_ROOT)/ace/Free_List.i \
+ $(ACE_ROOT)/ace/Timer_Queue_T.i \
+ $(ACE_ROOT)/ace/Signal.h \
+ $(ACE_ROOT)/ace/Containers.h \
+ $(ACE_ROOT)/ace/Containers.i \
+ $(ACE_ROOT)/ace/Signal.i \
+ $(ACE_ROOT)/ace/Object_Manager.h \
+ $(ACE_ROOT)/ace/Object_Manager.i \
+ $(ACE_ROOT)/ace/Managed_Object.h \
+ $(ACE_ROOT)/ace/Managed_Object.i \
+ $(ACE_ROOT)/ace/Reactor.i \
+ $(ACE_ROOT)/ace/Reactor_Impl.h \
+ $(ACE_ROOT)/ace/ARGV.h \
+ $(ACE_ROOT)/ace/ARGV.i \
+ $(TAO_ROOT)/tao/TAO.h \
+ $(TAO_ROOT)/tao/corba.h \
+ $(ACE_ROOT)/ace/Get_Opt.h \
+ $(ACE_ROOT)/ace/Get_Opt.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.h \
+ $(ACE_ROOT)/ace/SOCK_IO.h \
+ $(ACE_ROOT)/ace/SOCK.h \
+ $(ACE_ROOT)/ace/Addr.h \
+ $(ACE_ROOT)/ace/Addr.i \
+ $(ACE_ROOT)/ace/IPC_SAP.h \
+ $(ACE_ROOT)/ace/IPC_SAP.i \
+ $(ACE_ROOT)/ace/SOCK.i \
+ $(ACE_ROOT)/ace/SOCK_IO.i \
+ $(ACE_ROOT)/ace/INET_Addr.h \
+ $(ACE_ROOT)/ace/INET_Addr.i \
+ $(ACE_ROOT)/ace/SOCK_Stream.i \
+ $(ACE_ROOT)/ace/Hash_Map_Manager.h \
+ $(ACE_ROOT)/ace/SString.h \
+ $(ACE_ROOT)/ace/SString.i \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.h \
+ $(ACE_ROOT)/ace/Time_Value.h \
+ $(ACE_ROOT)/ace/SOCK_Acceptor.i \
+ $(ACE_ROOT)/ace/SOCK_Connector.h \
+ $(ACE_ROOT)/ace/SOCK_Connector.i \
+ $(ACE_ROOT)/ace/Strategies.h \
+ $(ACE_ROOT)/ace/Strategies_T.h \
+ $(ACE_ROOT)/ace/Service_Config.h \
+ $(ACE_ROOT)/ace/Service_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.h \
+ $(ACE_ROOT)/ace/Shared_Object.i \
+ $(ACE_ROOT)/ace/Service_Object.i \
+ $(ACE_ROOT)/ace/Service_Config.i \
+ $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \
+ $(ACE_ROOT)/ace/Synch_Options.h \
+ $(ACE_ROOT)/ace/Connector.h \
+ $(ACE_ROOT)/ace/Map_Manager.h \
+ $(ACE_ROOT)/ace/Map_Manager.i \
+ $(ACE_ROOT)/ace/Svc_Handler.h \
+ $(ACE_ROOT)/ace/Task.h \
+ $(ACE_ROOT)/ace/Thread_Manager.h \
+ $(ACE_ROOT)/ace/Thread_Manager.i \
+ $(ACE_ROOT)/ace/Task.i \
+ $(ACE_ROOT)/ace/Task_T.h \
+ $(ACE_ROOT)/ace/Message_Queue.h \
+ $(ACE_ROOT)/ace/Message_Block.h \
+ $(ACE_ROOT)/ace/Malloc.h \
+ $(ACE_ROOT)/ace/Malloc.i \
+ $(ACE_ROOT)/ace/Malloc_T.h \
+ $(ACE_ROOT)/ace/Malloc_T.i \
+ $(ACE_ROOT)/ace/Memory_Pool.h \
+ $(ACE_ROOT)/ace/Mem_Map.h \
+ $(ACE_ROOT)/ace/Mem_Map.i \
+ $(ACE_ROOT)/ace/Memory_Pool.i \
+ $(ACE_ROOT)/ace/Message_Block.i \
+ $(ACE_ROOT)/ace/IO_Cntl_Msg.h \
+ $(ACE_ROOT)/ace/Message_Queue.i \
+ $(ACE_ROOT)/ace/Task_T.i \
+ $(ACE_ROOT)/ace/Dynamic.h \
+ $(ACE_ROOT)/ace/Dynamic.i \
+ $(ACE_ROOT)/ace/Singleton.h \
+ $(ACE_ROOT)/ace/Singleton.i \
+ $(ACE_ROOT)/ace/Svc_Handler.i \
+ $(ACE_ROOT)/ace/Connector.i \
+ $(ACE_ROOT)/ace/Acceptor.h \
+ $(ACE_ROOT)/ace/Acceptor.i \
+ $(TAO_ROOT)/tao/compat/objbase.h \
+ $(TAO_ROOT)/tao/compat/initguid.h \
+ $(TAO_ROOT)/tao/orbconf.h \
+ $(TAO_ROOT)/tao/Align.h \
+ $(TAO_ROOT)/tao/ORB.h \
+ $(TAO_ROOT)/tao/Sequence.h \
+ $(TAO_ROOT)/tao/Sequence.i \
+ $(TAO_ROOT)/tao/Sequence_T.h \
+ $(TAO_ROOT)/tao/Sequence_T.i \
+ $(TAO_ROOT)/tao/Object_KeyC.h \
+ $(TAO_ROOT)/tao/Object_KeyC.i \
+ $(TAO_ROOT)/tao/ORB.i \
+ $(TAO_ROOT)/tao/Exception.h \
+ $(TAO_ROOT)/tao/Exception.i \
+ $(TAO_ROOT)/tao/Any.h \
+ $(TAO_ROOT)/tao/Any.i \
+ $(TAO_ROOT)/tao/params.h \
+ $(TAO_ROOT)/tao/params.i \
+ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/Server_Strategy_Factory.h \
+ $(TAO_ROOT)/tao/default_client.h \
+ $(TAO_ROOT)/tao/default_client.i \
+ $(TAO_ROOT)/tao/default_server.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.h \
+ $(TAO_ROOT)/tao/ORB_Strategies_T.i \
+ $(TAO_ROOT)/tao/default_server.i \
+ $(TAO_ROOT)/tao/NVList.h \
+ $(TAO_ROOT)/tao/NVList.i \
+ $(TAO_ROOT)/tao/Principal.h \
+ $(TAO_ROOT)/tao/Request.h \
+ $(TAO_ROOT)/tao/Request.i \
+ $(TAO_ROOT)/tao/Stub.h \
+ $(TAO_ROOT)/tao/Stub.i \
+ $(TAO_ROOT)/tao/Object.h \
+ $(TAO_ROOT)/tao/Object.i \
+ $(TAO_ROOT)/tao/Server_Request.h \
+ $(TAO_ROOT)/tao/Server_Request.i \
+ $(TAO_ROOT)/tao/Typecode.h \
+ $(TAO_ROOT)/tao/Typecode.i \
+ $(TAO_ROOT)/tao/Marshal.h \
+ $(TAO_ROOT)/tao/Marshal.i \
+ $(TAO_ROOT)/tao/CDR.h \
+ $(TAO_ROOT)/tao/CDR.i \
+ $(TAO_ROOT)/tao/POA.h \
+ $(TAO_ROOT)/tao/POAC.h \
+ $(TAO_ROOT)/tao/POAC.i \
+ $(TAO_ROOT)/tao/Servant_Base.h \
+ $(TAO_ROOT)/tao/POAS.h \
+ $(TAO_ROOT)/tao/POAS.i \
+ $(TAO_ROOT)/tao/Object_Table.h \
+ $(TAO_ROOT)/tao/Connect.h \
+ $(TAO_ROOT)/tao/Connect.i \
+ $(TAO_ROOT)/tao/ORB_Core.h \
+ $(TAO_ROOT)/tao/ORB_Core.i \
+ $(ACE_ROOT)/ace/Dynamic_Service.h \
+ $(TAO_ROOT)/tao/Operation_Table.h \
+ $(TAO_ROOT)/tao/debug.h \
+ $(TAO_ROOT)/tao/IIOP_Object.h \
+ $(TAO_ROOT)/tao/IIOP_Object.i \
+ $(TAO_ROOT)/tao/IIOP_ORB.h \
+ $(TAO_ROOT)/tao/IIOP_ORB.i \
+ $(TAO_ROOT)/tao/IIOP_Interpreter.h \
+ $(TAO_ROOT)/tao/GIOP.h \
+ $(TAO_ROOT)/tao/GIOP.i \
+ $(TAO_ROOT)/tao/singletons.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.i \
+ $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \
+ $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \
+ $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i \
+ $(ACE_ROOT)/ace/SOCK_CODgram.h \
+ $(ACE_ROOT)/ace/SOCK_CODgram.i ctr.cpp \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \
+ newproto.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \
+ global.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \
+ $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
index 4facd28c363..2003641fe61 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
@@ -2935,12 +2935,6 @@ int CTRmain(void)
ACE_ERROR_RETURN ((LM_ERROR,
"(%P|%t) command_handler: init returned -1"),
-1);
- // initialize the command handler , ORB
- if (command_handler->resolve_server_reference () == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%P|%t) command_handler: resolve_server_reference returned -1"),
- -1);
- // Resolve the video control object reference.
// .. and register it with the reactor.
if (ACE_Reactor::instance ()->register_handler (command_handler,