summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs
diff options
context:
space:
mode:
authornaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-15 18:57:08 +0000
committernaga <naga@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-05-15 18:57:08 +0000
commit7ed07f96173ab4b9d31dab671877e76bc8305540 (patch)
treed7838cf8b1c3aab0a30281c85c44173a2f482dd6 /TAO/orbsvcs
parentb42c5aa852b985dfa3ff92c9a4b899c5091be6f8 (diff)
downloadATCD-7ed07f96173ab4b9d31dab671877e76bc8305540.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp3
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp203
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h3
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp2
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp12
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp39
-rw-r--r--TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp1
7 files changed, 161 insertions, 102 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
index 4df92cc607e..5ad6d36d92a 100644
--- a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
@@ -158,6 +158,9 @@ TAO_AV_Endpoint_Process_Strategy::activate (void)
int
TAO_AV_Endpoint_Process_Strategy::bind_to_naming_service (CORBA::Environment &env)
{
+ if (CORBA::is_nil (this->naming_context_.in ()) == CORBA::B_FALSE)
+ return 0;
+
CORBA::Object_var naming_obj =
TAO_ORB_Core_instance ()->orb ()->resolve_initial_references ("NameService");
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 24bf54e8c6f..c8a08abfada 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
@@ -6,7 +6,8 @@
const char *TAO_AV_ORB_ARGUMENTS = "-ORBobjrefstyle URL";
Command_Handler::Command_Handler (ACE_HANDLE command_handle)
- :video_data_handle_ (-1),
+ :busy_ (0),
+ video_data_handle_ (-1),
audio_data_handle_ (-1),
command_handle_ (command_handle),
video_control_ (0),
@@ -181,102 +182,113 @@ Command_Handler::get_handle (void) const
int
Command_Handler::handle_input (ACE_HANDLE fd)
{
-
+ // cerr << "(" << getpid () << " Command_Handler::handle_input\n" ;
unsigned char cmd;
int val;
- val = OurCmdRead ((char*)&cmd, 1);
- ::TimerProcessing ();
+
+ if (!(this->busy_))
+ {
+ val = OurCmdRead ((char*)&cmd, 1);
+ this->busy_ = 1;
+ ::TimerProcessing ();
- // if we get an interrupt while reading we go back to the event loop
- if (val == 1)
- return 0;
+ // if we get an interrupt while reading we go back to the event loop
+ if (val == 1)
+ return 0;
- FILE * fp = NULL; /* file pointer for experiment plan */
- usr1_flag = 0;
+ FILE * fp = NULL; /* file pointer for experiment plan */
+ usr1_flag = 0;
- // fprintf(stderr, "CTR: cmd received - %d\n", cmd);
- TAO_TRY
- {
- switch (cmd)
+ // fprintf(stderr, "CTR: cmd received - %d\n", cmd);
+ TAO_TRY
{
- case CmdINIT:
- ACE_DEBUG ((LM_DEBUG,"(%P|%t) command_handler:CmdINIT received\n"));
- if (this->init_av () == -1)
+ switch (cmd)
{
- TAO_ORB_Core_instance ()->orb ()->shutdown ();
- return -1;
+ case CmdINIT:
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) command_handler:CmdINIT received\n"));
+ if (this->init_av () == -1)
+ {
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) init_av failed\n"));
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+ return -1;
+ }
+ // cerr << "init_av done\n";
+ // automatic experiment code zapped :-)
+ fp = NULL;
+ break;
+ case CmdSTOP:
+ this->stop();
+ break;
+ case CmdFF:
+ this->fast_forward ();
+ break;
+ case CmdFB:
+ this->fast_backward ();
+ break;
+ case CmdSTEP:
+ this->step ();
+ break;
+ case CmdPLAY:
+ // automatic experiment code zapped :-)
+ if (this->play (fp != NULL,
+ TAO_TRY_ENV) < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)play failed\n"),-1);
+ TAO_CHECK_ENV;
+ break;
+ case CmdPOSITION:
+ this->position ();
+ break;
+ case CmdPOSITIONrelease:
+ this->position_release ();
+ break;
+ case CmdVOLUME:
+ this->volume ();
+ break;
+ case CmdBALANCE:
+ this->balance ();
+ break;
+ case CmdSPEED:
+ this->speed ();
+ break;
+ case CmdLOOPenable:
+ {
+ shared->loopBack = 1;
+ break;
+ }
+ case CmdLOOPdisable:
+ {
+ shared->loopBack = 0;
+ break;
+ }
+ default:
+ fprintf(stderr, "CTR: unexpected command from UI: cmd = %d.\n", cmd);
+ exit(1);
+ break;
}
- // automatic experiment code zapped :-)
- fp = NULL;
- break;
- case CmdSTOP:
- this->stop();
- break;
- case CmdFF:
- this->fast_forward ();
- break;
- case CmdFB:
- this->fast_backward ();
- break;
- case CmdSTEP:
- this->step ();
- break;
- case CmdPLAY:
- // automatic experiment code zapped :-)
- if (this->play (fp != NULL,
- TAO_TRY_ENV) < 0)
- ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)play failed\n"),-1);
- TAO_CHECK_ENV;
- break;
- case CmdPOSITION:
- this->position ();
- break;
- case CmdPOSITIONrelease:
- this->position_release ();
- break;
- case CmdVOLUME:
- this->volume ();
- break;
- case CmdBALANCE:
- this->balance ();
- break;
- case CmdSPEED:
- this->speed ();
- break;
- case CmdLOOPenable:
- {
- shared->loopBack = 1;
- break;
- }
- case CmdLOOPdisable:
- {
- shared->loopBack = 0;
- break;
- }
- default:
- fprintf(stderr, "CTR: unexpected command from UI: cmd = %d.\n", cmd);
- exit(1);
- break;
}
+ TAO_CATCHANY
+ {
+ TAO_TRY_ENV.print_exception ("Command_Handler::handle_input ()");
+ return -1;
+ }
+ TAO_ENDTRY;
+ // cerr << "returning from Command_Handler::handle_input \n";
+ this->busy_ = 0;
+ // unset the busy flag,done with processing the command.
}
- TAO_CATCHANY
- {
- TAO_TRY_ENV.print_exception ("Command_Handler::handle_input ()");
- return -1;
- }
- TAO_ENDTRY;
return 0;
}
int
Command_Handler::init_av (void)
{
-
+ // cerr << "inside init_av \n";
int i, j;
/* try to stop and close previous playing */
if (audioSocket >= 0 || videoSocket >= 0)
{
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__));
// this may have to be taken care of afterwards.
unsigned char tmp = CmdCLOSE;
int result =
@@ -312,20 +324,38 @@ Command_Handler::init_av (void)
}
}
+ int result;
/* read in video/audio files */
+ // set the vf and af to 0 , very important.
+
+ vh [0] = 0;
+ vf [0]= 0;
+ ah [0] = 0;
+ af [0]=0;
+
NewCmd(CmdINIT);
- CmdRead((char*)&i, 4);
- CmdRead(vh, i);
- vh[i] = 0;
- CmdRead((char*)&i, 4);
- CmdRead(vf, i);
+ i = 0;
+ // cerr << "cmdsocket = " << cmdSocket << endl;
+// result = OurCmdRead((char*)&i, 4);
+// cerr << " " <<i << " ";
+// result = OurCmdRead(vh, i);
+// vh[i] = 0;
+// cerr << vh << "\n";
+ result = OurCmdRead((char*)&i, 4);
+ // cerr << i << " ";
+ result = OurCmdRead(vf, i);
vf[i] = 0;
- CmdRead((char*)&i, 4);
- CmdRead(ah, i);
- ah[i] = 0;
- CmdRead((char*)&i, 4);
- CmdRead(af, i);
+ // cerr << vf << "\n";
+// result = OurCmdRead((char*)&i, 4);
+// cerr << i << " ";
+// result = OurCmdRead(ah, i);
+// ah[i] = 0;
+// cerr << ah << endl;
+ result = OurCmdRead((char*)&i, 4);
+ // cerr << i << " ";
+ result = OurCmdRead(af, i);
af[i] = 0;
+ // cerr << af << endl;
/*
fprintf(stderr, "INIT: vh-%s, vf-%s, ah-%s, af-%s\n", vh, vf, ah, af);
*/
@@ -402,6 +432,7 @@ Command_Handler::init_av (void)
}
return 0;
}
+ // cerr << "returning from init_av \n";
return 0;
}
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 5b9e95e82f0..ec9cdf1beb3 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
@@ -360,6 +360,9 @@ public:
// mmdevices together.
private:
+ int busy_;
+ // flag to indicate the state of the command handler
+
ACE_SOCK_Dgram video_dgram_;
// UDP socket on which to send/recv data
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 4ff9496d27a..1e4f2271d4d 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp
@@ -2909,7 +2909,7 @@ int CTRmain(int argc,
exit(1);
}
cmdSocket = sv[0];
-
+ cerr << "cmdsocket = " << cmdSocket << endl;
/* fork processes: VD, GUI */
if ((VDpid = fork()) == -1)
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp
index 4a2b152ca6c..ed13635d4d9 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp
@@ -24,6 +24,7 @@
#include "video.h"
#include "proto.h"
#include "decoders.h"
+#include "ace/OS.h"
/* External declarations. */
@@ -235,7 +236,11 @@ ParseReconBlock(int n)
DECODE_DCT_COEFF_NEXT(run, level);
if (run == END_OF_BLOCK) break;
-
+ if (i >= 64)
+ {
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) subscript out of range \n"));
+ break;
+ }
i = i + run + 1;
pos = zigzag_direct[i];
coeff = (level * qscale * ((int) iqmatrixptr[pos])) >> 3;
@@ -298,6 +303,11 @@ ParseReconBlock(int n)
if (run == END_OF_BLOCK) break;
i = i+run+1;
+ if (i >= 64)
+ {
+ ACE_DEBUG ((LM_DEBUG,"(%P|%t) subscript out of range \n"));
+ break;
+ }
pos = zigzag_direct[i];
if (level < 0) {
coeff = (((level<<1) - 1) * qscale *
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp
index 5f6537b2865..7a8f1eb712d 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp
@@ -258,9 +258,9 @@ lemond.cse.ogi.edu\n\
fprintf(stderr, "Reading next program.\n");
*/
Fgets(prog[items].title);
- Fgets(prog[items].vh);
+ // Fgets(prog[items].vh);
Fgets(prog[items].vf);
- Fgets(prog[items].ah);
+ // Fgets(prog[items].ah);
Fgets(prog[items].af);
item[items] = (XmString)XmStringCreateLtoR(prog[items].title, XmStringTag);
if ((++items) >= ITEMS) break;
@@ -318,14 +318,14 @@ void StartProgram(char * title, char * vh, char * vf, char * ah, char * af)
if (!cmdBusy) {
char *str = title;
len = strlen(str);
- if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- str = vh;
- len = strlen(str);
+// if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
+// str = vh;
+ // len = strlen(str);
if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
str = vf;
- len = strlen(str);
- if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
- str = ah;
+ // len = strlen(str);
+ // if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
+ // str = ah;
len = strlen(str);
if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0;
str = af;
@@ -334,22 +334,31 @@ void StartProgram(char * title, char * vh, char * vf, char * ah, char * af)
XmTextFieldSetString(titlewidget, title);
cmdBusy = 1;
CmdWrite(&tmp, 1);
- len = strlen(vh);
- CmdWrite((char *)&len, 4);
- CmdWrite(vh, len);
+// len = strlen(vh);
+// CmdWrite((char *)&len, 4);
+// cerr << "StartProgram: len =" << len;
+// CmdWrite(vh, len);
+// cerr << " StartProgram: vh =" << vh << endl;
len = strlen(vf);
CmdWrite((char *)&len, 4);
+ cerr << "StartProgram: len =" << len;
CmdWrite(vf, len);
- len = strlen(ah);
- CmdWrite((char *)&len, 4);
- CmdWrite(ah, len);
+ cerr << " StartProgram: vf =" << vf << endl;
+// len = strlen(ah);
+// CmdWrite((char *)&len, 4);
+// cerr << "StartProgram: len =" << len;
+// CmdWrite(ah, len);
+// cerr << " StartProgram: ah =" << ah << endl;
len = strlen(af);
CmdWrite((char *)&len, 4);
+ cerr << "StartProgram: len =" << len;
CmdWrite(af, len);
+ cerr << " StartProgram: af =" << af << endl;
}
else {
beep();
}
+ cerr << "StartProgram done\n";
}
static int curListPos(void)
@@ -524,6 +533,8 @@ static void playCB(Widget w, XtPointer closure, XtPointer call_data)
int i = curListPos();
if (i >= items || i < 0)
return;
+ cerr << "PlayCB\n";
+ cerr << prog[i].title << " " << prog[i].vh << " " <<prog[i].vf << " " << prog[i].ah << " " << prog[i].af << endl;
StartProgram(prog[i].title, prog[i].vh, prog[i].vf, prog[i].ah, prog[i].af);
}
}
diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp
index ecad3ffb794..19bcff7e45e 100644
--- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp
@@ -997,3 +997,4 @@ void UIprocess(int cmdSock)
XtAppMainLoop(App);
}
+