diff options
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams')
135 files changed, 0 insertions, 50577 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Makefile b/TAO/orbsvcs/tests/AVStreams/Makefile deleted file mode 100644 index 313324a45e1..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Top-level Makefile for the AVStreams demo of the TAO ORB -# -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -LDLIBS = -lorbsvcs -lTAO - -PROG_SRCS = main.cpp - -LSRC = $(PROG_SRCS) - -AVStreams_SERVER_OBJS = server.o -AVStreams_CLIENT_OBJS = client.o - -COSPROPERTY_OBJS = main.o - -BIN = server client -BUILD = $(BIN) -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -ifndef TAO_ROOT -TAO_ROOT = $(ACE_ROOT)/TAO -endif - -DCFLAGS = -g -LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao -CPPFLAGS += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H - -server:$(addprefix $(VDIR),$(AVStreams_SERVER_OBJS)) - $(LINK.cc) $(LDFAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - -client:$(addprefix $(VDIR),$(AVStreams_CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - -realclean: clean - -/bin/rm -rf - - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/client.cpp b/TAO/orbsvcs/tests/AVStreams/client.cpp deleted file mode 100644 index d63a79f2d8e..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/client.cpp +++ /dev/null @@ -1,748 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/tests/AVStreams -// -// = FILENAME -// client.cpp -// -// = DESCRIPTION -// Test client for the AVStreams demo -// -// = AUTHORS -// Sumedh Mungee <sumedh@cs.wustl.edu> -// -// ============================================================================ - -#include "client.h" - -Video_Client_StreamEndPoint::Video_Client_StreamEndPoint (void) -{ -} - -void -Video_Client_StreamEndPoint::handle_stop (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Client_StreamEndPoint::handle_stop: called\n")); -} - -void -Video_Client_StreamEndPoint::handle_start (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Client_StreamEndPoint::handle_start: called\n")); -} - -void -Video_Client_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Client_StreamEndPoint::handle_destroy: called\n")); -} - -CORBA::Boolean -Video_Client_StreamEndPoint::handle_connection_established (AVStreams::StreamEndPoint_ptr responder, - AVStreams::streamQoS &qos_spec, - const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Client_StreamEndPoint::handle_connection_established: called\n")); - return 1; -} - -Client::Client (void) -{ -} - -// initialize the ORB, get a grip on the remote mmdevice, and store it -// in this->remote_mmdevice_. Also create a stream controlller and a -// local mmdevice. - -int -Client::init (int argc, - char *argv[], - CORBA::Environment &env) -{ - // Init the ORB. - manager_.init (argc, - argv, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Create the local mmdevice. - TAO_Client_MMDevice <Video_Client_StreamEndPoint> *mmdevice_impl; - - ACE_NEW_RETURN (mmdevice_impl, - TAO_Client_MMDevice <Video_Client_StreamEndPoint>, - -1); - - this->local_mmdevice_ = mmdevice_impl->_this (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Create the local streamctrl. - TAO_StreamCtrl *stream_ctrl; - - ACE_NEW_RETURN (stream_ctrl, - TAO_StreamCtrl (manager_.orb ()), - -1); - this->stream_ctrl_ = stream_ctrl->_this (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Bind to a remote mmdevice, as supplied by argc argv. - this->bind_to_remote_mmdevice (argc, argv, env); - - manager_.orb ()->open (); - // Create a locall mmdevice for now.. - // mmdevice_impl = new TAO_MMDevice; - // this->remote_mmdevice_ = mmdevice_impl->_this (env); - - TAO_CHECK_ENV_RETURN (env, 1); -} - -// Use stream_ctrl_ to bind local_mmdevice_ and remote_mmdevice_. - -int -Client::run (CORBA::Environment &env) -{ - // Initialize the in parameters. - - // @@ Alex, please make sure you restructure this code so that you - // test for allocation failures. - AVStreams::streamQoS_var the_qos (new AVStreams::streamQoS); - AVStreams::flowSpec_var the_flows (new AVStreams::flowSpec); - - // Allocate the qos_list. - struct AVStreams::QoS qos_list; - // @@ Alex, please take a careful look at this code and figure out - // if you really need to use "magic numbers" like 64 here. - qos_list.QoSType = CORBA::string_alloc (64); - qos_list.QoSParams = CORBA::string_alloc (64); - strcpy (qos_list.QoSType, "foo"); - strcpy (qos_list.QoSParams, "bar"); - - the_qos->length (1); - the_qos [0] = qos_list; - - // Allocate the flow_list. - const char *flow_list [] = - { - "alpha", - "beta", - "gamma" - }; - - CORBA::ULong len = sizeof (flow_list)/sizeof (char *); - - // Set the length of the sequence. - the_flows->length (len); - - // Now set each individual element. - for (CORBA::ULong i=0; i < the_flows->length (); i++) - { - // Generate some arbitrary string to be filled into the ith - // location in the sequence. - // char *str = gen->gen_string (); - //this->in_[i] = str; - the_flows [i] = flow_list [i]; - } - - // Bind the devices together. - this->stream_ctrl_->bind_devs (local_mmdevice_, - remote_mmdevice_, - the_qos.inout (), - the_flows.in (), - env); - - TAO_CHECK_ENV_RETURN (env, 1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Devices bound successfully!\n")); - - // Start the flow of the stream. - this->stream_ctrl_-> start (the_flows.in (), - env); - - TAO_CHECK_ENV_RETURN (env, 1); - return 0; -} - -// Bind to a remote mmdevice, as given by the command line arguments. - -int -Client::bind_to_remote_mmdevice (int argc, - char *argv[], - CORBA::Environment &env) -{ - ACE_Get_Opt get_opts (argc, argv, "k:"); - int c; - char *ior = 0; - - // @@ Alex, can you please move this into a "parse_args()" helper - // method? - - // Parse the command line. - while ((c = get_opts ()) != -1) - switch (c) - { - case 'k': - ior = - ACE_OS::strdup (get_opts.optarg); - break; - case '?': - default: - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - " [-k mmdevice_key]" - "\n", - argv [0]), - -1); - } - - // We didn't get an IOR from the command line! - if (ior == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - " [-k mmdevice_key]" - "\n", - argv [0]), - -1); - - // Get the object reference. - CORBA::Object_var mmdevice_object = - this->manager_.orb ()->string_to_object (ior, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Narrow the reference. - this->remote_mmdevice_ = - AVStreams::MMDevice::_narrow (mmdevice_object.in (), - env); - TAO_CHECK_ENV_RETURN (env, 1); - - if (CORBA::is_nil (this->remote_mmdevice_.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "invalid key <%s>\n", - ior), - -1); - - ACE_DEBUG ((LM_DEBUG, - "Object received OK\n")); - - ACE_DEBUG ((LM_DEBUG, - "\n(%P|%t) Bound to remote mmdevice")); - return 0; -} - - -// Testing the methods of the property service. - -int -Client::property_tester (CORBA::Environment &env) -{ - // Testing define_property () of PropertySet interface. - this->test_define_property (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Test the number of properties. - this->test_get_number_of_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing get_all_property_names. - this->test_get_all_property_names (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing delete property. - this->test_delete_property ("string_property",env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing get_properties. - this->test_get_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing delete_properties. - this->test_delete_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Test the number of properties. - this->test_get_number_of_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing define_properties. - this->test_define_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Test the number of properties. - this->test_get_number_of_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing get_all_property_names. - this->test_get_all_property_names (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Testing get_all_properties. - this->test_get_all_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); -} - -// Testing define_property. - -int -Client::test_define_property (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nChecking define_property\n")); - - CORBA::Any anyval; - - // Prepare a char and "define" that in the PropertySet. - CORBA::Char ch = '#'; - anyval <<= from_char (ch); - ch = '*'; - anyval >>= to_char (ch); - - ACE_DEBUG ((LM_DEBUG, - "Main : Char ch = %c\n", - ch)); - this->remote_mmdevice_->define_property ("char_property", - anyval, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Prepare a Short and "define" that in the PropertySet. - CORBA::Short s = 3; - anyval <<= s; - s = 7; - anyval >>= s; - - ACE_DEBUG ((LM_DEBUG, - "Main : Short s = %d\n", - s)); - remote_mmdevice_->define_property ("short_property", - anyval, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Prepare a Long and "define" that in the PropertySet. - CORBA::Long l = 931232; - anyval <<= l; - l = 931233; - anyval >>= l; - ACE_DEBUG ((LM_DEBUG, - "Main : Long l = %d\n", - l)); - CORBA::Any newany(anyval); - remote_mmdevice_->define_property ("long_property", - anyval, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - - // Prepare a Float and "define" that in the PropertySet. - CORBA::Float f = 3.14; - anyval <<= f; - f = 4.14; - anyval >>= f; - ACE_DEBUG ((LM_DEBUG, - "Main : Float f = %f\n", - f)); - remote_mmdevice_->define_property ("float_property", - anyval, - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Prepare a String and "define" that in the PropertySet. - ACE_DEBUG ((LM_DEBUG, - "Main: Any holding String\n")); - CORBA::String_var strvar (CORBA::string_dup ("Test_String")); - anyval <<= strvar.in (); - CORBA::String newstr; - anyval >>= newstr; - - ACE_DEBUG ((LM_DEBUG, - "Main: String : %s, From any : %s\n", - strvar.in (), - newstr)); - remote_mmdevice_->define_property ("string_property", - anyval, - env); - TAO_CHECK_ENV_RETURN (env, 1); -} - -// Testing get_all_property_names of the PropertySet. - -int -Client::test_get_all_property_names (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nTesting get_all_property_names ()\n")); - - // Get the size. - CORBA::ULong num_of_properties = - remote_mmdevice_->get_number_of_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Get half on the names and half of on the iterator. - CORBA::ULong how_many = num_of_properties / 2; - CosPropertyService::PropertyNames_var names_var; - CosPropertyService::PropertyNamesIterator_var iterator_var; - remote_mmdevice_->get_all_property_names (how_many, - names_var.out (), - iterator_var.out (), - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Print out the names in the names-sequence. - if (names_var.ptr () != 0) - { - CORBA::ULong len = names_var->length (); - - for (CORBA::ULong ni = 0; ni < len; ni++) - ACE_DEBUG ((LM_DEBUG, - "%s\n", - (const char *) names_var [ni])); - } - - // Iterate thru and print out the names in the iterator, if any. - if (iterator_var.ptr () != 0) - { - CosPropertyService::PropertyName_var name_var; - - while (iterator_var->next_one (name_var.out (), env) == CORBA::B_TRUE) - { - TAO_CHECK_ENV_RETURN (env, 1); - ACE_DEBUG ((LM_DEBUG, "%s\n", name_var.in ())); - } - - TAO_CHECK_ENV_RETURN (env, 1); - } -} - -// Test get_properties. Give a sequence of names and get all their -// properties. - -int -Client::test_get_properties (CORBA::Environment &env) -{ - // Get float_property, string_property and no_property. If return - // value is false and type is tc_void then that name is not there in - // the PropertySet. - ACE_DEBUG ((LM_DEBUG, "\nTesting get_properties\n")); - CosPropertyService::PropertyNames_var names; - CosPropertyService::PropertyNames_ptr names_ptr; - - ACE_NEW_RETURN (names_ptr, - CosPropertyService::PropertyNames, - -1); - names = names_ptr; - - names->length (3); - names [0] = CORBA::string_dup ("float_property"); - //names [1] = CORBA::string_dup ("string_property"); - names [1] = CORBA::string_dup ("long_property"); - //names [2] = CORBA::string_dup ("char_property"); - names [2] = CORBA::string_dup ("no_property"); - - CosPropertyService::Properties_var properties; - - // Get the properties. - CORBA::Boolean return_val = remote_mmdevice_->get_properties (names.in (), - properties.out (), - env); - TAO_CHECK_ENV_RETURN (env, 1); - - if (properties.ptr () != 0) - { - // Go thru the properties and print them out, if they are not - // _tc_void typed values. - CORBA::ULong len = properties->length (); - - for (CORBA::ULong pi = 0; pi < len; pi++) - { - // Print the name. - ACE_DEBUG ((LM_DEBUG, - "%s : ", - (const char *) properties [pi].property_name.in ())); - - // Print the value if type is not tk_void. - if (properties [pi].property_value.type () == CORBA::_tc_void) - ACE_DEBUG ((LM_DEBUG,"Void\n")); - - if (properties [pi].property_value.type () == CORBA::_tc_float) - { - CORBA::Float f; - properties [pi].property_value >>= f; - ACE_DEBUG ((LM_DEBUG,"%f\n", f)); - } - - if (properties [pi].property_value.type () == CORBA::_tc_string) - { - CORBA::String str; - properties [pi].property_value >>= str; - ACE_DEBUG ((LM_DEBUG,"%s\n", str)); - } - - if (properties [pi].property_value.type () == CORBA::_tc_long) - { - CORBA::Long l; - properties [pi].property_value >>= l; - ACE_DEBUG ((LM_DEBUG,"%d\n", l)); - } - if (properties [pi].property_value.type () == CORBA::_tc_char) - { - CORBA::Char ch; - properties [pi].property_value >>= to_char (ch); - ACE_DEBUG ((LM_DEBUG,"%c\n", ch)); - } - } - } - return 0; -} - -// Testing, get_number_of_properties. - -int -Client::test_get_number_of_properties (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nNumber of props : %d\n", - this->remote_mmdevice_->get_number_of_properties (env))); - TAO_CHECK_ENV_RETURN (env, 1); - - return 0; -} - -// Test delete_property. - -int -Client::test_delete_property (CORBA::String property_name, - CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, "\nDeleting %s\n",property_name)); - - this->remote_mmdevice_->delete_property (property_name, env); - TAO_CHECK_ENV_RETURN (env, 1); - - return 0; -} - -// Test delete_properties. -// Make a sequence of property names and delete them from the -// PropertySet. Deleting char, short, long, float and string -// properties. - -int -Client::test_delete_properties (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nChecking delete_properties\n")); - CosPropertyService::PropertyNames prop_names; - prop_names.length (4); - prop_names [0] = CORBA::string_dup ("char_property"); - prop_names [1] = CORBA::string_dup ("short_property"); - prop_names [2] = CORBA::string_dup ("long_property"); - prop_names [3] = CORBA::string_dup ("float_property"); - ACE_DEBUG ((LM_DEBUG, - "Length of sequence %d, Maxlength : %d\n", - prop_names.length (), - prop_names.maximum ())); - this->remote_mmdevice_->delete_properties (prop_names, - env); - TAO_CHECK_ENV_RETURN (env, 0); - - return 0; -} - -// Defines a sequnce of properties containing, char, short, long, -// float in the property set. - -int -Client::test_define_properties (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nChecking define_properties\n")); - CosPropertyService::Properties nproperties; - nproperties.length (4); - CORBA::Any anyval; - // Prepare a char and "define" that in the PropertySet. - CORBA::Char ch = '#'; - anyval <<= from_char (ch); - ch = '*'; - anyval >>= to_char (ch); - nproperties[0].property_name = CORBA::string_copy ("char_property"); - nproperties[0].property_value <<= from_char (ch); - - // Prepare a Short and "define" that in the PropertySet. - CORBA::Short s = 3; - anyval <<= s; - s = 7; - anyval >>= s; - nproperties[1].property_name = CORBA::string_copy ("short_property"); - nproperties[1].property_value <<= s; - - // Prepare a Long and "define" that in the PropertySet. - CORBA::Long l = 931232; - anyval <<= l; - l = 931233; - anyval >>= l; - nproperties[2].property_name = CORBA::string_copy ("long_property"); - nproperties[2].property_value <<= l; - - // Prepare a Float and "define" that in the PropertySet. - CORBA::Float f = 3.14; - anyval <<= f; - f = 4.14; - anyval >>= f; - nproperties[3].property_name = CORBA::string_copy ("float_property"); - nproperties[3].property_value <<= f; - - // Define this sequence of properties now. - this->remote_mmdevice_->define_properties (nproperties, env); - TAO_CHECK_ENV_RETURN (env, 1); - - return 0; -} - -// Test get_all_properties. - -int -Client::test_get_all_properties (CORBA::Environment &env) -{ - ACE_DEBUG ((LM_DEBUG, - "\nTesting get_all_properties\n")); - // Get the number of current properties. - CORBA::ULong num_of_properties = - this->remote_mmdevice_->get_number_of_properties (env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Get half on the properties and half of on the iterator. - CORBA::ULong how_many = 0; - CosPropertyService::Properties_var properties; - CosPropertyService::PropertiesIterator_var iterator; - remote_mmdevice_->get_all_properties (how_many, - properties.out (), - iterator.out (), - env); - TAO_CHECK_ENV_RETURN (env, 1); - - // Print out the properties now. - if (properties.ptr () != 0) - { - CORBA::ULong len = properties->length (); - - for (CORBA::ULong pi = 0; pi < len; pi++) - { - // Print the property_name. - ACE_DEBUG ((LM_DEBUG, - "%s : ", - properties [pi].property_name.in ())); - - // Print the value if type is not tk_void. - if (properties [pi].property_value.type () == CORBA::_tc_void) - ACE_DEBUG ((LM_DEBUG,"Void\n")); - - if (properties [pi].property_value.type () == CORBA::_tc_float) - { - CORBA::Float f; - properties [pi].property_value >>= f; - ACE_DEBUG ((LM_DEBUG,"%f\n", f)); - } - - if (properties [pi].property_value.type () == CORBA::_tc_string) - { - CORBA::String str; - properties [pi].property_value >>= str; - ACE_DEBUG ((LM_DEBUG,"%s\n", str)); - } - - if (properties [pi].property_value.type () == CORBA::_tc_long) - { - CORBA::Long l; - properties [pi].property_value >>= l; - ACE_DEBUG ((LM_DEBUG,"%d\n", l)); - } - } - } - - // Pass thru the iterator. - if (iterator.ptr () != 0) - { - CosPropertyService::Property_var property; - - while (iterator->next_one (property.out (), env) != CORBA::B_FALSE) - { - ACE_DEBUG ((LM_DEBUG, "Iteration over PropertyIterartor")); - TAO_CHECK_ENV_RETURN (env, 1); - ACE_DEBUG ((LM_DEBUG, - "%s : ", - property->property_name.in ())); - - // Print the property_value. - if (property->property_value.type () == CORBA::_tc_char) - { - CORBA::Char c; - property->property_value >>= to_char (c); - ACE_DEBUG ((LM_DEBUG,"%c\n", c)); - } - - if (property->property_value.type () == CORBA::_tc_short) - { - CORBA::Short s; - property->property_value >>= s; - ACE_DEBUG ((LM_DEBUG,"%d\n", s)); - } - - if (property->property_value.type () == CORBA::_tc_float) - { - CORBA::Float f; - property->property_value >>= f; - ACE_DEBUG ((LM_DEBUG,"%f\n", f)); - } - - if (property->property_value.type () == CORBA::_tc_string) - { - CORBA::String str; - property->property_value >>= str; - ACE_DEBUG ((LM_DEBUG,"%s\n", str)); - } - - if (property->property_value.type () == CORBA::_tc_long) - { - CORBA::Long l; - property->property_value >>= l; - ACE_DEBUG ((LM_DEBUG,"%d\n", l)); - } - } - TAO_CHECK_ENV_RETURN (env, 1); - } -} - -int -main (int argc, char **argv) -{ - TAO_TRY - { - Client client; - - if (client.init (argc, - argv, - TAO_TRY_ENV) == -1) - return 1; - TAO_CHECK_ENV; - - client.run (TAO_TRY_ENV); - client.property_tester (TAO_TRY_ENV); - TAO_CHECK_ENV; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("AVStreams: client"); - return -1; - } - TAO_ENDTRY; -} diff --git a/TAO/orbsvcs/tests/AVStreams/client.h b/TAO/orbsvcs/tests/AVStreams/client.h deleted file mode 100644 index 9f9916c9f03..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/client.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/tests/AVStreams -// -// = FILENAME -// client.h -// -// = DESCRIPTION -// Test client for the AVStreams demo -// -// = AUTHORS -// Sumedh Mungee <sumedh@cs.wustl.edu> -// -// ============================================================================ - -#if !defined (AVSTREAMS_CLIENT_H) -#define AVSTREAMS_CLIENT_H - -#include "ace/Synch.h" -#include "ace/Task.h" -#include "ace/Thread_Manager.h" -#include "orbsvcs/Property/CosPropertyService_i.h" -#include "orbsvcs/AV/AVStreams_i.h" -#include "ace/Get_Opt.h" -#include "tao/tao_util.h" - -class Client -{ - // = TITLE - // Client for A/V Streams demo. - // - // = DESCRIPTION - // Encapsulates client functionality. -public: - Client (void); - // Constructor. - - int init (int argc, - char **argv, - CORBA::Environment &env); - // Initialize the ORB etc, and bind the MMDevices. - - int run (CORBA::Environment &env); - // Run the client. This will call StreamCtrl::bind_devs. - - int property_tester (CORBA::Environment &env); - // Testing the property service methods. - -protected: - int bind_to_remote_mmdevice (int argc, - char *argv[], - CORBA::Environment &env); - // Bind to the remote MMDevice. - - // = Property Testing. - - int test_define_property (CORBA::Environment &env); - // Testing the define property method. - - int test_get_number_of_properties (CORBA::Environment &env); - // Testing the number of properties, currently in the Property Set. - - int test_get_all_property_names (CORBA::Environment &env); - //Testing get_all_property_names. - - int test_get_properties (CORBA::Environment &env); - //Testing get_properties. Give the names and get their properties. - - int test_get_all_properties (CORBA::Environment &env); - // Testing get_all_properties. - - int test_delete_property (CORBA::String property_name, - CORBA::Environment &env); - // Testing delete_property. - - int test_delete_properties (CORBA::Environment &env); - // Testing delete_properties. - - int test_define_properties (CORBA::Environment &env); - // Defining a sequence of properties. - - TAO_ORB_Manager manager_; - // The ORB manager, handles ORB initialization etc. - - AVStreams::MMDevice_var local_mmdevice_; - // Our MMDevice. - - AVStreams::MMDevice_var remote_mmdevice_; - // Servers MMDevice. - - AVStreams::StreamCtrl_var stream_ctrl_; - // Stream Controller. -}; - -class Video_Client_StreamEndPoint - : public virtual TAO_Client_StreamEndPoint -{ - // = TITLE - // Stream Endpoint for the video client. - // - // = DESCRIPTION - // Implements the callbacks that are made by the AVStreams library. -public: - Video_Client_StreamEndPoint (void); - // Constructor. - - virtual void handle_stop (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream stoppage. - - virtual void handle_start (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream start. Starts the flow of data. - - virtual void handle_destroy (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles the destruction of the stream, tears down the transport. - - virtual CORBA::Boolean handle_connection_established (AVStreams::StreamEndPoint_ptr responder, - AVStreams::streamQoS &qos_spec, - const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream bind, establishes the transport. -}; - -#endif /* AVSTREAMS_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/ANNOUNCE b/TAO/orbsvcs/tests/AVStreams/mpeg/ANNOUNCE deleted file mode 100644 index 77ccd3aaeb1..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/ANNOUNCE +++ /dev/null @@ -1,45 +0,0 @@ -Sent to: - comp.multimedia, comp.sources.x, comp.windows.x, - comp.windows.x.announce, - ogi.general, ogi.cse.general, ogi.cse.software - -ANNOUNCE: Internet MPEG Player v2.0 - -The Distributed Systems Research Group of the Department of Computer -Science and Engineering, Oregon Graduate Institute of Science and -Technology is pleased to announce the release of version 2.0 of its -Internet-based distributed real-time MPEG video audio player. - -The MPEG player has following salient features: - - - Real-time synchronized playback of MPEG1 video and SPARC audio. - - Movie data stream from server to client, NO NEED to download - all bits beforehand. - - Launch-able from within WWW browsers. - - Users can specify QoS parameters like desired video frame - rate. - - Novel software feedback mechanisms are used to make the - player robust across Internet: - - synchronizing client and server clocks. - - adapting video frame rate to current Internet - workload. - - -The video player is publicly available via following WWW pointer: - - http://cse.ogi.edu/DISC/projects/synthetix/Player/ - -or following anonymous ftp pointer: - - ftp.cse.ogi.edu (129.29.20.2) in /pub/dsrg/Player/ - - -Best wishes, - -Shanwei Cen - -Distributed Systems Research Group -Department of Computer Science and Engineering -Oregon Graduate Institute of Science & Technology - -scen@cse.ogi.edu diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/BUGS b/TAO/orbsvcs/tests/AVStreams/mpeg/BUGS deleted file mode 100644 index dbb12fd2df5..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/BUGS +++ /dev/null @@ -1,21 +0,0 @@ -Reporting bugs: - - If you find any bugs in this MPEG video audio player, - please report them to - - scen@cse.ogi.edu. - - Since this software - is unsupported, we make no guarantee about how long it will - take to fix the bugs, or if it will be fixed at all. Bug fixes - will be cheerfully accepted. Please include as much detailed - information as possible, including: - - 1) the version number of the program you are using (cf. VERSION) - 2) the data file that caused the bug (if possible) - 3) the OS version and machine type you ran the program on - 4) the compiler used to compile the program - -Known problems: - - Please see man page vcr(1) for a list of them. diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/COPYING b/TAO/orbsvcs/tests/AVStreams/mpeg/COPYING deleted file mode 100644 index a43ea2126fb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL b/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL deleted file mode 100644 index 20c5d01aae5..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL +++ /dev/null @@ -1,231 +0,0 @@ -Following are the instructions for installing the distributed -real-time MPEG video and audio player. - -To install this MPEG video audio player on an architecture, you need -to login to a machine of the same architecture, and follow the -instructions below. - -Building this software needs a Motif environment. - -The player can be built to have or not to have audio capacity. If your -workstation or X-terminal has audio output, you may want to play audio -with the player. - -Audio can be supported either through native audio device or -AudioFile. If you want to build the player to use AudioFile, you need -AudioFile client environment: header files and libraries. Those who -are interested in getting AudioFile may want to follow the pointer(ftp -or WWW): - - file://crl.dec.com/pub/DEC/AF/ - -Upon reading this file, you should have uncompressed and untared the -file vcr.tar.Z. Suppose you are now in the root directory of the -source tree, which contains this file and several other files as well -as a source subdirectory ./source. - -Prior to installation, please read all files 'INSTALL*', and 'README*' -in current directory, to get more information. - -The software and Makefile's are coded so that you can build the player -for several architectures at the same time, without copying the source -code, or making symbolic links to source files. - -There are plenty of sample Makefile's in directory ./source for -architectures HPUX (Makefile.ohp[.debug|.static]), SunOS4 for -Sparc-stations (Makefile.osun4[.debug|.static]), Solaris 2.4 for x86 -(Makefile.osolpc[.debug]) and Solaris 2.x for SparcStation -(Makefile.solsparc). Makefile's with suffix '.debug' are with -debugging mode turned on, otherwise most optimizations are turned on. - -Also you will find a file 'Makefile.rules'. This file contains all -dependency information, which is independent from specific environment -setting. This file is included by all other sample Makefile's in that -directory. Separate 'Makefile.rules' make it easier for you to -understand and modify the sample Makefile's, and/or create your own -Makefile's. - -The Makefile's in ./source defines following variables: - - LIBDIRS -- a list of internal library directories your version - of binaries need. - CC -- name of the compiler used. - CFLAGS -- flags for the compiler. This should also include - paths of the header files for X11, AudioFile, etc. - In the sample Makefile's, the pathes are defined by - the name INCLUDEDIR. - LD -- name of the linker used. - LDFLAGS -- flags for the linker. - AR -- name and options of archive mantenance program - RANLIB -- name an option of ranlib, if your platform (like SunOS4) - needs ranlib, you need to define this, otherwise leave it - undefined. - CLIBS -- a list of external libraries for client, like X11, - Xm, AF, etc. including the paths of these libraries, - if they are not in default path. - CILIBS -- a list of internal libraries for client, each element - in this list should be in a directory listed in LIBDIRS. - SLIBS -- a list of external libraries for server, like X11, - Xm, AF, etc. including the paths of these libraries, - if they are not in default path. - SILIBS -- a list of internal libraries for server, each element - in this list should be in a directory listed in LIBDIRS. - -The Makefile's finally include the 'Makefile.rules' in ./source. - -In the definition of the name CFLAGS, one or more of following micros -may need to be defined through '-D' compiler option, for compiling the -client and/or the server: - - Shared by client and server: - - SunOS -- If you are building the player on SunOS4. For both - the client and the server. - __srv4__ -- If you are building the player on Solaris 2.x. - For both the client and the server. - _HPUX_SOURCE -- If you are building the player on HPUX. - For both the client and the server. - ULTRIX -- If you are building the player on Ultrix 4.x. For - both the client and the server - IRIX -- For SGI IRIX 5.x - FreeBSD -- For FreeBSD 2.x - LINUX -- For Linux 1.x - - BIG_ENDIAN -- If you are building the player on big-endian - machines, like HP and SunSPARC. For both the - client and the server. - LITTLE_ENDIAN -- If you are building the player on little-endian - machines, like x86 PC and DEC MIPS. For both the - client and the server. - - STAT -- If you want to build the player WITH the code for - statistics. For both the client and the server. - - NDEBUG -- If you want to include assertion checking in the - player. For both the client and the server. - - Used by client only: - - AUDIOFILE -- If you want to build the player to output audio - to AudioFile server. You need to have at least - AudioFile client side library to use AudioFile. - Otherwise, you may access directly audio devices. - SH_MEM -- If you want the player to output to X-window via - shared memory. For the client only. - - -Following are the steps for installing the software, with -installing on HPUX as an example. - -If you are installing on an architecture other than HPUX, you may want -to create working directories with different names. If your -architecture is in above architecture list, you may want to make use -of the sample Makefile's for your architecture instead of HPUX, and -edit them to suit your environment. - -If you are porting the player to an architecture which is not in above -list, you may need to create your own Makefile's. Nevertheless, you -will find useful hints from existing sample Makefile's. Among other -things, choose to define BIG_ENDIAN or LITTLE_ENDIAN in CFLAGS -depending on the endianness of your platform, and you may need to -define a name for your porting, like SunOS ULTRIX etc. mentioned -above. Also, you may need to modify some architecture specific code, -which is usually around where names like ULTRIX, _HPUX_SOURCE or -__svr4__ show up. - -Suppose now you are to build the player on the HPUX architecture, in -working subdirectory ./hpux. In fact, you can choose any names you -like for this working directory. - -Now, you have or will create following directories for building the -software: - -./ -- root directory for the source package. -./source -- source code directory tree. - -Above directories have been created automatically when you untar the -source package. You will create following working directory for -compiling the software. - -./hpux -- directory for building the whole package. - - -Steps for building the package on HPUX - -(1). - % mkdir ./hpux - % cd ./hpux - % tar xf ../dirtree.tar - % ln -s ../source/Makefile.hp Makefile - -(2). Edit ./Makefile, to suit your environment. - -(3). - % make - % make clean - % cd .. - -If no error is reported, you should have got ./hpux/vcrs, the server -program, and ./hpux/vcr, the client programs of the player. - -In editing the Makefile's, make sure to set right values to all -variables like CC, CFLAGS, etc., so that the right compiler is chosen, -the right compile flags are set, the header files and the libraries -for TCP/UNIX socket are accessible when compiling both the server and -the client, and the header files and the libraries for X11, -X11-toolkit, Motif, and AudioFile (if applicable) are all accessible -when compiling the client. Also make sure you set all reasonal -compile-time optimization flags on with CFLAGS. This makes things -different, because the client takes very much CPU time to decode video -frames. - -If you have problem with the meaning of CC, CFLAGS, LD, LDFLAGS, -etc. or the syntax or structure of the Makefile's you are to edit or -create, please read the man page of 'make'. If you are not sure which -compiler to use and what compile and link flags to set, please find -out the compilers available in your system (usually they are 'cc' or -'gcc') and read their man pages. - -Only compilers accepting prototypes will compile successfully. gcc is -one of them. The Makefiles in this package work with 'make' programs -which support pattern match rules. gnu make is one of them. - -3. Install the compiled programs into proper directories - -For example, suppose you are in the root dir of the source kit, and -want to install the player in /usr/local, run following commands: - - % cp ./vcr.1 ./vcrs.1 /usr/local/man/man1/. - % cp ./hpux/vcrs ./hpux/vcr /usr/local/bin/. - - -4. Run the player. - -(1). Start the server program on hosts on which there are video and/or -audio files to be played. Refer to vcrs(1) for instructions. - -(2). Set environment for accessing AudioFile, X, Motif, start the client -program. Refer to vcr(1) for instructions. Following are sample steps -(assume you are using csh on Sparc-station, and use AudioFile): - - % set path=(/usr/local/bin $path) - % setenv LD_LIBRARY_PATH /usr/lib:/usr/local/lib - % setenv DISPLAY hostname:0.0 - % Asparc & - % ahost hostname - % vcr - -(3). The first invocation of the client programs will create a -directory $(HOME)/.vcr, and a movie list file $(HOME)/.vcr/vcrPrograms -with default movie list. After the first invocation, edit the movie -list file to include all your favorite programs in this file, and -invoke the client again to play your favorite programs. Refer to man -page vcr(1) for structure of this file. - -5. Add yourself to our mailing list by sending a mail (with your name -and email address) to the following address, so that we can keep you -informed of software upgrade and bug fix. - - scen@cse.ogi.edu - -If you experience any problem, please read file BUGS for bug report. diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL.UCB b/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL.UCB deleted file mode 100644 index 38a656a538b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/INSTALL.UCB +++ /dev/null @@ -1,105 +0,0 @@ -These are the instructions for compiling mpeg_play, the software MPEG -decoder and player. - -1) Untar the file mpeg_play.tar.Z. This is best done by creating a new -directory for the files involved, moving the tar file into this directory -and invoking the command: - - zcat mpeg_play-2.0.tar.Z | tar xvf - - -2) Create and customize the Makefile. Do this by copying the file -Makefile.proto to Makefile. Then edit Makefile for your particular needs. - -In the makefile the CFLAGS definition is multiply defined for a couple of -different machines, uncomment the one you want to use, or define your own -if necessary. - -The INCLUDEDIR variable should be set to include the paths leading to the -standard header files such as stdio.h as well as to X11/Xlib.h (on most -systems, this is /usr/include). To do this set the INCLUDEDIR variable to --I followed by the pathname. For example, if the path is /usr/local/include, -edit the Makefile to look like this: - - INCLUDEDIR = -I/usr/local/include - -If more than one pathname is necessary, simply prepend -I to each path. -For example if you needed to include /usr/local/include and /usr/X11/include, -the variable definition would look like: - - INCLUDEDIR = -I/usr/local/include -I/usr/X11/include - -Finally, make sure the LIBS variable is set to the path and name of your X11 -library. For example: - - LIBS = /usr/lib/X11/libX11.a - -3) Type make all. - -4) To remove .o files, type make clean - -5) Add yourself to the mailing list by sending mail to - mpeg-list-request@roger-rabbit.cs.berkeley.edu with the subject line - "ADD" (you can delete yourself by sending the subject line "DEL"). - If you are a uunet user, you can use the mail path - 'uunet!ucbvax!roger-rabbit.cs!mpeg-list-request' - - mail mpeg-list-request@roger-rabbit.cs.berkeley.edu - Subject: ADD - ^D - -6) Try it out! You can ftp some sample data files from the same site - you got this player from. Data files usually end in .mpg or .mpeg - The command line for the player is described in the man page, but - is basically: - - mpeg_play [options] [file_name] - -7) If you want the player to collect statistics on size of frames, - macroblocks, time to decode, etc., add the following to the - definition of CFLAGS in the Makefile: - -DANALYSIS - Remove all .o files with "make clean" and remake with "make all" - The player will now print summarized statistics at the end of the - video clip and can be made to print frame by frame statistics with - the use of the -eachstat flag. Read man page for more info. ------------------------------------------------------------------------- - -Using Imake - -We have included an Imakefile for use with Imake. Since we do not use -Imake ourselves and the file was provided by someone else, we can not -give any specific instructions on how to use it. Please, consult -someone more experienced with Imake. -Thanks. - ------------------------------------------------------------------------- -NOTES - -It seems that much of the time is spent converting the 24 bit MPEG image -to an 8 bit color space. This process is called "dithering". We've included -several dithering algorithms. Read the man pages for more instructions. - -The data files available are produced by XING. These images are -usually small (~160X120). XING data does not take advantage -of P or B frames (ie, frames with motion compensation). The data is simply -a series of I frames. Performance of the player on XING data is -significantly lower (half or less) of the performance when motion compensated -MPEG data is decoded. - -Reporting bugs: - If you find any bugs in this software, please send them to - mpeg-bugs@roger-rabbit.cs.berkeley.edu. Since this software - is unsupported, we make no guarantees about how long it will - take to fix the bug, or if it will be fixed at all. Bug fixes - will be cheerfully accepted. Please include as much detailed - information as possible, including: - - 1) the version number of the program you are using (cf. VERSION) - 2) the data file that caused the bug (if possible) - 3) the OS version and machine type you ran the program on - 4) the compiler used to compile the program - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/PatchLevel b/TAO/orbsvcs/tests/AVStreams/mpeg/PatchLevel deleted file mode 100644 index fc8384029fb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/PatchLevel +++ /dev/null @@ -1,12 +0,0 @@ - -1. Current patch level: version 2.0, patch level 1 - -Sun Jun 9 12:26:16 PDT 1996 - -(1). Port to linux 1.3 -(2). Reduce the number of semaphores used in the client to ONE. -(3). Various bug fix - -2. Patch level: version 2.0, patch level 0 - -Tue Nov 28 14:14:58 PST 1995 diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/README b/TAO/orbsvcs/tests/AVStreams/mpeg/README deleted file mode 100644 index 26a835dac7f..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/README +++ /dev/null @@ -1,142 +0,0 @@ - Distributed real-time MPEG video audio player v2.0 - - Distributed Systems Research Group - Department of Computer Science and Engineering - Oregon Graduate Institute of Science & Technology - November, 1995 - - -This directory contains a freely available software distributed -real-time MPEG video and audio player, for use across the -Internet. Please install it, run it, play movies and music, and have -fun ! - -The player features common VCR functionalities like synchronized video -and audio play back, play speed change on the fly, fast-forward, rewind, -step forward, random Positioning, and more. - -This version of the player plays MPEG1 video (elementary stream) and -Sun Sparc format (mu-law) audio. It does not play MPEG1 system streams -or MPEG2 streams yet. - -The player is of server/client architecture, with audio/video servers -and a client distributed across the Internet. The server manages audio -video file retrieval and distribution. The client decodes video -frames, plays video and audio streams, and provides a Motif style user -interface. - -The servers stream out media data to clients, so there is NO NEED to -download all bits beforehand. - -Some important characteristics of Internet are resource sharing, -highly dynamic workload, no resource reservation facility, and lack of -a common clock. This player uses novel software feedback mechanisms -to synchronize servers and clients, and to adapt playback quality to -the current Internet workload. - - -As compared to version 1.0, this version has following improvements: - - - UDP/TCP video audio data connection choice - - support of both native audio device and AudioFile - - client invocable from web browser - - better organized source code tree - - bug fix - - and more... - - -The player has been compiled and tested on following architectures: - - HP-UX 09.03 - SunOS 4.1.3_U1 (sparc) - Solaris 2.3 (sparc) - Solaris 2.4 (i86pc) - Solaris 2.4 (sparc) - Ultrix 4.x - FreeBSD 2.0.5 - LINUX 1.3 - -If you decide to port the player to a new architecture, please let -us know so that we can incorporate the changes into our sources. - - -The player is publicly available via anonymous ftp from: - - ftp.cse.ogi.edu (129.29.20.2) in /pub/dsrg/Player/ - -or through following WWW pointer: - - http://cse.ogi.edu/DISC/projects/synthetix/Player/ - -To install the player, ftp file vcr.tar.Z to local host, move it to a -suitable directory (best to create a new directory for this software), -uncompress and untar the .Z file, and see INSTALL for instructions. -Following is an example of steps to ftp and untar the package: - - % mkdir vcr - % cd vcr - % ftp ftp.cse.ogi.edu - *** login as anonymous and your email address as passwd *** - ftp> cd pub/dsrg/Player - ftp> binary - ftp> get README - ftp> get vcr.tar.Z - ftp> quit - % gunzip vcr.tar.Z (or you may also use 'uncompress vcr.tar.Z') - % tar xf vcr.tar - -Binary code for platforms HPUX, Solaris 2.4 for x86, Solaris 2.x for -Sparc, SunOS4.1.3 and FreeBSD are also available in directory -/pub/dsrg/Player/binaries/. - - -This software is covered by copyrights. It contains code contributed -by the author and several other parties. Please see the beginning of -source files and copyright file(s) in the root directory of the source -tree for more information. - - -Please add yourself to our mailing list by sending a mail (with your -name and address) to following address, so that we can keep you -informed of software upgrade and bug fix. - - scen@cse.ogi.edu - - -We would highly appreciate it if you can share with us the performance -result you get when you play movies retrieved from the OGI -server. Please let us know following information: - - - The platform you use for the client. - - - How many hops from your site to OGI, and what is the - estimated bandwidth, - - - Which picture size (320x240, 256x192, 128x96 or 64x48) - works best for you, and on average how many - frames-per-second can be displayed. - - - Questions, comments, suggestions, and bug report. - -Information can also be sent to: scen@cse.ogi.edu Thank you! - - -ACKNOWLEDGMENT - -We gratefully thank ARPA and the National Science Foundation for their -financial support, and thank Tektronix, Hewlett-Packard and the -Portland Trail Blazers for their donations. - -We also want to thank following people for their code: - - Lawrence A. Rowe, Ketan Patel, and Brian Smith of Computer Science - Division-EECS, Univ. of Calif. at Berkeley. The MPEG decoder used by - the client of the player is originated from their MPEG decoder 2.0 - - Thomas M. Levergood, Andrew C. Payne, James Gettys, G. Winfield - Treese, and Lawrence C. Stewart of Cambridge Research Lab, Digital - Equipment Corporation. The player uses AudioFile as audio output. - - Daeron Meyer of the Geometry Center, University of Minnesota. The - Motif user interface is based on his version. - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/README.MI b/TAO/orbsvcs/tests/AVStreams/mpeg/README.MI deleted file mode 100644 index 85a3069e979..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/README.MI +++ /dev/null @@ -1,39 +0,0 @@ -Hello animation addicts, - -I'll be brief. This is the modified source of mpeg_play that has a new motif -user interface (finally!). I hope you will enjoy spending many hours using it! -This is a very rough first release and the source files + make files are not -particularly well organized. You might have to do a lot of hand tweaking to get -it to compile. - -Here are some helpful hints: - -/mib directory contains the source for my mib interface construction toolkit - which is really just a wrapper around motif. This is the majority of the - new code and is the same toolkit I used for the X11 version of Geomview - (3d visualization program), also available via ftp from geom.umn.edu. - -/interface directory contains the bitmaps for buttons, and the interface - geometry specified with .mib files. - -ui.c file contains the code which sets up the interface and processes button - callbacks. - -More minor modifications were made to gdith.c util.c util32.c and video.c. - -To compile you will need a decent compiler (gcc works the best!), as well as -the X11, Xt, and Xm (motif) libraries. - -You must first get mib/libmib.a to be created. The Makefile in /mib should take -care of this when properly tweaked. The main makefile should handle linking the -library into the mpeg_play binary. - -If you have any questions or need help with the compile feel free to send me -mail, but I may take a while to respond. I tend to correspond with quite a -few people about many different things. - -best wishes, - -Daeron Meyer - -daeron@geom.umn.edu diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/README.UCB b/TAO/orbsvcs/tests/AVStreams/mpeg/README.UCB deleted file mode 100644 index 3c122f92421..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/README.UCB +++ /dev/null @@ -1,105 +0,0 @@ - MPEG Video Software Decoder - (Version 2.0; Jan 27, 1993) - - Lawrence A. Rowe, Ketan Patel, and Brian Smith - Computer Science Division-EECS, Univ. of Calif. at Berkeley - -This directory contains a public domain MPEG video software -decoder. The decoder is implemented as a library that will -take a video stream and display it in an X window on an 8, 24 -or 32 bit deep display. The main routine is supplied to -demonstrate the use of the decoder library. Several dithering -algorithms are supplied based on the Floyd-Steinberg, ordered -dither, and half-toning algorithms that tradeoff quality and -performance. Neither the library nor the main routine handle -real-time synchronization or audio streams. - -The decoder implements the standard described in the Committee -Draft ISO/IEC CD 11172 dated December 6, 1991 which is -sometimes refered to as "Paris Format." The code has been -compiled and tested on the following platforms: - - HP PA-RISC (HP/UX 8.X, X11R4) (i.e., HP 9000/7XX and 9000/3XX) - Sun Sparc (SunOS 4.X, X11R5) - DECstation 5000 and Alpha - IBM RS6000 - Silicon Graphics Indigo - MIPS RISC/os 4.51 - Sequent Symmetry - Sony NEWS - and more than we can list here. - -If you decide to port the code to a new architecture, please let -us know so that we can incorporate the changes into our sources. - -This directory contains everything required to build and -display video. We have included source code, a makefile, an Imakefile, -installation instructions, and a man page. Data files can -be obtained from the same ftp site this was located in. -See the INSTALL file for instructions on how to -compile and run the decoder. - -The data files were produced by XING. XING data does not take -advantage of P or B frames (ie, frames with motion compensation). -Performance of the player on XING data is significantly slower -(half or less) than the performance when motion compensated MPEG -data is decoded. We are very interested in running the software -on other MPEG streams. Please contact us if you have a stream -that does not decode correctly. Also, please send us new streams -produced by others that do utilize P and B frames. - -NOTE: One particular XING data file: raiders.mpg, is not a -valid MPEG stream since it does not contain a sequence -header. - -We have established several mailing lists for messages about -the decoder: - -mpeg-list-dist@CS.Berkeley.EDU - General information on the decoder for everyone interested - should be sent to this list. This should become active after - 11/20/92 - -mpeg-list-request@CS.Berkeley.EDU - Requests to join or leave the list should be sent to this - address. The subject line should contain the single word - ADD or DELETE. - -mpeg-bugs@CS.Berkeley.EDU - Problems, questions, or patches should be sent to this address. - -Our future plans include porting the decoder to run on other -platforms, integrating it into a video playback system that -supports real-time synchronization and audio streams, and -further experiments to improve the performance of the -decoder. Vendors or other organizations interested in supporting -this research or discussing other aspects of this project should -contact Larry Rowe at Rowe@CS.Berkeley.EDU. - -We also plan on producing an MPEG encoder. The encoder will NOT be -a real time digitizer, but will be intended for offline processing -of video data. - -ACKNOWLEDGEMENTS: - We gratefully thank Hewlett-Packard, Fujitsu, the Semiconductor - Research Corporation for financial support. - - We also want to thank the following people for their help: - - Tom Lane of the Independent JPEG Group provided us with - the basic inverse DCT code used by our player. - (tom_lane@g.gp.cs.cmu.edu) - - Reid Judd of Sun Microsystems provided advice and assistance. - - Todd Brunhoff of NVR provided advise and assistance. - - Toshihiko Kawai of Sony provided advise and assistance. - - - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/VERSION b/TAO/orbsvcs/tests/AVStreams/mpeg/VERSION deleted file mode 100644 index b8dcb387060..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/VERSION +++ /dev/null @@ -1 +0,0 @@ -Distributed real-time MPEG video and audio player version 2.0 diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/Makefile deleted file mode 100644 index 436da0b23b9..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -## $Id$ -#---------------------------------------------------------------------------- -# @(#)Makefile 1.1 -# -# Makefile for MPEG stuff -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -INFO = README - -DIRS = mpeg_shared \ - mpeg_mib \ - mpeg_server \ - mpeg_client \ - client \ - server - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO b/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO deleted file mode 100644 index ad7698e62f4..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/TODO +++ /dev/null @@ -1,45 +0,0 @@ -$Id$ - -Use - for things to do, * for urgent things, and + for things that -have been done. - -Things to do ------------- - -"Simple" things - -- Clear the semaphores on the client and the server! - -- Semaphore on the client side is exclusive ?! Sometimes one - client blocks forever when the server exits - -- rttag is enabled with -r - does it work ? - -- Make #define's into enums in common.h/globals.h - -+ Change handle_input to handle_connection in - Mpeg_Svc_Handler - -+ Video_Sig_Handler is in Mpeg_Server -- needs to be moved to Video_Server - -- done - -+ Split up VIDEO_FAST into two commands - VIDEO_FAST_{FORWARD,BACKWARD} - -+ create a helper class for video, and put FBread et al in that - -- try compiling ACE and the application with fast=1 to see if - performance improves - -- Rename "play", "play_send" etc. appropriately - - - -"Not-so-simple" things - - -- Logic for Video_Server is convoluted!! - -- Need to modularize Audio_Server - -- Seperate command parsing in its own class diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/Makefile deleted file mode 100644 index 13ae89f9b8e..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -BIN = vcr - -BUILD = $(BIN) - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES= vcr - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - - -LIBS += -lTAO -lACE -lorbsvcs -MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source -CPPFLAGS += -I$(MPEG_ROOT) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -LDFLAGS += -lmpeg_shared -lmpeg_mib -lmpeg_client -lXm -lXext -lXt -lSM -lICE -lX11 -lsocket -lnsl -ldl -CPPFLAGS += -i -DSH_MEM -DNDEBUG -I/project/doc/pkg/X11/include -L/project/doc/pkg/X11/lib - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/vcr.o .obj/vcr.so .shobj/vcr.o .shobj/vcr.so: vcr.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/svc.conf b/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/svc.conf deleted file mode 100644 index 43c6a486c92..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/svc.conf +++ /dev/null @@ -1,49 +0,0 @@ -# $Id$ -# -# This file contains a sample ACE_Service_Config configuration -# file specifying the strategy factories utilized by an application -# using TAO. There are currently only two possible factories: -# Client_Strategy_Factory and Server_Strategy_Factory. These names -# must be used as the second argument to their corresponding line, -# because that's what the ORB uses to find the desired factory. -# -# Note that there are two unordinary characteristics of the way *this* -# file is set up: -# - both client and server strategies are specified in the same -# file, which would only make sense for co-located clients & servers -# - both of the factories are actually sourced out of libTAO.so -# (TAO.DLL on Win32), and they would normally be in a separate -# dll from the TAO ORB Core. -# -# The options which can be passed to the Resource Factory are: -# -# -ORBresources <which> -# where <which> can be 'global' to specify globally-held resources, -# or 'tss' to specify thread-specific resources. -# -# The options which can be passed to the Client are: -# <none currently> -# -# The options which can be passed to the Server are: -# -# -ORBconcurrency <which> -# where <which> can be 'thread-per-connection' to specify -# use of the ACE_Threaded_Strategy concurrency strategy, -# or 'reactive' to specify use of the ACE_Reactive_Strategy -# concurrency strategy. -# -# -ORBthreadflags <flags> -# specifies the default thread flags to use, where <flags> is a -# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, -# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid -# on every platform. -# -# -ORBdemuxstrategy <which> -# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', -# and specifies the type of object lookup strategy used internally. -# -ORBtablesize <unsigned> -# specifies the size of the object table -# -dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global" -dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() -dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/vcr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/vcr.cpp deleted file mode 100644 index 34b0336fb59..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/client/vcr.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <X11/Intrinsic.h> -#include <sys/types.h> -#include <signal.h> -#include <sys/wait.h> -#ifndef MIPS -#include <netinet/in.h> -#else -#include <bsd/netinet/in.h> -#endif -#if defined(sun) || defined(FreeBSD) -#include <stdlib.h> -#endif -#include <time.h> -#include <sys/time.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/sem.h> - -#include "include/common.h" - -#include "mpeg_client/video.h" -#include "mpeg_client/proto.h" -#include "mpeg_client/newproto.h" -#include "mpeg_client/global.h" - -#include "mpeg_client/util.h" -#include "mpeg_client/dither.h" - -#include "mpeg_shared/routine.h" - -static int mainPid; - -static time_t start_time; -/* - *-------------------------------------------------------------- - * - * usage -- - * - * Print mpeg_play usage - * - * Results: - * None. - * - * Side effects: - * exits with a return value -1 - * - *-------------------------------------------------------------- - */ - -void -usage(char *s) /* program name */ -{ - fprintf(stderr, "Usage:\n"); - fprintf(stderr, "%s [-rt] [-shmem] [-rmsem]\n", s); - fprintf(stderr, " [-dither ordered|ordered2|fs4|fs2|fs2fast|hybrid|\n"); - fprintf(stderr, " hybrid2|2x2|gray|color|mono|threshold]\n"); - fprintf(stderr, " [X-window options]\n"); - fprintf(stderr, " [-v [host_name:]video_file_name]\n"); - fprintf(stderr, " [-a [host_name:]audio_file_name]\n"); - - fprintf(stderr, " [-p movie_file_name]\n"); - fprintf(stderr, " [-l movie_list_file_name]\n"); - - fprintf(stderr, " [-help]\n"); - fprintf(stderr, " [-quiet]\n"); - - exit (-1); -} - -/* - *-------------------------------------------------------------- - * - * int_handler -- - * - * Handles Cntl-C interupts.. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static int on_exit_tag = 1; - -void set_exit_routine_tag(int tag) -{ - on_exit_tag = tag; -} -void on_exit_routine(void) -{ - if (!on_exit_tag) - return; - if (mainPid == getpid()) - { - extern void delete_semaphore(); - ABdeleteSem(); - VBdeleteSem(); - VDdeleteSem(); - delete_semaphore(); - if (getuid() != DEVELOPER_UID) - { - FILE * fp; - char *buf = (char *)malloc(100); - char *tbuf; - if (buf != NULL) { - sprintf(buf, "%s%s", LOG_DIR, "vcrSession.log"); - if ((fp = fopen(buf, "a")) != NULL) { - time_t val = time(NULL); - get_hostname(buf, 100); - buf[99] = 0; - tbuf = ctime(&start_time); - tbuf[strlen(tbuf) - 1] = 0; - fprintf(fp, "User %d on %s at %s %dm%ds\n", getuid(), buf, - tbuf, (val - start_time) / 60, (val - start_time) % 60); - } - free(buf); - } - } - } - on_exit_tag = 0; - kill(0, SIGINT); -} - -static void int_handler(int sig) -{ - exit(0); -} - -static void clear_child(int sig) -{ - int pid; - int status; - - while ((pid = waitpid(-1, &status, WNOHANG)) > 0) - { - if (status == 0) { - continue; - } - fprintf(stderr, "VCR: child %d (status %d) ", pid, status); - if (WIFEXITED(status)) { - fprintf(stderr, "exited with status %d\n", WEXITSTATUS(status)); - } - else if (WIFSIGNALED(status)) { -#if defined(_HPUX_SOURCE) || defined(__svr4__) || defined(IRIX) - fprintf(stderr, "terminated at signal %d%s.\n", WTERMSIG(status), - WCOREDUMP(status) ? ", core dumped" : ""); -#else - fprintf(stderr, "terminated at signal %d.\n", WTERMSIG(status)); -#endif - } - else if (WIFSTOPPED(status)) { - fprintf(stderr, "stopped at signal %d\n", WSTOPSIG(status)); - } - - } -} - -/* - *-------------------------------------------------------------- - * - * main -- - * - * Parses command line, starts decoding and displaying. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -int main(int argc, char ** argv) -{ - - int mark; - int rmsemFlag = 0; - - argc_share = argc; - argv_share = argv; - mark = 1; - argc--; - - displayName[0] = 0; - ditherType = ORDERED2_DITHER; - LUM_RANGE = 8; - CR_RANGE = CB_RANGE = 4; - noDisplayFlag = 0; - -#ifdef SH_MEM - shmemFlag = 0; -#endif - - if (getenv("DISPLAY")!= NULL) - { - char * disp = getenv("DISPLAY"); - if (strncmp(disp, "anquetil:0", 10) == 0 || - strncmp(disp, "helix:0", 7) == 0 || - strncmp(disp, "hinault:0", 9) == 0 || - strncmp(disp, "lemond:0", 8) == 0 || - strncmp(disp, "indurain:0", 10) == 0) - ditherType = ORDERED_DITHER; - else - ditherType = ORDERED_DITHER; - } - - while (argc) { - if (strcmp(argv[mark], "-rt") == 0) { - realTimeFlag = 1; - argc--; mark++; - } - else if (strcmp(argv[mark], "-rt1") == 0) { - realTimeFlag = 2; - argc--; mark++; - } - else if (strcmp(argv[mark], "-rt2") == 0) { - realTimeFlag = 3; - argc--; mark++; - } - else if (strcmp(argv[mark], "-shmem") == 0) { - argc--; mark++; - shmemFlag = 1; - } - else if (strcmp(argv[mark], "-rmsem") == 0) { - argc--; mark++; - rmsemFlag = 1; - } -#if 0 - else if (strcmp(argv[mark], "-nop") == 0) { - TogglePFlag(); - argc--; mark++; - } else if (strcmp(argv[mark], "-nob") == 0) { - ToggleBFlag(); - argc--; mark++; - } -#endif - else if (strcmp(argv[mark], "-l") == 0) { /* program list file name */ - strcpy(proglistName, argv[++mark]); - argc -= 2; mark++; - - } else if (strcmp(argv[mark], "-display") == 0) { - strcpy(displayName,argv[++mark]); - argc -= 2; mark++; - } else if (strcmp(argv[mark], "-dither") == 0) { - argc--; mark++; - if (argc < 1) { - perror("Must specify dither option after -dither flag"); - usage(argv[0]); - } - if (strcmp(argv[mark], "hybrid") == 0) { - argc--; mark++; - ditherType = HYBRID_DITHER; - } else if (strcmp(argv[mark], "hybrid2") == 0) { - argc--; mark++; - ditherType = HYBRID2_DITHER; - } else if (strcmp(argv[mark], "fs4") == 0) { - argc--; mark++; - ditherType = FS4_DITHER; - } else if (strcmp(argv[mark], "fs2") == 0) { - argc--; mark++; - ditherType = FS2_DITHER; - } else if (strcmp(argv[mark], "fs2fast") == 0) { - argc--; mark++; - ditherType = FS2FAST_DITHER; - } else if (strcmp(argv[mark], "hybrid2") == 0) { - argc--; mark++; - ditherType = HYBRID2_DITHER; - } else if (strcmp(argv[mark], "2x2") == 0) { - argc--; mark++; - ditherType = Twox2_DITHER; - } else if (strcmp(argv[mark], "gray") == 0) { - argc--; mark++; - ditherType = GRAY_DITHER; - } else if (strcmp(argv[mark], "color") == 0) { - argc--; mark++; - ditherType = FULL_COLOR_DITHER; - } - /* - else if (strcmp(argv[mark], "none") == 0) { - argc--; mark++; - ditherType = NO_DITHER; - } - */ - else if (strcmp(argv[mark], "ordered") == 0) { - argc--; mark++; - ditherType = ORDERED_DITHER; - } else if (strcmp(argv[mark], "ordered2") == 0) { - argc--; mark++; - ditherType = ORDERED2_DITHER; - } - /* - else if (strcmp(argv[mark], "mbordered") == 0) { - argc--; mark++; - ditherType = MBORDERED_DITHER; - } - */ - else if (strcmp(argv[mark], "mono") == 0) { - argc--; mark++; - ditherType = MONO_DITHER; - } else if (strcmp(argv[mark], "threshold") == 0) { - argc--; mark++; - ditherType = MONO_THRESHOLD; - } else { - perror("Illegal dither option."); - usage(argv[0]); - } - } - else if (strcmp(argv[mark], "-quiet") == 0) { - argc--; mark++; - quietFlag = 1; - } - else if (strcmp(argv[mark], "-l_range") == 0) { - argc--; mark++; - LUM_RANGE = atoi(argv[mark]); - if (LUM_RANGE < 1) { - fprintf(stderr, "Illegal luminance range value: %d\n", LUM_RANGE); - exit(1); - } - argc--; mark++; - } - else if (strcmp(argv[mark], "-cr_range") == 0) { - argc--; mark++; - CR_RANGE = atoi(argv[mark]); - if (CR_RANGE < 1) { - fprintf(stderr, "Illegal cr range value: %d\n", CR_RANGE); - exit(1); - } - argc--; mark++; - } - else if (strcmp(argv[mark], "-cb_range") == 0) { - argc--; mark++; - CB_RANGE = atoi(argv[mark]); - if (CB_RANGE < 1) { - fprintf(stderr, "Illegal cb range value: %d\n", CB_RANGE); - exit(1); - } - argc--; mark++; - } - else if (strcmp(argv[mark], "-help") == 0) { - usage(argv[0]); - } - else { - argc--; mark++; - } - /* - else if (argv[mark][0] == '-') { - fprintf(stderr, "Un-recognized flag %s\n",argv[mark]); - usage(argv[0]); - } - */ - /* the input video and audio files with options '-v', '-a' and '-p' are processed - at the end of 'ui.c' */ - } - if (ditherType == MBORDERED_DITHER) - { - fprintf(stderr, "Sorry, mbordered dithertype no longer supported.\n"); - exit(1); - } - // setsignal(SIGCHLD, clear_child); - // setsignal(SIGINT, int_handler); - // setsignal(SIGHUP, int_handler); - /* - setsignal(SIGKILL, int_handler); - setsignal(SIGSEGV, int_handler); - */ - // setsignal(SIGQUIT, int_handler); - // setsignal(SIGTERM, int_handler); - // setsignal(SIGALRM, SIG_IGN); - setsignal(SIGPIPE, SIG_IGN); - - - atexit (on_exit_routine); - - if (rmsemFlag) { - if (geteuid() == 0) { /* root, refuse to remove shm and sem ids */ - fprintf(stderr, "You are ROOT, -rmsem is ignored 'cause it's too dangerous.\n"); - } - else { - char *tmpf = tempnam("/tmp", ""); - if (tmpf != NULL) { - char buf[128]; - FILE *fp; - sprintf(buf, "ipcs >%s", tmpf); - system(buf); - if ((fp = fopen(tmpf, "r")) != NULL) { - while (fgets(buf, 128, fp) != NULL && (int)(strlen(buf)) > 10) { - int id; - sscanf(&buf[1], "%d", &id); - if (buf[0] == 'm') { - shmctl(id, IPC_RMID, NULL); - } - else if (buf[0] == 's') { - semctl(id, 0, IPC_RMID, 0); - } - } - fclose(fp); - unlink(tmpf); - } - free(tmpf); - } - } - } - - if (quietFlag) { - if ((freopen("/dev/null", "w", stdout) == NULL) || - (freopen("/dev/null", "w", stderr) == NULL)) { - exit(10); - } - } - - start_time = time(NULL); - - setsid(); /* break controlling terminal and creat a new session */ - - mainPid = getpid(); - - CTRmain(); - - return 0; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/include/common.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/include/common.h deleted file mode 100644 index f393c2d615b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/include/common.h +++ /dev/null @@ -1,580 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#if !defined (_MPEG_COMMON_H) -#define _MPEG_COMMON_H - -#include "ace/OS.h" - -extern int gethostname (char*, size_t); - -#define VERSION 200 /* version 2.00 */ - -#ifdef LITTLE_ENDIAN -#define NeedByteOrderConversion -#elif !defined(BIG_ENDIAN) -#if (defined(vax) || defined(i386) || defined(i486)) && !defined(NeedByteOrderConversion) -#define NeedByteOrderConversion -#endif -#endif - -/*following is defined so that debuging information is printed out for only - specific user (usually software developer), LOG_DIR is also defined */ - -/* -#define LOG_DIR "/home/shanweic/log/" -#define DEVELOPER_UID 8640 -*/ - -/* %% this is where the logging is done.." */ -#define LOG_DIR "./" -#define DEVELOPER_UID 1735 - -#define SFprintf if ((!getuid()) || getuid() == DEVELOPER_UID) fprintf -#define Fprintf if (shared->config.verbose) fprintf - -#define VCR_TCP_PORT 7101 -#define VCR_UNIX_PORT "/tmp/vcr_unix_port01" -#define VCR_ATM_PORT "3005" - -#define SPEEDUP_INV_SCALE 5 /* VS fast starts at 5/(5-1) normal speed */ - -#define AB_BUF_SIZE (64 * 1024) /* size of client AB buffer */ - -#if 0 -#define VB_BUF_SIZE (256 * 1024) /* Size of client VB buffer */ -#endif - -#define VB_BUF_SIZE (1024 * 1024) /* Size of client VB buffer */ - -#define VD_BUF_SIZE (1024 * 1024) /* Size of client VD buffer */ - -#define PATH_SIZE 256 -#define PATTERN_SIZE 100 -#define MAX_FRAMES 54000 /* half hour video at 30FPS */ -#define MAX_VDQUEUE_SIZE 20 -#define MAX_FB_PACKETS 20 /* max number of feedback packet info collected. */ -#define POSITION_RANGE 100 -#define MSGGAP_MIN -10 /* these are used for recording stat of - msgs received by VB */ -#define MSGGAP_MAX 50 - -#define INET_SOCKET_BUFFER_SIZE 1400 - -/* audio type constants */ - -#define AudioTypeMuLaw 0 -#define AudioTypeALaw 1 -#define AudioTypeRIFF 2 -#define AudioTypeLiner16 3 -#define AudioTypeLiner8 4 -#define AudioTypeLiner8Offset 5 - -/* Video and audio compression format */ - -#define VIDEO_MPEG1 0 -#define VIDEO_MPEG2 1 -#define VIDEO_JPEG 3 -#define VIDEO_SIF 4 - -#define AUDIO_RAW 10 -#define AUDIO_MPEG1 11 -#define AUDIO_MPEG2 12 - - -/* system configuration default values */ - -#define DEFAULT_maxFPS 60 -#define DEFAULT_maxSPS 16000 -#define DEFAULT_ffFPS 150 -#define DEFAULT_fbFPS 150 -#define DEFAULT_feedBackDelay 2000 -#define DEFAULT_audioMask 0x1 -#define DEFAULT_encodeType AudioTypeMuLaw -#define DEFAULT_channels 1 -#define DEFAULT_samplesPerSecond 8000 -#define DEFAULT_bytesPerSample 1 -#define DEFAULT_audioTimerDuration 500 -#define DEFAULT_audioBufferedIntervals 2 -#define DEFAULT_framesPerAudioPlay 4 -#define DEFAULT_audioForward 800 -#define DEFAULT_filterPara 50 -#define DEFAULT_maxSPframes 60 -#define DEFAULT_VStimeAdvance 100 - -#define DEFAULT_volume 0 - -/* audio parameter data structure */ - -typedef struct -{ - int encodeType; - int channels; - int samplesPerSecond; - int bytesPerSample; -} AudioParameter; - -/* client processes shared data structure definition */ - -typedef struct -{ - int VDframeNumber; - int VBbufId, VDbufId; - char * VBbufAddr, * VDbufAddr; - int pixelValid; - unsigned char pixel[256]; /* for transfering pixel value from VP to VD */ - - /* command and status */ - int cmd; - int cmdsn; - int cmdBusy; - - int loopBack; - - int framesPerSecond; /* Frames per second */ - int usecPerFrame; /* micro-seconds per frame, actual video speed */ - int samplesPerSecond; /* Samples per second */ - int usecPerSample; /* micro-seconds per sample, actual audio speed */ - - int volumePosition; - int balancePosition; - int speedPosition; - int locationPosition; - struct hostent audioHost; - char audioPath[PATH_SIZE]; - struct hostent videoHost; - char videoPath[PATH_SIZE]; - - int live; /* non-zero if any of the video/audio streams are live source */ - int videoFormat; - int audioFormat; - - /* video channel parameters */ - int totalFrames; - int totalGroups; - int totalHeaders; - int averageFrameSize; - double pictureRate; - int horizontalSize; - int verticalSize; - int pelAspectRatio; - int vbvBufferSize; - int firstGopFrames; - int patternSize; - char pattern[PATTERN_SIZE]; - int IframeGap; - int VStimeAdvance; - - int lastIframeDecoded; - int sendPatternGops; - char sendPattern[PATTERN_SIZE]; - float frameRateLimit; - int framesDropped; - int qosRecomputes; - - /* video channel status */ - int currentGroup; - int currentFrame; - int currentDisplay; - int nextFrame; - int nextGroup; - - /* audio channel parameters */ - int totalSamples; - AudioParameter audioPara; - - /* audio channel status */ - int nextSample; /* played by AP */ - - /* AudioFile device parameter */ - AudioParameter AFPara; - - int currentUPF; - int rtplay; /* realtime tag, -- VD needs to drop frames when needed */ - int collectStat; /* to indicate if statistics should be collected or not */ - int VBheadFrame; /* ID of last frame put to VBbuffer by VB */ - int needHeader; /* VD requests resending of systerm Header */ - int playRoundTripDelay; /* play round trip time (from issuing play/FF/FB - command to first Decoded frame showup in - VD buffer) estimated by CTR start_timer() */ - int audioMaxPktSize; /* 0 -- reliable byte stream, - >0 - non-discard mode packet stream, - <0 - discard mode packet stream */ - int videoMaxPktSize; - - /* System configuration parameters */ - struct - { - int rt; /* play as fast as possible without dropping frames, - and audio turned off when this tag is set to 0 (zero) - */ - int maxFPS; /* maximum PLAY frames-per-second, this play speed is used - during playback when speed scale is set to 100 */ - int maxSPS; /* similar to maxFPS, used when audio is played without - corresponding video - */ - int ffFPS; /* play speed when Fast forward */ - int fbFPS; /* play speed when fast rewind */ - int feedBackDelay; /* msec, delay of feedback when AB, VB received first - packet, 0 (zero) default to adaptive */ - int audioMask; /* mask for audio output device */ - AudioParameter audioPara; /* default audio parameter by system */ - int audioTimerDuration; /* for audio-only case, miliseconds */ - int audioBufferedIntervals; /* for audio-only case, - audioTimerDuration * audioBufferedIntervals - milliseconds of audio samples will be buffered - in AF buffer - */ - int framesPerAudioPlay; /* for audio-video case, each time, samples corresponding - to this number of video frames will be played */ - int audioForward; /* forward value for audio channel, in AFTime unit - (number of samples), audio channel is played ahead of video - by this number of samples. This is introduce to compensate - the dely to AF in audio channel, and usually should be less - than 1 (one) second, but greater than zero. - */ - int VStimeAdvance; /* target VB buffer level to be mentained (micro-seconds). This - is sent in INIT message to VS, to decide how many frames to - be maintained in VB buffer - */ - float frameRateLimit; /* playback frame rate limit (frames per second) */ - int collectStat; /* tag to collect statistics to file 'stat.n' when set */ - int collectFrameInfo; /* collect MPEG frame info to file 'stat.n' when set*/ - int syncEffective; /* tag to make sync mechanism effective when set */ - int qosEffective; /* tag to make QoS control effective when set */ - int audioOffset; /* offset added to audio channel 'nextSample' when play(). - usually audio and video are not recorded strictly - synchronized. This parameter is to compensate it. The - value can be any integer value. - */ - int filterPara; /* 1/R of Median, nsamples of Mean and Average */ - int maxSPframes; /* max number of frame in a sendPattern */ - int audioConn; /* tag for connection oriented audio data channel */ - int videoConn; /* tag for connection oriented video data channel */ - int verbose; - } config; - -#ifdef STAT - struct - { - unsigned VBmaxBytes; /* max fill level (bytes) in VB */ - unsigned VBdroppedFrames; /* accumulative total number of frames dropped by VB - because VB buffer full */ - unsigned VBemptyTimes; /* number of time VD fail to get a frame from VB - immediately */ - unsigned VDnoRef; /* # of frames without reference */ - unsigned VDagainstSendPattern; /* # of frames against send pattern */ - unsigned VDtooLateI; /* # of I frames dropped 'cause too late */ - unsigned VDtooLateP; /* # of P frames dropped 'cause too late */ - unsigned VDtooLateB; /* # of B frames dropped 'cause too late */ - unsigned VDlastFrameDecoded; /* ID of last frame decoded by VD */ - unsigned CTRdropLate; - unsigned CTRdropOutOrder; - unsigned CTRdispOnTime; - unsigned CTRdispLate; - unsigned fbPacketNumber; /* # packets sent by feedback mechanism */ - struct { - int frameId; - int addUsecPerFrame; - int addFrames; - int frames; - int framesDropped; - float frameRateLimit; - int advance; - } fbPackets[MAX_FB_PACKETS]; /* recording FB packet contents */ - unsigned VDqueue[MAX_VDQUEUE_SIZE]; /* record number of frames with VD queue - length of index number */ - int VBmsgGaps[MSGGAP_MAX + 1 - MSGGAP_MIN]; /* # of ind-sized gaps between msgs */ - char VBframesReceived[(MAX_FRAMES + 7)/8]; /* bit array for frames received by VB */ - char VDframesDecoded[(MAX_FRAMES + 7)/8]; /* bit array for frames decoded by VD */ - char VPframesDisplayed[(MAX_FRAMES + 7)/8]; /* bit array for frames displayed by VP */ - short VBfillLevel[MAX_FRAMES]; /* VB buffer fill level (frames) recorded by CTR */ - } stat; -#endif -} SharedData; - -/* command and reply: GUI-CTR, CTR-VS, CTR-AS */ - -/* GUI to CTR, (and also CTR to VS and/or AS) */ - -#define CmdINIT 0 /* followed by: videoHost, videoPath, audioHost, audioPath - each item is passed as a string (without 0), led with length(int) */ -#define CmdINITaudio 1 /* for CTR-AS */ -#define CmdINITvideo 2 /* for CTR-VS */ -#define CmdSTOP 3 -#define CmdFF 4 -#define CmdFB 5 -#define CmdSTEP 6 -#define CmdPLAY 7 -#define CmdREF 20 /* this is for sending REFerence frame by VS - for CmdSTEP and CmdPLAY */ -#define CmdPOSITION 8 /* followed by position */ -#define CmdPOSITIONrelease 9 /* followed by position */ -#define CmdVOLUME 10 /* followed by position */ -#define CmdBALANCE 11 /* followed by position */ -#define CmdSPEED 12 /* followed by position */ -#define CmdLOOPenable 13 -#define CmdLOOPdisable 14 -#define CmdSTATstream 23 /* reply with { | type(byte) | size(int) }+ | */ -#define CmdSTATsent 24 /* reply with { | byte }+ | */ -#define CmdCLOSE 18 -#define CmdFAIL 19 /* followed by a string */ - -#define CmdDONE 15 /* CTR to GUI: - replay for accptance and execution of Above Cmd */ - -#define CmdVPinitScreen 30 /* CTR to VP(GUI), audio-only screen clearning */ -#define CmdVPdisplayFrame 31 /* CTR to VP(GUI) to display the single frame in buffer */ -#define CmdVPclearScreen 32 /* CTR to VP(GUI), to clear all images in VD buffer */ -#define CmdVPaudioPosition 33 /* CTR to VP(GUI), in audio-only case, set position bar */ - -// to terminate the event loop -#define CmdExit 34 - -/* CTR-VS */ - -/* CmdINITvideo: followd by parameters of a fixed structure of 3 integers - reply with CmdINITvideo followed by reply or CmdFAIL followed by a string, -*/ -typedef struct -{ - int sn; - int version; - int nameLength; /* the length of the video file */ - /* this structure is followed by a zero-terminated file name as follows: - char videoFile[]; - */ -} INITvideoPara; - -typedef struct -{ - int live; - int format; - - int totalHeaders; - int totalFrames; - int totalGroups; - int horizontalSize; - int verticalSize; - int pelAspectRatio; - int pictureRate1000; - int vbvBufferSize; - int sizeIFrame; - int sizePFrame; - int sizeBFrame; - int sizeSystemHeader; - int sizeGop; - int averageFrameSize; - int firstGopFrames; - int patternSize; - char pattern[PATTERN_SIZE]; -} INITvideoReply; - -/* CmdPOSITION, CmdPOSITIONrelease: followed by following parameter */ -typedef struct -{ - int sn; - int nextGroup; -} POSITIONpara; - -/* CmdSTEP: followed by following parameter */ -typedef struct -{ - int sn; - int nextFrame; -} STEPpara; - -/* CmdFF, CmdFB: followed by following parameter */ -typedef struct -{ - int sn; - int nextGroup; - int usecPerFrame; - int framesPerSecond; - int VStimeAdvance; -} FFpara; - -/*CmdPLAY: followed by following parameter */ -typedef struct -{ - int sn; - int collectStat; - int nextFrame; - int usecPerFrame; - int framesPerSecond; - int frameRateLimit1000; - int VStimeAdvance; - int sendPatternGops; - char sendPattern[PATTERN_SIZE]; -} PLAYpara; - -/* CmdSPEED: parameter */ -typedef struct -{ - int sn; - int usecPerFrame; - int framesPerSecond; - int frameRateLimit1000; - int sendPatternGops; - char sendPattern[PATTERN_SIZE]; -} SPEEDpara; - -/* CmdLOOPenabe, CmdLOOPdisable, CmdSTOP: following by SN */ - - -/* video channel data packet structure */ - -typedef struct -{ - int cmd; - int cmdsn; - int sh; - int gop; - int frame; - int display; /* display frame number */ - int future; - int past; - int currentUPF; - int dataBytes; -} VideoPacket; - - -/* video channel data message structure */ - -typedef struct -{ - int packetsn; - int packetSize; - int msgsn; - int msgOffset; - int msgSize; -} VideoMessage; - - -/* Feedback parameter structure */ - -typedef struct -{ - int cmdsn; - int needHeader; - int addUsecPerFrame; - int addFrames; - int frameRateLimit1000; - int sendPatternGops; - int sendPattern[PATTERN_SIZE]; -} VideoFeedBackPara; - - - -/* audio channel commands and parameters */ - -/* CmdINITaudio parameter of fixed structure of 3 integers and a AudioPara, - replys with CmdINITaudio followed by reply or CmdFAIL followed by a string */ -typedef struct -{ - int sn; - int version; - AudioParameter para; - int nameLength; - /* char audioFile[] */ -} INITaudioPara; - -typedef struct -{ - int live; - int format; - - AudioParameter para; - int totalSamples; -} INITaudioReply; - - -/* CmdPLAY parameter */ -typedef struct -{ - int sn; - int nextSample; -#if 0 - int samplesPerSecond; /* <= shared->audioPara.samplesPerSecond */ -#endif - int samplesPerSecond; /* audio playback speed */ - int samplesPerPacket; /* Number of samples in a packet */ - int ABsamples; /* size of client VB buffer in samples */ - int spslimit; /* QoS parameter: sps supported by the audio channel */ -} PLAYaudioPara; - -/* STOP followed only by SN */ - -/* CmdSPEED parameter */ -typedef struct -{ - int sn; - int samplesPerSecond; - int samplesPerPacket; /* Number of samples in a packet */ - int spslimit; -} SPEEDaudioPara; - -/* audio packet structure */ -typedef struct -{ - int cmdsn; - int resend; - int samplesPerSecond; - int firstSample; - int samples; - int actualSamples; - int dataBytes; -} AudioPacket; - -typedef struct -{ - int firstSample; /* Id of the first sample in this packet */ - int samples; /* number of samples in current packet */ -} APdescriptor; /* audio packet decriptor */ - -/* audio feedback packet */ -typedef struct -{ - int cmdsn; - int type; /* 0 - feedback command; >=1 - Number of packets to be resent */ - union { - struct { - int addsps; - int addSamples; - } fb; - APdescriptor ap; - } data; -} AudioFeedBackPara; -/* One actual resent request may have multiple APdescriptors depending on - the value in element type, all execpt the first one follows above structure*/ - -typedef struct { - int sh, gop, frame, display, future, past; - int refcount; /* reference count */ - unsigned char * data; /* data buffer for image */ -} FrameBlock; - - -#endif /* _MPEG_COMMON_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp deleted file mode 100644 index 40fa6f6ca4e..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/24bit.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include <stdlib.h> -#include <string.h> -#include "video.h" -#include "dither.h" -#include "proto.h" - -/* - * We'll define the "ConvertColor" macro here to do fixed point arithmetic - * that'll convert from YCrCb to RGB using: - * R = L + 1.40200*Cr; - * G = L - 0.34414*Cb - 0.71414*Cr - * B = L + 1.77200*Cb; - * - * We'll use fixed point by adding two extra bits after the decimal. - */ - -#define BITS 8 -#define ONE ((int) 1) -#define CONST_SCALE (ONE << BITS) -#define ROUND_FACTOR (ONE << (BITS-1)) - -/* Macro to convert integer to fixed. */ -#define UP(x) (((int)(x)) << BITS) - -/* Macro to convert fixed to integer (with rounding). */ -#define DOWN(x) (((x) + ROUND_FACTOR) >> BITS) - -/* Macro to convert a float to a fixed */ -#define FIX(x) ((int) ((x)*CONST_SCALE + 0.5)) - -#define CLAMP(ll,x,ul) ( ((x)<(ll)) ?(ll):( ((x)>(ul)) ?(ul):(x))) - -static int *Cb_r_tab, *Cr_g_tab, *Cb_g_tab, *Cr_b_tab; - -/* - *-------------------------------------------------------------- - * - * InitColorDither -- - * - * To get rid of the multiply and other conversions in color - * dither, we use a lookup table. - * - * Results: - * None. - * - * Side effects: - * The lookup tables are initialized. - * - *-------------------------------------------------------------- - */ - -void -InitColorDither() -{ - int CR, CB, i; - - Cr_b_tab = (int *)malloc(256*sizeof(int)); - Cr_g_tab = (int *)malloc(256*sizeof(int)); - Cb_g_tab = (int *)malloc(256*sizeof(int)); - Cb_r_tab = (int *)malloc(256*sizeof(int)); - - for (i=0; i<256; i++) { - CB = CR = i; - - CB -= 128; CR -= 128; - - Cb_r_tab[i] = FIX(1.40200) * CB; - Cr_g_tab[i] = -FIX(0.34414) * CR; - Cb_g_tab[i] = -FIX(0.71414) * CB; - Cr_b_tab[i] = FIX(1.77200) * CR; - } -} - - -/* - *-------------------------------------------------------------- - * - * ColorDitherImage -- - * - * Converts image into 24 bit color. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -ColorDitherImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols) -{ - int L, CR, CB; - unsigned int *row1, *row2; - unsigned char *lum2; - int x, y; - unsigned int r, b, g; - int cb_r; - int cr_g; - int cb_g; - int cr_b; - - row1 = (unsigned int *)out; - row2 = row1 + cols; - lum2 = lum + cols; - for (y=0; y<rows; y+=2) { - for (x=0; x<cols; x+=2) { - int R, G, B; - - CR = *cr++; - CB = *cb++; - cb_r = Cb_r_tab[CB]; - cr_g = Cr_g_tab[CR]; - cb_g = Cb_g_tab[CB]; - cr_b = Cr_b_tab[CR]; - - L = *lum++; - L = UP(L); - R = L + cb_r; - G = L + cr_g + cb_g; - B = L + cr_b; -#ifndef LITTLE_ENDIAN - r = CLAMP(0,R,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS; -#else - b = CLAMP(0,B,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS; -#endif - *row1++ = r | g | b; - - L = *lum++; - L = UP(L); - R = L + cb_r; - G = L + cr_g + cb_g; - B = L + cr_b; -#ifndef LITTLE_ENDIAN - r = CLAMP(0,R,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS; -#else - b = CLAMP(0,B,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS; -#endif - *row1++ = r | g | b; - - /* - * Now, do second row. - */ - L = *lum2++; - L = UP(L); - R = L + cb_r; - G = L + cr_g + cb_g; - B = L + cr_b; -#ifndef LITTLE_ENDIAN - r = CLAMP(0,R,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS; -#else - b = CLAMP(0,B,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS; -#endif - *row2++ = r | g | b; - - L = *lum2++; - L = UP(L); - R = L + cb_r; - G = L + cr_g + cb_g; - B = L + cr_b; -#ifndef LITTLE_ENDIAN - r = CLAMP(0,R,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - b = (CLAMP(0,B,UP(255)) & 0xff00) << BITS; -#else - b = CLAMP(0,B,UP(255)) >> BITS; - g = CLAMP(0,G,UP(255)) & 0xff00; - r = (CLAMP(0,R,UP(255)) & 0xff00) << BITS; -#endif - *row2++ = r | g | b; - } - lum += cols; - lum2 += cols; - row1 += cols; - row2 += cols; - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp deleted file mode 100644 index ba59df34e12..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/2x2.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include <string.h> -#include <stdlib.h> -#include "video.h" -#include "dither.h" -#include "proto.h" - -#define RAND_ERR_RANGE 7 -#define RAND_ERR_SUBVAL 3 - -/* Array containing actual pixel values for each possible 2x2 dither pattern. */ - -static unsigned char *dith_a; - -/* Arrays mapping lum, cr, and cb values to portions of dither pattern code. - The addtion of one value from each array yields a valid dither pattern - code. -*/ - -static int lval_a[256+RAND_ERR_RANGE-1]; -static int rval_a[256+RAND_ERR_RANGE-1]; -static int bval_a[256+RAND_ERR_RANGE-1]; - -/* Range of possible dither patterns in each channel. */ - -#define L_DITH_RANGE (((LUM_RANGE-1)*4)+1) -#define CR_DITH_RANGE (((CR_RANGE-1)*4)+1) -#define CB_DITH_RANGE (((CB_RANGE-1)*4)+1) - -/* Arrays of random error terms added to break up contours. */ - -static int *randval_a; -static int **randptr_a; - - -/* - *-------------------------------------------------------------- - * - * Init2x2Dither-- - * - * Initializes structures used for 2x2 dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -Init2x2Dither() -{ - unsigned char *dith_ca; - int numcodes; - int l_range, cr_range, cb_range; - int p1, p2, p3, p4; - int l_dith, cr_dith, cb_dith; - int big_part, small_part; - int i, j; - - l_range = L_DITH_RANGE; - cr_range = CR_DITH_RANGE; - cb_range = CB_DITH_RANGE; - - numcodes = l_range * cr_range * cb_range; - - dith_a = (unsigned char *) malloc(numcodes*4); - - dith_ca = dith_a; - - for (i=0; i<numcodes; i++) { - l_dith = i % l_range; - - big_part = l_dith / 4; - small_part = l_dith % 4; - - p1 = big_part + ((small_part > 0) ? 1 : 0); - p2 = big_part + ((small_part > 2) ? 1 : 0); - p3 = big_part; - p4 = big_part + ((small_part > 1) ? 1 : 0); - - p1 *= CR_RANGE * CB_RANGE; - p2 *= CR_RANGE * CB_RANGE; - p3 *= CR_RANGE * CB_RANGE; - p4 *= CR_RANGE * CB_RANGE; - - cr_dith = (i/l_range) % cr_range; - - big_part = cr_dith / 4; - small_part = cr_dith % 4; - - p1 += (big_part + ((small_part > 0) ? 1 : 0))*CB_RANGE; - p2 += (big_part + ((small_part > 2) ? 1 : 0))*CB_RANGE; - p3 += (big_part)*CB_RANGE; - p4 += (big_part + ((small_part > 1) ? 1 : 0))*CB_RANGE; - - cb_dith = (i/(cr_range*l_range)) % cb_range; - - big_part = cb_dith / 4; - small_part = cb_dith % 4; - - p1 += (big_part + ((small_part > 0) ? 1 : 0)); - p2 += (big_part + ((small_part > 2) ? 1 : 0)); - p3 += (big_part); - p4 += (big_part + ((small_part > 1) ? 1 : 0)); - - *dith_ca++ = p1; - *dith_ca++ = p2; - *dith_ca++ = p3; - *dith_ca++ = p4; - } - - for (i=RAND_ERR_SUBVAL; i<256+RAND_ERR_SUBVAL; i++) { - j = i-RAND_ERR_SUBVAL; - lval_a[i] = (j * L_DITH_RANGE)/256; - rval_a[i] = (j * CR_DITH_RANGE)/256; - bval_a[i] = (j * CB_DITH_RANGE)/256; - - bval_a[i] *= CR_DITH_RANGE * L_DITH_RANGE * 4; - rval_a[i] *= L_DITH_RANGE * 4; - lval_a[i] *= 4; - } - - for (i=0; i<RAND_ERR_SUBVAL; i++) { - lval_a[i] = lval_a[RAND_ERR_SUBVAL]; - rval_a[i] = rval_a[RAND_ERR_SUBVAL]; - bval_a[i] = bval_a[RAND_ERR_SUBVAL]; - } - - for(i=256+RAND_ERR_SUBVAL; i<256+RAND_ERR_RANGE-1; i++) { - lval_a[i] = lval_a[255+RAND_ERR_SUBVAL]; - rval_a[i] = rval_a[255+RAND_ERR_SUBVAL]; - bval_a[i] = bval_a[255+RAND_ERR_SUBVAL]; - } -} - - -/* - *-------------------------------------------------------------- - * - * RandInit -- - * - * Initializes the random values used for 2x2 dithering. - * - * Results: - * randval_a filled with random values. - * randptr_a filled with random pointers to random value arrays. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void RandInit(int h, int w) -{ - int i; - - randval_a = (int *) malloc(w*5*sizeof(int)); - randptr_a = (int **) malloc(h*sizeof(int *)); - -#ifdef NO_LRAND48 - for (i=0; i<w*5; i++) { - long int random(); - - randval_a[i] = random() % RAND_ERR_RANGE; - } - - for (i=0; i<h; i++) { - long int random(); - - randptr_a[i] = randval_a + (random() % (w*2)); - } -#else /* NO_LRAND48 */ - - for (i=0; i<w*5; i++) { - - randval_a[i] = lrand48() % RAND_ERR_RANGE; - } - - for (i=0; i<h; i++) { - - randptr_a[i] = randval_a + (lrand48() % (w*2)); - } -#endif - -} - - -/* - *-------------------------------------------------------------- - * - * PostInit2x2Dither-- - * - * Remaps color numbers in dither patterns to actual pixel - * values allocated by the X server. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -PostInit2x2Dither() -{ - unsigned char *dith_ca; - int i; - - dith_ca = dith_a; - - for (i=0; i < (L_DITH_RANGE * CR_DITH_RANGE * CB_DITH_RANGE); i++) { - - *dith_ca = pixel[*dith_ca]; - dith_ca++; - *dith_ca = pixel[*dith_ca]; - dith_ca++; - *dith_ca = pixel[*dith_ca]; - dith_ca++; - *dith_ca = pixel[*dith_ca]; - dith_ca++; - } -} - - -/* - *-------------------------------------------------------------- - * - * Twox2DitherImage -- - * - * Dithers lum, cr, and cb channels togethor using predefined - * and computed 2x2 dither patterns. Each possible combination of - * lum, cr, and cb values combines to point to a particular dither - * pattern (2x2) which is used to represent the pixel. This assumes - * That the display plane is 4 times larger than the lumianance - * plane. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -Twox2DitherImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - int i, j; - unsigned short *o1, *o2, *o3, *o4; - unsigned char *l1, *l2, *base; - unsigned char B, R; - unsigned short *dith_ca; - int big_adv = 3*w; - int b_val, r_val, l_val; - int *randvalptr; - int randval; - static int first = 1; - - if (first) { - RandInit(h, w); - first = 0; - } - - o1 = (unsigned short *)out; - o2 = (unsigned short *)(out+(2*w)); - o3 = (unsigned short *)(out+(4*w)); - o4 = (unsigned short *)(out+(6*w)); - l1 = lum; - l2 = lum+w; - - for (i=0; i<h; i+=2) { - for(j=0; j<w; j+= 4) { - - B = cb[0]; - b_val = bval_a[B]; - R = cr[0]; - r_val = rval_a[R]; - base = dith_a + b_val + r_val; - - l_val = lval_a[l1[0]]; - dith_ca = (unsigned short *)(base + l_val); - o1[0] = dith_ca[0]; - o2[0] = dith_ca[1]; - - l_val = lval_a[l1[1]]; - dith_ca = (unsigned short *)(base + l_val); - o1[1] = dith_ca[0]; - o2[1] = dith_ca[1]; - - l_val = lval_a[l2[0]]; - dith_ca = (unsigned short *)(base + l_val); - o3[0] = dith_ca[0]; - o4[0] = dith_ca[1]; - - l_val = lval_a[l2[1]]; - dith_ca = (unsigned short *)(base + l_val); - o3[1] = dith_ca[0]; - o4[1] = dith_ca[1]; - - B = cb[1]; - b_val = bval_a[B]; - R = cr[1]; - r_val = rval_a[R]; - base = dith_a + b_val + r_val; - - l_val = lval_a[l1[2]]; - dith_ca = (unsigned short *)(base + l_val); - o1[2] = dith_ca[0]; - o2[2] = dith_ca[1]; - - l_val = lval_a[l1[3]]; - dith_ca = (unsigned short *)(base + l_val); - o1[3] = dith_ca[0]; - o2[3] = dith_ca[1]; - - l_val = lval_a[l2[2]]; - dith_ca = (unsigned short *)(base + l_val); - o3[2] = dith_ca[0]; - o4[2] = dith_ca[1]; - - l_val = lval_a[l2[3]]; - dith_ca = (unsigned short *)(base + l_val); - o3[3] = dith_ca[0]; - o4[3] = dith_ca[1]; - - o1 += 4; - o2 += 4; - o3 += 4; - o4 += 4; - l1 += 4; - l2 += 4; - cb += 2; - cr += 2; - } - - l1 += w; - l2 += w; - o1 += big_adv; - o2 += big_adv; - o3 += big_adv; - o4 += big_adv; - } -} 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 deleted file mode 100644 index a66e8a76c03..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.cpp +++ /dev/null @@ -1,1516 +0,0 @@ -// $Id$ - -#include "Command_Handler.h" - -// %% yikes!!! -#include "ctr.cpp" - -const char *TAO_AV_ORB_ARGUMENTS = "-ORBobjrefstyle URL"; - -Command_Handler::Command_Handler (ACE_HANDLE command_handle) - : command_handle_ (command_handle), - orb_manager_ (0) -{ -} - -Command_Handler::~Command_Handler (void) -{ - ACE_Reactor::instance ()->remove_handler (this, - ACE_Event_Handler::READ_MASK); -} - -int -Command_Handler::init (void) -{ - ACE_ARGV orb_args (TAO_AV_ORB_ARGUMENTS); - int argc = orb_args.argc (); - - ACE_NEW_RETURN (this->orb_manager_, - TAO_ORB_Manager, - -1); - - TAO_TRY - { - this->orb_manager_->init (argc, - orb_args.argv (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("Command_Handler::init"); - return -1; - } - TAO_ENDTRY; - return 0; -} - -int -Command_Handler::resolve_server_reference (void) -{ - TAO_TRY - { - CORBA::Object_var naming_obj = - this->orb_manager_->orb ()->resolve_initial_references ("NameService"); - if (CORBA::is_nil (naming_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to resolve the Name Service.\n"), - -1); - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - - CosNaming::Name Video_Control_name (1); - - Video_Control_name.length (1); - Video_Control_name [0].id = CORBA::string_dup ("Video_Control"); - CORBA::Object_var Video_Control_obj = - naming_context->resolve (Video_Control_name, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->video_control_ = - Video_Control::_narrow (Video_Control_obj.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (CORBA::is_nil (this->video_control_.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " could not resolve Video_Control in Naming service <%s>\n"), - -1); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("Command_Handler::resolve_server_reference"); - return -1; - } - TAO_ENDTRY; - - return 0; -} - - -ACE_HANDLE -Command_Handler::get_handle (void) const -{ - return this->command_handle_; -} - - -// handle the command sent to us by the GUI process -// this is a reactor callback method -int -Command_Handler::handle_input (ACE_HANDLE fd) -{ - - unsigned char cmd; - int val; - val = OurCmdRead ((char*)&cmd, 1); - ::TimerProcessing (); - - // 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; - - // fprintf(stderr, "CTR: cmd received - %d\n", cmd); - TAO_TRY - { - switch (cmd) - { - case CmdINIT: - this->init_video (); - // 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 :-) - this->play (fp != NULL, - TAO_TRY_ENV); - 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; - return 0; -} - -CORBA::Boolean -Command_Handler::init_video (void) -{ - - // :: init (); - // return 0; - - int i, j; - - /* try to stop and close previous playing */ - if (audioSocket >= 0 || videoSocket >= 0) - { - unsigned char tmp = CmdCLOSE; - int result = - this->stop_playing(); - if (result < 0) - return result; - - if (audioSocket >= 0) - { - if (ABpid > 0) { - kill(ABpid, SIGUSR1); - ABpid = -1; - } - usleep(10000); - AudioWrite(&tmp, 1); - ComCloseConn(audioSocket); - audioSocket = -1; - } - - if (videoSocket >= 0) - { - if (VBpid > 0) { - kill(VBpid, SIGUSR1); - VBpid = -1; - } - usleep(10000); - this->close (); - ComCloseConn(videoSocket); - videoSocket = -1; - while ((!VBbufEmpty()) || !VDbufEmpty()) { - while (VDpeekMsg() != NULL) { - VDreclaimMsg(VDgetMsg()); - } - usleep(10000); - } - usleep(10000); - } - } - - /* read in video/audio files */ - NewCmd(CmdINIT); - CmdRead((char*)&i, 4); - CmdRead(vh, i); - vh[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(vf, i); - vf[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(ah, i); - ah[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(af, i); - af[i] = 0; - /* - fprintf(stderr, "INIT: vh-%s, vf-%s, ah-%s, af-%s\n", vh, vf, ah, af); - */ - - shared->live = 0; - shared->audioMaxPktSize = !shared->config.audioConn; - shared->videoMaxPktSize = !shared->config.videoConn; - - if (af[0] != 0) - { - if (InitAudioChannel(ah, af)) - { - audioSocket = -1; - shared->totalSamples = 0; - } - else - { - ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initialized audio\n")); - shared->nextSample = 0; - if (shared->config.maxSPS < shared->audioPara.samplesPerSecond) - shared->config.maxSPS < shared->audioPara.samplesPerSecond; - } - } - else - { - shared->totalSamples = 0; - audioSocket = -1; - } - if (vf[0] != 0) - { - ACE_DEBUG ((LM_DEBUG,"(%P|%t) Initializing video\n")); - if (this->init_video_channel(vh, vf)) - { - shared->totalFrames = 0; /* disable video channel */ - videoSocket = -1; - } - else - { - ACE_DEBUG ((LM_DEBUG, - "%s %d\n", - __FILE__,__LINE__)); - shared->nextFrame = 1; - shared->nextGroup = 0; - shared->currentFrame = shared->currentGroup = shared->currentDisplay = 0; - if (shared->config.maxFPS < shared->framesPerSecond) - shared->config.maxFPS = shared->framesPerSecond; - } - } - else - { - videoSocket = -1; - shared->totalFrames = 0; /* disable video channel */ - } - if (audioSocket < 0 && videoSocket < 0) /* none of video/audio channels is setup */ - { - unsigned char tmp = CmdFAIL; - CmdWrite(&tmp, 1); - /* - fprintf(stderr, "CTR initialization failed.\n"); - */ - return 0; - } - else - { - unsigned char tmp = CmdDONE; - set_speed(); - if (videoSocket >= 0) - wait_display(); - CmdWrite(&tmp, 1); - if (videoSocket < 0) - { - tmp = CmdVPclearScreen; - CmdWrite(&tmp, 1); - } - return 0; - } - return 0; -} - -int -Command_Handler::init_video_channel (char *phostname, char *videofile) -{ - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - 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 */ - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - Video_Control::INITvideoPara_var para (new - Video_Control::INITvideoPara); - Video_Control::INITvideoReply *reply_ptr = 0; - Video_Control::INITvideoReply_out reply (reply_ptr); - - 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, - 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); - - 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; - } - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - - /* 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); - } - - switch (VBpid = fork()) - { - case -1: - perror("CTR error on forking VB process"); - exit(1); - break; - case 0: - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - if (realTimeFlag) { - SetRTpriority("VB", -1); - } - free(vh); - free(videofile); - free(ah); - free(af); - ::close(sp[0]); - // ::close (videoSocket); - if (audioSocket >= 0) - ComCloseFd(audioSocket); - ABdeleteBuf(); - VDdeleteBuf(); - if (cmdSocket >= 0) - ::close(cmdSocket); - if (realTimeFlag >= 2) { -#ifdef __svr4__ - if (SetRTpriority("VB", 0)) realTimeFlag = 0; -#elif defined(_HPUX_SOURCE) - if (SetRTpriority("VB", 1)) realTimeFlag = 0; -#endif - } - VBprocess(sp[1], dataSocket); - break; - default: - ::close(sp[1]); - // ::close(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) { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - cerr << "expecting a packet of size " << sizeof (*msg) - << endl; - VideoRead(buf, sizeof(*msg)); - //~~ we need to read the first frame from the - // data socket instead of control socket. - // SocketRecv(dataSocket, buf, size); - pkts = ntohl(msg->packetSize); - msgo = ntohl(msg->msgOffset); - msgs = ntohl(msg->msgSize); - if (shared->videoMaxPktSize >= 0) { /* non-discard mode */ - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Reached line %d in %s\n", __LINE__, __FILE__)); - 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 { - cerr << "expecting a packet of size " << msgs - << endl; - 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; - } - } - } - return 0; -} - -CORBA::Boolean -Command_Handler::stat_stream (CORBA::Char_out ch, - CORBA::Long_out size) -{ - return 0; -} - - -CORBA::Boolean -Command_Handler::close (void) -{ - if (this->video_control_.in () == 0) - return CORBA::B_TRUE; - TAO_TRY - { - CORBA::Boolean result; - result = this->video_control_->close (TAO_TRY_ENV); - TAO_CHECK_ENV; - if (result == (CORBA::B_FALSE)) - return CORBA::B_FALSE; - ACE_DEBUG ((LM_DEBUG,"(%P|%t) close done \n")); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->close (..)"); - return CORBA::B_FALSE; - } - TAO_ENDTRY; - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Command_Handler::stat_sent (void) -{ - return 0; -} - - -CORBA::Boolean -Command_Handler::fast_forward (void) - -{ - // ::ff (); - // CORBA call - unsigned char tmp; - Video_Control::FFpara_var para (new Video_Control::FFpara); - /* - fprintf(stderr, "CTR: FF . . .\n"); - */ - if (shared->live) { - beep(); - } - else { - this->stop_playing (); - if (shared->nextGroup < 0) - shared->nextGroup = 0; - if (videoSocket >= 0 && shared->nextGroup < shared->totalGroups) - { - NewCmd(CmdFF); - shared->needHeader = 0; - shared->framesPerSecond = shared->config.ffFPS / - shared->patternSize; - shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.ffFPS) * - shared->patternSize; - - shared->VStimeAdvance = - max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para->VStimeAdvance = shared->VStimeAdvance; - para->sn = shared->cmdsn; - para->nextGroup = shared->nextGroup; - para->usecPerFrame = shared->usecPerFrame; - para->framesPerSecond = shared->framesPerSecond; - startTime = get_usec(); - TAO_TRY - { - CORBA::Boolean result; - result = this->video_control_->fast_forward (para.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - if (result == (CORBA::B_FALSE)) - return CORBA::B_FALSE; - ACE_DEBUG ((LM_DEBUG,"(%P|%t) fast_forward done \n")); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)"); - return CORBA::B_FALSE; - } - TAO_ENDTRY; - start_timer(); - } - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Command_Handler::fast_backward (void) - -{ - // ::fb (); - // return 0; - unsigned char tmp; - Video_Control::FBpara_var para (new Video_Control::FBpara); - /* - fprintf(stderr, "CTR: FB . . .\n"); - */ - if (shared->live) { - beep(); - } - else { - this->stop_playing(); - if (shared->nextGroup >= shared->totalGroups) - shared->nextGroup = shared->totalGroups - 1; - if (videoSocket >= 0 && shared->nextGroup >= 0) - { - NewCmd(CmdFB); - shared->needHeader = 0; - shared->framesPerSecond = shared->config.fbFPS / - shared->patternSize; - shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.fbFPS) * - shared->patternSize; - - shared->VStimeAdvance = - max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para->VStimeAdvance = shared->VStimeAdvance; - para->sn = shared->cmdsn; - para->nextGroup = shared->nextGroup; - para->usecPerFrame = shared->usecPerFrame; - para->framesPerSecond = shared->framesPerSecond; - startTime = get_usec(); - TAO_TRY - { - CORBA::Boolean result; - result = this->video_control_->fast_backward (para.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - if (result == (CORBA::B_FALSE)) - return CORBA::B_FALSE; - ACE_DEBUG ((LM_DEBUG,"(%P|%t) fast_backward done \n")); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)"); - return CORBA::B_FALSE; - } - TAO_ENDTRY; - - start_timer(); - } - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Command_Handler::step (void) - -{ - // ::step (); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Command_Handler::step ()\n")); - Video_Control::STEPpara_var para (new Video_Control::STEPpara); - this->stop_playing (); - NewCmd (CmdSTEP); - if (videoSocket >= 0 && shared->nextFrame <= shared->totalFrames) - { /* when shared->nextFrame == shared->totalFrame, it will force VS to send a ENDSEQ, - to let VD give out the remaining frame in its ring[] buffer */ - para->sn = shared->cmdsn; - para->nextFrame = shared->nextFrame; - TAO_TRY - { - CORBA::Boolean result; - result = this->video_control_->step (para.in (), - TAO_TRY_ENV); - ACE_DEBUG ((LM_DEBUG,"(%P|%t) step done \n")); - TAO_CHECK_ENV; - if (result == (CORBA::B_FALSE)) - return CORBA::B_FALSE; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->step (..)"); - return CORBA::B_FALSE; - } - TAO_ENDTRY; - /* - fprintf(stderr, "CTR: STEP . . . frame-%d\n", para.nextFrame); - */ - ::wait_display (); - } - unsigned char tmp = CmdDONE; - CmdWrite(&tmp, 1); - return CORBA::B_TRUE; -} - -CORBA::Boolean -Command_Handler::play (int auto_exp, - CORBA::Environment& env) -{ - /* - ::play (auto_exp); - return 0; - */ - - CORBA::Long vts; - unsigned char tmp; - unsigned int ats; - int cmdstarted = 0; - int stuffsamples = 0; - /* - fprintf (stderr, "CTR: PLAY . . .\n"); - */ - this->stop_playing (); - - if (!shared->live && !shared->config.rt && videoSocket >= 0) { - /* rtplay turned off only when video avaible and not want RT play */ - rtplay = 0; - fprintf (stderr, "VCR is not playing at in realtime mode, audio disabled\n"); - } - else { - rtplay = 1; - } - - if (shared->live) { - rtplay = 1; - shared->nextFrame = 0; - shared->nextSample = 0; - } - - shared->rtplay = rtplay; - - if (shared->nextFrame < 0) - shared->nextFrame = 0; - else if (shared->nextFrame >= shared->totalFrames) - shared->nextFrame = shared->totalFrames - 1; - - if (audioSocket >= 0 && shared->nextSample < shared->totalSamples && rtplay) - { - PLAYaudioPara para; - if (cmdstarted == 0) - { - NewCmd (CmdPLAY); - if (!auto_exp) set_speed (); - cmdstarted = 1; - } - - if (videoSocket >= 0 && rtplay && !shared->live) { - /* video channel also active, recompute nextSample */ - shared->nextSample = (int) ( (double)shared->audioPara.samplesPerSecond * - ( (double)shared->nextFrame / shared->pictureRate)); - shared->nextSample += shared->config.audioOffset; - if (shared->nextSample < 0) { - stuffsamples = (- shared->nextSample); - shared->nextSample = 0; - } - else if (shared->nextSample >= shared->totalSamples) - shared->nextSample = shared->totalSamples - 1; - } - - ABflushBuf (shared->nextSample); - - para.sn = htonl (shared->cmdsn); - para.nextSample = htonl (shared->nextSample); - para.samplesPerSecond = htonl (shared->samplesPerSecond); - para.samplesPerPacket = htonl (1024 / shared->audioPara.bytesPerSample); - para.ABsamples = htonl (AB_BUF_SIZE / shared->audioPara.bytesPerSample); - para.spslimit = htonl (32000); - - startTime = get_usec (); - tmp = CmdPLAY; - AudioWrite (&tmp, 1); - AudioWrite (¶, sizeof (para)); - read_int (audioSocket, (int *)&ats); - } - - if (videoSocket >= 0 && shared->nextFrame < shared->totalFrames) - { - Video_Control::PLAYpara_var para (new Video_Control::PLAYpara); - - if (cmdstarted == 0) - { - NewCmd (CmdPLAY); - if (!auto_exp) set_speed (); - cmdstarted = 1; - } - shared->VBheadFrame = -1; - shared->needHeader = 0; - { - int i = shared->config.maxSPframes; - i = (int) ( (double)i * (1000000.0 / (double)shared->usecPerFrame) / - shared->pictureRate); - shared->sendPatternGops = max (min (i, PATTERN_SIZE) / shared->patternSize, 1); - } - cmdstarted = 1; -#ifdef STAT - shared->collectStat = (shared->config.collectStat && (!shared->live)); - if (shared->collectStat) - { - int i; - memset (& (shared->stat), 0, sizeof (shared->stat)); - shared->stat.VDlastFrameDecoded = (unsigned)-1; - for (i = 0; i < MAX_FRAMES; i++) - shared->stat.VBfillLevel[i] = SHRT_MIN; - speedPtr = 0; - } -#endif - shared->VStimeAdvance = - max (shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para->VStimeAdvance = shared->VStimeAdvance; - para->sn = shared->cmdsn; - para->nextFrame = shared->nextFrame; - para->usecPerFrame = shared->usecPerFrame; - para->framesPerSecond = shared->framesPerSecond; - para->collectStat = shared->collectStat; - frate = shared->config.frameRateLimit; - if (frate <= 0.0) { - frate = 1.0; - } - shared->frameRateLimit = frate; - para->frameRateLimit1000 = - (long) (shared->frameRateLimit * 1000.0); - compute_sendPattern (); - para->sendPatternGops = shared->sendPatternGops; - // memcpy (para->sendPattern, shared->sendPattern, PATTERN_SIZE); - - // Sequence of chars - - para->sendPattern.length (PATTERN_SIZE); - - for (int i=0; i<PATTERN_SIZE ; i++) - para->sendPattern [i] = shared->sendPattern [i]; - - startTime = get_usec (); - /* - tmp = CmdPLAY; - VideoWrite (&tmp, 1); - VideoWrite (¶, sizeof (para)); - read_int (videoSocket, (int *)&vts); - */ - // CORBA call - this->video_control_->play (para, - vts, - env); - - if (shared->config.qosEffective) { - /* - fprintf (stderr, "CTR start FeedBack with init frameRateLimit %lf\n", - frate); - */ - maxfr = frate; /* max frame rate all the time during one playback */ - minupf = (int) (1000000.0 / maxfr); /* min usec-per-frame all the time - during one playback */ - maxrate = (double)minupf / (double)max (shared->usecPerFrame, minupf); - /* this is current max frame rate in percentage against 'maxfr', - current max frame rate is the lower of 'maxfr' and play speed */ - frate = 1.0; /* current sending frame rate, in percentage against 'maxfr' - This value is set with init value as 1.0, so that if current - speed is lower than frameRateLimit, no frames are dropped, - then when play speed increases frame rate will increase - accordingly until frames are dropped*/ - adjstep = ( (double)minupf / (double)shared->usecPerFrame) / - (double)max (shared->patternSize * shared->sendPatternGops, 5); - /* adjust step for current play speed, in percentage against - 'maxfr' */ - - fbstate = 1; - fb_startup = 1; - - /* - fprintf (stderr, "CTR init frate: %lf minupf %d, shared->upf %d\n", - frate, minupf, shared->usecPerFrame); - */ - } - } - - if (shared->live && (videoSocket >= 0) && (audioSocket >= 0)) { - int gap = get_duration (ats, vts); - if (gap < 0 || gap >= 5000000) { - Fprintf (stderr, "Error for live source: ats %u, vts %u, gap %d\n", - ats, vts, gap); - } - else { - int skipped = gap * shared->audioPara.samplesPerSecond / 1000000; - skipped += shared->config.audioOffset; - ABskipSamples (skipped); - Fprintf (stderr, "Live source: skipped %d audio samples\n", skipped); - } - } - else if (stuffsamples) { - ABskipSamples (-stuffsamples); - } - if (cmdstarted) - start_timer (); - tmp = CmdDONE; - CmdWrite (&tmp, 1); - return 0; -} - -int -Command_Handler::position_action (int operation_tag) -{ - int val; - unsigned char tmp = CmdDONE; - CmdRead ((char*)&val, 4); - if (shared->live) { - beep(); - } - else { - shared->locationPosition = val; - this->stop_playing (); - NewCmd(CmdPOSITION); - if (videoSocket >= 0) - { - int gop = shared->nextGroup; - Video_Control::POSITIONpara_var para (new Video_Control::POSITIONpara); - shared->nextGroup = ((shared->totalGroups-1) * val) / POSITION_RANGE; - /* - fprintf(stderr, "CTR: POSITION%s %d (nextGop %d). . .\n", - operation_tag ? "_released" : "", val, shared->nextGroup); - */ - if (gop != shared->nextGroup || operation_tag) - { - shared->nextFrame = ((shared->totalFrames-1) * val) / POSITION_RANGE; - para->sn = htonl(shared->cmdsn); - para->nextGroup = htonl(shared->nextGroup); - tmp = CmdPOSITION; - TAO_TRY - { - CORBA::Boolean result; - result = this->video_control_->position (para.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - if (result == (CORBA::B_FALSE)) - return -1; - ACE_DEBUG ((LM_DEBUG,"(%P|%t) position done \n")); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->position (..)"); - return -1; - } - TAO_ENDTRY; - if (operation_tag) /* release or LOOPrewind */ - wait_display(); - } - if (operation_tag && audioSocket >= 0) /* needs to adjust audio position */ - { - shared->nextSample = (int)((double)shared->audioPara.samplesPerSecond * - ((double)shared->nextFrame / shared->pictureRate)); - } - } - else if (audioSocket >= 0) - shared->nextSample = (shared->totalSamples-1) * val / POSITION_RANGE; - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return 0; -} - -int -Command_Handler::position (void) - -{ - return this->position_action (0); -} - -int -Command_Handler::position_release (void) - -{ - return this->position_action (1); -} - -int -Command_Handler::volume (void) - -{ - CmdRead((char *)&shared->volumePosition, 4); - if (audioSocket >= 0) { - SetAudioGain(); - } - /* - unsigned char tmp = CmdDONE; - tmp = CmdDONE; - CmdWrite(&tmp, 1); - */ - return 0; -} - -int -Command_Handler::balance (void) - -{ - CmdRead((char *)&shared->balancePosition, 4); - /* - unsigned char tmp = CmdDONE; - tmp = CmdDONE; - CmdWrite(&tmp, 1); - */ - return 0; -} - -CORBA::Boolean -Command_Handler::speed (void) - -{ - - // ::speed (); - // return 0; - - unsigned char tmp; - CmdRead((char *)&shared->speedPosition, 4); - set_speed(); - if (!shared->live && shared->cmd == CmdPLAY) - { - if (videoSocket >= 0) { - Video_Control::SPEEDpara_var para (new Video_Control::SPEEDpara); - para->sn = shared->cmdsn; - para->usecPerFrame = shared->usecPerFrame; - para->framesPerSecond = shared->framesPerSecond; - para->frameRateLimit1000 = - (long)(shared->frameRateLimit * 1000.0); - { - int i = shared->config.maxSPframes; - i = (int) ((double)i * (1000000.0 / (double)shared->usecPerFrame) / - shared->pictureRate); - shared->sendPatternGops = max(min(i, PATTERN_SIZE) / shared->patternSize, 1); - } - compute_sendPattern(); - para->sendPatternGops = shared->sendPatternGops; - - // memcpy(para.sendPattern, shared->sendPattern, PATTERN_SIZE); - para->sendPattern.length (PATTERN_SIZE); - for (int i=0; i< PATTERN_SIZE ; i++) - para->sendPattern[i]=shared->sendPattern[i]; - // CORBA call - TAO_TRY - { - CORBA::Boolean result = - this->video_control_->speed (para.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CORBA call returned %d\n", - result)); - if (result == (CORBA::B_FALSE)) - // ~~ what about audio if video fails - // ~~ Eventually audio will have a separate audio command handler and - // hence this shouldn't be a problem. - return -1; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control->speed ()"); - return -1; - } - TAO_ENDTRY; - - if (fbstate) { - maxrate = (double)minupf / (double)max(shared->usecPerFrame, minupf); - adjstep = ((double)minupf / (double)shared->usecPerFrame) / - (double)max(shared->patternSize * shared->sendPatternGops, 5); - fbstate = 1; - } - } - if (audioSocket >= 0) { - SPEEDaudioPara para; - para.sn = htonl(shared->cmdsn); - para.samplesPerSecond = htonl(shared->samplesPerSecond); - para.samplesPerPacket = htonl(1024 / shared->audioPara.bytesPerSample); - para.spslimit = htonl(32000); - tmp = CmdSPEED; - AudioWrite(&tmp, 1); - AudioWrite(¶, sizeof(para)); - } - } - return 0; - -} - - -CORBA::Boolean -Command_Handler::stop (void) - -{ - /* - ::stop (); - return 0; - */ -#ifdef STAT - unsigned char preCmd = shared->cmd; -#endif - /* - fprintf(stderr, "CTR: STOP . . .\n"); - */ - this->stop_playing (); - - if (shared->live && videoSocket >= 0) { - Fprintf(stderr, "CTR live video stat: average disp frame rate: %5.2f fps\n", - shared->pictureRate * displayedFrames / shared->nextFrame); - } - unsigned char tmp = CmdDONE; - CmdWrite(&tmp, 1); - - return CORBA::B_TRUE; -} - -int -Command_Handler::stop_playing (void) -{ - unsigned char precmd = shared->cmd; - - if (precmd == CmdFF || precmd == CmdFB || precmd == CmdPLAY) - { - unsigned char tmp = CmdSTOP; - NewCmd(CmdSTOP); - - /* notify AS and/or VS */ - if (audioSocket >= 0 && precmd == CmdPLAY && rtplay) - { - int cmdsn = htonl(shared->cmdsn); - AudioWrite(&tmp, 1); - AudioWrite(&cmdsn, 4); - } - if (videoSocket >= 0) - { - // CORBA call - TAO_TRY - { - CORBA::Boolean result = - this->video_control_->stop (shared->cmdsn, - TAO_TRY_ENV); - if (result == (CORBA::B_FALSE)) - return -1; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->stop(..)"); - return -1; - } - TAO_ENDTRY; - } - - /* stop timer and sleep for a while */ - stop_timer(); - usleep(100000); - - /* purge VDbuf and audio channel from AS*/ - if (videoSocket >= 0) - { - while (VDpeekMsg() != NULL) - VDreclaimMsg(VDgetMsg()); - /* - Fprintf(stderr, "CTR: VDbuf purged.\n"); - */ - fbstate = 0; - - } - - /* adjust some info */ - if (precmd == CmdPLAY && videoSocket >= 0) - shared->nextFrame = shared->currentFrame+1; - else - shared->nextGroup = shared->currentGroup + 1; - } -} - -// connects and handshakes with the server -int -Command_Handler::connect_to_server (char *address, - int *ctr_fd, - int *data_fd, - int *max_pkt_size) -{ - - // set the pointers to the correct values - *max_pkt_size = -INET_SOCKET_BUFFER_SIZE; - - // construct the server addr - ACE_INET_Addr server_addr (VCR_TCP_PORT, - address); - - if (this->connector_.connect (this->stream_, - server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Connection to server failed: %p\n", - "connect"), - -1); - // Write the CmdINITvideo to tell the server that this is a video - // client. - int tmp; - tmp = CmdINITvideo; - this->stream_.send_n (&tmp, sizeof (tmp)); - int ack; - this->stream_.recv_n (&ack, sizeof (ack)); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) got ack :%d\n", - ack)); - - // 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::UShort server_port; - ACE_INET_Addr local_addr; - CORBA::String client_address_string; - TAO_TRY - { - ACE_NEW_RETURN (client_address_string, - char [BUFSIZ], - -1); - // Get the local UDP address - if (this->dgram_.open (ACE_Addr::sap_any) == -1) - ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram open failed %p"),-1); - - if (this->dgram_.get_local_addr (local_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram get local addr failed %p"),-1); - // form a string - ::sprintf (client_address_string, - "%s:%d", - local_addr.get_host_name (), - local_addr.get_port_number ()); - - 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:server port =%d\n",server_port)); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("video_control_->fast_forward_video (..)"); - return CORBA::B_FALSE; - } - TAO_ENDTRY; - - ACE_INET_Addr server_udp_addr (server_port, - address); - - if (ACE_OS::connect (this->dgram_.get_handle (),(sockaddr *) server_udp_addr.get_addr (), - server_udp_addr.get_size ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)datagram connect failed %p"),-1); - // if (this->dgram_.open (server_udp_addr, - // local_addr) == -1) - // ACE_ERROR_RETURN ((LM_ERROR, - // "(%P|%t) Command_Handler::connect_to_server:%p\n", - // "dgram.open "), - // -1); - -// this->dgram_.get_local_addr (local_addr); -// // form a string -// ::sprintf (client_address_string, -// "%s:%d", -// local_addr.get_host_name (), -// local_addr.get_port_number ()); - -// ACE_DEBUG ((LM_DEBUG, -// "(%P|%t) Client string is %s\n", -// client_address_string)); - // set the pointers to the correct values - - *ctr_fd = *data_fd = this->dgram_.get_handle (); - // set both the control and data socket the same UDP socket. - ACE_DEBUG ((LM_DEBUG, - "Control and data fd = %d\n", - *ctr_fd)); - return 0; -} - -// ---------------------------------------------------------------------- - -// Client_Sig_Handler methods -// handles the timeout SIGALRM signal -Client_Sig_Handler::Client_Sig_Handler (Command_Handler *command_handler) - : command_handler_ (command_handler) -{ -} - -Client_Sig_Handler::~Client_Sig_Handler (void) -{ - ACE_Reactor::instance ()->remove_handler (this, - ACE_Event_Handler::NULL_MASK); - - ACE_Reactor::instance ()->remove_handler (this->sig_set); -} - -int -Client_Sig_Handler::register_handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != -1); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. - if (ACE_Reactor::instance ()->register_handler - (this, ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - - // Create a sigset_t corresponding to the signals we want to catch. - - this->sig_set.sig_add (SIGINT); - this->sig_set.sig_add (SIGQUIT); - this->sig_set.sig_add (SIGALRM); - this->sig_set.sig_add (SIGUSR1); - this->sig_set.sig_add (SIGUSR2); - - // Register the signal handler object to catch the signals. - if (ACE_Reactor::instance ()->register_handler (sig_set, - this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - return 0; -} -// Called by the ACE_Reactor to extract the fd. - -ACE_HANDLE -Client_Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -int -Client_Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handling asynchonrous input...\n")); - return 0; -} - -int -Client_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, -// the behavior triggered by the signal is handled in the main event -// loop, rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -Client_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - int status; - pid_t pid; - // ACE_DEBUG ((LM_DEBUG, "(%t) received signal %S\n", signum)); - - switch (signum) - { - case SIGALRM: - // Handle the timeout - ::TimerHandler (signum); - // %% ??!!! - break; - case SIGUSR1: - usr1_handler (signum); - break; - case SIGUSR2: - default_usr2_handler (signum); - break; - case SIGCHLD: - ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum)); - pid = ACE_OS::wait (&status); - if (pid == UIpid) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) UI process died, removing signal handlers from the reactor\n", signum)); - this->command_handler_->close (); - ACE_Reactor::instance ()->remove_handler (this->sig_set); - ACE_Reactor::instance ()->end_event_loop (); - } - return 0; - case SIGINT: - ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S, removing signal handlers from the reactor\n", signum)); - this->command_handler_->close (); - ACE_Reactor::instance ()->remove_handler (this->sig_set); - ACE_Reactor::instance ()->end_event_loop (); - return 0; - default: - ACE_DEBUG ((LM_DEBUG, - "(%t) %S: not handled, returning to program\n", - signum)); - break; - } - TimerProcessing (); - 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 deleted file mode 100644 index e8f2cefc39d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Command_Handler.h +++ /dev/null @@ -1,177 +0,0 @@ -/* -*- C++ -*- */ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#if !defined (AV_COMMAND_HANDLER_H) -#define AV_COMMAND_HANDLER_H - -#include "ace/Reactor.h" -#include "ace/Event_Handler.h" -#include "ace/ARGV.h" -#include "tao/TAO.h" -#include "mpeg_shared/Video_ControlC.h" -#include "orbsvcs/CosNamingC.h" -#include "ace/SOCK_Dgram.h" -#include "ace/SOCK_Connector.h" - -class Command_Handler - : public virtual ACE_Event_Handler -{ - // = TITLE - // Defines the event handler class for the client commands - // - // = DESCRIPTION - // This class makes use of a UNIX socket, over which - // it will receive commands from the GUI - -public: - - Command_Handler (ACE_HANDLE command_handle); - // Construct this handler with a control (UNIX) handle - - ~Command_Handler (void); - // Destructor - - int init (void); - // initialize the ORB - - int resolve_server_reference (void); - // Resolve the video control reference - - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - // Called when input events occur (e.g., connection or data). - - virtual ACE_HANDLE get_handle (void) const; - // Returns the handle used by the event_handler. - - CORBA::Boolean init_video (void); - - int init_video_channel (char *phostname,char *videofile); - - CORBA::Boolean stat_stream (CORBA::Char_out ch, - CORBA::Long_out size) ; - - CORBA::Boolean close (void) ; - - CORBA::Boolean stat_sent (void) ; - - CORBA::Boolean fast_forward (void); - - CORBA::Boolean fast_backward (void); - - CORBA::Boolean step (void); - - CORBA::Boolean play (int flag, - CORBA::Environment& env); - - int position_action (int operation_tag); - - int position (void); - - int position_release (void); - - int volume (void); - - int balance (void); - - CORBA::Boolean speed (void); - - CORBA::Boolean stop (void); - - int stop_playing (void); - - int connect_to_server (char *address, - int *ctr_fd, - int *data_fd, - int *max_pkt_size); - -private: - ACE_SOCK_Dgram dgram_; - // UDP datagram on which to send/recv data - - ACE_SOCK_Stream stream_; - // TCP stream socket - - ACE_SOCK_Connector connector_; - - ACE_HANDLE command_handle_; - // The fd for the UNIX command socket - - TAO_ORB_Manager *orb_manager_; - // the ORB manager - - Video_Control_var video_control_; - // Video Control CORBA object -}; - - -class Client_Sig_Handler - : public virtual ACE_Event_Handler - // = TITLE - // Defines the signal handler class for the client timer processing - // - // = DESCRIPTION - // %% -{ -public: - Client_Sig_Handler (Command_Handler *command_handler); - // We need the command handler to call close () - - ~Client_Sig_Handler (void); - // Destructor - - virtual ACE_HANDLE get_handle (void) const; - - int register_handler (void); - // this will register this sig_handler - // with the reactor for SIGCHLD,SIGTERM,SIGINT - - virtual int shutdown (ACE_HANDLE, - ACE_Reactor_Mask); - // handles the reactor shutdown - - virtual int handle_input (ACE_HANDLE); - // handle input on the dummy handle. - - virtual int handle_signal (ACE_HANDLE signum, - siginfo_t * = 0, - ucontext_t* = 0); - // handles SIGALRM - -private: - ACE_HANDLE handle_; - // dummy handle for the sig handler. - - ACE_Sig_Set sig_set; - // the signal set - - Command_Handler *command_handler_; - // We need the command handler to call close () - -}; - - -#endif /* AV_COMMAND_HANDLER_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile deleted file mode 100644 index 88318d56c9b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/Makefile +++ /dev/null @@ -1,514 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -LIBNAME = libmpeg_client -LIB = $(LIBNAME).a -SHLIB = $(LIBNAME).$(SOEXT) - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES= 24bit \ - 2x2 \ - ab \ - audio \ - decoders \ - file \ - fs2 \ - fs2fast \ - fs4 \ - global \ - gray \ - hybrid \ - hybriderr \ - info \ - jrevdct \ - mb_ordered \ - mono \ - motionvector \ - ordered \ - ordered2 \ - para \ - parseblock \ - prog \ - ui \ - util \ - util32 \ - vb \ - vd \ - video \ - vp \ - Command_Handler - -MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source -CPPFLAGS += -I$(MPEG_ROOT) -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - -##LIBS += -lTAO -lACE - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -LDFLAGS += -L/project/doc/pkg/X11/lib/ -lXm -lXt -lXext -lSM -lICE -lX11 -L/project/doc/pkg/X11/lib -lsocket -lnsl -ldl -CPPFLAGS += -i -DSH_MEM -DNDEBUG -I/project/doc/pkg/X11/include -L/project/doc/pkg/X11/lib - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/24bit.o .obj/24bit.so .shobj/24bit.o .shobj/24bit.so: 24bit.cpp video.h dither.h proto.h -.obj/2x2.o .obj/2x2.so .shobj/2x2.o .shobj/2x2.so: 2x2.cpp video.h dither.h proto.h -.obj/ab.o .obj/ab.so .shobj/ab.o .shobj/ab.so: ab.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.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 -.obj/audio.o .obj/audio.so .shobj/audio.o .shobj/audio.so: audio.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.h -.obj/decoders.o .obj/decoders.so .shobj/decoders.o .shobj/decoders.so: decoders.cpp decoders.h util.h video.h proto.h -.obj/file.o .obj/file.so .shobj/file.o .shobj/file.so: file.cpp video.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.h -.obj/fs2.o .obj/fs2.so .shobj/fs2.o .shobj/fs2.so: fs2.cpp video.h dither.h fs2.h proto.h -.obj/fs2fast.o .obj/fs2fast.so .shobj/fs2fast.o .shobj/fs2fast.so: fs2fast.cpp video.h proto.h dither.h -.obj/fs4.o .obj/fs4.so .shobj/fs4.o .shobj/fs4.so: fs4.cpp fs4.h video.h proto.h dither.h -.obj/global.o .obj/global.so .shobj/global.o .shobj/global.so: global.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i -.obj/gray.o .obj/gray.so .shobj/gray.o .shobj/gray.so: gray.cpp video.h proto.h dither.h -.obj/hybrid.o .obj/hybrid.so .shobj/hybrid.o .shobj/hybrid.so: hybrid.cpp video.h proto.h dither.h -.obj/hybriderr.o .obj/hybriderr.so .shobj/hybriderr.o .shobj/hybriderr.so: hybriderr.cpp video.h proto.h dither.h -.obj/info.o .obj/info.so .shobj/info.o .shobj/info.so: info.cpp -.obj/jrevdct.o .obj/jrevdct.so .shobj/jrevdct.o .shobj/jrevdct.so: jrevdct.cpp video.h proto.h -.obj/mb_ordered.o .obj/mb_ordered.so .shobj/mb_ordered.o .shobj/mb_ordered.so: mb_ordered.cpp video.h proto.h dither.h -.obj/mono.o .obj/mono.so .shobj/mono.o .shobj/mono.so: mono.cpp video.h proto.h dither.h -.obj/motionvector.o .obj/motionvector.so .shobj/motionvector.o .shobj/motionvector.so: motionvector.cpp video.h proto.h util.h -.obj/ordered.o .obj/ordered.so .shobj/ordered.o .shobj/ordered.so: ordered.cpp video.h proto.h dither.h -.obj/ordered2.o .obj/ordered2.so .shobj/ordered2.o .shobj/ordered2.so: ordered2.cpp video.h proto.h dither.h -.obj/para.o .obj/para.so .shobj/para.o .shobj/para.so: para.cpp video.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.h -.obj/parseblock.o .obj/parseblock.so .shobj/parseblock.o .shobj/parseblock.so: parseblock.cpp video.h proto.h decoders.h util.h -.obj/prog.o .obj/prog.so .shobj/prog.o .shobj/prog.so: prog.cpp video.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.h -.obj/ui.o .obj/ui.so .shobj/ui.o .shobj/ui.so: ui.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i interface/fb.xbm \ - interface/play.xbm interface/step.xbm interface/stop.xbm \ - interface/loop.xbm interface/ff.xbm interface/MainWindow.mib \ - interface/Info.mib video.h \ - $(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 -.obj/util.o .obj/util.so .shobj/util.o .shobj/util.so: util.cpp video.h proto.h util.h -.obj/util32.o .obj/util32.so .shobj/util32.o .shobj/util32.so: util32.cpp video.h proto.h ui.h -.obj/vb.o .obj/vb.so .shobj/vb.o .shobj/vb.so: vb.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i newproto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - global.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 -.obj/vd.o .obj/vd.so .shobj/vd.o .shobj/vd.so: vd.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(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 -.obj/video.o .obj/video.so .shobj/video.o .shobj/video.so: video.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i decoders.h util.h \ - video.h proto.h global.h ui.h -.obj/vp.o .obj/vp.so .shobj/vp.o .shobj/vp.so: vp.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(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/ab.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp deleted file mode 100644 index c2829df769c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ab.cpp +++ /dev/null @@ -1,475 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> -#include <stdlib.h> -#include <netinet/in.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> -#ifdef __svr4__ -#include <stropts.h> -#include <sys/conf.h> -#endif - -#include "include/common.h" -#include "newproto.h" -#include "global.h" -#include "mpeg_shared/filters.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" - -/* magic number -- deviation is considered - caused by clock drift only if rate <= 1/MAX_CLOCK_DRIFT. - */ -#define MAX_CLOCK_DRIFT 50 - -#define max(a,b) ((a)>(b) ? (a) : (b)) -#define min(a,b) ((a)<(b) ? (a) : (b)) - -typedef struct { - int bufsize; /* number of bytes for the buffer pointed by 'buf' */ - char * buf; /* pointer to the data buffer area */ - int bps; /* current byte-per-sample */ - int size; /* number of samples the buffer can hold */ - int samples; /* number of samples in the buffer; */ - int stuff; /* number of stuff samples to be read by ABgetSamples() */ - int ts; /* tail-sample: the next sample to be comsumed by CTR */ - int hs; /* head-sample: the next sample to be expected from the network */ - int tind; /* index of the ts-sample in the buf */ -} ABBuffer; - -static ABBuffer * abuf; -static int sid; -static int exit_tag = 0; -static int savedSocket; - -static void set_silence(char *buf, int samples) -{ - memset(buf, 0xff, samples * shared->audioPara.bytesPerSample); -} - -void ABinitBuf(int size) /* size in bytes */ -{ - abuf = (ABBuffer *)creat_shared_mem(size); - abuf->bufsize = size - sizeof(*abuf); - abuf->buf = (char *)abuf + sizeof(*abuf); - sid = creat_semaphore(); -} - -void ABflushBuf(int nextSample) /* flush the whole buffer */ -{ - enter_cs(sid); - abuf->bps = shared->audioPara.bytesPerSample; - abuf->size = abuf->bufsize / abuf->bps; - abuf->samples = 0; - abuf->stuff = 0; - abuf->ts = abuf->hs = nextSample; - abuf->tind = 0; - set_silence(abuf->buf, abuf->size); - leave_cs(sid); -} - -int ABcheckSamples(void) /* returns # of samples in ABbuf */ -{ - return abuf->samples; -} - -int ABgetSamples(char * buf, int samples) - /* read at most given number of samples from AB to buf, returns - number of sample actually read */ -{ - int as; - int tsamples = samples; - enter_cs(sid); - if (abuf->stuff > 0) { - as = min(abuf->stuff, samples); - set_silence(buf, as); - abuf->stuff -= as; - samples -= as; - buf += as * abuf->bps; - } - if (samples > 0) { - as = min(samples, max(0, abuf->samples)); - /* there may be fewer samples in abuf */ - if (as > 0) { - int part1 = min(as, abuf->size - abuf->tind); - memcpy(buf, abuf->buf + (abuf->bps * abuf->tind), part1 * abuf->bps); - set_silence(abuf->buf + (abuf->bps * abuf->tind), part1); - if (part1 < as) { /* This read cross the boundary of abuf */ - memcpy(buf + (part1 * abuf->bps), - abuf->buf, - (as - part1) * abuf->bps); - set_silence(abuf->buf, as - part1); - } - } - abuf->samples -= samples; - abuf->ts += samples; - abuf->tind = (abuf->tind + samples) % abuf->size; - if (as < samples) set_silence(buf + (as * abuf->bps), samples - as); - } - leave_cs(sid); - return tsamples; -} - -/* if samples < 0; then stuff |samples| silient samples to ABgetSamples(), - otherwise wipe out this number of samples from AB */ -int ABskipSamples(int samples) -{ - enter_cs(sid); - if (samples <= 0) { - abuf->stuff += (- samples); - } - else { - abuf->samples -= samples; - abuf->ts += samples; - abuf->tind = (abuf->tind + samples) % abuf->size; - } - leave_cs(sid); - return samples; -} - -void ABdeleteBuf(void) -{ - remove_shared_mem((char *)abuf); -} - -void ABdeleteSem(void) -{ - remove_semaphore(sid); -} - -/* SIGUSR1 from CTR is for killing this process, without affecting any other ones. */ - -static void usr1_handler(int sig) -{ - exit_tag = 1; -} - -static void exit_on_kill(void) -{ - extern void set_exit_routine_tag(int tag); - set_exit_routine_tag(0); - ComCloseConn(savedSocket); - VBdeleteBuf(); - exit(0); -} - -static void usr2_handler(int sig) -{ - Fprintf(stderr, "VB void usr2_handler (supposed for stat).\n"); -} - -#define PACKET_SIZE 8192 -#define STARTUP_WAIT 10000000 -#define ACTION_WAIT 5000000 - -void ABprocess(int dataSocket) -{ - - AudioPacket * packet; - char * pkt_data; - int conn_tag = shared->audioMaxPktSize; - - /* following are for feedback */ - int fbstate = 0; - unsigned waketime; - int pcmdsn = -1; /* previous cmdsn */ - - exit_tag = 0; - - savedSocket = dataSocket; - - setsignal(SIGUSR1, usr1_handler); - setsignal(SIGUSR2, usr2_handler); - - packet = (AudioPacket *)malloc(PACKET_SIZE); - if (packet == NULL) { - perror("AB failed to allocate mem for packet buffer"); - exit(1); - } - pkt_data = (char *)packet + sizeof(*packet); - - for (;;) { - int len; - int bytes; - if (conn_tag >= 0) { - bytes = sizeof(*packet); - len = wait_read_bytes(dataSocket, (char *)packet, bytes); - if (exit_tag) exit_on_kill(); - } - else { /* discard mode packet stream, read all bytes */ - bytes = PACKET_SIZE; - len = read(dataSocket, (char *)packet, bytes); - if (exit_tag) exit_on_kill(); - if (len == -1) { - if (errno == EINTR || errno == EWOULDBLOCK || errno == EAGAIN) { - usleep(10000); - if (exit_tag) exit_on_kill(); - continue; - } - perror("AB read() audio packet from discard-mode packet stream"); - exit(1); - } - } - if (len == 0) { - fprintf(stderr, "Error: AB found dataSocket broken\n"); - exit(1); - } - if (len < sizeof(*packet)) { /* unknown packet */ - fprintf(stderr, "Warn: AB discard len = %d bytes of supposed header.\n", len); - continue; - } -#ifdef NeedByteOrderConversion - packet->dataBytes = ntohl(packet->dataBytes); -#endif - - if (packet->dataBytes <= 0) { - fprintf(stderr, "AB Error: pkt->dataBytes %d, len %d\n", - packet->dataBytes, - len); - exit(1); - } - bytes = packet->dataBytes + sizeof(*packet); - - if (bytes > PACKET_SIZE) { - Fprintf(stderr, "Fatal error: AB packet buf (%dB) too small (%d)\n", - PACKET_SIZE, bytes); - exit(1); - } - if (conn_tag >= 0) { - len = wait_read_bytes(dataSocket, (char *)packet + sizeof(*packet), - bytes - sizeof(*packet)); - if (len <= 0) { - if (len == -1) perror("AB encounter error on wait_read_bytes()"); - else fprintf(stderr, "AB encounter EOF on wait_read_bytes()\n"); - } - } -#ifdef NeedByteOrderConversion - packet->cmdsn = ntohl(packet->cmdsn); - packet->samplesPerSecond = ntohl(packet->samplesPerSecond); - packet->resend = ntohl(packet->resend); - packet->firstSample = ntohl(packet->firstSample); - packet->samples = ntohl(packet->samples); - packet->actualSamples = ntohl(packet->actualSamples); - /* dataBytes already byte-reordered */ -#endif - /* - Fprintf(stderr, "AB got a packet: %d(%d)\n", - packet->firstSample, packet->samples); - */ - /* - if (packet->firstSample % 10240 && !packet->resend) continue; - */ - if (packet->samples * abuf->bps > PACKET_SIZE - sizeof(*packet)) { - fprintf(stderr, "Fatal error: AB has too small packet buffer, %d out of %d\n", - PACKET_SIZE, packet->samples * abuf->bps + sizeof(*packet)); - exit(1); - } - - if (packet->cmdsn != shared->cmdsn) { /* outdated packet */ - /* - Fprintf(stderr, "AB discarded an outdated packet\n"); - */ - continue; - } - enter_cs(sid); - if (packet->firstSample + packet->samples <= abuf->ts) { - /* all samples too late, discard it */ - abuf->hs = max(abuf->hs, packet->firstSample + packet->samples); - abuf->samples = abuf->hs - abuf->ts; - leave_cs(sid); - /* - Fprintf(stderr, "AB all sample in packet %d(%d) too late\n", - packet->firstSample, packet->samples); - */ - goto feedback_code; - } - if (packet->firstSample >= abuf->ts + abuf->size) { - /* all samples too early, discard the packet */ - abuf->hs = max(abuf->hs, packet->firstSample + packet->samples); - abuf->samples = abuf->hs - abuf->ts; - leave_cs(sid); - /* - Fprintf(stderr, "AB all sample in packet %d(%d) too early\n", - packet->firstSample, packet->samples); - */ - goto feedback_code; - } - - if (packet->samples > packet->actualSamples) { - leave_cs(sid); - fprintf(stderr, "Error: AB interpolation not available yet.\n"); - exit(1); - } - - { - int oldhs = abuf->hs; - int firstSample = max(packet->firstSample, abuf->ts); - int samples = min(packet->samples - - (firstSample - packet->firstSample), - (abuf->ts + abuf->size) - packet->firstSample); - char * data = pkt_data + - (firstSample - packet->firstSample) * abuf->bps; - int dstart = (abuf->tind + (firstSample - abuf->ts)) % abuf->size; - int part1 = min(samples, abuf->size - dstart); - memcpy(abuf->buf + (dstart * abuf->bps), data, part1 * abuf->bps); - if (part1 < samples) { - memcpy(abuf->buf, data + part1 * abuf->bps, - (samples - part1) * abuf->bps); - } - abuf->hs = max(abuf->hs, packet->firstSample + packet->samples); - abuf->samples = abuf->hs - abuf->ts; - dstart =max(oldhs, abuf->ts); - - leave_cs(sid); - - part1 = firstSample - dstart; - if (packet->resend) { - Fprintf(stderr, "AB got resent %d(%d)\n", - packet->firstSample, packet->samples); - } - else if (part1 > 0) { - int res; - AudioFeedBackPara para; - Fprintf(stderr, "AB found gap %d(%d)\n", dstart, part1); - para.cmdsn = htonl(shared->cmdsn); - para.type = htonl(1); - para.data.ap.firstSample = htonl(dstart); - para.data.ap.samples = htonl(part1); - if (conn_tag != 0) { /* packet stream */ - while ((res = write(dataSocket, (char *)¶, sizeof(para))) == -1) - { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - perror("AB Warning, resend-req packet discarded for"); - break; - } - perror("AB error, resend-req packet sending failed"); - exit(1); - } - } - else { - res = wait_write_bytes(dataSocket, (char *)¶, sizeof(para)); - if (res == -1) { - perror("AB error, resend-req packet sending failed"); - exit(1); - } - } - if (res < sizeof(para)) { - fprintf(stderr, "AB warn: send() for gap res %dB < sizeof(para) %dB\n", - res, sizeof(para)); - } - } - } - - /* following is feedback algorithm */ - - feedback_code: - - if (shared->live || (!shared->config.syncEffective)) continue; - /* - fprintf(stderr, "AB fbstate = %d\n", fbstate); - */ - switch (fbstate) { - case 0: /* startup init */ - if (pcmdsn != packet->cmdsn) { - fbstate = 0; - pcmdsn = packet->cmdsn; - } - else { - fbstate = 1; - waketime = get_usec() + STARTUP_WAIT; - } - break; - case 1: /* startup wait */ - if (pcmdsn != packet->cmdsn) { - fbstate = 0; - break; - } - if (get_usec() >= waketime) { - fbstate = 2; - } - break; - case 2: /* monitoring */ - if (pcmdsn != packet->cmdsn) { - fbstate = 0; - break; - } - if (abuf->samples < abuf->size >>2 || - abuf->samples > (abuf->size * 3) >> 2) { - /* feedback action needed */ - AudioFeedBackPara para; - int res; - para.data.fb.addsps = 0; - para.data.fb.addSamples = (abuf->size >> 2) - abuf->samples; - - Fprintf(stderr, "AB sends fb: %dsps, %dsamples\n", - para.data.fb.addsps, - para.data.fb.addSamples); - para.cmdsn = htonl(shared->cmdsn); - para.type = htonl(0); - para.data.fb.addsps = htonl(para.data.fb.addsps); - para.data.fb.addSamples = htonl(para.data.fb.addSamples); - if (conn_tag != 0) { - while ((res = write(dataSocket, (char *)¶, sizeof(para))) == -1) - { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - perror("AB Warning, fb packet discarded for"); - break; - } - perror("AB error, fb packet sending failed"); - exit(1); - } - } - else { - res = wait_write_bytes(dataSocket, (char *)¶, sizeof(para)); - if (res == -1) { - perror("AB error, fb packet sending failed"); - exit(1); - } - } - if (res < sizeof(para)) { - fprintf(stderr, "AB warn: send() for sync res %dB < sizeof(para) %dB\n", - res, sizeof(para)); - } - - waketime = get_usec() + STARTUP_WAIT; - fbstate = 1; - } - break; - default: - break; - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp deleted file mode 100644 index 5389b3e5f09..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/audio.cpp +++ /dev/null @@ -1,490 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -/* ################################################################## - - When you port to a new architecture, you much add native audio - device support in this file by adding stuff to all relevant - functions, otherwise, it is disabled by default. - - ################################################################# */ -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/ioctl.h> -#ifdef __svr4__ -#include <sys/audioio.h> -#elif defined(FreeBSD) -#include <machine/pcaudioio.h> -#elif defined(sun) -#include <sys/audioio.h> -#elif defined(_HPUX_SOURCE) -#include <sys/audio.h> -#elif defined(IRIX) -#include <audio.h> -#endif - -#ifdef FreeBSD -#define AUDIO_DEVICE "/dev/pcaudio" -#define AUDIO_CONTROL "/dev/pcaudioctl" -#elif defined(__svr4__) || defined(sun) -#define AUDIO_DEVICE "/dev/audio" -#define AUDIO_CONTROL "/dev/audioctl" -#elif defined(_HPUX_SOURCE) -#define AUDIO_DEVICE "/dev/audio" -#define AUDIO_CONTROL "/dev/audioCtl" -#elif defined(IRIX) -#define AUDIO_DEVICE "proprietary device" -#define AUDIO_CONTROL "proprietary device" -#elif defined(LINUX) -#define AUDIO_DEVICE "/dev/audio" -#define AUDIO_CONTROL "NO CONTROL DEV" -#endif - -#include <time.h> -#include <signal.h> -#include <sys/time.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#include "include/common.h" -#include "newproto.h" -#include "global.h" - -static int cfd = -1, afd = -1; /* afd == -1 mean no native device available */ -static long start_time; -static long current_time; - -#ifdef IRIX -#define audioDevice AL_DEFAULT_DEVICE -static ALport playPort = NULL; -#endif - -#ifdef AUDIOFILE - -#include <AF/AFlib.h> -#include <AF/AFUtils.h> - -static int useAF = 0; - -static AFAudioConn *aud; -static AC ac; -static AFSetACAttributes attributes; - -/* - * Find a suitable default device - * Returns -1 if no suitable device can be found. - */ -static int FindDefaultDevice(AFAudioConn *aud) -{ - AFDeviceDescriptor *audioDevice; - int i; - for(i=0; i<ANumberOfAudioDevices(aud); i++) - { - audioDevice = AAudioDeviceDescriptor(aud, i); - if(audioDevice->inputsFromPhone == 0 && audioDevice->outputsToPhone == 0) - return i; - } - return -1; -} -#endif - -/* - returns: 0 - succ - -1 - failed -*/ -int InitAudioDevice(void) -{ -#ifdef AUDIOFILE - int device; - int gain; - unsigned int channels; - int endianflag = 0; -#endif - -#ifdef AUDIOFILE - device = -1; - attributes.preempt = Mix; - attributes.start_timeout = 0; - attributes.end_silence = 0; - attributes.play_gain = 0; - attributes.rec_gain = 0; - attributes.type = UNKNOWN_ENCODETYPE; - - if ( (aud = AFOpenAudioConn(NULL)) == NULL) - { - fprintf(stderr, "Failed locating default AudioFile.\n"); - goto native_audio; - } - - /* set up audio context, find sample size and sample rate - At this time, we only support default setings */ - device = FindDefaultDevice(aud); - attributes.type = aud->devices[device].playBufType; - ac = AFCreateAC(aud, device, (ACPlayGain | ACEncodingType | endianflag), - &attributes); - if (ac == NULL) - { - fprintf(stderr, "Failed Initializing default AudioFile.\n"); - AFCloseAudioConn(aud); - goto native_audio; - } - AFSync(aud, 0); /* Make sure we confirm encoding type support. */ - shared->AFPara.encodeType = attributes.type; - shared->AFPara.channels = ac->device->playNchannels; - shared->AFPara.bytesPerSample = - BytesPerUnit(attributes.type) / SampsPerUnit(attributes.type); - shared->AFPara.samplesPerSecond = ac->device->playSampleFreq; - /* - memcpy(&(shared->AFPara), &(shared->config.audioPara), sizeof(AudioParameter)); - */ - useAF = 1; - fprintf(stderr, "Using default AudioFile.\n"); - return 0; -#elif defined(__svr4__) || defined(sun) || defined(FreeBSD) \ - || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX) - fprintf(stderr, "This vcr compiled without AudioFile, try native audio.\n"); -#else - fprintf(stderr, "This vcr compiled without AudioFile, audio to be ignored\n"); - afd = -1; - return -1; -#endif - - native_audio: - -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) || defined(_HPUX_SOURCE) - - afd = open(AUDIO_DEVICE, O_WRONLY | O_NDELAY); - if (afd == -1) { - fprintf(stderr, "%s", AUDIO_DEVICE); - perror(" can't be opened for write"); - return -1; - } - cfd = open(AUDIO_CONTROL, O_WRONLY | O_NDELAY); - if (cfd == -1) { - fprintf(stderr, "%s", AUDIO_DEVICE); - perror(" can't be opened for write"); - close(afd); - afd = -1; - return -1; - } -#if defined(_HPUX_SOURCE) - - if (ioctl(cfd, AUDIO_SET_DATA_FORMAT, AUDIO_FORMAT_ULAW) < 0) { - fprintf(stderr, "%s" AUDIO_DEVICE); - perror("can't be set to u-law"); - close(afd); - close(cfd); - afd = -1; - return -1; - } - if (ioctl(cfd, AUDIO_SET_CHANNELS, 1) < 0) { - fprintf(stderr, "%s" AUDIO_DEVICE); - perror("can't be set to have single channel"); - close(afd); - close(cfd); - afd = -1; - return -1; - } - if (ioctl(cfd, AUDIO_SET_SAMPLE_RATE, 8000) < 0) { - fprintf(stderr, "%s" AUDIO_DEVICE); - perror("can't be set to 8000sps"); - close(afd); - close(cfd); - afd = -1; - return -1; - } - if (ioctl(cfd, AUDIO_SET_OUTPUT, AUDIO_OUT_SPEAKER | AUDIO_OUT_HEADPHONE)) - { - fprintf(stderr, "%s" AUDIO_DEVICE); - perror("can't be set output to both internal speaker and headphone"); - close(afd); - close(cfd); - afd = -1; - return -1; - } - if(ioctl(cfd, AUDIO_SET_TXBUFSIZE, 1024*64) < 0) - { - fprintf(stderr, "%s" AUDIO_DEVICE); - perror("can't be set output buffer size to 64K"); - close(afd); - close(cfd); - afd = -1; - return -1; - } -#endif /* _HPUX_SOURCE */ - -#elif defined(IRIX) - { -#define NCH 1 -#define MSQUEUE 100 - ALconfig c; - long params[2]; - - params[0] = AL_OUTPUT_RATE; - params[1] = 8000; - ALsetparams(audioDevice, params, 2); - - if ((c = ALnewconfig()) == NULL) { - afd = -1; - return -1; - } - ALsetwidth(c, AL_SAMPLE_16); - ALsetchannels(c, AL_MONO); - ALsetqueuesize(c, 10240); /* Minimal queue size */ - playPort = ALopenport(AUDIO_DEVICE, "w", c); - ALfreeconfig(c); - if (playPort == NULL) { - afd = -1; - return -1; - } - afd = 0; - } -#elif defined(LINUX) - - afd = open(AUDIO_DEVICE, O_WRONLY); - if (afd == -1) { - fprintf(stderr, "%s", AUDIO_DEVICE); - perror(" can't be opened for write"); - return -1; - } - -#else /* no audio device supported on other platforms */ - - fprintf(stderr, "Audio device access not supported, audio to be ignored\n"); - afd = -1; - return -1; - -#endif /* sun, FreeBSD, _HPUX_SOURCE, ... */ - shared->AFPara.encodeType = AudioTypeMuLaw; - shared->AFPara.channels = 1; - shared->AFPara.bytesPerSample = 1; - shared->AFPara.samplesPerSecond = 8000; - start_time = get_msec(); - current_time = 0; - fprintf(stderr, "Using native %s\n", AUDIO_DEVICE); - return 0; -} - -void SetAudioParameter(AudioParameter * para) -{ -} - -unsigned int GetAudioTime(void) -{ -#ifdef AUDIOFILE - if (useAF) return AFGetTime(ac); -#endif -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \ - || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX) - if (afd == -1) return 0; - return get_duration(start_time, get_msec()) * 8; /* 8K sampling speed */ -#else - return 0; -#endif -} - -/* Play size number of samples to AF */ -unsigned int PlayAudioSamples(unsigned int time, char * buf, int size) -{ -#ifdef AUDIOFILE - if (useAF) return AFPlaySamples(ac, time, size * shared->audioPara.bytesPerSample, - (unsigned char *)buf); -#endif - -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \ - || defined(_HPUX_SOURCE) || defined(IRIX) || defined(LINUX) - if (afd == -1) return 0; - -#ifdef IRIX - { -#define BUFSIZE 1024 - static short AF_cvt_u2s[]={ - -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, - -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, - -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412, - -11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316, - -7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, - -5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, - -3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, - -2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, - -1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, - -1372, -1308, -1244, -1180, -1116, -1052, -988, -924, - -876, -844, -812, -780, -748, -716, -684, -652, - -620, -588, -556, -524, -492, -460, -428, -396, - -372, -356, -340, -324, -308, -292, -276, -260, - -244, -228, -212, -196, -180, -164, -148, -132, - -120, -112, -104, -96, -88, -80, -72, -64, - -56, -48, -40, -32, -24, -16, -8, 0, - 32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, - 23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, - 15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, - 11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, - 7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, - 5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, - 3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, - 2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, - 1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, - 1372, 1308, 1244, 1180, 1116, 1052, 988, 924, - 876, 844, 812, 780, 748, 716, 684, 652, - 620, 588, 556, 524, 492, 460, 428, 396, - 372, 356, 340, 324, 308, 292, 276, 260, - 244, 228, 212, 196, 180, 164, 148, 132, - 120, 112, 104, 96, 88, 80, 72, 64, - 56, 48, 40, 32, 24, 16, 8, 0 - }; - int left = size; - unsigned char * src = buf; - int i; - while (left > 0) { - short buffer[BUFSIZE]; - short * dst = buffer; - int len = left; - if (len > BUFSIZE) len = BUFSIZE; - left -= len; - for (i = 0; i < len; i ++) { - *(dst ++) = AF_cvt_u2s[*(src ++)]; - } - ALwritesamps(playPort, buffer, len); - } - } -#else - write(afd, buf, size); -#endif - - current_time += size; - return get_duration(start_time, get_msec()) * 8; /* 8K sampling speed */ -#else - return 0; -#endif -} - -void StartAudioPlaySession(void) -{ - SetAudioGain(); -#ifdef AUDIOFILE - if (useAF) return; -#endif -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) \ - || defined(_HPUX_SOURCE) || defined(IRIX) - if (afd == -1) return; -#else - return; -#endif -} -void SetAudioGain(void) -{ -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) - audio_info_t sun_gapo; -#elif defined(_HPUX_SOURCE) - struct audio_gain ag; -#elif defined(IRIX) - long params[4]; -#endif - int volume = shared->volumePosition; - -#ifdef AUDIOFILE - if (useAF) { - AFSetOutputGain(ac, volume * 2); - /* - AFSetOutputGain(ac, (volume - 10)/3); - fprintf(stderr, "CTR audio.c: volume changed to %d.\n", volume); - */ - return; - } -#endif -#if defined(__svr4__) || defined(sun) || defined(FreeBSD) - if (afd == -1) return; - ioctl(cfd, AUDIO_GETINFO, &sun_gapo); - sun_gapo.play.gain = volume * 2; - ioctl(cfd, AUDIO_SETINFO, &sun_gapo); - return; -#elif defined(_HPUX_SOURCE) - ioctl(cfd, AUDIO_GET_GAINS, &ag); - ag.cgain[0].transmit_gain = AUDIO_OFF_GAIN+(AUDIO_MAX_GAIN-AUDIO_OFF_GAIN)*volume/100; - ag.cgain[1].transmit_gain = ag.cgain[0].transmit_gain; - ioctl(cfd, AUDIO_SET_GAINS, &ag); - return; -#elif defined(IRIX) - params[0] = AL_LEFT_SPEAKER_GAIN; - params[1] = volume; - params[2] = AL_RIGHT_SPEAKER_GAIN; - params[3] = volume; - ALsetparams(audioDevice, params, 4); - return; -#else - return; -#endif -} - -void AudioInterpolate(char *rBuf, int len, char * cBuf, int convLen) -{ - unsigned char *rawBuf = (unsigned char *)rBuf; - unsigned char *convBuf = (unsigned char *)cBuf; - int i; - float factor = (float)len / (float)convLen; - -#ifdef AUDIOFILE - if ((!useAF) && afd == -1) return; -#else - if (afd == -1) return; -#endif - - /* - Fprintf(stderr, "factor %5.2lf, len %d, convLen %d\n", factor, len, convLen); - */ - if (shared->audioPara.bytesPerSample == 1) - { - for (i=0; i<convLen; i++) - { - float a = i * factor; - int k = (int) (a + 0.5); - /* - int k = a; - a = a - k; - */ - if (k < len - 1) { /* interpolation algorithm can be improved */ - /* - convBuf[i] = AF_comp_u[(int)(a * AF_exp_u[(int)rawBuf[k+1] & 0xff] + (1.0 - a) * - AF_exp_u[(int)rawBuf[k] & 0xff]) + 8192]; - */ - - convBuf[i] = rawBuf[k]; - - } - else - convBuf[i] = rawBuf[len-1]; - } - } - else - { - fprintf(stderr, "CTR audio.c error: multi_byte samples not supported.\n"); - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp deleted file mode 100644 index 33412c67fa9..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ctr.cpp +++ /dev/null @@ -1,3016 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <unistd.h> -#include <stdlib.h> -#include <netinet/in.h> -#ifdef ULTRIX -#include <fcntl.h> -#else -#include <sys/fcntl.h> -#endif -#include <time.h> -#include <signal.h> -#include <sys/time.h> -#include <limits.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#include "include/common.h" -#include "newproto.h" -#include "global.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/sendpt.h" -#include "mpeg_shared/filters.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" -#include "Command_Handler.h" - -#define SPEEDHIST_SIZE 20 - -#define max(a,b) (a>b ? a : b) -#define min(a,b) (a<b ? a : b) - -static int usr1_flag = 0; -static int rtplay = 1; -static int cmdSocket = -1; -static int CTRpid = -1, VBpid = -1, VDpid = -1, UIpid = -1; -static int ABpid = -1; -static int videoSocket = -1; -static int audioSocket = -1; -static int hasAudioDevice = 0; -static int cmdBytes = 0; -static char *cmdBuffer = NULL; -static char *vh, *vf, *ah, *af; -static int cmdAcks = 0; -static int speedPtr = 0; -static struct -{ - int frameId; - int usecPerFrame; - float frameRateLimit; - int frames; - int framesDropped; -} speedHistory[SPEEDHIST_SIZE]; - -/* following are for live video */ -static unsigned startTime; /* used to record start time for live playback, - also used to record FF/FB/PLAY round trip time */ -static unsigned startVSA; /* VS advance at the begining of playback of live video */ -static int displayedFrames; - -/* following static variable is for frameRate feedback. See comments on - initialization of these variables in function play()*/ - -static int fbstate = 0; /* state value of frame-rate feedback */ -static double maxfr = 0; /* frame-rate limit during playback, in fps. This is deduced - from frameRateLimit, a constant during a playback, even if - play speed changes */ -static int minupf = 0; /* minimum usec/frame, equals to 1000000/maxfr */ -static double maxrate = 0; /* current max frame rate, in percent of maxfr, after taken - playspeed into consideration. If play speed > maxfr, - then this value would be 1.0. Otherwise it would be - playspeed/maxfr */ -static double frate = 0; /* current server frame rate, in percentage of maxrate */ -static double adjstep = 0; /* step of frame-rate adjustment. In percentage value. - This is basically - maxrate/#frames-in-feedback-frame-sequence */ -static int fb_startup = 0; /* Indicate the first feedback action. The first feedback - action is to set the server fps directly according to - actully measured display frame-rate. All following - feedback action would then adjust server fps linearly - adjstep each time */ - -#define max(a,b) (a>b ? a : b) -#define min(a,b) (a<b ? a : b) - -#define NewCmd(val) {shared->cmd = val; shared->cmdsn ++; } - -static void compute_sendPattern(void); - -int -OurCmdRead(char *buf, int size) -{ - int val; - if (size == 0) return 0; - if (cmdBytes > 0) - { - memcpy(buf, cmdBuffer, size); - cmdBytes -= size; - cmdBuffer += size; - return 0; - } - while ((val = read(cmdSocket, (buf), (size))) <= 0) - { - if (val == -1 && errno == EINTR) return 1; - if (!val) { - perror("CTR error, EOF reached unexpected within CmdRead()"); - } - else { - perror("CTR CmdRead() from UI through CmdSocket"); - } - exit(1); - } - return 0; -} - -void CmdRead(char *buf, int size) -{ - int val; - if (size == 0) return; - if (cmdBytes > 0) - { - memcpy(buf, cmdBuffer, size); - cmdBytes -= size; - cmdBuffer += size; - return; - } - while ((val = read(cmdSocket, (buf), (size))) <= 0) - { - if (val == -1 && errno == EINTR) continue; - if (!val) { - perror("CTR error, EOF reached unexpected within CmdRead()"); - } - else { - perror("CTR CmdRead() from UI through CmdSocket"); - } - exit(1); - } - return; -} - -static int CmdReadNW(char *buf, int size) -{ - struct fd_set read_mask; - int nfds = cmdSocket+1; - int val; - - if (size == 0) return 0; - - if (cmdBytes > 0) - { - memcpy(buf, cmdBuffer, size); - cmdBytes -= size; - cmdBuffer += size; - return 0; - } - - FD_ZERO(&read_mask); - FD_SET(cmdSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, NULL) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, NULL) == -1) -#endif - { - if (errno == EINTR) - return -1; - perror("CTR CmdReadNW by select"); - exit(1); - } - if ((val = read(cmdSocket, (buf), (size))) < 0) - { - if (errno == EINTR) - return -1; - - perror("CTR CmdReadNW by read"); - exit(1); - } - if (val == 0) - { - fprintf(stderr, "Error: EOF reached unexpectedly within CmdReadNW()."); - exit(1); - } - return 0; -} - -static void CmdWrite(unsigned char * buf, int size) -{ - if (cmdAcks > 0 && size == 1 && *buf == CmdDONE) - { - cmdAcks --; - return; - } - - while (write(cmdSocket, buf, size) == -1) - { - if (errno == EINTR) - continue; - perror("CTR writes to UI through cmdSocket"); - exit(1); - } -} - -/* following function can be replaced by ../shared/fileio.c:read_bytes() - but SocketRead provides more error info */ - -static void SocketRead(int s, char *buf, int size) -{ int val, remain = size; - char * ptr = buf; - fprintf (stderr, "SocketRead: videoSocket = %d\n", - videoSocket); - for (;;) - { - val = read(s, ptr, remain); - - fprintf(stderr, "CTR got from %sSocket %d of %d.\n", - s == videoSocket ? "video" : "audio", val, remain); - - if (val == -1 && errno == EINTR) - { - errno = 0; - continue; - } - if (val == -1) - { - fprintf(stderr, "CTR error read %sSocket, ret=%d(size=%d)", - s == videoSocket ? "video" : "audio", size-remain, size); - perror(""); - exit(1); - } - if (val == 0) - { - fprintf(stderr, "CTR error read %sSocket, EOF met, ret=%d(size=%d).\n", - s == videoSocket ? "video" : "audio", size-remain, size); - exit(1); - } - ptr += val; - remain -= val; - if (remain < 0) - { - fprintf(stderr, "CTR error read %sSocket, read too much, ret=%d(size=%d).\n", - s == videoSocket ? "video" : "audio", size-remain, size); - exit(1); - } - if (remain == 0) - break; - } -} - -#if 0 -static void SocketRecv(int s, char *buf, int size) -{ int val, remain = size; - char * ptr = buf; - for (;;) - { - val = read(s, ptr, remain); - /* - fprintf(stderr, "CTR got from %sSocket %d of %d.\n", - s == videoSocket ? "video" : "audio", val, remain); - */ - if (val == -1 && errno == EINTR) - { - errno = 0; - continue; - } - if (val == -1) - { - fprintf(stderr, "CTR error read %sSocket, ret=%d(size=%d)", - s == videoSocket ? "video" : "audio", size-remain, size); - perror(""); - exit(1); - } - if (val == 0) - { - fprintf(stderr, "CTR error read %sSocket, EOF met, ret=%d(size=%d).\n", - s == videoSocket ? "video" : "audio", size-remain, size); - exit(1); - } - ptr += val; - remain -= val; - if (remain < 0) - { - fprintf(stderr, "CTR error read %sSocket, read too much, ret=%d(size=%d).\n", - s == videoSocket ? "video" : "audio", size-remain, size); - exit(1); - } - if (remain == 0) - break; - } -} -#endif - -#define VideoRead(buf, size) SocketRead(videoSocket, buf, size) - -#define VideoWrite(buf, psize) \ - { int val; while ((val = write(videoSocket, (buf), (psize))) == -1) \ - { if (errno == EINTR) continue; \ - perror("CTR writes to VS through videoSocket");\ - exit(1); \ - } \ - if (val < (int)(psize)) { \ - fprintf(stderr, "CTR bad VideoWrite, size %d, val %d", psize, val); perror(""); }\ - } - -#define AudioRead(buf, size) SocketRead(audioSocket, buf, size) - -#define AudioWrite(buf, size) \ - { while (write(audioSocket, (buf), (size)) == -1) \ - { if (errno == EINTR) continue; \ - perror("CTR writes to AS through audioSocket"); \ - exit(1); \ - } \ - } - -static void start_timer(void); -static void stop_timer(void); -static void timer_speed(void); -static void wait_display(void); -static void stop_playing(); - -static int InitVideoChannel(char * phostname, char * vf) -{ - int dataSocket = -1; - - if (ComOpenConnPair(phostname, &videoSocket, - &dataSocket, &shared->videoMaxPktSize) == -1) { - return -1; - } - - /* Initialize with VS */ - { - INITvideoPara para; - INITvideoReply reply; - unsigned char tmp; - tmp = CmdINITvideo; - VideoWrite(&tmp, 1); - - para.sn = htonl(shared->cmdsn); - para.version = htonl(VERSION); - para.nameLength = htonl(strlen(vf)+1); - - VideoWrite(¶, sizeof(para)); - VideoWrite(vf, strlen(vf)+1); - /* - fprintf(stderr, "InitCommand to VSwritten.\n"); - */ - /* - VideoRead((char*)&tmp, 1); - */ - errno = 0; - if (read(videoSocket, (char*)&tmp, 1) <= 0) { - if (errno) { - perror("CTR error read first byte from videoSocket"); - } - else { - fprintf(stderr, "CTR error: videoSocket closed by VS.\n"); - } - ComCloseConn(dataSocket); - ComCloseConn(videoSocket); - videoSocket = -1; - return -1; - } - if (tmp == CmdFAIL) - { - char errmsg[128]; - read_string(videoSocket, errmsg, 128); - fprintf(stderr, "CTR failed to connect to VS: %s.\n", errmsg); - ComCloseConn(dataSocket); - ComCloseConn(videoSocket); - videoSocket = -1; - return -1; - } - else - { - VideoRead((char*)&reply, sizeof(reply)); -#ifdef NeedByteOrderConversion - reply.live = ntohl(reply.live); - reply.format = ntohl(reply.format); - reply.totalHeaders = ntohl(reply.totalHeaders); - reply.totalGroups = ntohl(reply.totalGroups); - reply.totalFrames = ntohl(reply.totalFrames); - reply.horizontalSize = ntohl(reply.horizontalSize); - reply.verticalSize = ntohl(reply.verticalSize); - reply.pelAspectRatio = ntohl(reply.pelAspectRatio); - reply.pictureRate1000 = ntohl(reply.pictureRate1000); - reply.vbvBufferSize = ntohl(reply.vbvBufferSize); - reply.sizeIFrame = ntohl(reply.sizeIFrame); - reply.sizePFrame = ntohl(reply.sizePFrame); - reply.sizeBFrame = ntohl(reply.sizeBFrame); - reply.sizeSystemHeader = ntohl(reply.sizeSystemHeader); - reply.sizeGop = ntohl(reply.sizeGop); - reply.averageFrameSize = ntohl(reply.averageFrameSize); - reply.firstGopFrames = ntohl(reply.firstGopFrames); - reply.patternSize = ntohl(reply.patternSize); -#endif - 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 = strlen(reply.pattern); - if (shared->patternSize == 0) { - - 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 = 1; i < PATTERN_SIZE / shared->patternSize; i ++) { - memcpy(ptr, shared->pattern, shared->patternSize); - 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, pattern: %s, IframeGap %d\n", - reply.firstGopFrames, reply.pattern, 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 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(vf); - 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; -#elif defined(_HPUX_SOURCE) - 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; - - 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; - - 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, vf); - 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; -} - -static int InitAudioChannel(char * phostname, char * af) -{ - ACE_DEBUG ((LM_DEBUG,"(%P|%t) InitAudioChannel called\n")); - int dataSocket = -1; - - if (!hasAudioDevice) - { - fprintf(stderr, "CTR warning: Audio device not available, Audio ignored.\n"); - return -1; - } - - if (ComOpenConnPair(phostname, &audioSocket, - &dataSocket, &shared->audioMaxPktSize) == -1) { - return -1; - } - - /* Initialize with AS */ - { - INITaudioPara para; - INITaudioReply reply; - unsigned char tmp; - // tmp = CmdINITaudio; - // AudioWrite(&tmp, 1); - para.sn = htonl(shared->cmdsn); - para.version = htonl(VERSION); - para.para.encodeType = htonl(shared->AFPara.encodeType); - para.para.channels = htonl(shared->AFPara.channels); - para.para.samplesPerSecond = htonl(shared->AFPara.samplesPerSecond); - para.para.bytesPerSample = htonl(shared->AFPara.bytesPerSample); - para.nameLength = htonl(strlen(af)+1); - /* - fprintf(stderr, "AF Audio para: encode %d, ch %d, sps %d, bps %d.\n", - para.para.encodeType, para.para.channels, - para.para.samplesPerSecond, para.para.bytesPerSample); - */ - AudioWrite(¶, sizeof(para)); - AudioWrite(af, strlen(af)+1); - /* - fprintf(stderr, "CTR: InitCommand to AS written.\n"); - */ - /* - AudioRead((char*)&tmp, 1); - */ - errno = 0; - if (read(audioSocket, (char*)&tmp, 1) <= 0) { - if (errno) { - perror("CTR error read first byte from audioSocket"); - } - else { - fprintf(stderr, "CTR error: audioSocket closed by AS.\n"); - } - ComCloseConn(audioSocket); - ComCloseConn(dataSocket); - videoSocket = -1; - return -1; - } - if (tmp == CmdFAIL) - { - char errmsg[128]; - read_string(audioSocket, errmsg, 128); - fprintf(stderr, "CTR failed to connect to AS: %s\n", errmsg); - ComCloseConn(audioSocket); - ComCloseConn(dataSocket); - audioSocket = -1; - return -1; - } - else - { - int flag = 1; - AudioRead((char*)&reply, sizeof(reply)); - shared->live += ntohl(reply.live); - shared->audioFormat = ntohl(reply.format); - shared->audioPara.encodeType = ntohl(reply.para.encodeType); - shared->audioPara.channels = ntohl(reply.para.channels); - shared->audioPara.samplesPerSecond = ntohl(reply.para.samplesPerSecond); - shared->audioPara.bytesPerSample = ntohl(reply.para.bytesPerSample); - shared->totalSamples = ntohl(reply.totalSamples); - - fprintf(stderr, "Audio: samples %d, sps %d, bps %d\n", - shared->totalSamples, shared->AFPara.samplesPerSecond, - shared->AFPara.bytesPerSample); - - SetAudioParameter(&shared->audioPara); - } - - /* create AB */ - { - switch (ABpid = fork()) - { - case -1: - perror("CTR error on forking AB process"); - exit(1); - break; - case 0: - if (realTimeFlag) { - SetRTpriority("AB", -1); - } - free(vh); - free(vf); - free(ah); - free(af); - ComCloseFd(audioSocket); - if (videoSocket >= 0) - ComCloseFd(videoSocket); - VBdeleteBuf(); - VDdeleteBuf(); - if (cmdSocket >= 0) - close(cmdSocket); - if (realTimeFlag >= 2) { -#ifdef __svr4__ - if (SetRTpriority("AB", 0)) realTimeFlag = 0; -#elif defined(_HPUX_SOURCE) - if (SetRTpriority("AB", 1)) realTimeFlag = 0; -#endif - } - ABprocess(dataSocket); - break; - default: - ComCloseFd(dataSocket); - ABflushBuf(0); - break; - } - } - } - return 0; -} - -static void set_speed(void) -{ - int val; - if (shared->live) { - shared->speedPosition = 50; - } - val = shared->speedPosition; - if (val == 0) - val = 1; - if (shared->cmd == CmdPLAY && audioSocket >= 0 && videoSocket >= 0 && rtplay) { - /* limit audio signal period to no more than 1.0 seconds, because AudioFile - will block if one send more than 4 seconds of sample ahead of current - time. and our timing control is not precise. - */ - double s = ((1.0 / shared->pictureRate) * 50.0) * - (double)max(shared->config.framesPerAudioPlay, 1) / 1.0; - if (s > 50.0) { - fprintf(stderr, "CTR warning: lower value of parameter framesPerAudioPlay,\n"); - fprintf(stderr, " otherwise the Player may not work properly.\n"); - } - if (val < s) { - if (shared->config.verbose) { - if (val < s * 1.0 / 2.0) { - val = (int)s; - fprintf(stderr, "CTR warning: speed too low, set to %d scale val.\n", val); - } - else { - fprintf(stderr, "CTR warning: audio signal period %3.2f > 1 sec.\n", - 1.0 * (float)s / (float) val); - fprintf(stderr, " lower framesPerAudioPlay or increase speed.\n"); - } - } - else { - val = (int)s; - } - } - } - if (videoSocket >= 0) - { - float fps; - if (val <= 50) - fps = shared->pictureRate * (float)val / 50.0; - else - { - float rate = shared->config.maxFPS - shared->pictureRate; - fps = shared->pictureRate + (float)rate * (float)(val - 50) / 50.0; - /* only B frames are to be dropped */ - } - Fprintf(stderr, "Play speed video %5.1ffps\n", fps); - shared->framesPerSecond = (int)fps; - shared->usecPerFrame = (int) (1000000.0/fps); - if (audioSocket >= 0) - { - float sps = shared->audioPara.samplesPerSecond * fps / shared->pictureRate; - shared->samplesPerSecond = (int)sps; - shared->usecPerSample = (int)(1000000.0/sps); - } - } - else if (audioSocket >= 0) - { - float sps; - if (val <= 50) - sps = (float)shared->audioPara.samplesPerSecond * (float)val / 50.0; - else - { - int rate = shared->config.maxSPS - shared->audioPara.samplesPerSecond; - sps = shared->audioPara.samplesPerSecond + (float)rate * (float)(val - 50) / 50.0; - } - Fprintf(stderr, "Play speed audio %5.1fsps\n", sps); - shared->samplesPerSecond = (int)sps; - shared->usecPerSample = (int)(1000000.0/sps); - } -} - -static void init() -{ - int i, j; - - /* try to stop and close previous playing */ - if (audioSocket >= 0 || videoSocket >= 0) - { - unsigned char tmp = CmdCLOSE; - stop_playing(); - - if (audioSocket >= 0) - { - if (ABpid > 0) { - kill(ABpid, SIGUSR1); - ABpid = -1; - } - usleep(10000); - AudioWrite(&tmp, 1); - ComCloseConn(audioSocket); - audioSocket = -1; - } - - if (videoSocket >= 0) - { - if (VBpid > 0) { - kill(VBpid, SIGUSR1); - VBpid = -1; - } - usleep(10000); - VideoWrite(&tmp, 1); - ComCloseConn(videoSocket); - videoSocket = -1; - while ((!VBbufEmpty()) || !VDbufEmpty()) { - while (VDpeekMsg() != NULL) { - VDreclaimMsg(VDgetMsg()); - } - usleep(10000); - } - usleep(10000); - } - } - - /* read in video/audio files */ - NewCmd(CmdINIT); - CmdRead((char*)&i, 4); - CmdRead(vh, i); - vh[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(vf, i); - vf[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(ah, i); - ah[i] = 0; - CmdRead((char*)&i, 4); - CmdRead(af, i); - af[i] = 0; - /* - fprintf(stderr, "INIT: vh-%s, vf-%s, ah-%s, af-%s\n", vh, vf, ah, af); - */ - - shared->live = 0; - shared->audioMaxPktSize = !shared->config.audioConn; - shared->videoMaxPktSize = !shared->config.videoConn; - - if (af[0] != 0) - { - if (InitAudioChannel(ah, af)) - { - audioSocket = -1; - shared->totalSamples = 0; - } - else - { - shared->nextSample = 0; - if (shared->config.maxSPS < shared->audioPara.samplesPerSecond) - shared->config.maxSPS < shared->audioPara.samplesPerSecond; - } - } - else - { - shared->totalSamples = 0; - audioSocket = -1; - } - if (vf[0] != 0) - { - if (InitVideoChannel(vh, vf)) - { - shared->totalFrames = 0; /* disable video channel */ - videoSocket = -1; - } - else - { - shared->nextFrame = 1; - shared->nextGroup = 0; - shared->currentFrame = shared->currentGroup = shared->currentDisplay = 0; - if (shared->config.maxFPS < shared->framesPerSecond) - shared->config.maxFPS = shared->framesPerSecond; - } - } - else - { - videoSocket = -1; - shared->totalFrames = 0; /* disable video channel */ - } - if (audioSocket < 0 && videoSocket < 0) /* none of video/audio channels is setup */ - { - unsigned char tmp = CmdFAIL; - CmdWrite(&tmp, 1); - /* - fprintf(stderr, "CTR initialization failed.\n"); - */ - return; - } - else - { - unsigned char tmp = CmdDONE; - set_speed(); - if (videoSocket >= 0) - wait_display(); - CmdWrite(&tmp, 1); - if (videoSocket < 0) - { - tmp = CmdVPclearScreen; - CmdWrite(&tmp, 1); - } - return; - } -} - -static void stop(void) -{ -#ifdef STAT - unsigned char preCmd = shared->cmd; -#endif - unsigned char tmp = CmdDONE; - /* - fprintf(stderr, "CTR: STOP . . .\n"); - */ - stop_playing(); - - if (shared->live && videoSocket >= 0) { - Fprintf(stderr, "CTR live video stat: average disp frame rate: %5.2f fps\n", - shared->pictureRate * displayedFrames / shared->nextFrame); - } - CmdWrite(&tmp, 1); - -#ifdef STAT - if (shared->collectStat && preCmd == CmdPLAY && videoSocket >= 0) - { - int i; - int count = 0; - char ch; - char buf[100]; - FILE *fp; - - for (;;) - { - sprintf(buf, "stat.%02d", count++); - if (access(buf, 0)) - break; - if (count > 10000) - { - fprintf(stderr, "CTR generating stat file, weired thing happened.\n"); - exit(1); - } - } - fprintf(stderr, "Statistics is being collected to file %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, vf); - 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", shared->patternSize, shared->pattern); - shared->pattern[shared->patternSize] = 'I'; - - fprintf(fp, "\nStartPlayRoundTripDelay: %d (millisec)\n", - shared->playRoundTripDelay); - fprintf(fp, "VBmaxBytes: %d\nVBdroppedFrames: %d\n", - shared->stat.VBmaxBytes, shared->stat.VBdroppedFrames); - fprintf(fp, "VBemptyTimes: %d\nVDlastFrameDecoded: %d\n", - shared->stat.VBemptyTimes, shared->stat.VDlastFrameDecoded); - - fprintf(fp, "\nVDframesDroppedWithoutReference: %d\n", - shared->stat.VDnoRef); - fprintf(fp, "VDframesDroppedAgainstSendPattern: %d\n", - shared->stat.VDagainstSendPattern); - fprintf(fp, "VDIframesDroppedTooLate: %d\n", - shared->stat.VDtooLateI); - fprintf(fp, "VDPframesDroppedTooLate: %d\n", - shared->stat.VDtooLateP); - fprintf(fp, "VDBframesDroppedTooLate: %d\n", - shared->stat.VDtooLateB); - - fprintf(fp, "CTRframesDisplayedOnTime: %d\n", shared->stat.CTRdispOnTime); - fprintf(fp, "CTRframesDisplayedLate: %d\n", shared->stat.CTRdispLate); - fprintf(fp, "CTRframesDroppedOutOrder: %d\n", shared->stat.CTRdropOutOrder); - fprintf(fp, "CTRframesDroppedLate: %d\n", shared->stat.CTRdropLate); - - fprintf(fp, -"\nSpeedChangeHistory:\n(frameId, UPF, FPS, frameRateLimit, frames, dropped):\n"); - for (i = 0; i < min(speedPtr, SPEEDHIST_SIZE); i ++) - fprintf(fp, "%-4d %-6d %6.2f %6.2f %-4d %d\n", - speedHistory[i].frameId, speedHistory[i].usecPerFrame, - 1000000.0 / (double)speedHistory[i].usecPerFrame, - speedHistory[i].frameRateLimit, - speedHistory[i].frames, speedHistory[i].framesDropped); - if (speedPtr > SPEEDHIST_SIZE) - fprintf(fp, "Actual speed change times: %d (>%d)\n", - speedPtr, SPEEDHIST_SIZE); - - fprintf(fp, "\nVDbufferFillLevel:\n(frames, times):\n"); - for (i = 0; i < MAX_VDQUEUE_SIZE; i ++) { - if (shared->stat.VDqueue[i]) { - fprintf(fp, "%-6d %d\n", i, shared->stat.VDqueue[i]); - } - } - - fprintf(fp, "\nVBmessageGap:\n(width, times):\n"); - { - for (i = 0; i <= MSGGAP_MAX - MSGGAP_MIN; i ++) { - if (shared->stat.VBmsgGaps[i]) { - fprintf(fp, "%-6d %d\n", i + MSGGAP_MIN, shared->stat.VBmsgGaps[i]); - } - } - } - - if (shared->stat.fbPacketNumber > 0) - { - fprintf(fp, -"\nFeedbackPackets:\n(fId,addUPF,addf,rateLimit,frames,fdropped,advance):\n"); - for (i = 0; i < min(shared->stat.fbPacketNumber, MAX_FB_PACKETS); i++) - fprintf(fp, "%-6d %-6d %-6d %6.2f %4d %4d %d\n", - shared->stat.fbPackets[i].frameId, - shared->stat.fbPackets[i].addUsecPerFrame, - shared->stat.fbPackets[i].addFrames, - shared->stat.fbPackets[i].frameRateLimit, - shared->stat.fbPackets[i].frames, - shared->stat.fbPackets[i].framesDropped, - shared->stat.fbPackets[i].advance); - if (shared->stat.fbPacketNumber > MAX_FB_PACKETS) - fprintf(fp, "Actual # of FB packets: %d\n", shared->stat.fbPacketNumber); - } - - ch = CmdSTATsent; - VideoWrite(&ch, 1); - fprintf(fp, "\n\nVSFramesSent:\n "); - for (i = 0; i < 8; i++) - fprintf(fp, "%-10d", i * 10); - fprintf(fp, "\n -----------------------------------------------------"); - count = 0; - for (i = 0; i < (shared->totalFrames + 7)/8; i ++) - { - int j; - VideoRead(&ch, 1); - if (i % 10 == 0) - fprintf(fp, "\n%5d: ", i * 8); - for (j = 0; j < 8; j++) - { - if (ch & (1 << j)) - { - count ++; - fputc('x', fp); - } - else - fputc('-', fp); - } - } - fprintf(fp, "\nVSTotalFramesSent: %d\n", count); - fprintf(fp, "\nVBFramesReceived:\n "); - for (i = 0; i < 8; i++) - fprintf(fp, "%-10d", i * 10); - fprintf(fp, "\n -----------------------------------------------------"); - count = 0; - for (i = 0; i < (shared->totalFrames + 7)/8; i ++) - { - int j; - if (i % 10 == 0) - fprintf(fp, "\n%5d: ", i * 8); - for (j = 0; j < 8; j++) - { - if (shared->stat.VBframesReceived[i] & (1 << j)) - { - count ++; - fputc('x', fp); - } - else - fputc('-', fp); - } - } - fprintf(fp, "\nVBTotalFramesReceived: %d\n", count); - fprintf(fp, "\nVDFramesDecoded:\n "); - for (i = 0; i < 8; i++) - fprintf(fp, "%-10d", i * 10); - fprintf(fp, "\n -----------------------------------------------------"); - count = 0; - for (i = 0; i < (shared->totalFrames + 7)/8; i ++) - { - int j; - if (i % 10 == 0) - fprintf(fp, "\n%5d: ", i * 8); - for (j = 0; j < 8; j++) - { - if (shared->stat.VDframesDecoded[i] & (1 << j)) - { - count ++; - fputc('x', fp); - } - else - fputc('-', fp); - } - } - fprintf(fp, "\nVDTotalFramesDecoded: %d\n", count); - fprintf(fp, "\nVPFramesDisplayed:\n "); - for (i = 0; i < 8; i++) - fprintf(fp, "%-10d", i * 10); - fprintf(fp, "\n -----------------------------------------------------"); - count = 0; - for (i = 0; i < (shared->totalFrames + 7)/8; i ++) - { - int j; - if (i % 10 == 0) - fprintf(fp, "\n%5d: ", i * 8); - for (j = 0; j < 8; j++) - { - if (shared->stat.VPframesDisplayed[i] & (1 << j)) - { - count ++; - fputc('x', fp); - } - else - fputc('-', fp); - } - } - fprintf(fp, "\nVPTotalFramesDisplayed: %d\n", count); - - fprintf(fp, "\nVBBufferFillLevelHistory:\n "); - for (i = 0; i < 10; i ++) - fprintf(fp, "%-7d", i); - fprintf(fp, "\n -----------------------------------------------------"); - for (i = 0; i < shared->totalFrames; i++) - { - if (i % 10 == 0) - fprintf(fp, "\n%5d: ", i / 10); - if (shared->stat.VBfillLevel[i] == SHRT_MIN) - fprintf(fp, "x "); - else - fprintf(fp, "%-7d", shared->stat.VBfillLevel[i]); - } - fprintf(fp, "\nHistoryEnd\n"); - fclose(fp); - fprintf(stderr, "Statistics collecting done.\n"); - } -#endif - - return; -} - -static void ff(void) -{ - unsigned char tmp; - FFpara para; - /* - fprintf(stderr, "CTR: FF . . .\n"); - */ - if (shared->live) { - beep(); - } - else { - stop_playing(); - if (shared->nextGroup < 0) - shared->nextGroup = 0; - if (videoSocket >= 0 && shared->nextGroup < shared->totalGroups) - { - NewCmd(CmdFF); - shared->needHeader = 0; - shared->framesPerSecond = shared->config.ffFPS / - shared->patternSize; - shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.ffFPS) * - shared->patternSize; - - shared->VStimeAdvance = - max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para.VStimeAdvance = htonl(shared->VStimeAdvance); - para.sn = htonl(shared->cmdsn); - para.nextGroup = htonl(shared->nextGroup); - para.usecPerFrame = htonl(shared->usecPerFrame); - para.framesPerSecond = htonl(shared->framesPerSecond); - tmp = CmdFF; - startTime = get_usec(); - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - start_timer(); - } - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return; -} - -static void fb(void) -{ - unsigned char tmp; - FFpara para; - /* - fprintf(stderr, "CTR: FB . . .\n"); - */ - if (shared->live) { - beep(); - } - else { - stop_playing(); - if (shared->nextGroup >= shared->totalGroups) - shared->nextGroup = shared->totalGroups - 1; - if (videoSocket >= 0 && shared->nextGroup >= 0) - { - NewCmd(CmdFB); - shared->needHeader = 0; - shared->framesPerSecond = shared->config.fbFPS / - shared->patternSize; - shared->usecPerFrame = (int)(1000000.0 / (float)shared->config.fbFPS) * - shared->patternSize; - - shared->VStimeAdvance = - max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para.VStimeAdvance = htonl(shared->VStimeAdvance); - para.sn = htonl(shared->cmdsn); - para.nextGroup = htonl(shared->nextGroup); - para.usecPerFrame = htonl(shared->usecPerFrame); - para.framesPerSecond = htonl(shared->framesPerSecond); - tmp = CmdFB; - startTime = get_usec(); - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - start_timer(); - } - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return; -} - -static void step() -{ - unsigned char tmp; - STEPpara para; - stop_playing(); - NewCmd(CmdSTEP); - if (videoSocket >= 0 && shared->nextFrame <= shared->totalFrames) - { /* when shared->nextFrame == shared->totalFrame, it will force VS to send a ENDSEQ, - to let VD give out the remaining frame in its ring[] buffer */ - para.sn = htonl(shared->cmdsn); - para.nextFrame = htonl(shared->nextFrame); - /* - fprintf(stderr, "CTR: STEP . . . frame-%d\n", para.nextFrame); - */ - tmp = CmdSTEP; - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - wait_display(); - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return; -} - -static void play(int auto_exp) -{ - unsigned char tmp; - unsigned ats, vts; - int cmdstarted = 0; - int stuffsamples = 0; - /* - fprintf(stderr, "CTR: PLAY . . .\n"); - */ - stop_playing(); - - if (!shared->live && !shared->config.rt && videoSocket >= 0) { - /* rtplay turned off only when video avaible and not want RT play */ - rtplay = 0; - fprintf(stderr, "VCR is not playing at in realtime mode, audio disabled\n"); - } - else { - rtplay = 1; - } - - if (shared->live) { - rtplay = 1; - shared->nextFrame = 0; - shared->nextSample = 0; - } - - shared->rtplay = rtplay; - - if (shared->nextFrame < 0) - shared->nextFrame = 0; - else if (shared->nextFrame >= shared->totalFrames) - shared->nextFrame = shared->totalFrames - 1; - - if (audioSocket >= 0 && shared->nextSample < shared->totalSamples && rtplay) - { - PLAYaudioPara para; - if (cmdstarted == 0) - { - NewCmd(CmdPLAY); - if (!auto_exp) set_speed(); - cmdstarted = 1; - } - - if (videoSocket >= 0 && rtplay && !shared->live) { - /* video channel also active, recompute nextSample */ - shared->nextSample =(int) ((double)shared->audioPara.samplesPerSecond * - ((double)shared->nextFrame / shared->pictureRate)); - shared->nextSample += shared->config.audioOffset; - if (shared->nextSample < 0) { - stuffsamples = (- shared->nextSample); - shared->nextSample = 0; - } - else if (shared->nextSample >= shared->totalSamples) - shared->nextSample = shared->totalSamples - 1; - } - - ABflushBuf(shared->nextSample); - - para.sn = htonl(shared->cmdsn); - para.nextSample = htonl(shared->nextSample); - para.samplesPerSecond = htonl(shared->samplesPerSecond); - para.samplesPerPacket = htonl(1024 / shared->audioPara.bytesPerSample); - para.ABsamples = htonl(AB_BUF_SIZE / shared->audioPara.bytesPerSample); - para.spslimit = htonl(32000); - - startTime = get_usec(); - tmp = CmdPLAY; - AudioWrite(&tmp, 1); - AudioWrite(¶, sizeof(para)); - read_int(audioSocket, (int *)&ats); - } - - if (videoSocket >= 0 && shared->nextFrame < shared->totalFrames) - { - PLAYpara para; - if (cmdstarted == 0) - { - NewCmd(CmdPLAY); - if (!auto_exp) set_speed(); - cmdstarted = 1; - } - shared->VBheadFrame = -1; - shared->needHeader = 0; - { - int i = shared->config.maxSPframes; - i = (int) ((double)i * (1000000.0 / (double)shared->usecPerFrame) / - shared->pictureRate); - shared->sendPatternGops = max(min(i, PATTERN_SIZE) / shared->patternSize, 1); - } - cmdstarted = 1; -#ifdef STAT - shared->collectStat = (shared->config.collectStat && (!shared->live)); - if (shared->collectStat) - { - int i; - memset(&(shared->stat), 0, sizeof(shared->stat)); - shared->stat.VDlastFrameDecoded = (unsigned)-1; - for (i = 0; i < MAX_FRAMES; i++) - shared->stat.VBfillLevel[i] = SHRT_MIN; - speedPtr = 0; - } -#endif - shared->VStimeAdvance = - max(shared->config.VStimeAdvance, DEFAULT_VStimeAdvance) * 1000; - if (shared->VStimeAdvance < shared->usecPerFrame) - shared->VStimeAdvance = shared->usecPerFrame; - - para.VStimeAdvance = htonl(shared->VStimeAdvance); - para.sn = htonl(shared->cmdsn); - para.nextFrame = htonl(shared->nextFrame); - para.usecPerFrame = htonl(shared->usecPerFrame); - para.framesPerSecond = htonl(shared->framesPerSecond); - para.collectStat = htonl(shared->collectStat); - frate = shared->config.frameRateLimit; - if (frate <= 0.0) { - frate = 1.0; - } - shared->frameRateLimit = frate; - para.frameRateLimit1000 = - htonl((long)(shared->frameRateLimit * 1000.0)); - compute_sendPattern(); - para.sendPatternGops = htonl(shared->sendPatternGops); - memcpy(para.sendPattern, shared->sendPattern, PATTERN_SIZE); - startTime = get_usec(); - tmp = CmdPLAY; - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - read_int(videoSocket, (int *)&vts); - - if (shared->config.qosEffective) { - /* - fprintf(stderr, "CTR start FeedBack with init frameRateLimit %lf\n", - frate); - */ - maxfr = frate; /* max frame rate all the time during one playback */ - minupf = (int) (1000000.0 / maxfr); /* min usec-per-frame all the time - during one playback */ - maxrate = (double)minupf / (double)max(shared->usecPerFrame, minupf); - /* this is current max frame rate in percentage against 'maxfr', - current max frame rate is the lower of 'maxfr' and play speed */ - frate = 1.0; /* current sending frame rate, in percentage against 'maxfr' - This value is set with init value as 1.0, so that if current - speed is lower than frameRateLimit, no frames are dropped, - then when play speed increases frame rate will increase - accordingly until frames are dropped*/ - adjstep = ((double)minupf / (double)shared->usecPerFrame) / - (double)max(shared->patternSize * shared->sendPatternGops, 5); - /* adjust step for current play speed, in percentage against - 'maxfr' */ - - fbstate = 1; - fb_startup = 1; - - /* - fprintf(stderr, "CTR init frate: %lf minupf %d, shared->upf %d\n", - frate, minupf, shared->usecPerFrame); - */ - } - } - - if (shared->live && (videoSocket >= 0) && (audioSocket >= 0)) { - int gap = get_duration(ats, vts); - if (gap < 0 || gap >= 5000000) { - Fprintf(stderr, "Error for live source: ats %u, vts %u, gap %d\n", - ats, vts, gap); - } - else { - int skipped = gap * shared->audioPara.samplesPerSecond / 1000000; - skipped += shared->config.audioOffset; - ABskipSamples(skipped); - Fprintf(stderr, "Live source: skipped %d audio samples\n", skipped); - } - } - else if (stuffsamples) { - ABskipSamples(-stuffsamples); - } - if (cmdstarted) - start_timer(); - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return; -} - -static void position_action(int operation_tag) -{ - int val; - unsigned char tmp = CmdDONE; - CmdRead((char*)&val, 4); - if (shared->live) { - beep(); - } - else { - shared->locationPosition = val; - stop_playing(); - NewCmd(CmdPOSITION); - if (videoSocket >= 0) - { - int gop = shared->nextGroup; - POSITIONpara para; - shared->nextGroup = ((shared->totalGroups-1) * val) / POSITION_RANGE; - /* - fprintf(stderr, "CTR: POSITION%s %d (nextGop %d). . .\n", - operation_tag ? "_released" : "", val, shared->nextGroup); - */ - if (gop != shared->nextGroup || operation_tag) - { - shared->nextFrame = ((shared->totalFrames-1) * val) / POSITION_RANGE; - para.sn = htonl(shared->cmdsn); - para.nextGroup = htonl(shared->nextGroup); - tmp = CmdPOSITION; - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - if (operation_tag) /* release or LOOPrewind */ - wait_display(); - } - if (operation_tag && audioSocket >= 0) /* needs to adjust audio position */ - { - shared->nextSample = (int)((double)shared->audioPara.samplesPerSecond * - ((double)shared->nextFrame / shared->pictureRate)); - } - } - else if (audioSocket >= 0) - shared->nextSample = (shared->totalSamples-1) * val / POSITION_RANGE; - } - tmp = CmdDONE; - CmdWrite(&tmp, 1); - return; -} - -static void position() -{ - position_action(0); -} - -static void position_release() -{ - position_action(1); -} - -static void volume() -{ - CmdRead((char *)&shared->volumePosition, 4); - if (audioSocket >= 0) { - SetAudioGain(); - } - /* - unsigned char tmp = CmdDONE; - tmp = CmdDONE; - CmdWrite(&tmp, 1); - */ - return; -} - -static void balance() -{ - CmdRead((char *)&shared->balancePosition, 4); - /* - unsigned char tmp = CmdDONE; - tmp = CmdDONE; - CmdWrite(&tmp, 1); - */ - return; -} - -static void speed(void) -{ - unsigned char tmp; - CmdRead((char *)&shared->speedPosition, 4); - set_speed(); - if (!shared->live && shared->cmd == CmdPLAY) - { - if (videoSocket >= 0) { - SPEEDpara para; - para.sn = htonl(shared->cmdsn); - para.usecPerFrame = htonl(shared->usecPerFrame); - para.framesPerSecond = htonl(shared->framesPerSecond); - para.frameRateLimit1000 = - htonl((long)(shared->frameRateLimit * 1000.0)); - { - int i = shared->config.maxSPframes; - i = (int) ((double)i * (1000000.0 / (double)shared->usecPerFrame) / - shared->pictureRate); - shared->sendPatternGops = max(min(i, PATTERN_SIZE) / shared->patternSize, 1); - } - compute_sendPattern(); - para.sendPatternGops = htonl(shared->sendPatternGops); - memcpy(para.sendPattern, shared->sendPattern, PATTERN_SIZE); - tmp = CmdSPEED; - VideoWrite(&tmp, 1); - VideoWrite(¶, sizeof(para)); - if (fbstate) { - maxrate = (double)minupf / (double)max(shared->usecPerFrame, minupf); - adjstep = ((double)minupf / (double)shared->usecPerFrame) / - (double)max(shared->patternSize * shared->sendPatternGops, 5); - fbstate = 1; - } - } - if (audioSocket >= 0) { - SPEEDaudioPara para; - para.sn = htonl(shared->cmdsn); - para.samplesPerSecond = htonl(shared->samplesPerSecond); - para.samplesPerPacket = htonl(1024 / shared->audioPara.bytesPerSample); - para.spslimit = htonl(32000); - tmp = CmdSPEED; - AudioWrite(&tmp, 1); - AudioWrite(¶, sizeof(para)); - } - /* - timer_speed(); - */ - } - /* - tmp = CmdDONE; - CmdWrite(&tmp, 1); - */ - return; -} - -static int timer_on = 0; -static int timer_signals_skip = 0; -static int timerCount = 0; -static int lastCount = 0; -static int timerUPF; -static int wait_usr2 = 0; -static int last_disp_fid = 0; - -static void stop_playing(void) -{ - unsigned char precmd = shared->cmd; - - if (precmd == CmdFF || precmd == CmdFB || precmd == CmdPLAY) - { - - unsigned char tmp = CmdSTOP; - NewCmd(CmdSTOP); - - /* notify AS and/or VS */ - if (audioSocket >= 0 && precmd == CmdPLAY && rtplay) - { - int cmdsn = htonl(shared->cmdsn); - AudioWrite(&tmp, 1); - AudioWrite(&cmdsn, 4); - } - if (videoSocket >= 0) - { - // CORBA call - int cmdsn = htonl(shared->cmdsn); - VideoWrite(&tmp, 1); - VideoWrite(&cmdsn, 4); - } - - /* stop timer and sleep for a while */ - stop_timer(); - usleep(100000); - - /* purge VDbuf and audio channel from AS*/ - if (videoSocket >= 0) - { - while (VDpeekMsg() != NULL) - VDreclaimMsg(VDgetMsg()); - /* - Fprintf(stderr, "CTR: VDbuf purged.\n"); - */ - fbstate = 0; - - } - - /* adjust some info */ - if (precmd == CmdPLAY && videoSocket >= 0) - shared->nextFrame = shared->currentFrame+1; - else - shared->nextGroup = shared->currentGroup + 1; - } -} - -static void loopBack(void) -{ - static char loopBackCmd[7] = {CmdSTOP, CmdPOSITIONrelease, - 0, 0, 0, 0, CmdPLAY}; - cmdBuffer = loopBackCmd; - cmdBytes = 7; - cmdAcks = 3; -} - -void TimerHandler(int sig) -{ - int currentUPF = shared->currentUPF; - /* - Fprintf(stderr, "CTR in TimerHandler.\n"); - */ - if (videoSocket >= 0 && shared->cmd == CmdPLAY && currentUPF != timerUPF) - { - struct itimerval val; - { - val.it_interval.tv_sec = val.it_value.tv_sec = currentUPF / 1000000; - val.it_interval.tv_usec = val.it_value.tv_usec = currentUPF % 1000000; - setitimer(ITIMER_REAL, &val, NULL); - /* - fprintf(stderr, "CTR: timer speed changed to %d upf.\n", shared->currentUPF); - */ - } - timerUPF = currentUPF; -#ifdef STAT - if (shared->collectStat && speedPtr < SPEEDHIST_SIZE) - { - speedHistory[speedPtr].frameId = shared->nextFrame; - speedHistory[speedPtr].usecPerFrame = timerUPF; - speedHistory[speedPtr].frameRateLimit = shared->frameRateLimit; - speedHistory[speedPtr].frames = shared->sendPatternGops * shared->patternSize; - speedHistory[speedPtr].framesDropped = shared->framesDropped; - } - speedPtr ++; -#endif - } - /* - fprintf(stderr, "+\n"); - */ - if (!timerCount) { - int addedVSwat; - if (shared->cmd == CmdPLAY) { - addedVSwat = shared->usecPerFrame * (shared->VBheadFrame - shared->nextFrame); - } - else if (shared->cmd == CmdFF) { - addedVSwat = shared->usecPerFrame * (shared->VBheadFrame - shared->nextGroup); - } - else { /* shared->cmd == CmdFB */ - addedVSwat = shared->usecPerFrame * (shared->nextGroup - shared->VBheadFrame); - } - shared->VStimeAdvance += addedVSwat; - } - timerCount += timer_signals_skip + 1; - timer_signals_skip = 0; - - if (shared->live ) { - if (audioSocket <= 0) { /* video only */ - unsigned t = shared->VBheadFrame - startVSA; - if (timerCount < t) { - /* - Fprintf(stderr, "CTR: (av) timerCount %d, t %d\n", timerCount, t); - */ - timerCount = t; - } - } - /* audio involved, TimerProcessing() will adjust the rate automatically */ - } -} - -static void DisplayPicture(void) -{ - int toDisplay = 1; - int count = timerCount; - - if ((shared->cmd != CmdPLAY && - shared->cmd != CmdFF && - shared->cmd != CmdFB) || - lastCount == count) - return; - if (timer_on >4) /* 4 is a magic number */ - { - stop_timer(); - - /* tries to rewind and play again */ - if (shared->cmd == CmdPLAY && shared->loopBack) - loopBack(); - - return; - } - /* - Fprintf(stderr, "CTR in diplayPicture().\n"); - */ - { - int i, j; - FrameBlock *buf, *next; -#if 0 - if (shared->cmd == CmdPLAY && rtplay && - (i = shared->nextFrame - shared->firstGopFrames) > 0) { - j = (i / shared->patternSize) % shared->sendPatternGops; - i %= shared->patternSize; - if (shared->pattern[i] != 'B') { - while (i > 0) { - if (shared->pattern[--i] != 'B') break; - } - } - toDisplay = (shared->sendPattern + j * shared->patternSize)[i]; - } - else if (shared->cmd != CmdPLAY) { - if (last_disp_fid != shared->nextGroup) toDisplay = 1; - else toDisplay = 0; - } - if (toDisplay) -#endif - { - if (shared->cmd == CmdPLAY && !rtplay) { /* if play with best effort */ - while (VDcheckMsg() <= 0) /* keep sleeping for 10 millisec until a decoded - frame show up in VD buffer */ - usleep(10000); - } -#ifdef STAT - if (shared->collectStat) - { - shared->stat.VBfillLevel[shared->nextFrame] = - shared->VBheadFrame - shared->nextFrame; - i = VDcheckMsg(); - if (i < 0) i = 0; - else if (i >= MAX_VDQUEUE_SIZE) i = MAX_VDQUEUE_SIZE - 1; - shared->stat.VDqueue[i] ++; - } -#endif - toDisplay = 0; - for (;;) - { - buf = VDpeekMsg(); - - if (buf == NULL) { - goto loop_end; - } - - switch (shared->cmd) - { - int position; - case CmdPLAY: - position = shared->nextFrame; - /* - Fprintf(stderr, "CTR PLAY: buf->display %d, position %d\n", - buf->display, position); - */ - if (buf->display == position) - { /* display it */ - buf = VDgetMsg(); - shared->nextGroup = buf->gop + 1; -#ifdef STAT - shared->stat.CTRdispOnTime ++; -#endif - goto display_picture; - } - else if (buf->display > position) - { /* too early, wait for future display */ - goto loop_end; - } - else /* this picture too late */ - { - // this line gets the buffer or dequeues from the shared memory queue - buf = VDgetMsg(); - if (((next = VDpeekMsg()) == NULL || next->display > position) && - buf->display > last_disp_fid) { -#ifdef STAT - shared->stat.CTRdispLate ++; -#endif - /* buf is the last one, or next too to early, display it anyway */ - goto display_picture; - } - else /* next not too early, discard buf */ - { -#ifdef STAT - if (buf->display < last_disp_fid) - shared->stat.CTRdropOutOrder ++; - else - shared->stat.CTRdropLate ++; -#endif - /* - Fprintf(stderr, "CTR drops frame display=%d, shared->nextFrame=%d\n", - buf->display, shared->nextFrame); - */ - VDreclaimMsg(buf); - continue; - } - } - break; - case CmdFF: - position = shared->nextGroup; - if (buf->gop == position) - { /* display it */ - buf = VDgetMsg(); - shared->nextFrame = buf->display; - goto display_picture; - } - else if (buf->gop > position) - { /* hold it for future display */ - goto loop_end; - } - else /* discard late picture */ - { - buf = VDgetMsg(); - if ((next = VDpeekMsg()) == NULL || next->gop > position) - /* buf is the last one, or next too to early, display it anyway */ - goto display_picture; - else /* next not too early, discard buf */ - { - VDreclaimMsg(buf); - continue; - } - } - break; - case CmdFB: - position = shared->nextGroup; - if (buf->gop == position) - { /* display it */ - buf = VDgetMsg(); - shared->nextFrame = buf->display; - goto display_picture; - } - else if (buf->gop < position) - { /* hold it for future display */ - goto loop_end; - } - else /* discard late picture */ - { - buf = VDgetMsg(); - if ((next = VDpeekMsg()) == NULL || next->gop < position) - /* buf is the last one, or next too to early, display it anyway */ - goto display_picture; - else /* next not too early, discard buf */ - { - VDreclaimMsg(buf); - continue; - } - } - break; - default: - goto loop_end; - } - } - display_picture: - toDisplay = 1; - if (shared->cmd == CmdPLAY) last_disp_fid = buf->display; - else last_disp_fid = buf->gop; -#ifdef STAT - if (shared->live) displayedFrames ++; - if (shared->collectStat) - shared->stat.VPframesDisplayed[buf->display >> 3] |= 1 << (buf->display % 8); -#endif - { - unsigned char tmp = CmdVPdisplayFrame; - CmdWrite(&tmp, 1); - } - CmdWrite((unsigned char *)&buf, sizeof(char *)); - loop_end:; - } - } - - if (shared->cmd == CmdPLAY) - { - shared->nextFrame += rtplay ? count - lastCount : 1; - if (shared->nextFrame >= shared->totalFrames) - { - timer_on ++; - shared->nextFrame = shared->totalFrames; - } - - /* following is frameRate feedback algorithm */ - if (fbstate && toDisplay && rtplay) { - static Filter *fr = NULL; /* frame-rate filter */ - static int start; /* feedback action time, in microseconds */ - static int delay; /* time to delay after each action, and to charge - the filter after action-delay */ - static int pretime; /* time of previous frame, in microseconds */ - static int throw_outlier = 0; - /* tag to throw away outlier. In case there are outliers, this - tag is flipped by the algorithm, so that If there are two - consecutive sample deviating very much from the filtered mean - value, the second is not considered outlier. This may mean - that the frame rate has dropped significantly. */ - static double vr; /* filtered frame-rate value, in microseconds/frame */ - double r, nr; - int t = get_usec(); - - switch (fbstate) { - case 3: /* working, monitoring */ - { - int interval = get_duration(pretime, t); - if (throw_outlier) { - if (interval >> 2 >= vr) { - /* at least four times the filtered mean value to be - considered outlier */ - /* In case an outlier is detected and thrown away, then - the following sample will never be classified as an - outlier, and the current time is recorded */ - throw_outlier = 0; - pretime = t; - Fprintf(stderr, "CTR detected a gap %d (vr = %d) us\n", - interval, (int)vr); - break; - } - } - else { - throw_outlier = 1; - } - vr = DoFilter(fr, (double)interval); - } - pretime = t; - - r = minupf / vr; /* convert the display fps to percentage of maxfr */ - - nr = 0; /* This variable contains the newly computed server frame rate */ - - /* let nr oscillate around 1.5 ~ 2.5 */ - if (min(frate, maxrate) - r >= 3.0 * adjstep) { - /* pipeline is considered overloaded if server fps is more than 3 adjsteps - higher than display fps */ - nr = min(frate, maxrate) - adjstep; /* slow down server frame rate - one step */ - if (fb_startup) { /* startup feedback action: jump set the server fps - to a value close to actually measure display - frame rate */ - fb_startup = 0; - while (nr >= r + 2.5 * adjstep) { - nr -= adjstep; - } - } - } - else if (frate - r <= 0.5 * adjstep && frate < maxrate) { - /* pipeline load is considered too light if the server frame rate - is less than 0.5fps higher than display frame rate, while the server - fps is no maximum yet. The server fps then is stepped up. */ - nr = min(frate + adjstep, maxrate); - } - if (nr > 0) { /* nr = 0 if not feedback action needs to be taken */ - shared->frameRateLimit = maxfr * nr; - compute_sendPattern(); - /* - fprintf(stderr, - "CTR adjust frameRate to %lf, vr=%lf minupf=%d, r=%lf, frate=%lf, nr=%lf\n", - shared->frameRateLimit, vr, minupf, r, frate, nr); - */ - frate = nr; /* remember new server frame rate */ - shared->qosRecomputes ++; - start = t; /* remember the action time */ - /* delay for some time before restarts, to let feedback take effect */ - delay = shared->usecPerFrame * (shared->VBheadFrame - shared->nextFrame) + - shared->playRoundTripDelay; - if (delay < 0) delay = shared->usecPerFrame; - fbstate = 4; - } - break; - case 4: /* delay and reset after action*/ - if (get_duration(start, t) >= delay) { - /* - fprintf(stderr, - "CTR VB from s2 to s3, vr %lf, frate %lf, maxrate %lf, step %lf\n", - vr, frate, maxrate, adjstep); - */ - fr = ResetFilter(fr, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - delay = shared->usecPerFrame * - max(shared->sendPatternGops * shared->patternSize, - shared->config.filterPara); - /* charge filter for time */ - start = pretime = t; - throw_outlier = 0; - fbstate = 2; - } - break; - case 2: /* charge the filter */ - { - int interval = get_duration(pretime, t); - if (throw_outlier) { - if (interval >> 2 >= vr) { /* at least four times the previous average */ - throw_outlier = 0; - pretime = t; - Fprintf(stderr, "CTR detected a gap %d (vr = %d) us\n", - interval, (int)vr); - break; - } - } - else { - throw_outlier = 1; - } - vr = DoFilter(fr, (double)interval); - } - pretime = t; - if (get_duration(start, t) >= delay) { - /* - fprintf(stderr, - "CTR VB from s2 to s3, vr %lf, frate %lf, maxrate %lf, step %lf\n", - vr, frate, maxrate, adjstep); - */ - fbstate = 3; - } - break; - case 1: /* start or speed change, wait until speed data consistant */ - if (shared->currentUPF == shared->usecPerFrame) { - if (fr == NULL) { - fr = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - else { - fr = ResetFilter(fr, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - if (fr == NULL) { - perror("CTR failed to allocate space for fr filter"); - fbstate = 0; - } - vr = DoFilter(fr, (double)shared->usecPerFrame); - delay = shared->usecPerFrame * - shared->sendPatternGops * shared->patternSize; - /* charge filter for some time */ - pretime = start = t; - throw_outlier = 0; - fbstate = 2; - } - break; - default: - fprintf(stderr, "CTR error: unknown feedback state: %d\n", fbstate); - fbstate = 1; - break; - } - } - /* end of frame rate control algorithm */ - - } - else if (shared->cmd == CmdFF) - { - shared->nextGroup += count - lastCount; - if (shared->nextGroup >= shared->totalGroups) - { - timer_on ++; - shared->nextGroup = shared->totalGroups - 1; - } - } - else - { - shared->nextGroup -= count - lastCount; - if (shared->nextGroup < 0) - { - timer_on ++; - shared->nextGroup = 0; - } - } - lastCount = count; -} - -#define AUDIO_BUFSIZE 2048 - -static int audioCount = 0; -static int audioFirst = 0; -static int needAudioSkip = 0; -static int bufferedSamples; -static int nextASSample, startSample; -static unsigned int nextAFtime; -static int forward, forwardDelta; -static int audioForward, framesPerAudioPlay; -static int AudioBufSize; -static char * rawBuf = NULL, * workBuf = NULL, * convBuf = NULL; - -static void PlayAudioInit(void) -{ - audioCount = -1; - audioFirst = 1; - needAudioSkip = 0; - startSample = nextASSample = shared->nextSample; - audioForward = shared->config.audioForward; - framesPerAudioPlay = max(shared->config.framesPerAudioPlay, 1); - if (audioForward <= 0) - audioForward = DEFAULT_audioForward; - fprintf(stderr, "CTR audioForward: %d samples.\n", audioForward); - bufferedSamples = (int)(((double) - (shared->config.audioTimerDuration * - shared->config.audioBufferedIntervals)) - * (double)shared->audioPara.samplesPerSecond / 1000.0); - if (rawBuf == NULL) - { - if ((rawBuf = (char *)malloc(AUDIO_BUFSIZE)) == NULL) - { - perror("CTR fails to allocate rawBuf for audio channel"); - exit(1); - } - if ((workBuf = (char *)malloc(AUDIO_BUFSIZE)) == NULL) - { - perror("CTR fails to allocate workBuf for audio channel"); - exit(1); - } - } - AudioBufSize = (AUDIO_BUFSIZE / shared->audioPara.bytesPerSample) * - shared->audioPara.bytesPerSample; - - StartAudioPlaySession(); -} - -/* input the number of samples in the raw buffer, - returns the numberof samples in theconverted buffer */ -static int AudioConvert(int len) -{ - int convLen; - - if (shared->samplesPerSecond == shared->audioPara.samplesPerSecond) - { - convBuf = rawBuf; - return len; - } - - convBuf = workBuf; - convLen = len * shared->audioPara.samplesPerSecond / shared->samplesPerSecond; - AudioInterpolate(rawBuf, len, convBuf, convLen); - return convLen; -} - -static void PlayAudioOnly(void) -{ - int maxSize; - int size, csize; /* all in samples */ - unsigned int AFtime; - - if (audioFirst) - { - audioFirst = 0; - nextAFtime = GetAudioTime() + audioForward; - } - else - if ((int)(nextAFtime - GetAudioTime()) >= bufferedSamples) - return; - - if (timer_on >4) - { - stop_timer(); - - /* tries to rewind and play again */ - if (shared->loopBack) - { - /* - fprintf(stderr, "CTR: trying loopBack().\n"); - */ - loopBack(); - } - - return; - } - if (nextASSample >= shared->totalSamples) - { - timer_on ++; - return; - } - if (shared->samplesPerSecond >= shared->audioPara.samplesPerSecond) - maxSize = (AudioBufSize/shared->audioPara.bytesPerSample); - else - maxSize = ((AudioBufSize/shared->audioPara.bytesPerSample) * - shared->samplesPerSecond) / - shared->audioPara.samplesPerSecond; - for (;;) - { - size = ABgetSamples(rawBuf, maxSize); - csize = AudioConvert(size); - AFtime = PlayAudioSamples(nextAFtime, convBuf, csize); - nextASSample += size; - shared->nextSample += size; - nextAFtime += csize; - if ((int)(nextAFtime - AFtime) < 0) - nextAFtime = AFtime; - if (nextASSample >= shared->totalSamples) - { - timer_on ++; - break; - } - /* - Fprintf(stderr, "CTR: nextAFtime:%d, AFtime:%d, bufferedSamples:%d\n", - nextAFtime, AFtime, bufferedSamples); - */ - if ((int)(nextAFtime - AFtime) >= bufferedSamples) - break; - } - { - unsigned char tmp = CmdVPaudioPosition; - CmdWrite(&tmp, 1); - } -} - -/* returns: 0 - no forward calculated , 1 - forward calculated */ -static int PlayAudio(void) -{ - int timer_count = timerCount; - int i = timer_count / framesPerAudioPlay; - if (audioFirst) - { - audioFirst = 0; - nextAFtime = GetAudioTime() + audioForward;; - audioCount = -1; /* guarantee that PlayAudio do the first step */ - } - if (audioCount == i) /* current audio timer signal already processed */ - return 0; - if (audioCount < i - 1) /* some audio timer signal missing */ - { - needAudioSkip = 1; - /* - Fprintf(stderr, "CTR: some audio timer signal missed.\n"); - */ - } - if (nextASSample >= shared->totalSamples) - { - /* - timer_on ++; - */ - return 0; - } - - audioCount = i; - - if (needAudioSkip) - { - /* return if not enough skip can be done */ - int next_sample = (int)(startSample + - ((double)timer_count / shared->pictureRate) * - shared->audioPara.samplesPerSecond); - int skip_samples = next_sample - nextASSample; - ABskipSamples(skip_samples); - nextAFtime += (unsigned int)(((double)skip_samples * - (double)shared->audioPara.samplesPerSecond) / - (double)shared->samplesPerSecond); - nextASSample += skip_samples; - needAudioSkip = 0; - } - - /* read current block, convert, put to AF, and update nextAFtime */ - { - int frame_samples = (int)(startSample + - ((double)(timer_count + framesPerAudioPlay) / shared->pictureRate) * - (double)shared->audioPara.samplesPerSecond - - nextASSample); - int fsize = frame_samples * shared->audioPara.bytesPerSample; - int read_samples; - unsigned int curAFtime; - unsigned int oldAFtime = nextAFtime; - char * ptr = rawBuf; - if (fsize > AudioBufSize) - { /* make sure the rawBuf is big enough */ - Fprintf(stderr, "CTR PlayAudio error: BytesPerFrame=%d > AudioBufSize=%d.\n", - fsize, AudioBufSize); - Fprintf(stderr, - "CTR PlayAudio: startSample=%d, timer_count=%d, nextASSmple=%d.\n", - startSample, timer_count, nextASSample); - fprintf(stderr, "Internal error: audio resampling buffer not big enough,\n\ - please reduce value of parameter 'Audio timer interval',\n\ - or 'Audio buffered intervals' or Frames per audio play',\n\ - and try again.\n"); - exit(1); - } - - read_samples = ABgetSamples(ptr, frame_samples); - - /* convert and play to AF */ - { - int maxSamples; - int left_samples = read_samples; - if (shared->samplesPerSecond >= shared->audioPara.samplesPerSecond) - maxSamples = (AudioBufSize/shared->audioPara.bytesPerSample); - else - maxSamples = ((AudioBufSize/shared->audioPara.bytesPerSample) * - shared->samplesPerSecond) / - shared->audioPara.samplesPerSecond; - for (;;) - { - int samples = (left_samples > maxSamples) ? maxSamples : left_samples; - int convSamples = AudioConvert(samples); - curAFtime = PlayAudioSamples(nextAFtime, convBuf, convSamples); - nextAFtime += convSamples; - left_samples -= samples; - if (left_samples == 0) - break; - else - { - memcpy(rawBuf, rawBuf + samples * shared->audioPara.bytesPerSample, - left_samples * shared->audioPara.bytesPerSample); - } - } - } - - /* possible bugs in AF some times cause PlayAudioSample() to return 0 */ - forward = curAFtime ? (oldAFtime - curAFtime) : audioForward; - /* - if ((oldAFtime - curAFtime) > (audioForward << 6)) { - fprintf(stderr, "forward %d, oldAFtime %d, curAFtime %d\n", - oldAFtime - curAFtime, oldAFtime, curAFtime); - } - */ - /* check condition */ - if (read_samples == frame_samples) { /* all bytes for current frame already read */ - nextASSample += frame_samples; - } - else { /* read to the end of audio file */ - /* - timer_on ++; - */ - nextASSample += read_samples; - } - shared->nextSample = nextASSample; - } - return 1; -} - - -void TimerProcessing(void) -{ - if (audioSocket >= 0 && shared->cmd == CmdPLAY) - { - if (videoSocket < 0) - PlayAudioOnly(); - else if (rtplay) - { - int res = PlayAudio(); - /* and also tries to sync audio and video */ - if (res) - { - int jit; - res = forward - audioForward; - jit = (res>0 ? res : -res); - jit = (int)(((double)jit / (double)shared->samplesPerSecond) * 1000000.0); - if (res < -audioForward/2) /* needs to speedup the clock */ - { - struct itimerval val; - getitimer(ITIMER_REAL, &val); - if ((int)val.it_value.tv_usec > jit) - val.it_value.tv_usec -= jit; - else - { - timer_signals_skip ++; - val.it_value.tv_usec = 2; - } - setitimer(ITIMER_REAL, &val, NULL); - } - else if (res > audioForward) /* needs to slow down the clock */ - { - struct itimerval val; - /* - val.it_interval.tv_sec = val.it_value.tv_sec = 0; - val.it_interval.tv_usec = val.it_value.tv_usec = 0; - */ - getitimer(ITIMER_REAL, &val); - val.it_value.tv_usec += (jit % 1000000); - val.it_value.tv_sec += (jit / 1000000); - setitimer(ITIMER_REAL, &val, NULL); - } - /* - if (res < -audioForward || res > audioForward) - */ - if (res < -16000 || res > 16000) - { - Fprintf(stderr, "Audio forward jit %d samples\n", res); - } - } - } - } - if (videoSocket >= 0 && - (shared->cmd == CmdPLAY || shared->cmd == CmdFF || shared->cmd == CmdFB)) { - DisplayPicture(); - } -} - -#define MAX_WAIT_USEC 10000000 - -static void start_timer(void) -{ - struct itimerval val; - - if (audioSocket >= 0 && shared->cmd == CmdPLAY && rtplay) - PlayAudioInit(); - - /* sleep for a while to wait for decoding the first picture - and/or audio stream ready */ - { - unsigned val1 = startTime; - if (audioSocket >= 0 && shared->cmd == CmdPLAY && rtplay) - { - int samples = videoSocket >= 0 ? 1200 : 1200; - while (ABcheckSamples() <= samples) - { - if (get_duration(val1, get_usec()) >= MAX_WAIT_USEC) { - fprintf(stderr, "CTR warning: audio is not ready yet.\n"); - break; - } - else { - usleep(10000); - continue; - } - } - } - if (videoSocket >= 0) - { - while (VDcheckMsg() <= 0) { /* keep sleeping for 1 millisec until a decoded - frame show up in VD buffer */ - if (get_duration(val1, get_usec()) >= MAX_WAIT_USEC) { - fprintf(stderr, "CTR warning: video is not ready yet.\n"); - break; - } - usleep(10000); - } - } - val1 = get_duration(val1, get_usec()) / 1000; - shared->playRoundTripDelay = val1; - - Fprintf(stderr, "CTR: estimated play round trip delay: %d millisec.\n", val1); - - /* - if (shared->collectStat) - { - fprintf(stderr, "CTR: estimated play round trip delay: %d millisec.\n", val1); - } - */ - } - timer_on = 1; - timer_signals_skip = 0; - timerCount = 0; - lastCount = 0; - - if (shared->live) { - - /* delay for shared->config.VStimeAdvance milliseconds, adjustable delay */ - if (shared->config.VStimeAdvance > 0) { - Fprintf(stderr, "CTR adds %d millisec of latency\n", - shared->config.VStimeAdvance); - usleep(shared->config.VStimeAdvance * 1000); - } - displayedFrames = 0; - startTime = get_usec(); - startVSA = shared->nextFrame - shared->VBheadFrame; - if (startVSA < 5) startVSA = 5; - /* - Fprintf(stderr, "CTR: startVSA %d\n", startVSA); - */ - } - - if (shared->cmd == CmdPLAY && rtplay) { - wait_usr2 = 0; - } - else { - wait_usr2 = 1; - } - last_disp_fid = -1; - /* - fprintf(stderr, "CTR start_timer() - %s for usr2\n", - wait_usr2 ? "wait" : "NOwait"); - */ - if (shared->cmd == CmdPLAY && audioSocket >= 0 && videoSocket < 0) - timerUPF = shared->config.audioTimerDuration * 1000; - else { - timerUPF = shared->usecPerFrame; - } -#ifdef STAT - speedPtr = 1; - speedHistory[0].frameId = shared->nextFrame; - speedHistory[0].usecPerFrame = timerUPF; - speedHistory[0].frameRateLimit = shared->frameRateLimit; - speedHistory[0].frames = shared->sendPatternGops * shared->patternSize; - speedHistory[0].framesDropped = shared->framesDropped; -#endif - /* - fprintf(stderr, "CTR: timer started at %d upf.\n", timerUPF); - */ - val.it_interval.tv_sec = val.it_value.tv_sec = timerUPF / 1000000; - val.it_interval.tv_usec = val.it_value.tv_usec = timerUPF % 1000000; - // setsignal(SIGALRM, TimerHandler); - setitimer(ITIMER_REAL, &val, NULL); -} - -static void stop_timer(void) -{ - struct itimerval val; - - if (!timer_on) - return; - - timer_on = 0; - - // setsignal(SIGALRM, SIG_IGN); - - val.it_interval.tv_sec = val.it_value.tv_sec = 0; - val.it_interval.tv_usec = val.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &val, NULL); - /* - fprintf(stderr, "CTR: timer stopped.\n"); - */ - /* - usleep(200000); - */ -} - -static void timer_speed() -{ - /* - struct itimerval val; - if (timer_on && videoSocket >= 0 && - (shared->cmd == CmdPLAY || shared->cmd == CmdFF || shared->cmd == CmdFB)) - { - fprintf(stderr, "CTR: timer speed changed to %d upf.\n", shared->usecPerFrame); - val.it_interval.tv_sec = val.it_value.tv_sec = shared->usecPerFrame / 1000000; - val.it_interval.tv_usec = val.it_value.tv_usec = shared->usecPerFrame % 1000000; - setitimer(ITIMER_REAL, &val, NULL); - } - */ -} - -static void wait_display(void) -{ - if (!usr1_flag) { - if (shared->cmd == CmdINIT) usleep(5000000);// XXX hack to make the client wait until the server gets a chance. - else usleep(800000); - } - if (!usr1_flag) - { - if (shared->cmd == CmdSTEP) /* to skip undecodable pictures */ - shared->nextFrame ++; - else if (shared->cmd == CmdINIT) { - fprintf(stderr, "Warning: initialilzation failed. Please reinitialize the program.\n"); - } - return; - } - usr1_flag = 0; -} - -static void usr1_handler(int sig) -{ - FrameBlock *buf; - unsigned char tmp; - /* - Fprintf(stderr, "CTR got USR1 for displaying single frame.\n"); - */ - usr1_flag = 1; - - if (shared->cmd == CmdINIT) { /* Initialize display window */ - tmp = CmdVPinitScreen; - CmdWrite(&tmp, 1); - } - /* - fprintf(stderr, "CTR: %d frames in VDbuf.\n", VDcheckMsg()); - */ - while (VDcheckMsg() > 1) - { - /* - Fprintf(stderr, "CTR: VDcheckMsg() = %d, to discard a picture.\n", VDcheckMsg()); - */ - if ((buf = VDgetMsg()) != NULL) - VDreclaimMsg(buf); - else - fprintf(stderr, "CTR error: VDgetMsg is NULL, unexpected.\n"); - } - if (VDcheckMsg() >0 ) { - /* - Fprintf(stderr, "CTR to display a frame in user1_handler()\n"); - */ - buf = VDgetMsg(); - } - else { - /* - Fprintf(stderr, "CTR no frame to display in user_handler()\n"); - */ - buf = NULL; - } - - if (buf != NULL) { - if (shared->cmd == CmdSTEP) - { - shared->nextFrame ++; - shared->nextGroup = buf->gop + 1; - } - else - { - shared->nextFrame = buf->display; - shared->nextGroup = buf->gop; - } - tmp = CmdVPdisplayFrame; - CmdWrite(&tmp, 1); - CmdWrite((unsigned char *)&buf, sizeof(char *)); - } - else if (shared->cmd == CmdSTEP) { - shared->nextFrame ++; - } -} - -static void default_usr2_handler(int sig) -{ - Fprintf(stderr, "CTR warning: void SIGUSR2 handler.\n"); -} - -static void compute_sendPattern(void) -{ - char buf[PATTERN_SIZE]; - float limit = shared->frameRateLimit; - char * pat = shared->pattern; - int len = shared->patternSize * shared->sendPatternGops; - int f; - - if (limit <= 0) - limit = 1.0; - if (rtplay) { - f = (int)((double)len * - ((double)limit / (1000000.0 / (double)shared->usecPerFrame)) + 0.5); - /* rounded to integer, instead of truncated */ - } - else { - f = len; - } - if (f >= len) - f = len; - else if (f <= 1) - f = 1; - - ComputeSendPattern(pat, buf, len, f); - shared->qosRecomputes ++; - - memcpy(shared->sendPattern, buf, PATTERN_SIZE); - - f = len - f; - if (shared->config.verbose) { - fprintf(stderr, "speed %dupf, %d frames dropped, frames %d:\nsend pattern:", - shared->usecPerFrame, f, len); - shared->framesDropped = f; - { - int i; - for (i = 0; i < len; i ++) - fputc(buf[i] ? pat[i] : '-', stderr); - } - fputc('\n', stderr); - } -} - -/* about automatic experiment plan by software developers or specific users: - to be able to conduct experiment plan, the user need to have a uid defined - by DEVELOPER_UID in "../include/common.h", and he/she needs to prepare a file - EXP_PLAN_FILE, with following format: - - {Delay #seconds | - Expriment } * - EndExpriment - - An experiment command is followed by one or more of following parameters: - - playSpeed #float - frameRateLimit #float - maxSPframes #int - filterPara #int - collectStat 0/1 - qosEffective 0/1 - syncEffective 0/1 - - and the parameter is terminated by an empty line. - - The automatic experiment plan file is opened after init() and experiment - setting read just before calling play(). The Player will be terminated - after all experiments are done. - - */ - -static void on_exit_routine(void) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %s:%d\n", - __FILE__, - __LINE__)); - unsigned char tmp = CmdCLOSE; - - if (getpid() != CTRpid) return; - - if (audioSocket >= 0) - { - write(audioSocket, &tmp, 1); - ComCloseConn(audioSocket); - audioSocket = -1; - } - if (videoSocket >= 0) - { - write(videoSocket, &tmp, 1); - ComCloseConn(videoSocket); - videoSocket = -1; - if (VBpid > 0) { - kill(VBpid, SIGUSR1); - VBpid = -1; - } - } - ComCloseClient(); -} - -#define EXP_PLAN_FILE "experiment_plan" - -int CTRmain(void) -{ - int sv[2]; - extern void set_exit_routine_tag(int tag); - - FILE * fp = NULL; /* file pointer for experiment plan */ - - set_exit_routine_tag(0); - // setsignal(SIGUSR2, default_usr2_handler); - - /* allocate shared data structure and initialize it */ - shared = (SharedData *) creat_shared_mem(sizeof(*shared)); - shared->cmd = 0; - shared->cmdsn = 0; - shared->cmdBusy = 0; - shared->loopBack = 0; - shared->volumePosition = 0; - shared->balancePosition = 50; - shared->locationPosition = 0; - shared->speedPosition = 0; - shared->qosRecomputes = 0; - - shared->pixelValid = 0; - - shared->config.rt = 1; - shared->config.maxFPS = DEFAULT_maxFPS; - shared->config.maxSPS = DEFAULT_maxSPS; - shared->config.ffFPS = DEFAULT_ffFPS; - shared->config.fbFPS = DEFAULT_fbFPS; - shared->config.feedBackDelay = DEFAULT_feedBackDelay; - shared->config.audioMask = DEFAULT_audioMask; - shared->config.audioPara.encodeType = DEFAULT_encodeType; - shared->config.audioPara.channels = DEFAULT_channels; - shared->config.audioPara.samplesPerSecond = DEFAULT_samplesPerSecond; - shared->config.audioPara.bytesPerSample = DEFAULT_bytesPerSample; - shared->config.audioTimerDuration = DEFAULT_audioTimerDuration; - shared->config.audioBufferedIntervals = DEFAULT_audioBufferedIntervals; - shared->config.framesPerAudioPlay = DEFAULT_framesPerAudioPlay; - shared->config.audioForward = DEFAULT_audioForward; - shared->config.VStimeAdvance = DEFAULT_VStimeAdvance; - shared->config.frameRateLimit = DEFAULT_maxFPS; - shared->config.collectStat = 0; - shared->config.collectFrameInfo = 0; - shared->config.syncEffective = 1; - shared->config.qosEffective = 1; - shared->config.audioOffset = 0; - shared->config.filterPara = DEFAULT_filterPara; - shared->config.maxSPframes = DEFAULT_maxSPframes; - shared->config.audioConn = 0; - shared->config.videoConn = 0; - shared->config.verbose = (!getuid()) || getuid() == DEVELOPER_UID; - - /* create all shared buffers: AB-CTR, VB-VD, VD-VP */ - ABinitBuf(AB_BUF_SIZE); - VBinitBuf(VB_BUF_SIZE); - VDinitBuf(VD_BUF_SIZE); - - CTRpid = getpid(); - set_exit_routine_tag(1); - - /* create command socket pair */ - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == -1) - { - perror("CTR error on open cmd socketpair"); - exit(1); - } - cmdSocket = sv[0]; - - /* fork processes: VD, GUI */ - - if ((VDpid = fork()) == -1) - { - perror("CTR error on fork VD"); - exit(1); - } else if (VDpid == 0) - { - ABdeleteBuf(); - close(sv[0]); - close(sv[1]); - if (realTimeFlag >= 3) { - if (SetRTpriority("VD", 0)) realTimeFlag = 0; - } - VDprocess(CTRpid); - } - - if ((UIpid = fork()) == -1) - { - perror("CTR error on fork UI"); - exit(1); - } else if (UIpid == 0) - { - VBdeleteBuf(); - ABdeleteBuf(); - close(sv[0]); - if (realTimeFlag >= 2) { -#ifdef __svr4__ - if (SetRTpriority("VB", 0)) realTimeFlag = 0; -#elif defined(_HPUX_SOURCE) - if (SetRTpriority("VB", 2)) realTimeFlag = 0; -#endif - } - UIprocess(sv[1]); - } - close(sv[1]); - // setsignal(SIGUSR1, usr1_handler); - - /* initialize Audio device */ - if (InitAudioDevice() == 0) - hasAudioDevice = 1; - else - hasAudioDevice = 0; - - ComInitClient(VCR_TCP_PORT, VCR_UNIX_PORT, VCR_ATM_PORT); - - if ((vh = (char *)malloc(PATH_SIZE)) == NULL) - { - perror("CTR failed to allocate space for vh"); - exit(1); - } - if ((vf = (char *)malloc(PATH_SIZE)) == NULL) - { - perror("CTR failed to allocate space for vf"); - exit(1); - } - if ((ah = (char *)malloc(PATH_SIZE)) == NULL) - { - perror("CTR failed to allocate space for ah"); - exit(1); - } - if ((af = (char *)malloc(PATH_SIZE)) == NULL) - { - perror("CTR failed to allocate space for af"); - exit(1); - } - if (realTimeFlag) { - if (SetRTpriority("CTR", 4)) realTimeFlag = 0; - } - - - // atexit(on_exit_routine); - - - // instantiate our command handler - Command_Handler command_handler (cmdSocket); -// ACE_NEW_RETURN (command_handler, -// Command_Handler (cmdSocket), -// -1); - - // if (command_handler->init () == -1) - if (command_handler.init () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) command_handler: init returned -1"), - -1); - - // .. and register it with the reactor. - if (ACE_Reactor::instance ()->register_handler (&command_handler, - ACE_Event_Handler::READ_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) register_handler for command_handler failed\n"), - -1); - - // and now instantiate the sig_handler - Client_Sig_Handler client_sig_handler (&command_handler); -// Client_Sig_Handler *client_sig_handler; -// ACE_NEW_RETURN (client_sig_handler, -// Client_Sig_Handler (command_handler), -// -1); - - // .. and ask it to register itself with the reactor - if (client_sig_handler.register_handler () < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) register_handler for sig_handler failed\n"), - -1); - - // and run the event loop - ACE_Reactor::instance ()->run_event_loop (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Exited the client command handler event loop\n" - "%p\n", - "run_event_loop")); - - return 0; -} - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp deleted file mode 100644 index b57d8bb4419..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.cpp +++ /dev/null @@ -1,933 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* - * decoders.c - * - * This file contains all the routines for Huffman decoding required in - * MPEG - * - */ - -#include <stdio.h> -#include <assert.h> -#include "decoders.h" -#include "util.h" -#include "video.h" -#include "proto.h" - -/* Decoding table for macroblock_address_increment */ -mb_addr_inc_entry mb_addr_inc[2048]; - -/* Decoding table for macroblock_type in predictive-coded pictures */ -mb_type_entry mb_type_P[64]; - -/* Decoding table for macroblock_type in bidirectionally-coded pictures */ -mb_type_entry mb_type_B[64]; - -/* Decoding table for motion vectors */ -motion_vectors_entry motion_vectors[2048]; - -/* Decoding table for coded_block_pattern */ - -coded_block_pattern_entry coded_block_pattern[512] = -{ {(unsigned int)ERROR, 0}, {(unsigned int)ERROR, 0}, {39, 9}, {27, 9}, {59, 9}, {55, 9}, {47, 9}, {31, 9}, - {58, 8}, {58, 8}, {54, 8}, {54, 8}, {46, 8}, {46, 8}, {30, 8}, {30, 8}, - {57, 8}, {57, 8}, {53, 8}, {53, 8}, {45, 8}, {45, 8}, {29, 8}, {29, 8}, - {38, 8}, {38, 8}, {26, 8}, {26, 8}, {37, 8}, {37, 8}, {25, 8}, {25, 8}, - {43, 8}, {43, 8}, {23, 8}, {23, 8}, {51, 8}, {51, 8}, {15, 8}, {15, 8}, - {42, 8}, {42, 8}, {22, 8}, {22, 8}, {50, 8}, {50, 8}, {14, 8}, {14, 8}, - {41, 8}, {41, 8}, {21, 8}, {21, 8}, {49, 8}, {49, 8}, {13, 8}, {13, 8}, - {35, 8}, {35, 8}, {19, 8}, {19, 8}, {11, 8}, {11, 8}, {7, 8}, {7, 8}, - {34, 7}, {34, 7}, {34, 7}, {34, 7}, {18, 7}, {18, 7}, {18, 7}, {18, 7}, - {10, 7}, {10, 7}, {10, 7}, {10, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, - {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7}, - {9, 7}, {9, 7}, {9, 7}, {9, 7}, {5, 7}, {5, 7}, {5, 7}, {5, 7}, - {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, - {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, - {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, - {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, - {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, - {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, - {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, - {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, - {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, - {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, - {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, - {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, - {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, - {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, - {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, - {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, - {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, - {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, - {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, - {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, - {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, - {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, - {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, - {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, - {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, - {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, - {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, - {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, - {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, - {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, - {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, - {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, - {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, - {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, - {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, - {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, - {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, - {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, - {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, - {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, - {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3} -}; - -/* Decoding table for dct_dc_size_luminance */ -dct_dc_size_entry dct_dc_size_luminance[128] = -{ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, - {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, {0, 3}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, - {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, {4, 3}, - {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, {5, 4}, - {6, 5}, {6, 5}, {6, 5}, {6, 5}, {7, 6}, {7, 6}, {8, 7}, {(unsigned int)ERROR, 0} -}; - -/* Decoding table for dct_dc_size_chrominance */ -dct_dc_size_entry dct_dc_size_chrominance[256] = -{ {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, {0, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, {3, 3}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, - {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, {5, 5}, - {6, 6}, {6, 6}, {6, 6}, {6, 6}, {7, 7}, {7, 7}, {8, 8}, {(unsigned int)ERROR, 0} -}; - -/* DCT coeff tables. */ - -unsigned short int dct_coeff_tbl_0[256] = -{ -0xffff, 0xffff, 0xffff, 0xffff, -0xffff, 0xffff, 0xffff, 0xffff, -0xffff, 0xffff, 0xffff, 0xffff, -0xffff, 0xffff, 0xffff, 0xffff, -0x052f, 0x051f, 0x050f, 0x04ff, -0x183f, 0x402f, 0x3c2f, 0x382f, -0x342f, 0x302f, 0x2c2f, 0x7c1f, -0x781f, 0x741f, 0x701f, 0x6c1f, -0x028e, 0x028e, 0x027e, 0x027e, -0x026e, 0x026e, 0x025e, 0x025e, -0x024e, 0x024e, 0x023e, 0x023e, -0x022e, 0x022e, 0x021e, 0x021e, -0x020e, 0x020e, 0x04ee, 0x04ee, -0x04de, 0x04de, 0x04ce, 0x04ce, -0x04be, 0x04be, 0x04ae, 0x04ae, -0x049e, 0x049e, 0x048e, 0x048e, -0x01fd, 0x01fd, 0x01fd, 0x01fd, -0x01ed, 0x01ed, 0x01ed, 0x01ed, -0x01dd, 0x01dd, 0x01dd, 0x01dd, -0x01cd, 0x01cd, 0x01cd, 0x01cd, -0x01bd, 0x01bd, 0x01bd, 0x01bd, -0x01ad, 0x01ad, 0x01ad, 0x01ad, -0x019d, 0x019d, 0x019d, 0x019d, -0x018d, 0x018d, 0x018d, 0x018d, -0x017d, 0x017d, 0x017d, 0x017d, -0x016d, 0x016d, 0x016d, 0x016d, -0x015d, 0x015d, 0x015d, 0x015d, -0x014d, 0x014d, 0x014d, 0x014d, -0x013d, 0x013d, 0x013d, 0x013d, -0x012d, 0x012d, 0x012d, 0x012d, -0x011d, 0x011d, 0x011d, 0x011d, -0x010d, 0x010d, 0x010d, 0x010d, -0x282c, 0x282c, 0x282c, 0x282c, -0x282c, 0x282c, 0x282c, 0x282c, -0x242c, 0x242c, 0x242c, 0x242c, -0x242c, 0x242c, 0x242c, 0x242c, -0x143c, 0x143c, 0x143c, 0x143c, -0x143c, 0x143c, 0x143c, 0x143c, -0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, -0x0c4c, 0x0c4c, 0x0c4c, 0x0c4c, -0x085c, 0x085c, 0x085c, 0x085c, -0x085c, 0x085c, 0x085c, 0x085c, -0x047c, 0x047c, 0x047c, 0x047c, -0x047c, 0x047c, 0x047c, 0x047c, -0x046c, 0x046c, 0x046c, 0x046c, -0x046c, 0x046c, 0x046c, 0x046c, -0x00fc, 0x00fc, 0x00fc, 0x00fc, -0x00fc, 0x00fc, 0x00fc, 0x00fc, -0x00ec, 0x00ec, 0x00ec, 0x00ec, -0x00ec, 0x00ec, 0x00ec, 0x00ec, -0x00dc, 0x00dc, 0x00dc, 0x00dc, -0x00dc, 0x00dc, 0x00dc, 0x00dc, -0x00cc, 0x00cc, 0x00cc, 0x00cc, -0x00cc, 0x00cc, 0x00cc, 0x00cc, -0x681c, 0x681c, 0x681c, 0x681c, -0x681c, 0x681c, 0x681c, 0x681c, -0x641c, 0x641c, 0x641c, 0x641c, -0x641c, 0x641c, 0x641c, 0x641c, -0x601c, 0x601c, 0x601c, 0x601c, -0x601c, 0x601c, 0x601c, 0x601c, -0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, -0x5c1c, 0x5c1c, 0x5c1c, 0x5c1c, -0x581c, 0x581c, 0x581c, 0x581c, -0x581c, 0x581c, 0x581c, 0x581c, -}; - -unsigned short int dct_coeff_tbl_1[16] = -{ -0x00bb, 0x202b, 0x103b, 0x00ab, -0x084b, 0x1c2b, 0x541b, 0x501b, -0x009b, 0x4c1b, 0x481b, 0x045b, -0x0c3b, 0x008b, 0x182b, 0x441b, -}; - -unsigned short int dct_coeff_tbl_2[4] = -{ -0x4019, 0x1429, 0x0079, 0x0839, -}; - -unsigned short int dct_coeff_tbl_3[4] = -{ -0x0449, 0x3c19, 0x3819, 0x1029, -}; - -unsigned short int dct_coeff_next[256] = -{ -0xffff, 0xffff, 0xffff, 0xffff, -0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5, -0x0826, 0x0826, 0x2416, 0x2416, -0x0046, 0x0046, 0x2016, 0x2016, -0x1c15, 0x1c15, 0x1c15, 0x1c15, -0x1815, 0x1815, 0x1815, 0x1815, -0x0425, 0x0425, 0x0425, 0x0425, -0x1415, 0x1415, 0x1415, 0x1415, -0x3417, 0x0067, 0x3017, 0x2c17, -0x0c27, 0x0437, 0x0057, 0x2817, -0x0034, 0x0034, 0x0034, 0x0034, -0x0034, 0x0034, 0x0034, 0x0034, -0x1014, 0x1014, 0x1014, 0x1014, -0x1014, 0x1014, 0x1014, 0x1014, -0x0c14, 0x0c14, 0x0c14, 0x0c14, -0x0c14, 0x0c14, 0x0c14, 0x0c14, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0xfbe1, 0xfbe1, 0xfbe1, 0xfbe1, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -0x0011, 0x0011, 0x0011, 0x0011, -}; - -unsigned short int dct_coeff_first[256] = -{ -0xffff, 0xffff, 0xffff, 0xffff, -0xf7d5, 0xf7d5, 0xf7d5, 0xf7d5, -0x0826, 0x0826, 0x2416, 0x2416, -0x0046, 0x0046, 0x2016, 0x2016, -0x1c15, 0x1c15, 0x1c15, 0x1c15, -0x1815, 0x1815, 0x1815, 0x1815, -0x0425, 0x0425, 0x0425, 0x0425, -0x1415, 0x1415, 0x1415, 0x1415, -0x3417, 0x0067, 0x3017, 0x2c17, -0x0c27, 0x0437, 0x0057, 0x2817, -0x0034, 0x0034, 0x0034, 0x0034, -0x0034, 0x0034, 0x0034, 0x0034, -0x1014, 0x1014, 0x1014, 0x1014, -0x1014, 0x1014, 0x1014, 0x1014, -0x0c14, 0x0c14, 0x0c14, 0x0c14, -0x0c14, 0x0c14, 0x0c14, 0x0c14, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0023, 0x0023, 0x0023, 0x0023, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0813, 0x0813, 0x0813, 0x0813, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0412, 0x0412, 0x0412, 0x0412, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -0x0010, 0x0010, 0x0010, 0x0010, -}; - -/* Macro for filling up the decoding table for mb_addr_inc */ -#define ASSIGN1(start, end, step, val, num) \ - for (i = start; i < end; i+= step) { \ - for (j = 0; j < step; j++) { \ - mb_addr_inc[i+j].value = val; \ - mb_addr_inc[i+j].num_bits = num; \ - } \ - val--; \ - } - - - -/* - *-------------------------------------------------------------- - * - * init_mb_addr_inc -- - * - * Initialize the VLC decoding table for macro_block_address_increment - * - * Results: - * The decoding table for macro_block_address_increment will - * be filled; illegal values will be filled as ERROR. - * - * Side effects: - * The global array mb_addr_inc will be filled. - * - *-------------------------------------------------------------- - */ -static void -init_mb_addr_inc() -{ - int i, j, val; - - for (i = 0; i < 8; i++) { - mb_addr_inc[i].value = (unsigned int)ERROR; - mb_addr_inc[i].num_bits = 0; - } - - mb_addr_inc[8].value = MACRO_BLOCK_ESCAPE; - mb_addr_inc[8].num_bits = 11; - - for (i = 9; i < 15; i++) { - mb_addr_inc[i].value = (unsigned int)ERROR; - mb_addr_inc[i].num_bits = 0; - } - - mb_addr_inc[15].value = MACRO_BLOCK_STUFFING; - mb_addr_inc[15].num_bits = 11; - - for (i = 16; i < 24; i++) { - mb_addr_inc[i].value = (unsigned int)ERROR; - mb_addr_inc[i].num_bits = 0; - } - - val = 33; - - ASSIGN1(24, 36, 1, val, 11); - ASSIGN1(36, 48, 2, val, 10); - ASSIGN1(48, 96, 8, val, 8); - ASSIGN1(96, 128, 16, val, 7); - ASSIGN1(128, 256, 64, val, 5); - ASSIGN1(256, 512, 128, val, 4); - ASSIGN1(512, 1024, 256, val, 3); - ASSIGN1(1024, 2048, 1024, val, 1); -} - - -/* Macro for filling up the decoding table for mb_type */ -#define ASSIGN2(start, end, quant, motion_forward, motion_backward, pattern, intra, num, mb_type) \ - for (i = start; i < end; i ++) { \ - mb_type[i].mb_quant = quant; \ - mb_type[i].mb_motion_forward = motion_forward; \ - mb_type[i].mb_motion_backward = motion_backward; \ - mb_type[i].mb_pattern = pattern; \ - mb_type[i].mb_intra = intra; \ - mb_type[i].num_bits = num; \ - } - - - -/* - *-------------------------------------------------------------- - * - * init_mb_type_P -- - * - * Initialize the VLC decoding table for macro_block_type in - * predictive-coded pictures. - * - * Results: - * The decoding table for macro_block_type in predictive-coded - * pictures will be filled; illegal values will be filled as ERROR. - * - * Side effects: - * The global array mb_type_P will be filled. - * - *-------------------------------------------------------------- - */ -static void -init_mb_type_P() -{ - int i; - - mb_type_P[0].mb_quant = mb_type_P[0].mb_motion_forward - = mb_type_P[0].mb_motion_backward = mb_type_P[0].mb_pattern - = mb_type_P[0].mb_intra = (unsigned int)ERROR; - mb_type_P[0].num_bits = 0; - - ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_P) - ASSIGN2(2, 4, 1, 0, 0, 1, 0, 5, mb_type_P) - ASSIGN2(4, 6, 1, 1, 0, 1, 0, 5, mb_type_P); - ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_P); - ASSIGN2(8, 16, 0, 1, 0, 0, 0, 3, mb_type_P); - ASSIGN2(16, 32, 0, 0, 0, 1, 0, 2, mb_type_P); - ASSIGN2(32, 64, 0, 1, 0, 1, 0, 1, mb_type_P); -} - - - - -/* - *-------------------------------------------------------------- - * - * init_mb_type_B -- - * - * Initialize the VLC decoding table for macro_block_type in - * bidirectionally-coded pictures. - * - * Results: - * The decoding table for macro_block_type in bidirectionally-coded - * pictures will be filled; illegal values will be filled as ERROR. - * - * Side effects: - * The global array mb_type_B will be filled. - * - *-------------------------------------------------------------- - */ -static void -init_mb_type_B() -{ - int i; - - mb_type_B[0].mb_quant = mb_type_B[0].mb_motion_forward - = mb_type_B[0].mb_motion_backward = mb_type_B[0].mb_pattern - = mb_type_B[0].mb_intra = (unsigned int)ERROR; - mb_type_B[0].num_bits = 0; - - ASSIGN2(1, 2, 1, 0, 0, 0, 1, 6, mb_type_B); - ASSIGN2(2, 3, 1, 0, 1, 1, 0, 6, mb_type_B); - ASSIGN2(3, 4, 1, 1, 0, 1, 0, 6, mb_type_B); - ASSIGN2(4, 6, 1, 1, 1, 1, 0, 5, mb_type_B); - ASSIGN2(6, 8, 0, 0, 0, 0, 1, 5, mb_type_B); - ASSIGN2(8, 12, 0, 1, 0, 0, 0, 4, mb_type_B); - ASSIGN2(12, 16, 0, 1, 0, 1, 0, 4, mb_type_B); - ASSIGN2(16, 24, 0, 0, 1, 0, 0, 3, mb_type_B); - ASSIGN2(24, 32, 0, 0, 1, 1, 0, 3, mb_type_B); - ASSIGN2(32, 48, 0, 1, 1, 0, 0, 2, mb_type_B); - ASSIGN2(48, 64, 0, 1, 1, 1, 0, 2, mb_type_B); -} - - -/* Macro for filling up the decoding tables for motion_vectors */ -#define ASSIGN3(start, end, step, val, num) \ - for (i = start; i < end; i+= step) { \ - for (j = 0; j < step / 2; j++) { \ - motion_vectors[i+j].code = val; \ - motion_vectors[i+j].num_bits = num; \ - } \ - for (j = step / 2; j < step; j++) { \ - motion_vectors[i+j].code = -val; \ - motion_vectors[i+j].num_bits = num; \ - } \ - val--; \ - } - - - -/* - *-------------------------------------------------------------- - * - * init_motion_vectors -- - * - * Initialize the VLC decoding table for the various motion - * vectors, including motion_horizontal_forward_code, - * motion_vertical_forward_code, motion_horizontal_backward_code, - * and motion_vertical_backward_code. - * - * Results: - * The decoding table for the motion vectors will be filled; - * illegal values will be filled as ERROR. - * - * Side effects: - * The global array motion_vector will be filled. - * - *-------------------------------------------------------------- - */ -static void -init_motion_vectors() -{ - int i, j, val = 16; - - for (i = 0; i < 24; i++) { - motion_vectors[i].code = (unsigned int)ERROR; - motion_vectors[i].num_bits = 0; - } - - ASSIGN3(24, 36, 2, val, 11); - ASSIGN3(36, 48, 4, val, 10); - ASSIGN3(48, 96, 16, val, 8); - ASSIGN3(96, 128, 32, val, 7); - ASSIGN3(128, 256, 128, val, 5); - ASSIGN3(256, 512, 256, val, 4); - ASSIGN3(512, 1024, 512, val, 3); - ASSIGN3(1024, 2048, 1024, val, 1); -} - - - - -/* - *-------------------------------------------------------------- - * - * init_tables -- - * - * Initialize all the tables for VLC decoding; this must be - * called when the system is set up before any decoding can - * take place. - * - * Results: - * All the decoding tables will be filled accordingly. - * - * Side effects: - * The corresponding global array for each decoding table - * will be filled. - * - *-------------------------------------------------------------- - */ -void -init_tables() -{ - extern void init_pre_idct(); - - init_mb_addr_inc(); - init_mb_type_P(); - init_mb_type_B(); - init_motion_vectors(); - init_pre_idct(); - -#ifdef ANALYSIS - { - init_stats(); - } -#endif -} - -/* - *-------------------------------------------------------------- - * - * DecodeDCTDCSizeLum -- - * - * Huffman Decoder for dct_dc_size_luminance; location where - * the result of decoding will be placed is passed as argument. - * The decoded values are obtained by doing a table lookup on - * dct_dc_size_luminance. - * - * Results: - * The decoded value for dct_dc_size_luminance or ERROR for - * unbound values will be placed in the location specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -void -decodeDCTDCSizeLum(unsigned int *value) -{ - unsigned int index; - - show_bits7(index); - - *value = dct_dc_size_luminance[index].value; - - flush_bits(dct_dc_size_luminance[index].num_bits); -} - - - - -/* - *-------------------------------------------------------------- - * - * DecodeDCTDCSizeChrom -- - * - * Huffman Decoder for dct_dc_size_chrominance; location where - * the result of decoding will be placed is passed as argument. - * The decoded values are obtained by doing a table lookup on - * dct_dc_size_chrominance. - * - * Results: - * The decoded value for dct_dc_size_chrominance or ERROR for - * unbound values will be placed in the location specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -void -decodeDCTDCSizeChrom(unsigned int *value) -{ - unsigned int index; - - show_bits8(index); - - *value = dct_dc_size_chrominance[index].value; - - flush_bits(dct_dc_size_chrominance[index].num_bits); -} - - - -/* - *-------------------------------------------------------------- - * - * decodeDCTCoeff -- - * - * Huffman Decoder for dct_coeff_first and dct_coeff_next; - * locations where the results of decoding: run and level, are to - * be placed and also the type of DCT coefficients, either - * dct_coeff_first or dct_coeff_next, are being passed as argument. - * - * The decoder first examines the next 8 bits in the input stream, - * and perform according to the following cases: - * - * '0000 0000' - examine 8 more bits (i.e. 16 bits total) and - * perform a table lookup on dct_coeff_tbl_0. - * One more bit is then examined to determine the sign - * of level. - * - * '0000 0001' - examine 4 more bits (i.e. 12 bits total) and - * perform a table lookup on dct_coeff_tbl_1. - * One more bit is then examined to determine the sign - * of level. - * - * '0000 0010' - examine 2 more bits (i.e. 10 bits total) and - * perform a table lookup on dct_coeff_tbl_2. - * One more bit is then examined to determine the sign - * of level. - * - * '0000 0011' - examine 2 more bits (i.e. 10 bits total) and - * perform a table lookup on dct_coeff_tbl_3. - * One more bit is then examined to determine the sign - * of level. - * - * otherwise - perform a table lookup on dct_coeff_tbl. If the - * value of run is not ESCAPE, extract one more bit - * to determine the sign of level; otherwise 6 more - * bits will be extracted to obtain the actual value - * of run , and then 8 or 16 bits to get the value of level. - * - * - * - * Results: - * The decoded values of run and level or ERROR for unbound values - * are placed in the locations specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -static void -decodeDCTCoeff(unsigned short int *dct_coeff_tbl, unsigned int *run, int *level) -{ - unsigned int temp, index, num_bits; - unsigned int value, next32bits, flushed; - - /* - * Grab the next 32 bits and use it to improve performance of - * getting the bits to parse. Thus, calls are translated as: - * - * show_bitsX <--> next32bits >> (32-X) - * get_bitsX <--> val = next32bits >> (32-flushed-X); - * flushed += X; - * next32bits &= bitMask[flushed]; - * flush_bitsX <--> flushed += X; - * next32bits &= bitMask[flushed]; - * - */ - show_bits32(next32bits); - flushed = 0; - - /* show_bits8(index); */ - index = next32bits >> 24; - - if (index > 3) { - value = dct_coeff_tbl[index]; - *run = (value & RUN_MASK) >> RUN_SHIFT; - if (*run == END_OF_BLOCK) { - *level = END_OF_BLOCK; - } - else { - /* num_bits = (value & NUM_MASK) + 1; */ - /* flush_bits(num_bits); */ - flushed = (value & NUM_MASK) + 1; - next32bits &= bitMask[flushed]; - if (*run != ESCAPE) { - *level = (value & LEVEL_MASK) >> LEVEL_SHIFT; - /* get_bits1(value); */ - /* if (value) *level = -*level; */ - if (next32bits >> (31-flushed)) *level = -*level; - flushed++; - /* next32bits &= bitMask[flushed]; last op before update */ - } - else { /* *run == ESCAPE */ - /* get_bits14(temp); */ - temp = next32bits >> (18-flushed); - flushed += 14; - next32bits &= bitMask[flushed]; - *run = temp >> 8; - temp &= 0xff; - if (temp == 0) { - /* get_bits8(*level); */ - *level = next32bits >> (24-flushed); - flushed += 8; - /* next32bits &= bitMask[flushed]; last op before update */ - assert(*level >= 128); - } else if (temp != 128) { - /* Grab sign bit */ - *level = ((int) (temp << 24)) >> 24; - } else { - /* get_bits8(*level); */ - *level = next32bits >> (24-flushed); - flushed += 8; - /* next32bits &= bitMask[flushed]; last op before update */ - *level = *level - 256; - assert(*level <= -128 && *level >= -255); - } - } - /* Update bitstream... */ - flush_bits(flushed); - } - } - else { - if (index == 2) { - /* show_bits10(index); */ - index = next32bits >> 22; - value = dct_coeff_tbl_2[index & 3]; - } - else if (index == 3) { - /* show_bits10(index); */ - index = next32bits >> 22; - value = dct_coeff_tbl_3[index & 3]; - } - else if (index) { /* index == 1 */ - /* show_bits12(index); */ - index = next32bits >> 20; - value = dct_coeff_tbl_1[index & 15]; - } - else { /* index == 0 */ - /* show_bits16(index); */ - index = next32bits >> 16; - value = dct_coeff_tbl_0[index & 255]; - } - *run = (value & RUN_MASK) >> RUN_SHIFT; - *level = (value & LEVEL_MASK) >> LEVEL_SHIFT; - - /* - * Fold these operations together to make it fast... - */ - /* num_bits = (value & NUM_MASK) + 1; */ - /* flush_bits(num_bits); */ - /* get_bits1(value); */ - /* if (value) *level = -*level; */ - - flushed = (value & NUM_MASK) + 2; - if ((next32bits >> (32-flushed)) & 0x1) *level = -*level; - - /* Update bitstream ... */ - flush_bits(flushed); - } -} - - -/* - *-------------------------------------------------------------- - * - * decodeDCTCoeffFirst -- - * - * Huffman Decoder for dct_coeff_first. Locations for the - * decoded results: run and level, are being passed as - * arguments. Actual work is being done by calling DecodeDCTCoeff, - * with the table dct_coeff_first. - * - * Results: - * The decoded values of run and level for dct_coeff_first or - * ERROR for unbound values are placed in the locations given. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -void -decodeDCTCoeffFirst(unsigned int *run, int *level) -{ - decodeDCTCoeff(dct_coeff_first, run, level); -} - - - - -/* - *-------------------------------------------------------------- - * - * decodeDCTCoeffNext -- - * - * Huffman Decoder for dct_coeff_first. Locations for the - * decoded results: run and level, are being passed as - * arguments. Actual work is being done by calling DecodeDCTCoeff, - * with the table dct_coeff_next. - * - * Results: - * The decoded values of run and level for dct_coeff_next or - * ERROR for unbound values are placed in the locations given. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -void -decodeDCTCoeffNext(unsigned int *run, int *level) -{ - decodeDCTCoeff(dct_coeff_next, run, level); -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h deleted file mode 100644 index eaed06d00cb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/decoders.h +++ /dev/null @@ -1,475 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* - * decoders.h - * - * This file contains the declarations of structures required for Huffman - * decoding - * - */ - -/* Include util.h for bit i/o parsing macros. */ - -#include "util.h" - -/* Code for unbound values in decoding tables */ -#define ERROR -1 -#define DCT_ERROR 63 - -#define MACRO_BLOCK_STUFFING 34 -#define MACRO_BLOCK_ESCAPE 35 - -/* Two types of DCT Coefficients */ -#define DCT_COEFF_FIRST 0 -#define DCT_COEFF_NEXT 1 - -/* Special values for DCT Coefficients */ -#define END_OF_BLOCK 62 -#define ESCAPE 61 - -/* Structure for an entry in the decoding table of - * macroblock_address_increment */ -typedef struct { - unsigned int value; /* value for macroblock_address_increment */ - int num_bits; /* length of the Huffman code */ -} mb_addr_inc_entry; - -/* Decoding table for macroblock_address_increment */ -extern mb_addr_inc_entry mb_addr_inc[2048]; - - -/* Structure for an entry in the decoding table of macroblock_type */ -typedef struct { - unsigned int mb_quant; /* macroblock_quant */ - unsigned int mb_motion_forward; /* macroblock_motion_forward */ - unsigned int mb_motion_backward; /* macroblock_motion_backward */ - unsigned int mb_pattern; /* macroblock_pattern */ - unsigned int mb_intra; /* macroblock_intra */ - int num_bits; /* length of the Huffman code */ -} mb_type_entry; - -/* Decoding table for macroblock_type in predictive-coded pictures */ -extern mb_type_entry mb_type_P[64]; - -/* Decoding table for macroblock_type in bidirectionally-coded pictures */ -extern mb_type_entry mb_type_B[64]; - - -/* Structures for an entry in the decoding table of coded_block_pattern */ -typedef struct { - unsigned int cbp; /* coded_block_pattern */ - int num_bits; /* length of the Huffman code */ -} coded_block_pattern_entry; - -/* External declaration of coded block pattern table. */ - -extern coded_block_pattern_entry coded_block_pattern[512]; - - - -/* Structure for an entry in the decoding table of motion vectors */ -typedef struct { - int code; /* value for motion_horizontal_forward_code, - * motion_vertical_forward_code, - * motion_horizontal_backward_code, or - * motion_vertical_backward_code. - */ - int num_bits; /* length of the Huffman code */ -} motion_vectors_entry; - - -/* Decoding table for motion vectors */ -extern motion_vectors_entry motion_vectors[2048]; - - -/* Structure for an entry in the decoding table of dct_dc_size */ -typedef struct { - unsigned int value; /* value of dct_dc_size (luminance or chrominance) */ - int num_bits; /* length of the Huffman code */ -} dct_dc_size_entry; - -/* External declaration of dct dc size lumiance table. */ - -extern dct_dc_size_entry dct_dc_size_luminance[128]; - -/* External declaration of dct dc size chrom table. */ - -extern dct_dc_size_entry dct_dc_size_chrominance[256]; - - -/* DCT coeff tables. */ - -#define RUN_MASK 0xfc00 -#define LEVEL_MASK 0x03f0 -#define NUM_MASK 0x000f -#define RUN_SHIFT 10 -#define LEVEL_SHIFT 4 - -/* External declaration of dct coeff tables. */ - -extern unsigned short int dct_coeff_tbl_0[256]; -extern unsigned short int dct_coeff_tbl_1[16]; -extern unsigned short int dct_coeff_tbl_2[4]; -extern unsigned short int dct_coeff_tbl_3[4]; -extern unsigned short int dct_coeff_next[256]; -extern unsigned short int dct_coeff_first[256]; - -#define DecodeDCTDCSizeLum(macro_val) \ -{ \ - unsigned int index; \ - \ - show_bits7(index); \ - \ - macro_val = dct_dc_size_luminance[index].value; \ - \ - flush_bits(dct_dc_size_luminance[index].num_bits); \ -} - -#define DecodeDCTDCSizeChrom(macro_val) \ -{ \ - unsigned int index; \ - \ - show_bits8(index); \ - \ - macro_val = dct_dc_size_chrominance[index].value; \ - \ - flush_bits(dct_dc_size_chrominance[index].num_bits); \ -} - -#define DecodeDCTCoeff(dct_coeff_tbl, run, level) \ -{ \ - unsigned int temp, index; \ - unsigned int value, next32bits, flushed; \ - \ - /* \ - * Grab the next 32 bits and use it to improve performance of \ - * getting the bits to parse. Thus, calls are translated as: \ - * \ - * show_bitsX <--> next32bits >> (32-X) \ - * get_bitsX <--> val = next32bits >> (32-flushed-X); \ - * flushed += X; \ - * next32bits &= bitMask[flushed]; \ - * flush_bitsX <--> flushed += X; \ - * next32bits &= bitMask[flushed]; \ - * \ - * I've streamlined the code a lot, so that we don't have to mask \ - * out the low order bits and a few of the extra adds are removed. \ - */ \ - show_bits32(next32bits); \ - \ - /* show_bits8(index); */ \ - index = next32bits >> 24; \ - \ - if (index > 3) { \ - value = dct_coeff_tbl[index]; \ - run = value >> RUN_SHIFT; \ - if (run != END_OF_BLOCK) { \ - /* num_bits = (value & NUM_MASK) + 1; */ \ - /* flush_bits(num_bits); */ \ - if (run != ESCAPE) { \ - /* get_bits1(value); */ \ - /* if (value) level = -level; */ \ - flushed = (value & NUM_MASK) + 2; \ - level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ - value = next32bits >> (32-flushed); \ - value &= 0x1; \ - if (value) level = -level; \ - /* next32bits &= ((~0) >> flushed); last op before update */ \ - } \ - else { /* run == ESCAPE */ \ - /* Get the next six into run, and next 8 into temp */ \ - /* get_bits14(temp); */ \ - flushed = (value & NUM_MASK) + 1; \ - temp = next32bits >> (18-flushed); \ - /* Normally, we'd ad 14 to flushed, but I've saved a few \ - * instr by moving the add below */ \ - temp &= 0x3fff; \ - run = temp >> 8; \ - temp &= 0xff; \ - if (temp == 0) { \ - /* get_bits8(level); */ \ - level = next32bits >> (10-flushed); \ - level &= 0xff; \ - flushed += 22; \ - assert(level >= 128); \ - } else if (temp != 128) { \ - /* Grab sign bit */ \ - flushed += 14; \ - level = ((int) (temp << 24)) >> 24; \ - } else { \ - /* get_bits8(level); */ \ - level = next32bits >> (10-flushed); \ - level &= 0xff; \ - flushed += 22; \ - level = level - 256; \ - assert(level <= -128 && level >= -255); \ - } \ - } \ - /* Update bitstream... */ \ - flush_bits(flushed); \ - assert (flushed <= 32); \ - } \ - } \ - else { \ - if (index == 2) { \ - /* show_bits10(index); */ \ - index = next32bits >> 22; \ - value = dct_coeff_tbl_2[index & 3]; \ - } \ - else if (index == 3) { \ - /* show_bits10(index); */ \ - index = next32bits >> 22; \ - value = dct_coeff_tbl_3[index & 3]; \ - } \ - else if (index) { /* index == 1 */ \ - /* show_bits12(index); */ \ - index = next32bits >> 20; \ - value = dct_coeff_tbl_1[index & 15]; \ - } \ - else { /* index == 0 */ \ - /* show_bits16(index); */ \ - index = next32bits >> 16; \ - value = dct_coeff_tbl_0[index & 255]; \ - } \ - run = value >> RUN_SHIFT; \ - level = (value & LEVEL_MASK) >> LEVEL_SHIFT; \ - \ - /* \ - * Fold these operations together to make it fast... \ - */ \ - /* num_bits = (value & NUM_MASK) + 1; */ \ - /* flush_bits(num_bits); */ \ - /* get_bits1(value); */ \ - /* if (value) level = -level; */ \ - \ - flushed = (value & NUM_MASK) + 2; \ - value = next32bits >> (32-flushed); \ - value &= 0x1; \ - if (value) level = -level; \ - \ - /* Update bitstream ... */ \ - flush_bits(flushed); \ - assert (flushed <= 32); \ - } \ -} - -#define DecodeDCTCoeffFirst(runval, levelval) \ -{ \ - DecodeDCTCoeff(dct_coeff_first, runval, levelval); \ -} - -#define DecodeDCTCoeffNext(runval, levelval) \ -{ \ - DecodeDCTCoeff(dct_coeff_next, runval, levelval); \ -} - -/* - *-------------------------------------------------------------- - * - * DecodeMBAddrInc -- - * - * Huffman Decoder for macro_block_address_increment; the location - * in which the result will be placed is being passed as argument. - * The decoded value is obtained by doing a table lookup on - * mb_addr_inc. - * - * Results: - * The decoded value for macro_block_address_increment or ERROR - * for unbound values will be placed in the location specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -#define DecodeMBAddrInc(val) \ -{ \ - unsigned int index; \ - show_bits11(index); \ - val = mb_addr_inc[index].value; \ - flush_bits(mb_addr_inc[index].num_bits); \ -} - -/* - *-------------------------------------------------------------- - * - * DecodeMotionVectors -- - * - * Huffman Decoder for the various motion vectors, including - * motion_horizontal_forward_code, motion_vertical_forward_code, - * motion_horizontal_backward_code, motion_vertical_backward_code. - * Location where the decoded result will be placed is being passed - * as argument. The decoded values are obtained by doing a table - * lookup on motion_vectors. - * - * Results: - * The decoded value for the motion vector or ERROR for unbound - * values will be placed in the location specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -#define DecodeMotionVectors(value) \ -{ \ - unsigned int index; \ - show_bits11(index); \ - value = motion_vectors[index].code; \ - flush_bits(motion_vectors[index].num_bits); \ -} -/* - *-------------------------------------------------------------- - * - * DecodeMBTypeB -- - * - * Huffman Decoder for macro_block_type in bidirectionally-coded - * pictures;locations in which the decoded results: macroblock_quant, - * macroblock_motion_forward, macro_block_motion_backward, - * macroblock_pattern, macro_block_intra, will be placed are - * being passed as argument. The decoded values are obtained by - * doing a table lookup on mb_type_B. - * - * Results: - * The various decoded values for macro_block_type in - * bidirectionally-coded pictures or ERROR for unbound values will - * be placed in the locations specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -#define DecodeMBTypeB(quant, motion_fwd, motion_bwd, pat, intra) \ -{ \ - unsigned int index; \ - \ - show_bits6(index); \ - \ - quant = mb_type_B[index].mb_quant; \ - motion_fwd = mb_type_B[index].mb_motion_forward; \ - motion_bwd = mb_type_B[index].mb_motion_backward; \ - pat = mb_type_B[index].mb_pattern; \ - intra = mb_type_B[index].mb_intra; \ - flush_bits(mb_type_B[index].num_bits); \ -} -/* - *-------------------------------------------------------------- - * - * DecodeMBTypeI -- - * - * Huffman Decoder for macro_block_type in intra-coded pictures; - * locations in which the decoded results: macroblock_quant, - * macroblock_motion_forward, macro_block_motion_backward, - * macroblock_pattern, macro_block_intra, will be placed are - * being passed as argument. - * - * Results: - * The various decoded values for macro_block_type in intra-coded - * pictures or ERROR for unbound values will be placed in the - * locations specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -#define DecodeMBTypeI(quant, motion_fwd, motion_bwd, pat, intra) \ -{ \ - unsigned int index; \ - static int quantTbl[4] = {ERROR, 1, 0, 0}; \ - \ - show_bits2(index); \ - \ - motion_fwd = 0; \ - motion_bwd = 0; \ - pat = 0; \ - intra = 1; \ - quant = quantTbl[index]; \ - if (index) { \ - flush_bits (1 + quant); \ - } \ -} -/* - *-------------------------------------------------------------- - * - * DecodeMBTypeP -- - * - * Huffman Decoder for macro_block_type in predictive-coded pictures; - * locations in which the decoded results: macroblock_quant, - * macroblock_motion_forward, macro_block_motion_backward, - * macroblock_pattern, macro_block_intra, will be placed are - * being passed as argument. The decoded values are obtained by - * doing a table lookup on mb_type_P. - * - * Results: - * The various decoded values for macro_block_type in - * predictive-coded pictures or ERROR for unbound values will be - * placed in the locations specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -#define DecodeMBTypeP(quant, motion_fwd, motion_bwd, pat, intra) \ -{ \ - unsigned int index; \ - \ - show_bits6(index); \ - \ - quant = mb_type_P[index].mb_quant; \ - motion_fwd = mb_type_P[index].mb_motion_forward; \ - motion_bwd = mb_type_P[index].mb_motion_backward; \ - pat = mb_type_P[index].mb_pattern; \ - intra = mb_type_P[index].mb_intra; \ - \ - flush_bits(mb_type_P[index].num_bits); \ -} -/* - *-------------------------------------------------------------- - * - * DecodeCBP -- - * - * Huffman Decoder for coded_block_pattern; location in which the - * decoded result will be placed is being passed as argument. The - * decoded values are obtained by doing a table lookup on - * coded_block_pattern. - * - * Results: - * The decoded value for coded_block_pattern or ERROR for unbound - * values will be placed in the location specified. - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -#define DecodeCBP(coded_bp) \ -{ \ - unsigned int index; \ - \ - show_bits9(index); \ - coded_bp = coded_block_pattern[index].cbp; \ - flush_bits(coded_block_pattern[index].num_bits); \ -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h deleted file mode 100644 index f11623f84a5..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/dither.h +++ /dev/null @@ -1,36 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -extern int LUM_RANGE; -extern int CR_RANGE; -extern int CB_RANGE; - - -#define CB_BASE 1 -#define CR_BASE (CB_BASE*CB_RANGE) -#define LUM_BASE (CR_BASE*CR_RANGE) - -extern unsigned char pixel[256]; -extern int *lum_values; -extern int *cr_values; -extern int *cb_values; - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp deleted file mode 100644 index 871741f239f..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/file.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include "video.h" -#include <X11/Intrinsic.h> -#include <Xm/Xm.h> -#include <Xm/Text.h> -#include <Xm/FileSB.h> -#include <Xm/DialogS.h> -#if defined(sun) || defined(FreeBSD) -#include <stdlib.h> -#endif -#include "include/common.h" -#include "newproto.h" -#include "global.h" - -#ifdef XmFONTLIST_DEFAULT_TAG -#define XmStringTag XmFONTLIST_DEFAULT_TAG -#else -#define XmStringTag XmSTRING_DEFAULT_CHARSET -#endif -#define BUFSIZE 256 - -static Widget fileshell; - -void StartLocalServer(void) -{ - int res; - - static int startLocalServer = 1; - - if (startLocalServer) { - startLocalServer = 0; - if (access(VCR_UNIX_PORT, 0) == -1) { /* going to start a server */ - fprintf(stderr, "Trying to fork a server on local host...\n"); - res = system("vcrs -rt 2> /dev/null& exit"); - if (shared->config.verbose && res == -1) { - perror("Error on fork server on local host"); - } - usleep(1000000); - } - } -} - -/* hostname == "" defaults to local host */ -static void StartFile(char *hostname, char *filename) -{ - char *title = (char *)malloc(strlen(hostname) + strlen(filename) + 10); - char buf[BUFSIZE]; - int len; - - if (*hostname == 0) StartLocalServer(); - - if (*hostname == 0) { - get_full_path(filename, buf, BUFSIZE); - } - else { - strncpy(buf, filename, BUFSIZE); - buf[BUFSIZE-1] = 0; - } - len = strlen(buf); - - if (title == NULL) title = filename; - else sprintf(title, "%s:%s", hostname, filename); - - if (!strcasecmp(".mpg", buf+len-4) || !strcasecmp(".mpeg", buf+len-5)) - StartProgram(title, hostname, buf, "", ""); - else if (!strcasecmp(".au", buf+len-3)) - StartProgram(title, "", "", hostname, buf); - else - fprintf(stderr, "Error: type of file %s not known (know only .mpeg .mpg, .au).\n", - filename); - if (title != filename) free(title); -} - -static void dismissCB(Widget W, XtPointer closure, XtPointer call_data) -{ - - XtUnmanageChild (fileshell); -} - -static void playCB(Widget w, XtPointer closure, XtPointer call_data) -{ - char *filename = NULL; /* String containing file name */ - XmStringCharSet charset = (XmStringCharSet) XmSTRING_DEFAULT_CHARSET; - XmFileSelectionBoxCallbackStruct *fcb = - (XmFileSelectionBoxCallbackStruct *) call_data; - - XmStringGetLtoR(fcb->value, charset, &filename); - - if (filename == NULL) - { - fprintf(stderr, "Error: failed to get file name to play.\n"); - return; - } - StartFile("", filename); - XmStringFree((XmString)filename); -} - -Widget CreateFileWindow(Widget parent, int cmdSock, int * playflag, Widget frametext) -{ - Arg args[10]; /* arg list */ - register int n; /* arg count */ - XmString okString, cancelString; - -/* Create the file selection box */ - okString = (XmString)XmStringCreateLtoR("Select", XmStringTag); - cancelString = (XmString)XmStringCreateLtoR("Dismiss", XmStringTag); - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR File Selection"); n++; - XtSetArg(args[n], XmNokLabelString, okString); n++; - XtSetArg(args[n], XmNcancelLabelString, cancelString); n++; - fileshell = XmCreateFileSelectionDialog(parent, "filebox", args, n); - XmStringFree(okString); - XmStringFree(cancelString); - XtAddCallback (fileshell, XmNokCallback, (XtCallbackProc)playCB, NULL); - XtAddCallback (fileshell, XmNcancelCallback, (XtCallbackProc)dismissCB, NULL); - - return fileshell; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp deleted file mode 100644 index 583582ff3d2..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.cpp +++ /dev/null @@ -1,394 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include <stdlib.h> -#include <string.h> -#include "video.h" -#include "dither.h" -#include "fs2.h" -#include "proto.h" - -/* Structures for precomputed error propogation values. */ - -static FS2DithVal lum_index[256]; -static FS2DithVal cr_index[256]; -static FS2DithVal cb_index[256]; - - - -/* - *-------------------------------------------------------------- - * - * InitFS2Dither -- - * - * Initializes structures for precomputed 2 error f-s dithering. - * The value field of the structure contains the pixel component - * of the particular channel in question. Thus the addition of - * the value field of a structure in the luminance index, a - * structure in the Cr index, and a structure in the Cb index will - * yeild a color number. This color number can then be transformed - * into a pixel value to be displayed. Each channel can then be - * processed (i.e. dithered) separately, with the results being - * added up and remapped to yield a final pixel value. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void InitFS2Dither() -{ - int i; - - /* For each possible pixel value, precompute propogated error and - store in array. - */ - - for (i=0; i<256; i++) { - lum_index[i].value = (i * LUM_RANGE) / 256; - - lum_index[i].e1 = (i-lum_values[lum_index[i].value]) / 2; - lum_index[i].e3 = (i - lum_values[lum_index[i].value]) - lum_index[i].e1; - - lum_index[i].value *= LUM_BASE; - - cr_index[i].value = (i * CR_RANGE) / 256; - - cr_index[i].e1 = (i - cr_values[cr_index[i].value]) / 2; - cr_index[i].e3 = (i - cr_values[cr_index[i].value]) - cr_index[i].e1 ; - - cr_index[i].value *= CR_BASE; - - cb_index[i].value = (i * CB_RANGE) / 256; - - cb_index[i].e1 = (i - cb_values[cb_index[i].value]) / 2; - cb_index[i].e3 = (i - cb_values[cb_index[i].value]) - cb_index[i].e1; - - cb_index[i].value *= CB_BASE; - - } - -} - - -/* - *-------------------------------------------------------------- - * - * DitherImage -- - * - * Converts lum, cr, cb image planes into fixed colormap - * space. - * - * Results: - * the display plane is replaced by 8-bit colormap space - * image. - * - * Side effects: - * Hopefully, none. - * - *-------------------------------------------------------------- - */ - -void FS2DitherImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *disp, - int rows, int cols) -{ - static char *cur_row_error, *next_row_error; - static int first = 1; - char *cur_row_err_mark, *next_row_err_mark; - char *temp; - int i, j, pixsum, c_cols; - unsigned char *cur_row, *channel, *dest_row; - FS2DithVal *chan_index; - - /* Allocate error arrays. */ - - if (first) { - cur_row_error = (char *) malloc(cols+2); - next_row_error = (char *) malloc(cols+2); - first = 0; - } - - /* Initialize error arrays. */ - - memset(cur_row_error, 0, cols+2); - memset(next_row_error, 0, cols+2); - - /* Use luminance values first. */ - - /* For each two rows, do... */ - - for(i=0; i<rows; i+=2) { - - /* Establish pointer to current source and destination rows. */ - cur_row = lum + (i*cols); - dest_row = disp + (i*cols); - - /* Establish pointers to error arrays. */ - cur_row_err_mark = cur_row_error + 1; - next_row_err_mark = next_row_error + 1; - - - /* For each column within first row do... */ - - for (j=0; j<cols; j++) { - - /* Calculate pixel value with error. */ - - pixsum = *cur_row + *cur_row_err_mark; - - /* Bounds check. */ - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - /* Establish dest value, propogate errors. */ - - *dest_row = lum_index[pixsum].value; - *(cur_row_err_mark+1) += lum_index[pixsum].e1; - *next_row_err_mark += lum_index[pixsum].e3; - - /* Advance pointers. */ - - cur_row++; - dest_row++; - cur_row_err_mark++; - next_row_err_mark++; - } - - /* Switch error arrays, so next row errors are now current row errors, and - vice versa. - */ - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - /* Reset next row errors. */ - - memset(next_row_error, 0, cols+2); - - /* Establish pointers for second row. This one will be processed right to - left to establish serpantine motion. - */ - - cur_row += cols-1; - dest_row += cols-1; - cur_row_err_mark = cur_row_error + cols; - next_row_err_mark = next_row_error + cols; - - /* Process each column... */ - - for (j=0; j<cols; j++) { - - pixsum = *cur_row + *cur_row_err_mark; - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - *dest_row = lum_index[pixsum].value; - *(cur_row_err_mark-1) += lum_index[pixsum].e1; - *next_row_err_mark += lum_index[pixsum].e3; - - cur_row--; - dest_row--; - cur_row_err_mark--; - next_row_err_mark--; - } - - /* Switch error arrays. */ - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - /* Reset next row errors. */ - - memset(next_row_error, 0, cols+2); - } - - /* Reset error arrays. */ - - memset(cur_row_error, 0, cols+2); - - /* Establish column length divided by two. */ - - c_cols = cols >> 1; - - /* Set channel to Cr. Use Cr index. */ - - channel = cr; - chan_index = cr_index; - - repeat: - - /* Process each row of chrominance data... */ - - for (i=0; i < rows; i+=2) { - - /* Establish pointers. */ - - cur_row = channel + ((i>>1)*c_cols); - dest_row = disp + (i*cols); - - cur_row_err_mark = cur_row_error+1; - next_row_err_mark = next_row_error+1; - - /* For each column in row... */ - - for (j=0; j<cols; j++) { - int p_val; - - /* Get pixel value as twos bit complement. */ - - p_val = *cur_row; - - /* Add error term. */ - - pixsum = *cur_row_err_mark + p_val; - - /* Bounds check. */ - - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - /* Increment dest value. */ - - *dest_row += chan_index[pixsum].value; - - /* Propogate error values. */ - - *(cur_row_err_mark+1) += chan_index[pixsum].e1; - *next_row_err_mark += chan_index[pixsum].e3; - - - /* If count is odd, advance source pointer (Cr and Cb channels are 2:1 - subsampled. - */ - - if (j&1) cur_row++; - - /* Advance destination and error pointers. */ - - dest_row++; - cur_row_err_mark++; - next_row_err_mark++; - } - - /* Switch error arrays. */ - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - /* Reset next row errors. */ - - memset(next_row_error, 0, cols+2); - - /* Re-establish pointers. */ - - cur_row += c_cols-1; - dest_row += cols-1; - cur_row_err_mark = cur_row_error+cols; - next_row_err_mark = next_row_error+cols; - - /* Process second row right to left. */ - - for (j=0; j<cols; j++) { - int p_val; - - /* Get source value as twos bit complement. */ - - p_val = *cur_row; - - /* Add error. */ - - pixsum = *cur_row_err_mark + p_val; - - /* Bounds check. */ - - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - /* Increment dest value. */ - - *dest_row += chan_index[pixsum].value; - - /* Propogate errors. */ - - *(cur_row_err_mark-1) += chan_index[pixsum].e1; - *next_row_err_mark += chan_index[pixsum].e3; - - /* If column counters is odd, decrement source pointer. */ - - if (j&1) cur_row--; - - /* Decrement dest and error pointers. */ - - dest_row--; - cur_row_err_mark--; - next_row_err_mark--; - } - - /* Switch error arrays. */ - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - /* Reinitialize next row errors. */ - - memset(next_row_error, 0, cols+2); - } - - /* If Cr channel completed, set channel to Cb and Cb index and repeat. */ - - if (channel == cr) { - channel = cb; - chan_index = cb_index; - memset(cur_row_error, 0, cols+2); - - goto repeat; - } - - /* Establish pointer to start of display frame. */ - - dest_row = disp; - - /* Transform all display values to pixel values. */ - - for (i=0; i<rows; i++) { - for (j=0; j<cols; j++) { - *dest_row = pixel[*dest_row]; - dest_row++; - } - } -} - - - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h deleted file mode 100644 index 3fa96c16e66..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2.h +++ /dev/null @@ -1,28 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -typedef struct { - unsigned char value; - int e1; - int e3; -} FS2DithVal; - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp deleted file mode 100644 index 949825b64bc..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs2fast.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include <stdlib.h> -#include <string.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -/* Arrays containing error values for floyd-steinberg dithering. */ - -static int deltay[256]; -static int deltau[256]; -static int deltav[256]; -static int deltay2[256]; -static int deltau2[256]; -static int deltav2[256]; - -/* Definitions governing number of bits used for luminance, cr, and cb. */ - -#define L_BITS 3 -#define CR_BITS 2 -#define CB_BITS 2 - -/* Masks for proper quantization of lum, cr, and cb values. */ - -#define L_MASK 0xe0 -#define CR_MASK 0xc0 -#define CB_MASK 0xc0 - - - -/* - *-------------------------------------------------------------- - * - * InitFS2FastDither -- - * - * Initializes structures and arrays neeeded for fast implementation - * of two error F-S dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void InitFS2FastDither() -{ - int i; - int lum_num, cr_num, cb_num; - - for (i=0; i<256; i++) { - lum_num = (i >> (8-L_BITS)); - cr_num = (i >> (8-CR_BITS)); - cb_num = (i >> (8-CB_BITS)); - - /* These arrays contain the error values propogated for each pixel value - for each channel. - */ - - deltay[i] = (i - ((int) lum_values[lum_num])) / 2; - deltau[i] = (i-((int) cr_values[cr_num])) / 2; - deltav[i] = (i-((int) cb_values[cb_num])) / 2; - deltay2[i] = (i - ((int) lum_values[lum_num])) - deltay[i]; - deltau2[i] = (i - ((int) cr_values[cr_num])) - deltau[i]; - deltav2[i] = (i - ((int) cb_values[cb_num])) - deltav[i]; - - } - -} - -/* - *-------------------------------------------------------------- - * - * DitherImage -- - * - * Dithers an image using floyd-steinberg. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -FS2FastDitherImage ( - unsigned char *lum, - unsigned char *cr, - unsigned char *cb, - unsigned char *out, - int w, int h) -{ - int i, j, idx, idx2; - int y, u, v; - int dy, du, dv; - int code; - static int *yerr1; - static int *yerr2; - static int *uerr1; - static int *uerr2; - static int *verr1; - static int *verr2; - int *ye1, *ue1, *ve1; - int *ye2, *ue2, *ve2; - unsigned char *o, *l, *r, *b; - static int first = 1; - - /* If first time called, allocate error arrays. */ - - if (first) { - first = 0; - yerr1 = (int *) malloc((w+5)*sizeof(int)); - yerr2 = (int *) malloc((w+5)*sizeof(int)); - uerr1 = (int *) malloc((w+5)*sizeof(int)); - uerr2 = (int *) malloc((w+5)*sizeof(int)); - verr1 = (int *) malloc((w+5)*sizeof(int)); - verr2 = (int *) malloc((w+5)*sizeof(int)); - } - - /* - * Init error arrays and variables. - */ - memset ((char *)yerr1, 0, (w+5)*sizeof(int)); - memset ((char *)yerr2, 0, (w+5)*sizeof(int)); - memset ((char *)uerr1, 0, (w+5)*sizeof(int)); - memset ((char *)uerr2, 0, (w+5)*sizeof(int)); - memset ((char *)verr1, 0, (w+5)*sizeof(int)); - memset ((char *)verr2, 0, (w+5)*sizeof(int)); - du = dv = dy = 0; - - for (j=0; j<h; j+=2) { - ye1 = yerr1; - ue1 = uerr1; - ve1 = verr1; - ye2 = yerr2; - ue2 = uerr2; - ve2 = verr2; - idx = j*w; - idx2 = idx/4; - o = out+idx; - l = lum+idx; - r = cr+idx2; - b = cb+idx2; - /* Do the top row in forward order. */ - for (i=0; i<w; i+=2) { - /* Do left side of this pair... */ - y = *l++ + dy + *ye1++; - u = *r + du + *ue1++; - v = *b + dv + *ve1++; - - if (y < 0) y = 0; - else if (y > 255) y = 255; - if (u < 0) u = 0; - else if (u > 255) u = 255; - if (v < 0) v = 0; - else if (v > 255) v = 255; - - /* - * Construct a code using: - * high order 3 bits of y, - * high order 2 bits of u, - * high order 2 bits of v - */ - code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS))) - >> (8-(L_BITS+CR_BITS+CB_BITS))); - *o++ = pixel[code]; - *ye2++ = deltay[y]; - *ue2++ = deltau[u]; - *ve2++ = deltav[v]; - dy = deltay2[y]; - du = deltau2[u]; - dv = deltav2[v]; - - /* Do right side of this pair... */ - y = *l++ + dy + *ye1++; - u = *r++ + du + *ue1++; - v = *b++ + dv + *ve1++; - - if (y < 0) y = 0; - else if (y > 255) y = 255; - if (u < 0) u = 0; - else if (u > 255) u = 255; - if (v < 0) v = 0; - else if (v > 255) v = 255; - - code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS))) - >> (8-(L_BITS+CR_BITS+CB_BITS))); - *o++ = pixel[code]; - *ye2++ = deltay[y]; - *ue2++ = deltau[u]; - *ve2++ = deltav[v]; - dy = deltay2[y]; - du = deltau2[u]; - dv = deltav2[v]; - - } - - ye1 = yerr1+w-1; - ue1 = uerr1+w-1; - ve1 = verr1+w-1; - ye2 = yerr2+w-1; - ue2 = uerr2+w-1; - ve2 = verr2+w-1; - l += w-1; - o += w-1; - r--; - b--; - dy = du = dv = 0; - - /* Do bottom part of row, in right to left order. */ - for (i=w-1; i>0; i-=2) { - /* Do right side of this pair... */ - y = *l-- + dy + *ye2--; - u = *r + du + *ue2--; - v = *b + dv + *ve2--; - - if (y < 0) y = 0; - else if (y > 255) y = 255; - if (u < 0) u = 0; - else if (u > 255) u = 255; - if (v < 0) v = 0; - else if (v > 255) v = 255; - - /* - * Construct a code using: - * high order 3 bits of y, - * high order 2 bits of u, - * high order 2 bits of v - */ - code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS))) - >> (8-(L_BITS+CR_BITS+CB_BITS))); - *o-- = pixel[code]; - *ye1-- = deltay[y]; - *ue1-- = deltau[u]; - *ve1-- = deltav[v]; - dy = deltay2[y]; - du = deltau2[u]; - dv = deltav2[v]; - - /* Do left side of this pair... */ - y = *l-- + dy + *ye2--; - u = *r-- + du + *ue2--; - v = *b-- + dv + *ve2--; - - if (y < 0) y = 0; - else if (y > 255) y = 255; - if (u < 0) u = 0; - else if (u > 255) u = 255; - if (v < 0) v = 0; - else if (v > 255) v = 255; - - code = (((y & L_MASK) | ((u & CR_MASK) >> L_BITS) | (v >> (L_BITS+CR_BITS))) - >> (8-(L_BITS+CR_BITS+CB_BITS))); - *o-- = pixel[code]; - *ye1-- = deltay[y]; - *ue1-- = deltau[u]; - *ve1-- = deltav[v]; - dy = deltay2[y]; - du = deltau2[u]; - dv = deltav2[v]; - - } - } -} - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp deleted file mode 100644 index 0be89ba33e5..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to do YCrCb -> colormap space. */ - -#include <stdlib.h> -#include <string.h> -#include "fs4.h" -#include "video.h" -#include "proto.h" -#include "dither.h" - -/* Structures containing precomputed error terms. */ - -static FS4Dither lum_index[256]; -static FS4Dither cr_index[256]; -static FS4Dither cb_index[256]; - - -/* - *-------------------------------------------------------------- - * - * InitFS4Dither -- - * - * Initializes structures used for f-s dithering. Precomputes - * error terms. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitFS4Dither() -{ - int i; - - for (i=0; i<256; i++) { - lum_index[i].value = (i * LUM_RANGE) / 256; - - lum_index[i].e1 = (7 * (i-lum_values[lum_index[i].value])) / 16; - lum_index[i].e2 = (i-lum_values[lum_index[i].value])/16; - lum_index[i].e3 = (5 * (i - lum_values[lum_index[i].value])) / 16; - lum_index[i].e4 = (i-lum_values[lum_index[i].value]) - lum_index[i].e1 - - lum_index[i].e2 - lum_index[i].e3; - - lum_index[i].value *= LUM_BASE; - - cr_index[i].value = (i * CR_RANGE) / 256; - - cr_index[i].e1 = (7 * (i-cr_values[cr_index[i].value])) / 16; - cr_index[i].e2 = (i-cr_values[cr_index[i].value])/16; - cr_index[i].e3 = (5 * (i - cr_values[cr_index[i].value])) / 16; - cr_index[i].e4 = (i-cr_values[cr_index[i].value]) - cr_index[i].e1 - - cr_index[i].e2 - cr_index[i].e3; - cr_index[i].value *= CR_BASE; - - cb_index[i].value = (i * CB_RANGE) / 256; - - cb_index[i].e1 = (7 * (i-cb_values[cb_index[i].value])) / 16; - cb_index[i].e2 = (i-cb_values[cb_index[i].value])/16; - cb_index[i].e3 = (5 * (i - cb_values[cb_index[i].value])) / 16; - cb_index[i].e4 = (i-cb_values[cb_index[i].value]) - cb_index[i].e1 - - cb_index[i].e2 - cb_index[i].e3; - cb_index[i].value *= CB_BASE; - - } - -} - - -/* - *-------------------------------------------------------------- - * - * DitherImage -- - * - * Converts lum, cr, cb image planes into fixed colormap - * space. Uses Floyd-Steinberg dithering in serpentine - * pattern with standard 4 errors propogated. - * - * Results: - * The display plane is replaced by 8-bit colormap space - * image. - * - * Side effects: - * Hopefully, none. - * - *-------------------------------------------------------------- - */ - -void -FS4DitherImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *disp, - int rows, int cols) -{ - static char *cur_row_error, *next_row_error; - static int first = 1; - char *cur_row_err_mark, *next_row_err_mark; - char *temp; - int i, j, pixsum, c_cols; - unsigned char *cur_row, *channel, *dest_row; - FS4Dither *chan_index; - - if (first) { - cur_row_error = (char *) malloc(cols+2); - next_row_error = (char *) malloc(cols+2); - first = 0; - } - - memset(cur_row_error, 0, cols+2); - memset(next_row_error, 0, cols+2); - - for(i=0; i<rows; i+=2) { - cur_row = lum + (i*cols); - dest_row = disp + (i*cols); - - cur_row_err_mark = cur_row_error + 1; - next_row_err_mark = next_row_error + 1; - - for (j=0; j<cols; j++) { - - pixsum = *cur_row + *cur_row_err_mark; - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - *dest_row = lum_index[pixsum].value; - *(cur_row_err_mark+1) += lum_index[pixsum].e1; - *(next_row_err_mark+1) += lum_index[pixsum].e2; - *next_row_err_mark += lum_index[pixsum].e3; - *(next_row_err_mark-1) += lum_index[pixsum].e4; - - cur_row++; - dest_row++; - cur_row_err_mark++; - next_row_err_mark++; - } - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - memset(next_row_error, 0, cols+2); - - cur_row += cols-1; - dest_row += cols-1; - cur_row_err_mark = cur_row_error + cols; - next_row_err_mark = next_row_error + cols; - - for (j=0; j<cols; j++) { - - pixsum = *cur_row + *cur_row_err_mark; - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - *dest_row = lum_index[pixsum].value; - *(cur_row_err_mark-1) += lum_index[pixsum].e1; - *(next_row_err_mark-1) += lum_index[pixsum].e2; - *next_row_err_mark += lum_index[pixsum].e3; - *(next_row_err_mark+1) += lum_index[pixsum].e4; - - cur_row--; - dest_row--; - cur_row_err_mark--; - next_row_err_mark--; - } - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - memset(next_row_error, 0, cols+2); - } - - memset(cur_row_error, 0, cols+2); - - c_cols = cols >> 1; - - channel = cr; - chan_index = cr_index; - - repeat: - - for (i=0; i < rows; i+=2) { - cur_row = channel + ((i>>1)*c_cols); - dest_row = disp + (i*cols); - - cur_row_err_mark = cur_row_error+1; - next_row_err_mark = next_row_error+1; - - for (j=0; j<cols; j++) { - int p_val; - - p_val = *cur_row; - - pixsum = *cur_row_err_mark + p_val; - - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - *dest_row += chan_index[pixsum].value; - - *(cur_row_err_mark+1) += chan_index[pixsum].e1; - *(next_row_err_mark+1) += chan_index[pixsum].e2; - *next_row_err_mark += chan_index[pixsum].e3; - *(next_row_err_mark-1) += chan_index[pixsum].e4; - - - if (j&1) cur_row++; - dest_row++; - cur_row_err_mark++; - next_row_err_mark++; - } - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - memset(next_row_error, 0, cols+2); - - cur_row += c_cols-1; - dest_row += cols-1; - cur_row_err_mark = cur_row_error+cols; - next_row_err_mark = next_row_error+cols; - - for (j=0; j<cols; j++) { - int p_val; - - p_val = *cur_row; - - pixsum = *cur_row_err_mark + p_val; - - if (pixsum < 0) pixsum = 0; - else if (pixsum > 255) pixsum = 255; - - *dest_row += chan_index[pixsum].value; - - *(cur_row_err_mark-1) += chan_index[pixsum].e1; - *(next_row_err_mark-1) += chan_index[pixsum].e2; - *next_row_err_mark += chan_index[pixsum].e3; - *(next_row_err_mark+1) += chan_index[pixsum].e4; - - if (j&1) cur_row--; - dest_row--; - cur_row_err_mark--; - next_row_err_mark--; - } - - temp = cur_row_error; - cur_row_error = next_row_error; - next_row_error = temp; - - memset(next_row_error, 0, cols+2); - } - - if (channel == cr) { - channel = cb; - chan_index = cb_index; - memset(cur_row_error, 0, cols+2); - - goto repeat; - } - - dest_row = disp; - - - for (i=0; i<rows; i++) { - for (j=0; j<cols; j++) { - *dest_row = pixel[*dest_row]; - dest_row++; - } - } -} - - - - - - - - - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h deleted file mode 100644 index e63fcafa874..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/fs4.h +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -typedef struct { - unsigned char value; - int e1; - int e2; - int e3; - int e4; -} FS4Dither; - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp deleted file mode 100644 index b32855ec370..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <sys/types.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#include "include/common.h" - -/* Declaration of global variable to hold dither info. */ - -int ditherType; - -/* Global file pointer to incoming data. */ -FILE *input; - -/* End of File flag. */ -int EOF_flag = 0; - -/* Loop flag. */ -int loopFlag = 0; - -/* Shared memory flag. */ -int shmemFlag = 0; - -/* Quiet flag. */ -int quietFlag = 0; - -/* Display image on screen? */ -int noDisplayFlag = 0; - -/* real time flag */ -int realTimeFlag = 0; - -/* shared version of command line argument */ -int argc_share; -char **argv_share; - -/* for command line display name */ -char displayName[64]; - -/* command line program list name */ -char proglistName[PATH_SIZE] = ""; - -/* shared data structure */ -SharedData * shared = NULL; - -/* Range values for lum, cr, cb. */ -int LUM_RANGE; -int CR_RANGE; -int CB_RANGE; - -/* Array that remaps color numbers to actual pixel values used by X server. */ - -unsigned char pixel[256]; - -/* Arrays holding quantized value ranged for lum, cr, and cb. */ - -int *lum_values = NULL; -int *cr_values = NULL; -int *cb_values = NULL; - -/* Structures used by the X server. */ - -Display *display; -Colormap cmap; - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h deleted file mode 100644 index b7faf0b2827..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/global.h +++ /dev/null @@ -1,67 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* Declaration of global variable to hold dither info. */ - -extern int ditherType; - -/* Global file pointer to incoming data. */ -extern FILE *input; - -/* End of File flag. */ -extern int EOF_flag; - -/* Loop flag. */ -extern int loopFlag; - -/* Shared memory flag. */ -extern int shmemFlag; - -/* Quiet flag. */ -extern int quietFlag; - -/* Display image on screen? */ -extern int noDisplayFlag; - -/* real time flag */ -extern int realTimeFlag; - -/* shared version of command line argument */ -extern int argc_share; -extern char **argv_share; - -/* for command line display name */ -extern char displayName[]; - -/* command line program list name */ -extern char proglistName[PATH_SIZE]; - -/* shared data structure */ -extern SharedData * shared; - -/* Structures used by the X server. */ - -extern Display *display; -extern Colormap cmap; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp deleted file mode 100644 index 1e0e82c4ba3..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/gray.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#include <string.h> -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - - -/* - *-------------------------------------------------------------- - * - * GrayDitherImage -- - * - * Dithers image into 128 gray scales. Simply maps luminance - * value into 1 of 128 gray scale colors (divide by two, essentially). - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -GrayDitherImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - - int i, max = w*h/16; - - for (i=0; i<max; i++) { - out[0] = pixel[lum[0]]; - out[1] = pixel[lum[1]]; - out[2] = pixel[lum[2]]; - out[3] = pixel[lum[3]]; - out[4] = pixel[lum[4]]; - out[5] = pixel[lum[5]]; - out[6] = pixel[lum[6]]; - out[7] = pixel[lum[7]]; - out[8] = pixel[lum[8]]; - out[9] = pixel[lum[9]]; - out[10] = pixel[lum[10]]; - out[11] = pixel[lum[11]]; - out[12] = pixel[lum[12]]; - out[13] = pixel[lum[13]]; - out[14] = pixel[lum[14]]; - out[15] = pixel[lum[15]]; - out += 16; - lum += 16; - } -} - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp deleted file mode 100644 index d94efcf5f56..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybrid.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to implement an ordered dither. */ -#include <string.h> -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -#define DITH_SIZE 16 - - -/* Structures used to implement hybrid ordered dither/floyd-steinberg - dither algorithm. -*/ - -static unsigned char *l_darrays[DITH_SIZE]; -static unsigned char cr_fsarray[256][4]; -static unsigned char cb_fsarray[256][4]; - - -/* - *-------------------------------------------------------------- - * - * InitHybridDither-- - * - * Structures intialized for hybrid dithering. Ordered dither - * patterns set for luminance channel, f-s errors precomputed - * for chrominance channels. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitHybridDither() -{ - int i, j, k, err_range, threshval; - unsigned char *lmark; - - for (i=0; i<DITH_SIZE; i++) { - lmark = l_darrays[i] = (unsigned char *) malloc(256); - - for (j=0; j<lum_values[0]; j++) { - *lmark++ = 0; - } - - for (j=0; j<(LUM_RANGE-1); j++) { - err_range = lum_values[j+1] - lum_values[j]; - threshval = ((i * err_range) / DITH_SIZE)+lum_values[j]; - - for (k=lum_values[j]; k<lum_values[j+1]; k++) { - if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE)); - else *lmark++ = (j * (CR_RANGE * CB_RANGE)); - } - } - - for (j=lum_values[LUM_RANGE-1]; j<256; j++) { - *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE); - } - - } - { - int cr1, cr2, cr3, cr4, err1, err2; - int cb1, cb2, cb3, cb4, val, nval; - - for (i=0; i<256; i++) { - - val = i; - - cr1 = (val * CR_RANGE) / 256; - err1 = (val - cr_values[cr1])/2; - err2 = (val - cr_values[cr1]) - err1; - - nval = val+err1; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cr2 = (nval * CR_RANGE) / 256; - err1 = (nval - cr_values[cr2])/2; - - nval = val+err2; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cr3 = (nval * CR_RANGE) / 256; - err2 = (nval - cr_values[cr3])/2; - - nval = val+err1+err2; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cr4 = (nval * CR_RANGE) / 256; - - cr_fsarray[i][0] = cr1*CB_RANGE; - cr_fsarray[i][1] = cr2*CB_RANGE; - cr_fsarray[i][2] = cr3*CB_RANGE; - cr_fsarray[i][3] = cr4*CB_RANGE; - } - - for (i=0; i<256; i++) { - - val = i; - - cb1 = (val * CB_RANGE) / 256; - err1 = (val - cb_values[cb1])/2; - err2 = (val - cb_values[cb1]) - err1; - - nval = val+err1; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cb2 = (nval * CB_RANGE) / 256; - err1 = (nval - cb_values[cb2])/2; - - nval = val+err2; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cb3 = (nval * CB_RANGE) / 256; - err2 = (nval - cb_values[cb3])/2; - - nval = val+err1+err2; - if (nval > 255) nval = 255; - else if (nval < 0) nval = 0; - cb4 = (nval * CB_RANGE) / 256; - - cb_fsarray[i][0] = cb1; - cb_fsarray[i][1] = cb2; - cb_fsarray[i][2] = cb3; - cb_fsarray[i][3] = cb4; - } - } -} - -/* - *-------------------------------------------------------------- - * - * HybridDitherImage -- - * - * Dithers an image using an ordered dither. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * The luminance channel is dithered based on the standard - * ordered dither pattern for a 4x4 area. The Chrominance - * channels are dithered based on precomputed f-s errors. - * Two errors are propogated per pixel. Errors are NOT propogated - * beyond a 2x2 pixel area. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -HybridDitherImage (unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int w, int h) -{ - unsigned char *l, *r, *b, *o1, *o2; - unsigned char *l2; - int i, j; - - l = lum; - l2 = lum+w; - r = cr; - b = cb; - o1 = out; - o2 = out+w; - - for (i=0; i<h; i+=4) { - - for (j=0; j<w; j+=4) { - - *o1++ = pixel[(l_darrays[0][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])]; - *o1++ = pixel[(l_darrays[8][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])]; - *o2++ = pixel[(l_darrays[12][*l2++] | cr_fsarray[*r][2] | cb_fsarray[*b][2])]; - *o2++ = pixel[(l_darrays[4][*l2++] | cr_fsarray[*r++][3] | cb_fsarray[*b++][3])]; - - *o1++ = pixel[(l_darrays[2][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])]; - *o1++ = pixel[(l_darrays[10][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])]; - *o2++ = pixel[(l_darrays[14][*l2++] | cr_fsarray[*r][2] | cb_fsarray[*b][2])]; - *o2++ = pixel[(l_darrays[6][*l2++] | cr_fsarray[*r++][3] | cb_fsarray[*b++][3])]; - } - - l += w; l2 += w; - o1 += w; o2 += w; - - for (j=0; j<w; j+=4) { - - *o1++ = pixel[(l_darrays[3][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])]; - *o1++ = pixel[(l_darrays[11][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])]; - *o2++ = pixel[(l_darrays[15][*l2++] | cr_fsarray[*r][3] | cb_fsarray[*b][3])]; - *o2++ = pixel[(l_darrays[7][*l2++] | cr_fsarray[*r++][2] | cb_fsarray[*b++][2])]; - - *o1++ = pixel[(l_darrays[1][*l++] | cr_fsarray[*r][1] | cb_fsarray[*b][1])]; - *o1++ = pixel[(l_darrays[9][*l++] | cr_fsarray[*r][0] | cb_fsarray[*b][0])]; - *o2++ = pixel[(l_darrays[13][*l2++] | cr_fsarray[*r][3] | cb_fsarray[*b][3])]; - *o2++ = pixel[(l_darrays[5][*l2++] | cr_fsarray[*r++][2] | cb_fsarray[*b++][2])]; - } - - l += w; l2 += w; - o1 += w; o2 += w; - } -} - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp deleted file mode 100644 index 6386b2f08de..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/hybriderr.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to implement an ordered dither in the - luminance channel and F-S error diffusion on chrominance. -*/ - -#include <stdlib.h> -#include <string.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -#define DITH_SIZE 16 - -/* Structures used for hybrid dither with errors propogated. */ - -static unsigned char *l_darrays[DITH_SIZE]; -static unsigned char *l_darrays0, *l_darrays1, *l_darrays2, *l_darrays3; -static unsigned char *l_darrays4, *l_darrays5, *l_darrays6, *l_darrays7; -static unsigned char *l_darrays8, *l_darrays9, *l_darrays10, *l_darrays11; -static unsigned char *l_darrays12, *l_darrays13, *l_darrays14, *l_darrays15; -static unsigned char cr_fsarray[256*256][4]; -static unsigned char cb_fsarray[256*256][4]; -static unsigned short c_fserr[256*256][2]; - - -/* - *-------------------------------------------------------------- - * - * InitHybridErrorDither-- - * - * Initializes structures used for hybrid dither algorithm - * with errors propogated on Cr and Cb. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitHybridErrorDither() -{ - int i, j, k, err_range, threshval; - unsigned char *lmark; - - - for (i=0; i<DITH_SIZE; i++) { - lmark = l_darrays[i] = (unsigned char *) malloc(256); - - for (j=0; j<lum_values[0]; j++) { - *lmark++ = 0; - } - - for (j=0; j<(LUM_RANGE-1); j++) { - err_range = lum_values[j+1] - lum_values[j]; - threshval = ((i * err_range) / DITH_SIZE)+lum_values[j]; - - for (k=lum_values[j]; k<lum_values[j+1]; k++) { - if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE)); - else *lmark++ = (j * (CR_RANGE * CB_RANGE)); - } - } - - for (j=lum_values[LUM_RANGE-1]; j <256; j++) { - *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE); - } - } - l_darrays0 = l_darrays[0]; l_darrays8 = l_darrays[8]; - l_darrays1 = l_darrays[1]; l_darrays9 = l_darrays[9]; - l_darrays2 = l_darrays[2]; l_darrays10 = l_darrays[10]; - l_darrays3 = l_darrays[3]; l_darrays11 = l_darrays[11]; - l_darrays4 = l_darrays[4]; l_darrays12 = l_darrays[12]; - l_darrays5 = l_darrays[5]; l_darrays13 = l_darrays[13]; - l_darrays6 = l_darrays[6]; l_darrays14 = l_darrays[14]; - l_darrays7 = l_darrays[7]; l_darrays15 = l_darrays[15]; - { - int cr1, cr2, cr3, cr4, err1, err2; - int cb1, cb2, cb3, cb4, val, nval; - int outerr1, outerr2, outerr3, outerr4; - int inerr1, inerr2, inerr3, inerr4; - unsigned short oe1, oe2, oe3, oe4; - - for (j=0; j<65536; j+= 256) { - - inerr1 = (((j & 0xc000) >> 14)*8) - 12; - inerr2 = (((j & 0x3000) >> 12)*8) - 12; - inerr3 = (((j & 0x0c00) >> 10)*8) - 12; - inerr4 = (((j & 0x0300) >> 8) *8) - 12; - - for (i=0; i<256; i++) { - val = i; - - nval = val+inerr1+inerr3; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cr1 = ((nval) * CR_RANGE) / 256; - err1 = ((nval) - cr_values[cr1])/2; - err2 = ((nval) - cr_values[cr1]) - err1; - - nval = val+err1+inerr2; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cr2 = ((nval) * CR_RANGE) / 256; - err1 = ((nval) - cr_values[cr2])/2; - outerr3 = ((nval) - cr_values[cr2])-err1; - - nval = val+err2+inerr4; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cr3 = ((nval) * CR_RANGE) / 256; - err2 = ((nval) - cr_values[cr3])/2; - outerr1 = ((nval) - cr_values[cr3]) - err2; - - nval = val+err1+err2; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cr4 = ((nval) * CR_RANGE) / 256; - outerr2 = ((nval) - cr_values[cr4])/2; - outerr4 = ((nval) - cr_values[cr4])-outerr2; - - cr_fsarray[i+j][0] = cr1*CB_RANGE; - cr_fsarray[i+j][1] = cr2*CB_RANGE; - cr_fsarray[i+j][2] = cr3*CB_RANGE; - cr_fsarray[i+j][3] = cr4*CB_RANGE; - - if (outerr1 < -16) outerr1++; - else if (outerr1 > 15) outerr1--; - if (outerr2 < -16) outerr2++; - else if (outerr2 > 15) outerr2--; - if (outerr3 < -16) outerr3++; - else if (outerr3 > 15) outerr3--; - if (outerr4 < -16) outerr4++; - else if (outerr4 > 15) outerr4--; - - oe1 = (outerr1 + 16) / 8; - oe2 = (outerr2 + 16) / 8; - oe3 = (outerr3 + 16) / 8; - oe4 = (outerr4 + 16) / 8; - -/* This is a debugging check and should be removed if not needed. */ - if ((oe1 > 3) || (oe2 > 3) || (oe3 > 3) || (oe4 > 3)) - fprintf(stderr, "OE error!!!!\n"); - - - c_fserr[i+j][0] = ((oe1 << 14) | (oe2 << 12)); - - c_fserr[i+j][1] = ((oe3 << 10) | (oe4 << 8)); - } - - for (i=0; i<256; i++) { - val = i; - nval = val+inerr1+inerr3; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cb1 = ((nval) * CB_RANGE) / 256; - err1 = ((nval) - cb_values[cb1])/2; - err2 = ((nval) - cb_values[cb1]) - err1; - - nval = val+err1+inerr2; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cb2 = ((nval) * CB_RANGE) / 256; - err1 = ((nval) - cb_values[cb2])/2; - - nval = val+err2+inerr4; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cb3 = ((nval) * CB_RANGE) / 256; - err2 = ((nval) - cb_values[cb3])/2; - - nval = val+err1+err2; - if (nval < 0) nval = 0; else if (nval > 255) nval = 255; - cb4 = ((nval) * CB_RANGE) / 256; - - cb_fsarray[i+j][0] = cb1; - cb_fsarray[i+j][1] = cb2; - cb_fsarray[i+j][2] = cb3; - cb_fsarray[i+j][3] = cb4; - } - } - } -} - -/* - *-------------------------------------------------------------- - * - * HybridErrorDitherImage -- - * - * Dithers an image using a hybrid ordered/floyd-steinberg dither. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * This dither is almost exactly like the dither implemented in the - * file odith.c (i.e. hybrid dithering) except a quantized amount of - * error is propogated between 2x2 pixel areas in Cr and Cb. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -HybridErrorDitherImage (unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int w, int h) -{ - unsigned char *l, *r, *b, *o1, *o2; - unsigned char *l2; - static int *cr_row_errs; - static int *cb_row_errs; - int *cr_r_err; - int *cb_r_err; - int cr_c_err; - int cb_c_err; - unsigned char *cr_fsptr; - unsigned char *cb_fsptr; - static int first = 1; - int cr_code, cb_code; - - int i, j; - int row_advance, row_advance2; - int half_row_advance, half_row_advance2; - - /* If first time called, allocate error arrays. */ - - if (first) { - cr_row_errs = (int *) malloc((w+5)*sizeof(int)); - cb_row_errs = (int *) malloc((w+5)*sizeof(int)); - first = 0; - } - - row_advance = (w << 1) - 1; - row_advance2 = row_advance+2; - half_row_advance = (w>>1)-1; - half_row_advance2 = half_row_advance+2; - - l = lum; - l2 = lum+w; - r = cr; - b = cb; - o1 = out; - o2 = out+w; - - memset( (char *) cr_row_errs, 0, (w+5)*sizeof(int)); - cr_r_err = cr_row_errs; - cr_c_err = 0; - memset( (char *) cb_row_errs, 0, (w+5)*sizeof(int)); - cb_r_err = cb_row_errs; - cb_c_err = 0; - - for (i=0; i<h; i+=4) { - - for (j=w; j>0; j-=4) { - - cr_code = (*cr_r_err | cr_c_err | *r++); - cb_code = (*cb_r_err | cb_c_err | *b++); - - cr_fsptr = cr_fsarray[cr_code]; - cb_fsptr = cb_fsarray[cb_code]; - - *o1++ = pixel[(l_darrays0[*l++] | *cr_fsptr++ | *cb_fsptr++)]; - *o1++ = pixel[(l_darrays8[*l++] | *cr_fsptr++ | *cb_fsptr++)]; - *o2++ = pixel[(l_darrays12[*l2++] | *cr_fsptr++ | *cb_fsptr++)]; - *o2++ = pixel[(l_darrays4[*l2++] | *cr_fsptr++ | *cb_fsptr++)]; - - cr_c_err = c_fserr[cr_code][1]; - cb_c_err = c_fserr[cb_code][1]; - *cr_r_err++ = c_fserr[cr_code][0]; - *cb_r_err++ = c_fserr[cb_code][0]; - cr_code = (*cr_r_err | cr_c_err | *r++); - cb_code = (*cb_r_err | cb_c_err | *b++); - - cr_fsptr = cr_fsarray[cr_code]; - cb_fsptr = cb_fsarray[cb_code]; - - *o1++ = pixel[(l_darrays2[*l++] | *cr_fsptr++ | *cb_fsptr++)]; - *o1++ = pixel[(l_darrays10[*l++] | *cr_fsptr++ | *cb_fsptr++)]; - *o2++ = pixel[(l_darrays14[*l2++] | *cr_fsptr++ | *cb_fsptr++)]; - *o2++ = pixel[(l_darrays6[*l2++] | *cr_fsptr++ | *cb_fsptr++)]; - - cr_c_err = c_fserr[cr_code][1]; - cb_c_err = c_fserr[cb_code][1]; - *cr_r_err++ = c_fserr[cr_code][0]; - *cb_r_err++ = c_fserr[cb_code][0]; - } - - l += row_advance; l2 += row_advance; - o1 += row_advance; o2 += row_advance; - cr_c_err = 0; - cb_c_err = 0; - cr_r_err--; cb_r_err--; - r += half_row_advance; b += half_row_advance; - - for (j=w; j>0; j-=4) { - - cr_code = (*cr_r_err | cr_c_err | *r--); - cb_code = (*cb_r_err | cb_c_err | *b--); - cr_fsptr = cr_fsarray[cr_code]; - cb_fsptr = cb_fsarray[cb_code]; - - *o1-- = pixel[(l_darrays9[*l--] | *cr_fsptr++ | *cb_fsptr++)]; - *o1-- = pixel[(l_darrays1[*l--] | *cr_fsptr++ | *cb_fsptr++)]; - *o2-- = pixel[(l_darrays5[*l2--] | *cr_fsptr++ | *cb_fsptr++)]; - *o2-- = pixel[(l_darrays13[*l2--] | *cr_fsptr++ | *cb_fsptr++)]; - - cr_c_err = c_fserr[cr_code][1]; - cb_c_err = c_fserr[cb_code][1]; - *cr_r_err-- = c_fserr[cr_code][0]; - *cb_r_err-- = c_fserr[cb_code][0]; - cr_code = (*cr_r_err | cr_c_err | *r--); - cb_code = (*cb_r_err | cb_c_err | *b--); - cr_fsptr = cr_fsarray[cr_code]; - cb_fsptr = cb_fsarray[cb_code]; - - *o1-- = pixel[(l_darrays11[*l--] | *cr_fsptr++ | *cb_fsptr++)]; - *o1-- = pixel[(l_darrays3[*l--] | *cr_fsptr++ | *cb_fsptr++)]; - *o2-- = pixel[(l_darrays7[*l2--] | *cr_fsptr++ | *cb_fsptr++)]; - *o2-- = pixel[(l_darrays15[*l2--] | *cr_fsptr++ | *cb_fsptr++)]; - - cr_c_err = c_fserr[cr_code][1]; - cb_c_err = c_fserr[cb_code][1]; - *cr_r_err-- = c_fserr[cr_code][0]; - *cb_r_err-- = c_fserr[cb_code][0]; - - } - - l += row_advance2; l2 += row_advance2; - o1 += row_advance2; o2 += row_advance2; - cr_c_err = 0; cb_c_err = 0; - cr_r_err++; cb_r_err++; - r += half_row_advance2; b += half_row_advance2; - } -} - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp deleted file mode 100644 index ed77e72a442..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/info.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -char infomessage[] = "\ -\n\ -\n\ - Distributed real-time MPEG video audio Player v2.0\n\ - \n\ - Distributed Systems Research Group\n\ - Department of Computer Science and Engineering\n\ - Oregon Graduate Institute of Science and Technology\n\ - October, 1995\n\ -\n\ -The player features common VCR functionalities like synchronized\n\ -video(MPEG) and audio(.au) play back, play speed set on the fly,\n\ -fast-forward, rewind, step forward, random Positioning, and more.\n\ -\n\ -The player is of server/client architecture. The server manages program\n\ -retrieval and distribution. The client decodes video frames, plays video\n\ -and audio streams, and provides a Motif style user interface.\n\ -\n\ -The MPEG decoder used by the client is originated from U.C.Berkeley\n\ -MPEG decoder 2.0, by Lawrence A. Rowe, Ketan Patel, and Brian Smith,\n\ -of Computer Science Division-EECS, Univ. of Calif. at Berkeley.\n\ -\n\ -The Motif user interface is based on an implementation by Daeron Meyer\n\ -of The Geometry Center, University of Minnesota.\n\ -\n\ -This software is covered by copyrights. It contains code contributed\n\ -by the author and several other parties. Please see the beginning of\n\ -source files and copyright file(s) in the root directory of the source\n\ -kit.\n\ -\n\ -Please forward your questions, comments and bug report to:\n\ -\n\ - scen@cse.ogi.edu\n\ -\n\ -"; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib deleted file mode 100644 index e42c3b7ec75..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/Info.mib +++ /dev/null @@ -1,78 +0,0 @@ -static char InfoMib[] = "\ -TotalWidgets: 4\n\ -Ref: 1\n\ -Widget: \"RootForm\"\n\ -Children: 2 3 4\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Root\"\n\ -Xmwidth: 562\n\ -Xmheight: 307\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 0\n\ -XmleftOffset: 0\n\ -XmrightOffset: 0\n\ -Private-\n\ -EndWidget.\n\ -Ref: 2\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Dismiss\"\n\ -Xmwidth: 62\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 270\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 506\n\ -XmrightOffset: 9\n\ -Private-\n\ -label: \"Dismiss\"\n\ -EndWidget.\n\ -Ref: 3\n\ -Widget: \"TextBig\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"TextBig\"\n\ -Xmwidth: 546\n\ -Xmheight: 256\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 8\n\ -XmbottomOffset: 43\n\ -XmleftOffset: 8\n\ -XmrightOffset: 8\n\ -Private-\n\ -EndWidget.\n\ -Ref: 4\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"OutFrame\"\n\ -Xmwidth: 561\n\ -Xmheight: 306\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 1\n\ -XmleftOffset: 1\n\ -XmrightOffset: 0\n\ -Private-\n\ -shadowtype: 1\n\ -EndWidget.\n\ -END.\n\ -"; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib deleted file mode 100644 index d1f432214bb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MW.mib +++ /dev/null @@ -1,229 +0,0 @@ -static char MainMib[] = "\ -TotalWidgets: 12\n\ -Ref: 1\n\ -Widget: \"RootForm\"\n\ -Children: 2 3 4 5 6 7 8 9 10 11 12\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Root\"\n\ -Xmwidth: 364\n\ -Xmheight: 216\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 0\n\ -XmleftOffset: 0\n\ -XmrightOffset: 0\n\ -Private-\n\ -EndWidget.\n\ -Ref: 2\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Info\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 200\n\ -XmrightOffset: 123\n\ -Private-\n\ -label: \"Info\"\n\ -EndWidget.\n\ -Ref: 3\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Loop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 140\n\ -XmrightOffset: 196\n\ -Private-\n\ -label: \"Loop\"\n\ -EndWidget.\n\ -Ref: 4\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Step\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 74\n\ -XmrightOffset: 262\n\ -Private-\n\ -label: \"Step\"\n\ -EndWidget.\n\ -Ref: 5\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Exit\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 314\n\ -XmrightOffset: 9\n\ -Private-\n\ -label: \"Exit\"\n\ -EndWidget.\n\ -Ref: 6\n\ -Widget: \"TextBox\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"FrameText\"\n\ -Xmwidth: 65\n\ -Xmheight: 29\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 8\n\ -XmleftOffset: 245\n\ -XmrightOffset: 54\n\ -Private-\n\ -EndWidget.\n\ -Ref: 7\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Rewind\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 8\n\ -XmrightOffset: 328\n\ -Private-\n\ -label: \"Rew\"\n\ -EndWidget.\n\ -Ref: 8\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Play\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 107\n\ -XmrightOffset: 229\n\ -Private-\n\ -label: \"Play\"\n\ -EndWidget.\n\ -Ref: 9\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Stop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 9\n\ -XmleftOffset: 41\n\ -XmrightOffset: 295\n\ -Private-\n\ -label: \"Stop\"\n\ -EndWidget.\n\ -Ref: 10\n\ -Widget: \"DrawingArea\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Monitor\"\n\ -Xmwidth: 336\n\ -Xmheight: 157\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 13\n\ -XmbottomOffset: 46\n\ -XmleftOffset: 13\n\ -XmrightOffset: 15\n\ -Private-\n\ -EndWidget.\n\ -Ref: 11\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"InFrame\"\n\ -Xmwidth: 347\n\ -Xmheight: 167\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 8\n\ -XmbottomOffset: 41\n\ -XmleftOffset: 8\n\ -XmrightOffset: 9\n\ -Private-\n\ -shadowtype: 0\n\ -EndWidget.\n\ -Ref: 12\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"OutFrame\"\n\ -Xmwidth: 362\n\ -Xmheight: 215\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 1\n\ -XmleftOffset: 1\n\ -XmrightOffset: 1\n\ -Private-\n\ -shadowtype: 1\n\ -EndWidget.\n\ -END.\n\ -"; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib deleted file mode 100644 index 1005fba75e8..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/MainWindow.mib +++ /dev/null @@ -1,324 +0,0 @@ -static char MainMib[] = "\ -TotalWidgets: 17\n\ -Ref: 1\n\ -Widget: \"RootForm\"\n\ -Children: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Root\"\n\ -Xmwidth: 364\n\ -Xmheight: 306\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 0\n\ -XmleftOffset: 0\n\ -XmrightOffset: 0\n\ -Private-\n\ -EndWidget.\n\ -Ref: 2\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Exit\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 8\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Exit\"\n\ -EndWidget.\n\ -Ref: 3\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Info\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 53\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Info\"\n\ -EndWidget.\n\ -Ref: 4\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Para\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 98\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Para\"\n\ -EndWidget.\n\ -Ref: 5\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Prog\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 143\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Prog\"\n\ -EndWidget.\n\ -Ref: 6\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"File\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 188\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"File\"\n\ -EndWidget.\n\ -Ref: 7\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Step\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 9\n\ -Private-\n\ -label: \"Step\"\n\ -EndWidget.\n\ -Ref: 8\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Play\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 42\n\ -Private-\n\ -label: \"Play\"\n\ -EndWidget.\n\ -Ref: 9\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"FF\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 75\n\ -Private-\n\ -label: \"FF\"\n\ -EndWidget.\n\ -Ref: 10\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Stop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 108\n\ -Private-\n\ -label: \"Stop\"\n\ -EndWidget.\n\ -Ref: 11\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Rewind\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 141\n\ -Private-\n\ -label: \"Rewind\"\n\ -EndWidget.\n\ -Ref: 12\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Normal\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 174\n\ -Private-\n\ -label: \"Norm\"\n\ -EndWidget.\n\ -Ref: 13\n\ -Widget: \"Toggle\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Loop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 219\n\ -Private-\n\ -label: \"Loop\"\n\ -EndWidget.\n\ -Ref: 14\n\ -Widget: \"DrawingArea\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Monitor\"\n\ -Xmwidth: 336\n\ -Xmheight: 157\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 43\n\ -XmbottomOffset: 106\n\ -XmleftOffset: 13\n\ -XmrightOffset: 15\n\ -Private-\n\ -EndWidget.\n\ -Ref: 15\n\ -Widget: \"TextBox\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"TitleText\"\n\ -Xmwidth: 336\n\ -Xmheight: 29\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 0\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 8\n\ -XmbottomOffset: 106\n\ -XmleftOffset: 8\n\ -XmrightOffset: 9\n\ -Private-\n\ -EndWidget.\n\ -Ref: 16\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"InFrame\"\n\ -Xmwidth: 347\n\ -Xmheight: 197\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 38\n\ -XmbottomOffset: 101\n\ -XmleftOffset: 8\n\ -XmrightOffset: 9\n\ -Private-\n\ -shadowtype: 0\n\ -EndWidget.\n\ -Ref: 17\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"OutFrame\"\n\ -Xmwidth: 362\n\ -Xmheight: 275\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 1\n\ -XmleftOffset: 1\n\ -XmrightOffset: 1\n\ -Private-\n\ -shadowtype: 1\n\ -EndWidget.\n\ -END.\n\ -"; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm deleted file mode 100644 index e20c1d81d6c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/fb.xbm +++ /dev/null @@ -1,9 +0,0 @@ -#define fb_width 20 -#define fb_height 20 -static unsigned char fb_bits[] = { -0x00, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x8a, 0x02, 0x00, -0x4d, 0x03, 0x80, 0xaa, 0x02, 0x40, 0x5d, 0x03, 0xa0, 0x28, -0x02, 0x50, 0x1c, 0x03, 0x28, 0x00, 0x02, 0x1c, 0x00, 0x03, -0x38, 0x00, 0x02, 0x70, 0x1c, 0x03, 0xe0, 0x38, 0x02, 0xc0, -0x7d, 0x03, 0x80, 0xeb, 0x02, 0x00, 0xcf, 0x03, 0x00, 0x8e, -0x03, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm deleted file mode 100644 index 82b4c250417..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/ff.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define ff_width 20 -#define ff_height 20 -static unsigned char ff_bits[] = { - 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x14, 0x05, 0x00, 0x2c, 0x0b, 0x00, - 0x54, 0x15, 0x00, 0xac, 0x2b, 0x00, 0x44, 0x51, 0x00, 0x8c, 0xa3, 0x00, - 0x04, 0x40, 0x01, 0x0c, 0x80, 0x03, 0x04, 0xc0, 0x01, 0x8c, 0xe3, 0x00, - 0xc4, 0x71, 0x00, 0xec, 0x3b, 0x00, 0x74, 0x1d, 0x00, 0x3c, 0x0f, 0x00, - 0x1c, 0x07, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm deleted file mode 100644 index 9847623ba6a..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/loop.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define loop_width 20 -#define loop_height 20 -static unsigned char loop_bits[] = { - 0x00, 0x10, 0x00, 0x00, 0xf0, 0x00, 0xa0, 0xa0, 0x03, 0x50, 0x51, 0x05, - 0xe8, 0xa0, 0x06, 0x74, 0x50, 0x03, 0x38, 0xe0, 0x02, 0x34, 0x70, 0x05, - 0x1a, 0x80, 0x06, 0x14, 0x00, 0x05, 0x1a, 0x80, 0x06, 0x14, 0x00, 0x05, - 0x2a, 0x80, 0x06, 0x54, 0x40, 0x03, 0xa8, 0xaa, 0x02, 0x50, 0x55, 0x01, - 0xb0, 0xea, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib deleted file mode 100644 index b3cc211d9ad..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/old.MainWindow.mib +++ /dev/null @@ -1,305 +0,0 @@ -static char MainMib[] = "\ -TotalWidgets: 16\n\ -Ref: 1\n\ -Widget: \"RootForm\"\n\ -Children: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Root\"\n\ -Xmwidth: 364\n\ -Xmheight: 306\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 0\n\ -XmleftOffset: 0\n\ -XmrightOffset: 0\n\ -Private-\n\ -EndWidget.\n\ -Ref: 2\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Exit\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 8\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Exit\"\n\ -EndWidget.\n\ -Ref: 3\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Info\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 53\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Info\"\n\ -EndWidget.\n\ -Ref: 4\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Para\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 98\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Para\"\n\ -EndWidget.\n\ -Ref: 5\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Prog\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 0\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 143\n\ -XmrightOffset: 10\n\ -Private-\n\ -label: \"Prog\"\n\ -EndWidget.\n\ -Ref: 6\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Step\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 9\n\ -Private-\n\ -label: \"Step\"\n\ -EndWidget.\n\ -Ref: 7\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Play\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 42\n\ -Private-\n\ -label: \"Play\"\n\ -EndWidget.\n\ -Ref: 8\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"FF\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 75\n\ -Private-\n\ -label: \"FF\"\n\ -EndWidget.\n\ -Ref: 9\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Stop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 108\n\ -Private-\n\ -label: \"Stop\"\n\ -EndWidget.\n\ -Ref: 10\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Rewind\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 141\n\ -Private-\n\ -label: \"Rewind\"\n\ -EndWidget.\n\ -Ref: 11\n\ -Widget: \"Button\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Normal\"\n\ -Xmwidth: 41\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 174\n\ -Private-\n\ -label: \"Norm\"\n\ -EndWidget.\n\ -Ref: 12\n\ -Widget: \"Toggle\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Loop\"\n\ -Xmwidth: 28\n\ -Xmheight: 28\n\ -XmtopAttachment: 0\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 0\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 179\n\ -XmbottomOffset: 69\n\ -XmleftOffset: 100\n\ -XmrightOffset: 219\n\ -Private-\n\ -label: \"Loop\"\n\ -EndWidget.\n\ -Ref: 13\n\ -Widget: \"DrawingArea\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"Monitor\"\n\ -Xmwidth: 336\n\ -Xmheight: 157\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 43\n\ -XmbottomOffset: 106\n\ -XmleftOffset: 13\n\ -XmrightOffset: 15\n\ -Private-\n\ -EndWidget.\n\ -Ref: 14\n\ -Widget: \"TextBox\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"TitleText\"\n\ -Xmwidth: 336\n\ -Xmheight: 29\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 0\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 8\n\ -XmbottomOffset: 106\n\ -XmleftOffset: 8\n\ -XmrightOffset: 9\n\ -Private-\n\ -EndWidget.\n\ -Ref: 15\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"InFrame\"\n\ -Xmwidth: 347\n\ -Xmheight: 197\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 38\n\ -XmbottomOffset: 101\n\ -XmleftOffset: 8\n\ -XmrightOffset: 9\n\ -Private-\n\ -shadowtype: 0\n\ -EndWidget.\n\ -Ref: 16\n\ -Widget: \"Frame\"\n\ -Children: X\n\ -Parent: 1\n\ -Public-\n\ -Name: \"OutFrame\"\n\ -Xmwidth: 362\n\ -Xmheight: 275\n\ -XmtopAttachment: 1\n\ -XmbottomAttachment: 1\n\ -XmleftAttachment: 1\n\ -XmrightAttachment: 1\n\ -XmtopOffset: 0\n\ -XmbottomOffset: 1\n\ -XmleftOffset: 1\n\ -XmrightOffset: 1\n\ -Private-\n\ -shadowtype: 1\n\ -EndWidget.\n\ -END.\n\ -"; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm deleted file mode 100644 index 91955e5117c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/play.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define play_width 20 -#define play_height 20 -static unsigned char play_bits[] = { - 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x40, 0x01, 0x00, 0xc0, 0x02, 0x00, - 0x40, 0x05, 0x00, 0xc0, 0x0a, 0x00, 0x40, 0x14, 0x00, 0xc0, 0x28, 0x00, - 0x40, 0x50, 0x00, 0xc0, 0xe0, 0x00, 0x40, 0x70, 0x00, 0xc0, 0x38, 0x00, - 0x40, 0x1c, 0x00, 0xc0, 0x0e, 0x00, 0x40, 0x07, 0x00, 0xc0, 0x03, 0x00, - 0xc0, 0x01, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm deleted file mode 100644 index 402643dcd25..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/rewind.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define rewind_width 20 -#define rewind_height 20 -static unsigned char rewind_bits[] = { - 0x00, 0x00, 0x00, 0x30, 0x80, 0x01, 0x28, 0x40, 0x01, 0x30, 0xa0, 0x01, - 0x28, 0x50, 0x01, 0x30, 0xa8, 0x01, 0x28, 0x14, 0x01, 0x30, 0x8a, 0x01, - 0x28, 0x05, 0x01, 0xb0, 0x83, 0x01, 0x28, 0x03, 0x01, 0x30, 0x8e, 0x01, - 0x28, 0x1c, 0x01, 0x30, 0xb8, 0x01, 0x28, 0x70, 0x01, 0x30, 0xe0, 0x01, - 0x28, 0xc0, 0x01, 0x38, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm deleted file mode 100644 index 3ac996cbdb7..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/step.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define step_width 20 -#define step_height 20 -static unsigned char step_bits[] = { - 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x14, 0x05, 0x00, 0x18, 0x0b, 0x00, - 0x14, 0x15, 0x00, 0x18, 0x2b, 0x00, 0x14, 0x51, 0x00, 0x18, 0xa3, 0x00, - 0x14, 0x41, 0x01, 0x18, 0x83, 0x03, 0x14, 0xc1, 0x01, 0x18, 0xe3, 0x00, - 0x14, 0x71, 0x00, 0x18, 0x3b, 0x00, 0x14, 0x1d, 0x00, 0x18, 0x0f, 0x00, - 0x14, 0x07, 0x00, 0x1c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm deleted file mode 100644 index 490ee392761..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/interface/stop.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define stop_width 20 -#define stop_height 20 -static unsigned char stop_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x54, 0x55, 0x01, - 0xac, 0xaa, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, - 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, - 0x0c, 0x80, 0x02, 0x14, 0x80, 0x01, 0x0c, 0x80, 0x02, 0xf4, 0xff, 0x01, - 0xac, 0xaa, 0x02, 0x54, 0x55, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp deleted file mode 100644 index b59adbd847b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/jrevdct.cpp +++ /dev/null @@ -1,1457 +0,0 @@ -/* $Id$ */ -/* - * jrevdct.c - * - * Copyright (C) 1991, 1992, Thomas G. Lane. - * This file is part of the Independent JPEG Group's software. - * For conditions of distribution and use, see the accompanying README file. - * - * This file contains the basic inverse-DCT transformation subroutine. - * - * This implementation is based on an algorithm described in - * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT - * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, - * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. - * The primary algorithm described there uses 11 multiplies and 29 adds. - * We use their alternate method with 12 multiplies and 32 adds. - * The advantage of this method is that no data path contains more than one - * multiplication; this allows a very simple and accurate implementation in - * scaled fixed-point arithmetic, with a minimal number of shifts. - * - * I've made lots of modifications to attempt to take advantage of the - * sparse nature of the DCT matrices we're getting. Although the logic - * is cumbersome, it's straightforward and the resulting code is much - * faster. - * - * A better way to do this would be to pass in the DCT block as a sparse - * matrix, perhaps with the difference cases encoded. - */ - -#include <string.h> -#include "video.h" -#include "proto.h" - -#define GLOBAL /* a function referenced thru EXTERNs */ - -/* We assume that right shift corresponds to signed division by 2 with - * rounding towards minus infinity. This is correct for typical "arithmetic - * shift" instructions that shift in copies of the sign bit. But some - * C compilers implement >> with an unsigned shift. For these machines you - * must define RIGHT_SHIFT_IS_UNSIGNED. - * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. - * It is only applied with constant shift counts. SHIFT_TEMPS must be - * included in the variables of any routine using RIGHT_SHIFT. - */ - -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define SHIFT_TEMPS INT32 shift_temp; -#define RIGHT_SHIFT(x,shft) \ - ((shift_temp = (x)) < 0 ? \ - (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ - (shift_temp >> (shft))) -#else -#define SHIFT_TEMPS -#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) -#endif - -/* - * This routine is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* - * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT - * on each column. Direct algorithms are also available, but they are - * much more complex and seem not to be any faster when reduced to code. - * - * The poop on this scaling stuff is as follows: - * - * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) - * larger than the true IDCT outputs. The final outputs are therefore - * a factor of N larger than desired; since N=8 this can be cured by - * a simple right shift at the end of the algorithm. The advantage of - * this arrangement is that we save two multiplications per 1-D IDCT, - * because the y0 and y4 inputs need not be divided by sqrt(N). - * - * We have to do addition and subtraction of the integer inputs, which - * is no problem, and multiplication by fractional constants, which is - * a problem to do in integer arithmetic. We multiply all the constants - * by CONST_SCALE and convert them to integer constants (thus retaining - * CONST_BITS bits of precision in the constants). After doing a - * multiplication we have to divide the product by CONST_SCALE, with proper - * rounding, to produce the correct output. This division can be done - * cheaply as a right shift of CONST_BITS bits. We postpone shifting - * as long as possible so that partial sums can be added together with - * full fractional precision. - * - * The outputs of the first pass are scaled up by PASS1_BITS bits so that - * they are represented to better-than-integral precision. These outputs - * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word - * with the recommended scaling. (To scale up 12-bit sample data further, an - * intermediate INT32 array would be needed.) - * - * To avoid overflow of the 32-bit intermediate results in pass 2, we must - * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis - * shows that the values given below are the most effective. - */ - -#ifdef EIGHT_BIT_SAMPLES -#define PASS1_BITS 2 -#else -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -#define ONE ((INT32) 1) - -#define CONST_SCALE (ONE << CONST_BITS) - -/* Convert a positive real constant to an integer scaled by CONST_SCALE. - * IMPORTANT: if your compiler doesn't do this arithmetic at compile time, - * you will pay a significant penalty in run time. In that case, figure - * the correct integer constant values and insert them by hand. - */ - -#define FIX(x) ((INT32) ((x) * CONST_SCALE + 0.5)) - -/* Descale and correctly round an INT32 value that's scaled by N bits. - * We assume RIGHT_SHIFT rounds towards minus infinity, so adding - * the fudge factor is correct for either sign of X. - */ - -#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) - -/* Multiply an INT32 variable by an INT32 constant to yield an INT32 result. - * For 8-bit samples with the recommended scaling, all the variable - * and constant values involved are no more than 16 bits wide, so a - * 16x16->32 bit multiply can be used instead of a full 32x32 multiply; - * this provides a useful speedup on many machines. - * There is no way to specify a 16x16->32 multiply in portable C, but - * some C compilers will do the right thing if you provide the correct - * combination of casts. - * NB: for 12-bit samples, a full 32-bit multiplication will be needed. - */ - -#ifdef EIGHT_BIT_SAMPLES -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ -#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const))) -#endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ -#define MULTIPLY(var,const) (((INT16) (var)) * ((INT32) (const))) -#endif -#endif - -#ifndef MULTIPLY /* default definition */ -#define MULTIPLY(var,const) ((var) * (const)) -#endif - -/* Precomputed idct value arrays. */ - -static DCTELEM PreIDCT[64][64]; - -void j_rev_dct (DCTBLOCK data); - -/* Pre compute singleton coefficient IDCT values. */ -void -init_pre_idct() { - int i; - - for (i=0; i<64; i++) { - memset((char *) PreIDCT[i], 0, 64*sizeof(DCTELEM)); - PreIDCT[i][i] = 2048; - j_rev_dct(PreIDCT[i]); - } -} - -#ifndef ORIG_DCT - - -/* - * Perform the inverse DCT on one block of coefficients. - */ - -void -j_rev_dct_sparse (DCTBLOCK data, int pos) -{ - register DCTELEM *dataptr; - short int val; - DCTELEM *ndataptr; - int scale, coeff, rr; - register int *dp; - register int v; - - /* If DC Coefficient. */ - - if (pos == 0) { - dp = (int *)data; - v = *data; - /* Compute 32 bit value to assign. This speeds things up a bit */ - if (v < 0) val = (v-3)>>3; - else val = (v+4)>>3; - v = val | (val << 16); - dp[0] = v; dp[1] = v; dp[2] = v; dp[3] = v; - dp[4] = v; dp[5] = v; dp[6] = v; dp[7] = v; - dp[8] = v; dp[9] = v; dp[10] = v; dp[11] = v; - dp[12] = v; dp[13] = v; dp[14] = v; dp[15] = v; - dp[16] = v; dp[17] = v; dp[18] = v; dp[19] = v; - dp[20] = v; dp[21] = v; dp[22] = v; dp[23] = v; - dp[24] = v; dp[25] = v; dp[26] = v; dp[27] = v; - dp[28] = v; dp[29] = v; dp[30] = v; dp[31] = v; - return; - } - - /* Some other coefficient. */ - dataptr = (DCTELEM *)data; - coeff = dataptr[pos]; - ndataptr = PreIDCT[pos]; - - for (rr=0; rr<4; rr++) { - dataptr[0] = (ndataptr[0] * coeff) >> (CONST_BITS-2); - dataptr[1] = (ndataptr[1] * coeff) >> (CONST_BITS-2); - dataptr[2] = (ndataptr[2] * coeff) >> (CONST_BITS-2); - dataptr[3] = (ndataptr[3] * coeff) >> (CONST_BITS-2); - dataptr[4] = (ndataptr[4] * coeff) >> (CONST_BITS-2); - dataptr[5] = (ndataptr[5] * coeff) >> (CONST_BITS-2); - dataptr[6] = (ndataptr[6] * coeff) >> (CONST_BITS-2); - dataptr[7] = (ndataptr[7] * coeff) >> (CONST_BITS-2); - dataptr[8] = (ndataptr[8] * coeff) >> (CONST_BITS-2); - dataptr[9] = (ndataptr[9] * coeff) >> (CONST_BITS-2); - dataptr[10] = (ndataptr[10] * coeff) >> (CONST_BITS-2); - dataptr[11] = (ndataptr[11] * coeff) >> (CONST_BITS-2); - dataptr[12] = (ndataptr[12] * coeff) >> (CONST_BITS-2); - dataptr[13] = (ndataptr[13] * coeff) >> (CONST_BITS-2); - dataptr[14] = (ndataptr[14] * coeff) >> (CONST_BITS-2); - dataptr[15] = (ndataptr[15] * coeff) >> (CONST_BITS-2); - dataptr += 16; - ndataptr += 16; - } - return; -} - - -void -j_rev_dct (DCTBLOCK data) -{ - INT32 tmp0, tmp1, tmp2, tmp3; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 z1, z2, z3, z4, z5; - INT32 d0, d1, d2, d3, d4, d5, d6, d7; - register DCTELEM *dataptr; - int rowctr; - SHIFT_TEMPS - - /* Pass 1: process rows. */ - /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - dataptr = data; - - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any row in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * row DCT calculations can be simplified this way. - */ - - register int *idataptr = (int*)dataptr; - d0 = dataptr[0]; - d1 = dataptr[1]; - if ((d1 == 0) && (idataptr[1] | idataptr[2] | idataptr[3]) == 0) { - /* AC terms all zero */ - if (d0) { - /* Compute a 32 bit value to assign. */ - DCTELEM dcval = (DCTELEM) (d0 << PASS1_BITS); - register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); - - idataptr[0] = v; - idataptr[1] = v; - idataptr[2] = v; - idataptr[3] = v; - } - - dataptr += DCTSIZE; /* advance pointer to next row */ - continue; - } - d2 = dataptr[2]; - d3 = dataptr[3]; - d4 = dataptr[4]; - d5 = dataptr[5]; - d6 = dataptr[6]; - d7 = dataptr[7]; - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - if (d6) { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, -FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } - } - } else { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = d4 << CONST_BITS; - tmp11 = tmp12 = -tmp10; - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = 0; - } - } - } - } - - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7; - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5; - z3 = d7; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(d7, - FIX(0.601344887)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - tmp1 = MULTIPLY(d5, - FIX(0.509795578)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - z5 = MULTIPLY(d5 + d7, FIX(1.175875602)); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(d3, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(d1, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(d7, - FIX(0.601344887)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - tmp2 = MULTIPLY(d3, FIX(0.509795579)); - z2 = MULTIPLY(d3, - FIX(2.562915447)); - z5 = MULTIPLY(z3, FIX(1.175875602)); - z3 = MULTIPLY(z3, - FIX(0.785694958)); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX(1.175875602)); - - z1 = MULTIPLY(z1, FIX(0.275899379)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - tmp0 = MULTIPLY(d7, - FIX(1.662939224)); - z4 = MULTIPLY(d1, - FIX(0.390180644)); - tmp3 = MULTIPLY(d1, FIX(1.111140466)); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(d7, - FIX(1.387039845)); - tmp1 = MULTIPLY(d7, FIX(1.175875602)); - tmp2 = MULTIPLY(d7, - FIX(0.785694958)); - tmp3 = MULTIPLY(d7, FIX(0.275899379)); - } - } - } - } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX(1.175875602)); - - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(d1, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(d3, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX(1.175875602)); - tmp1 = MULTIPLY(d5, FIX(1.662939225)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - z2 = MULTIPLY(z2, - FIX(1.387039845)); - tmp2 = MULTIPLY(d3, FIX(1.111140466)); - z3 = MULTIPLY(d3, - FIX(1.961570560)); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX(1.175875602)); - z1 = MULTIPLY(d1, - FIX(0.899976223)); - tmp3 = MULTIPLY(d1, FIX(0.601344887)); - tmp1 = MULTIPLY(d5, - FIX(0.509795578)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z4 = MULTIPLY(z4, FIX(0.785694958)); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX(1.175875602)); - tmp1 = MULTIPLY(d5, FIX(0.275899380)); - tmp2 = MULTIPLY(d5, - FIX(1.387039845)); - tmp3 = MULTIPLY(d5, FIX(0.785694958)); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX(0.211164243)); - tmp2 = MULTIPLY(d3, - FIX(1.451774981)); - z1 = MULTIPLY(d1, FIX(1.061594337)); - z2 = MULTIPLY(d3, - FIX(2.172734803)); - z4 = MULTIPLY(z5, FIX(0.785694958)); - z5 = MULTIPLY(z5, FIX(1.175875602)); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d3, - FIX(0.785694958)); - tmp1 = MULTIPLY(d3, - FIX(1.387039845)); - tmp2 = MULTIPLY(d3, - FIX(0.275899379)); - tmp3 = MULTIPLY(d3, FIX(1.175875602)); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX(0.275899379)); - tmp1 = MULTIPLY(d1, FIX(0.785694958)); - tmp2 = MULTIPLY(d1, FIX(1.175875602)); - tmp3 = MULTIPLY(d1, FIX(1.387039845)); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } - } - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); - dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); - dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); - dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); - dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); - dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); - dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); - dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - dataptr = data; - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Columns of zeroes can be exploited in the same way as we did with rows. - * However, the row calculation has created many nonzero AC terms, so the - * simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - - d0 = dataptr[DCTSIZE*0]; - d1 = dataptr[DCTSIZE*1]; - d2 = dataptr[DCTSIZE*2]; - d3 = dataptr[DCTSIZE*3]; - d4 = dataptr[DCTSIZE*4]; - d5 = dataptr[DCTSIZE*5]; - d6 = dataptr[DCTSIZE*6]; - d7 = dataptr[DCTSIZE*7]; - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - if (d6) { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, -FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(d6, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */ - tmp2 = MULTIPLY(d6, - FIX(1.306562965)); - tmp3 = MULTIPLY(d6, FIX(0.541196100)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } - } - } else { - if (d4) { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = d4 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp2 - tmp0; - tmp12 = -(tmp0 + tmp2); - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = d4 << CONST_BITS; - tmp11 = tmp12 = -tmp10; - } - } - } else { - if (d2) { - if (d0) { - /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp0 = d0 << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp0 + tmp2; - tmp12 = tmp0 - tmp2; - } else { - /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX(0.541196100)); - tmp3 = MULTIPLY(d2, FIX(1.306562965)); - - tmp10 = tmp3; - tmp13 = -tmp3; - tmp11 = tmp2; - tmp12 = -tmp2; - } - } else { - if (d0) { - /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS; - } else { - /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */ - tmp10 = tmp13 = tmp11 = tmp12 = 0; - } - } - } - } - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7; - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5; - z3 = d7; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(d7, - FIX(0.601344887)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - tmp1 = MULTIPLY(d5, - FIX(0.509795578)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - z5 = MULTIPLY(d5 + d7, FIX(1.175875602)); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX(1.175875602)); - - tmp0 = MULTIPLY(d7, FIX(0.298631336)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(z1, - FIX(0.899976223)); - z2 = MULTIPLY(d3, - FIX(2.562915447)); - z3 = MULTIPLY(z3, - FIX(1.961570560)); - z4 = MULTIPLY(d1, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(d7, - FIX(0.601344887)); - z1 = MULTIPLY(d7, - FIX(0.899976223)); - tmp2 = MULTIPLY(d3, FIX(0.509795579)); - z2 = MULTIPLY(d3, - FIX(2.562915447)); - z5 = MULTIPLY(z3, FIX(1.175875602)); - z3 = MULTIPLY(z3, - FIX(0.785694958)); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX(1.175875602)); - - z1 = MULTIPLY(z1, FIX(0.275899379)); - z3 = MULTIPLY(d7, - FIX(1.961570560)); - tmp0 = MULTIPLY(d7, - FIX(1.662939224)); - z4 = MULTIPLY(d1, - FIX(0.390180644)); - tmp3 = MULTIPLY(d1, FIX(1.111140466)); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(d7, - FIX(1.387039845)); - tmp1 = MULTIPLY(d7, FIX(1.175875602)); - tmp2 = MULTIPLY(d7, - FIX(0.785694958)); - tmp3 = MULTIPLY(d7, FIX(0.275899379)); - } - } - } - } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX(1.175875602)); - - tmp1 = MULTIPLY(d5, FIX(2.053119869)); - tmp2 = MULTIPLY(d3, FIX(3.072711026)); - tmp3 = MULTIPLY(d1, FIX(1.501321110)); - z1 = MULTIPLY(d1, - FIX(0.899976223)); - z2 = MULTIPLY(z2, - FIX(2.562915447)); - z3 = MULTIPLY(d3, - FIX(1.961570560)); - z4 = MULTIPLY(z4, - FIX(0.390180644)); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX(1.175875602)); - tmp1 = MULTIPLY(d5, FIX(1.662939225)); - z4 = MULTIPLY(d5, - FIX(0.390180644)); - z2 = MULTIPLY(z2, - FIX(1.387039845)); - tmp2 = MULTIPLY(d3, FIX(1.111140466)); - z3 = MULTIPLY(d3, - FIX(1.961570560)); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX(1.175875602)); - z1 = MULTIPLY(d1, - FIX(0.899976223)); - tmp3 = MULTIPLY(d1, FIX(0.601344887)); - tmp1 = MULTIPLY(d5, - FIX(0.509795578)); - z2 = MULTIPLY(d5, - FIX(2.562915447)); - z4 = MULTIPLY(z4, FIX(0.785694958)); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX(1.175875602)); - tmp1 = MULTIPLY(d5, FIX(0.275899380)); - tmp2 = MULTIPLY(d5, - FIX(1.387039845)); - tmp3 = MULTIPLY(d5, FIX(0.785694958)); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX(0.211164243)); - tmp2 = MULTIPLY(d3, - FIX(1.451774981)); - z1 = MULTIPLY(d1, FIX(1.061594337)); - z2 = MULTIPLY(d3, - FIX(2.172734803)); - z4 = MULTIPLY(z5, FIX(0.785694958)); - z5 = MULTIPLY(z5, FIX(1.175875602)); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d3, - FIX(0.785694958)); - tmp1 = MULTIPLY(d3, - FIX(1.387039845)); - tmp2 = MULTIPLY(d3, - FIX(0.275899379)); - tmp3 = MULTIPLY(d3, FIX(1.175875602)); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX(0.275899379)); - tmp1 = MULTIPLY(d1, FIX(0.785694958)); - tmp2 = MULTIPLY(d1, FIX(1.175875602)); - tmp3 = MULTIPLY(d1, FIX(1.387039845)); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } - } - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3); - - dataptr++; /* advance pointer to next column */ - } -} - -#else - - -void -j_rev_dct_sparse (DCTBLOCK data, int pos) -{ - j_rev_dct(data); -} - -void -j_rev_dct (DCTBLOCK data) -{ - INT32 tmp0, tmp1, tmp2, tmp3; - INT32 tmp10, tmp11, tmp12, tmp13; - INT32 z1, z2, z3, z4, z5; - register DCTELEM *dataptr; - int rowctr; - SHIFT_TEMPS - - /* Pass 1: process rows. */ - /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - dataptr = data; - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any row in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * row DCT calculations can be simplified this way. - */ - - if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] | - dataptr[5] | dataptr[6] | dataptr[7]) == 0) { - /* AC terms all zero */ - DCTELEM dcval = (DCTELEM) (dataptr[0] << PASS1_BITS); - - dataptr[0] = dcval; - dataptr[1] = dcval; - dataptr[2] = dcval; - dataptr[3] = dcval; - dataptr[4] = dcval; - dataptr[5] = dcval; - dataptr[6] = dcval; - dataptr[7] = dcval; - - dataptr += DCTSIZE; /* advance pointer to next row */ - continue; - } - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - - z2 = (INT32) dataptr[2]; - z3 = (INT32) dataptr[6]; - - z1 = MULTIPLY(z2 + z3, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865)); - - tmp0 = ((INT32) dataptr[0] + (INT32) dataptr[4]) << CONST_BITS; - tmp1 = ((INT32) dataptr[0] - (INT32) dataptr[4]) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - tmp0 = (INT32) dataptr[7]; - tmp1 = (INT32) dataptr[5]; - tmp2 = (INT32) dataptr[3]; - tmp3 = (INT32) dataptr[1]; - - z1 = tmp0 + tmp3; - z2 = tmp1 + tmp2; - z3 = tmp0 + tmp2; - z4 = tmp1 + tmp3; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */ - - tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[0] = (DCTELEM) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); - dataptr[7] = (DCTELEM) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); - dataptr[1] = (DCTELEM) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); - dataptr[6] = (DCTELEM) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); - dataptr[2] = (DCTELEM) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); - dataptr[5] = (DCTELEM) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); - dataptr[3] = (DCTELEM) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); - dataptr[4] = (DCTELEM) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - dataptr = data; - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Columns of zeroes can be exploited in the same way as we did with rows. - * However, the row calculation has created many nonzero AC terms, so the - * simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - -#ifndef NO_ZERO_COLUMN_TEST - if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] | - dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] | - dataptr[DCTSIZE*7]) == 0) { - /* AC terms all zero */ - DCTELEM dcval = (DCTELEM) DESCALE((INT32) dataptr[0], PASS1_BITS+3); - - dataptr[DCTSIZE*0] = dcval; - dataptr[DCTSIZE*1] = dcval; - dataptr[DCTSIZE*2] = dcval; - dataptr[DCTSIZE*3] = dcval; - dataptr[DCTSIZE*4] = dcval; - dataptr[DCTSIZE*5] = dcval; - dataptr[DCTSIZE*6] = dcval; - dataptr[DCTSIZE*7] = dcval; - - dataptr++; /* advance pointer to next column */ - continue; - } -#endif - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - - z2 = (INT32) dataptr[DCTSIZE*2]; - z3 = (INT32) dataptr[DCTSIZE*6]; - - z1 = MULTIPLY(z2 + z3, FIX(0.541196100)); - tmp2 = z1 + MULTIPLY(z3, - FIX(1.847759065)); - tmp3 = z1 + MULTIPLY(z2, FIX(0.765366865)); - - tmp0 = ((INT32) dataptr[DCTSIZE*0] + (INT32) dataptr[DCTSIZE*4]) << CONST_BITS; - tmp1 = ((INT32) dataptr[DCTSIZE*0] - (INT32) dataptr[DCTSIZE*4]) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - tmp0 = (INT32) dataptr[DCTSIZE*7]; - tmp1 = (INT32) dataptr[DCTSIZE*5]; - tmp2 = (INT32) dataptr[DCTSIZE*3]; - tmp3 = (INT32) dataptr[DCTSIZE*1]; - - z1 = tmp0 + tmp3; - z2 = tmp1 + tmp2; - z3 = tmp0 + tmp2; - z4 = tmp1 + tmp3; - z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */ - - tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */ - tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */ - tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */ - tmp3 = MULTIPLY(tmp3, FIX(1.501321110)); /* sqrt(2) * ( c1+c3-c5-c7) */ - z1 = MULTIPLY(z1, - FIX(0.899976223)); /* sqrt(2) * (c7-c3) */ - z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */ - z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */ - z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */ - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[DCTSIZE*0] = (DCTELEM) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*7] = (DCTELEM) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*1] = (DCTELEM) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*6] = (DCTELEM) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*2] = (DCTELEM) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*5] = (DCTELEM) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*3] = (DCTELEM) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*4] = (DCTELEM) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3); - - dataptr++; /* advance pointer to next column */ - } -} - - -#endif diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp deleted file mode 100644 index 997a14c21e7..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mb_ordered.cpp +++ /dev/null @@ -1,512 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to implement an ordered dither. */ - -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -#define DITH_SIZE 16 - - -/* Structures used to implement macroblock ordered - dither algorithm. -*/ - -static unsigned char ***ditherPtr[DITH_SIZE]; - - -/* - *-------------------------------------------------------------- - * - * InitMBOrderedDither-- - * - * Structures intialized for ordered dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitMBOrderedDither() -{ - unsigned char ****pos_2_cb; - unsigned char ***cb_2_cr; - unsigned char **cr_2_l; - int cb_val, cb_rval, cr_val, cr_rval, l_val, l_rval; - int i, j, pos; - int err_range, threshval; - - pos_2_cb = (unsigned char ****) malloc (DITH_SIZE*sizeof(unsigned char ***)); - cb_2_cr = (unsigned char ***) malloc(CB_RANGE*sizeof(unsigned char **)); - cr_2_l = (unsigned char **) malloc(CR_RANGE*sizeof(unsigned char *)); - - for (pos=0; pos<DITH_SIZE; pos++) { - - pos_2_cb[pos] = (unsigned char ***) malloc(256*(sizeof(unsigned char **))); - - for (j=0; j<CB_RANGE; j++) { - cb_2_cr[j] = (unsigned char **) malloc(256*(sizeof(unsigned char *))); - } - - for (cb_val=0; cb_val<cb_values[0]; cb_val++) { - (pos_2_cb[pos])[cb_val] = cb_2_cr[0]; - } - - for (cb_rval=0; cb_rval<(CB_RANGE-1); cb_rval++) { - err_range = cb_values[cb_rval+1] - cb_values[cb_rval]; - threshval = ((pos*err_range)/DITH_SIZE)+cb_values[cb_rval]; - - for (cb_val=cb_values[cb_rval]; cb_val<cb_values[cb_rval+1]; cb_val++) { - if (cb_val>threshval) (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval+1]; - else (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval]; - } - } - - for (cb_val=cb_values[CB_RANGE-1]; cb_val<256; cb_val++) { - (pos_2_cb[pos])[cb_val] = cb_2_cr[CB_RANGE-1]; - } - - for (cb_rval=0; cb_rval<CB_RANGE; cb_rval++) { - - for (j=0; j<CR_RANGE; j++) { - cr_2_l[j] = (unsigned char *) malloc(256*(sizeof(unsigned char))); - } - - for (cr_val=0; cr_val < cr_values[0]; cr_val++) { - (cb_2_cr[cb_rval])[cr_val] = cr_2_l[0]; - } - - for (cr_rval=0; cr_rval<(CR_RANGE-1); cr_rval++) { - err_range = cr_values[cr_rval+1] - cr_values[cr_rval]; - threshval = ((pos*err_range)/DITH_SIZE)+cr_values[cr_rval]; - - for (cr_val=cr_values[cr_rval]; cr_val<cr_values[cr_rval+1]; cr_val++) { - if (cr_val>threshval) (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval+1]; - else (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval]; - } - } - - for (cr_val=cr_values[CR_RANGE-1]; cr_val<256; cr_val++) { - (cb_2_cr[cb_rval])[cr_val] = cr_2_l[CR_RANGE-1]; - } - - for (cr_rval=0; cr_rval<CR_RANGE; cr_rval++) { - - for (l_val = 0; l_val < lum_values[0]; l_val++) { - (cr_2_l[cr_rval])[l_val] = pixel[cb_rval+(cr_rval*CB_RANGE)+ - (0*CR_RANGE*CB_RANGE)]; - } - - for (l_rval=0; l_rval<(LUM_RANGE-1); l_rval++) { - err_range = lum_values[l_rval+1] - lum_values[l_rval]; - threshval = ((pos*err_range) /DITH_SIZE) + lum_values[l_rval]; - - for (l_val = lum_values[l_rval]; l_val < lum_values[l_rval+1]; l_val++) { - if (l_val>threshval) (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+((l_rval+1)*CR_RANGE*CB_RANGE)]; - else (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+(l_rval*CR_RANGE*CB_RANGE)]; - } - } - - for (l_val = lum_values[LUM_RANGE-1]; l_val < 256; l_val++) { - (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+((LUM_RANGE-1)*CR_RANGE*CB_RANGE)]; - } - } - } - } - - for (i=0; i<DITH_SIZE; i++) { - ditherPtr[i] = pos_2_cb[i]; - } -} - - - -/* - *-------------------------------------------------------------- - * - * MBOrderedDitherImage -- - * - * Dithers an image using an ordered dither at macroblock level. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * The channels are dithered based on the standard - * ordered dither pattern for a 4x4 area. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -MBOrderedDitherImage (unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - unsigned char *l, *r, *b, *o1, *o2; - unsigned char *l2; - unsigned char L, R, B; - int i, j, mbaddr, mbwidth; - unsigned char ***dp0 = ditherPtr[0]; - unsigned char ***dp2 = ditherPtr[2]; - unsigned char ***dp4 = ditherPtr[4]; - unsigned char ***dp6 = ditherPtr[6]; - unsigned char ***dp8 = ditherPtr[8]; - unsigned char ***dp10 = ditherPtr[10]; - unsigned char ***dp12 = ditherPtr[12]; - unsigned char ***dp14 = ditherPtr[14]; - unsigned char ***dp1 = ditherPtr[1]; - unsigned char ***dp3 = ditherPtr[3]; - unsigned char ***dp5 = ditherPtr[5]; - unsigned char ***dp7 = ditherPtr[7]; - unsigned char ***dp9 = ditherPtr[9]; - unsigned char ***dp11 = ditherPtr[11]; - unsigned char ***dp13 = ditherPtr[13]; - unsigned char ***dp15 = ditherPtr[15]; - - l = lum; - l2 = lum + w; - r = cr; - b = cb; - o1 = out; - o2 = out+w; - mbwidth = w / 16; - - for (i=0; i<h; i+=4) { - - mbaddr = (i / 16) * mbwidth ; - - for (j=0; j<w; j+=8) { - - if (ditherFlags[mbaddr+(j/16)]) { - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = ((dp0[B])[R])[L]; - L = l[1]; - o1[1] = ((dp8[B])[R])[L]; - L = l2[0]; - o2[0] = ((dp12[B])[R])[L]; - L = l2[1]; - o2[1] = ((dp4[B])[R])[L]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = ((dp2[B])[R])[L]; - L = l[3]; - o1[3] = ((dp10[B])[R])[L]; - L = l2[2]; - o2[2] = ((dp14[B])[R])[L]; - L = l2[3]; - o2[3] = ((dp6[B])[R])[L]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = ((dp0[B])[R])[L]; - L = l[5]; - o1[5] = ((dp8[B])[R])[L]; - L = l2[4]; - o2[4] = ((dp12[B])[R])[L]; - L = l2[5]; - o2[5] = ((dp4[B])[R])[L]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = ((dp2[B])[R])[L]; - L = l[7]; - o1[7] = ((dp10[B])[R])[L]; - L = l2[6]; - o2[6] = ((dp14[B])[R])[L]; - L = l2[7]; - o2[7] = ((dp6[B])[R])[L]; - } - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - - for (j=0; j<w; j+=8) { - - if (ditherFlags[mbaddr+(j/16)]) { - - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = ((dp3[B])[R])[L]; - L = l[1]; - o1[1] = ((dp11[B])[R])[L]; - L = l2[0]; - o2[0] = ((dp15[B])[R])[L]; - L = l2[1]; - o2[1] = ((dp7[B])[R])[L]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = ((dp1[B])[R])[L]; - L = l[3]; - o1[3] = ((dp9[B])[R])[L]; - L = l2[2]; - o2[2] = ((dp13[B])[R])[L]; - L = l2[3]; - o2[3] = ((dp5[B])[R])[L]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = ((dp3[B])[R])[L]; - L = l[5]; - o1[5] = ((dp11[B])[R])[L]; - L = l2[4]; - o2[4] = ((dp15[B])[R])[L]; - L = l2[5]; - o2[5] = ((dp7[B])[R])[L]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = ((dp1[B])[R])[L]; - L = l[7]; - o1[7] = ((dp9[B])[R])[L]; - L = l2[6]; - o2[6] = ((dp13[B])[R])[L]; - L = l2[7]; - o2[7] = ((dp5[B])[R])[L]; - } - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - } -} - -void -MBOrderedDitherDisplayCopy(VidStream *vid_stream, int mb_addr, - int motion_forw, int r_right_forw, int r_down_forw, - int motion_back, int r_right_back, int r_down_back, - unsigned char *past, unsigned char *future) -{ - int right_back, right_forw, down_back, down_forw; - unsigned char *dest = NULL; - unsigned char *src1, *src2; - int row, col, row_size, rr; - int mc, mr; - - row = (mb_addr / vid_stream->mb_width) << 4; - col = (mb_addr % vid_stream->mb_width) << 4; - row_size = vid_stream->mb_width << 4; -/* - dest = vid_stream->current->display + (row * row_size) + col; -*/ - if (motion_forw) { - right_forw = r_right_forw >> 1; - down_forw = r_down_forw >> 1; - src1 = past + ((row + down_forw) * row_size) + (col + right_forw); - } - - if (motion_back) { - right_back = r_right_back >> 1; - down_back = r_down_back >> 1; - src2 = future + ((row + down_back) * row_size) + (col + right_back); - } - - if (motion_forw) { - if (motion_back) { - for (rr = 0; rr<16; rr++) { - dest[0] = src1[0]; dest[1] = src2[1]; - dest[2] = src1[2]; dest[3] = src2[3]; - dest[4] = src1[4]; dest[5] = src2[5]; - dest[6] = src1[6]; dest[7] = src2[7]; - dest[8] = src1[8]; dest[9] = src2[9]; - dest[10] = src1[10]; dest[11] = src2[11]; - dest[12] = src1[12]; dest[13] = src2[13]; - dest[14] = src1[14]; dest[15] = src2[15]; - - dest += row_size; - src1 += row_size; - src2 += row_size; - } - } - else { - mc = col & 0x3; - mr = right_forw & 0x3; - if (!mc && !mr) { - /* Use 32 bit copy */ - int *d, *s; - - d = (int *) dest; - s = (int *) src1; - row_size /= 4; - - for (rr = 0; rr < 16; rr++) { - d[0] = s[0]; - d[1] = s[1]; - d[2] = s[2]; - d[3] = s[3]; - d += row_size; - s += row_size; - } - } else if ((!mc || (mc == 2)) && - (!mr || (mr == 2))) { - /* Use 16 bit copy */ - short int *d, * s; - - d = (short int *) dest; - s = (short int *) src1; - row_size /= 2; - - for (rr = 0; rr < 16; rr++) { - d[0] = s[0]; - d[1] = s[1]; - d[2] = s[2]; - d[3] = s[3]; - d[4] = s[4]; - d[5] = s[5]; - d[6] = s[6]; - d[7] = s[7]; - d += row_size; - s += row_size; - } - } - else { - for (rr = 0; rr < 16; rr++) { - dest[0] = src1[0]; - dest[1] = src1[1]; - dest[2] = src1[2]; - dest[3] = src1[3]; - dest[4] = src1[4]; - dest[5] = src1[5]; - dest[6] = src1[6]; - dest[7] = src1[7]; - dest[8] = src1[8]; - dest[9] = src1[9]; - dest[10] = src1[10]; - dest[11] = src1[11]; - dest[12] = src1[12]; - dest[13] = src1[13]; - dest[14] = src1[14]; - dest[15] = src1[15]; - - dest += row_size; - src1 += row_size; - } - } - } - } - else if (motion_back) { - mc = col & 0x3; - mr = right_back & 0x3; - if (!mc && !mr) { - /* Use 32 bit copy */ - int *d, *s; - - d = (int *) dest; - s = (int *) src2; - row_size /= 4; - - for (rr = 0; rr < 16; rr++) { - d[0] = s[0]; - d[1] = s[1]; - d[2] = s[2]; - d[3] = s[3]; - d += row_size; - s += row_size; - } - } - else if ((!mc || mc == 2) && - (!mr || mr == 2)) { - /* Use 8 bit copy */ - short int *d, *s; - - d = (short int *) dest; - s = (short int *) src2; - row_size /= 2; - - for (rr = 0; rr < 16; rr++) { - d[0] = s[0]; - d[1] = s[1]; - d[2] = s[2]; - d[3] = s[3]; - d[4] = s[4]; - d[5] = s[5]; - d[6] = s[6]; - d[7] = s[7]; - d += row_size; - s += row_size; - } - } - else { - for (rr = 0; rr < 16; rr++) { - /* Use 8 bit copy */ - dest[0] = src2[0]; - dest[1] = src2[1]; - dest[2] = src2[2]; - dest[3] = src2[3]; - dest[4] = src2[4]; - dest[5] = src2[5]; - dest[6] = src2[6]; - dest[7] = src2[7]; - dest[8] = src2[8]; - dest[9] = src2[9]; - dest[10] = src2[10]; - dest[11] = src2[11]; - dest[12] = src2[12]; - dest[13] = src2[13]; - dest[14] = src2[14]; - dest[15] = src2[15]; - - dest += row_size; - src2 += row_size; - } - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h deleted file mode 100644 index c421a53f167..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mibload.h +++ /dev/null @@ -1,155 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with this file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include <stdio.h> -#include <X11/Intrinsic.h> -#include <X11/Shell.h> -#include <Xm/Xm.h> -#include <Xm/Text.h> -#include <Xm/TextF.h> -#include <Xm/RowColumn.h> -#include <Xm/MainW.h> -#include <Xm/Label.h> -#include <Xm/PushB.h> -#include <Xm/PushBG.h> -#include <Xm/ToggleB.h> -#include <Xm/ToggleBG.h> -#include <Xm/DrawingA.h> -#include <Xm/CascadeBG.h> -#include <Xm/SeparatoG.h> -#include <Xm/Frame.h> -#include <Xm/BulletinB.h> -#include <Xm/Scale.h> -#include <Xm/ScrollBar.h> -#include <Xm/Form.h> -#include <Xm/List.h> -#include <Xm/FileSB.h> -#include <Xm/AtomMgr.h> -#include <Xm/Protocols.h> -#include <Xm/MwmUtil.h> - - -/* Structure of mib_Widget */ -/*****************************************************************************/ - -typedef struct _mib_Widget { - char *mib_class; /* name of mib class (Button, TextBox, etc..)*/ - int mib_class_num; /* class number for ez reference :) */ - int mib_mynum; /* numbering for storage format */ - Widget me; /* Xt widget */ - int mib_selected; /* is selected */ - int mib_resizing; /* is resizing 1, or being moved 0 */ - int mib_resizetype;/* 1 = upper left, 2 = upper, 3 = ... */ - int mib_allowresize; /* can this widget be resized ? */ - - int clkx, clky; /* where user clicked */ - - void *myres; /* my resources (different for each widget) */ - - char *name; /* reference name of this widget */ - int width, height; /* width and height */ - - int topAttachment, bottomAttachment, leftAttachment, rightAttachment; - /* attachments 1=attached 0=not-attached */ - - int topOffset, bottomOffset, leftOffset, rightOffset; - /* offsets if attached */ - - struct _mib_Widget *parent; /* pointer to parent */ - struct _mib_Widget *sibling; /* remaining linked list of sibling widgets */ - struct _mib_Widget *prev; /* previous sibling or parent */ - struct _mib_Widget *child; /* linked list of children widgets */ -} mib_Widget; - -/* mib_Buffer structure */ -/*****************************************************************************/ - -typedef struct _mib_Buffer { - void *buffer; /* pointer to either a file or a char string */ - int buf_type; /* type of buffer (defined above) */ - int point; /* pointer for string */ - int buflen; /* length of string buffer */ -} mib_Buffer; - -/* mib_Widget functions */ -/*****************************************************************************/ - -void mib_add_mib_Widget(mib_Widget *, mib_Widget *); -void mib_add_backward_Widget(mib_Widget *, mib_Widget *); -void mib_remove_mib_Widget(mib_Widget *); -void mib_clear_myres(mib_Widget *); -mib_Widget *mib_new_mib_Widget(); -mib_Widget *mib_find_name(mib_Widget *, char *); -mib_Widget *mib_load_interface(Widget, char *, int); -int mib_count_all(mib_Widget *, int); -int mib_load_Root(Widget, mib_Widget **, mib_Buffer *); -mib_Widget *mib_load_public(mib_Widget *, mib_Widget *, mib_Buffer *); -int mib_load_mib_class(mib_Widget **, mib_Widget *, char *, char *, - mib_Buffer *); -int mib_load_private(mib_Widget *, mib_Buffer *); -void mib_reset_size(mib_Widget *); -int mib_read_line(mib_Buffer *, char *, char *); -void mib_set_eventhandlers(void *, void *, void *); -void mib_apply_eventhandlers(Widget, mib_Widget *); - -/* supporting functions and structures */ -/*****************************************************************************/ - -typedef struct _menu_item { - char *label; - WidgetClass *class; - char mnemonic; - char *accelerator; - char *accel_text; - void (*callback)(); - XtPointer callback_data; - struct _menu_item *subitems; -} MenuItem; - -Widget BuildMenu(Widget, int, char *, char, MenuItem *); - -/* mib class numbers */ - -#define MIB_NULL 0 -#define MIB_TEXTBOX 1 -#define MIB_BUTTON 2 -#define MIB_TOGGLE 3 -#define MIB_RADIOBOX 4 -#define MIB_DRAWINGAREA 5 -#define MIB_LABEL 6 -#define MIB_FRAME 7 -#define MIB_SCROLLBAR 8 -#define MIB_TEXTBIG 9 -#define MIB_LIST 10 -#define MIB_SCALE 11 -#define MIB_MENU 12 - -/* number of classes */ -#define MI_NUMCLASSES 12 - -/* for specifying creation of a widget with - default private values, no values at all (empty), - or no values and editable */ - -#define WDEFAULT 1 -#define WEMPTY 2 -#define WEDIT 3 - -/* for specifing whether we are loading an - interface from a file or from a string and whether it - is editable :) */ - -#define MI_FROMFILE 1 -#define MI_EDITFROMFILE 2 -#define MI_FROMSTRING 3 -#define MI_EDITFROMSTRING 4 - -#define MI_MAXSTRLEN 200 /* maximum string length */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp deleted file mode 100644 index 2a155f4f116..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/mono.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* $Id$ */ -/* - * Author: Yoichiro Ueno (ueno@cs.titech.ac.jp) - * - * Copyright (C) 1991, 1992, Yoichiro Ueno. - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose is hereby granted by the Author without - * fee, provided that the above copyright notice appear in all copies and - * that both the copyright notice and this permission notice appear in - * supporting documentation, and that the name of the Author not be used - * in advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The Author makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF - * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -#include <string.h> -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - - -/* - *-------------------------------------------------------------- - * - * MonoDitherImage -- - * - * Dithers image into monochrome. - * Dither algorithm is based on dither.c in xli.1.11. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -#define MaxGrey 65280 -#define Threshold (MaxGrey/2) -#define MinGrey 0 - -#if ultrix && mips -# define SEED_BIT 0x01 -# define OPP_SEED_BIT 0x80 -# define SHIFT_SEED_BIT(b) (b <<= 1) -# define OPP_SHIFT_SEED_BIT(b) (b >>= 1) -#else -# define SEED_BIT 0x80 -# define OPP_SEED_BIT 0x01 -# define SHIFT_SEED_BIT(b) (b >>= 1) -# define OPP_SHIFT_SEED_BIT(b) (b <<= 1) -#endif - -static int *curr = NULL; -static int *next = NULL; - -#if 0 -void -MonoDitherImage(register unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - int bit_r2l; - register unsigned int bit; - register unsigned int data; - int i; - register int j; - int *swap; - register int out_err; - register int next1; - register int next2; - - if(curr == NULL) { - curr = (int *)malloc(sizeof(int) * (w + 2)); - curr += 1; - } - if(next == NULL) { - next = (int *)malloc(sizeof(int) * (w + 2)); - next += 1; - } - - bzero ((char *)curr, w * sizeof(*curr)); - - bit_r2l = SEED_BIT << (w - 1 & 7); - for(i = 0; i < h; i ++) { - if(i & 0x01) { /* Right to Left */ - bit = bit_r2l; - data = 0; - out_err = curr[w-1]; - next1 = 0; - next2 = 0; - for (j=(w-1); j>=0; j--) - { - out_err = (out_err >> 4) + (lum[j] << 8); - if(out_err > Threshold) { - data |= bit; - out_err -= MaxGrey; - } - else - out_err -= MinGrey; - - next[j+1] = next1 + (out_err * 3); - next1 = next2 + (out_err * 5); - next2 = (out_err * 1); - out_err = curr[j-1] + (out_err * 7); - - OPP_SHIFT_SEED_BIT(bit); -#if ultrix && mips - if(bit == 0) -#else - if(bit > 0x80) -#endif - { - out[j >> 3] = data; - bit = OPP_SEED_BIT; - data = 0; - } - } - next[0] = next1; - } - else { /* Left to Right */ - bit = SEED_BIT; - data = 0; - out_err = curr[0]; - next1 = 0; - next2 = 0; - for (j=0; j<w; j++) - { - out_err = (out_err >> 4) + (lum[j] << 8); - if(out_err > Threshold) { - data |= bit; - out_err = out_err - MaxGrey; - } - else - out_err = out_err - MinGrey; - - next[j-1] = next1 + (out_err * 3); - next1 = next2 + (out_err * 5); - next2 = (out_err * 1); - out_err = curr[j+1] + (out_err * 7); - - SHIFT_SEED_BIT(bit); -#if ultrix && mips - if(bit > 0x80) -#else - if(bit == 0) -#endif - { - out[j >> 3] = data; - bit = SEED_BIT; - data = 0; - } - } - next[w-1] = next1; - } - - lum += w; - out += w >> 3; - swap = curr; - curr = next; - next = swap; - } -} -#endif - -void -MonoDitherImage(register unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - register unsigned int bit; - register unsigned int data; - register int j; - int i; - static unsigned char d[4][4] = {{0, 8, 2, 10}, - {12, 4, 14, 6}, - {3, 11, 1, 9}, - {15, 7, 13, 5}}; - - for(i = 0; i < h; i ++) { - bit = SEED_BIT; - data = 0; - for (j=0; j<w; j++) { - if((lum[j] >> 4) > d[i % 4][j % 4]) { - data |= bit; - } - SHIFT_SEED_BIT(bit); -#if ultrix && mips - if(bit > 0x80) -#else - if(bit == 0) -#endif - { - out[j >> 3] = data; - bit = SEED_BIT; - data = 0; - } - } - lum += w; - out += (w + 7) >> 3; - } -} - - -/* - *-------------------------------------------------------------- - * - * MonoThresholdImage -- - * - * convert image into monochrome with threshold. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -MonoThresholdImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - unsigned char bit; - unsigned char data; - - bit = SEED_BIT; - data = 0; - for (w*=h; w>0; w--) { - if(*lum++>128) - data |= bit; - - SHIFT_SEED_BIT(bit); - if(bit == 0) { - *out ++ = data; - bit = SEED_BIT; - data = 0; - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp deleted file mode 100644 index 7525a3ee802..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/motionvector.cpp +++ /dev/null @@ -1,192 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include "video.h" -#include "proto.h" -#include "util.h" - - -/* - *-------------------------------------------------------------- - * - * ComputeVector -- - * - * Computes motion vector given parameters previously parsed - * and reconstructed. - * - * Results: - * Reconstructed motion vector info is put into recon_* parameters - * passed to this function. Also updated previous motion vector - * information. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -#define ComputeVector(recon_right_ptr, recon_down_ptr, recon_right_prev, recon_down_prev, f, full_pel_vector, motion_h_code, motion_v_code, motion_h_r, motion_v_r) \ - \ -{ \ - int comp_h_r, comp_v_r; \ - int right_little, right_big, down_little, down_big; \ - int max, min, new_vector; \ - \ - /* The following procedure for the reconstruction of motion vectors \ - is a direct and simple implementation of the instructions given \ - in the mpeg December 1991 standard draft. \ - */ \ - \ - if (f == 1 || motion_h_code == 0) \ - comp_h_r = 0; \ - else \ - comp_h_r = f - 1 - motion_h_r; \ - \ - if (f == 1 || motion_v_code == 0) \ - comp_v_r = 0; \ - else \ - comp_v_r = f - 1 - motion_v_r; \ - \ - right_little = motion_h_code * f; \ - if (right_little == 0) \ - right_big = 0; \ - else { \ - if (right_little > 0) { \ - right_little = right_little - comp_h_r; \ - right_big = right_little - 32 * f; \ - } \ - else { \ - right_little = right_little + comp_h_r; \ - right_big = right_little + 32 * f; \ - } \ - } \ - \ - down_little = motion_v_code * f; \ - if (down_little == 0) \ - down_big = 0; \ - else { \ - if (down_little > 0) { \ - down_little = down_little - comp_v_r; \ - down_big = down_little - 32 * f; \ - } \ - else { \ - down_little = down_little + comp_v_r; \ - down_big = down_little + 32 * f; \ - } \ - } \ - \ - max = 16 * f - 1; \ - min = -16 * f; \ - \ - new_vector = recon_right_prev + right_little; \ - \ - if (new_vector <= max && new_vector >= min) \ - *recon_right_ptr = recon_right_prev + right_little; \ - /* just new_vector */ \ - else \ - *recon_right_ptr = recon_right_prev + right_big; \ - recon_right_prev = *recon_right_ptr; \ - if (full_pel_vector) \ - *recon_right_ptr = *recon_right_ptr << 1; \ - \ - new_vector = recon_down_prev + down_little; \ - if (new_vector <= max && new_vector >= min) \ - *recon_down_ptr = recon_down_prev + down_little; \ - /* just new_vector */ \ - else \ - *recon_down_ptr = recon_down_prev + down_big; \ - recon_down_prev = *recon_down_ptr; \ - if (full_pel_vector) \ - *recon_down_ptr = *recon_down_ptr << 1; \ -} - -/* - *-------------------------------------------------------------- - * - * ComputeForwVector -- - * - * Computes forward motion vector by calling ComputeVector - * with appropriate parameters. - * - * Results: - * Reconstructed motion vector placed in recon_right_for_ptr and - * recon_down_for_ptr. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -ComputeForwVector(int *recon_right_for_ptr, int *recon_down_for_ptr) -{ - - Pict *picture; - Macroblock *mblock; - - picture = &(curVidStream->picture); - mblock = &(curVidStream->mblock); - - ComputeVector(recon_right_for_ptr, recon_down_for_ptr, - mblock->recon_right_for_prev, - mblock->recon_down_for_prev, - picture->forw_f, picture->full_pel_forw_vector, - mblock->motion_h_forw_code, mblock->motion_v_forw_code, - mblock->motion_h_forw_r, mblock->motion_v_forw_r); -} - - -/* - *-------------------------------------------------------------- - * - * ComputeBackVector -- - * - * Computes backward motion vector by calling ComputeVector - * with appropriate parameters. - * - * Results: - * Reconstructed motion vector placed in recon_right_back_ptr and - * recon_down_back_ptr. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -ComputeBackVector(int *recon_right_back_ptr, int *recon_down_back_ptr) -{ - Pict *picture; - Macroblock *mblock; - - picture = &(curVidStream->picture); - mblock = &(curVidStream->mblock); - - ComputeVector(recon_right_back_ptr, recon_down_back_ptr, - mblock->recon_right_back_prev, - mblock->recon_down_back_prev, - picture->back_f, picture->full_pel_back_vector, - mblock->motion_h_back_code, mblock->motion_v_back_code, - mblock->motion_h_back_r, mblock->motion_v_back_r); - -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h deleted file mode 100644 index 365745476ce..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/newproto.h +++ /dev/null @@ -1,110 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* ui.c */ -void UIprocess(int cmdSocket); - -#include "mpeg_shared/routine.h" - -/* ctr.c */ -int CTRmain(void); - -/* ab.c */ -void ABinitBuf(int size); -void ABflushBuf(int nextSample); -int ABcheckSamples(void); /* returns # of samples in ABbuf */ -int ABgetSamples(char * buf, int samples); - /* read at most given number of samples from AB to buf, returns - number of sample actually read */ -int ABskipSamples(int samples); -/* if samples < 0; then stuff |samples| silient samples to ABgetSamples(), - otherwise wipe out this number of samples from AB */ -void ABdeleteBuf(void); -void ABdeleteSem(void); - -void ABprocess(int dataSocket); - -/* vb.c */ -void VBinitBuf(int size); -char * VBgetBuf(int size); /* block version */ -int VBcheckBuf(int size); /* non-block check, return True/False*/ -void VBputMsg(char * msgPtr); -char * VBgetMsg(); /* block version */ -int VBcheckMsg(); /* non-block check, return Number of Msgs in buffer */ -int VBbufEmpty(void); -void VBreclaimMsg(char * msgPtr); -void VBdeleteBuf(void); -void VBdeleteSem(void); - -void VBprocess(int initSocket, int dataSocket); - -/* vd.c */ -void VDprocess(int CTRpid); -void VDinitBuf(int size); -void VDresizeBuf(int height, int width); -FrameBlock * VDgetBuf(void); /* block version, return with interrupt */ -int VDcheckBuf(void); /* non-block check, return True/False */ -void VDputMsg(FrameBlock * msgPtr); -FrameBlock * VDgetMsg(void); /* block version, return with interrupt */ -FrameBlock * VDpeekMsg(void); /* returns a msg for checking only, no modification allowed */ -int VDcheckMsg(void); /* non-block check, return Number of Msg in buffer */ -int VDbufEmpty(void); -void VDreferMsg(FrameBlock * msgPtr); -void VDreclaimMsg(FrameBlock * msgPtr); -void VDdeleteBuf(void); -void VDdeleteSem(void); - -/* vp.c */ - -void VPinitWindow(Widget shell, Window monitorWindow, int cmdSocket); -void VPresizeWindow(int height, int width); - -/* -- in gdith.c -- */ -void VPcommand(int cmd, char * position); -void VPexpose(void); - -/* audio.c */ -int InitAudioDevice(void); -void SetAudioParameter(AudioParameter * para); -unsigned int GetAudioTime(void); -unsigned int PlayAudioSamples(unsigned int time, char * buf, int size); -void StartAudioPlaySession(void); -void SetAudioGain(void); -void AudioInterpolate(char *rawBuf, int len, char * convBuf, int convLen); - -/* prog.c */ - -void StartProgram(char * title, char * vh, char * vf, char * ah, char * af); -Widget CreateProgramWindow(Widget parent, int cmdSoket, int * playflag, Widget frametext); - -/* file.c */ - -void StartLocalServer(void); -Widget CreateFileWindow(Widget parent, int cmdSoket, int * playflag, Widget frametext); - - -/* para.c */ - -Widget CreateParameterWindow(Widget parent); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp deleted file mode 100644 index 89c76bf6aba..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to implement an ordered dither. */ - -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -#define DITH_SIZE 16 - - -/* Structures used to implement hybrid ordered dither/floyd-steinberg - dither algorithm. -*/ - -static unsigned char *l_darrays[DITH_SIZE]; -static unsigned char *cr_darrays[DITH_SIZE]; -static unsigned char *cb_darrays[DITH_SIZE]; - -/* - *-------------------------------------------------------------- - * - * InitOrderedDither-- - * - * Structures intialized for ordered dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitOrderedDither() -{ - int i, j, k, err_range, threshval; - unsigned char *lmark, *cmark; - - for (i=0; i<DITH_SIZE; i++) { - lmark = l_darrays[i] = (unsigned char *) malloc(256); - - for (j=0; j<lum_values[0]; j++) { - *lmark++ = 0; - } - - for (j=0; j<(LUM_RANGE-1); j++) { - err_range = lum_values[j+1] - lum_values[j]; - threshval = ((i * err_range) / DITH_SIZE)+lum_values[j]; - - for (k=lum_values[j]; k<lum_values[j+1]; k++) { - if (k > threshval) *lmark++ = ((j+1) * (CR_RANGE * CB_RANGE)); - else *lmark++ = (j * (CR_RANGE * CB_RANGE)); - } - } - - for (j=lum_values[LUM_RANGE-1]; j<256; j++) { - *lmark++ = (LUM_RANGE-1)*(CR_RANGE * CB_RANGE); - } - } - - for (i=0; i<DITH_SIZE; i++) { - cmark = cr_darrays[i] = (unsigned char *) malloc(256); - - for (j=0; j<cr_values[0]; j++) { - *cmark++ = 0; - } - - for (j=0; j<(CR_RANGE-1); j++) { - err_range = cr_values[j+1] - cr_values[j]; - threshval = ((i * err_range) / DITH_SIZE)+cr_values[j]; - - for (k=cr_values[j]; k<cr_values[j+1]; k++) { - if (k > threshval) *cmark++ = ((j+1) * CB_RANGE); - else *cmark++ = (j * CB_RANGE); - } - } - - for (j=cr_values[CR_RANGE-1]; j<256; j++) { - *cmark++ = (CR_RANGE-1)*(CB_RANGE); - } - } - - for (i=0; i<DITH_SIZE; i++) { - cmark = cb_darrays[i] = (unsigned char *) malloc(256); - - for (j=0; j<cb_values[0]; j++) { - *cmark++ = 0; - } - - for (j=0; j<(CB_RANGE-1); j++) { - err_range = cb_values[j+1] - cb_values[j]; - threshval = ((i * err_range) / DITH_SIZE)+cb_values[j]; - - for (k=cb_values[j]; k<cb_values[j+1]; k++) { - if (k > threshval) *cmark++ = j+1; - else *cmark++ = j; - } - } - - for (j=cb_values[CB_RANGE-1]; j<256; j++) { - *cmark++ = CB_RANGE-1; - } - } -} - -/* - *-------------------------------------------------------------- - * - * OrderedDitherImage -- - * - * Dithers an image using an ordered dither. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * The channels are dithered based on the standard - * ordered dither pattern for a 4x4 area. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -OrderedDitherImage (unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - unsigned char *l, *r, *b, *o1, *o2; - unsigned char *l2; - unsigned char L, R, B; - int i, j; - - l = lum; - l2 = lum+w; - r = cr; - b = cb; - o1 = out; - o2 = out+w; - - for (i=0; i<h; i+=4) { - - for (j=0; j<w; j+=8) { - - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = pixel[(l_darrays[0][L] + cr_darrays[0][R] + cb_darrays[0][B])]; - L = l[1]; - o1[1] = pixel[(l_darrays[8][L] + cr_darrays[8][R] + cb_darrays[8][B])]; - L = l2[0]; - o2[0] = pixel[(l_darrays[12][L] + cr_darrays[12][R] + cb_darrays[12][B])]; - L = l2[1]; - o2[1] = pixel[(l_darrays[4][L] + cr_darrays[4][R] + cb_darrays[4][B])]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = pixel[(l_darrays[2][L] + cr_darrays[2][R] + cb_darrays[2][B])]; - L = l[3]; - o1[3] = pixel[(l_darrays[10][L] + cr_darrays[10][R] + cb_darrays[10][B])]; - L = l2[2]; - o2[2] = pixel[(l_darrays[14][L] + cr_darrays[14][R] + cb_darrays[14][B])]; - L = l2[3]; - o2[3] = pixel[(l_darrays[6][L] + cr_darrays[6][R] + cb_darrays[6][B])]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = pixel[(l_darrays[0][L] + cr_darrays[0][R] + cb_darrays[0][B])]; - L = l[5]; - o1[5] = pixel[(l_darrays[8][L] + cr_darrays[8][R] + cb_darrays[8][B])]; - L = l2[4]; - o2[4] = pixel[(l_darrays[12][L] + cr_darrays[12][R] + cb_darrays[12][B])]; - L = l2[5]; - o2[5] = pixel[(l_darrays[4][L] + cr_darrays[4][R] + cb_darrays[4][B])]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = pixel[(l_darrays[2][L] + cr_darrays[2][R] + cb_darrays[2][B])]; - L = l[7]; - o1[7] = pixel[(l_darrays[10][L] + cr_darrays[10][R] + cb_darrays[10][B])]; - L = l2[6]; - o2[6] = pixel[(l_darrays[14][L] + cr_darrays[14][R] + cb_darrays[14][B])]; - L = l2[7]; - o2[7] = pixel[(l_darrays[6][L] + cr_darrays[6][R] + cb_darrays[6][B])]; - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - - for (j=0; j<w; j+=8) { - - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = pixel[(l_darrays[3][L] + cr_darrays[3][R] + cb_darrays[3][B])]; - L = l[1]; - o1[1] = pixel[(l_darrays[11][L] + cr_darrays[11][R] + cb_darrays[11][B])]; - L = l2[0]; - o2[0] = pixel[(l_darrays[15][L] + cr_darrays[15][R] + cb_darrays[15][B])]; - L = l2[1]; - o2[1] = pixel[(l_darrays[7][L] + cr_darrays[7][R] + cb_darrays[7][B])]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = pixel[(l_darrays[1][L] + cr_darrays[1][R] + cb_darrays[1][B])]; - L = l[3]; - o1[3] = pixel[(l_darrays[9][L] + cr_darrays[9][R] + cb_darrays[9][B])]; - L = l2[2]; - o2[2] = pixel[(l_darrays[13][L] + cr_darrays[13][R] + cb_darrays[13][B])]; - L = l2[3]; - o2[3] = pixel[(l_darrays[5][L] + cr_darrays[5][R] + cb_darrays[5][B])]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = pixel[(l_darrays[3][L] + cr_darrays[3][R] + cb_darrays[3][B])]; - L = l[5]; - o1[5] = pixel[(l_darrays[11][L] + cr_darrays[11][R] + cb_darrays[11][B])]; - L = l2[4]; - o2[4] = pixel[(l_darrays[15][L] + cr_darrays[15][R] + cb_darrays[15][B])]; - L = l2[5]; - o2[5] = pixel[(l_darrays[7][L] + cr_darrays[7][R] + cb_darrays[7][B])]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = pixel[(l_darrays[1][L] + cr_darrays[1][R] + cb_darrays[1][B])]; - L = l[7]; - o1[7] = pixel[(l_darrays[9][L] + cr_darrays[9][R] + cb_darrays[9][B])]; - L = l2[6]; - o2[6] = pixel[(l_darrays[13][L] + cr_darrays[13][R] + cb_darrays[13][B])]; - L = l2[7]; - o2[7] = pixel[(l_darrays[5][L] + cr_darrays[5][R] + cb_darrays[5][B])]; - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - } -} - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp deleted file mode 100644 index eab1505b642..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ordered2.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code to implement an ordered dither. */ - -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "dither.h" - -#define DITH_SIZE 16 - - -/* Structures used to implement hybrid ordered dither/floyd-steinberg - dither algorithm. -*/ - -static unsigned char ***ditherPtr[DITH_SIZE]; - - -/* - *-------------------------------------------------------------- - * - * InitOrderedDither-- - * - * Structures intialized for ordered dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitOrdered2Dither() -{ - unsigned char ****pos_2_cb; - unsigned char ***cb_2_cr; - unsigned char **cr_2_l; - int cb_val, cb_rval, cr_val, cr_rval, l_val, l_rval; - int i, j, pos; - int err_range, threshval; - - pos_2_cb = (unsigned char ****) malloc (DITH_SIZE*sizeof(unsigned char ***)); - cb_2_cr = (unsigned char ***) malloc(CB_RANGE*sizeof(unsigned char **)); - cr_2_l = (unsigned char **) malloc(CR_RANGE*sizeof(unsigned char *)); - - for (pos=0; pos<DITH_SIZE; pos++) { - - pos_2_cb[pos] = (unsigned char ***) malloc(256*(sizeof(unsigned char **))); - - for (j=0; j<CB_RANGE; j++) { - cb_2_cr[j] = (unsigned char **) malloc(256*(sizeof(unsigned char *))); - } - - for (cb_val=0; cb_val<cb_values[0]; cb_val++) { - (pos_2_cb[pos])[cb_val] = cb_2_cr[0]; - } - - for (cb_rval=0; cb_rval<(CB_RANGE-1); cb_rval++) { - err_range = cb_values[cb_rval+1] - cb_values[cb_rval]; - threshval = ((pos*err_range)/DITH_SIZE)+cb_values[cb_rval]; - - for (cb_val=cb_values[cb_rval]; cb_val<cb_values[cb_rval+1]; cb_val++) { - if (cb_val>threshval) (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval+1]; - else (pos_2_cb[pos])[cb_val] = cb_2_cr[cb_rval]; - } - } - - for (cb_val=cb_values[CB_RANGE-1]; cb_val<256; cb_val++) { - (pos_2_cb[pos])[cb_val] = cb_2_cr[CB_RANGE-1]; - } - - for (cb_rval=0; cb_rval<CB_RANGE; cb_rval++) { - - for (j=0; j<CR_RANGE; j++) { - cr_2_l[j] = (unsigned char *) malloc(256*(sizeof(unsigned char))); - } - - for (cr_val=0; cr_val < cr_values[0]; cr_val++) { - (cb_2_cr[cb_rval])[cr_val] = cr_2_l[0]; - } - - for (cr_rval=0; cr_rval<(CR_RANGE-1); cr_rval++) { - err_range = cr_values[cr_rval+1] - cr_values[cr_rval]; - threshval = ((pos*err_range)/DITH_SIZE)+cr_values[cr_rval]; - - for (cr_val=cr_values[cr_rval]; cr_val<cr_values[cr_rval+1]; cr_val++) { - if (cr_val>threshval) (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval+1]; - else (cb_2_cr[cb_rval])[cr_val] = cr_2_l[cr_rval]; - } - } - - for (cr_val=cr_values[CR_RANGE-1]; cr_val<256; cr_val++) { - (cb_2_cr[cb_rval])[cr_val] = cr_2_l[CR_RANGE-1]; - } - - for (cr_rval=0; cr_rval<CR_RANGE; cr_rval++) { - - for (l_val = 0; l_val < lum_values[0]; l_val++) { - (cr_2_l[cr_rval])[l_val] = pixel[cb_rval+(cr_rval*CB_RANGE)+ - (0*CR_RANGE*CB_RANGE)]; - } - - for (l_rval=0; l_rval<(LUM_RANGE-1); l_rval++) { - err_range = lum_values[l_rval+1] - lum_values[l_rval]; - threshval = ((pos*err_range) /DITH_SIZE) + lum_values[l_rval]; - - for (l_val = lum_values[l_rval]; l_val < lum_values[l_rval+1]; l_val++) { - if (l_val>threshval) (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+((l_rval+1)*CR_RANGE*CB_RANGE)]; - else (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+(l_rval*CR_RANGE*CB_RANGE)]; - } - } - - for (l_val = lum_values[LUM_RANGE-1]; l_val < 256; l_val++) { - (cr_2_l[cr_rval])[l_val] = - pixel[cb_rval+(cr_rval*CB_RANGE)+((LUM_RANGE-1)*CR_RANGE*CB_RANGE)]; - } - } - } - } - - for (i=0; i<DITH_SIZE; i++) { - ditherPtr[i] = pos_2_cb[i]; - } -} - -/* - *-------------------------------------------------------------- - * - * Ordered2DitherImage -- - * - * Dithers an image using an ordered dither. - * Assumptions made: - * 1) The color space is allocated y:cr:cb = 8:4:4 - * 2) The spatial resolution of y:cr:cb is 4:1:1 - * The channels are dithered based on the standard - * ordered dither pattern for a 4x4 area. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -Ordered2DitherImage (unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w) -{ - unsigned char *l, *r, *b, *o1, *o2; - unsigned char *l2; - unsigned char L, R, B; - int i, j; - unsigned char ***dp0 = ditherPtr[0]; - unsigned char ***dp2 = ditherPtr[2]; - unsigned char ***dp4 = ditherPtr[4]; - unsigned char ***dp6 = ditherPtr[6]; - unsigned char ***dp8 = ditherPtr[8]; - unsigned char ***dp10 = ditherPtr[10]; - unsigned char ***dp12 = ditherPtr[12]; - unsigned char ***dp14 = ditherPtr[14]; - unsigned char ***dp1 = ditherPtr[1]; - unsigned char ***dp3 = ditherPtr[3]; - unsigned char ***dp5 = ditherPtr[5]; - unsigned char ***dp7 = ditherPtr[7]; - unsigned char ***dp9 = ditherPtr[9]; - unsigned char ***dp11 = ditherPtr[11]; - unsigned char ***dp13 = ditherPtr[13]; - unsigned char ***dp15 = ditherPtr[15]; - - l = lum; - l2 = lum+w; - r = cr; - b = cb; - o1 = out; - o2 = out+w; - - for (i=0; i<h; i+=4) { - - for (j=0; j<w; j+=8) { - - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = ((dp0[B])[R])[L]; - L = l[1]; - o1[1] = ((dp8[B])[R])[L]; - L = l2[0]; - o2[0] = ((dp12[B])[R])[L]; - L = l2[1]; - o2[1] = ((dp4[B])[R])[L]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = ((dp2[B])[R])[L]; - L = l[3]; - o1[3] = ((dp10[B])[R])[L]; - L = l2[2]; - o2[2] = ((dp14[B])[R])[L]; - L = l2[3]; - o2[3] = ((dp6[B])[R])[L]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = ((dp0[B])[R])[L]; - L = l[5]; - o1[5] = ((dp8[B])[R])[L]; - L = l2[4]; - o2[4] = ((dp12[B])[R])[L]; - L = l2[5]; - o2[5] = ((dp4[B])[R])[L]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = ((dp2[B])[R])[L]; - L = l[7]; - o1[7] = ((dp10[B])[R])[L]; - L = l2[6]; - o2[6] = ((dp14[B])[R])[L]; - L = l2[7]; - o2[7] = ((dp6[B])[R])[L]; - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - - for (j=0; j<w; j+=8) { - - R = r[0]; B = b[0]; - - L = l[0]; - o1[0] = ((dp3[B])[R])[L]; - L = l[1]; - o1[1] = ((dp11[B])[R])[L]; - L = l2[0]; - o2[0] = ((dp15[B])[R])[L]; - L = l2[1]; - o2[1] = ((dp7[B])[R])[L]; - - R = r[1]; B = b[1]; - - L = l[2]; - o1[2] = ((dp1[B])[R])[L]; - L = l[3]; - o1[3] = ((dp9[B])[R])[L]; - L = l2[2]; - o2[2] = ((dp13[B])[R])[L]; - L = l2[3]; - o2[3] = ((dp5[B])[R])[L]; - - R = r[2]; B = b[2]; - - L = l[4]; - o1[4] = ((dp3[B])[R])[L]; - L = l[5]; - o1[5] = ((dp11[B])[R])[L]; - L = l2[4]; - o2[4] = ((dp15[B])[R])[L]; - L = l2[5]; - o2[5] = ((dp7[B])[R])[L]; - - R = r[3]; B = b[3]; - - L = l[6]; - o1[6] = ((dp1[B])[R])[L]; - L = l[7]; - o1[7] = ((dp9[B])[R])[L]; - L = l2[6]; - o2[6] = ((dp13[B])[R])[L]; - L = l2[7]; - o2[7] = ((dp5[B])[R])[L]; - - l += 8; - l2 += 8; - r += 4; - b += 4; - o1 += 8; - o2 += 8; - } - - l += w; l2 += w; - o1 += w; o2 += w; - } -} - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp deleted file mode 100644 index 8715d47f63f..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/para.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <stdlib.h> -#include "video.h" -#include <X11/Intrinsic.h> -#include <Xm/DialogS.h> -#include <Xm/List.h> -#include <Xm/Frame.h> -#include <Xm/PushB.h> -#include <Xm/Form.h> -#include <Xm/Text.h> -#include <Xm/TextF.h> -#include <Xm/Label.h> -#include "include/common.h" -#include "newproto.h" -#include "global.h" - -#define NUM_LIST_ITEMS 25 -#define PARAMETER_FILE "~/.vcr/vcrParameters" -#define BANNER "Virtual VCR Parameter File, version 2.0 ** Do not Edit **" -#ifdef XmFONTLIST_DEFAULT_TAG -#define XmStringTag XmFONTLIST_DEFAULT_TAG -#else -#define XmStringTag XmSTRING_DEFAULT_CHARSET -#endif -#define STRING_SIZE 64 -#define ITEMS sizeof(shared->config)/4 - -static Widget parashell, wparalist, wparafield; - -static int * config; -static float *fconfig; - -static struct -{ - char * title; - int float_tag; /* 0 - integer, 1 - floating point */ -} -para[] = -{ - {"Real time (audio on)(tag)", 0}, - {"Video max frames-per-second", 0}, - {"Audio max sampels-per-second", 0}, - {"FF frames-per-second", 0}, - {"Rewind frames-per-second", 0}, - {"Feedback delay (msec)", 0}, - {"Audio output mask", 0}, - {"Audio_para.encodeType", 0}, - {"Audio_para.channels", 0}, - {"Audio_para.samplesPerSecond", 0}, - {"Audio_para.bytesPerSamples", 0}, - {"Audio timer interval (millisec)", 0}, - {"Audio buffered intervals", 0}, - {"Frames per audio play", 0}, - {"Audio forward (samples)", 0}, - {"VS work-ahead (milliseconds)", 0}, - {"frame rate limit (fps, float)", 1}, - {"collect statistics(tag)", 0}, - {"collect video structure info(tag)", 0}, - {"Sync effective(tag)", 0}, - {"QoS effective(tag)", 0}, - {"Audio offset(samples)", 0}, - {"Filter parameter(1/R or nsamples)", 0}, - {"Max send pattern frames", 0}, - {"Reliable byte-stream audio (tag)", 0}, - {"Reliable byte-stream video (tag)", 0}, - {"Verbose message(tag)", 0}, - {"", 0} /* this empty string is needed for testing the size of para */ -}; - -#define Fgets(s) {if (feof(fp) || fgets(s, STRING_SIZE, fp) == NULL) break; s[strlen(s)-1] = 0; } - -#define Fputs(s) {fputs(s, fp); fputc('\n', fp);} - -static void InitBuf(void) -{ - FILE * fp; - char buf[256]; - int i; - - config = (int *)&(shared->config); - fconfig = (float *)&(shared->config); - - get_full_path(PARAMETER_FILE, buf, 256); - fp = fopen(buf, "r"); - if (fp == NULL) - { - fprintf(stderr, "Warning: %s not found, use default parameter value\n", - PARAMETER_FILE); - InitBuf_exit1: - return; - } - if (fgets(buf, 100, fp) == NULL) - { - fclose(fp); - goto InitBuf_exit1; - } - buf[strlen(buf)-1] = 0; - if (strcmp(buf, BANNER)) - { - fprintf(stderr, "BANNER in %s not expected, use default parameter value\n", - PARAMETER_FILE); - fclose(fp); - goto InitBuf_exit1; - } - for(i = 0; i < ITEMS; i++) - { - Fgets(buf); - if (para[i].float_tag) - sscanf(buf, "%f", &fconfig[i]); - else - sscanf(buf, "%d", &config[i]); - } - fclose(fp); -} - -static void SaveBuf(void) -{ - int i; - FILE * fp; - char buf[256]; - get_full_path(PARAMETER_FILE, buf, 256); - fp = fopen(buf, "w"); - if (fp == NULL) - { - fprintf(stderr, "Fail to open %s for saving para", buf); - perror(""); - return; - } - Fputs(BANNER); - for (i = 0; i < ITEMS; i++) - if (para[i].float_tag) - fprintf(fp, "%f\n", fconfig[i]); - else - fprintf(fp, "%d\n", config[i]); - fclose(fp); -} - - -static int curListPos(void) -{ - int * poses, count; - - if (XmListGetSelectedPos(wparalist, &poses, &count)) - { - count = poses[0]; - XtFree((char*)poses); - /* - fprintf(stderr, "curListPos: current pos = %d\n", count); - */ - return count - 1; - } - return -1; -} - -static void modifyCB(Widget w, XtPointer closure, XtPointer call_data) -{ - int i, value; - XmString item; - char buf[100], * valptr; - i = curListPos(); - if (i == -1) { beep(); return;} - valptr = XmTextGetString(wparafield); - if (para[i].float_tag) - sscanf(valptr, "%f", &fconfig[i]); - else - sscanf(valptr, "%d", &config[i]); - XtFree(valptr); - if (para[i].float_tag) - sprintf(buf, "%s: %f", para[i].title, fconfig[i]); - else - sprintf(buf, "%s: %d", para[i].title, config[i]); - item = (XmString)XmStringCreateLtoR(buf, XmStringTag); - XmListReplaceItemsPos(wparalist, &item, 1, i+1); - XmListSelectPos(wparalist, i+1, 0); - XmStringFree(item); - SaveBuf(); - /* - XtManageChild(parashell); - */ - return; -} - -static void dismissCB(Widget W, XtPointer closure, XtPointer call_data) -{ - - XtUnrealizeWidget(parashell); - /* - XtUnmanageChild(parashell); - */ -} - -Widget CreateParameterWindow(Widget parent) -{ - Arg args[20]; - int n; - Widget wform, frame1, frame2, wlabel, - wmodify, wdismiss; - XmFontList fontlist; - XFontStruct * font; - XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET; - - InitBuf(); - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR Parameter List"); n++; - XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++; - XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; - XtSetArg(args[n], XmNwidth, 350); n++; - XtSetArg(args[n], XmNheight, 400); n++; - XtSetArg(args[n], XmNminWidth, 250); n++; - XtSetArg(args[n], XmNminHeight, 150); n++; - - parashell = XtAppCreateShell("Parameter List", "virtual_vcr", - topLevelShellWidgetClass, display, args, n); - /* - parashell = XmCreateDialogShell(parent, "virtual_vcr", args, n); - */ - - font = XLoadQueryFont (XtDisplay (parashell), "courB14"); - fontlist = XmStringCreateFontList (font, cset); - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual Parameter List"); n++; - wform = XmCreateForm(parashell, "Parameters", args, n); - XtManageChild(wform); - /* - parashell = wform = XmCreateForm(parashell, "Parameters", args, n); - */ - - n = 0; - wmodify = XmCreatePushButton (wform, "Update", args, n); - XtManageChild(wmodify); - XtAddCallback (wmodify, XmNactivateCallback, (XtCallbackProc)modifyCB, NULL); - wdismiss = XmCreatePushButton (wform, "Dismiss", args, n); - XtManageChild(wdismiss); - XtAddCallback (wdismiss, XmNactivateCallback, (XtCallbackProc)dismissCB, NULL); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 20); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wmodify, args, n); - - n = 0; - XtSetArg(args[n], XmNcolumns, 10); n++; - XtSetArg (args[n], XmNleftOffset, 90); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - wparafield = XmCreateTextField(wform, "updata_text", args, n); - XtManageChild(wparafield); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNrightOffset, 20); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wdismiss, args, n); - - n = 0; - XtSetArg (args[n], XmNtopOffset, 5); n++; - XtSetArg (args[n], XmNleftOffset, 5); n++; - XtSetArg (args[n], XmNbottomOffset, 45); n++; - XtSetArg (args[n], XmNrightOffset, 5); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNfontList, fontlist); n++; - XtSetArg(args[n], XmNvisibleItemCount, NUM_LIST_ITEMS); n++; - - { - int items; - XmString * item; - int i; - /* - fprintf(stderr, "Total parameter items: %d\n", items); - */ - for (items = 0; para[items].title[0] != 0; items ++); - if (items > ITEMS) - items = ITEMS; - else if (items < ITEMS) - { - fprintf(stderr, "Error in para.c: fewer titles than parameters, %d out of %d.\n", - items, ITEMS); - exit(1); - } - item = (XmString *)malloc(sizeof(*item) * items); - if (item == NULL) - { - perror("UI allocate parameter list item(XmString)"); - exit(1); - } - for (i = 0; i < items; i ++) - { - char buf[100]; - if (para[i].float_tag) - sprintf(buf, "%s: %f", para[i].title, fconfig[i]); - else - sprintf(buf, "%s: %d", para[i].title, config[i]); - item[i] = (XmString)XmStringCreateLtoR(buf, XmStringTag); - } - XtSetArg(args[n], XmNitems, item); n++; - XtSetArg(args[n], XmNitemCount, items); n++; - XtSetArg(args[n], XmNselectedItems, item); n++; - XtSetArg(args[n], XmNselectedItemCount, 1); n++; - wparalist = XmCreateScrolledList(wform, "ParameterList", args, n); - XtManageChild(wparalist); - for (i = 0; i < items; i++) - XmStringFree(item[i]); - free(item); - } - XmFontListFree(fontlist); - - n=0; - XtSetArg (args[n], XmNtopOffset, 5); n++; - XtSetArg (args[n], XmNleftOffset, 5); n++; - XtSetArg (args[n], XmNbottomOffset, 45); n++; - XtSetArg (args[n], XmNrightOffset, 5); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - frame2 = XmCreateFrame (wform, "frame", args, n); - XtManageChild(frame2); - - n=0; - XtSetArg (args[n], XmNtopOffset, 0); n++; - XtSetArg (args[n], XmNleftOffset, 0); n++; - XtSetArg (args[n], XmNbottomOffset, 0); n++; - XtSetArg (args[n], XmNrightOffset, 0); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - frame1 = XmCreateFrame (wform, "frame", args, n); - XtManageChild(frame1); - - return parashell; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp deleted file mode 100644 index 4a2b152ca6c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/parseblock.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#define NO_SANITY_CHECKS -#include <assert.h> -#include "video.h" -#include "proto.h" -#include "decoders.h" - -/* External declarations. */ - -extern int zigzag_direct[]; - -/* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */ - -#define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1)) - - -/* - *-------------------------------------------------------------- - * - * ParseReconBlock -- - * - * Parse values for block structure from bitstream. - * n is an indication of the position of the block within - * the macroblock (i.e. 0-5) and indicates the type of - * block (i.e. luminance or chrominance). Reconstructs - * coefficients from values parsed and puts in - * block.dct_recon array in vid stream structure. - * sparseFlag is set when the block contains only one - * coeffictient and is used by the IDCT. - * - * Results: - * - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -#define DCT_recon blockPtr->dct_recon -#define DCT_dc_y_past blockPtr->dct_dc_y_past -#define DCT_dc_cr_past blockPtr->dct_dc_cr_past -#define DCT_dc_cb_past blockPtr->dct_dc_cb_past - -#define DECODE_DCT_COEFF_FIRST DecodeDCTCoeffFirst -#define DECODE_DCT_COEFF_NEXT DecodeDCTCoeffNext - -void -ParseReconBlock(int n) -{ -#ifdef RISC - unsigned int temp_curBits; - int temp_bitOffset; - int temp_bufLength; - unsigned int *temp_bitBuffer; -#endif - - Block *blockPtr = &curVidStream->block; - int coeffCount; - - if (bufLength < 2) - correct_underflow(); - -#ifdef RISC - temp_curBits = curBits; - temp_bitOffset = bitOffset; - temp_bufLength = bufLength; - temp_bitBuffer = bitBuffer; -#endif - - { - /* - * Copy the globals curBits, bitOffset, bufLength, and bitBuffer - * into local variables with the same names, so the macros use the - * local variables instead. This allows register allocation and - * can provide 1-2 fps speedup. On machines with not so many registers, - * don't do this. - */ -#ifdef RISC - register unsigned int curBits = temp_curBits; - register int bitOffset = temp_bitOffset; - register int bufLength = temp_bufLength; - register unsigned int *bitBuffer = temp_bitBuffer; -#endif - - int diff; - int size, level, i, run, pos, coeff; - short int *reconptr; - unsigned char *iqmatrixptr, *niqmatrixptr; - int qscale; - - reconptr = DCT_recon[0]; - - /* - * Hand coded version of memset that's a little faster... - * Old call: - * memset((char *) DCT_recon, 0, 64*sizeof(short int)); - */ - { - INT32 *p; - p = (INT32 *) reconptr; - - p[0] = p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = p[9] = - p[10] = p[11] = p[12] = p[13] = p[14] = p[15] = p[16] = p[17] = p[18] = - p[19] = p[20] = p[21] = p[22] = p[23] = p[24] = p[25] = p[26] = p[27] = - p[28] = p[29] = p[30] = p[31] = 0; - - } - - if (curVidStream->mblock.mb_intra) { - - if (n < 4) { - - /* - * Get the luminance bits. This code has been hand optimized to - * get by the normal bit parsing routines. We get some speedup - * by grabbing the next 16 bits and parsing things locally. - * Thus, calls are translated as: - * - * show_bitsX <--> next16bits >> (16-X) - * get_bitsX <--> val = next16bits >> (16-flushed-X); - * flushed += X; - * next16bits &= bitMask[flushed]; - * flush_bitsX <--> flushed += X; - * next16bits &= bitMask[flushed]; - * - * I've streamlined the code a lot, so that we don't have to mask - * out the low order bits and a few of the extra adds are removed. - * bsmith - */ - unsigned int next16bits, index, flushed; - - show_bits16(next16bits); - index = next16bits >> (16-7); - size = dct_dc_size_luminance[index].value; - flushed = dct_dc_size_luminance[index].num_bits; - next16bits &= bitMask[16+flushed]; - - if (size != 0) { - flushed += size; - diff = next16bits >> (16-flushed); - if (!(diff & bitTest[32-size])) { - diff = rBitMask[size] | (diff + 1); - } - } else { - diff = 0; - } - flush_bits(flushed); - - if (n == 0) { - coeff = diff << 3; - if (curVidStream->mblock.mb_address - - curVidStream->mblock.past_intra_addr > 1) - coeff += 1024; - else coeff += DCT_dc_y_past; - DCT_dc_y_past = coeff; - } else { - coeff = DCT_dc_y_past + (diff << 3); - DCT_dc_y_past = coeff; - } - } else { - - /* - * Get the chrominance bits. This code has been hand optimized to - * as described above - */ - unsigned int next16bits, index, flushed; - - show_bits16(next16bits); - index = next16bits >> (16-8); - size = dct_dc_size_chrominance[index].value; - flushed = dct_dc_size_chrominance[index].num_bits; - next16bits &= bitMask[16+flushed]; - - if (size != 0) { - flushed += size; - diff = next16bits >> (16-flushed); - if (!(diff & bitTest[32-size])) { - diff = rBitMask[size] | (diff + 1); - } - } else { - diff = 0; - } - flush_bits(flushed); - - if (n == 4) { - coeff = diff << 3; - if (curVidStream->mblock.mb_address - - curVidStream->mblock.past_intra_addr > 1) - coeff += 1024; - else coeff += DCT_dc_cr_past; - DCT_dc_cr_past = coeff; - - } else { - coeff = diff << 3; - if (curVidStream->mblock.mb_address - - curVidStream->mblock.past_intra_addr > 1) - coeff += 1024; - else coeff += DCT_dc_cb_past; - DCT_dc_cb_past = coeff; - } - } - - *reconptr = coeff; - i = 0; pos = 0; - coeffCount = (coeff != 0); - - if (curVidStream->picture.code_type != 4) { - - qscale = curVidStream->slice.quant_scale; - iqmatrixptr = curVidStream->intra_quant_matrix[0]; - - while(1) { - - DECODE_DCT_COEFF_NEXT(run, level); - - if (run == END_OF_BLOCK) break; - - i = i + run + 1; - pos = zigzag_direct[i]; - coeff = (level * qscale * ((int) iqmatrixptr[pos])) >> 3; - if (level < 0) { - coeff += (coeff & 1); - } else { - coeff -= (coeff & 1); - } - - reconptr[pos] = coeff; - if (coeff) { - coeffCount++; - } - - } - -#ifdef ANALYSIS - - { - extern unsigned int *mbCoeffPtr; - mbCoeffPtr[pos]++; - } -#endif - - flush_bits(2); - - goto end; - } - } - - else { - - niqmatrixptr = curVidStream->non_intra_quant_matrix[0]; - qscale = curVidStream->slice.quant_scale; - - DECODE_DCT_COEFF_FIRST(run, level); - i = run; - - pos = zigzag_direct[i]; - if (level < 0) { - coeff = (((level<<1) - 1) * qscale * - ((int) (niqmatrixptr[pos]))) >> 4; - coeff += (coeff & 1); - } else { - coeff = (((level<<1) + 1) * qscale * - ((int) (*(niqmatrixptr+pos)))) >> 4; - coeff -= (coeff & 1); - } - reconptr[pos] = coeff; - if (coeff) { - coeffCount = 1; - } - - if (curVidStream->picture.code_type != 4) { - - while(1) { - - DECODE_DCT_COEFF_NEXT(run, level); - - if (run == END_OF_BLOCK) break; - - i = i+run+1; - pos = zigzag_direct[i]; - if (level < 0) { - coeff = (((level<<1) - 1) * qscale * - ((int) (niqmatrixptr[pos]))) >> 4; - coeff += (coeff & 1); - } else { - coeff = (((level<<1) + 1) * qscale * - ((int) (*(niqmatrixptr+pos)))) >> 4; - coeff -= (coeff & 1); - } - reconptr[pos] = coeff; - if (coeff) { - coeffCount++; - } - } - -#ifdef ANALYSIS - { - extern unsigned int *mbCoeffPtr; - mbCoeffPtr[pos]++; - } -#endif - - flush_bits(2); - - goto end; - } - } - - end: - - if (coeffCount == 1) j_rev_dct_sparse (reconptr, pos); - else j_rev_dct(reconptr); - -#ifdef RISC - temp_curBits = curBits; - temp_bitOffset = bitOffset; - temp_bufLength = bufLength; - temp_bitBuffer = bitBuffer; -#endif - - } - -#ifdef RISC - curBits = temp_curBits; - bitOffset = temp_bitOffset; - bufLength = temp_bufLength; - bitBuffer = temp_bitBuffer; -#endif -} - -#undef DCT_recon -#undef DCT_dc_y_past -#undef DCT_dc_cr_past -#undef DCT_dc_cb_past - - -/* - *-------------------------------------------------------------- - * - * ParseAwayBlock -- - * - * Parses off block values, throwing them away. - * Used with grayscale dithering. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -ParseAwayBlock(int n) -{ - unsigned int diff; - unsigned int size, run; - int level; - - if (bufLength < 2) - correct_underflow(); - - if (curVidStream->mblock.mb_intra) { - - /* If the block is a luminance block... */ - - if (n < 4) { - - /* Parse and decode size of first coefficient. */ - - DecodeDCTDCSizeLum(size); - - /* Parse first coefficient. */ - - if (size != 0) { - get_bitsn(size, diff); - } - } - - /* Otherwise, block is chrominance block... */ - - else { - - /* Parse and decode size of first coefficient. */ - - DecodeDCTDCSizeChrom(size); - - /* Parse first coefficient. */ - - if (size != 0) { - get_bitsn(size, diff); - } - } - } - - /* Otherwise, block is not intracoded... */ - - else { - - /* Decode and set first coefficient. */ - - DECODE_DCT_COEFF_FIRST(run, level); - } - - /* If picture is not D type (i.e. I, P, or B)... */ - - if (curVidStream->picture.code_type != 4) { - - /* While end of macroblock has not been reached... */ - - while (1) { - - /* Get the dct_coeff_next */ - - DECODE_DCT_COEFF_NEXT(run, level); - - if (run == END_OF_BLOCK) break; - } - - /* End_of_block */ - - flush_bits(2); - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp deleted file mode 100644 index 60fb1c13e6b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/prog.cpp +++ /dev/null @@ -1,916 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdlib.h> -#include <unistd.h> -#include "video.h" -#include <X11/Intrinsic.h> -#include <Xm/List.h> -#include <Xm/Frame.h> -#include <Xm/PushB.h> -#include <Xm/Form.h> -#include <Xm/Text.h> -#include <Xm/TextF.h> -#include <Xm/DialogS.h> -#include "include/common.h" -#include "newproto.h" -#include "global.h" - -#define NUM_LIST_ITEMS 20 -#define STRING_SIZE 100 -#define ITEMS 100 -#define PROGRAM_FILE "~/.vcr/vcrPrograms" -#define BANNER "Virtual VCR Program DataBase. version 2.0 **DO NOT edit**" -#ifdef XmFONTLIST_DEFAULT_TAG -#define XmStringTag XmFONTLIST_DEFAULT_TAG -#else -#define XmStringTag XmSTRING_DEFAULT_CHARSET -#endif - -static int cmdSocket; -static int *playtag; -static Widget titlewidget, progshell, progmodifyshell; -static Widget wproglist, wprogmodify; - -static int items = 0; -static XmString * item; -static struct ProgramList -{ - char title[STRING_SIZE]; - char vh[STRING_SIZE]; - char vf[STRING_SIZE]; - char ah[STRING_SIZE]; - char af[STRING_SIZE]; -} * prog; - -static int progcmd, progid; /* progcmd == 0 - insert, 1 - modify*/ -static struct ProgramList deletedprog; - -#define LINE1 " Program Title: " -#define LINE2 "Video file host: " -#define LINE3 "Video file path: " -#define LINE4 "Audio file host: " -#define LINE5 "Audio file path: " -#define MarginHeight 10 -#define MarginWidth 10 -static int charHeight, charWidth; -static int titleSize; - -#define Fgets(s) {if (feof(fp) || fgets(s, STRING_SIZE, fp) == NULL) break; s[strlen(s)-1] = 0; } - -#define Fputs(s) {fputs(s, fp); fputc('\n', fp);} - -static void SaveBuf(void); - -static void InitBuf(void) -{ - FILE * fp; - char *fname; - char buf[256]; - int copyTag = 0; - - deletedprog.title[0] = 0; - - item = (XmString *)malloc(sizeof(*item) * ITEMS); - if (item == NULL) - { - perror("UI allocate proglist item(XmString)"); - exit(1); - } - prog = (struct ProgramList *) malloc(sizeof(*prog) * ITEMS); - if (prog == NULL) - { - perror("UI allocate prog"); - exit(1); - } - fp = NULL; - if (proglistName[0] != 0) { /* file name given in command line */ - get_full_path(proglistName, buf, 256); - fname = proglistName; - fp = fopen(buf, "r"); - if (fp == NULL) { - fprintf(stderr,"PROG.C error opening %s:", proglistName); - perror(""); - } - } - if (fp == NULL) { - get_full_path(PROGRAM_FILE, buf, 256); - fname = PROGRAM_FILE; - fp = fopen(buf, "r"); - } - if (fp == NULL) { - { - - InitBuf_exit1: - - get_full_path(PROGRAM_FILE, buf, 256); - if (access(buf, 0) != 0) { /* PROGRAM_FILE does not exist, create it */ - if (strchr(fname, '/') != NULL) { /* create the default directory */ - char *ptr = strrchr(buf, '/'); - *ptr = 0; - mkdir(buf, 0755); - *ptr = '/'; - } - fname = PROGRAM_FILE; - fp = fopen(buf, "w+"); - } - else { /* Exist, create a temp file in /tmp */ - char *ptr = tempnam("/tmp/", "vcr"); - fname = tmpnam(NULL); - if (ptr != NULL) { - strncpy(fname, ptr, L_tmpnam); - free(ptr); - } - strcpy(buf, fname); - fp = tmpfile(); - } - if (fp != NULL) { - if (strncmp(fname, "/tmp/", 5) != 0) { - fprintf(stderr, - "Warning: created file %s with default movie list.\n", - fname); - } - else fprintf(stderr, "Warning: using default movie list.\n"); - fprintf(fp, "%s\n", BANNER); - fprintf(fp, "\ -lemond: (va) Blazers Game 1 (128)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.128.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.au\n\ -lemond: (va) Blazers Game 1 (256)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.256.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.au\n\ -lemond: (va) Blazers Game 1 (320)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.320.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/c1.0.300.au\n\ -lemond: (va) Blazers Game 2 (128)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.128.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.au\n\ -lemond: (va) Blazers Game 2 (256)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.256.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.au\n\ -lemond: (va) Blazers Game 2 (320)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.320.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/h1.0.300.au\n\ -lemond: (va) Blazers Game 3 (128)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/s1.0.300.128.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/s1.0.300.au\n\ -lemond: (va) Blazers Game 3 (256)\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/s1.0.300.256.mpg\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/s1.0.300.au\n\ -lemond: (vo) Skiing on Mt. Rainer\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/skiRainer.mpeg\n\ -\n\ -\n\ -lemond: (ao) Following the sense (Chinese song)\n\ -\n\ -\n\ -lemond.cse.ogi.edu\n\ -/projects/dsrg/L/multimedia3/sense.au\n\ -"); - fseek(fp, (long)0, 0); - fgets(buf, 100, fp); - goto InitBuf_continue; - /* - fclose(fp); - fp = fopen(buf, "r"); - if (fp != NULL) { - fgets(buf, 100, fp); - goto InitBuf_continue; - } - else { - fprintf(stderr, "Warning: failed to read newly created %s:", buf); - perror(""); - } - */ - } - else { - fprintf(stderr, "Warning: failed to create %s:", buf); - perror(""); - } - items = 0; - return; - } - } - if (fgets(buf, 100, fp) == NULL) - { - fclose(fp); - goto InitBuf_exit1; - } - buf[strlen(buf)-1] = 0; - if (strncmp(buf, BANNER, strlen(BANNER))) - { - fprintf(stderr, "BANNER in %s not expected\n", fname); - fprintf(stderr, " Expected: %s\n", BANNER); - fprintf(stderr, " Actual : %s\n", buf); - fclose(fp); - goto InitBuf_exit1; - } - - InitBuf_continue: - - items = 0; - for(;;) - { - /* - fprintf(stderr, "Reading next program.\n"); - */ - Fgets(prog[items].title); - Fgets(prog[items].vh); - Fgets(prog[items].vf); - Fgets(prog[items].ah); - Fgets(prog[items].af); - item[items] = (XmString)XmStringCreateLtoR(prog[items].title, XmStringTag); - if ((++items) >= ITEMS) break; - } - /* - fprintf(stderr, "Total programs %d\n", items); - */ - fclose(fp); - if (copyTag) { - SaveBuf(); - } -} - -static void SaveBuf(void) -{ - int i; - FILE * fp; - char buf[256]; - get_full_path(PROGRAM_FILE, buf, 256); - fp = fopen(buf, "w"); - if (fp == NULL) - { - fprintf(stderr, "Fail to open %s for saving programs", buf); - perror(""); - return; - } - Fputs(BANNER); - for (i = 0; i < items; i++) - { - Fputs(prog[i].title); - Fputs(prog[i].vh); - Fputs(prog[i].vf); - Fputs(prog[i].ah); - Fputs(prog[i].af); - } - fclose(fp); -} - -static void CmdWrite(char * buf, int size) -{ - if (size == 0) return; - while (write(cmdSocket, (buf), (size)) == -1) - { - if (errno == EINTR) continue; - perror("UI write to cmdSocket"); - exit(1); - } -} - -void StartProgram(char * title, char * vh, char * vf, char * ah, char * af) -{ - extern int cmdBusy; - char tmp = CmdINIT; - int len; - 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 = 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 = af; - len = strlen(str); - if (len > 0 && str[len-1] == 0x0d) str[len - 1] = 0; - XmTextFieldSetString(titlewidget, title); - cmdBusy = 1; - CmdWrite(&tmp, 1); - len = strlen(vh); - CmdWrite((char *)&len, 4); - CmdWrite(vh, len); - len = strlen(vf); - CmdWrite((char *)&len, 4); - CmdWrite(vf, len); - len = strlen(ah); - CmdWrite((char *)&len, 4); - CmdWrite(ah, len); - len = strlen(af); - CmdWrite((char *)&len, 4); - CmdWrite(af, len); - } - else { - beep(); - } -} - -static int curListPos(void) -{ - int * poses, count; - - if (XmListGetSelectedPos(wproglist, &poses, &count)) - { - count = poses[0]; - XtFree((char*)poses); - /* - fprintf(stderr, "curListPos: current pos = %d\n", count); - */ - return count - 1; - } - return -1; -} - - -static void modifyprog(struct ProgramList *p) -{ - XmString item; - - if (items <0 || progid >= items || progid < 0) - { beep(); return; } - item = (XmString)XmStringCreateLtoR(p->title, XmStringTag); - XmListReplaceItemsPos(wproglist, &item, 1, progid+1); - XmListSelectPos(wproglist, progid+1, 0); - XmStringFree(item); - memcpy(&(prog[progid]), p, sizeof(*p)); - SaveBuf(); -} - -static void insertprog(struct ProgramList *p) -{ - XmString item; - - if (items <= 0 || items >= ITEMS) return; - memcpy((char*)&(prog[items]), (char *)p, sizeof(*p)); - item = (XmString)XmStringCreateLtoR(p->title, XmStringTag); - XmListAddItemUnselected(wproglist, item, items+1); - XmStringFree(item); - if (items == 0) - XmListSelectPos(wproglist, 0, False); - items ++; - SaveBuf(); -} - -static void verifyCB(Widget w, XtPointer closure, XmTextVerifyCallbackStruct * cd); - -static void deleteCB(Widget w, XtPointer closure, XtPointer call_data) -{ - int i, j; - - return; - - /* - if (items <= 0) { beep(); return; } - j = curListPos(); - if (j == -1) return; - memcpy(&deletedprog, &prog[j], sizeof(deletedprog)); - for (i = j+1; i < items; i++) - memcpy(&prog[i-1], &prog[i], sizeof(*prog)); - XmListDeletePos(wproglist, j+1); - items --; - SaveBuf(); - */ -} - -static void undoCB(Widget w, XtPointer closure, XtPointer call_data) -{ - return; - /* - if (deletedprog.title[0] != 0) - { - insertprog(&deletedprog); - deletedprog.title[0] = 0; - } - else - beep(); - */ -} - -static void setposition(Widget w, int x, int y); - -static void insertCB(Widget w, XtPointer closure, XtPointer call_data) -{ - char buf[1000]; - - return; - -#if 0 - if (items >= ITEMS -1) - { - beep(); - return; - } - XtRemoveAllCallbacks(wprogmodify, XmNmodifyVerifyCallback); - XtRemoveAllCallbacks(wprogmodify, XmNmotionVerifyCallback); - progcmd = 0; - sprintf(buf, " *** append a program ***\n"); - strcat(buf, LINE1); - strcat(buf, "\n"); - strcat(buf, LINE2); - strcat(buf, "\n"); - strcat(buf, LINE3); - strcat(buf, "\n"); - strcat(buf, LINE4); - strcat(buf, "\n"); - strcat(buf, LINE5); - strcat(buf, "\n\n"); - XmTextSetString(wprogmodify, buf); - - setposition(wprogmodify, titleSize, 1); - XtAddCallback (wprogmodify, XmNmodifyVerifyCallback, (XtCallbackProc)verifyCB, NULL); - XtAddCallback (wprogmodify, XmNmotionVerifyCallback, (XtCallbackProc)verifyCB, NULL); - /* - XtManageChild(progmodifyshell); - */ - XtRealizeWidget(progmodifyshell); -#endif -} - -static void modifyCB(Widget w, XtPointer closure, XtPointer call_data) -{ - int i; - char buf[1000]; - if (items == 0) - { - beep(); - return; - } - XtRemoveAllCallbacks(wprogmodify, XmNmodifyVerifyCallback); - XtRemoveAllCallbacks(wprogmodify, XmNmotionVerifyCallback); - progid = i = curListPos(); - progcmd = 1; - sprintf(buf, " *** modify program: %s ***\n", prog[i].title); - strcat(buf, LINE1); - strcat(buf, prog[i].title); - strcat(buf, "\n"); - strcat(buf, LINE2); - strcat(buf, prog[i].vh); - strcat(buf, "\n"); - strcat(buf, LINE3); - strcat(buf, prog[i].vf); - strcat(buf, "\n"); - strcat(buf, LINE4); - strcat(buf, prog[i].ah); - strcat(buf, "\n"); - strcat(buf, LINE5); - strcat(buf, prog[i].af); - strcat(buf, "\n\n"); - XmTextSetString(wprogmodify, buf); - - setposition(wprogmodify, titleSize, 1); - XtAddCallback (wprogmodify, XmNmodifyVerifyCallback, (XtCallbackProc)verifyCB, NULL); - XtAddCallback (wprogmodify, XmNmotionVerifyCallback, (XtCallbackProc)verifyCB, NULL); - /* - XtManageChild(progmodifyshell); - */ - XtRealizeWidget(progmodifyshell); -} - -static void playCB(Widget w, XtPointer closure, XtPointer call_data) -{ - /* - fprintf(stderr, "play"); - */ - if (items > 0) - { - int i = curListPos(); - if (i >= items || i < 0) - return; - StartProgram(prog[i].title, prog[i].vh, prog[i].vf, prog[i].ah, prog[i].af); - } -} - -static void dismissCB(Widget W, XtPointer closure, XtPointer call_data) -{ - - XtUnrealizeWidget(progshell); - /* - XtUnmanageChild(progshell); - */ -} - -static void setposition(Widget w, int x, int y) -{ - Position x1, y1; - x1 = charWidth * x + (MarginWidth+4); - y1 = charHeight * y + (charHeight+MarginHeight+1); - XmTextSetInsertionPosition(w, XmTextXYToPos(w, x1, y1)); -} - -static int getposition(Widget w, XmTextVerifyCallbackStruct * cd, - int * x, int *y) -{ - Position x1, y1; - if (!XmTextPosToXY(w, cd->newInsert, &x1, &y1)) - return 0; - *x = (x1-(MarginWidth+4))/charWidth; - *y = (y1-(charHeight+MarginHeight+1))/charHeight; - if ((*x)*charWidth != x1-(MarginWidth+4) || (*y)*charHeight != y1-(charHeight+MarginHeight+1)) - { - /* - fprintf(stderr, "error: TextCursorConversion failed. \007\n"); - fprintf(stderr, "x-%d, x1-%d, y-%d, y1-%d\n", *x, (int)x1, *y, (int)y1); - */ - return 1; - } - return 1; - -} - -static void modifydismissCB(Widget w, XtPointer closure, XtPointer call_data) -{ - - XtUnrealizeWidget(progmodifyshell); - /* - XtUnmanageChild(progmodifyshell); - */ -} - -static void modifysaveCB(Widget w, XtPointer closure, XtPointer call_data) -{ - return; - -#if 0 - if (progcmd == 1 && items <= progid) - { - beep(); - } - else if (progcmd == 1 || progcmd == 0) - { - char * buf, * ptr, *ptr1; - struct ProgramList p; - buf = XmTextGetString(wprogmodify); - ptr = buf; - fprintf(stderr, "Buf: %s\n", buf); - while (*ptr != '\n') ptr ++; - ptr ++; - - ptr1 = ptr + titleSize; - while (*ptr != '\n') ptr ++; - (*ptr) = 0; ptr ++; - strncpy(p.title, ptr1, STRING_SIZE); - p.title[STRING_SIZE-1] = 0; - - ptr1 = ptr + titleSize; - while (*ptr != '\n') ptr ++; - (*ptr) = 0; ptr ++; - strncpy(p.vh, ptr1, STRING_SIZE); - p.vh[STRING_SIZE-1] = 0; - - ptr1 = ptr + titleSize; - while (*ptr != '\n') ptr ++; - (*ptr) = 0; ptr ++; - strncpy(p.vf, ptr1, STRING_SIZE); - p.vf[STRING_SIZE-1] = 0; - - ptr1 = ptr + titleSize; - while (*ptr != '\n') ptr ++; - (*ptr) = 0; ptr ++; - strncpy(p.ah, ptr1, STRING_SIZE); - p.ah[STRING_SIZE-1] = 0; - - ptr1 = ptr + titleSize; - while (*ptr != '\n') ptr ++; - (*ptr) = 0; - strncpy(p.af, ptr1, STRING_SIZE); - p.af[STRING_SIZE-1] = 0; - /* - fprintf(stderr, "*|%s||%s||%s||%s||%s||*\n", p.title, p.vh, p.vf, p.ah, p.af); - */ - XtFree((char *)buf); - if (progcmd == 1) - modifyprog(&p); - else - insertprog(&p); - } -#endif -} - -static void verifyCB(Widget w, XtPointer closure, XmTextVerifyCallbackStruct * cd) -{ - int x = 0, y = 0; - - if (!getposition(w, cd, &x, &y)) - { - fprintf(stderr, "error on conversion to x/y\n"); - return; - } -/* - fprintf(stderr, "verifyCB: %d (x-%d, y-%d)\n",cd->newInsert, x, y); -*/ - if (x < titleSize || x > titleSize+STRING_SIZE || y < 1 || y > 5) - { - beep(); - cd->doit = False; - return; - } - else - return; -} - -static void CreateModifyWindow(Widget parent) -{ - Arg args[20]; - int n; - Widget wform, wtext, wdone, wcancel; - XmFontList fontlist; - XFontStruct * font; - XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET; - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR Program List Edit"); n++; - XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++; - XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; - XtSetArg(args[n], XmNwidth, 700); n++; - XtSetArg(args[n], XmNheight, 160); n++; - XtSetArg(args[n], XmNallowShellResize, False); n++; - - progmodifyshell = XtAppCreateShell("Program List", "virtual_vcr", - topLevelShellWidgetClass, display, args, n); - /* - progmodifyshell = XmCreateDialogShell(parent, "virtual_vcr", args, n); - */ - n = 0; - - /* Create form widget */ - n = 0; - XtSetArg (args[n], XmNallowShellResize, False); n++; - /* - XtSetArg (args[n], XmNheight, 300); n++; - XtSetArg (args[n], XmNwidth, 800); n++; - */ - wform = XmCreateForm(progmodifyshell, "Programs", args, n); - - XtManageChild(wform); - - font = XLoadQueryFont (XtDisplay (progmodifyshell), "8x13"); - charHeight = 13; - charWidth = 8; - fontlist = XmStringCreateFontList (font, cset); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 20); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - wdone = XmCreatePushButton (wform, "Save", args, n); - XtManageChild(wdone); - XtAddCallback (wdone, XmNactivateCallback, (XtCallbackProc)modifysaveCB, NULL); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNrightOffset, 20); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - wcancel = XmCreatePushButton (wform, "Dismiss", args, n); - XtManageChild(wcancel); - XtAddCallback (wcancel, XmNactivateCallback, (XtCallbackProc)modifydismissCB, NULL); - - titleSize = strlen(LINE1); - - n=0; - XtSetArg (args[n], XmNleftOffset, 5); n++; - XtSetArg (args[n], XmNtopOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNcolumns, titleSize + STRING_SIZE+1); n++; - XtSetArg(args[n], XmNrows, 7); n++; -/* - XtSetArg(args[n], XmNeditable, True); n++; -*/ - XtSetArg(args[n], XmNeditable, False); n++; - - XtSetArg(args[n], XmNmarginHeight, MarginHeight); n++; - XtSetArg(args[n], XmNmarginWidth, MarginWidth); n++; - XtSetArg(args[n], XmNborderWidth, 0); n++; - XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; - /* - XtSetArg(args[n], XmNvalue, new_string1); n++; - */ - XtSetArg(args[n], XmNfontList, fontlist); n++; - wtext = XmCreateText(wform, "Virtual VCR program list modify text", args, n); - - XtManageChild(wtext); - - XmFontListFree (fontlist); - wprogmodify = wtext; -} - -Widget CreateProgramWindow(Widget parent, int cmdSock, int * playflag, Widget frametext) -{ - Arg args[20]; - int n; - Widget wform, frame1, frame2, wlist, - wdelete, wundo, winsert, wmodify, wplay, wdismiss; - XmFontList fontlist; - XFontStruct * font; - XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET; - - cmdSocket = cmdSock; - playtag = playflag; - titlewidget = frametext; - - InitBuf(); - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR Program List"); n++; - XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++; - XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; - XtSetArg(args[n], XmNwidth, 396); n++; - XtSetArg(args[n], XmNheight, 300); n++; - XtSetArg(args[n], XmNminWidth, 396); n++; - XtSetArg(args[n], XmNminHeight, 150); n++; - - progshell = XtAppCreateShell("Program List", "virtual_vcr", - topLevelShellWidgetClass, display, args, n); - /* - progshell = XmCreateDialogShell(parent, "virtual_vcr", args, n); - */ - font = XLoadQueryFont (XtDisplay (progshell), "courB14"); - fontlist = XmStringCreateFontList (font, cset); - - n = 0; - XtSetArg(args[n], XmNtitle, "Program List"); n++; - wform = XmCreateForm(progshell, "Programs", args, n); - - XtManageChild(wform); - - n = 0; - wdelete = XmCreatePushButton (wform, "Delete", args, n); - XtManageChild(wdelete); - XtAddCallback (wdelete, XmNactivateCallback, (XtCallbackProc)deleteCB, NULL); - wundo = XmCreatePushButton (wform, "Undo", args, n); - XtManageChild(wundo); - XtAddCallback (wundo, XmNactivateCallback, (XtCallbackProc)undoCB, NULL); - winsert = XmCreatePushButton (wform, "Insert", args, n); - XtManageChild(winsert); - XtAddCallback (winsert, XmNactivateCallback, (XtCallbackProc)insertCB, NULL); - wmodify = XmCreatePushButton (wform, "Modify", args, n); - XtManageChild(wmodify); - XtAddCallback (wmodify, XmNactivateCallback, (XtCallbackProc)modifyCB, NULL); - wplay = XmCreatePushButton (wform, "Select", args, n); - XtManageChild(wplay); - XtAddCallback (wplay, XmNactivateCallback, (XtCallbackProc)playCB, NULL); - wdismiss = XmCreatePushButton (wform, "Dismiss", args, n); - XtManageChild(wdismiss); - XtAddCallback (wdismiss, XmNactivateCallback, (XtCallbackProc)dismissCB, NULL); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 5); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wdelete, args, n); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 70); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wundo, args, n); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 135); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (winsert, args, n); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 200); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wmodify, args, n); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 265); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wplay, args, n); - - n=0; - XtSetArg (args[n], XmNwidth, 60); n++; - XtSetArg (args[n], XmNheight, 28); n++; - XtSetArg (args[n], XmNleftOffset, 330); n++; - XtSetArg (args[n], XmNbottomOffset, 5); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetValues (wdismiss, args, n); - - n = 0; - XtSetArg (args[n], XmNtopOffset, 2); n++; - XtSetArg (args[n], XmNleftOffset, 2); n++; - XtSetArg (args[n], XmNbottomOffset, 38); n++; - XtSetArg (args[n], XmNrightOffset, 2); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNfontList, fontlist); n++; - XtSetArg(args[n], XmNvisibleItemCount, NUM_LIST_ITEMS); n++; - if (items > 0) - { - XtSetArg(args[n], XmNitems, item); n++; - XtSetArg(args[n], XmNitemCount, items); n++; - XtSetArg(args[n], XmNselectedItems, item); n++; - XtSetArg(args[n], XmNselectedItemCount, 1); n++; - } - wlist = XmCreateScrolledList(wform, "ProgramList", args, n); - XtManageChild(wlist); - XmFontListFree(fontlist); - wproglist = wlist; - for (n = 0; n < items; n++) - XmStringFree(item[n]); - free(item); - - n=0; - XtSetArg (args[n], XmNtopOffset, 2); n++; - XtSetArg (args[n], XmNleftOffset, 2); n++; - XtSetArg (args[n], XmNbottomOffset, 38); n++; - XtSetArg (args[n], XmNrightOffset, 2); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - frame2 = XmCreateFrame (wform, "frame", args, n); - XtManageChild(frame2); - - n=0; - XtSetArg (args[n], XmNtopOffset, 0); n++; - XtSetArg (args[n], XmNleftOffset, 0); n++; - XtSetArg (args[n], XmNbottomOffset, 0); n++; - XtSetArg (args[n], XmNrightOffset, 0); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - frame1 = XmCreateFrame (wform, "frame", args, n); - XtManageChild(frame1); - - CreateModifyWindow(parent); - - return progshell; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h deleted file mode 100644 index 762a66d184d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/proto.h +++ /dev/null @@ -1,128 +0,0 @@ -/* $Id$ */ - - -#ifdef __STDC__ -# define P(s) s -#else -# define P(s) () -#endif - - -/* util.c */ -void correct_underflow P((void )); -int next_bits P((int num , unsigned int mask )); -char *get_ext_data P((void )); -int next_start_code P((void )); -char *get_extra_bit_info P((void )); - -/* video.c */ -void init_stats P((void )); -void PrintAllStats P((void )); -double ReadSysClock P((void )); -void PrintTimeInfo P((void )); -VidStream *NewVidStream P((void )); -void DestroyVidStream P((VidStream *astream )); -PictImage *NewPictImage P((unsigned int width , unsigned int height )); -void DestroyPictImage P((PictImage *apictimage )); -int mpegVidRsrc P((char *p )); -void ToggleBFlag P((void )); -void TogglePFlag P((void )); - -/* parseblock.c */ -void ParseReconBlock P((int n )); -void ParseAwayBlock P((int n )); - -/* motionvector.c */ -void ComputeForwVector P((int *recon_right_for_ptr , int *recon_down_for_ptr )); -void ComputeBackVector P((int *recon_right_back_ptr , int *recon_down_back_ptr )); - -/* decoders.c */ -void init_tables P((void )); -void decodeDCTDCSizeLum P((unsigned int *value )); -void decodeDCTDCSizeChrom P((unsigned int *value )); -void decodeDCTCoeffFirst P((unsigned int *run , int *level )); -void decodeDCTCoeffNext P((unsigned int *run , int *level )); - -/* main.c */ -int get_more_data P((unsigned int *buf_start , int max_length , int *length_ptr , unsigned int **buf_ptr )); -int main P((int argc , char **argv )); -void usage P((char *s )); - -/* gdith.c */ -void InitColor P((void )); -int HandleXError P((Display *dpy , XErrorEvent *event )); -void InstallXErrorHandler P((void )); -void DeInstallXErrorHandler P((void )); -void ResizeDisplay P((int w , int h )); -void InitDisplay P((char *name )); -void InitGrayDisplay P((char *name )); -void InitMonoDisplay P((char *name )); -void InitColorDisplay P((char *name )); -void ExecuteDisplay P((VidStream *vid_stream )); - -/* fs2.c */ -void InitFS2Dither P((void )); -void FS2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols )); - -/* fs2fast.c */ -void InitFS2FastDither P((void )); -void FS2FastDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* fs4.c */ -void InitFS4Dither P((void )); -void FS4DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *disp , int rows , int cols )); - -/* hybrid.c */ -void InitHybridDither P((void )); -void HybridDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* hybriderr.c */ -void InitHybridErrorDither P((void )); -void HybridErrorDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* 2x2.c */ -void Init2x2Dither P((void )); -void RandInit P((int h , int w )); -void PostInit2x2Dither P((void )); -void Twox2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* gray.c */ -void GrayDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* mono.c */ -void MonoDitherImage(register unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w); -void MonoThresholdImage(unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int h, int w); - -/* jrevdct.c */ -void init_pre_idct P((void )); -void j_rev_dct_sparse P((DCTBLOCK data , int pos )); -void j_rev_dct P((DCTBLOCK data )); -void j_rev_dct_sparse P((DCTBLOCK data , int pos )); -void j_rev_dct P((DCTBLOCK data )); - -/* 24bit.c */ -void InitColorDither P((void )); -void ColorDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int rows , int cols )); - -/* util32.c */ -Visual *FindFullColorVisual P((Display *dpy , int *depth )); -Window CreateFullColorWindow P((Display *dpy , int x , int y , int w , int h )); - -/* ordered.c */ -void InitOrderedDither P((void )); -void OrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* ordered2.c */ -void InitOrdered2Dither P((void )); -void Ordered2DitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); - -/* mb_ordered.c */ -void InitMBOrderedDither P((void )); -void MBOrderedDitherImage P((unsigned char *lum , unsigned char *cr , unsigned char *cb , unsigned char *out , int h , int w )); -void MBOrderedDitherDisplayCopy P((VidStream *vid_stream , int mb_addr , int motion_forw , int r_right_forw , int r_down_forw , int motion_back , int r_right_back , int r_down_back , unsigned char *past , unsigned char *future )); - -#undef P diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp deleted file mode 100644 index 66ae9219437..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.cpp +++ /dev/null @@ -1,989 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with this file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -/* This software is modified on January 15, 1995 by: - * - * Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> -#include <X11/IntrinsicP.h> -#include <Xm/DialogS.h> -#include "mpeg_mib/mibload.h" -#include "interface/fb.xbm" -#include "interface/play.xbm" -#include "interface/step.xbm" -#include "interface/stop.xbm" -#include "interface/loop.xbm" -#include "interface/ff.xbm" -#include "interface/MainWindow.mib" -#include "interface/Info.mib" -#include "video.h" - -#include "include/common.h" -#include "newproto.h" -#include "global.h" - -int cmdBusy = 0; - -extern char infomessage[]; - -/*****************************************************************************/ - -/* Private Variables and Methods */ - -static int playtag = 0; -static int cmdSocket = -1; - -/* Intrinsics Application Context */ -static XtAppContext App; -static Window monitorwindow = (int)NULL; -static mib_Widget *mainload, *infoload; -static Widget shell = (int)NULL, infoshell = (int)NULL, - parashell = (int)NULL, progshell = (int)NULL, - fileshell = (int)NULL; -static Widget frametext= (int)NULL; -static Widget volumescale = (int)NULL, balancescale = (int)NULL, - speedscale = (int)NULL, positionscale = (int)NULL; -static int frameshown = 0; - -#define MINX 500 -#define MINY 360 - -static Window displaywin = (int)NULL; -static int privcolormap = 0; - -static void exit_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void info_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void para_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void prog_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void file_callback(Widget, XtPointer, XmAnyCallbackStruct *); - -static void loopchange_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void normal_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void fb_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void stop_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void ff_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void step_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void play_callback(Widget, XtPointer, XmAnyCallbackStruct *); - -static void volume_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void balance_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void speed_callback(Widget, XtPointer, XmAnyCallbackStruct *); -static void position_callback(Widget, XtPointer, XmAnyCallbackStruct *); - -static void cmdSocket_callback(Widget, XtPointer, XmAnyCallbackStruct *); - -static void monitor_expose(Widget, XtPointer, XmDrawingAreaCallbackStruct *); - -static void infoclose_callback(Widget, XtPointer, XmAnyCallbackStruct *); - -static void CmdWrite(char * buf, int size) -{ - while (write(cmdSocket, (buf), (size)) == -1) - { - if (errno == EINTR) continue; - perror("UI write to cmdSocket"); - exit(1); - } -} - -/***************************************************************************** - - UICreate: Create/load in a motif interface. - - *****************************************************************************/ - -static void UICreate() -{ - - Widget toplevel; - - Widget mainwindow, - temp; - - Pixel fg, bg; - Pixmap button_pix; - - XmFontList fontlist; - XFontStruct * font; - - Arg args[20]; - int n, depth; - - static String fallbacks[] = { - "*Foreground: gray20", - "*BorderWidth: 0", - "*Background: gray70", - "*XmToggleButton.selectColor: yellow", - "*XmToggleButton.indicatorSize: 16", - "*XmToggleButtonGadget.selectColor: yellow", - "*XmToggleButtonGadget.indicatorSize: 16", - "*fontList: -adobe-helvetica-medium-r-normal--14-*-*-*-p-*-iso8859-1", - "*XmText*fontList: -adobe-courier-medium-r-normal--12-*-*-*-m-70-iso8859-1", - NULL - }; - -/*****************************************************************************/ - - n = 0; - - toplevel = XtAppInitialize(&App, "virtual_vcr", NULL, 0, &argc_share, - argv_share, fallbacks, args, n); - - display = XtDisplay(toplevel); - -/******************************************************************************/ - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR"); n++; - XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++; - XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; - XtSetArg(args[n], XmNwidth, MINX); n++; - XtSetArg(args[n], XmNminWidth, MINX); n++; - XtSetArg(args[n], XmNheight, MINY); n++; - XtSetArg(args[n], XmNminHeight, MINY); n++; - - shell = XtAppCreateShell("Virtual VCR", "virtual_vcr", - topLevelShellWidgetClass, display, args, n); - -/*****************************************************************************/ - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR"); n++; - - mainwindow = XmCreateForm(shell, "MainForm", args, n); - XtManageChild(mainwindow); - { - XmStringCharSet cset = XmSTRING_DEFAULT_CHARSET; - XmString titleString; - - font = XLoadQueryFont (XtDisplay (shell), "courB14"); - fontlist = XmStringCreateFontList (font, cset); - - - titleString = XmStringCreateLtoR ("Balance", cset); - n = 0; - XtSetArg (args[n], XmNfontList, fontlist); n++; - XtSetArg (args[n], XmNshowValue, True); n++; - XtSetArg (args[n], XmNtitleString, titleString); n++; - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - XtSetArg (args[n], XmNmaximum, 100); n++; - XtSetArg (args[n], XmNvalue, 50); n++; - XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; - XtSetArg (args[n], XmNscaleHeight, 17);n++; - XtSetArg (args[n], XmNscaleWidth, 100);n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, 4);n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, 8);n++; - balancescale = XmCreateScale(mainwindow, "scale", args, n); - XmStringFree (titleString); - XtManageChild (balancescale); - XtAddCallback (balancescale, XmNvalueChangedCallback, (XtCallbackProc)balance_callback, NULL); - XtAddCallback (balancescale, XmNdragCallback, (XtCallbackProc)balance_callback, NULL); - - - titleString = XmStringCreateLtoR ("Volume", cset); - n = 0; - XtSetArg (args[n], XmNfontList, fontlist); n++; - XtSetArg (args[n], XmNshowValue, True); n++; - XtSetArg (args[n], XmNtitleString, titleString); n++; - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - XtSetArg (args[n], XmNmaximum, 100); n++; - XtSetArg (args[n], XmNvalue, DEFAULT_volume); n++; - XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; - XtSetArg (args[n], XmNscaleHeight, 17);n++; - XtSetArg (args[n], XmNscaleWidth, 100);n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, 4);n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, 128);n++; - volumescale = XmCreateScale(mainwindow, "scale", args, n); - XmStringFree (titleString); - XtManageChild (volumescale); - XtAddCallback (volumescale, XmNvalueChangedCallback, (XtCallbackProc)volume_callback, NULL); - XtAddCallback (volumescale, XmNdragCallback, (XtCallbackProc)volume_callback, NULL); - - - titleString = XmStringCreateLtoR ("Play Speed", cset); - n = 0; - XtSetArg (args[n], XmNfontList, fontlist); n++; - XtSetArg (args[n], XmNshowValue, True); n++; - XtSetArg (args[n], XmNtitleString, titleString); n++; - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - XtSetArg (args[n], XmNmaximum, 100); n++; - XtSetArg (args[n], XmNvalue, 50); n++; - XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; - XtSetArg (args[n], XmNscaleHeight, 17);n++; - XtSetArg (args[n], XmNscaleWidth, 100);n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, 4);n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, 248);n++; - speedscale = XmCreateScale(mainwindow, "scale", args, n); - XmStringFree (titleString); - XtManageChild (speedscale); - XtAddCallback (speedscale, XmNvalueChangedCallback, (XtCallbackProc)speed_callback, NULL); - XtAddCallback (speedscale, XmNdragCallback, (XtCallbackProc)speed_callback, NULL); - - - titleString = XmStringCreateLtoR ("Position", cset); - n = 0; - XtSetArg (args[n], XmNfontList, fontlist); n++; - XtSetArg (args[n], XmNshowValue, True); n++; - XtSetArg (args[n], XmNtitleString, titleString); n++; - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - XtSetArg (args[n], XmNmaximum, POSITION_RANGE); n++; - XtSetArg (args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++; - XtSetArg (args[n], XmNscaleHeight, 17);n++; - XtSetArg (args[n], XmNscaleWidth, 100);n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, 4);n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, 368);n++; - positionscale = XmCreateScale(mainwindow, "scale", args, n); - XmStringFree (titleString); - XtManageChild (positionscale); - XtAddCallback (positionscale, XmNvalueChangedCallback, (XtCallbackProc)position_callback, NULL); - XtAddCallback (positionscale, XmNdragCallback, (XtCallbackProc)position_callback, NULL); - - } - - mainload = mib_load_interface(mainwindow, MainMib, MI_FROMSTRING); - XtSetMappedWhenManaged(shell, False); - XtRealizeWidget(shell); - - frametext = mib_find_name(mainload, "TitleText")->me; - XtVaSetValues(frametext, - XmNfontList, fontlist, - XmNcursorPositionVisible, False, - XmNeditable, False, - NULL); - - temp = mib_find_name(mainload, "Monitor")->me; - XtAddCallback(temp, XmNexposeCallback, - (XtCallbackProc) monitor_expose, (XtPointer) NULL); - XtVaSetValues(temp, XmNforeground, - BlackPixel(display, DefaultScreen(display)), - XmNbackground, - BlackPixel(display, DefaultScreen(display)), - NULL); - monitorwindow = XtWindow(temp); - - temp = mib_find_name(mainload, "Info")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) info_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Para")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) para_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Prog")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) prog_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "File")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) file_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Exit")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) exit_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Loop")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)loop_bits, loop_width, loop_height, fg, bg, depth); - /* - { - int i; - for (i = 0; i < sizeof(loop_bits); i++) - loop_bits[i] = ~loop_bits[i]; - } - */ - XtVaSetValues(temp, - XmNshadowThickness, 2, - - XmNwidth, 45, - XmNheight, 28, - - XmNindicatorType, XmN_OF_MANY, - - XmNindicatorOn, False, - - XmNfillOnSelect, True, - XmNlabelType, XmPIXMAP, - XmNhighlightThickness, 0, - XmNrubberPositioning, False, - XmNlabelPixmap, button_pix, - XmNselectPixmap, button_pix, -/* - XmNselectPixmap, (XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)loop_bits, loop_width, loop_height, fg, bg, depth)), -*/ - NULL); - XtAddCallback(temp, XmNvalueChangedCallback, (XtCallbackProc) loopchange_callback, - (XtPointer) NULL); -/* - XtAddCallback(temp, XmNarmCallback, (XtCallbackProc) looparm_callback, - (XtPointer) NULL); - XtAddCallback(temp, XmNdisarmCallback, (XtCallbackProc) loopdisarm_callback, - (XtPointer) NULL); -*/ - temp = mib_find_name(mainload, "Normal")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) normal_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Rewind")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)fb_bits, fb_width, fb_height, fg, bg, depth); - XtVaSetValues(temp, XmNlabelType, XmPIXMAP, - XmNlabelPixmap, button_pix, NULL); - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) fb_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Stop")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)stop_bits, stop_width, stop_height, fg, bg, depth); - XtVaSetValues(temp, XmNlabelType, XmPIXMAP, - XmNlabelPixmap, button_pix, NULL); - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) stop_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "FF")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)ff_bits, ff_width, ff_height, fg, bg, depth); - XtVaSetValues(temp, XmNlabelType, XmPIXMAP, - XmNlabelPixmap, button_pix, NULL); - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) ff_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Step")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)step_bits, step_width, step_height, fg, bg, depth); - XtVaSetValues(temp, XmNlabelType, XmPIXMAP, - XmNlabelPixmap, button_pix, NULL); - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) step_callback, - (XtPointer) NULL); - - temp = mib_find_name(mainload, "Play")->me; - XtVaGetValues(temp, XmNforeground, &fg, - XmNbackground, &bg, XmNdepth, &depth, NULL); - button_pix = XCreatePixmapFromBitmapData(display, DefaultRootWindow(display), - (char *)play_bits, play_width, play_height, fg, bg, depth); - XtVaSetValues(temp, XmNlabelType, XmPIXMAP, - XmNlabelPixmap, button_pix, NULL); - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) play_callback, - (XtPointer) NULL); - -/*****************************************************************************/ - - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR Infomation"); n++; - XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING);n++; - XtSetArg(args[n], XmNkeyboardFocusPolicy, XmPOINTER); n++; - XtSetArg(args[n], XmNwidth, MINX); n++; - XtSetArg(args[n], XmNheight, MINY); n++; - /* - infoshell = XtAppCreateShell("Info", "virtual_vcr", - topLevelShellWidgetClass, display, args, n); - */ - temp = XmCreateDialogShell(shell, "virtual_vcr", args, n); - n = 0; - XtSetArg(args[n], XmNtitle, "Virtual VCR Infomation"); n++; - - infoshell = XmCreateForm(temp, "virtual_vcr", args, n); - infoload = mib_load_interface(infoshell, InfoMib, - MI_FROMSTRING); - - temp = mib_find_name(infoload, "Dismiss")->me; - XtAddCallback(temp, XmNactivateCallback, (XtCallbackProc) infoclose_callback, - (XtPointer) NULL); - - temp = mib_find_name(infoload, "TextBig")->me; - XtVaSetValues(temp, XmNcursorPositionVisible, False, - XmNeditable, False, NULL); - XmTextSetString(temp, infomessage); - - XmFontListFree (fontlist); - - parashell = CreateParameterWindow(shell); - - progshell = CreateProgramWindow(shell, cmdSocket, &playtag, frametext); - - fileshell = CreateFileWindow(shell, cmdSocket, &playtag, frametext); - -} - -/*****************************************************************************/ - -Window MonitorWindow() -{ - return monitorwindow; -} - -/*****************************************************************************/ - -void UISetColormap() -{ - privcolormap = 1; -} - -/*****************************************************************************/ - -void UISetwin(Window win) -{ - displaywin = win; -} - -/*****************************************************************************/ - -void UISetFrame() -{ - char framestr[100]; - - sprintf(framestr, "%d of %d", shared->currentDisplay, shared->totalFrames); - XmTextFieldSetString(frametext, framestr); -} - -/*****************************************************************************/ - -void UIMinsize(int x, int y) -{ - int minx; - int miny; - int winx; - int winy; - - winx = x; - winy = y; - - x += 30; - y += 180; - - if (x < 450) x = MINX; - if (y < 350) y = MINY; - - minx = x; miny = y; - - if (privcolormap) - { - XtVaSetValues(shell, XmNcolormap, cmap, NULL); - } - if (shell) - { - XtResizeWidget(shell, (Dimension)minx, (Dimension)miny, (Dimension)0); - XtVaSetValues(shell, - XmNminWidth, MINX, - XmNminHeight, MINY, - XmNmaxWidth, minx, - XmNmaxHeight, miny, - NULL); - - XtMapWidget(shell); /* Map the shell now to avoid disappearing buttons! */ - if (displaywin) - { - x = winx; y = winy; - winx = minx - 30; winy = miny - 180; - XMoveWindow(display, displaywin, (winx - x)/2, (winy - y)/2+12); - } - } -} - -/***************************************************************************** - - From here on we have private methods: - - *****************************************************************************/ - -static void exit_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - exit(0); -} - - -static void info_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - /* - XtRealizeWidget(infoshell); - */ - XtManageChild(infoshell); -} - -static void infoclose_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - /* - XtUnrealizeWidget(infoshell); - */ - XtUnmanageChild(infoshell); -} - -static void para_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - - XtRealizeWidget(parashell); - /* - XtManageChild(parashell); - */ -} - -static void prog_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - - XtRealizeWidget(progshell); - /* - XtManageChild(progshell); - */ -} - -static void file_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - /* - XtRealizeWidget(fileshell); - */ - XtManageChild (fileshell); -} - -/*****************************************************************************/ - -static void loopchange_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - static int loop = 0; - loop = !loop; - if (playtag) - { - char cmd = loop ? CmdLOOPenable : CmdLOOPdisable; - CmdWrite(&cmd, 1); - } - else - beep(); -} - -static void normal_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -/* set speed bar, suppose speed_callback should be called automatically */ -{ - char cmd = CmdSPEED; - int value = 50; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - XmScaleSetValue(speedscale, 50); -} - -static void fb_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - if (playtag && !cmdBusy) - { - char cmd = CmdFB; - cmdBusy = 1; - CmdWrite(&cmd, 1); - } - else - beep(); -} - -static void stop_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - if (playtag && !cmdBusy) - { - char cmd = CmdSTOP; - cmdBusy = 1; - CmdWrite(&cmd, 1); - } - else - beep(); -} - -static void ff_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - if (playtag && !cmdBusy) - { - char cmd = CmdFF; - cmdBusy = 1; - CmdWrite(&cmd, 1); - } - else - beep(); -} - - -static void step_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - if (playtag && !cmdBusy) - { - char cmd = CmdSTEP; - cmdBusy = 1; - CmdWrite(&cmd, 1); - } - else { - /* - beep(); - */ - } -} - -static void play_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - if (playtag && !cmdBusy) - { - char cmd = CmdPLAY; - cmdBusy = 1; - CmdWrite(&cmd, 1); - } - else - beep(); -} - -static void volume_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - char cmd; - XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs; - int value = call_value ->value; - - switch (call_value->reason) - { - case XmCR_VALUE_CHANGED: - case XmCR_DRAG: - cmd = CmdVOLUME; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - break; - default: - fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n"); - break; - } -} - -static void speed_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - char cmd; - XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs; - int value = call_value ->value; - - switch (call_value->reason) - { - case XmCR_VALUE_CHANGED: - case XmCR_DRAG: - cmd = CmdSPEED; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - break; - default: - fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n"); - break; - } -} - -static void balance_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - char cmd; - XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs; - int value = call_value ->value; - - switch (call_value->reason) - { - case XmCR_VALUE_CHANGED: - case XmCR_DRAG: - cmd = CmdBALANCE; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - break; - default: - fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n"); - break; - } -} - -static void position_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - char cmd; - XmScaleCallbackStruct * call_value = (XmScaleCallbackStruct *) cbs; - int value = call_value ->value; - - switch (call_value->reason) - { - case XmCR_VALUE_CHANGED: - if (playtag && !cmdBusy) - { - cmdBusy = 1; - cmd = CmdPOSITIONrelease; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - } - else - { - XmScaleSetValue(positionscale, shared->locationPosition); - /* - fprintf(stderr, "UI: shared->cmd = %d\n", shared->cmd); - if (shared->cmd != CmdPOSITION) - beep(); - */ - } - - break; - case XmCR_DRAG: - if (playtag && !cmdBusy) - { - cmdBusy = 1; - cmd = CmdPOSITION; - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - } - break; - default: - fprintf(stderr, "Hit the default, incorrect reason sent for scale!!\n"); - break; - } -} - -static void cmdSocket_callback(Widget w, XtPointer data, XmAnyCallbackStruct *cbs) -{ - char cmd; -/* - fprintf(stderr, "UI in CmdSocket_callback.\n"); -*/ - while (read(cmdSocket, &cmd, 1) <= 0) - { - if (errno == EINTR) return; - perror("UI by callback read from CmdSocket"); - exit(1); - } - if (cmd == CmdDONE || cmd == CmdFAIL) - { - cmdBusy --; - if (shared->cmd == CmdINIT) - { - if (cmd == CmdDONE) - { - char cmd = CmdSPEED; - int value = 50; - XmScaleSetValue(speedscale, 50); - XmScaleSetValue(positionscale, 0); - CmdWrite(&cmd, 1); - CmdWrite((char *)&value, 4); - /* - fprintf(stderr, "UI: VCR program successfully initialized.\n"); - */ - playtag = 1; - } - else - { - fprintf(stderr, "UI: VCR program initialization failed.\n"); - playtag = 0; - } - } - else { - /* - fprintf(stderr, "UI: cmd-%d finished successfully.\n", shared->cmd); - */ - } - /* - UISetFrame(); - */ - } - else - { - static int prepos = 0; - int curpos; - char * ptr; - - if (cmd == CmdVPdisplayFrame) { - read(cmdSocket, (char *)&ptr, sizeof(char *)); - } - VPcommand((int)cmd, ptr); - - if (cmd == CmdVPaudioPosition) - { - curpos = (shared->nextSample * 100) / shared->totalSamples; - if (shared->cmd == CmdPLAY && - (curpos <= prepos - 1 || curpos >= prepos + 1)) - { - XmScaleSetValue(positionscale, curpos); - prepos = curpos; - } - } - else if (cmd == CmdVPdisplayFrame && shared->totalFrames) - { - curpos = (shared->currentDisplay * 100) / shared->totalFrames; - if ((shared->cmd == CmdSTEP || shared->cmd == CmdPLAY || - shared->cmd == CmdFF || shared->cmd == CmdFB) && - (curpos <= prepos - 1 || curpos >= prepos + 1)) - { - XmScaleSetValue(positionscale, curpos); - prepos = curpos; - } - } - } -} - -static void monitor_expose(Widget w, XtPointer data, - XmDrawingAreaCallbackStruct *cbs) -{ - VPexpose(); -} - -#define BUFSIZE 256 - -void UIprocess(int cmdSock) -{ - char *title, *vh, *vf, *vb, *ah, *af, *ab; - int i; - cmdSocket = cmdSock; - UICreate(); - - VPinitWindow(shell, monitorwindow, cmdSock); - XtAppAddInput(App, cmdSock, (XtPointer)XtInputReadMask, - (XtInputCallbackProc)cmdSocket_callback, NULL); - - title = vh = vf = vb = ah = af = ab = NULL; - - for (i = 1; i < argc_share; i++) { - if (strcmp(argv_share[i], "-v") == 0) { - if (argc_share > i + 1) { - i ++; - vh = argv_share[i]; - } - else break; - } - else if (strcmp(argv_share[i], "-a") == 0) { - if (argc_share > i + 1) { - i ++; - ah = argv_share[i]; - } - else break; - } - else if (strcmp(argv_share[i], "-p") == 0) { - if (argc_share > i + 1) { - i ++; - title = argv_share[i]; - } - } - } - - if (title != NULL) { /* the init program is supplied by -l */ - FILE * fp; - char buf[PATH_SIZE]; - char vh[PATH_SIZE]; - char vf[PATH_SIZE]; - char ah[PATH_SIZE]; - char af[PATH_SIZE]; - - get_full_path(title, buf, 256); - fp = fopen(buf, "r"); - if (fp != NULL) { - if ((!feof(fp)) && fgets(buf, PATH_SIZE, fp) != NULL) { - buf[strlen(buf)-1] = 0; - } - else buf[0] = 0; - if ((!feof(fp)) && fgets(vh, PATH_SIZE, fp) != NULL) { - vh[strlen(vh)-1] = 0; - } - else vh[0] = 0; - if ((!feof(fp)) && fgets(vf, PATH_SIZE, fp) != NULL) { - vf[strlen(vf)-1] = 0; - } - else vf[0] = 0; - if ((!feof(fp)) && fgets(ah, PATH_SIZE, fp) != NULL) { - ah[strlen(ah)-1] = 0; - } - else ah[0] = 0; - if ((!feof(fp)) && fgets(af, PATH_SIZE, fp) != NULL) { - af[strlen(af)-1] = 0; - } - else af[0] = 0; - - fclose(fp); - Fprintf(stderr, "Init program: title %s, vh %s, vf %s, ah %s, af %s\n", - buf, vh, vf, ah, af); - StartProgram(buf, vh, vf, ah, af); - } - } - else if (vh != NULL || ah != NULL) {/* init program supplied by -v and -a */ - char *ptr; - - /* form the title */ - if (vh != NULL) { - title = (char *)malloc(strlen(vh) + 1); - if (title != NULL) { - strcpy(title, vh); - } - } - else { - title = (char *)malloc(strlen(ah) + 1); - if (title != NULL) { - strcpy(title, ah); - } - } - if (title == NULL) { - title = "The program from the command line"; - } - - /* generate vh and vf */ - if (vh != NULL) { - if ((ptr = strchr(vh, ':')) != NULL) { - * ptr = 0; - vf = ptr + 1; - } - else { - vf = vh; - vh = ""; - vb = (char *)malloc(BUFSIZE); - if (vb != NULL) { - get_full_path(vf, vb, BUFSIZE); - vf = vb; - } - } - } - else vh = vf = ""; - - /* generate ah and af */ - if (ah != NULL) { - if ((ptr = strchr(ah, ':')) != NULL) { - * ptr = 0; - af = ptr + 1; - } - else { - af = ah; - ah = ""; - ab = (char *)malloc(BUFSIZE); - if (ab != NULL) { - get_full_path(af, ab, BUFSIZE); - af = ab; - } - } - } - else ah = af = ""; - - Fprintf(stderr, "Init program: title %s, vh %s, vf %s, ah %s, af %s\n", - title, vh, vf, ah, af); - StartProgram(title, vh, vf, ah, af); - free(title); - if (ab != NULL) free(ab); - if (vb != NULL) free(vb); - } - - XtAppMainLoop(App); -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h deleted file mode 100644 index b1ce065cc10..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/ui.h +++ /dev/null @@ -1,18 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with this file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -void UICreate(); -void UIEnd(); -Window MonitorWindow(); -void UISetwin(Window); -void UIMinsize(int, int); -void UISetFrame(); -void UISetColormap(); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp deleted file mode 100644 index b29b2b3b796..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.cpp +++ /dev/null @@ -1,464 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -#include <stdlib.h> -#include "video.h" -#include "proto.h" -#include "util.h" - -#define TRUE 1 -#define FALSE 0 - -/* Declarations of global variables used. */ - -unsigned int curBits; -int bitOffset; -int bufLength; -unsigned int *bitBuffer; - -/* Bit masks used by bit i/o operations. */ - -unsigned int nBitMask[] = { 0x00000000, 0x80000000, 0xc0000000, 0xe0000000, - 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000, - 0xff000000, 0xff800000, 0xffc00000, 0xffe00000, - 0xfff00000, 0xfff80000, 0xfffc0000, 0xfffe0000, - 0xffff0000, 0xffff8000, 0xffffc000, 0xffffe000, - 0xfffff000, 0xfffff800, 0xfffffc00, 0xfffffe00, - 0xffffff00, 0xffffff80, 0xffffffc0, 0xffffffe0, - 0xfffffff0, 0xfffffff8, 0xfffffffc, 0xfffffffe}; - -unsigned int bitMask[] = { 0xffffffff, 0x7fffffff, 0x3fffffff, 0x1fffffff, - 0x0fffffff, 0x07ffffff, 0x03ffffff, 0x01ffffff, - 0x00ffffff, 0x007fffff, 0x003fffff, 0x001fffff, - 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, - 0x0000ffff, 0x00007fff, 0x00003fff, 0x00001fff, - 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, - 0x000000ff, 0x0000007f, 0x0000003f, 0x0000001f, - 0x0000000f, 0x00000007, 0x00000003, 0x00000001}; - -unsigned int rBitMask[] = { 0xffffffff, 0xfffffffe, 0xfffffffc, 0xfffffff8, - 0xfffffff0, 0xffffffe0, 0xffffffc0, 0xffffff80, - 0xffffff00, 0xfffffe00, 0xfffffc00, 0xfffff800, - 0xfffff000, 0xffffe000, 0xffffc000, 0xffff8000, - 0xffff0000, 0xfffe0000, 0xfffc0000, 0xfff80000, - 0xfff00000, 0xffe00000, 0xffc00000, 0xff800000, - 0xff000000, 0xfe000000, 0xfc000000, 0xf8000000, - 0xf0000000, 0xe0000000, 0xc0000000, 0x80000000}; - -unsigned int bitTest[] = { 0x80000000, 0x40000000, 0x20000000, 0x10000000, - 0x08000000, 0x04000000, 0x02000000, 0x01000000, - 0x00800000, 0x00400000, 0x00200000, 0x00100000, - 0x00080000, 0x00040000, 0x00020000, 0x00010000, - 0x00008000, 0x00004000, 0x00002000, 0x00001000, - 0x00000800, 0x00000400, 0x00000200, 0x00000100, - 0x00000080, 0x00000040, 0x00000020, 0x00000010, - 0x00000008, 0x00000004, 0x00000002, 0x00000001}; - - -/* - *-------------------------------------------------------------- - * - * correct_underflow -- - * - * Called when buffer does not have sufficient data to - * satisfy request for bits. - * Calls get_more_data, an application specific routine - * required to fill the buffer with more data. - * - * Results: - * None really. - * - * Side effects: - * buf_length and buffer fields in curVidStream structure - * may be changed. - * - *-------------------------------------------------------------- - */ - -void -correct_underflow() { - - int status; - - status = get_more_data(curVidStream->buf_start, - curVidStream->max_buf_length, - &bufLength, &bitBuffer); - - if (status < 0) { - if (!quietFlag) { - fprintf (stderr, "\n"); - perror("Unexpected read error."); - } - exit(1); - } - else if ((status == 0) && (bufLength < 1)) { - if (!quietFlag) { - fprintf(stderr, "\nImproper or missing sequence end code.\n"); - } -#ifdef ANALYSIS - PrintAllStats(); -#endif - if (!quietFlag) { - PrintTimeInfo(); - } -/* - if (loopFlag) longjmp(env, 1); - DestroyVidStream(curVidStream); -*/ - exit(0); - } -#ifdef UTIL2 - curBits = *bitBuffer << bitOffset; -#else - curBits = *bitBuffer; -#endif - -} - - -/* - *-------------------------------------------------------------- - * - * next_bits -- - * - * Compares next num bits to low order position in mask. - * Buffer pointer is NOT advanced. - * - * Results: - * TRUE, FALSE, or error code. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -int next_bits(int num, unsigned int mask) -{ - unsigned int stream; - int ret_value; - - /* If no current stream, return error. */ - - if (curVidStream == NULL) - return NO_VID_STREAM; - - /* Get next num bits, no buffer pointer advance. */ - - show_bitsn(num, stream); - - /* Compare bit stream and mask. Set return value toTRUE if equal, FALSE if - differs. - */ - - if (mask == stream) { - ret_value = TRUE; - } else ret_value = FALSE; - - /* Return return value. */ - - return ret_value; -} - - -/* - *-------------------------------------------------------------- - * - * get_ext_data -- - * - * Assumes that bit stream is at begining of extension - * data. Parses off extension data into dynamically - * allocated space until start code is hit. - * - * Results: - * Pointer to dynamically allocated memory containing - * extension data. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -char *get_ext_data () -{ - int size, marker; - char *dataPtr; - unsigned int data; - - /* Set initial ext data buffer size. */ - - size = EXT_BUF_SIZE; - - /* Allocate ext data buffer. */ - - dataPtr = (char *) malloc(size); - - /* Initialize marker to keep place in ext data buffer. */ - - marker = 0; - - /* While next data is not start code... */ - while (!next_bits(24, 0x000001)) { - - /* Get next byte of ext data. */ - - get_bits8(data); - - /* Put ext data into ext data buffer. Advance marker. */ - - dataPtr[marker] = (char) data; - marker++; - - /* If end of ext data buffer reached, resize data buffer. */ - - if (marker == size) { - size += EXT_BUF_SIZE; - dataPtr = (char *) realloc(dataPtr, size); - } - } - - /* Realloc data buffer to free any extra space. */ - - dataPtr = (char *) realloc(dataPtr, marker); - - /* Return pointer to ext data buffer. */ - - return dataPtr; -} - - -/* - *-------------------------------------------------------------- - * - * next_start_code -- - * - * Parses off bitstream until start code reached. When done - * next 4 bytes of bitstream will be start code. Bit offset - * reset to 0. - * - * Results: - * Status code. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -int next_start_code() -{ - int state; - int byteoff; - unsigned int data; - - /* If no current stream, return error. */ - - if (curVidStream == NULL) - return NO_VID_STREAM; - - /* If insufficient buffer length, correct underflow. */ -/* - if (bufLength < 2) { - correct_underflow(); - } - */ - - /* If bit offset not zero, reset and advance buffer pointer. */ - - byteoff = bitOffset % 8; - - if (byteoff != 0) { - flush_bits((8-byteoff)); - } - - /* Set state = 0. */ - - state = 0; - - /* While buffer has data ... */ - - while(bufLength > 0) { - - /* If insufficient data exists, correct underflow. */ -/* - if (bufLength < 2) { - correct_underflow(); - } -*/ - /* If next byte is zero... */ - - get_bits8(data); - - if (data == 0) { - - /* If state < 2, advance state. */ - - if (state < 2) state++; - } - - /* If next byte is one... */ - - else if (data == 1) { - - /* If state == 2, advance state (i.e. start code found). */ - - if (state == 2) state++; - - /* Otherwise, reset state to zero. */ - - else state = 0; - } - - /* Otherwise byte is neither 1 or 0, reset state to 0. */ - - else { - state = 0; - } - - /* If state == 3 (i.e. start code found)... */ - - if (state == 3) { - - /* Set buffer pointer back and reset length & bit offsets so - next bytes will be beginning of start code. - */ - - bitOffset = bitOffset - 24; - -#ifdef ANALYSIS - bitCount -= 24; -#endif - - if (bitOffset < 0) { - bitOffset = 32 + bitOffset; - bufLength++; - bitBuffer--; -#ifdef UTIL2 - curBits = *bitBuffer << bitOffset; -#else - curBits = *bitBuffer; -#endif - } - else { -#ifdef UTIL2 - curBits = *bitBuffer << bitOffset; -#else - curBits = *bitBuffer; -#endif - } - - /* Return success. */ - - return OK; - } - } - - /* Return underflow error. */ - - return UNDERFLOW; -} - - -/* - *-------------------------------------------------------------- - * - * get_extra_bit_info -- - * - * Parses off extra bit info stream into dynamically - * allocated memory. Extra bit info is indicated by - * a flag bit set to 1, followed by 8 bits of data. - * This continues until the flag bit is zero. Assumes - * that bit stream set to first flag bit in extra - * bit info stream. - * - * Results: - * Pointer to dynamically allocated memory with extra - * bit info in it. Flag bits are NOT included. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -char *get_extra_bit_info () -{ - int size, marker; - char *dataPtr; - unsigned int data; - - /* Get first flag bit. */ - get_bits1(data); - - /* If flag is false, return NULL pointer (i.e. no extra bit info). */ - - if (!data) return NULL; - - /* Initialize size of extra bit info buffer and allocate. */ - - size = EXT_BUF_SIZE; - dataPtr = (char *) malloc(size); - - /* Reset marker to hold place in buffer. */ - - marker = 0; - - /* While flag bit is true. */ - - while (data) { - - /* Get next 8 bits of data. */ - get_bits8(data); - - /* Place in extra bit info buffer. */ - - dataPtr[marker] = (char) data; - marker++; - - /* If buffer is full, reallocate. */ - - if (marker == size) { - size += EXT_BUF_SIZE; - dataPtr = (char *) realloc(dataPtr, size); - } - - /* Get next flag bit. */ - get_bits1(data); - } - - /* Reallocate buffer to free extra space. */ - - dataPtr = (char *) realloc(dataPtr, marker); - - /* Return pointer to extra bit info buffer. */ - - return dataPtr; -} - - - - - - - - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h deleted file mode 100644 index 272e0add31d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util.h +++ /dev/null @@ -1,368 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - -/* Status codes for bit stream i/o operations. */ - -#if !defined (AV_UTIL_H) -#define AV_UTIL_H - -#define NO_VID_STREAM -1 -#define UNDERFLOW -2 -#define OK 1 -/* Size increment of extension data buffers. */ - -#define EXT_BUF_SIZE 1024 - -/* External declarations for bitstream i/o operations. */ -extern unsigned int bitMask[]; -extern unsigned int nBitMask[]; -extern unsigned int rBitMask[]; -extern unsigned int bitTest[]; - -/* External declarations of bitstream global variables. */ -extern unsigned int curBits; -extern int bitOffset; -extern int bufLength; -extern unsigned int *bitBuffer; - -/* Macro for updating bit counter if analysis tool is on. */ -#ifdef ANALYSIS -#define UPDATE_COUNT(numbits) bitCount += numbits -#else -#define UPDATE_COUNT(numbits) -#endif - -#ifdef NO_SANITY_CHECKS -#define get_bits1(result) \ -{ \ - UPDATE_COUNT(1); \ - result = ((curBits & 0x80000000) != 0); \ - curBits <<= 1; \ - bitOffset++; \ - \ - if (bitOffset & 0x20) { \ - bitOffset = 0; \ - bitBuffer++; \ - curBits = *bitBuffer; \ - bufLength--; \ - } \ -} - -#define get_bits2(result) \ -{ \ - UPDATE_COUNT(2); \ - bitOffset += 2; \ - \ - if (bitOffset & 0x20) { \ - bitOffset -= 32; \ - bitBuffer++; \ - bufLength--; \ - if (bitOffset) { \ - curBits |= (*bitBuffer >> (2 - bitOffset)); \ - } \ - result = ((curBits & 0xc0000000) >> 30); \ - curBits = *bitBuffer << bitOffset; \ - } \ - \ - result = ((curBits & 0xc0000000) >> 30); \ - curBits <<= 2; \ -} - -#define get_bitsX(num, mask, shift, result) \ -{ \ - UPDATE_COUNT(num); \ - bitOffset += num; \ - \ - if (bitOffset & 0x20) { \ - bitOffset -= 32; \ - bitBuffer++; \ - bufLength--; \ - if (bitOffset) { \ - curBits |= (*bitBuffer >> (num - bitOffset)); \ - } \ - result = ((curBits & mask) >> shift); \ - curBits = *bitBuffer << bitOffset; \ - } \ - else { \ - result = ((curBits & mask) >> shift); \ - curBits <<= num; \ - } \ -} -#else - -#define get_bits1(result) \ -{ \ - /* Check for underflow. */ \ - /* \ - if (bufLength < 2) { \ - correct_underflow(); \ - } */ \ - UPDATE_COUNT(1); \ - result = ((curBits & 0x80000000) != 0); \ - curBits <<= 1; \ - bitOffset++; \ - \ - if (bitOffset & 0x20) { \ - bitOffset = 0; \ - bitBuffer++; \ - curBits = *bitBuffer; \ - bufLength--; \ - } \ -} - -#define get_bits2(result) \ -{ \ - /* Check for underflow. */ \ - /* \ - if (bufLength < 2) { \ - correct_underflow(); \ - } */ \ - UPDATE_COUNT(2); \ - bitOffset += 2; \ - \ - if (bitOffset & 0x20) { \ - bitOffset -= 32; \ - bitBuffer++; \ - bufLength--; \ - if (bitOffset) { \ - curBits |= (*bitBuffer >> (2 - bitOffset)); \ - } \ - result = ((curBits & 0xc0000000) >> 30); \ - curBits = *bitBuffer << bitOffset; \ - } \ - \ - result = ((curBits & 0xc0000000) >> 30); \ - curBits <<= 2; \ -} - -#define get_bitsX(num, mask, shift, result) \ -{ \ - /* Check for underflow. */ \ - /* \ - if (bufLength < 2) { \ - correct_underflow(); \ - } */ \ - UPDATE_COUNT(num); \ - bitOffset += num; \ - \ - if (bitOffset & 0x20) { \ - bitOffset -= 32; \ - bitBuffer++; \ - bufLength--; \ - if (bitOffset) { \ - curBits |= (*bitBuffer >> (num - bitOffset)); \ - } \ - result = ((curBits & mask) >> shift); \ - curBits = *bitBuffer << bitOffset; \ - } \ - else { \ - result = ((curBits & mask) >> shift); \ - curBits <<= num; \ - } \ -} -#endif - -#define get_bits3(result) get_bitsX(3, 0xe0000000, 29, result) -#define get_bits4(result) get_bitsX(4, 0xf0000000, 28, result) -#define get_bits5(result) get_bitsX(5, 0xf8000000, 27, result) -#define get_bits6(result) get_bitsX(6, 0xfc000000, 26, result) -#define get_bits7(result) get_bitsX(7, 0xfe000000, 25, result) -#define get_bits8(result) get_bitsX(8, 0xff000000, 24, result) -#define get_bits9(result) get_bitsX(9, 0xff800000, 23, result) -#define get_bits10(result) get_bitsX(10, 0xffc00000, 22, result) -#define get_bits11(result) get_bitsX(11, 0xffe00000, 21, result) -#define get_bits12(result) get_bitsX(12, 0xfff00000, 20, result) -#define get_bits14(result) get_bitsX(14, 0xfffc0000, 18, result) -#define get_bits16(result) get_bitsX(16, 0xffff0000, 16, result) -#define get_bits18(result) get_bitsX(18, 0xffffc000, 14, result) -#define get_bits32(result) get_bitsX(32, 0xffffffff, 0, result) - -#define get_bitsn(num, result) get_bitsX((num), nBitMask[num], (32-(num)), result) - -#ifdef NO_SANITY_CHECKS -#define show_bits32(result) \ -{ \ - if (bitOffset) { \ - result = curBits | (*(bitBuffer+1) >> (32 - bitOffset)); \ - } \ - else { \ - result = curBits; \ - } \ -} - -#define show_bitsX(num, mask, shift, result) \ -{ \ - int bO; \ - bO = bitOffset + num; \ - if (bO > 32) { \ - bO -= 32; \ - result = ((curBits & mask) >> shift) | \ - (*(bitBuffer+1) >> (shift + (num - bO))); \ - } \ - else { \ - result = ((curBits & mask) >> shift); \ - } \ -} - -#else -#define show_bits32(result) \ -{ \ - /* Check for underflow. */ \ - /* if (bufLength < 2) { \ - correct_underflow(); \ - } */ \ - if (bitOffset) { \ - result = curBits | (*(bitBuffer+1) >> (32 - bitOffset)); \ - } \ - else { \ - result = curBits; \ - } \ -} - -#define show_bitsX(num, mask, shift, result) \ -{ \ - int bO; \ - \ - /* Check for underflow. */ \ - /* if (bufLength < 2) { \ - correct_underflow(); \ - } */ \ - bO = bitOffset + num; \ - if (bO > 32) { \ - bO -= 32; \ - result = ((curBits & mask) >> shift) | \ - (*(bitBuffer+1) >> (shift + (num - bO))); \ - } \ - else { \ - result = ((curBits & mask) >> shift); \ - } \ -} -#endif - -#define show_bits1(result) show_bitsX(1, 0x80000000, 31, result) -#define show_bits2(result) show_bitsX(2, 0xc0000000, 30, result) -#define show_bits3(result) show_bitsX(3, 0xe0000000, 29, result) -#define show_bits4(result) show_bitsX(4, 0xf0000000, 28, result) -#define show_bits5(result) show_bitsX(5, 0xf8000000, 27, result) -#define show_bits6(result) show_bitsX(6, 0xfc000000, 26, result) -#define show_bits7(result) show_bitsX(7, 0xfe000000, 25, result) -#define show_bits8(result) show_bitsX(8, 0xff000000, 24, result) -#define show_bits9(result) show_bitsX(9, 0xff800000, 23, result) -#define show_bits10(result) show_bitsX(10, 0xffc00000, 22, result) -#define show_bits11(result) show_bitsX(11, 0xffe00000, 21, result) -#define show_bits12(result) show_bitsX(12, 0xfff00000, 20, result) -#define show_bits13(result) show_bitsX(13, 0xfff80000, 19, result) -#define show_bits14(result) show_bitsX(14, 0xfffc0000, 18, result) -#define show_bits15(result) show_bitsX(15, 0xfffe0000, 17, result) -#define show_bits16(result) show_bitsX(16, 0xffff0000, 16, result) -#define show_bits17(result) show_bitsX(17, 0xffff8000, 15, result) -#define show_bits18(result) show_bitsX(18, 0xffffc000, 14, result) -#define show_bits19(result) show_bitsX(19, 0xffffe000, 13, result) -#define show_bits20(result) show_bitsX(20, 0xfffff000, 12, result) -#define show_bits21(result) show_bitsX(21, 0xfffff800, 11, result) -#define show_bits22(result) show_bitsX(22, 0xfffffc00, 10, result) -#define show_bits23(result) show_bitsX(23, 0xfffffe00, 9, result) -#define show_bits24(result) show_bitsX(24, 0xffffff00, 8, result) -#define show_bits25(result) show_bitsX(25, 0xffffff80, 7, result) -#define show_bits26(result) show_bitsX(26, 0xffffffc0, 6, result) -#define show_bits27(result) show_bitsX(27, 0xffffffe0, 5, result) -#define show_bits28(result) show_bitsX(28, 0xfffffff0, 4, result) -#define show_bits29(result) show_bitsX(29, 0xfffffff8, 3, result) -#define show_bits30(result) show_bitsX(30, 0xfffffffc, 2, result) -#define show_bits31(result) show_bitsX(31, 0xfffffffe, 1, result) - -#define show_bitsn(num,result) show_bitsX((num), (0xffffffff << (32-(num))), (32-(num)), result) - -#ifdef NO_SANITY_CHECKS -#define flush_bits32 \ -{ \ - UPDATE_COUNT(32); \ - \ - bitBuffer++; \ - bufLength--; \ - curBits = *bitBuffer << bitOffset; \ -} - -#define flush_bits(num) \ -{ \ - bitOffset += num; \ - \ - UPDATE_COUNT(num); \ - \ - if (bitOffset & 0x20) { \ - bitOffset -= 32; \ - bitBuffer++; \ - bufLength--; \ - curBits = *bitBuffer << bitOffset; \ - } \ - else { \ - curBits <<= num; \ - } \ -} -#else -#define flush_bits32 \ -{ \ - if (curVidStream == NULL) { \ - /* Deal with no vid stream here. */ \ - } \ - /* \ - if (bufLength < 2) { \ - correct_underflow(); \ - } \ - */ \ - UPDATE_COUNT(32); \ - \ - bitBuffer++; \ - bufLength--; \ - curBits = *bitBuffer << bitOffset; \ -} - -#define flush_bits(num) \ -{ \ - if (curVidStream == NULL) { \ - /* Deal with no vid stream here. */ \ - } \ - /* \ - if (bufLength < 2) { \ - correct_underflow(); \ - } \ - */ \ - UPDATE_COUNT(num); \ - \ - bitOffset += num; \ - \ - if (bitOffset & 0x20) { \ - bufLength--; \ - bitOffset -= 32; \ - bitBuffer++; \ - curBits = *bitBuffer << bitOffset; \ - } \ - else { \ - curBits <<= num; \ - } \ -} -#endif - -#define UTIL2 - -#endif /* if !defined (AV_UTIL_H) */ - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp deleted file mode 100644 index d94f63f8069..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/util32.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* $Id$ */ -#include <stdio.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include "video.h" -#include "proto.h" -#include "ui.h" /* include user interface */ - -/* - * Return a pointer to a full color bit visual on the dpy - */ -Visual * -FindFullColorVisual (Display *dpy, int *depth) -{ - XVisualInfo vinfo; - XVisualInfo *vinfo_ret; - int numitems, maxdepth; - -#ifdef __cplusplus - vinfo.c_class = TrueColor; -#else - vinfo.class = TrueColor; -#endif - vinfo_ret = XGetVisualInfo(dpy, VisualClassMask, &vinfo, &numitems); - - if (numitems == 0) return NULL; - - maxdepth = 0; - while(numitems > 0) { - if (vinfo_ret[numitems-1].depth > maxdepth) { - maxdepth = vinfo_ret[numitems-1 ].depth; - } - numitems--; - } - XFree(vinfo_ret); - - if (maxdepth < 24) return NULL; - - if (XMatchVisualInfo(dpy, DefaultScreen(dpy), maxdepth, - TrueColor, &vinfo)) { - *depth = maxdepth; - return vinfo.visual; - } - - return NULL; -} - -Window -CreateFullColorWindow (Display *dpy, int x, int y, int w, int h) -{ - int depth; - Visual *visual; - XSetWindowAttributes xswa; - Window temp; - unsigned int mask; - unsigned int valclass; - int screen; - - screen = XDefaultScreen(dpy); - valclass = InputOutput; /* Could be InputOnly */ - visual = FindFullColorVisual (dpy, &depth); - if (visual == NULL) { - return 0; - } - mask = CWBackPixel | CWColormap | CWBorderPixel; - xswa.colormap = XCreateColormap(dpy, XRootWindow(dpy, screen), - visual, AllocNone); - xswa.background_pixel = BlackPixel(dpy, DefaultScreen(dpy)); - xswa.border_pixel = WhitePixel(dpy, DefaultScreen(dpy)); - - temp = XCreateWindow(dpy, MonitorWindow(), x, y, w, h, - 1, depth, valclass, visual, mask, &xswa); - - UISetwin(temp); - - return temp; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp deleted file mode 100644 index 3969df96cca..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vb.cpp +++ /dev/null @@ -1,1797 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> -#include <stdlib.h> -#include <netinet/in.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> -#if defined(__svr4__) || defined(IRIX) -#include <stropts.h> -#include <sys/conf.h> -#endif -#include "include/common.h" -#include "newproto.h" -#include "global.h" -#include "mpeg_shared/filters.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" - -/* magic number -- deviation is considered - caused by clock drift only if rate <= 1/MAX_CLOCK_DRIFT. - */ -#define MAX_CLOCK_DRIFT 50 - -#define SHCODE 0x000001b3 - -#define max(a,b) ((a)>(b) ? (a) : (b)) - -static struct block -{ - unsigned shcode; - struct block * next; - int full; -} ** head, ** tail; - -struct header -{ - struct block *h, *t; -}; - -static char * buf; -static int bufsize; -static int sid, countid; -static exit_tag = 0; -static int conn_tag; -static int savedSocket; - -void VBinitBuf(int size) -/* size in byte */ -{ - bufsize = size - sizeof(struct header); - buf = creat_shared_mem(size); - head = &((struct header *)buf)->h; - tail = &((struct header *)buf)->t; - buf += sizeof(struct header); - sid = creat_semaphore(); - countid = creat_semaphore(); - enter_cs(countid); - *head = *tail = (struct block *)buf; - (*tail)->full = 0; - (*tail)->next = NULL; - (*tail)->shcode = SHCODE; -} - -char * VBgetBuf(int size) /* block version */ -{ - return 0; -} - -int VBcheckBuf(int size) /* non-block check, return True/False*/ -{ - return 0; -} - -void VBputMsg(char * msgPtr) -{ -} - -char * VBgetMsg() /* block version */ -{ - char *ptr; - -#ifdef STAT - if (shared->collectStat && *head == *tail) - shared->stat.VBemptyTimes ++; -#endif - - enter_cs(countid); - enter_cs(sid); - while (*tail != *head && (*tail)->full == 0) - *tail = (*tail)->next; - leave_cs(sid); - if (*head == *tail) - { - fprintf(stderr, "VB: getMsg run out of msg unexpectedly.\n"); - exit(1); - } - ptr = ((char*)*tail)+sizeof(**tail)+sizeof(VideoMessage); - /* - fprintf(stderr,"VBgetMsg: buf:%x, msg:%x\n", (int)buf, (int)ptr); - */ - return ptr; -} - -int VBcheckMsg() /* non-block check, return Number of Msgs in buffer */ -{ - return get_semval(countid); -} - -int VBbufEmpty(void) -{ - /* - Fprintf(stderr, "VB countid %d\n", get_semval(countid)); - */ - return get_semval(countid) <= 0; -} - -void VBreclaimMsg(char * msgPtr) -{ - enter_cs(sid); - *tail = (*tail)->next; - leave_cs(sid); -} - -void VBdeleteBuf(void) -{ - remove_shared_mem(buf - sizeof(struct header)); -} -void VBdeleteSem(void) -{ - remove_semaphore(sid); - remove_semaphore(countid); -} - -/* SIGUSR1 from CTR is for killing this process, without affecting any other ones. */ - -static void usr1_handler(int sig) -{ - exit_tag = 1; -} - -static void exit_on_kill(void) -{ - extern void set_exit_routine_tag(int tag); - set_exit_routine_tag(0); - ComCloseConn(savedSocket); - VBdeleteBuf(); - exit(0); -} - -static void usr2_handler(int sig) -{ - /* - fprintf(stderr, "VB void usr2_handler (supposed for stat).\n"); - */ -} - -static int send_feedback(int sock, int addupf, int addf, int advance) -{ - int res; - VideoFeedBackPara para; - para.cmdsn = htonl(shared->cmdsn); - para.addUsecPerFrame = htonl(addupf); - para.addFrames = htonl(addf); - para.needHeader = htonl(shared->needHeader); - shared->needHeader = 0; - para.frameRateLimit1000 = - htonl((long)(shared->frameRateLimit * 1000.0)); - para.sendPatternGops = htonl(shared->sendPatternGops); - memcpy(para.sendPattern, shared->sendPattern, PATTERN_SIZE); - /* - fprintf(stderr, "VB to send a fb packet..."); - */ - if (conn_tag != 0) { /* packet stream */ - while ((res = write(sock, (char *)¶, sizeof(para))) == -1) { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - perror("VB Warning, fb packet discarded for"); - return -1; - } - perror("VB error, fb packet sending failed"); - exit(1); - } - } - else { - res = write(sock, (char *)¶, sizeof(para)); - if (res == -1) { - perror("VB error, fb packet sending failed"); - exit(1); - } - } - if (res < sizeof(para)) { - fprintf(stderr, "VB send_feedback() warn: res %dB < sizeof(para) %dB\n", - res, sizeof(para)); - } -#ifdef STAT - { - int i; - if ((i = shared->stat.fbPacketNumber) < MAX_FB_PACKETS) { - shared->stat.fbPackets[i].frameId = shared->nextFrame; - shared->stat.fbPackets[i].addUsecPerFrame = addupf; - shared->stat.fbPackets[i].addFrames = addf; - shared->stat.fbPackets[i].frames = shared->sendPatternGops * - shared->patternSize; - shared->stat.fbPackets[i].framesDropped = shared->framesDropped; - shared->stat.fbPackets[i].frameRateLimit = shared->frameRateLimit; - shared->stat.fbPackets[i].advance = advance; - } - shared->stat.fbPacketNumber ++; - } -#endif - Fprintf(stderr, "VB sent fb pkt frame%d gop%d addf%d addupf%d frate%5.2f.\n", - shared->nextFrame, shared->nextGroup, - addf, addupf, shared->frameRateLimit); - return 0; -} - -static void skip_message(int fd, VideoMessage * msg) -{ - char buf[1024]; - if (conn_tag >= 0) { - int size = msg->msgSize; - while (size > 0) { - int res; - int bytes = size > 1024 ? 1024 : size; - read_bytes(fd, buf, bytes); - /* - if ((res = read(fd, buf, bytes)) < bytes) { - fprintf(stderr, "VB Error skip_message: try read %dB, got %dB\n", - bytes, res); - } - */ - size -= bytes; - } - } - else { /* discard mode packet stream packet has been read */ - } - if (exit_tag) exit_on_kill(); -} - -void VBprocess(int initSocket, int normalSocket) -{ - VideoMessage * msg, msghd; - VideoPacket * packet; - int len, bsize, msgsn = -1; - int psize, poffset; - char * ptr, *ptr1; - char *tmp_buf = NULL; - int dataSocket = initSocket; - - /* INIT frame is received from CTR through initSocket */ - -#ifdef STAT - int to_count = 1; - int gap_msgsn = -1; -#endif - - /* following variables are for feedback */ - int pcmdsn, pcmd; /* to store the cmdsn and cmd of previous frame, - to detect new commands */ - int pfid, pgop; /* frame-id of gopid of previous frame */ - int cmdsn = -1; /* cmdsn of previous command */ - int state = 0; /* state of the control law/regulator */ - int startpos; /* gopid or frameid when the regulator is in 'start' state 1 */ - int delay; /* #frames to delay after 'start' */ - int qosRecomputes = 0; /* indicate if qos has been recomputed recently */ - int action_delay; /* microseconds to delay after feedback action */ - int action_time; /* the time when feedback action is taken, used to enforce - action_delay */ - int upf, cupf; /* upf -- currentUPF as carried in all frames, - cupf -- real current UPF, being adjusted by FB */ - double fv; /* current buffer fill level in term of #frames */ - double init_fv; /* init_fv and init_pos record the fv value and position - (frameid or gopid) when fv is very close to med */ - double init_pos; - int high, low, med; /* median, high and low water marks, in term of #frames */ - int period; /* interms of #frames, (high-med, period) defined the max - buffer fill drift which can be assumed as caused by - clock drift */ - Filter * f = NULL; /* buffer fill level filter */ - - int advance, min_advance; /* in microseconds, advance holds the - current target buffer-fill-level as - determined by jitter level - estimate. min_advance sets a absolute - minimun level, no matter how low jitter - level is. - 'advance' does not change when - play-speed changes, but med/high/low - will be updated upon speed change */ - double fav; /* #frames, jitter level output by the filter */ - Filter * fa = NULL; /* jitter filter */ - int reach_limit = 0; /* indicate that the target 'advance' has reached client VB - buffer limit, and can not further increase, even if - jitter increases */ - int not_action = 1; /* indicates entering state=3 is not caused by - feedback action. If not_action = 1 entering state=3 - is caused either by 'start' or speed change, and - the jitter filter needs to be reset */ - - exit_tag = 0; - conn_tag = shared->videoMaxPktSize; - - savedSocket = normalSocket; -#if 0 -#ifdef __svr4__ - - /* On solaris 2.x for i86pc, a datagram socket may not discard the - remaining of a message if recv() fails to read the whole - thing. Following systems are tried but seems doesn't work. So for - this platform, This causes problem with skip_message() defined - above, which tries to discard whole packets by reading only a few - bytes. An alternative here is to allocate a big enough buffer, - read and discard the whole packet, this is less efficient because - of more data copy. - - But if we call read(2) instead of recv(), then it works. - */ - if (!conn_tag) { - len = ioctl(dataSocket, I_SRDOPT, RMSGD); /* discard unread part of the message */ - if (len) perror("error message"); - } -#endif -#endif - - setsignal(SIGUSR1, usr1_handler); - setsignal(SIGUSR2, usr2_handler); - - if (conn_tag < 0) { /* buffer big enough for discard mode packet stream */ - tmp_buf = (char *)malloc(-conn_tag); - if (tmp_buf == NULL) { - fprintf(stderr, "AB failed to allocate %d bytes"); - perror("of tmp_buf"); - exit(1); - } - } - - for (;;) - { - // fprintf(stderr, "VB wait for a new packet.\n"); - if (conn_tag >= 0) { - len = wait_read_bytes(dataSocket, (char *)&msghd, sizeof(msghd)); - } - else { /* discard mode packet stream, read all bytes */ - len = read(dataSocket, tmp_buf, -conn_tag); - memcpy((char *)&msghd, tmp_buf, sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len == -1) { - if (errno == EWOULDBLOCK || errno == EAGAIN) { - perror("VB sleep for 10ms"); - usleep(10000); - if (exit_tag) exit_on_kill(); - continue; - } - perror("VB read() data"); - exit(1); - } - if (len == 0) { /* EOF, connection closed by peer */ - fprintf(stderr, "Error: VB found dataSocket broken\n"); - for (;;) { - usleep(1000000); - if (exit_tag) exit_on_kill(); - } - } - if (len < sizeof(msghd)) { - fprintf(stderr, "VD warn: PEEK1ed %dB < expected %dB\n", - len, sizeof(msghd)); - continue; - } -#ifdef NeedByteOrderConversion - msghd.packetsn = ntohl(msghd.packetsn); - msghd.packetSize = ntohl(msghd.packetSize); - msghd.msgsn = ntohl(msghd.msgsn); - msghd.msgOffset = ntohl(msghd.msgOffset); - msghd.msgSize = ntohl(msghd.msgSize); -#endif - /* - fprintf(stderr, "VB PEEK1 a msg sn-%d, size-%d, pkt-%d, pktsize-%d\n", - msghd.msgsn, msghd.msgSize, msghd.packetsn, msghd.packetSize); - */ - - - start_new_packet: - - -#ifdef STAT - if (to_count) { - int gap = msghd.msgsn - gap_msgsn; - gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap; - shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++; - if (gap >0) gap_msgsn = msghd.msgsn; - } - to_count = 1; -#endif - if (msghd.msgsn <= msgsn) /* outdated msg */ - { - /* - fprintf(stderr, "VB discard outdated msgsn %d, pktsn %d when expecting first\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - else if (msghd.msgOffset != 0) /* not first msg of a packet */ - { - /* - Fprintf(stderr, "VB discard non-first msg msgsn %d, pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - else - msgsn = msghd.msgsn; - - /* allocate packet for the incoming msg */ - bsize = msghd.packetSize + sizeof(**head)*2 + sizeof(msghd); - bsize = ((bsize+3)>>2)<<2; - enter_cs(sid); - if (*head >= *tail) - { - if (bufsize - (int)((char*)*head - buf) >= bsize ) - msg =(VideoMessage *)((char*)*head + sizeof(**head)); - else if ((int)((char*)*tail - buf) >= bsize) - { - (*head)->next = (struct block *)buf; - (*head)->full = 0; - *head = (struct block *)buf; - msg = (VideoMessage *)(buf + sizeof(**head)); - *head = (struct block *)buf; - (*head)->shcode = SHCODE; - } - else /* not enough buffer, discard current message */ - { - leave_cs(sid); -#ifdef STAT - if (shared->collectStat) - shared->stat.VBdroppedFrames ++; -#endif - /* - Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - } - else /* *head < *tail */ - if ((char*)*tail - (char*)*head >= bsize) - msg = (VideoMessage *)((char*)*head + sizeof(**head)); - else /* not enough buffer, abandon current message */ - { - leave_cs(sid); -#ifdef STAT - if (shared->collectStat) - shared->stat.VBdroppedFrames ++; -#endif - /* - Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - leave_cs(sid); - /* - fprintf(stderr, "VB allocated a buffer for comming packet.\n"); - */ - psize = msghd.packetSize; - poffset = 0; - packet = (VideoPacket *)((char*)msg + sizeof(msghd)); - *(((int*)packet)+(msghd.packetSize>>2)) = 0; - /* clear the last no more than three bytes, for - proper detecting the end of packet by VD */ - ptr = (char*)msg; - for (;;) - { - int bytes; - bytes = sizeof(msghd) + msghd.msgSize; - if (conn_tag >= 0) { - len = bytes; - read_bytes(dataSocket, ptr + sizeof(msghd), bytes - sizeof(msghd)); - } - else { - len = bytes; - memcpy(ptr + sizeof(msghd), tmp_buf + sizeof(msghd), bytes - sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len == -1) { - perror("VB fails to recv data"); - exit(1); - } - if (len < bytes) { - fprintf(stderr, "VB warn: recv() len %dB < bytes %dB\n", len, bytes); - } - /* because message header is already PEEKed to msghd before recv(), so we can - use info in msghd instead of *(VideoMessage*)ptr */ - if (len != sizeof(msghd)+msghd.msgSize) - /* some of msg contents not successfully received, abandon current packet */ - { - /* - fprintf(stderr, "VB got corrupted msg, len=%d, supposed len=%d\n", - len, sizeof(msghd)+msghd.msgSize); - */ - break; - } - poffset += msghd.msgSize; - psize -= msghd.msgSize; - ptr += msghd.msgSize; - /* - fprintf(stderr, "VB packet remain size %d\n", psize); - */ - if (psize == 0) - { - /* finished receiving the current packet */ -#ifdef NeedByteOrderConversion - packet->cmd = ntohl(packet->cmd); - packet->cmdsn = ntohl(packet->cmdsn); - packet->sh = ntohl(packet->sh); - packet->gop = ntohl(packet->gop); - packet->frame = ntohl(packet->frame); - packet->display = ntohl(packet->display); - packet->future = ntohl(packet->future); - packet->past = ntohl(packet->past); - packet->currentUPF = ntohl(packet->currentUPF); - packet->dataBytes = ntohl(packet->dataBytes); -#endif - pcmdsn = packet->cmdsn; - pcmd = packet->cmd; - pfid = packet->frame; - pgop = packet->gop; - shared->VBheadFrame = (pcmd == CmdPLAY) ? pfid : pgop; - - shared->currentUPF = packet->currentUPF; - enter_cs(sid); - (*head)->full = 1; - psize = sizeof(**head) + sizeof(*msg) + msghd.packetSize; - psize = ((psize+3)>>2)<<2; - ptr = (char*)*head + psize; - (*head)->next = (struct block *) ptr; - (*head) = (struct block *)ptr; - (*head)->shcode = SHCODE; - leave_cs(countid); - leave_cs(sid); - - /* VB receives all frame except for the INIT one through normalSocket */ - if (dataSocket != normalSocket) { - /* - Fprintf(stderr, "VB got INIT frame.\n"); - */ - write(initSocket, (char *)&initSocket, 1); /* write a garbage byte */ - close(initSocket); - dataSocket = normalSocket; - } - - /* following is synchronization feedback algorithm */ - - if (shared->config.syncEffective) { - if (state > 1 && state != 4 && (len = shared->qosRecomputes) != qosRecomputes) { - /* QoS feedback packet is sent if at any time send pattern is - recomputed, and sync feedback is not in active state*/ - send_feedback(dataSocket, 0, 0, advance); - qosRecomputes = len; - } - switch (state) { - case 4: /* active */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY && shared->usecPerFrame != upf) { - /* jump to state 5 if speed changes */ - state = 5; - break; - } - { - int interval = shared->usecPerFrame; - double val = (double)(pcmd == CmdPLAY ? - pfid - shared->nextFrame : - (pcmd == CmdFF ? - pgop - shared->nextGroup : - shared->nextGroup - pgop)); - fv = DoFilter(f, val); /* get average #frames in the whole client - pipeline, including all stages */ - val = val - fv; - fav = DoFilter(fa, val >= 0.0 ? val : -val); - /* get average #frames jitter in the whole client pipeline */ - - val = fav * interval * 6; - /* convert deviation in frame into microseconds, 6 is a magic number */ - - /* tries to recompute advance (in microseconds), and med/high/low - in adaptation to current jitter level */ - if ((val > advance && !reach_limit) || - (advance > min_advance && val < advance >> 3)) { - advance = (int) max(2 * val, min_advance); - med = advance / interval; - /* - if (pcmd == CmdPLAY) { - if (med < shared->VDframeNumber) { - med = shared->VDframeNumber; - } - } - else - */ - if (med < 2 ) { /* but keep minimum buffer fill level */ - med = 2; - } - if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) { - reach_limit = 1; - med = (VB_BUF_SIZE / shared->averageFrameSize) / 2; - Fprintf(stderr, - "VB VSadvance control: VBbuf limit reached, med %d.\n", med); - } - else reach_limit = 0; - high = med + med / 2; - low = med - med / 2; - period = med * MAX_CLOCK_DRIFT; - Fprintf(stderr, - "VB: VS advance control: fav %5.2f, med %d, advance %d at nextFrame %d\n", - fav, med, advance, shared->nextFrame); - } - } - /* record the current time (fid or gopid) if buffer fill level drift - only very little */ - if ((int)fv == med) { - init_fv = fv; - init_pos = pcmd == CmdPLAY ? pfid : pgop; - break; - } - /* - fprintf(stderr, "VB fb: fv %lf\n", fv); - */ - /* try send action if low/high water mark is passed, or qos recomputed */ - /* There is problem here, the deltas of upf are sent, instead of upf - and frame themself. This scheme is not robust in case case feedback - packets are lost, and get resent */ - len = shared->qosRecomputes; - if (fv >= high || fv <= low || len != qosRecomputes) { - int addupf, addf; - int pos = pcmd == CmdPLAY ? pfid : pgop; - int dist = (int)(pcmd == CmdFB ? init_pos - pos : pos - init_pos); - if (fv >= high || fv <= low) { - if (dist < period) { /* try skip or stall */ - addf = (int)(med - fv); - addupf = 0; - } - else { /* try adjust VS clock rate */ - int added = (int)((double)cupf * (fv - (double)med) / (double) dist); - addf = (int)(med - fv); - addupf = added; - cupf += added; - } - state = 6; - } - else { /* fb only recomputed sendpattern, no state change */ - addupf = 0; - addf = 0; - } - - /* tries to send a feedback packet. */ - if (shared->live) { /* no sync feedback with live video */ - qosRecomputes = len; - } - else if (send_feedback(dataSocket, addupf, addf, advance) == -1) { - /* Keep trying action repeatedly if failed to send the action - packet (by keeping in state 4). - An action packet can also be lost in the network */ - state = 4; - } - else { - qosRecomputes = len; - } - if (state == 6) { /* record the time if an action packet is - successfully send, and indicate that an - feedback action leads to state 6, which after - delay sometime leads to state 3. - The action_delay should have been related - to round-trip time. */ - action_time = get_usec(); - action_delay = shared->usecPerFrame * 100; - not_action = 0; - } - } - break; - case 6: /* reset after action */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY && shared->usecPerFrame != upf) { - state = 5; - break; - } - /* Jump to transition state 3 only after delay for some - time, when feedback action has been taken, and the - effect has been propogated back to the client */ - if (get_duration(action_time, get_usec()) >= action_delay) { - state = 3; - } - break; - case 5: /* reset after speed change, feedback stays in this - state as long as play speed is changing */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - /* Jump to transition state 3, indicating that the transition - is not caused by feedback action */ - if (shared->currentUPF == shared->usecPerFrame) { - not_action = 1; - state = 3; - } - break; - case 2: /* delay after start, this delay is for avoiding feedback - action during server fast start-up. */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY) { - if (pfid - startpos >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - else if (pcmd == CmdFF) { - if (pgop - startpos >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - else { /* CmdFB */ - if (startpos - pgop >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - break; - case 3: /* transient state, entered after start-up delay, - action-delay, or play-speed change */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - /* Initialize both buffer-fill-level and jitter filters */ - if (f == NULL) { - f = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - else { - f = ResetFilter(f, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - if (fa == NULL) { - fa = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - DoFilter(fa, 0.0); - } - else if (not_action) { /* reset jitter level filter only - if entering this state is not - cause by feedback action */ - fa = ResetFilter(fa, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - if (f == NULL || fa == NULL) { - perror("VB failed to allocate space for filters"); - state = 0; - } - else { - init_fv = - DoFilter(f, (double)(pcmd == CmdPLAY ? - pfid - shared->nextFrame : - (pcmd == CmdFF ? - pgop - shared->nextGroup : - shared->nextGroup - pgop))); - init_pos = pcmd == CmdPLAY ? pfid : pgop; - upf = shared->currentUPF; - cupf = upf; - { - int interval = shared->usecPerFrame; - - /* upon speed change, 'advance', in microseconds, will - not change, but med/high/low will be updated. This - may suggest that in the new toolkit version of the - same feedback systems, the buffer-fill level and - jitter is measured directly in microseconds, not in - #frames then converting to microseconds. */ - med = advance / interval; - /* - if (pcmd == CmdPLAY) { - if (med < shared->VDframeNumber) { - med = shared->VDframeNumber; - min_advance = advance = med * interval; - } - } - else - */ - if (med < 2 ) { - med = 2; - advance = med * interval; - min_advance = max(advance, shared->VStimeAdvance); - } - else min_advance = shared->VStimeAdvance; - if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) { - reach_limit = 1; - med = (VB_BUF_SIZE / shared->averageFrameSize) / 2; - if (not_action) { - Fprintf(stderr, - "VB start/speed-change: VBbuf limit reached, med %d.\n", med); - } - } - else reach_limit = 0; - } - high = med + med / 2; - low = med - med / 2; - delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid - feedback when VS is in - fast-start period */ - period = med * MAX_CLOCK_DRIFT; - if (not_action) { - Fprintf(stderr, - "VB start/speed-change: med %d, advance %d at nextFrame %d\n", - med, advance, shared->nextFrame); - } - state = 4; - } - break; - case 0: /* idle */ - if (pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB) { - cmdsn = pcmdsn; - state = 1; - } - break; - case 1: /* start */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - break; - } - startpos = pcmd == CmdPLAY ? pfid : pgop; - advance = shared->VStimeAdvance; - - /* following from vs.c: - timerAdjust = (VStimeAdvance * SPEEDUP_INV_SCALE) / currentUPF; - */ - med = advance / shared->usecPerFrame; - /* - if (pcmd != CmdPLAY) med /= shared->patternSize; - */ - delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid - feedback when VS is in - fast-start period */ - not_action = 1; - state = 2; - break; - default: - fprintf(stderr, "VB: unknown Feedback state %d reached.\n", state); - state = 0; - break; - } - } /* end if (shared->config.syncEffective) */ - else { - state = 0; - } -#ifdef STAT - if (shared->collectStat && packet->cmd != CmdREF) - { - char * val, * val1; - int size; - size = packet->frame; - shared->stat.VBframesReceived[size >>3] |= 1 << (size % 8); - val = (char *)*head; - val1 = (char *)*tail; - if (val >= val1) /* *head >= *tail */ - size = val - val1; - else - size = bufsize - (val1 - val); - shared->stat.VBmaxBytes = max(shared->stat.VBmaxBytes, size); - } -#endif - /* - fprintf(stderr, "VB: Packet(%x, buf:%x)=cmd-%d, cmdsn-%d sh-%d, gop-%d\n", - (int)packet, (int)buf, packet->cmd, packet->cmdsn, packet->sh, packet->gop); - fprintf(stderr, " frame-%d, display-%d, future-%d, past-%d, bytes-%d\n", - packet->frame, packet->display, packet->future, - packet->past, packet->dataBytes); - */ - break; /* got the whole packet, break to the out-most loop for next packet */ - } /* end if (psize == 0) */ - else if (psize < 0) - { - fprintf(stderr, "VB error: received too many msgs for a packet.\n"); - exit(1); - } - - /* try get another message for current packet */ - for (;;) - { - if (conn_tag >= 0) { - len = wait_read_bytes(dataSocket, (char *)&msghd, sizeof(msghd)); - } - else { - len = read(dataSocket, tmp_buf, -conn_tag); - memcpy((char *)&msghd, tmp_buf, sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len <= 0) - { - if (errno == EWOULDBLOCK || errno == EAGAIN) { - perror("VB sleep2 for 10ms"); - usleep(10000); - if (exit_tag) exit_on_kill(); - continue; - } - perror("VB recv data(MSG_PEEK)"); - exit(1); - } - if (len < sizeof(msghd)) { - fprintf(stderr, "VD warn: PEEK1ed %dB < expected %dB\n", - len, sizeof(msghd)); - continue; - } -#ifdef NeedByteOrderConversion - msghd.packetsn = ntohl(msghd.packetsn); - msghd.packetSize = ntohl(msghd.packetSize); - msghd.msgsn = ntohl(msghd.msgsn); - msghd.msgOffset = ntohl(msghd.msgOffset); - msghd.msgSize = ntohl(msghd.msgSize); -#endif - /* - fprintf(stderr, "VB PEEK2 a msg: sn-%d, size-%d, pkt-%d, pktsize-%d\n", - msghd.msgsn, msghd.msgSize, msghd.packetsn, msghd.packetSize); - */ -#ifdef STAT - { - int gap = msghd.msgsn - gap_msgsn; - gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap; - shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++; - if (gap >0) gap_msgsn = msghd.msgsn; - } -#endif - if (msghd.msgsn <= msgsn) { /* outdated message, wait for next one */ - /* - fprintf(stderr, "VB discard outdated or dup msgsn %d, pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - break; /* got a message for current packet */ - } /* end for (;;) */ - - if (msghd.msgsn > msgsn + 1 || msghd.msgOffset == 0) - { - /* message out of order, abandon current packet */ - /* - fprintf(stderr, "VB msg out of order for current packet, discard it.\n"); - */ -#ifdef STAT - to_count = 0; -#endif - goto start_new_packet; - } - else { - msgsn = msghd.msgsn; - } - } - } -} - - -void MyVBprocess(int initSocket, int normalSocket) -{ - VideoMessage * msg, msghd; - VideoPacket * packet; - int len, bsize, msgsn = -1; - int psize, poffset; - char * ptr, *ptr1; - char *tmp_buf = NULL; - int dataSocket = initSocket; - - /* INIT frame is received from CTR through initSocket */ - -#ifdef STAT - int to_count = 1; - int gap_msgsn = -1; -#endif - - /* following variables are for feedback */ - int pcmdsn, pcmd; /* to store the cmdsn and cmd of previous frame, - to detect new commands */ - int pfid, pgop; /* frame-id of gopid of previous frame */ - int cmdsn = -1; /* cmdsn of previous command */ - int state = 0; /* state of the control law/regulator */ - int startpos; /* gopid or frameid when the regulator is in 'start' state 1 */ - int delay; /* #frames to delay after 'start' */ - int qosRecomputes = 0; /* indicate if qos has been recomputed recently */ - int action_delay; /* microseconds to delay after feedback action */ - int action_time; /* the time when feedback action is taken, used to enforce - action_delay */ - int upf, cupf; /* upf -- currentUPF as carried in all frames, - cupf -- real current UPF, being adjusted by FB */ - double fv; /* current buffer fill level in term of #frames */ - double init_fv; /* init_fv and init_pos record the fv value and position - (frameid or gopid) when fv is very close to med */ - double init_pos; - int high, low, med; /* median, high and low water marks, in term of #frames */ - int period; /* interms of #frames, (high-med, period) defined the max - buffer fill drift which can be assumed as caused by - clock drift */ - Filter * f = NULL; /* buffer fill level filter */ - - int advance, min_advance; /* in microseconds, advance holds the - current target buffer-fill-level as - determined by jitter level - estimate. min_advance sets a absolute - minimun level, no matter how low jitter - level is. - 'advance' does not change when - play-speed changes, but med/high/low - will be updated upon speed change */ - double fav; /* #frames, jitter level output by the filter */ - Filter * fa = NULL; /* jitter filter */ - int reach_limit = 0; /* indicate that the target 'advance' has reached client VB - buffer limit, and can not further increase, even if - jitter increases */ - int not_action = 1; /* indicates entering state=3 is not caused by - feedback action. If not_action = 1 entering state=3 - is caused either by 'start' or speed change, and - the jitter filter needs to be reset */ - - exit_tag = 0; - conn_tag = shared->videoMaxPktSize; - - savedSocket = normalSocket; -#if 0 -#ifdef __svr4__ - - /* On solaris 2.x for i86pc, a datagram socket may not discard the - remaining of a message if recv() fails to read the whole - thing. Following systems are tried but seems doesn't work. So for - this platform, This causes problem with skip_message() defined - above, which tries to discard whole packets by reading only a few - bytes. An alternative here is to allocate a big enough buffer, - read and discard the whole packet, this is less efficient because - of more data copy. - - But if we call read(2) instead of recv(), then it works. - */ - if (!conn_tag) { - len = ioctl(dataSocket, I_SRDOPT, RMSGD); /* discard unread part of the message */ - if (len) perror("error message"); - } -#endif -#endif - - setsignal(SIGUSR1, usr1_handler); - setsignal(SIGUSR2, usr2_handler); - - if (conn_tag < 0) { /* buffer big enough for discard mode packet stream */ - tmp_buf = (char *)malloc(-conn_tag); - if (tmp_buf == NULL) { - fprintf(stderr, "AB failed to allocate %d bytes"); - perror("of tmp_buf"); - exit(1); - } - } - - for (;;) - { - // fprintf(stderr, "VB wait for a new packet.\n"); - if (conn_tag >= 0) { - len = wait_read_bytes(dataSocket, (char *)&msghd, sizeof(msghd)); - } - else { /* discard mode packet stream, read all bytes */ - len = read(dataSocket, tmp_buf, -conn_tag); - memcpy((char *)&msghd, tmp_buf, sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len == -1) { - if (errno == EWOULDBLOCK || errno == EAGAIN) { - perror("VB sleep for 10ms"); - usleep(10000); - if (exit_tag) exit_on_kill(); - continue; - } - perror("VB read() data"); - exit(1); - } - if (len == 0) { /* EOF, connection closed by peer */ - fprintf(stderr, "Error: VB found dataSocket broken\n"); - for (;;) { - usleep(1000000); - if (exit_tag) exit_on_kill(); - } - } - if (len < sizeof(msghd)) { - fprintf(stderr, "VD warn: PEEK1ed %dB < expected %dB\n", - len, sizeof(msghd)); - continue; - } -#ifdef NeedByteOrderConversion - msghd.packetsn = ntohl(msghd.packetsn); - msghd.packetSize = ntohl(msghd.packetSize); - msghd.msgsn = ntohl(msghd.msgsn); - msghd.msgOffset = ntohl(msghd.msgOffset); - msghd.msgSize = ntohl(msghd.msgSize); -#endif - /* - fprintf(stderr, "VB PEEK1 a msg sn-%d, size-%d, pkt-%d, pktsize-%d\n", - msghd.msgsn, msghd.msgSize, msghd.packetsn, msghd.packetSize); - */ - - - start_new_packet: - - -#ifdef STAT - if (to_count) { - int gap = msghd.msgsn - gap_msgsn; - gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap; - shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++; - if (gap >0) gap_msgsn = msghd.msgsn; - } - to_count = 1; -#endif - if (msghd.msgsn <= msgsn) /* outdated msg */ - { - /* - fprintf(stderr, "VB discard outdated msgsn %d, pktsn %d when expecting first\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - else if (msghd.msgOffset != 0) /* not first msg of a packet */ - { - /* - Fprintf(stderr, "VB discard non-first msg msgsn %d, pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - else - msgsn = msghd.msgsn; - - /* allocate packet for the incoming msg */ - bsize = msghd.packetSize + sizeof(**head)*2 + sizeof(msghd); - bsize = ((bsize+3)>>2)<<2; - enter_cs(sid); - if (*head >= *tail) - { - if (bufsize - (int)((char*)*head - buf) >= bsize ) - msg =(VideoMessage *)((char*)*head + sizeof(**head)); - else if ((int)((char*)*tail - buf) >= bsize) - { - (*head)->next = (struct block *)buf; - (*head)->full = 0; - *head = (struct block *)buf; - msg = (VideoMessage *)(buf + sizeof(**head)); - *head = (struct block *)buf; - (*head)->shcode = SHCODE; - } - else /* not enough buffer, discard current message */ - { - leave_cs(sid); -#ifdef STAT - if (shared->collectStat) - shared->stat.VBdroppedFrames ++; -#endif - /* - Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - } - else /* *head < *tail */ - if ((char*)*tail - (char*)*head >= bsize) - msg = (VideoMessage *)((char*)*head + sizeof(**head)); - else /* not enough buffer, abandon current message */ - { - leave_cs(sid); -#ifdef STAT - if (shared->collectStat) - shared->stat.VBdroppedFrames ++; -#endif - /* - Fprintf(stderr, "VB not enough space 1, drop msg.sn %d pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - leave_cs(sid); - /* - fprintf(stderr, "VB allocated a buffer for comming packet.\n"); - */ - psize = msghd.packetSize; - poffset = 0; - packet = (VideoPacket *)((char*)msg + sizeof(msghd)); - *(((int*)packet)+(msghd.packetSize>>2)) = 0; - /* clear the last no more than three bytes, for - proper detecting the end of packet by VD */ - ptr = (char*)msg; - for (;;) - { - int bytes; - bytes = sizeof(msghd) + msghd.msgSize; - if (conn_tag >= 0) { - len = bytes; - read_bytes(dataSocket, ptr + sizeof(msghd), bytes - sizeof(msghd)); - } - else { - len = bytes; - memcpy(ptr + sizeof(msghd), tmp_buf + sizeof(msghd), bytes - sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len == -1) { - perror("VB fails to recv data"); - exit(1); - } - if (len < bytes) { - fprintf(stderr, "VB warn: recv() len %dB < bytes %dB\n", len, bytes); - } - /* because message header is already PEEKed to msghd before recv(), so we can - use info in msghd instead of *(VideoMessage*)ptr */ - if (len != sizeof(msghd)+msghd.msgSize) - /* some of msg contents not successfully received, abandon current packet */ - { - /* - fprintf(stderr, "VB got corrupted msg, len=%d, supposed len=%d\n", - len, sizeof(msghd)+msghd.msgSize); - */ - break; - } - poffset += msghd.msgSize; - psize -= msghd.msgSize; - ptr += msghd.msgSize; - /* - fprintf(stderr, "VB packet remain size %d\n", psize); - */ - if (psize == 0) - { - /* finished receiving the current packet */ -#ifdef NeedByteOrderConversion - packet->cmd = ntohl(packet->cmd); - packet->cmdsn = ntohl(packet->cmdsn); - packet->sh = ntohl(packet->sh); - packet->gop = ntohl(packet->gop); - packet->frame = ntohl(packet->frame); - packet->display = ntohl(packet->display); - packet->future = ntohl(packet->future); - packet->past = ntohl(packet->past); - packet->currentUPF = ntohl(packet->currentUPF); - packet->dataBytes = ntohl(packet->dataBytes); -#endif - pcmdsn = packet->cmdsn; - pcmd = packet->cmd; - pfid = packet->frame; - pgop = packet->gop; - shared->VBheadFrame = (pcmd == CmdPLAY) ? pfid : pgop; - - shared->currentUPF = packet->currentUPF; - enter_cs(sid); - (*head)->full = 1; - psize = sizeof(**head) + sizeof(*msg) + msghd.packetSize; - psize = ((psize+3)>>2)<<2; - ptr = (char*)*head + psize; - (*head)->next = (struct block *) ptr; - (*head) = (struct block *)ptr; - (*head)->shcode = SHCODE; - leave_cs(countid); - leave_cs(sid); - - /* VB receives all frame except for the INIT one through normalSocket */ - if (dataSocket != normalSocket) { - /* - Fprintf(stderr, "VB got INIT frame.\n"); - */ - write(initSocket, (char *)&initSocket, 1); /* write a garbage byte */ - close(initSocket); - dataSocket = normalSocket; - } - - /* following is synchronization feedback algorithm */ - - if (shared->config.syncEffective) { - if (state > 1 && state != 4 && (len = shared->qosRecomputes) != qosRecomputes) { - /* QoS feedback packet is sent if at any time send pattern is - recomputed, and sync feedback is not in active state*/ - send_feedback(dataSocket, 0, 0, advance); - qosRecomputes = len; - } - switch (state) { - case 4: /* active */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY && shared->usecPerFrame != upf) { - /* jump to state 5 if speed changes */ - state = 5; - break; - } - { - int interval = shared->usecPerFrame; - double val = (double)(pcmd == CmdPLAY ? - pfid - shared->nextFrame : - (pcmd == CmdFF ? - pgop - shared->nextGroup : - shared->nextGroup - pgop)); - fv = DoFilter(f, val); /* get average #frames in the whole client - pipeline, including all stages */ - val = val - fv; - fav = DoFilter(fa, val >= 0.0 ? val : -val); - /* get average #frames jitter in the whole client pipeline */ - - val = fav * interval * 6; - /* convert deviation in frame into microseconds, 6 is a magic number */ - - /* tries to recompute advance (in microseconds), and med/high/low - in adaptation to current jitter level */ - if ((val > advance && !reach_limit) || - (advance > min_advance && val < advance >> 3)) { - advance = (int) max(2 * val, min_advance); - med = advance / interval; - /* - if (pcmd == CmdPLAY) { - if (med < shared->VDframeNumber) { - med = shared->VDframeNumber; - } - } - else - */ - if (med < 2 ) { /* but keep minimum buffer fill level */ - med = 2; - } - if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) { - reach_limit = 1; - med = (VB_BUF_SIZE / shared->averageFrameSize) / 2; - Fprintf(stderr, - "VB VSadvance control: VBbuf limit reached, med %d.\n", med); - } - else reach_limit = 0; - high = med + med / 2; - low = med - med / 2; - period = med * MAX_CLOCK_DRIFT; - Fprintf(stderr, - "VB: VS advance control: fav %5.2f, med %d, advance %d at nextFrame %d\n", - fav, med, advance, shared->nextFrame); - } - } - /* record the current time (fid or gopid) if buffer fill level drift - only very little */ - if ((int)fv == med) { - init_fv = fv; - init_pos = pcmd == CmdPLAY ? pfid : pgop; - break; - } - /* - fprintf(stderr, "VB fb: fv %lf\n", fv); - */ - /* try send action if low/high water mark is passed, or qos recomputed */ - /* There is problem here, the deltas of upf are sent, instead of upf - and frame themself. This scheme is not robust in case case feedback - packets are lost, and get resent */ - len = shared->qosRecomputes; - if (fv >= high || fv <= low || len != qosRecomputes) { - int addupf, addf; - int pos = pcmd == CmdPLAY ? pfid : pgop; - int dist = (int)(pcmd == CmdFB ? init_pos - pos : pos - init_pos); - if (fv >= high || fv <= low) { - if (dist < period) { /* try skip or stall */ - addf = (int)(med - fv); - addupf = 0; - } - else { /* try adjust VS clock rate */ - int added = (int)((double)cupf * (fv - (double)med) / (double) dist); - addf = (int)(med - fv); - addupf = added; - cupf += added; - } - state = 6; - } - else { /* fb only recomputed sendpattern, no state change */ - addupf = 0; - addf = 0; - } - - /* tries to send a feedback packet. */ - if (shared->live) { /* no sync feedback with live video */ - qosRecomputes = len; - } - else if (send_feedback(dataSocket, addupf, addf, advance) == -1) { - /* Keep trying action repeatedly if failed to send the action - packet (by keeping in state 4). - An action packet can also be lost in the network */ - state = 4; - } - else { - qosRecomputes = len; - } - if (state == 6) { /* record the time if an action packet is - successfully send, and indicate that an - feedback action leads to state 6, which after - delay sometime leads to state 3. - The action_delay should have been related - to round-trip time. */ - action_time = get_usec(); - action_delay = shared->usecPerFrame * 100; - not_action = 0; - } - } - break; - case 6: /* reset after action */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY && shared->usecPerFrame != upf) { - state = 5; - break; - } - /* Jump to transition state 3 only after delay for some - time, when feedback action has been taken, and the - effect has been propogated back to the client */ - if (get_duration(action_time, get_usec()) >= action_delay) { - state = 3; - } - break; - case 5: /* reset after speed change, feedback stays in this - state as long as play speed is changing */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - /* Jump to transition state 3, indicating that the transition - is not caused by feedback action */ - if (shared->currentUPF == shared->usecPerFrame) { - not_action = 1; - state = 3; - } - break; - case 2: /* delay after start, this delay is for avoiding feedback - action during server fast start-up. */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - if (pcmd == CmdPLAY) { - if (pfid - startpos >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - else if (pcmd == CmdFF) { - if (pgop - startpos >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - else { /* CmdFB */ - if (startpos - pgop >= delay) { - advance = shared->VStimeAdvance; - state = 3; - } - } - break; - case 3: /* transient state, entered after start-up delay, - action-delay, or play-speed change */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - else { - state = 1; - } - break; - } - /* Initialize both buffer-fill-level and jitter filters */ - if (f == NULL) { - f = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - else { - f = ResetFilter(f, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - if (fa == NULL) { - fa = NewFilter(FILTER_LOWPASS, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - DoFilter(fa, 0.0); - } - else if (not_action) { /* reset jitter level filter only - if entering this state is not - cause by feedback action */ - fa = ResetFilter(fa, shared->config.filterPara >= 1 ? - shared->config.filterPara : 100); - } - if (f == NULL || fa == NULL) { - perror("VB failed to allocate space for filters"); - state = 0; - } - else { - init_fv = - DoFilter(f, (double)(pcmd == CmdPLAY ? - pfid - shared->nextFrame : - (pcmd == CmdFF ? - pgop - shared->nextGroup : - shared->nextGroup - pgop))); - init_pos = pcmd == CmdPLAY ? pfid : pgop; - upf = shared->currentUPF; - cupf = upf; - { - int interval = shared->usecPerFrame; - - /* upon speed change, 'advance', in microseconds, will - not change, but med/high/low will be updated. This - may suggest that in the new toolkit version of the - same feedback systems, the buffer-fill level and - jitter is measured directly in microseconds, not in - #frames then converting to microseconds. */ - med = advance / interval; - /* - if (pcmd == CmdPLAY) { - if (med < shared->VDframeNumber) { - med = shared->VDframeNumber; - min_advance = advance = med * interval; - } - } - else - */ - if (med < 2 ) { - med = 2; - advance = med * interval; - min_advance = max(advance, shared->VStimeAdvance); - } - else min_advance = shared->VStimeAdvance; - if (med > (VB_BUF_SIZE / shared->averageFrameSize) / 2) { - reach_limit = 1; - med = (VB_BUF_SIZE / shared->averageFrameSize) / 2; - if (not_action) { - Fprintf(stderr, - "VB start/speed-change: VBbuf limit reached, med %d.\n", med); - } - } - else reach_limit = 0; - } - high = med + med / 2; - low = med - med / 2; - delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid - feedback when VS is in - fast-start period */ - period = med * MAX_CLOCK_DRIFT; - if (not_action) { - Fprintf(stderr, - "VB start/speed-change: med %d, advance %d at nextFrame %d\n", - med, advance, shared->nextFrame); - } - state = 4; - } - break; - case 0: /* idle */ - if (pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB) { - cmdsn = pcmdsn; - state = 1; - } - break; - case 1: /* start */ - if (pcmdsn != cmdsn) { - cmdsn = pcmdsn; - if (!(pcmd == CmdPLAY || pcmd == CmdFF || pcmd == CmdFB)) { - state = 0; - } - break; - } - startpos = pcmd == CmdPLAY ? pfid : pgop; - advance = shared->VStimeAdvance; - - /* following from vs.c: - timerAdjust = (VStimeAdvance * SPEEDUP_INV_SCALE) / currentUPF; - */ - med = advance / shared->usecPerFrame; - /* - if (pcmd != CmdPLAY) med /= shared->patternSize; - */ - delay = med * (SPEEDUP_INV_SCALE - 1); /* this delay is to avoid - feedback when VS is in - fast-start period */ - not_action = 1; - state = 2; - break; - default: - fprintf(stderr, "VB: unknown Feedback state %d reached.\n", state); - state = 0; - break; - } - } /* end if (shared->config.syncEffective) */ - else { - state = 0; - } -#ifdef STAT - if (shared->collectStat && packet->cmd != CmdREF) - { - char * val, * val1; - int size; - size = packet->frame; - shared->stat.VBframesReceived[size >>3] |= 1 << (size % 8); - val = (char *)*head; - val1 = (char *)*tail; - if (val >= val1) /* *head >= *tail */ - size = val - val1; - else - size = bufsize - (val1 - val); - shared->stat.VBmaxBytes = max(shared->stat.VBmaxBytes, size); - } -#endif - /* - fprintf(stderr, "VB: Packet(%x, buf:%x)=cmd-%d, cmdsn-%d sh-%d, gop-%d\n", - (int)packet, (int)buf, packet->cmd, packet->cmdsn, packet->sh, packet->gop); - fprintf(stderr, " frame-%d, display-%d, future-%d, past-%d, bytes-%d\n", - packet->frame, packet->display, packet->future, - packet->past, packet->dataBytes); - */ - break; /* got the whole packet, break to the out-most loop for next packet */ - } /* end if (psize == 0) */ - else if (psize < 0) - { - fprintf(stderr, "VB error: received too many msgs for a packet.\n"); - exit(1); - } - - /* try get another message for current packet */ - for (;;) - { - if (conn_tag >= 0) { - len = wait_read_bytes(dataSocket, (char *)&msghd, sizeof(msghd)); - } - else { - len = read(dataSocket, tmp_buf, -conn_tag); - memcpy((char *)&msghd, tmp_buf, sizeof(msghd)); - } - if (exit_tag) exit_on_kill(); - if (len <= 0) - { - if (errno == EWOULDBLOCK || errno == EAGAIN) { - perror("VB sleep2 for 10ms"); - usleep(10000); - if (exit_tag) exit_on_kill(); - continue; - } - perror("VB recv data(MSG_PEEK)"); - exit(1); - } - if (len < sizeof(msghd)) { - fprintf(stderr, "VD warn: PEEK1ed %dB < expected %dB\n", - len, sizeof(msghd)); - continue; - } -#ifdef NeedByteOrderConversion - msghd.packetsn = ntohl(msghd.packetsn); - msghd.packetSize = ntohl(msghd.packetSize); - msghd.msgsn = ntohl(msghd.msgsn); - msghd.msgOffset = ntohl(msghd.msgOffset); - msghd.msgSize = ntohl(msghd.msgSize); -#endif - /* - fprintf(stderr, "VB PEEK2 a msg: sn-%d, size-%d, pkt-%d, pktsize-%d\n", - msghd.msgsn, msghd.msgSize, msghd.packetsn, msghd.packetSize); - */ -#ifdef STAT - { - int gap = msghd.msgsn - gap_msgsn; - gap = (gap >MSGGAP_MAX) ? MSGGAP_MAX : gap < MSGGAP_MIN ? MSGGAP_MIN : gap; - shared->stat.VBmsgGaps[gap - MSGGAP_MIN] ++; - if (gap >0) gap_msgsn = msghd.msgsn; - } -#endif - if (msghd.msgsn <= msgsn) { /* outdated message, wait for next one */ - /* - fprintf(stderr, "VB discard outdated or dup msgsn %d, pktsn %d\n", - msghd.msgsn, msghd.packetsn); - */ - skip_message(dataSocket, &msghd); - continue; - } - break; /* got a message for current packet */ - } /* end for (;;) */ - - if (msghd.msgsn > msgsn + 1 || msghd.msgOffset == 0) - { - /* message out of order, abandon current packet */ - /* - fprintf(stderr, "VB msg out of order for current packet, discard it.\n"); - */ -#ifdef STAT - to_count = 0; -#endif - goto start_new_packet; - } - else { - msgsn = msghd.msgsn; - } - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp deleted file mode 100644 index b1e74191181..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vd.cpp +++ /dev/null @@ -1,929 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include <unistd.h> -#include <stdlib.h> -/* -#include <sys/types.h> -#include <sys/socket.h> -*/ -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> -#include "include/common.h" -#include "newproto.h" -#include "global.h" -#include "dither.h" -#include "video.h" -#include "proto.h" - -#define MAX_VDBLOCK_NUM 8 -#define CQUEUE_SIZE MAX_VDBLOCK_NUM + 2 -#define ESTACK 0 -#define CQUEUE 1 - -static int win_width, win_height; -static int ecountid, ccountid; -static int sid; - -extern VidStream * curVidStream; - -static struct shared_mem_block -{ - int size; - int block_num; - int width, height; - int sptr, qhead, qtail; - FrameBlock *estack[MAX_VDBLOCK_NUM]; - FrameBlock *cqueue[CQUEUE_SIZE]; /* cqueue will never get full */ -} * shm = NULL; - -static void InitDitherEnv(void); -static void DitherFrame(PictImage * pict, FrameBlock * frame); -static void DoDitherImage(unsigned char *l, unsigned char *Cr, unsigned char *Cb, - unsigned char *disp, int h, int w); - -void VDinitBuf(int size) -/* size in bytes */ -{ - shm = (struct shared_mem_block *)creat_shared_mem_id(size, &shared->VDbufId); - shared->VDbufAddr = (char *)shm; - - shm->width = shm->height = 0; - shm->size = size - sizeof(*shm); - sid = creat_semaphore(); - ecountid = creat_semaphore(); - ccountid = creat_semaphore(); - enter_cs(ccountid); - enter_cs(ecountid); -} - -static void put_block(FrameBlock * bptr, int tag) -{ - if (tag == ESTACK) - { - shm->estack[shm->sptr] = bptr; - shm->sptr ++; - if (shm->sptr > MAX_VDBLOCK_NUM) - { - fprintf(stderr, "VD weird error: ESTACK full.\n"); - exit(1); - } - } - else - { - if (shm->qtail == shm->qhead) /* empty queue */ - { - shm->qtail = 0; - shm->qhead = 1; - shm->cqueue[0] = bptr; - } - else - { - int val = CQUEUE_SIZE; - int pos = (shm->qhead - 1 + val) % val; /* pos = shm->qhead - 1 */ - if (shared->cmd == CmdPLAY) - while ((pos + 1) % val != shm->qtail) - { - if (shm->cqueue[pos]->display > bptr->display) - { - shm->cqueue[(pos + 1) % val] = shm->cqueue[pos]; - pos = (pos - 1 + val) % val; /* pos -= 1 */ - } - else - break; - } - shm->cqueue[(pos + 1) % val] = bptr; - shm->qhead = (shm->qhead + 1) % val; - } - } -} - -static FrameBlock * get_block(int tag) -{ - FrameBlock * ptr; - - if (tag == ESTACK) - { - if (shm->sptr <= 0) - { - fprintf(stderr, "VD get_block error: ESTACK empty.\n"); - return NULL; - } - shm->sptr --; - ptr = shm->estack[shm->sptr]; - } - else - { - if (shm->qtail == shm->qhead) - { - fprintf(stderr, "VD get_block error: CQUEUE empty.\n"); - return NULL; - } - ptr = shm->cqueue[shm->qtail]; - shm->qtail = (shm->qtail + 1) % (CQUEUE_SIZE); - } - return ptr; -} - -void VDresizeBuf(int height, int width) -{ - char * ptr = (char*)shm + sizeof(*shm); - int imagesize; - int i; - - enter_cs(sid); - - if (get_semval(ecountid) < 0) { - fprintf(stderr, "Error<weird>: pid %d get (ecountid) = %d < 0\n", - getpid(), get_semval(ecountid)); - exit(1); - } - /* - fprintf(stderr, "VD before resizeBuf(): get_semval(ecountid) = %d\n", - get_semval(ecountid)); - */ - while (get_semval(ecountid) > 0) enter_cs(ecountid); - - shm->width = width; - shm->height = height; - width = ((width+15)>>4) << 4; - height = ((height+15)>>4) << 4; - imagesize = (((height * width)+3)>>2)<<2; - if ((ditherType == Twox2_DITHER) || (ditherType == FULL_COLOR_DITHER)) - imagesize <<= 2; - - shm->block_num = (shm->size)/(sizeof(FrameBlock) + imagesize); - if (shm->block_num > MAX_VDBLOCK_NUM) - shm->block_num = MAX_VDBLOCK_NUM; - - Fprintf(stderr, "VD resizeBuf: got %d(max %d) blocks of size %d.\n", - shm->block_num, - (shm->size)/(sizeof(FrameBlock) + imagesize), - (sizeof(FrameBlock) + imagesize)); - - if (shm->block_num < 3) - { - fprintf(stderr, - "VD error: VDbuf fails to hold at least 3(three) block.\n"); - exit(1); - } - shm->sptr = 0; /* empty stack */ - shm->qhead = shm->qtail = 0; /* empty cqueue */ - for (i=0; i<shm->block_num; i++) - { - put_block((FrameBlock *)ptr, ESTACK); - ((FrameBlock *)ptr)->data = (unsigned char *)(ptr + sizeof(FrameBlock)); - ptr += sizeof(FrameBlock) + imagesize; - leave_cs(ecountid); - } - leave_cs(sid); - - shared->VDframeNumber = shm->block_num; - /* - fprintf(stderr, "VD after resizeBuf(): get_semval(ecountid) = %d\n", - get_semval(ecountid)); - */ -} - -FrameBlock * VDgetBuf(void) /* block version, return with interrupt */ -{ - FrameBlock * ptr; - enter_cs(ecountid); - enter_cs(sid); - ptr = get_block(ESTACK); - if (ptr != NULL) - ptr->refcount = 1; - leave_cs(sid); - if (ptr == NULL) - fprintf(stderr, "VD error: VDgetBuf should not return NULL.\n"); - /* - fprintf(stderr, "pid %d VDgetBuf() %u, ref %d, ecount %d\n", - getpid(), (unsigned)ptr, ptr->refcount, get_semval(ecountid)); - */ - return ptr; -} - -int VDcheckBuf(void) /* non-block check, return True/False */ -{ - if (get_semval(ecountid) > 0) - return 1; - else - return 0; -} - -void VDputMsg(FrameBlock * msgPtr) -{ - enter_cs(sid); - put_block(msgPtr, CQUEUE); - leave_cs(ccountid); - leave_cs(sid); - /* - fprintf(stderr, "pid %d VDputMsg() %u, ref %d, ccount %d\n", - getpid(), (unsigned)msgPtr, msgPtr->refcount, get_semval(ccountid)); - */ -} - -FrameBlock * VDgetMsg(void) /* block version, return with interrupt */ -{ - FrameBlock * ptr; - enter_cs(ccountid); - enter_cs(sid); - ptr = get_block(CQUEUE); - leave_cs(sid); - if (ptr == NULL) - fprintf(stderr, "VD error: VDgetMsg should not return NULL.\n"); - /* - fprintf(stderr, "pid %d VDgetMsg() %u, ref %d, ccount %d\n", - getpid(), (unsigned)ptr, ptr->refcount, get_semval(ccountid)); - */ - return ptr; -} - -int VDcheckMsg(void) /* non-block check, return Number of Msg in buffer */ -{ - return get_semval(ccountid); -} - -int VDbufEmpty(void) -{ - /* - Fprintf(stderr, "VD ecountid %d, shm-block_num %d\n", - get_semval(ecountid), shm->block_num); - */ - return (get_semval(ecountid) == shm->block_num); -} - -FrameBlock * VDpeekMsg(void) -{ - FrameBlock * ptr; - - enter_cs(sid); - - if (shm->qhead == shm->qtail) - ptr = NULL; - else - ptr = shm->cqueue[shm->qtail]; - leave_cs(sid); - /* - if (ptr != NULL) { - fprintf(stderr, "pid %d VDpeekMsg() = %u, ref=%d\n", - getpid(), (unsigned)ptr, ptr->refcount); - } - */ - return ptr; -} - -void VDreferMsg(FrameBlock * msgPtr) -{ - enter_cs(sid); - msgPtr->refcount ++; - leave_cs(sid); - /* - fprintf(stderr, "pid %d VDreferMsg() %u, ccount %d\n", - getpid(), (unsigned)msgPtr, get_semval(ccountid)); - */ -} - -void VDreclaimMsg(FrameBlock * msgPtr) -{ - int ref; - enter_cs(sid); - ref = msgPtr->refcount; - if (msgPtr->refcount <= 1) - { - put_block(msgPtr, ESTACK); - leave_cs(ecountid); - } - else - msgPtr->refcount --; - leave_cs(sid); - /* - fprintf(stderr, "pid %d VDreclaimMsg() %u, ref %d, ecount %d\n", - getpid(), (unsigned)msgPtr, ref, get_semval(ecountid)); - */ - if (ref <= 0) { - Fprintf(stderr, "pid %d VDreclaimMsg() %u WEIRD, :ref %d:, ecount %d\n", - getpid(), (unsigned)msgPtr, ref, get_semval(ecountid)); - } -} - -void VDdeleteBuf(void) -{ - remove_shared_mem((char*)shm); -} - -void VDdeleteSem(void) -{ - remove_semaphore(ecountid); - remove_semaphore(ccountid); - remove_semaphore(sid); -} - -int -get_more_data(unsigned int *buf_start, int max_length, - int *length_ptr, unsigned int **buf_ptr) -{ - fprintf(stderr, - "Fatel error: vd.c get_more_data() should not be called, bufLength = %d.!\n", - *length_ptr); - fprintf(stderr, " **** Please report this bug. ****\n"); - exit(1); - return 0; -} - -static void printPacket(VideoPacket *p) -{ - fprintf(stderr, "VD: Packet(%x)=cmd-%d, cmdsn-%d sh-%d, gop-%d\n", - (int)p, p->cmd, p->cmdsn, p->sh, p->gop); - fprintf(stderr, " frame-%d, display-%d, future-%d, past-%d, bytes-%d\n", - p->frame, p->display, p->future, - p->past, p->dataBytes); -} - -static void usr1_handler(int sig) -{ - fprintf(stderr, "VD void usr1_handler.\n"); -} - -static void usr2_handler(int sig) -{ - fprintf(stderr, "VD void usr2_handler\n"); -} - -void VDprocess(int CTRpid) -{ - FrameBlock * curBlk = NULL; - PictImage * curPict = NULL; - - InitDitherEnv(); - - curVidStream = NewVidStream(); - if (curVidStream == NULL) - { - fprintf(stderr, "VD: unable to allocat curVidStream.\n"); - exit(1); - } - setsignal(SIGUSR1, usr1_handler); - setsignal(SIGUSR2, usr2_handler); - - for(;;) - { - int curcmd, curcmdsn; - int i; - int single_tag; - VideoPacket *p; - - if (curBlk != NULL) { - VDreclaimMsg(curBlk); - curBlk = NULL; - } - p = (VideoPacket*)VBgetMsg(); /* guarranteed to get a Packet */ - /* - printPacket(p); - */ - /* - Fprintf(stderr, "VD: got frame %d\n", p->frame); - */ - curcmd = shared->cmd; - curcmdsn = shared->cmdsn; - if (p->cmdsn != shared->cmdsn || p->cmdsn != curcmdsn) - { - - /* - fprintf(stderr, "VD: frame not for current Cmd, discard it\n"); - - printPacket(p); - */ - VBreclaimMsg((char*)p); - continue; - } - if (curcmd == CmdINIT) - { - /* free/allocate all PictImages, resize VDbuffer */ - curVidStream->future = curVidStream->past = curVidStream->current = NULL; - win_width = ((shared->horizontalSize + 15)>>4)<<4; - win_height = ((shared->verticalSize + 15)>>4)<<4; - for (i = 0; i < RING_BUF_SIZE; i++) - { - if (curVidStream->ring[i] != NULL) - DestroyPictImage(curVidStream->ring[i]); - curVidStream->ring[i] = - NewPictImage(win_width, win_height); - } - for (i = 0; i < 500; i ++) { - if (!VDbufEmpty()) usleep(1000); - else break; - } - if (!VDbufEmpty()) { - fprintf(stderr, "VD error<weired>: VDbuf can't become empty.\n"); - exit(1); - } - VDresizeBuf(shared->verticalSize, shared->horizontalSize); - } - else if (curcmd == CmdPLAY || curcmd == CmdSTEP) - { - /* to check if the packet can be decoded or not */ - if (p->future == -1) - { /* swap because the existing VD decoding algorithm refer to 'future' frame - to decode a P frame */ - int tmp = p->past; - p->past = p->future; - /* following is the bug found on 2-14-96, this may be the cause of decoding - P frames incorrectly, and showing corrupted messages, when previous I/P - frames are dropped. This happens frequently when the server is a remote one. - - p->future = p->past; - - */ - p->future = tmp; - - } - if ((p->future >= 0 && - (curVidStream->future == NULL || curVidStream->future->frame != p->future)) || - (p->past >= 0 && - (curVidStream->past == NULL || curVidStream->past->frame != p->past))) - { - /* - fprintf(stderr, - "VD: unable to decode packet -- future and/or past frame no available.\n"); - printPacket(p); - */ - if (curcmd == CmdSTEP && curcmdsn == shared->cmdsn) { - /* - Fprintf(stderr, "VD failed to decode f%d, USR1 to CTR for STEP\n", p->frame); - */ - kill(getppid(), SIGUSR1); /* notify CTR anyway if STEP */ - } -#ifdef STAT - else if (shared->collectStat && curcmd == CmdPLAY) - shared->stat.VDnoRef ++; -#endif - VBreclaimMsg((char*)p); - continue; - } - } - curBlk = VDgetBuf(); - - single_tag = 0; - /* to check if it's in time for PLAY, FF and FB */ - if (curcmd == CmdPLAY) - { - -#if 0 - /* checking against sendPattern seems irreasonable, because send-pattern of a less - frame-rate is not necessarily a subset of the one of a bigger frame-rate. - */ - /* check against sendPattern */ - if (p->frame - shared->firstGopFrames > 0) - { - int i = (p->frame - shared->firstGopFrames) % - (shared->patternSize * shared->sendPatternGops); - if (shared->sendPattern[i] == 0) - { - VBreclaimMsg((char*)p); -#ifdef STAT - if (shared->collectStat) - shared->stat.VDagainstSendPattern ++; -#endif - continue; - } - } -#endif - - if (VBcheckMsg() > 0) { /* a frame is to be dropped only if - there are more frames in VB */ - if (p->past >= 0) { /* 'B' */ - if (p->display <= shared->nextFrame) { -#ifdef STAT - if (shared->collectStat) - shared->stat.VDtooLateB ++; -#endif - goto frameTooLate; - } - } - else if (p->future >= 0) { /* 'P' */ - if (shared->lastIframeDecoded + shared->IframeGap <= shared->nextFrame) { -#ifdef STAT - if (shared->collectStat) - shared->stat.VDtooLateP ++; -#endif - goto frameTooLate; - } - } - else { /* 'I' */ - if (!shared->live) - { - if (p->display + shared->IframeGap <= shared->nextFrame) { -#ifdef STAT - if (shared->collectStat) - shared->stat.VDtooLateI ++; -#endif - frameTooLate: - if (shared->rtplay) /* too late, drop the frame */ - { - VBreclaimMsg((char*)p); - /* - Fprintf(stderr, "VD: frame %d too late, shared->nextFrame %d.\n", - p->frame, shared->nextFrame); - */ - continue; - } - } - } - else { /* live video */ - if (p->display < shared->nextFrame) { - VBreclaimMsg((char*)p); - /* - Fprintf(stderr, "VD live video frame %d too late, nextFrame=%d\n", - p->frame, shared->nextFrame); - */ - continue; - } - } - } - } - } - else if (curcmd == CmdFF) - { - if (p->gop < shared->nextGroup && VDcheckMsg() > 0) - { - /* - fprintf(stderr, "VD: a frame too late and dropped when FF.\n"); - printPacket(p); - */ - VBreclaimMsg((char*)p); - continue; - } - } - else if (curcmd == CmdFB) - { - if (p->gop > shared->nextGroup && VDcheckMsg() > 0) - { - /* - fprintf(stderr, "VD: a frame too late and dropped when FB.\n"); - printPacket(p); - */ - VBreclaimMsg((char*)p); - continue; - } - } - else - single_tag = 1; - - if (shared->videoFormat == VIDEO_JPEG || shared->videoFormat == VIDEO_SIF) { - int picsize = win_width * win_height; - unsigned char * l, *cr, *cb; - - if (shared->videoFormat == VIDEO_SIF) { - l = (unsigned char*)p + sizeof(*p); - cr = l + picsize; - cb = l + picsize + (picsize >> 2); - } - else { /* decode the JPEG frame */ - l = cr = cb = (unsigned char *)curBlk->data; - memcpy(l, (unsigned char*)p + sizeof(*p), p->dataBytes); - } - DoDitherImage(l, cr, cb, - (unsigned char *)curBlk->data, win_height, win_width); - curBlk->sh = p->sh; - curBlk->gop = p->gop; - curBlk->frame = p->frame; - curBlk->display = p->display; - curBlk->future = p->future; - curBlk->past = p->past; - VDputMsg(curBlk); - curBlk = NULL; - /* - Fprintf(stderr, "VD: SIF frame %d decoded.\n", p->frame); - */ - goto end_decode_loop; - } -#ifdef NeedByteOrderConversion - else { - unsigned int * ptr = (unsigned int *)((char*)p + sizeof(*p)); - /* the added two extra words to max_buf_length: one is for SHCODE, already - in right byte order, the second is for prevent calling of get_more_data(). - (which seem required for the UCB decoder used here ), this second word - contains value used by VB algorithm, and can't be changed elsewhere. - So they should not be swapped byte order. */ - for (i=0; i<((p->dataBytes + 11)>>2) - 2; i++) - { - *ptr = ntohl(*ptr); - ptr++; - } - } -#endif - - if (!mpegVidRsrc((char*)p)) /* successfully decoded */ - { - curPict = curVidStream->current; - /* - fprintf(stderr, "VD successfully decodes a frame.\n"); - printPacket(p); - */ - if (curcmd == CmdPLAY && shared->rtplay) - { - if ((curVidStream->picture.code_type == I_TYPE) || - (curVidStream->picture.code_type == P_TYPE)) - { - if (curVidStream->future == NULL) - { - curVidStream->future = curVidStream->current; - curVidStream->future->locked |= FUTURE_LOCK; - } - else - { - if (curVidStream->past != NULL) - { - curVidStream->past->locked &= ~PAST_LOCK; - } - else if (curcmd == CmdPLAY) { - /* this case should happen only at the begining of PLAY */ - DitherFrame(curVidStream->future, VDgetBuf()); - } - curVidStream->past = curVidStream->future; - curVidStream->past->locked &= ~FUTURE_LOCK; - curVidStream->past->locked |= PAST_LOCK; - curVidStream->future = curVidStream->current; - curVidStream->future->locked |= FUTURE_LOCK; - } - } - } - else if (curcmd == CmdSTEP || curcmd == CmdPLAY) /* !shared->rtplay */ - { - if ((curVidStream->picture.code_type == I_TYPE) || - (curVidStream->picture.code_type == P_TYPE)) - { - if (curVidStream->future == NULL) - { - curVidStream->future = curVidStream->current; - curVidStream->future->locked |= FUTURE_LOCK; - } - else - { - if (curVidStream->past != NULL) - { - curVidStream->past->locked &= ~PAST_LOCK; - } - curVidStream->past = curVidStream->future; - curVidStream->past->locked &= ~FUTURE_LOCK; - curVidStream->past->locked |= PAST_LOCK; - curVidStream->future = curVidStream->current; - curVidStream->future->locked |= FUTURE_LOCK; - curPict = curVidStream->past; - } - } - } - else /* only I-frame for all other Cmds */ - { - if (curVidStream->future != NULL) { - curVidStream->future->locked &= ~FUTURE_LOCK; - curVidStream->future = NULL; - } - if (curVidStream->past != NULL) - { - curVidStream->past->locked &= ~PAST_LOCK; - curVidStream->past = NULL; - } - /* - curVidStream->future = curVidStream->current; - curVidStream->future->locked |= FUTURE_LOCK; - */ - } - - if (p->past == -1 && p->future == -1) - shared->lastIframeDecoded = p->frame; - -#ifdef STAT - if (shared->collectStat && p->cmd != CmdREF) - { - int val = curPict->frame; - shared->stat.VDframesDecoded[val>>3] |= 1 << (val % 8); - shared->stat.VDlastFrameDecoded = val; - } -#endif - /* - if (single_tag && p->cmd != CmdREF) - { - fprintf(stderr, "VD: display %d for single.\n", curPict->display); - } - */ - /* - Fprintf(stderr, "p->cmd %d, p->cmdsn %d, shared->cmdsn %d\n", - p->cmd, p->cmdsn, shared->cmdsn); - */ - if (p->cmd != CmdREF && curcmdsn == shared->cmdsn) { - DitherFrame(curPict, curBlk); - curBlk = NULL; - } - } - else /* decoding failed */ - { - /* - fprintf(stderr, "VD error -- tried but failed decoding the packet.\n"); - printPacket(p); - */ - } - - end_decode_loop: - - /* signal CTR for singlular operation: STEP, POSITION, INIT */ - if (single_tag && p->cmd != CmdREF && curcmdsn == shared->cmdsn) - { - /* - Fprintf(stderr, "VD decoded f%d, USR1 to CTR\n", p->frame); - */ - kill(getppid(), SIGUSR1); - } - VBreclaimMsg((char*)p); - } -} - - -static void InitDitherEnv(void) -{ - lum_values = (int *) malloc(LUM_RANGE*sizeof(int)); - cr_values = (int *) malloc(CR_RANGE*sizeof(int)); - cb_values = (int *) malloc(CB_RANGE*sizeof(int)); - init_tables(); - - while (!shared->pixelValid) { - usleep(10000); - } - memcpy(pixel, shared->pixel, 256); - - switch (ditherType) { - - case HYBRID_DITHER: - - InitColor(); - InitHybridDither(); - break; - - case HYBRID2_DITHER: - InitColor(); - InitHybridErrorDither(); - break; - - case FS4_DITHER: - InitColor(); - InitFS4Dither(); - break; - - case FS2_DITHER: - InitColor(); - InitFS2Dither(); - break; - - case FS2FAST_DITHER: - InitColor(); - InitFS2FastDither(); - break; - - case Twox2_DITHER: - InitColor(); - Init2x2Dither(); - PostInit2x2Dither(); - break; - - case GRAY_DITHER: - break; - - case FULL_COLOR_DITHER: - InitColorDither(); - break; - - case ORDERED_DITHER: - InitColor(); - InitOrderedDither(); - break; - - case MONO_DITHER: - case MONO_THRESHOLD: - break; - - case ORDERED2_DITHER: - InitColor(); - InitOrdered2Dither(); - break; - } -} - -/* - *-------------------------------------------------------------- - * - * DoDitherImage -- - * - * Called when image needs to be dithered. Selects correct - * dither routine based on info in ditherType. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void DoDitherImage(unsigned char *l, unsigned char *Cr, unsigned char *Cb, - unsigned char *disp, int h, int w) -{ - - switch(ditherType) { - case HYBRID_DITHER: - HybridDitherImage(l, Cr, Cb, disp, h, w); - break; - - case HYBRID2_DITHER: - HybridErrorDitherImage(l, Cr, Cb, disp, h, w); - break; - - case FS2FAST_DITHER: - FS2FastDitherImage(l, Cr, Cb, disp, h, w); - break; - - case FS2_DITHER: - FS2DitherImage(l, Cr, Cb, disp, h, w); - break; - - case FS4_DITHER: - FS4DitherImage(l, Cr, Cb, disp, h, w); - break; - - case Twox2_DITHER: - Twox2DitherImage(l, Cr, Cb, disp, h, w); - break; - - case FULL_COLOR_DITHER: - ColorDitherImage(l, Cr, Cb, disp, h, w); - break; - - case GRAY_DITHER: - GrayDitherImage(l, Cr, Cb, disp, h, w); - break; - - case NO_DITHER: - break; - - case ORDERED_DITHER: - OrderedDitherImage(l, Cr, Cb, disp, h, w); - break; - - case MONO_DITHER: - MonoDitherImage(l, Cr, Cb, disp, h, w); - break; - - case MONO_THRESHOLD: - MonoThresholdImage(l, Cr, Cb, disp, h, w); - break; - - case ORDERED2_DITHER: - Ordered2DitherImage(l, Cr, Cb, disp, h, w); - break; - - case MBORDERED_DITHER: - MBOrderedDitherImage(l, Cr, Cb, disp, h, w); - break; - } -} - -static void DitherFrame(PictImage * pict, FrameBlock *frame) -{ - DoDitherImage((unsigned char *)pict->luminance, - (unsigned char *)pict->Cr, (unsigned char *)pict->Cb, - (unsigned char *)frame->data, win_height, win_width); - frame->sh = pict->sh; - frame->gop = pict->gop; - frame->frame = pict->frame; - frame->display = pict->display; - frame->future = pict->future; - frame->past = pict->past; - VDputMsg(frame); -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp deleted file mode 100644 index 06549db8205..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.cpp +++ /dev/null @@ -1,3756 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* This file contains C code that implements - * the video decoder model. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> - -#ifndef MIPS -#include <sys/time.h> -#else -#include <sys/types.h> -#include <sys/system.h> -#endif - -#include "include/common.h" -#include "decoders.h" -#include "video.h" -#include "util.h" -#include "proto.h" -#include "global.h" -#include "ui.h" - -/* Declarations of functions. */ -static void ReconIMBlock(VidStream *vid_stream, int bnum); -static void ReconPMBlock(VidStream *vid_stream, int bnum, - int recon_right_for, int recon_down_for, int zflag); -static void ReconBMBlock(VidStream *vid_stream, - int bnum, int recon_right_back, - int recon_down_back, int zflag); -static void ReconBiMBlock(VidStream *vid_stream, int bnum, int recon_right_for, - int recon_down_for, int recon_right_back, - int recon_down_back, int zflag); -static void ReconSkippedBlock(unsigned char *source, unsigned char *dest, - int row, int col, int row_size, int right, int down, - int right_half, int down_half, int width); -static int ParseSeqHead(VidStream *vid_stream); -static int ParseGOP(VidStream *vid_stream); -static int ParsePicture(VidStream *vid_stream,TimeStamp time_stamp); -static int ParseSlice(VidStream *vid_stream); -static int ParseMacroBlock(VidStream *vid_stream); -static void ProcessSkippedPFrameMBlocks(VidStream *vid_stream); -static void ProcessSkippedBFrameMBlocks(VidStream *vid_stream); - -extern int ditherType; -char *ditherFlags; - -/* Macro for returning 1 if num is positive, -1 if negative, 0 if 0. */ - -#define Sign(num) ((num > 0) ? 1 : ((num == 0) ? 0 : -1)) - -/* Declare global pointer to vid stream used for current decoding. */ - -VidStream *curVidStream = NULL; - -/* Set up array for fast conversion from zig zag order to row/column - coordinates. -*/ - -int zigzag[64][2] = { - 0, 0, 1, 0, 0, 1, 0, 2, 1, 1, 2, 0, 3, 0, 2, 1, 1, 2, 0, 3, 0, 4, 1, 3, - 2, 2, 3, 1, 4, 0, 5, 0, 4, 1, 3, 2, 2, 3, 1, 4, 0, 5, 0, 6, 1, 5, 2, 4, - 3, 3, 4, 2, 5, 1, 6, 0, 7, 0, 6, 1, 5, 2, 4, 3, 3, 4, 2, 5, 1, 6, 0, 7, - 1, 7, 2, 6, 3, 5, 4, 4, 5, 3, 6, 2, 7, 1, 7, 2, 6, 3, 5, 4, 4, 5, 3, 6, - 2, 7, 3, 7, 4, 6, 5, 5, 6, 4, 7, 3, 7, 4, 6, 5, 5, 6, 4, 7, 5, 7, 6, 6, -7, 5, 7, 6, 6, 7, 7, 7}; -/* Array mapping zigzag to array pointer offset. */ - -int zigzag_direct[64] = { - 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, - 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, - 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, -58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63}; -/* Set up array for fast conversion from row/column coordinates to - zig zag order. -*/ - -int scan[8][8] = { - {0, 1, 5, 6, 14, 15, 27, 28}, - {2, 4, 7, 13, 16, 26, 29, 42}, - {3, 8, 12, 17, 25, 30, 41, 43}, - {9, 11, 18, 24, 31, 40, 44, 53}, - {10, 19, 23, 32, 39, 45, 52, 54}, - {20, 22, 33, 38, 46, 51, 55, 60}, - {21, 34, 37, 47, 50, 56, 59, 61}, -{35, 36, 48, 49, 57, 58, 62, 63}}; -/* Initialize P and B skip flags. */ - -static int No_P_Flag = 0; -static int No_B_Flag = 0; - -/* Max lum, chrom indices for illegal block checking. */ - -static int lmaxx; -static int lmaxy; -static int cmaxx; -static int cmaxy; - -/* - * We use a lookup table to make sure values stay in the 0..255 range. - * Since this is cropping (ie, x = (x < 0)?0:(x>255)?255:x; ), wee call this - * table the "crop table". - * MAX_NEG_CROP is the maximum neg/pos value we can handle. - */ - -#define MAX_NEG_CROP 384 -#define NUM_CROP_ENTRIES (256+2*MAX_NEG_CROP) -#define assertCrop(x) assert(((x) >= -MAX_NEG_CROP) && \ - ((x) <= 256+MAX_NEG_CROP)) -static unsigned char cropTbl[NUM_CROP_ENTRIES]; - -/* - The following accounts for time and size spent in various parsing acitivites - if ANALYSIS has been defined. -*/ - -#ifdef ANALYSIS - - -unsigned int bitCount = 0; - -int showmb_flag = 0; -int showEachFlag = 0; - -typedef struct { - int frametype; - unsigned int totsize; - unsigned int number; - unsigned int i_mbsize; - unsigned int p_mbsize; - unsigned int b_mbsize; - unsigned int bi_mbsize; - unsigned int i_mbnum; - unsigned int p_mbnum; - unsigned int b_mbnum; - unsigned int bi_mbnum; - unsigned int i_mbcbp[64]; - unsigned int p_mbcbp[64]; - unsigned int b_mbcbp[64]; - unsigned int bi_mbcbp[64]; - unsigned int i_mbcoeff[64]; - unsigned int p_mbcoeff[64]; - unsigned int b_mbcoeff[64]; - unsigned int bi_mbcoeff[64]; - double tottime; -} Statval; - -Statval stat_a[4]; -unsigned int pictureSizeCount; -unsigned int mbSizeCount; -unsigned int *mbCBPPtr, *mbCoeffPtr, *mbSizePtr; -unsigned int cacheHit[8][8]; -unsigned int cacheMiss[8][8]; - -static void -init_stat_struct(astat) - Statval *astat; -{ - int j; - - astat->frametype = 0; - astat->totsize = 0; - astat->number = 0; - astat->i_mbsize = 0; - astat->p_mbsize = 0; - astat->b_mbsize = 0; - astat->bi_mbsize = 0; - astat->i_mbnum = 0; - astat->p_mbnum = 0; - astat->b_mbnum = 0; - astat->bi_mbnum = 0; - - for (j = 0; j < 64; j++) { - - astat->i_mbcbp[j] = 0; - astat->p_mbcbp[j] = 0; - astat->b_mbcbp[j] = 0; - astat->bi_mbcbp[j] = 0; - astat->i_mbcoeff[j] = 0; - astat->p_mbcoeff[j] = 0; - astat->b_mbcoeff[j] = 0; - astat->bi_mbcoeff[j] = 0; - } - astat->tottime = 0.0; -} - -void -init_stats() -{ - int i, j; - - for (i = 0; i < 4; i++) { - init_stat_struct(&(stat_a[i])); - stat_a[i].frametype = i; - } - - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - cacheHit[i][j] = 0; - cacheMiss[i][j] = 0; - } - } - - bitCount = 0; -} - -static void -PrintOneStat() -{ - int i; - - printf("\n"); - switch (stat_a[0].frametype) { - case I_TYPE: - printf("I FRAME\n"); - break; - case P_TYPE: - printf("P FRAME\n"); - break; - case B_TYPE: - printf("B FRAME\n"); - break; - } - - printf("Size: %d bytes + %d bits\n", stat_a[0].totsize / 8, stat_a[0].totsize % 8); - if (stat_a[0].i_mbnum > 0) { - printf("\tI Macro Block Stats:\n"); - printf("\t%d I Macroblocks\n", stat_a[0].i_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[0].i_mbsize / (8 * stat_a[0].i_mbnum), - (stat_a[0].i_mbsize * stat_a[0].i_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcbp[i], - stat_a[0].i_mbcbp[i + 1], stat_a[0].i_mbcbp[i + 2], stat_a[0].i_mbcbp[i + 3], - stat_a[0].i_mbcbp[i + 4], stat_a[0].i_mbcbp[i + 5], stat_a[0].i_mbcbp[i + 6], - stat_a[0].i_mbcbp[i + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].i_mbcoeff[i], - stat_a[0].i_mbcoeff[i + 1], stat_a[0].i_mbcoeff[i + 2], - stat_a[0].i_mbcoeff[i + 3], stat_a[0].i_mbcoeff[i + 4], - stat_a[0].i_mbcoeff[i + 5], stat_a[0].i_mbcoeff[i + 6], - stat_a[0].i_mbcoeff[i + 7]); - } - } - if (stat_a[0].p_mbnum > 0) { - printf("\tP Macro Block Stats:\n"); - printf("\t%d P Macroblocks\n", stat_a[0].p_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[0].p_mbsize / (8 * stat_a[0].p_mbnum), - (stat_a[0].p_mbsize / stat_a[0].p_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcbp[i], - stat_a[0].p_mbcbp[i + 1], stat_a[0].p_mbcbp[i + 2], stat_a[0].p_mbcbp[i + 3], - stat_a[0].p_mbcbp[i + 4], stat_a[0].p_mbcbp[i + 5], stat_a[0].p_mbcbp[i + 6], - stat_a[0].p_mbcbp[i + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].p_mbcoeff[i], - stat_a[0].p_mbcoeff[i + 1], stat_a[0].p_mbcoeff[i + 2], - stat_a[0].p_mbcoeff[i + 3], stat_a[0].p_mbcoeff[i + 4], - stat_a[0].p_mbcoeff[i + 5], stat_a[0].p_mbcoeff[i + 6], - stat_a[0].p_mbcoeff[i + 7]); - } - } - if (stat_a[0].b_mbnum > 0) { - printf("\tB Macro Block Stats:\n"); - printf("\t%d B Macroblocks\n", stat_a[0].b_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[0].b_mbsize / (8 * stat_a[0].b_mbnum), - (stat_a[0].b_mbsize / stat_a[0].b_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcbp[i], - stat_a[0].b_mbcbp[i + 1], stat_a[0].b_mbcbp[i + 2], stat_a[0].b_mbcbp[i + 3], - stat_a[0].b_mbcbp[i + 4], stat_a[0].b_mbcbp[i + 5], stat_a[0].b_mbcbp[i + 6], - stat_a[0].b_mbcbp[i + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].b_mbcoeff[i], - stat_a[0].b_mbcoeff[i + 1], stat_a[0].b_mbcoeff[i + 2], - stat_a[0].b_mbcoeff[i + 3], stat_a[0].b_mbcoeff[i + 4], - stat_a[0].b_mbcoeff[i + 5], stat_a[0].b_mbcoeff[i + 6], - stat_a[0].b_mbcoeff[i + 7]); - } - } - if (stat_a[0].bi_mbnum > 0) { - printf("\tBi Macro Block Stats:\n"); - printf("\t%d Bi Macroblocks\n", stat_a[0].bi_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[0].bi_mbsize / (8 * stat_a[0].bi_mbnum), - (stat_a[0].bi_mbsize * stat_a[0].bi_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcbp[i], - stat_a[0].bi_mbcbp[i + 1], stat_a[0].bi_mbcbp[i + 2], stat_a[0].bi_mbcbp[i + 3], - stat_a[0].bi_mbcbp[i + 4], stat_a[0].bi_mbcbp[i + 5], stat_a[0].bi_mbcbp[i + 6], - stat_a[0].bi_mbcbp[i + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (i = 0; i < 64; i += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[0].bi_mbcoeff[i], - stat_a[0].bi_mbcoeff[i + 1], stat_a[0].bi_mbcoeff[i + 2], - stat_a[0].bi_mbcoeff[i + 3], stat_a[0].bi_mbcoeff[i + 4], - stat_a[0].bi_mbcoeff[i + 5], stat_a[0].bi_mbcoeff[i + 6], - stat_a[0].bi_mbcoeff[i + 7]); - } - } - printf("\nTime to Decode: %g secs.\n", stat_a[0].tottime); - printf("****************\n"); -} - -void -PrintAllStats() -{ - int i, j; - unsigned int supertot, supernum; - double supertime; - - printf("\n"); - printf("General Info: \n"); - printf("Width: %d\nHeight: %d\n", curVidStream->mb_width * 16, curVidStream->mb_height * 16); - - for (i = 1; i < 4; i++) { - - if (stat_a[i].number == 0) - continue; - - switch (i) { - case 1: - printf("I FRAMES\n"); - break; - case 2: - printf("P FRAMES\n"); - break; - case 3: - printf("B FRAMES\n"); - break; - } - - printf("Number: %d\n", stat_a[i].number); - printf("Avg. Size: %d bytes + %d bits\n", - stat_a[i].totsize / (8 * stat_a[i].number), (stat_a[i].totsize / stat_a[i].number) % 8); - if (stat_a[i].i_mbnum > 0) { - printf("\tI Macro Block Stats:\n"); - printf("\t%d I Macroblocks\n", stat_a[i].i_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[i].i_mbsize / (8 * stat_a[i].i_mbnum), - (stat_a[i].i_mbsize / stat_a[i].i_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcbp[j], - stat_a[i].i_mbcbp[j + 1], stat_a[i].i_mbcbp[j + 2], stat_a[i].i_mbcbp[j + 3], - stat_a[i].i_mbcbp[j + 4], stat_a[i].i_mbcbp[j + 5], stat_a[i].i_mbcbp[j + 6], - stat_a[i].i_mbcbp[j + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].i_mbcoeff[j], - stat_a[i].i_mbcoeff[j + 1], stat_a[i].i_mbcoeff[j + 2], - stat_a[i].i_mbcoeff[j + 3], stat_a[i].i_mbcoeff[j + 4], - stat_a[i].i_mbcoeff[j + 5], stat_a[i].i_mbcoeff[j + 6], - stat_a[i].i_mbcoeff[j + 7]); - } - } - if (stat_a[i].p_mbnum > 0) { - printf("\tP Macro Block Stats:\n"); - printf("\t%d P Macroblocks\n", stat_a[i].p_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[i].p_mbsize / (8 * stat_a[i].p_mbnum), - (stat_a[i].p_mbsize / stat_a[i].p_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcbp[j], - stat_a[i].p_mbcbp[j + 1], stat_a[i].p_mbcbp[j + 2], stat_a[i].p_mbcbp[j + 3], - stat_a[i].p_mbcbp[j + 4], stat_a[i].p_mbcbp[j + 5], stat_a[i].p_mbcbp[j + 6], - stat_a[i].p_mbcbp[j + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].p_mbcoeff[j], - stat_a[i].p_mbcoeff[j + 1], stat_a[i].p_mbcoeff[j + 2], - stat_a[i].p_mbcoeff[j + 3], stat_a[i].p_mbcoeff[j + 4], - stat_a[i].p_mbcoeff[j + 5], stat_a[i].p_mbcoeff[j + 6], - stat_a[i].p_mbcoeff[j + 7]); - } - } - if (stat_a[i].b_mbnum > 0) { - printf("\tB Macro Block Stats:\n"); - printf("\t%d B Macroblocks\n", stat_a[i].b_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[i].b_mbsize / (8 * stat_a[i].b_mbnum), - (stat_a[i].b_mbsize * stat_a[i].b_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcbp[j], - stat_a[i].b_mbcbp[j + 1], stat_a[i].b_mbcbp[j + 2], stat_a[i].b_mbcbp[j + 3], - stat_a[i].b_mbcbp[j + 4], stat_a[i].b_mbcbp[j + 5], stat_a[i].b_mbcbp[j + 6], - stat_a[i].b_mbcbp[j + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].b_mbcoeff[j], - stat_a[i].b_mbcoeff[j + 1], stat_a[i].b_mbcoeff[j + 2], - stat_a[i].b_mbcoeff[j + 3], stat_a[i].b_mbcoeff[j + 4], - stat_a[i].b_mbcoeff[j + 5], stat_a[i].b_mbcoeff[j + 6], - stat_a[i].b_mbcoeff[j + 7]); - } - } - if (stat_a[i].bi_mbnum > 0) { - printf("\tBi Macro Block Stats:\n"); - printf("\t%d Bi Macroblocks\n", stat_a[i].bi_mbnum); - printf("\tAvg. Size: %d bytes + %d bits\n", - stat_a[i].bi_mbsize / (8 * stat_a[i].bi_mbnum), - (stat_a[i].bi_mbsize * stat_a[i].bi_mbnum) % 8); - printf("\t\tCoded Block Pattern Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcbp[j], - stat_a[i].bi_mbcbp[j + 1], stat_a[i].bi_mbcbp[j + 2], stat_a[i].bi_mbcbp[j + 3], - stat_a[i].bi_mbcbp[j + 4], stat_a[i].bi_mbcbp[j + 5], stat_a[i].bi_mbcbp[j + 6], - stat_a[i].bi_mbcbp[j + 7]); - } - printf("\n\t\tNumber of Coefficients/Block Histogram:\n"); - for (j = 0; j < 64; j += 8) { - printf("\t%.6d %.6d %.6d %.6d %.6d %.6d %.6d %.6d\n", stat_a[i].bi_mbcoeff[j], - stat_a[i].bi_mbcoeff[j + 1], stat_a[i].bi_mbcoeff[j + 2], - stat_a[i].bi_mbcoeff[j + 3], stat_a[i].bi_mbcoeff[j + 4], - stat_a[i].bi_mbcoeff[j + 5], stat_a[i].bi_mbcoeff[j + 6], - stat_a[i].bi_mbcoeff[j + 7]); - } - } - printf("\nAvg. Time to Decode: %f secs.\n", - (stat_a[i].tottime / ((double) stat_a[i].number))); - printf("\n"); - printf("*************************\n\n"); - } - - supertot = stat_a[1].totsize + stat_a[2].totsize + stat_a[3].totsize; - supernum = stat_a[1].number + stat_a[2].number + stat_a[3].number; - supertime = stat_a[1].tottime + stat_a[2].tottime + stat_a[3].tottime; - - printf("Total Number of Frames: %d\n", supernum); - printf("Avg Frame Size: %d bytes %d bits\n", - supertot / (8 * supernum), (supertot / supernum) % 8); - printf("Total Time Decoding: %g secs.\n", supertime); - printf("Avg Decoding Time/Frame: %g secs.\n", supertime / ((double) supernum)); - printf("Avg Decoding Frames/Sec: %g secs.\n", ((double) supernum) / supertime); - printf("\n"); - - printf("Cache Hits/Miss\n"); - for (i = 0; i < 8; i++) { - printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n", - cacheHit[i][0], cacheMiss[i][0], cacheHit[i][1], cacheMiss[i][1], - cacheHit[i][2], cacheMiss[i][2], cacheHit[i][3], cacheMiss[i][3]); - printf("%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\t%.6d/%.6d\n", - cacheHit[i][4], cacheMiss[i][4], cacheHit[i][5], cacheMiss[i][5], - cacheHit[i][6], cacheMiss[i][6], cacheHit[i][7], cacheMiss[i][7]); - } - -} - -static void -CollectStats() -{ - int i, j; - - i = stat_a[0].frametype; - - stat_a[i].totsize += stat_a[0].totsize; - stat_a[i].number += stat_a[0].number; - stat_a[i].i_mbsize += stat_a[0].i_mbsize; - stat_a[i].p_mbsize += stat_a[0].p_mbsize; - stat_a[i].b_mbsize += stat_a[0].b_mbsize; - stat_a[i].bi_mbsize += stat_a[0].bi_mbsize; - stat_a[i].i_mbnum += stat_a[0].i_mbnum; - stat_a[i].p_mbnum += stat_a[0].p_mbnum; - stat_a[i].b_mbnum += stat_a[0].b_mbnum; - stat_a[i].bi_mbnum += stat_a[0].bi_mbnum; - - for (j = 0; j < 64; j++) { - - stat_a[i].i_mbcbp[j] += stat_a[0].i_mbcbp[j]; - stat_a[i].p_mbcbp[j] += stat_a[0].p_mbcbp[j]; - stat_a[i].b_mbcbp[j] += stat_a[0].b_mbcbp[j]; - stat_a[i].bi_mbcbp[j] += stat_a[0].bi_mbcbp[j]; - stat_a[i].i_mbcoeff[j] += stat_a[0].i_mbcoeff[j]; - stat_a[i].p_mbcoeff[j] += stat_a[0].p_mbcoeff[j]; - stat_a[i].b_mbcoeff[j] += stat_a[0].b_mbcoeff[j]; - stat_a[i].bi_mbcoeff[j] += stat_a[0].bi_mbcoeff[j]; - } - - stat_a[i].tottime += stat_a[0].tottime; - - init_stat_struct(&(stat_a[0])); -} - -static unsigned int -bitCountRead() -{ - return bitCount; -} - -static void -StartTime() -{ - stat_a[0].tottime = ReadSysClock(); -} - -static void -EndTime() -{ - stat_a[0].tottime = ReadSysClock() - stat_a[0].tottime; -} -#endif - -double realTimeStart; -int totNumFrames = 0; - -double -ReadSysClock() -{ - struct timeval tv; - (void) gettimeofday(&tv, (struct timezone *)NULL); - return (tv.tv_sec + tv.tv_usec / 1000000.0); -} - -void -PrintTimeInfo() -{ - double spent; - - spent = ReadSysClock() - realTimeStart; - - if (!quietFlag) { - printf("\nReal Time Spent (After Initializations): %f secs.\n", spent); - printf("Avg. Frames/Sec: %f\n", ((double) totNumFrames) / spent); -/* - print_delta(); -*/ - } -} - - - -/* - *-------------------------------------------------------------- - * - * NewVidStream -- - * - * Allocates and initializes a VidStream structure. Takes - * as parameter requested size for buffer length. - * - * Results: - * A pointer to the new VidStream structure. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -VidStream * NewVidStream(void) -{ - int i, j; - VidStream *new_stream; - static unsigned char default_intra_matrix[64] = { - 8, 16, 19, 22, 26, 27, 29, 34, - 16, 16, 22, 24, 27, 29, 34, 37, - 19, 22, 26, 27, 29, 34, 34, 38, - 22, 22, 26, 27, 29, 34, 37, 40, - 22, 26, 27, 29, 32, 35, 40, 48, - 26, 27, 29, 32, 35, 40, 48, 58, - 26, 27, 29, 34, 38, 46, 56, 69, - 27, 29, 35, 38, 46, 56, 69, 83}; - - /* Allocate memory for new structure. */ - - new_stream = (VidStream *) malloc(sizeof(VidStream)); - - /* Initialize pointers to extension and user data. */ - - new_stream->group.ext_data = new_stream->group.user_data = - new_stream->picture.extra_info = new_stream->picture.user_data = - new_stream->picture.ext_data = new_stream->slice.extra_info = - new_stream->ext_data = new_stream->user_data = NULL; - - /* Copy default intra matrix. */ - - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - new_stream->intra_quant_matrix[j][i] = default_intra_matrix[i * 8 + j]; - } - } - - /* Initialize crop table. */ - - for (i = (-MAX_NEG_CROP); i < NUM_CROP_ENTRIES - MAX_NEG_CROP; i++) { - if (i <= 0) { - cropTbl[i + MAX_NEG_CROP] = 0; - } else if (i >= 255) { - cropTbl[i + MAX_NEG_CROP] = 255; - } else { - cropTbl[i + MAX_NEG_CROP] = i; - } - } - - /* Initialize non intra quantization matrix. */ - - for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { - new_stream->non_intra_quant_matrix[j][i] = 16; - } - } - - /* Initialize pointers to image spaces. */ - - new_stream->current = new_stream->past = new_stream->future = NULL; - for (i = 0; i < RING_BUF_SIZE; i++) { - new_stream->ring[i] = NULL; - } - - - /* Initialize bitstream i/o fields. */ - - new_stream->max_buf_length = 0; - new_stream->bit_offset = 0; - new_stream->buf_length = 0; - new_stream->buffer = new_stream->buf_start = NULL; - - - /* Return structure. */ - - return new_stream; -} - - - -/* - *-------------------------------------------------------------- - * - * DestroyVidStream -- - * - * Deallocates a VidStream structure. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -DestroyVidStream(VidStream *astream) -{ - int i; - - if (astream->ext_data != NULL) - free(astream->ext_data); - - if (astream->user_data != NULL) - free(astream->user_data); - - if (astream->group.ext_data != NULL) - free(astream->group.ext_data); - - if (astream->group.user_data != NULL) - free(astream->group.user_data); - - if (astream->picture.extra_info != NULL) - free(astream->picture.extra_info); - - if (astream->picture.ext_data != NULL) - free(astream->picture.ext_data); - - if (astream->picture.user_data != NULL) - free(astream->picture.user_data); - - if (astream->slice.extra_info != NULL) - free(astream->slice.extra_info); - - if (astream->buf_start != NULL) - free(astream->buf_start); - - for (i = 0; i < RING_BUF_SIZE; i++) { - if (astream->ring[i] != NULL) { - DestroyPictImage(astream->ring[i]); - astream->ring[i] = NULL; - } - } - - free((char *) astream); -} - - - - -/* - *-------------------------------------------------------------- - * - * NewPictImage -- - * - * Allocates and initializes a PictImage structure. - * The width and height of the image space are passed in - * as parameters. - * - * Results: - * A pointer to the new PictImage structure. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -PictImage * -NewPictImage(unsigned int width, unsigned int height) -{ - PictImage *new_pi; - - /* Allocate memory space for new structure. */ - - new_pi = (PictImage *) malloc(sizeof(PictImage)); - new_pi->luminance = (unsigned char *) malloc(width * height); - new_pi->Cr = (unsigned char *) malloc(width * height / 4); - new_pi->Cb = (unsigned char *) malloc(width * height / 4); - - /* Reset locked flag. */ - - new_pi->locked = 0; - - /* Return pointer to new structure. */ - - return new_pi; -} - - - -/* - *-------------------------------------------------------------- - * - * DestroyPictImage -- - * - * Deallocates a PictImage structure. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -void -DestroyPictImage(PictImage *apictimage) -{ - if (apictimage->luminance != NULL) { - free(apictimage->luminance); - } - if (apictimage->Cr != NULL) { - free(apictimage->Cr); - } - if (apictimage->Cb != NULL) { - free(apictimage->Cb); - } - free(apictimage); -} - - - -/* - *-------------------------------------------------------------- - * - * mpegVidRsrc -- - * - * Parses bit stream until a picture is decoded - * - * Results: - * 0 - successfully decoded a frame, -1 - failed - * - * Side effects: - * Bit stream is irreversibly parsed. - * - *-------------------------------------------------------------- - */ -int mpegVidRsrc(char *packet) -{ - TimeStamp time_stamp = 0; - VidStream *vid_stream = curVidStream; - unsigned int data; - int i, status; - VideoPacket *p = (VideoPacket *) packet; - - /* initialize buffer info and allocate ring item for current frame */ - (curVidStream->buf_start) = (curVidStream->buffer) = - (unsigned int *)(packet + sizeof(*p)); - curVidStream->max_buf_length = curVidStream->buf_length = - (p->dataBytes + 11)>>2; - curVidStream->bit_offset = 0; - - i = 0; - while (curVidStream->ring[i]->locked != 0) - if (++i >= RING_BUF_SIZE) { - perror("VD fatal error. Ring buffer full."); - exit(1); - } - curVidStream->current = curVidStream->ring[i]; - curVidStream->current->sh = p->sh; - curVidStream->current->gop = p->gop; - curVidStream->current->frame = p->frame; - curVidStream->current->display = p->display; - curVidStream->current->future = p->future; - curVidStream->current->past = p->past; - - bitOffset = curVidStream->bit_offset; -#ifdef UTIL2 - curBits = *curVidStream->buffer << bitOffset; -#else - curBits = *curVidStream->buffer; -#endif - bufLength = curVidStream->buf_length; - bitBuffer = curVidStream->buffer; - - /* - * If called for the INIT command, find start code, make sure it is a - * sequence start code. - */ - - if (shared->cmd == CmdINIT) { - next_start_code(); - show_bits32(data); - if (data != SEQ_START_CODE) { - fprintf(stderr, "VD error: This is not first packet of the an MPEG stream, data %u.", data); - DestroyVidStream(curVidStream); - exit(1); - } - } - /* Get next 32 bits (size of start codes). */ - - show_bits32(data); - - /* Process according to start code */ - - switch (data) - { - case SEQ_END_CODE: - - /* Display last frame. */ - /* - fprintf(stderr, "VD: SEQ_END_CODE decoded.\n"); - */ - if (vid_stream->future != NULL) - { - vid_stream->current = vid_stream->future; - return 0; - } - else - { - fprintf(stderr, "VD error: no more picture for SEQ_END_CODE\n"); - return -1; - } - - case SEQ_START_CODE: - - /* Sequence start code. Parse sequence header. */ - - if (ParseSeqHead(vid_stream) != PARSE_OK) - { - fprintf(stderr, "VD error on decoding SequenceHeader.\n"); - return -1; - } - - /* - * modify vid_stream after sequence start code so that application above can use - * info in header. - */ - - vid_stream->buffer = bitBuffer; - vid_stream->buf_length = bufLength; - vid_stream->bit_offset = bitOffset; - vid_stream->shid = ((VideoPacket *)packet)->sh; - - case GOP_START_CODE: - - /* Group of Pictures start code. Parse gop header. */ - - if (ParseGOP(vid_stream) != PARSE_OK) - { - fprintf(stderr, "VD error on decoding GOP\n"); - return -1; - } - - vid_stream->gopid = ((VideoPacket *)packet)->gop; - - case PICTURE_START_CODE: - - /* Picture start code. Parse picture header and first slice header. */ - - if (vid_stream->gopid != ((VideoPacket *)packet)->gop || - vid_stream->shid != ((VideoPacket *)packet)->sh) - { - shared->needHeader = 1; - /* - fprintf(stderr, "VD error: SeqHeader and/or GOP not available for the picture"); - */ - return -1; - } - - if (ParsePicture(vid_stream, time_stamp) != PARSE_OK) - { - /* - fprintf(stderr, "VD error on parsing Picture header\n"); - */ - return -1; - } - /* parse all the following slices */ - for (;;) - { - if (ParseSlice(vid_stream) != PARSE_OK) - { - fprintf(stderr, "VD error on decoding a Slice header.\n"); - return -1; - } - /* Parse all following macroblocks. */ - for (;;) - { - int res; - /* Check to see if actually a startcode and not a macroblock. */ - if (!next_bits(23, 0x00000000)) - { - /* Not start code. Parse Macroblock. */ - if ((res = ParseMacroBlock(vid_stream)) != PARSE_OK) - { - fprintf(stderr, "VD error on parsing a MacroBlock, res = %d\n", res); - return -1; - } - } - else - { - /* Not macroblock, actually start code. Get start code. */ - next_start_code(); - show_bits32(data); - - /* If start code is outside range of slice start codes, frame is - complete, display frame, otherwise another slice */ - if ((data < SLICE_MIN_START_CODE) || (data > SLICE_MAX_START_CODE)) - return 0; - else - break; - } - } - } - break; - default: - fprintf(stderr, "VD error: fail to clasify the packet.\n"); - return -1; - } - fprintf(stderr, "VD get wired.\n"); - return -1; -} - - -/* - *-------------------------------------------------------------- - * - * ParseSeqHead -- - * - * Assumes bit stream is at the begining of the sequence - * header start code. Parses off the sequence header. - * - * Results: - * Fills the vid_stream structure with values derived and - * decoded from the sequence header. Allocates the pict image - * structures based on the dimensions of the image space - * found in the sequence header. - * - * Side effects: - * Bit stream irreversibly parsed off. - * - *-------------------------------------------------------------- - */ - -static int -ParseSeqHead(VidStream *vid_stream) -{ - - unsigned int data; - int i; - - /* Flush off sequence start code. */ - - flush_bits32; - - /* Get horizontal size of image space. */ - - get_bits12(data); - vid_stream->h_size = data; - - /* Get vertical size of image space. */ - - get_bits12(data); - vid_stream->v_size = data; - - /* Calculate macroblock width and height of image space. */ - - vid_stream->mb_width = (vid_stream->h_size + 15) / 16; - vid_stream->mb_height = (vid_stream->v_size + 15) / 16; - - /* If dither type is MBORDERED allocate ditherFlags. */ - - if (ditherType == MBORDERED_DITHER) { - ditherFlags = (char *) malloc(vid_stream->mb_width*vid_stream->mb_height); - } - - /* Initialize lmaxx, lmaxy, cmaxx, cmaxy. */ - - lmaxx = vid_stream->mb_width*16-1; - lmaxy = vid_stream->mb_height*16-1; - cmaxx = vid_stream->mb_width*8-1; - cmaxy = vid_stream->mb_height*8-1; - - /* Parse of aspect ratio code. */ - - get_bits4(data); - vid_stream->aspect_ratio = (unsigned char) data; - - /* Parse off picture rate code. */ - - get_bits4(data); - vid_stream->picture_rate = (unsigned char) data; - - /* Parse off bit rate. */ - - get_bits18(data); - vid_stream->bit_rate = data; - - /* Flush marker bit. */ - - flush_bits(1); - - /* Parse off vbv buffer size. */ - - get_bits10(data); - vid_stream->vbv_buffer_size = data; - - /* Parse off contrained parameter flag. */ - - get_bits1(data); - if (data) { - vid_stream->const_param_flag = TRUE; - } else - vid_stream->const_param_flag = FALSE; - - /* - * If intra_quant_matrix_flag set, parse off intra quant matrix values. - */ - - get_bits1(data); - if (data) { - for (i = 0; i < 64; i++) { - get_bits8(data); - - vid_stream->intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] = - (unsigned char) data; - } - } - /* - * If non intra quant matrix flag set, parse off non intra quant matrix - * values. - */ - - get_bits1(data); - if (data) { - for (i = 0; i < 64; i++) { - get_bits8(data); - - vid_stream->non_intra_quant_matrix[zigzag[i][1]][zigzag[i][0]] = - (unsigned char) data; - } - } - /* Go to next start code. */ - - next_start_code(); - - /* - * If next start code is extension start code, parse off extension data. - */ - - if (next_bits(32, EXT_START_CODE)) { - flush_bits32; - if (vid_stream->ext_data != NULL) { - free(vid_stream->ext_data); - vid_stream->ext_data = NULL; - } - vid_stream->ext_data = get_ext_data(); - } - /* If next start code is user start code, parse off user data. */ - - if (next_bits(32, USER_START_CODE)) { - flush_bits32; - if (vid_stream->user_data != NULL) { - free(vid_stream->user_data); - vid_stream->user_data = NULL; - } - vid_stream->user_data = get_ext_data(); - } - return PARSE_OK; -} - - - -/* - *-------------------------------------------------------------- - * - * ParseGOP -- - * - * Parses of group of pictures header from bit stream - * associated with vid_stream. - * - * Results: - * Values in gop header placed into video stream structure. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -static int -ParseGOP(VidStream *vid_stream) -{ - unsigned int data; - - /* Flush group of pictures start code. WWWWWWOOOOOOOSSSSSSHHHHH!!! */ - - flush_bits32; - - /* Parse off drop frame flag. */ - - get_bits1(data); - if (data) { - vid_stream->group.drop_flag = TRUE; - } else - vid_stream->group.drop_flag = FALSE; - - /* Parse off hour component of time code. */ - - get_bits5(data); - vid_stream->group.tc_hours = data; - - /* Parse off minute component of time code. */ - - get_bits6(data); - vid_stream->group.tc_minutes = data; - - /* Flush marker bit. */ - - flush_bits(1); - - /* Parse off second component of time code. */ - - get_bits6(data); - vid_stream->group.tc_seconds = data; - - /* Parse off picture count component of time code. */ - - get_bits6(data); - vid_stream->group.tc_pictures = data; - /* - Fprintf(stderr, "GOP time_code:%d:%02d:%02d-%02d\n", - vid_stream->group.tc_hours, - vid_stream->group.tc_minutes, - vid_stream->group.tc_seconds, - vid_stream->group.tc_pictures); - */ - /* Parse off closed gop and broken link flags. */ - - get_bits2(data); - if (data > 1) { - vid_stream->group.closed_gop = TRUE; - if (data > 2) { - vid_stream->group.broken_link = TRUE; - } else - vid_stream->group.broken_link = FALSE; - } else { - vid_stream->group.closed_gop = FALSE; - if (data) { - vid_stream->group.broken_link = TRUE; - } else - vid_stream->group.broken_link = FALSE; - } - - /* Goto next start code. */ - - next_start_code(); - - /* If next start code is extension data, parse off extension data. */ - - if (next_bits(32, EXT_START_CODE)) { - flush_bits32; - if (vid_stream->group.ext_data != NULL) { - free(vid_stream->group.ext_data); - vid_stream->group.ext_data = NULL; - } - vid_stream->group.ext_data = get_ext_data(); - } - /* If next start code is user data, parse off user data. */ - - if (next_bits(32, USER_START_CODE)) { - flush_bits32; - if (vid_stream->group.user_data != NULL) { - free(vid_stream->group.user_data); - vid_stream->group.user_data = NULL; - } - vid_stream->group.user_data = get_ext_data(); - } - return PARSE_OK; -} - - - -/* - *-------------------------------------------------------------- - * - * ParsePicture -- - * - * Parses picture header. Marks picture to be presented - * at particular time given a time stamp. - * - * Results: - * Values from picture header put into video stream structure. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -static int -ParsePicture(VidStream *vid_stream,TimeStamp time_stamp) -{ - unsigned int data; - int i; - - /* Flush header start code. */ - flush_bits32; - - /* Parse off temporal reference. */ - get_bits10(data); - vid_stream->picture.temp_ref = data; - /* - Fprintf(stderr, "Pic temp_ref %d\n", vid_stream->picture.temp_ref); - */ - /* Parse of picture type. */ - get_bits3(data); - vid_stream->picture.code_type = data; - - if ((vid_stream->picture.code_type == B_TYPE) && - (No_B_Flag || - (vid_stream->past == NULL) || - (vid_stream->future == NULL))) - return SKIP_PICTURE; - - if ((vid_stream->picture.code_type == P_TYPE) && - (No_P_Flag || (vid_stream->future == NULL))) - return SKIP_PICTURE; - - /* Parse off vbv buffer delay value. */ - get_bits16(data); - vid_stream->picture.vbv_delay = data; - - /* If P or B type frame... */ - - if ((vid_stream->picture.code_type == 2) || (vid_stream->picture.code_type == 3)) { - - /* Parse off forward vector full pixel flag. */ - get_bits1(data); - if (data) - vid_stream->picture.full_pel_forw_vector = TRUE; - else - vid_stream->picture.full_pel_forw_vector = FALSE; - - /* Parse of forw_r_code. */ - get_bits3(data); - - /* Decode forw_r_code into forw_r_size and forw_f. */ - - vid_stream->picture.forw_r_size = data - 1; - vid_stream->picture.forw_f = (1 << vid_stream->picture.forw_r_size); - } - /* If B type frame... */ - - if (vid_stream->picture.code_type == 3) { - - /* Parse off back vector full pixel flag. */ - get_bits1(data); - if (data) - vid_stream->picture.full_pel_back_vector = TRUE; - else - vid_stream->picture.full_pel_back_vector = FALSE; - - /* Parse off back_r_code. */ - get_bits3(data); - - /* Decode back_r_code into back_r_size and back_f. */ - - vid_stream->picture.back_r_size = data - 1; - vid_stream->picture.back_f = (1 << vid_stream->picture.back_r_size); - } - /* Get extra bit picture info. */ - - if (vid_stream->picture.extra_info != NULL) { - free(vid_stream->picture.extra_info); - vid_stream->picture.extra_info = NULL; - } - vid_stream->picture.extra_info = get_extra_bit_info(); - - /* Goto next start code. */ - next_start_code(); - - /* If start code is extension start code, parse off extension data. */ - - if (next_bits(32, EXT_START_CODE)) { - flush_bits32; - - if (vid_stream->picture.ext_data != NULL) { - free(vid_stream->picture.ext_data); - vid_stream->picture.ext_data = NULL; - } - vid_stream->picture.ext_data = get_ext_data(); - } - /* If start code is user start code, parse off user data. */ - - if (next_bits(32, USER_START_CODE)) { - flush_bits32; - - if (vid_stream->picture.user_data != NULL) { - free(vid_stream->picture.user_data); - vid_stream->picture.user_data = NULL; - } - vid_stream->picture.user_data = get_ext_data(); - } - - /* Reset past macroblock address field. */ - - vid_stream->mblock.past_mb_addr = -1; - - return PARSE_OK; -} - -/* - *-------------------------------------------------------------- - * - * ParseSlice -- - * - * Parses off slice header. - * - * Results: - * Values found in slice header put into video stream structure. - * - * Side effects: - * Bit stream irreversibly parsed. - * - *-------------------------------------------------------------- - */ - -static int -ParseSlice(VidStream *vid_stream) -{ - unsigned int data; - - /* Flush slice start code. */ - - flush_bits(24); - - /* Parse off slice vertical position. */ - - get_bits8(data); - vid_stream->slice.vert_pos = data; - - /* Parse off quantization scale. */ - - get_bits5(data); - vid_stream->slice.quant_scale = data; - - /* Parse off extra bit slice info. */ - - if (vid_stream->slice.extra_info != NULL) { - free(vid_stream->slice.extra_info); - vid_stream->slice.extra_info = NULL; - } - vid_stream->slice.extra_info = get_extra_bit_info(); - - /* Reset past intrablock address. */ - - vid_stream->mblock.past_intra_addr = -2; - - /* Reset previous recon motion vectors. */ - - vid_stream->mblock.recon_right_for_prev = 0; - vid_stream->mblock.recon_down_for_prev = 0; - vid_stream->mblock.recon_right_back_prev = 0; - vid_stream->mblock.recon_down_back_prev = 0; - - /* Reset macroblock address. */ - - vid_stream->mblock.mb_address = ((vid_stream->slice.vert_pos - 1) * - vid_stream->mb_width) - 1; - - /* Reset past dct dc y, cr, and cb values. */ - - vid_stream->block.dct_dc_y_past = 1024; - vid_stream->block.dct_dc_cr_past = 1024; - vid_stream->block.dct_dc_cb_past = 1024; - - return PARSE_OK; -} - - - -/* - *-------------------------------------------------------------- - * - * ParseMacroBlock -- - * - * Parseoff macroblock. Reconstructs DCT values. Applies - * inverse DCT, reconstructs motion vectors, calculates and - * set pixel values for macroblock in current pict image - * structure. - * - * Results: - * Here's where everything really happens. Welcome to the - * heart of darkness. - * - * Side effects: - * Bit stream irreversibly parsed off. - * - *-------------------------------------------------------------- - */ - -static int -ParseMacroBlock(VidStream *vid_stream) -{ - int addr_incr; - unsigned int data; - int mask, i, recon_right_for, recon_down_for, recon_right_back, - recon_down_back; - int zero_block_flag; - BOOLEAN mb_quant, mb_motion_forw, mb_motion_back, mb_pattern; - int no_dith_flag = 0; - -#ifdef ANALYSIS - mbSizeCount = bitCountRead(); -#endif - - /* - * Parse off macroblock address increment and add to macroblock address. - */ - do { - DecodeMBAddrInc(addr_incr); - if (addr_incr == MB_ESCAPE) { - vid_stream->mblock.mb_address += 33; - addr_incr = MB_STUFFING; - } - } while (addr_incr == MB_STUFFING); - vid_stream->mblock.mb_address += addr_incr; - - if (vid_stream->mblock.mb_address > ((vid_stream->mb_height) * (vid_stream->mb_width) - 1)) - { - fprintf(stderr, "mblock.mb_address-%d, mb_height-%d, mb_width-%d, addr_incr-%d\n", - vid_stream->mblock.mb_address, vid_stream->mb_height, vid_stream->mb_width, addr_incr); - return SKIP_TO_START_CODE; - } - - /* - * If macroblocks have been skipped, process skipped macroblocks. - */ - - if (vid_stream->mblock.mb_address - vid_stream->mblock.past_mb_addr > 1) { - if (vid_stream->picture.code_type == P_TYPE) - ProcessSkippedPFrameMBlocks(vid_stream); - else if (vid_stream->picture.code_type == B_TYPE) - ProcessSkippedBFrameMBlocks(vid_stream); - } - /* Set past macroblock address to current macroblock address. */ - vid_stream->mblock.past_mb_addr = vid_stream->mblock.mb_address; - - /* Based on picture type decode macroblock type. */ - switch (vid_stream->picture.code_type) { - case I_TYPE: - DecodeMBTypeI(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, - vid_stream->mblock.mb_intra); - break; - - case P_TYPE: - DecodeMBTypeP(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, - vid_stream->mblock.mb_intra); - break; - - case B_TYPE: - DecodeMBTypeB(mb_quant, mb_motion_forw, mb_motion_back, mb_pattern, - vid_stream->mblock.mb_intra); - break; - } - - /* If quantization flag set, parse off new quantization scale. */ - - if (mb_quant == TRUE) { - get_bits5(data); - vid_stream->slice.quant_scale = data; - } - /* If forward motion vectors exist... */ - if (mb_motion_forw == TRUE) { - - /* Parse off and decode horizontal forward motion vector. */ - DecodeMotionVectors(vid_stream->mblock.motion_h_forw_code); - - /* If horiz. forward r data exists, parse off. */ - - if ((vid_stream->picture.forw_f != 1) && - (vid_stream->mblock.motion_h_forw_code != 0)) { - get_bitsn(vid_stream->picture.forw_r_size, data); - vid_stream->mblock.motion_h_forw_r = data; - } - /* Parse off and decode vertical forward motion vector. */ - DecodeMotionVectors(vid_stream->mblock.motion_v_forw_code); - - /* If vert. forw. r data exists, parse off. */ - - if ((vid_stream->picture.forw_f != 1) && - (vid_stream->mblock.motion_v_forw_code != 0)) { - get_bitsn(vid_stream->picture.forw_r_size, data); - vid_stream->mblock.motion_v_forw_r = data; - } - } - /* If back motion vectors exist... */ - if (mb_motion_back == TRUE) { - - /* Parse off and decode horiz. back motion vector. */ - DecodeMotionVectors(vid_stream->mblock.motion_h_back_code); - - /* If horiz. back r data exists, parse off. */ - - if ((vid_stream->picture.back_f != 1) && - (vid_stream->mblock.motion_h_back_code != 0)) { - get_bitsn(vid_stream->picture.back_r_size, data); - vid_stream->mblock.motion_h_back_r = data; - } - /* Parse off and decode vert. back motion vector. */ - DecodeMotionVectors(vid_stream->mblock.motion_v_back_code); - - /* If vert. back r data exists, parse off. */ - - if ((vid_stream->picture.back_f != 1) && - (vid_stream->mblock.motion_v_back_code != 0)) { - get_bitsn(vid_stream->picture.back_r_size, data); - vid_stream->mblock.motion_v_back_r = data; - } - } -#ifdef ANALYSIS - if (vid_stream->mblock.mb_intra) { - stat_a[0].i_mbnum++; - mbCBPPtr = stat_a[0].i_mbcbp; - mbCoeffPtr = stat_a[0].i_mbcoeff; - mbSizePtr = &(stat_a[0].i_mbsize); - } else if (mb_motion_back && mb_motion_forw) { - stat_a[0].bi_mbnum++; - mbCBPPtr = stat_a[0].bi_mbcbp; - mbCoeffPtr = stat_a[0].bi_mbcoeff; - mbSizePtr = &(stat_a[0].bi_mbsize); - } else if (mb_motion_back) { - stat_a[0].b_mbnum++; - mbCBPPtr = stat_a[0].b_mbcbp; - mbCoeffPtr = stat_a[0].b_mbcoeff; - mbSizePtr = &(stat_a[0].b_mbsize); - } else { - stat_a[0].p_mbnum++; - mbCBPPtr = stat_a[0].p_mbcbp; - mbCoeffPtr = stat_a[0].p_mbcoeff; - mbSizePtr = &(stat_a[0].p_mbsize); - } -#endif - - /* If mblock pattern flag set, parse and decode CBP (code block pattern). */ - if (mb_pattern == TRUE) { - DecodeCBP(vid_stream->mblock.cbp); - } - /* Otherwise, set CBP to zero. */ - else - vid_stream->mblock.cbp = 0; - - -#ifdef ANALYSIS - mbCBPPtr[vid_stream->mblock.cbp]++; -#endif - - /* Reconstruct motion vectors depending on picture type. */ - if (vid_stream->picture.code_type == P_TYPE) { - - /* - * If no forw motion vectors, reset previous and current vectors to 0. - */ - - if (!mb_motion_forw) { - recon_right_for = 0; - recon_down_for = 0; - vid_stream->mblock.recon_right_for_prev = 0; - vid_stream->mblock.recon_down_for_prev = 0; - } - /* - * Otherwise, compute new forw motion vectors. Reset previous vectors to - * current vectors. - */ - - else { - ComputeForwVector(&recon_right_for, &recon_down_for); - } - } - if (vid_stream->picture.code_type == B_TYPE) { - - /* Reset prev. and current vectors to zero if mblock is intracoded. */ - - if (vid_stream->mblock.mb_intra) { - vid_stream->mblock.recon_right_for_prev = 0; - vid_stream->mblock.recon_down_for_prev = 0; - vid_stream->mblock.recon_right_back_prev = 0; - vid_stream->mblock.recon_down_back_prev = 0; - } else { - - /* If no forw vectors, current vectors equal prev. vectors. */ - - if (!mb_motion_forw) { - recon_right_for = vid_stream->mblock.recon_right_for_prev; - recon_down_for = vid_stream->mblock.recon_down_for_prev; - } - /* - * Otherwise compute forw. vectors. Reset prev vectors to new values. - */ - - else { - ComputeForwVector(&recon_right_for, &recon_down_for); - } - - /* If no back vectors, set back vectors to prev back vectors. */ - - if (!mb_motion_back) { - recon_right_back = vid_stream->mblock.recon_right_back_prev; - recon_down_back = vid_stream->mblock.recon_down_back_prev; - } - /* Otherwise compute new vectors and reset prev. back vectors. */ - - else { - ComputeBackVector(&recon_right_back, &recon_down_back); - } - - /* - * Store vector existance flags in structure for possible skipped - * macroblocks to follow. - */ - - vid_stream->mblock.bpict_past_forw = mb_motion_forw; - vid_stream->mblock.bpict_past_back = mb_motion_back; - } - } - - /* For each possible block in macroblock. */ - if (ditherType == GRAY_DITHER || - ditherType == MONO_DITHER || - ditherType == MONO_THRESHOLD) { - for (mask = 32, i = 0; i < 4; mask >>= 1, i++) { - - /* If block exists... */ - if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) { - zero_block_flag = 0; - ParseReconBlock(i); - } else { - zero_block_flag = 1; - } - - /* If macroblock is intra coded... */ - if (vid_stream->mblock.mb_intra) { - ReconIMBlock(vid_stream, i); - } else if (mb_motion_forw && mb_motion_back) { - ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for, - recon_right_back, recon_down_back, zero_block_flag); - } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) { - ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for, - zero_block_flag); - } else if (mb_motion_back) { - ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back, - zero_block_flag); - } - } - /* Kill the Chrominace blocks... */ - if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x2)) { - ParseAwayBlock(4); - } - if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & 0x1)) { - ParseAwayBlock(5); - } - } else { - if ((ditherType == MBORDERED_DITHER) && - (vid_stream->mblock.cbp == 0) && - (vid_stream->picture.code_type == 3) && - (!vid_stream->mblock.mb_intra) && - (!(mb_motion_forw && mb_motion_back))) { - /* - MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address, - mb_motion_forw, recon_right_for, recon_down_for, - mb_motion_back, recon_right_back, recon_down_back, - vid_stream->past->display, vid_stream->future->display); - ditherFlags[vid_stream->mblock.mb_address] = 0; - no_dith_flag = 1; - */ - } - else { - for (mask = 32, i = 0; i < 6; mask >>= 1, i++) { - - /* If block exists... */ - if ((vid_stream->mblock.mb_intra) || (vid_stream->mblock.cbp & mask)) { - zero_block_flag = 0; - ParseReconBlock(i); - } else { - zero_block_flag = 1; - } - - /* If macroblock is intra coded... */ - if (vid_stream->mblock.mb_intra) { - ReconIMBlock(vid_stream, i); - } else if (mb_motion_forw && mb_motion_back) { - ReconBiMBlock(vid_stream, i, recon_right_for, recon_down_for, - recon_right_back, recon_down_back, zero_block_flag); - } else if (mb_motion_forw || (vid_stream->picture.code_type == P_TYPE)) { - ReconPMBlock(vid_stream, i, recon_right_for, recon_down_for, - zero_block_flag); - } else if (mb_motion_back) { - ReconBMBlock(vid_stream, i, recon_right_back, recon_down_back, - zero_block_flag); - } - } - } - } - - if ((ditherType == MBORDERED_DITHER) && (!no_dith_flag)) { - if ((vid_stream->picture.code_type == 2) && - (vid_stream->mblock.cbp == 0) && - (!vid_stream->mblock.mb_intra)) { - /* - MBOrderedDitherDisplayCopy(vid_stream, vid_stream->mblock.mb_address, - 1, recon_right_for, recon_down_for, - 0, 0, 0, - vid_stream->future->display, - (unsigned char *) NULL); - ditherFlags[vid_stream->mblock.mb_address] = 0; - */ - } - else { - ditherFlags[vid_stream->mblock.mb_address] = 1; - } - } - - - /* If D Type picture, flush marker bit. */ - if (vid_stream->picture.code_type == 4) - flush_bits(1); - - /* If macroblock was intracoded, set macroblock past intra address. */ - if (vid_stream->mblock.mb_intra) - vid_stream->mblock.past_intra_addr = - vid_stream->mblock.mb_address; - -#ifdef ANALYSIS - *mbSizePtr += bitCountRead() - mbSizeCount; -#endif - return PARSE_OK; -} - - - -/* - *-------------------------------------------------------------- - * - * ReconIMBlock -- - * - * Reconstructs intra coded macroblock. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ReconIMBlock(VidStream *vid_stream, int bnum) -{ - int mb_row, mb_col, row, col, row_size, rr; - unsigned char *dest; - - /* Calculate macroblock row and column from address. */ - - mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; - mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; - - - /* If block is luminance block... */ - - if (bnum < 4) { - - /* Calculate row and col values for upper left pixel of block. */ - - row = mb_row * 16; - col = mb_col * 16; - if (bnum > 1) - row += 8; - if (bnum % 2) - col += 8; - - /* Set dest to luminance plane of current pict image. */ - - dest = vid_stream->current->luminance; - - /* Establish row size. */ - - row_size = vid_stream->mb_width * 16; - } - /* Otherwise if block is Cr block... */ - - else if (bnum == 4) { - - /* Set dest to Cr plane of current pict image. */ - - dest = vid_stream->current->Cr; - - /* Establish row size. */ - - row_size = vid_stream->mb_width * 8; - - /* Calculate row,col for upper left pixel of block. */ - - row = mb_row * 8; - col = mb_col * 8; - } - /* Otherwise block is Cb block, and ... */ - - else { - - /* Set dest to Cb plane of current pict image. */ - - dest = vid_stream->current->Cb; - - /* Establish row size. */ - - row_size = vid_stream->mb_width * 8; - - /* Calculate row,col for upper left pixel value of block. */ - - row = mb_row * 8; - col = mb_col * 8; - } - - /* - * For each pixel in block, set to cropped reconstructed value from inverse - * dct. - */ - { - short *sp = &vid_stream->block.dct_recon[0][0]; - unsigned char *cm = cropTbl + MAX_NEG_CROP; - dest += row * row_size + col; - for (rr = 0; rr < 4; rr++, sp += 16, dest += row_size) { - dest[0] = cm[sp[0]]; - assertCrop(sp[0]); - dest[1] = cm[sp[1]]; - assertCrop(sp[1]); - dest[2] = cm[sp[2]]; - assertCrop(sp[2]); - dest[3] = cm[sp[3]]; - assertCrop(sp[3]); - dest[4] = cm[sp[4]]; - assertCrop(sp[4]); - dest[5] = cm[sp[5]]; - assertCrop(sp[5]); - dest[6] = cm[sp[6]]; - assertCrop(sp[6]); - dest[7] = cm[sp[7]]; - assertCrop(sp[7]); - - dest += row_size; - dest[0] = cm[sp[8]]; - assertCrop(sp[8]); - dest[1] = cm[sp[9]]; - assertCrop(sp[9]); - dest[2] = cm[sp[10]]; - assertCrop(sp[10]); - dest[3] = cm[sp[11]]; - assertCrop(sp[11]); - dest[4] = cm[sp[12]]; - assertCrop(sp[12]); - dest[5] = cm[sp[13]]; - assertCrop(sp[13]); - dest[6] = cm[sp[14]]; - assertCrop(sp[14]); - dest[7] = cm[sp[15]]; - assertCrop(sp[15]); - } - } -} - - - -/* - *-------------------------------------------------------------- - * - * ReconPMBlock -- - * - * Reconstructs forward predicted macroblocks. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ReconPMBlock(VidStream *vid_stream, int bnum, - int recon_right_for, int recon_down_for, int zflag) -{ - int mb_row, mb_col, row, col, row_size, rr; - unsigned char *dest, *past; - static int right_for, down_for, right_half_for, down_half_for; - unsigned char *rindex1, *rindex2; - unsigned char *index; - short int *blockvals; - -#ifdef LOOSE_MPEG - int maxx, maxy; - int illegalBlock = 0; - int row_start, row_end, rfirst, rlast, col_start, col_end, cfirst, clast; -#endif - - /* Calculate macroblock row and column from address. */ - - mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; - mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; - - if (bnum < 4) { - - /* Calculate right_for, down_for motion vectors. */ - - right_for = recon_right_for >> 1; - down_for = recon_down_for >> 1; - right_half_for = recon_right_for & 0x1; - down_half_for = recon_down_for & 0x1; - - /* Set dest to luminance plane of current pict image. */ - - dest = vid_stream->current->luminance; - - if (vid_stream->picture.code_type == B_TYPE) { - if (vid_stream->past != NULL) - past = vid_stream->past->luminance; - } else { - - /* Set predicitive frame to current future frame. */ - - if (vid_stream->future != NULL) - past = vid_stream->future->luminance; - } - - /* Establish row size. */ - - row_size = vid_stream->mb_width << 4; - - /* Calculate row,col of upper left pixel in block. */ - - row = mb_row << 4; - col = mb_col << 4; - if (bnum > 1) - row += 8; - if (bnum % 2) - col += 8; - -#ifdef LOOSE_MPEG - /* Check for block illegality. */ - - maxx = lmaxx; maxy = lmaxy; - - if (row + down_for + 7 > maxy) illegalBlock |= 0x4; - else if (row + down_for < 0) illegalBlock |= 0x1; - - if (col + right_for + 7 > maxx) illegalBlock |= 0x2; - else if (col + right_for < 0) illegalBlock |= 0x8; - -#endif - } - /* Otherwise, block is NOT luminance block, ... */ - - else { - - /* Construct motion vectors. */ - - recon_right_for /= 2; - recon_down_for /= 2; - right_for = recon_right_for >> 1; - down_for = recon_down_for >> 1; - right_half_for = recon_right_for & 0x1; - down_half_for = recon_down_for & 0x1; - - /* Establish row size. */ - - row_size = vid_stream->mb_width << 3; - - /* Calculate row,col of upper left pixel in block. */ - - row = mb_row << 3; - col = mb_col << 3; - -#ifdef LOOSE_MPEG - /* Check for block illegality. */ - - maxx = cmaxx; maxy = cmaxy; - - if (row + down_for + 7 > maxy) illegalBlock |= 0x4; - else if (row + down_for < 0) illegalBlock |= 0x1; - - if (col + right_for + 7 > maxx) illegalBlock |= 0x2; - else if (col + right_for < 0) illegalBlock |= 0x8; - -#endif - - /* If block is Cr block... */ - - if (bnum == 4) { - - /* Set dest to Cr plane of current pict image. */ - - dest = vid_stream->current->Cr; - - if (vid_stream->picture.code_type == B_TYPE) { - - if (vid_stream->past != NULL) - past = vid_stream->past->Cr; - } else { - if (vid_stream->future != NULL) - past = vid_stream->future->Cr; - } - } - /* Otherwise, block is Cb block... */ - - else { - - /* Set dest to Cb plane of current pict image. */ - - dest = vid_stream->current->Cb; - - if (vid_stream->picture.code_type == B_TYPE) { - if (vid_stream->past != NULL) - past = vid_stream->past->Cb; - } else { - if (vid_stream->future != NULL) - past = vid_stream->future->Cb; - } - } - } - - /* For each pixel in block... */ - -#ifdef LOOSE_MPEG - - if (illegalBlock) { - if (illegalBlock & 0x1) { - row_start = 0; - row_end = row+down_for+8; - rfirst = rlast = 8 - row_end; - } - else if (illegalBlock & 0x4) { - row_start = row + down_for; - row_end = maxy+1; - rlast = row_end - row_start - 1; - rfirst = 0; - } - else { - row_start = row+down_for; - row_end = row_start+8; - rfirst = 0; - } - - if (illegalBlock & 0x8) { - col_start = 0; - col_end = col + right_for + 8; - cfirst = clast = 8 - col_end; - } - else if (illegalBlock & 0x2) { - col_start = col + right_for; - col_end = maxx + 1; - clast = col_end - col_start - 1; - cfirst = 0; - } - else { - col_start = col + right_for; - col_end = col_start + 8; - cfirst = 0; - } - - for (rr = row_start; rr < row_end; rr++) { - rindex1 = past + (rr * row_size) + col_start; - index = dest + ((row + rfirst) * row_size) + col + cfirst; - for (cc = col_start; cc < col_end; cc++) { - *index++ = *rindex1++; - } - } - - if (illegalBlock & 0x1) { - for (rr = rlast -1; rr >=0; rr--) { - index = dest + ((row + rr) * row_size) + col; - rindex1 = dest + ((row + rlast) * row_size) + col; - for (cc = 0; cc < 8; cc ++) { - *index++ = *rindex1++; - } - } - } - else if (illegalBlock & 0x4) { - for (rr = rlast+1; rr < 8; rr++) { - index = dest + ((row + rr) * row_size) + col; - rindex1 = dest + ((row + rlast) * row_size) + col; - for (cc = 0; cc < 8; cc ++) { - *index++ = *rindex1++; - } - } - } - - if (illegalBlock & 0x2) { - for (cc = clast+1; cc < 8; cc++) { - index = dest + (row * row_size) + (col + cc); - rindex1 = dest + (row * row_size) + (col + clast); - for (rr = 0; rr < 8; rr++) { - *index = *rindex1; - index += row_size; - rindex1 += row_size; - } - } - } - else if (illegalBlock & 0x8) { - for (cc = clast-1; cc >= 0; cc--) { - index = dest + (row * row_size) + (col + cc); - rindex1 = dest + (row * row_size) + (col + clast); - for (rr = 0; rr < 8; rr++) { - *index = *rindex1; - index += row_size; - rindex1 += row_size; - } - } - } - - if (!zflag) { - for (rr = 0; rr < 8; rr++) { - index = dest + (row*row_size) + col; - blockvals = &(vid_stream->block.dct_recon[rr][0]); - index[0] += blockvals[0]; - index[1] += blockvals[1]; - index[2] += blockvals[2]; - index[3] += blockvals[3]; - index[4] += blockvals[4]; - index[5] += blockvals[5]; - index[6] += blockvals[6]; - index[7] += blockvals[7]; - } - } - } - else { - -#endif - - index = dest + (row * row_size) + col; - rindex1 = past + (row + down_for) * row_size + col + right_for; - - blockvals = &(vid_stream->block.dct_recon[0][0]); - - /* - * Calculate predictive pixel value based on motion vectors and copy to - * dest plane. - */ - - if ((!down_half_for) && (!right_half_for)) { - unsigned char *cm = cropTbl + MAX_NEG_CROP; - if (!zflag) - for (rr = 0; rr < 4; rr++) { - index[0] = cm[(int) rindex1[0] + (int) blockvals[0]]; - index[1] = cm[(int) rindex1[1] + (int) blockvals[1]]; - index[2] = cm[(int) rindex1[2] + (int) blockvals[2]]; - index[3] = cm[(int) rindex1[3] + (int) blockvals[3]]; - index[4] = cm[(int) rindex1[4] + (int) blockvals[4]]; - index[5] = cm[(int) rindex1[5] + (int) blockvals[5]]; - index[6] = cm[(int) rindex1[6] + (int) blockvals[6]]; - index[7] = cm[(int) rindex1[7] + (int) blockvals[7]]; - index += row_size; - rindex1 += row_size; - - index[0] = cm[(int) rindex1[0] + (int) blockvals[8]]; - index[1] = cm[(int) rindex1[1] + (int) blockvals[9]]; - index[2] = cm[(int) rindex1[2] + (int) blockvals[10]]; - index[3] = cm[(int) rindex1[3] + (int) blockvals[11]]; - index[4] = cm[(int) rindex1[4] + (int) blockvals[12]]; - index[5] = cm[(int) rindex1[5] + (int) blockvals[13]]; - index[6] = cm[(int) rindex1[6] + (int) blockvals[14]]; - index[7] = cm[(int) rindex1[7] + (int) blockvals[15]]; - blockvals += 16; - index += row_size; - rindex1 += row_size; - } - else { - if (right_for & 0x1) { - /* No alignment, use bye copy */ - for (rr = 0; rr < 4; rr++) { - index[0] = rindex1[0]; - index[1] = rindex1[1]; - index[2] = rindex1[2]; - index[3] = rindex1[3]; - index[4] = rindex1[4]; - index[5] = rindex1[5]; - index[6] = rindex1[6]; - index[7] = rindex1[7]; - index += row_size; - rindex1 += row_size; - - index[0] = rindex1[0]; - index[1] = rindex1[1]; - index[2] = rindex1[2]; - index[3] = rindex1[3]; - index[4] = rindex1[4]; - index[5] = rindex1[5]; - index[6] = rindex1[6]; - index[7] = rindex1[7]; - index += row_size; - rindex1 += row_size; - } - } else if (right_for & 0x2) { - /* Half-word bit aligned, use 16 bit copy */ - short *src = (short *)rindex1; - short *dest = (short *)index; - row_size >>= 1; - for (rr = 0; rr < 4; rr++) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_size; - src += row_size; - - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_size; - src += row_size; - } - } else { - /* Word aligned, use 32 bit copy */ - int *src = (int *)rindex1; - int *dest = (int *)index; - row_size >>= 2; - for (rr = 0; rr < 4; rr++) { - dest[0] = src[0]; - dest[1] = src[1]; - dest += row_size; - src += row_size; - - dest[0] = src[0]; - dest[1] = src[1]; - dest += row_size; - src += row_size; - } - } - } - } else { - unsigned char *cm = cropTbl + MAX_NEG_CROP; - rindex2 = rindex1 + right_half_for + (down_half_for * row_size); - if (!zflag) - for (rr = 0; rr < 4; rr++) { - index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[0]]; - index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[1]]; - index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[2]]; - index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[3]]; - index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[4]]; - index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[5]]; - index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[6]]; - index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[7]]; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - - index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[8]]; - index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[9]]; - index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[10]]; - index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[11]]; - index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[12]]; - index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[13]]; - index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[14]]; - index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[15]]; - blockvals += 16; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - } - else - for (rr = 0; rr < 4; rr++) { - index[0] = (int) (rindex1[0] + rindex2[0]) >> 1; - index[1] = (int) (rindex1[1] + rindex2[1]) >> 1; - index[2] = (int) (rindex1[2] + rindex2[2]) >> 1; - index[3] = (int) (rindex1[3] + rindex2[3]) >> 1; - index[4] = (int) (rindex1[4] + rindex2[4]) >> 1; - index[5] = (int) (rindex1[5] + rindex2[5]) >> 1; - index[6] = (int) (rindex1[6] + rindex2[6]) >> 1; - index[7] = (int) (rindex1[7] + rindex2[7]) >> 1; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - - index[0] = (int) (rindex1[0] + rindex2[0]) >> 1; - index[1] = (int) (rindex1[1] + rindex2[1]) >> 1; - index[2] = (int) (rindex1[2] + rindex2[2]) >> 1; - index[3] = (int) (rindex1[3] + rindex2[3]) >> 1; - index[4] = (int) (rindex1[4] + rindex2[4]) >> 1; - index[5] = (int) (rindex1[5] + rindex2[5]) >> 1; - index[6] = (int) (rindex1[6] + rindex2[6]) >> 1; - index[7] = (int) (rindex1[7] + rindex2[7]) >> 1; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - } - } - -#ifdef LOOSE_MPEG - } -#endif -} - - -/* - *-------------------------------------------------------------- - * - * ReconBMBlock -- - * - * Reconstructs back predicted macroblocks. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ReconBMBlock(VidStream *vid_stream, - int bnum, int recon_right_back, int recon_down_back, int zflag) -{ - int mb_row, mb_col, row, col, row_size, rr; - unsigned char *dest, *future; - int right_back, down_back, right_half_back, down_half_back; - unsigned char *rindex1, *rindex2; - unsigned char *index; - short int *blockvals; - -#ifdef LOOSE_MPEG - int illegalBlock = 0; - int maxx, maxy; - int row_start, row_end, rlast, rfirst, col_start, col_end, clast, cfirst; -#endif - - /* Calculate macroblock row and column from address. */ - - mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; - mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; - - /* If block is luminance block... */ - - if (bnum < 4) { - - /* Calculate right_back, down_bakc motion vectors. */ - - right_back = recon_right_back >> 1; - down_back = recon_down_back >> 1; - right_half_back = recon_right_back & 0x1; - down_half_back = recon_down_back & 0x1; - - /* Set dest to luminance plane of current pict image. */ - - dest = vid_stream->current->luminance; - - /* - * If future frame exists, set future to luminance plane of future frame. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->luminance; - - /* Establish row size. */ - - row_size = vid_stream->mb_width << 4; - - /* Calculate row,col of upper left pixel in block. */ - - row = mb_row << 4; - col = mb_col << 4; - if (bnum > 1) - row += 8; - if (bnum % 2) - col += 8; - -#ifdef LOOSE_MPEG - - /* Check for block illegality. */ - - maxx = lmaxx; maxy = lmaxy; - - if (row + down_back + 7 > maxy) illegalBlock |= 0x4; - else if (row + down_back < 0) illegalBlock |= 0x1; - - if (col + right_back + 7 > maxx) illegalBlock |= 0x2; - else if (col + right_back < 0) illegalBlock |= 0x8; - -#endif - - } - /* Otherwise, block is NOT luminance block, ... */ - - else { - - /* Construct motion vectors. */ - - recon_right_back /= 2; - recon_down_back /= 2; - right_back = recon_right_back >> 1; - down_back = recon_down_back >> 1; - right_half_back = recon_right_back & 0x1; - down_half_back = recon_down_back & 0x1; - - /* Establish row size. */ - - row_size = vid_stream->mb_width << 3; - - /* Calculate row,col of upper left pixel in block. */ - - row = mb_row << 3; - col = mb_col << 3; - -#ifdef LOOSE_MPEG - - /* Check for block illegality. */ - - maxx = cmaxx; maxy = cmaxy; - - if (row + down_back + 7 > maxy) illegalBlock |= 0x4; - else if (row + down_back < 0) illegalBlock |= 0x1; - - if (col + right_back + 7 > maxx) illegalBlock |= 0x2; - else if (col + right_back < 0) illegalBlock |= 0x8; - -#endif - - /* If block is Cr block... */ - - if (bnum == 4) { - - /* Set dest to Cr plane of current pict image. */ - - dest = vid_stream->current->Cr; - - /* - * If future frame exists, set future to Cr plane of future image. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->Cr; - } - /* Otherwise, block is Cb block... */ - - else { - - /* Set dest to Cb plane of current pict image. */ - - dest = vid_stream->current->Cb; - - /* - * If future frame exists, set future to Cb plane of future frame. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->Cb; - } - } - - /* For each pixel in block do... */ - -#ifdef LOOSE_MPEG - - if (illegalBlock) { - if (illegalBlock & 0x1) { - row_start = 0; - row_end = row+down_back+8; - rfirst = rlast = 8 - row_end; - } - else if (illegalBlock & 0x4) { - row_start = row + down_back; - row_end = maxy+1; - rlast = row_end - row_start - 1; - rfirst = 0; - } - else { - row_start = row+down_back; - row_end = row_start+8; - rfirst = 0; - } - - if (illegalBlock & 0x8) { - col_start = 0; - col_end = col + right_back + 8; - cfirst = clast = 8 - col_end; - } - else if (illegalBlock & 0x2) { - col_start = col + right_back; - col_end = maxx + 1; - clast = col_end - col_start - 1; - cfirst = 0; - } - else { - col_start = col + right_back; - col_end = col_start + 8; - cfirst = 0; - } - - for (rr = row_start; rr < row_end; rr++) { - rindex1 = future + (rr * row_size) + col_start; - index = dest + ((row + rfirst) * row_size) + col + cfirst; - for (cc = col_start; cc < col_end; cc++) { - *index++ = *rindex1++; - } - } - - if (illegalBlock & 0x1) { - for (rr = rlast -1; rr >=0; rr--) { - index = dest + ((row + rr) * row_size) + col; - rindex1 = dest + ((row + rlast) * row_size) + col; - for (cc = 0; cc < 8; cc ++) { - *index++ = *rindex1++; - } - } - } - else if (illegalBlock & 0x4) { - for (rr = rlast+1; rr < 8; rr++) { - index = dest + ((row + rr) * row_size) + col; - rindex1 = dest + ((row + rlast) * row_size) + col; - for (cc = 0; cc < 8; cc ++) { - *index++ = *rindex1++; - } - } - } - - if (illegalBlock & 0x2) { - for (cc = clast+1; cc < 8; cc++) { - index = dest + (row * row_size) + (col + cc); - rindex1 = dest + (row * row_size) + (col + clast); - for (rr = 0; rr < 8; rr++) { - *index = *rindex1; - index += row_size; - rindex1 += row_size; - } - } - } - else if (illegalBlock & 0x8) { - for (cc = clast-1; cc >= 0; cc--) { - index = dest + (row * row_size) + (col + cc); - rindex1 = dest + (row * row_size) + (col + clast); - for (rr = 0; rr < 8; rr++) { - *index = *rindex1; - index += row_size; - rindex1 += row_size; - } - } - } - - if (!zflag) { - for (rr = 0; rr < 8; rr++) { - index = dest + (row*row_size) + col; - blockvals = &(vid_stream->block.dct_recon[rr][0]); - index[0] += blockvals[0]; - index[1] += blockvals[1]; - index[2] += blockvals[2]; - index[3] += blockvals[3]; - index[4] += blockvals[4]; - index[5] += blockvals[5]; - index[6] += blockvals[6]; - index[7] += blockvals[7]; - } - } - } - else { - -#endif - - index = dest + (row * row_size) + col; - rindex1 = future + (row + down_back) * row_size + col + right_back; - - blockvals = &(vid_stream->block.dct_recon[0][0]); - - if ((!right_half_back) && (!down_half_back)) { - unsigned char *cm = cropTbl + MAX_NEG_CROP; - if (!zflag) - for (rr = 0; rr < 4; rr++) { - index[0] = cm[(int) rindex1[0] + (int) blockvals[0]]; - index[1] = cm[(int) rindex1[1] + (int) blockvals[1]]; - index[2] = cm[(int) rindex1[2] + (int) blockvals[2]]; - index[3] = cm[(int) rindex1[3] + (int) blockvals[3]]; - index[4] = cm[(int) rindex1[4] + (int) blockvals[4]]; - index[5] = cm[(int) rindex1[5] + (int) blockvals[5]]; - index[6] = cm[(int) rindex1[6] + (int) blockvals[6]]; - index[7] = cm[(int) rindex1[7] + (int) blockvals[7]]; - index += row_size; - rindex1 += row_size; - - index[0] = cm[(int) rindex1[0] + (int) blockvals[8]]; - index[1] = cm[(int) rindex1[1] + (int) blockvals[9]]; - index[2] = cm[(int) rindex1[2] + (int) blockvals[10]]; - index[3] = cm[(int) rindex1[3] + (int) blockvals[11]]; - index[4] = cm[(int) rindex1[4] + (int) blockvals[12]]; - index[5] = cm[(int) rindex1[5] + (int) blockvals[13]]; - index[6] = cm[(int) rindex1[6] + (int) blockvals[14]]; - index[7] = cm[(int) rindex1[7] + (int) blockvals[15]]; - blockvals += 16; - index += row_size; - rindex1 += row_size; - } - else { - if (right_back & 0x1) { - /* No alignment, use bye copy */ - for (rr = 0; rr < 4; rr++) { - index[0] = rindex1[0]; - index[1] = rindex1[1]; - index[2] = rindex1[2]; - index[3] = rindex1[3]; - index[4] = rindex1[4]; - index[5] = rindex1[5]; - index[6] = rindex1[6]; - index[7] = rindex1[7]; - index += row_size; - rindex1 += row_size; - - index[0] = rindex1[0]; - index[1] = rindex1[1]; - index[2] = rindex1[2]; - index[3] = rindex1[3]; - index[4] = rindex1[4]; - index[5] = rindex1[5]; - index[6] = rindex1[6]; - index[7] = rindex1[7]; - index += row_size; - rindex1 += row_size; - } - } else if (right_back & 0x2) { - /* Half-word bit aligned, use 16 bit copy */ - short *src = (short *)rindex1; - short *dest = (short *)index; - row_size >>= 1; - for (rr = 0; rr < 4; rr++) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_size; - src += row_size; - - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_size; - src += row_size; - } - } else { - /* Word aligned, use 32 bit copy */ - int *src = (int *)rindex1; - int *dest = (int *)index; - row_size >>= 2; - for (rr = 0; rr < 4; rr++) { - dest[0] = src[0]; - dest[1] = src[1]; - dest += row_size; - src += row_size; - - dest[0] = src[0]; - dest[1] = src[1]; - dest += row_size; - src += row_size; - } - } - } - } else { - unsigned char *cm = cropTbl + MAX_NEG_CROP; - rindex2 = rindex1 + right_half_back + (down_half_back * row_size); - if (!zflag) - for (rr = 0; rr < 4; rr++) { - index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[0]]; - index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[1]]; - index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[2]]; - index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[3]]; - index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[4]]; - index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[5]]; - index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[6]]; - index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[7]]; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - - index[0] = cm[((int) (rindex1[0] + rindex2[0]) >> 1) + blockvals[8]]; - index[1] = cm[((int) (rindex1[1] + rindex2[1]) >> 1) + blockvals[9]]; - index[2] = cm[((int) (rindex1[2] + rindex2[2]) >> 1) + blockvals[10]]; - index[3] = cm[((int) (rindex1[3] + rindex2[3]) >> 1) + blockvals[11]]; - index[4] = cm[((int) (rindex1[4] + rindex2[4]) >> 1) + blockvals[12]]; - index[5] = cm[((int) (rindex1[5] + rindex2[5]) >> 1) + blockvals[13]]; - index[6] = cm[((int) (rindex1[6] + rindex2[6]) >> 1) + blockvals[14]]; - index[7] = cm[((int) (rindex1[7] + rindex2[7]) >> 1) + blockvals[15]]; - blockvals += 16; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - } - else - for (rr = 0; rr < 4; rr++) { - index[0] = (int) (rindex1[0] + rindex2[0]) >> 1; - index[1] = (int) (rindex1[1] + rindex2[1]) >> 1; - index[2] = (int) (rindex1[2] + rindex2[2]) >> 1; - index[3] = (int) (rindex1[3] + rindex2[3]) >> 1; - index[4] = (int) (rindex1[4] + rindex2[4]) >> 1; - index[5] = (int) (rindex1[5] + rindex2[5]) >> 1; - index[6] = (int) (rindex1[6] + rindex2[6]) >> 1; - index[7] = (int) (rindex1[7] + rindex2[7]) >> 1; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - - index[0] = (int) (rindex1[0] + rindex2[0]) >> 1; - index[1] = (int) (rindex1[1] + rindex2[1]) >> 1; - index[2] = (int) (rindex1[2] + rindex2[2]) >> 1; - index[3] = (int) (rindex1[3] + rindex2[3]) >> 1; - index[4] = (int) (rindex1[4] + rindex2[4]) >> 1; - index[5] = (int) (rindex1[5] + rindex2[5]) >> 1; - index[6] = (int) (rindex1[6] + rindex2[6]) >> 1; - index[7] = (int) (rindex1[7] + rindex2[7]) >> 1; - index += row_size; - rindex1 += row_size; - rindex2 += row_size; - } - } - -#ifdef LOOSE_MPEG - } -#endif - -} - - -/* - *-------------------------------------------------------------- - * - * ReconBiMBlock -- - * - * Reconstructs bidirectionally predicted macroblocks. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ReconBiMBlock(VidStream *vid_stream, int bnum, int recon_right_for, - int recon_down_for, int recon_right_back, - int recon_down_back, int zflag) -{ - int mb_row, mb_col, row, col, row_size, rr; - unsigned char *dest, *past, *future; - int right_for, down_for, right_half_for, down_half_for; - int right_back, down_back, right_half_back, down_half_back; - unsigned char *index, *rindex1, *bindex1; - short int *blockvals; - int forw_row_start, back_row_start, forw_col_start, back_col_start; - -#ifdef LOOSE_MPEG - int illegal_forw = 0; - int illegal_back = 0; -#endif - - /* Calculate macroblock row and column from address. */ - - mb_row = vid_stream->mblock.mb_address / vid_stream->mb_width; - mb_col = vid_stream->mblock.mb_address % vid_stream->mb_width; - - /* If block is luminance block... */ - - if (bnum < 4) { - - /* - * Calculate right_for, down_for, right_half_for, down_half_for, - * right_back, down_bakc, right_half_back, and down_half_back, motion - * vectors. - */ - - right_for = recon_right_for >> 1; - down_for = recon_down_for >> 1; - right_half_for = recon_right_for & 0x1; - down_half_for = recon_down_for & 0x1; - - right_back = recon_right_back >> 1; - down_back = recon_down_back >> 1; - right_half_back = recon_right_back & 0x1; - down_half_back = recon_down_back & 0x1; - - /* Set dest to luminance plane of current pict image. */ - - dest = vid_stream->current->luminance; - - /* If past frame exists, set past to luminance plane of past frame. */ - - if (vid_stream->past != NULL) - past = vid_stream->past->luminance; - - /* - * If future frame exists, set future to luminance plane of future frame. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->luminance; - - /* Establish row size. */ - - row_size = (vid_stream->mb_width << 4); - - /* Calculate row,col of upper left pixel in block. */ - - row = (mb_row << 4); - col = (mb_col << 4); - if (bnum > 1) - row += 8; - if (bnum & 0x01) - col += 8; - - forw_col_start = col + right_for; - forw_row_start = row + down_for; - - back_col_start = col + right_back; - back_row_start = row + down_back; - -#ifdef LOOSE_MPEG - - /* Check for illegal pred. blocks. */ - - - if (forw_col_start+8 > lmaxx) illegal_forw = 1; - else if (forw_col_start < 0) illegal_forw = 1; - - if (forw_row_start+8 > lmaxy) illegal_forw = 1; - else if (forw_row_start < 0) illegal_forw = 1; - - if (back_col_start+8 > lmaxx) illegal_back = 1; - else if (back_col_start < 0) illegal_back = 1; - - if (back_row_start+8 > lmaxy) illegal_back = 1; - else if (back_row_start < 0) illegal_back = 1; - -#endif - - } - /* Otherwise, block is NOT luminance block, ... */ - - else { - - /* Construct motion vectors. */ - - recon_right_for /= 2; - recon_down_for /= 2; - right_for = recon_right_for >> 1; - down_for = recon_down_for >> 1; - right_half_for = recon_right_for & 0x1; - down_half_for = recon_down_for & 0x1; - - recon_right_back /= 2; - recon_down_back /= 2; - right_back = recon_right_back >> 1; - down_back = recon_down_back >> 1; - right_half_back = recon_right_back & 0x1; - down_half_back = recon_down_back & 0x1; - - /* Establish row size. */ - - row_size = (vid_stream->mb_width << 3); - - /* Calculate row,col of upper left pixel in block. */ - - row = (mb_row << 3); - col = (mb_col << 3); - - forw_col_start = col + right_for; - forw_row_start = row + down_for; - - back_col_start = col + right_back; - back_row_start = row + down_back; - -#ifdef LOOSE_MPEG - - /* Check for illegal pred. blocks. */ - - if (forw_col_start+8 > cmaxx) illegal_forw = 1; - else if (forw_col_start < 0) illegal_forw = 1; - - if (forw_row_start+8 > cmaxy) illegal_forw = 1; - else if (forw_row_start < 0) illegal_forw = 1; - - if (back_col_start+8 > cmaxx) illegal_back = 1; - else if (back_col_start < 0) illegal_back = 1; - - if (back_row_start+8 > cmaxy) illegal_back = 1; - else if (back_row_start < 0) illegal_back = 1; - -#endif - - /* If block is Cr block... */ - - if (bnum == 4) { - - /* Set dest to Cr plane of current pict image. */ - - dest = vid_stream->current->Cr; - - /* If past frame exists, set past to Cr plane of past image. */ - - if (vid_stream->past != NULL) - past = vid_stream->past->Cr; - - /* - * If future frame exists, set future to Cr plane of future image. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->Cr; - } - /* Otherwise, block is Cb block... */ - - else { - - /* Set dest to Cb plane of current pict image. */ - - dest = vid_stream->current->Cb; - - /* If past frame exists, set past to Cb plane of past frame. */ - - if (vid_stream->past != NULL) - past = vid_stream->past->Cb; - - /* - * If future frame exists, set future to Cb plane of future frame. - */ - - if (vid_stream->future != NULL) - future = vid_stream->future->Cb; - } - } - - /* For each pixel in block... */ - - index = dest + (row * row_size) + col; - -#ifdef LOOSE_MPEG - if (illegal_forw) - rindex1 = future + back_row_start * row_size + back_col_start; - else -#endif - rindex1 = past + forw_row_start * row_size + forw_col_start; - -#ifdef LOOSE_MPEG - if (illegal_back) - bindex1 = past + forw_row_start * row_size + forw_col_start; - else -#endif - bindex1 = future + back_row_start * row_size + back_col_start; - - blockvals = (short int *) &(vid_stream->block.dct_recon[0][0]); - - { - unsigned char *cm = cropTbl + MAX_NEG_CROP; - if (!zflag) - for (rr = 0; rr < 4; rr++) { - index[0] = cm[((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[0]]; - index[1] = cm[((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[1]]; - index[2] = cm[((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[2]]; - index[3] = cm[((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[3]]; - index[4] = cm[((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[4]]; - index[5] = cm[((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[5]]; - index[6] = cm[((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[6]]; - index[7] = cm[((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[7]]; - index += row_size; - rindex1 += row_size; - bindex1 += row_size; - - index[0] = cm[((int) (rindex1[0] + bindex1[0]) >> 1) + blockvals[8]]; - index[1] = cm[((int) (rindex1[1] + bindex1[1]) >> 1) + blockvals[9]]; - index[2] = cm[((int) (rindex1[2] + bindex1[2]) >> 1) + blockvals[10]]; - index[3] = cm[((int) (rindex1[3] + bindex1[3]) >> 1) + blockvals[11]]; - index[4] = cm[((int) (rindex1[4] + bindex1[4]) >> 1) + blockvals[12]]; - index[5] = cm[((int) (rindex1[5] + bindex1[5]) >> 1) + blockvals[13]]; - index[6] = cm[((int) (rindex1[6] + bindex1[6]) >> 1) + blockvals[14]]; - index[7] = cm[((int) (rindex1[7] + bindex1[7]) >> 1) + blockvals[15]]; - blockvals += 16; - index += row_size; - rindex1 += row_size; - bindex1 += row_size; - } - - else - for (rr = 0; rr < 4; rr++) { - index[0] = (int) (rindex1[0] + bindex1[0]) >> 1; - index[1] = (int) (rindex1[1] + bindex1[1]) >> 1; - index[2] = (int) (rindex1[2] + bindex1[2]) >> 1; - index[3] = (int) (rindex1[3] + bindex1[3]) >> 1; - index[4] = (int) (rindex1[4] + bindex1[4]) >> 1; - index[5] = (int) (rindex1[5] + bindex1[5]) >> 1; - index[6] = (int) (rindex1[6] + bindex1[6]) >> 1; - index[7] = (int) (rindex1[7] + bindex1[7]) >> 1; - index += row_size; - rindex1 += row_size; - bindex1 += row_size; - - index[0] = (int) (rindex1[0] + bindex1[0]) >> 1; - index[1] = (int) (rindex1[1] + bindex1[1]) >> 1; - index[2] = (int) (rindex1[2] + bindex1[2]) >> 1; - index[3] = (int) (rindex1[3] + bindex1[3]) >> 1; - index[4] = (int) (rindex1[4] + bindex1[4]) >> 1; - index[5] = (int) (rindex1[5] + bindex1[5]) >> 1; - index[6] = (int) (rindex1[6] + bindex1[6]) >> 1; - index[7] = (int) (rindex1[7] + bindex1[7]) >> 1; - index += row_size; - rindex1 += row_size; - bindex1 += row_size; - } - } -} - -/* - *-------------------------------------------------------------- - * - * ProcessSkippedPFrameMBlocks -- - * - * Processes skipped macroblocks in P frames. - * - * Results: - * Calculates pixel values for luminance, Cr, and Cb planes - * in current pict image for skipped macroblocks. - * - * Side effects: - * Pixel values in pict image changed. - * - *-------------------------------------------------------------- - */ - -static void -ProcessSkippedPFrameMBlocks(VidStream *vid_stream) -{ - int row_size, half_row, mb_row, mb_col, row, col, rr; - int addr, row_incr, half_row_incr, crow, ccol; - int *dest, *src, *dest1, *src1; - - /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */ - - row_size = vid_stream->mb_width << 4; - half_row = (row_size >> 1); - row_incr = row_size >> 2; - half_row_incr = half_row >> 2; - - /* For each skipped macroblock, do... */ - - for (addr = vid_stream->mblock.past_mb_addr + 1; - addr < vid_stream->mblock.mb_address; addr++) { - - /* Calculate macroblock row and col. */ - - mb_row = addr / vid_stream->mb_width; - mb_col = addr % vid_stream->mb_width; - - /* Calculate upper left pixel row,col for luminance plane. */ - - row = mb_row << 4; - col = mb_col << 4; - - - /* For each row in macroblock luminance plane... */ - - dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); - src = (int *)(vid_stream->future->luminance + (row * row_size) + col); - - for (rr = 0; rr < 8; rr++) { - - /* Copy pixel values from last I or P picture. */ - - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_incr; - src += row_incr; - - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_incr; - src += row_incr; - } - - /* - * Divide row,col to get upper left pixel of macroblock in Cr and Cb - * planes. - */ - - crow = row >> 1; - ccol = col >> 1; - - /* For each row in Cr, and Cb planes... */ - - dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); - src = (int *)(vid_stream->future->Cr + (crow * half_row) + ccol); - dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); - src1 = (int *)(vid_stream->future->Cb + (crow * half_row) + ccol); - - for (rr = 0; rr < 4; rr++) { - - /* Copy pixel values from last I or P picture. */ - - dest[0] = src[0]; - dest[1] = src[1]; - - dest1[0] = src1[0]; - dest1[1] = src1[1]; - - dest += half_row_incr; - src += half_row_incr; - dest1 += half_row_incr; - src1 += half_row_incr; - - dest[0] = src[0]; - dest[1] = src[1]; - - dest1[0] = src1[0]; - dest1[1] = src1[1]; - - dest += half_row_incr; - src += half_row_incr; - dest1 += half_row_incr; - src1 += half_row_incr; - } - - if (ditherType == MBORDERED_DITHER) { - /* - MBOrderedDitherDisplayCopy(vid_stream, addr, - 1, 0, 0, 0, 0, 0, - vid_stream->future->display, - (unsigned char *) NULL); - ditherFlags[addr] = 0; - */ - } - } - - vid_stream->mblock.recon_right_for_prev = 0; - vid_stream->mblock.recon_down_for_prev = 0; -} - - - - -/* - *-------------------------------------------------------------- - * - * ProcessSkippedBFrameMBlocks -- - * - * Processes skipped macroblocks in B frames. - * - * Results: - * Calculates pixel values for luminance, Cr, and Cb planes - * in current pict image for skipped macroblocks. - * - * Side effects: - * Pixel values in pict image changed. - * - *-------------------------------------------------------------- - */ - -static void -ProcessSkippedBFrameMBlocks(VidStream *vid_stream) -{ - int row_size, half_row, mb_row, mb_col, row, col, rr; - int right_half_for, down_half_for, c_right_half_for, c_down_half_for; - int right_half_back, down_half_back, c_right_half_back, c_down_half_back; - int addr, right_for, down_for; - int recon_right_for, recon_down_for; - int recon_right_back, recon_down_back; - int right_back, down_back; - int c_right_for, c_down_for; - int c_right_back, c_down_back; - unsigned char forw_lum[256]; - unsigned char forw_cr[64], forw_cb[64]; - unsigned char back_lum[256], back_cr[64], back_cb[64]; - int row_incr, half_row_incr; - int ccol, crow; - - /* Calculate row sizes for luminance and Cr/Cb macroblock areas. */ - - row_size = vid_stream->mb_width << 4; - half_row = (row_size >> 1); - row_incr = row_size >> 2; - half_row_incr = half_row >> 2; - - /* Establish motion vector codes based on full pixel flag. */ - - if (vid_stream->picture.full_pel_forw_vector) { - recon_right_for = vid_stream->mblock.recon_right_for_prev << 1; - recon_down_for = vid_stream->mblock.recon_down_for_prev << 1; - } else { - recon_right_for = vid_stream->mblock.recon_right_for_prev; - recon_down_for = vid_stream->mblock.recon_down_for_prev; - } - - if (vid_stream->picture.full_pel_back_vector) { - recon_right_back = vid_stream->mblock.recon_right_back_prev << 1; - recon_down_back = vid_stream->mblock.recon_down_back_prev << 1; - } else { - recon_right_back = vid_stream->mblock.recon_right_back_prev; - recon_down_back = vid_stream->mblock.recon_down_back_prev; - } - - - /* If only one motion vector, do display copy, else do full - calculation. - */ - - if (ditherType == MBORDERED_DITHER) { - if (vid_stream->mblock.bpict_past_forw && - !vid_stream->mblock.bpict_past_back) { - for (addr = vid_stream->mblock.past_mb_addr+1; - addr < vid_stream->mblock.mb_address; addr++) { - /* - MBOrderedDitherDisplayCopy(vid_stream, addr, - 1, recon_right_for, recon_down_for, - 0, 0, 0, vid_stream->past->display, - vid_stream->future->display); - ditherFlags[addr] = 0; - */ - } - return; - } - if (vid_stream->mblock.bpict_past_back && - !vid_stream->mblock.bpict_past_forw) { - for (addr = vid_stream->mblock.past_mb_addr+1; - addr < vid_stream->mblock.mb_address; addr++) { - /* - MBOrderedDitherDisplayCopy(vid_stream, addr, - 0, 0, 0, - 1, recon_right_back, recon_down_back, - vid_stream->past->display, vid_stream->future->display); - ditherFlags[addr] = 0; - */ - } - return; - } - } - - /* Calculate motion vectors. */ - - if (vid_stream->mblock.bpict_past_forw) { - right_for = recon_right_for >> 1; - down_for = recon_down_for >> 1; - right_half_for = recon_right_for & 0x1; - down_half_for = recon_down_for & 0x1; - - recon_right_for /= 2; - recon_down_for /= 2; - c_right_for = recon_right_for >> 1; - c_down_for = recon_down_for >> 1; - c_right_half_for = recon_right_for & 0x1; - c_down_half_for = recon_down_for & 0x1; - - } - if (vid_stream->mblock.bpict_past_back) { - right_back = recon_right_back >> 1; - down_back = recon_down_back >> 1; - right_half_back = recon_right_back & 0x1; - down_half_back = recon_down_back & 0x1; - - recon_right_back /= 2; - recon_down_back /= 2; - c_right_back = recon_right_back >> 1; - c_down_back = recon_down_back >> 1; - c_right_half_back = recon_right_back & 0x1; - c_down_half_back = recon_down_back & 0x1; - - } - /* For each skipped macroblock, do... */ - - for (addr = vid_stream->mblock.past_mb_addr + 1; - addr < vid_stream->mblock.mb_address; addr++) { - - /* Calculate macroblock row and col. */ - - mb_row = addr / vid_stream->mb_width; - mb_col = addr % vid_stream->mb_width; - - /* Calculate upper left pixel row,col for luminance plane. */ - - row = mb_row << 4; - col = mb_col << 4; - crow = row / 2; - ccol = col / 2; - - /* If forward predicted, calculate prediction values. */ - - if (vid_stream->mblock.bpict_past_forw) { - - ReconSkippedBlock(vid_stream->past->luminance, forw_lum, - row, col, row_size, right_for, down_for, - right_half_for, down_half_for, 16); - ReconSkippedBlock(vid_stream->past->Cr, forw_cr, crow, - ccol, half_row, - c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8); - ReconSkippedBlock(vid_stream->past->Cb, forw_cb, crow, - ccol, half_row, - c_right_for, c_down_for, c_right_half_for, c_down_half_for, 8); - } - /* If back predicted, calculate prediction values. */ - - if (vid_stream->mblock.bpict_past_back) { - ReconSkippedBlock(vid_stream->future->luminance, back_lum, - row, col, row_size, right_back, down_back, - right_half_back, down_half_back, 16); - ReconSkippedBlock(vid_stream->future->Cr, back_cr, crow, - ccol, half_row, - c_right_back, c_down_back, - c_right_half_back, c_down_half_back, 8); - ReconSkippedBlock(vid_stream->future->Cb, back_cb, crow, - ccol, half_row, - c_right_back, c_down_back, - c_right_half_back, c_down_half_back, 8); - } - if (vid_stream->mblock.bpict_past_forw && - !vid_stream->mblock.bpict_past_back) { - - int *dest, *dest1; - int *src, *src1; - dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); - src = (int *)forw_lum; - - for (rr = 0; rr < 16; rr++) { - - /* memcpy(dest, forw_lum+(rr<<4), 16); */ - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_incr; - src += 4; - } - - dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); - dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); - src = (int *)forw_cr; - src1 = (int *)forw_cb; - - for (rr = 0; rr < 8; rr++) { - /* - * memcpy(dest, forw_cr+(rr<<3), 8); memcpy(dest1, forw_cb+(rr<<3), - * 8); - */ - - dest[0] = src[0]; - dest[1] = src[1]; - - dest1[0] = src1[0]; - dest1[1] = src1[1]; - - dest += half_row_incr; - dest1 += half_row_incr; - src += 2; - src1 += 2; - } - } else if (vid_stream->mblock.bpict_past_back && - !vid_stream->mblock.bpict_past_forw) { - - int *src, *src1; - int *dest, *dest1; - dest = (int *)(vid_stream->current->luminance + (row * row_size) + col); - src = (int *)back_lum; - - for (rr = 0; rr < 16; rr++) { - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - dest[3] = src[3]; - dest += row_incr; - src += 4; - } - - - dest = (int *)(vid_stream->current->Cr + (crow * half_row) + ccol); - dest1 = (int *)(vid_stream->current->Cb + (crow * half_row) + ccol); - src = (int *)back_cr; - src1 = (int *)back_cb; - - for (rr = 0; rr < 8; rr++) { - /* - * memcpy(dest, back_cr+(rr<<3), 8); memcpy(dest1, back_cb+(rr<<3), - * 8); - */ - - dest[0] = src[0]; - dest[1] = src[1]; - - dest1[0] = src1[0]; - dest1[1] = src1[1]; - - dest += half_row_incr; - dest1 += half_row_incr; - src += 2; - src1 += 2; - } - } else { - - unsigned char *src1, *src2, *src1a, *src2a; - unsigned char *dest, *dest1; - dest = vid_stream->current->luminance + (row * row_size) + col; - src1 = forw_lum; - src2 = back_lum; - - for (rr = 0; rr < 16; rr++) { - dest[0] = (int) (src1[0] + src2[0]) >> 1; - dest[1] = (int) (src1[1] + src2[1]) >> 1; - dest[2] = (int) (src1[2] + src2[2]) >> 1; - dest[3] = (int) (src1[3] + src2[3]) >> 1; - dest[4] = (int) (src1[4] + src2[4]) >> 1; - dest[5] = (int) (src1[5] + src2[5]) >> 1; - dest[6] = (int) (src1[6] + src2[6]) >> 1; - dest[7] = (int) (src1[7] + src2[7]) >> 1; - dest[8] = (int) (src1[8] + src2[8]) >> 1; - dest[9] = (int) (src1[9] + src2[9]) >> 1; - dest[10] = (int) (src1[10] + src2[10]) >> 1; - dest[11] = (int) (src1[11] + src2[11]) >> 1; - dest[12] = (int) (src1[12] + src2[12]) >> 1; - dest[13] = (int) (src1[13] + src2[13]) >> 1; - dest[14] = (int) (src1[14] + src2[14]) >> 1; - dest[15] = (int) (src1[15] + src2[15]) >> 1; - dest += row_size; - src1 += 16; - src2 += 16; - } - - - dest = vid_stream->current->Cr + (crow * half_row) + ccol; - dest1 = vid_stream->current->Cb + (crow * half_row) + ccol; - src1 = forw_cr; - src2 = back_cr; - src1a = forw_cb; - src2a = back_cb; - - for (rr = 0; rr < 8; rr++) { - dest[0] = (int) (src1[0] + src2[0]) >> 1; - dest[1] = (int) (src1[1] + src2[1]) >> 1; - dest[2] = (int) (src1[2] + src2[2]) >> 1; - dest[3] = (int) (src1[3] + src2[3]) >> 1; - dest[4] = (int) (src1[4] + src2[4]) >> 1; - dest[5] = (int) (src1[5] + src2[5]) >> 1; - dest[6] = (int) (src1[6] + src2[6]) >> 1; - dest[7] = (int) (src1[7] + src2[7]) >> 1; - dest += half_row; - src1 += 8; - src2 += 8; - - dest1[0] = (int) (src1a[0] + src2a[0]) >> 1; - dest1[1] = (int) (src1a[1] + src2a[1]) >> 1; - dest1[2] = (int) (src1a[2] + src2a[2]) >> 1; - dest1[3] = (int) (src1a[3] + src2a[3]) >> 1; - dest1[4] = (int) (src1a[4] + src2a[4]) >> 1; - dest1[5] = (int) (src1a[5] + src2a[5]) >> 1; - dest1[6] = (int) (src1a[6] + src2a[6]) >> 1; - dest1[7] = (int) (src1a[7] + src2a[7]) >> 1; - dest1 += half_row; - src1a += 8; - src2a += 8; - } - } - - if (ditherType == MBORDERED_DITHER) { - ditherFlags[addr] = 1; - } - } -} - - - - -/* - *-------------------------------------------------------------- - * - * ReconSkippedBlock -- - * - * Reconstructs predictive block for skipped macroblocks - * in B Frames. - * - * Results: - * No return values. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ReconSkippedBlock(unsigned char *source, unsigned char *dest, - int row, int col, int row_size, int right, int down, - int right_half, int down_half, int width) -{ - int rr; - unsigned char *source2; - - source += ((row + down) * row_size) + col + right; - - if (width == 16) { - if ((!right_half) && (!down_half)) { - if (right & 0x1) { - /* No alignment, use bye copy */ - for (rr = 0; rr < 16; rr++) { - dest[0] = source[0]; - dest[1] = source[1]; - dest[2] = source[2]; - dest[3] = source[3]; - dest[4] = source[4]; - dest[5] = source[5]; - dest[6] = source[6]; - dest[7] = source[7]; - dest[8] = source[8]; - dest[9] = source[9]; - dest[10] = source[10]; - dest[11] = source[11]; - dest[12] = source[12]; - dest[13] = source[13]; - dest[14] = source[14]; - dest[15] = source[15]; - dest += 16; - source += row_size; - } - } else if (right & 0x2) { - /* Half-word bit aligned, use 16 bit copy */ - short *src = (short *)source; - short *d = (short *)dest; - row_size >>= 1; - for (rr = 0; rr < 16; rr++) { - d[0] = src[0]; - d[1] = src[1]; - d[2] = src[2]; - d[3] = src[3]; - d[4] = src[4]; - d[5] = src[5]; - d[6] = src[6]; - d[7] = src[7]; - d += 8; - src += row_size; - } - } else { - /* Word aligned, use 32 bit copy */ - int *src = (int *)source; - int *d = (int *)dest; - row_size >>= 2; - for (rr = 0; rr < 16; rr++) { - d[0] = src[0]; - d[1] = src[1]; - d[2] = src[2]; - d[3] = src[3]; - d += 4; - src += row_size; - } - } - } else { - source2 = source + right_half + (row_size * down_half); - for (rr = 0; rr < width; rr++) { - dest[0] = (int) (source[0] + source2[0]) >> 1; - dest[1] = (int) (source[1] + source2[1]) >> 1; - dest[2] = (int) (source[2] + source2[2]) >> 1; - dest[3] = (int) (source[3] + source2[3]) >> 1; - dest[4] = (int) (source[4] + source2[4]) >> 1; - dest[5] = (int) (source[5] + source2[5]) >> 1; - dest[6] = (int) (source[6] + source2[6]) >> 1; - dest[7] = (int) (source[7] + source2[7]) >> 1; - dest[8] = (int) (source[8] + source2[8]) >> 1; - dest[9] = (int) (source[9] + source2[9]) >> 1; - dest[10] = (int) (source[10] + source2[10]) >> 1; - dest[11] = (int) (source[11] + source2[11]) >> 1; - dest[12] = (int) (source[12] + source2[12]) >> 1; - dest[13] = (int) (source[13] + source2[13]) >> 1; - dest[14] = (int) (source[14] + source2[14]) >> 1; - dest[15] = (int) (source[15] + source2[15]) >> 1; - dest += width; - source += row_size; - source2 += row_size; - } - } - } else { /* (width == 8) */ - assert(width == 8); - if ((!right_half) && (!down_half)) { - if (right & 0x1) { - for (rr = 0; rr < width; rr++) { - dest[0] = source[0]; - dest[1] = source[1]; - dest[2] = source[2]; - dest[3] = source[3]; - dest[4] = source[4]; - dest[5] = source[5]; - dest[6] = source[6]; - dest[7] = source[7]; - dest += 8; - source += row_size; - } - } else if (right & 0x02) { - short *d = (short *)dest; - short *src = (short *)source; - row_size >>= 1; - for (rr = 0; rr < width; rr++) { - d[0] = src[0]; - d[1] = src[1]; - d[2] = src[2]; - d[3] = src[3]; - d += 4; - src += row_size; - } - } else { - int *d = (int *)dest; - int *src = (int *)source; - row_size >>= 2; - for (rr = 0; rr < width; rr++) { - d[0] = src[0]; - d[1] = src[1]; - d += 2; - src += row_size; - } - } - } else { - source2 = source + right_half + (row_size * down_half); - for (rr = 0; rr < width; rr++) { - dest[0] = (int) (source[0] + source2[0]) >> 1; - dest[1] = (int) (source[1] + source2[1]) >> 1; - dest[2] = (int) (source[2] + source2[2]) >> 1; - dest[3] = (int) (source[3] + source2[3]) >> 1; - dest[4] = (int) (source[4] + source2[4]) >> 1; - dest[5] = (int) (source[5] + source2[5]) >> 1; - dest[6] = (int) (source[6] + source2[6]) >> 1; - dest[7] = (int) (source[7] + source2[7]) >> 1; - dest += width; - source += row_size; - source2 += row_size; - } - } - } -} - -/* - *-------------------------------------------------------------- - * - * ToggleBFlag -- - * - * Called to set no b frame processing flag. - * - * Results: - * No_B_Flag flag is toggled from present value to opposite value. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -ToggleBFlag() -{ - if (No_B_Flag) { - No_B_Flag = 0; - } else - No_B_Flag = 1; -} - - - - -/* - *-------------------------------------------------------------- - * - * TogglePFlag -- - * - * Called to set no p frame processing flag. - * - * Results: - * No_P_Flag flag is toggled from present value to opposite value. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -TogglePFlag() -{ - if (No_P_Flag) { - No_P_Flag = 0; - } else - No_P_Flag = 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h deleted file mode 100644 index 13096759702..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/video.h +++ /dev/null @@ -1,285 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -#include <stdio.h> -#include <setjmp.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#ifdef SH_MEM -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> -#endif - -/* X11/xmd.h correctly defines INT32, etc */ -#ifndef XMD_H -typedef int INT32; -typedef short INT16; -typedef char INT8; -#endif -typedef unsigned int UINT32; -typedef unsigned short UINT16; -typedef unsigned char UINT8; - -/* Define Parsing error codes. */ - -#define SKIP_PICTURE -10 -#define SKIP_TO_START_CODE -1 -#define PARSE_OK 1 - -/* Define BOOLEAN, TRUE, and FALSE. */ - -#define BOOLEAN int -/*#define TRUE 1 - - #define FALSE 0*/ - -/* Set ring buffer size. */ - -#define RING_BUF_SIZE 5 - -/* Macros for picture code type. */ - -#define I_TYPE 1 -#define P_TYPE 2 -#define B_TYPE 3 - -/* Start codes. */ - -#define SEQ_END_CODE 0x000001b7 -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 -#define SLICE_MIN_START_CODE 0x00000101 -#define SLICE_MAX_START_CODE 0x000001af -#define EXT_START_CODE 0x000001b5 -#define USER_START_CODE 0x000001b2 - -/* Number of macroblocks to process in one call to mpegVidRsrc. */ - -#define MB_QUANTUM 100 - -/* Macros used with macroblock address decoding. */ - -#define MB_STUFFING 34 -#define MB_ESCAPE 35 - -/* Lock flags for pict images. */ - -#define DISPLAY_LOCK 0x01 -#define PAST_LOCK 0x02 -#define FUTURE_LOCK 0x04 - -#define HYBRID_DITHER 0 -#define HYBRID2_DITHER 1 -#define FS4_DITHER 2 -#define FS2_DITHER 3 -#define FS2FAST_DITHER 4 -#define Twox2_DITHER 5 -#define GRAY_DITHER 6 -#define FULL_COLOR_DITHER 7 -#define NO_DITHER 8 -#define ORDERED_DITHER 9 -#define MONO_DITHER 10 -#define MONO_THRESHOLD 11 -#define ORDERED2_DITHER 12 -#define MBORDERED_DITHER 13 - -/* External declaration of row,col to zig zag conversion matrix. */ - -extern int scan[][8]; - -/* Temporary definition of time stamp structure. */ - -typedef int TimeStamp; - -/* Structure with reconstructed pixel values. */ - -typedef struct pict_image { - int sh, gop, frame, display, future, past; - int locked; /* lock flag. */ - unsigned char *luminance; /* Luminance plane. */ - unsigned char *Cr; /* Cr plane. */ - unsigned char *Cb; /* Cb plane. */ -} PictImage; - -/* Group of pictures structure. */ - -typedef struct GoP { - BOOLEAN drop_flag; /* Flag indicating dropped frame. */ - unsigned int tc_hours; /* Hour component of time code. */ - unsigned int tc_minutes; /* Minute component of time code. */ - unsigned int tc_seconds; /* Second component of time code. */ - unsigned int tc_pictures; /* Picture counter of time code. */ - BOOLEAN closed_gop; /* Indicates no pred. vectors to - previous group of pictures. */ - BOOLEAN broken_link; /* B frame unable to be decoded. */ - char *ext_data; /* Extension data. */ - char *user_data; /* User data. */ -} GoP; - -/* Picture structure. */ - -typedef struct pict { - unsigned int temp_ref; /* Temporal reference. */ - unsigned int code_type; /* Frame type: P, B, I */ - unsigned int vbv_delay; /* Buffer delay. */ - BOOLEAN full_pel_forw_vector; /* Forw. vectors specified in full - pixel values flag. */ - unsigned int forw_r_size; /* Used for vector decoding. */ - unsigned int forw_f; /* Used for vector decoding. */ - BOOLEAN full_pel_back_vector; /* Back vectors specified in full - pixel values flag. */ - unsigned int back_r_size; /* Used in decoding. */ - unsigned int back_f; /* Used in decoding. */ - char *extra_info; /* Extra bit picture info. */ - char *ext_data; /* Extension data. */ - char *user_data; /* User data. */ -} Pict; - -/* Slice structure. */ - -typedef struct slice { - unsigned int vert_pos; /* Vertical position of slice. */ - unsigned int quant_scale; /* Quantization scale. */ - char *extra_info; /* Extra bit slice info. */ -} Slice; - -/* Macroblock structure. */ - -typedef struct macroblock { - int mb_address; /* Macroblock address. */ - int past_mb_addr; /* Previous mblock address. */ - int motion_h_forw_code; /* Forw. horiz. motion vector code. */ - unsigned int motion_h_forw_r; /* Used in decoding vectors. */ - int motion_v_forw_code; /* Forw. vert. motion vector code. */ - unsigned int motion_v_forw_r; /* Used in decdoinge vectors. */ - int motion_h_back_code; /* Back horiz. motion vector code. */ - unsigned int motion_h_back_r; /* Used in decoding vectors. */ - int motion_v_back_code; /* Back vert. motion vector code. */ - unsigned int motion_v_back_r; /* Used in decoding vectors. */ - unsigned int cbp; /* Coded block pattern. */ - BOOLEAN mb_intra; /* Intracoded mblock flag. */ - BOOLEAN bpict_past_forw; /* Past B frame forw. vector flag. */ - BOOLEAN bpict_past_back; /* Past B frame back vector flag. */ - int past_intra_addr; /* Addr of last intracoded mblock. */ - int recon_right_for_prev; /* Past right forw. vector. */ - int recon_down_for_prev; /* Past down forw. vector. */ - int recon_right_back_prev; /* Past right back vector. */ - int recon_down_back_prev; /* Past down back vector. */ -} Macroblock; - -/* Block structure. */ - -typedef struct block { - short int dct_recon[8][8]; /* Reconstructed dct coeff matrix. */ - short int dct_dc_y_past; /* Past lum. dc dct coefficient. */ - short int dct_dc_cr_past; /* Past cr dc dct coefficient. */ - short int dct_dc_cb_past; /* Past cb dc dct coefficient. */ -} Block; - -/* Video stream structure. */ - -typedef struct vid_stream { - int shid; /* id of latest sequence header */ - unsigned int h_size; /* Horiz. size in pixels. */ - unsigned int v_size; /* Vert. size in pixels. */ - unsigned int mb_height; /* Vert. size in mblocks. */ - unsigned int mb_width; /* Horiz. size in mblocks. */ - unsigned char aspect_ratio; /* Code for aspect ratio. */ - unsigned char picture_rate; /* Code for picture rate. */ - unsigned int bit_rate; /* Bit rate. */ - unsigned int vbv_buffer_size; /* Minimum buffer size. */ - BOOLEAN const_param_flag; /* Contrained parameter flag. */ - unsigned char intra_quant_matrix[8][8]; /* Quantization matrix for - intracoded frames. */ - unsigned char non_intra_quant_matrix[8][8]; /* Quanitization matrix for - non intracoded frames. */ - char *ext_data; /* Extension data. */ - char *user_data; /* User data. */ - int gopid; /* id of latest group id */ - GoP group; /* Current group of pict. */ - Pict picture; /* Current picture. */ - Slice slice; /* Current slice. */ - Macroblock mblock; /* Current macroblock. */ - Block block; /* Current block. */ - int state; /* State of decoding. */ - int bit_offset; /* Bit offset in stream. */ - unsigned int *buffer; /* Pointer to next byte in - buffer. */ - int buf_length; /* Length of remaining buffer.*/ - unsigned int *buf_start; /* Pointer to buffer start. */ - int max_buf_length; /* Max lenght of buffer. */ - PictImage *past; /* Past predictive frame. */ - PictImage *future; /* Future predictive frame. */ - PictImage *current; /* Current frame. */ - PictImage *ring[RING_BUF_SIZE]; /* Ring buffer of frames. */ -} VidStream; - -/* Declaration of global pointer to current video stream. */ - -extern VidStream *curVidStream; - -/* Declarataion of global display pointer. */ -extern Display *display; - -/* Shared memory flag. */ -extern int shmemFlag; - -/* Quiet mode flag. */ -extern int quietFlag; - -/* Dither flags external declaration. */ -extern char *ditherFlags; - -/* Definition of Contant integer scale factor. */ - -#define CONST_BITS 13 - -/* Misc DCT definitions */ -#define DCTSIZE 8 /* The basic DCT block is 8x8 samples */ -#define DCTSIZE2 64 /* DCTSIZE squared; # of elements in a block */ - -#define GLOBAL /* a function referenced thru EXTERNs */ - -typedef short DCTELEM; -typedef DCTELEM DCTBLOCK[DCTSIZE2]; - - -#ifdef SH_MEM -extern int gXErrorFlag; -#endif - -extern double realTimeStart; -extern int totNumFrames; -extern int loopFlag; -extern int noDisplayFlag; -extern jmp_buf env; - -#ifdef ANALYSIS -extern unsigned int bitCount; -extern int showEachFlag; -extern unsigned int cacheHit[8][8]; -extern unsigned int cacheMiss[8][8]; -#endif - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp deleted file mode 100644 index 2248bb52ce3..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_client/vp.cpp +++ /dev/null @@ -1,916 +0,0 @@ -/* $Id$ */ -/* - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include <stdlib.h> -/* -#include <sys/types.h> -#include <sys/socket.h> -*/ -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#ifdef SH_MEM /* this is already defined in video.h */ -#include <sys/ipc.h> -#include <sys/shm.h> -#include <X11/extensions/XShm.h> -#endif - -#include "include/common.h" -#include "newproto.h" -#include "global.h" -#include "dither.h" -#include "video.h" - -#include <math.h> -#include "proto.h" -#include "ui.h" - -/* Declaration of global variable to hold dither info. */ - -extern int ditherType; - -/* Structures used by the X server. */ - -extern Display *display; -extern Colormap cmap; - -static int cmdSocket = -1; -static int win_width, win_height; -static Window window; -static GC gc; - -static int usingShm = 0; -#ifdef SH_MEM -static XShmSegmentInfo shminfo; /* Segment info. */ -#endif -static XImage *ximage = NULL; - - -/* - *-------------------------------------------------------------- - * - * InitColor -- - * - * Initialized lum, cr, and cb quantized range value arrays. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void -InitColor() -{ - int i; - - for (i=0; i<LUM_RANGE; i++) { - lum_values[i] = ((i * 256) / (LUM_RANGE)) + (256/(LUM_RANGE*2)); - } - - for (i=0; i<CR_RANGE; i++) { - cr_values[i] = ((i * 256) / (CR_RANGE)) + (256/(CR_RANGE*2)); - } - - for (i=0; i<CB_RANGE; i++) { - cb_values[i] = ((i * 256) / (CB_RANGE)) + (256/(CB_RANGE*2)); - } - -} - - -/* - *-------------------------------------------------------------- - * - * ConvertColor -- - * - * Given a l, cr, cb tuple, converts it to r,g,b. - * - * Results: - * r,g,b values returned in pointers passed as parameters. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -static void -ConvertColor(unsigned char l, unsigned char cr, unsigned char cb, - unsigned char *r, unsigned char *g, unsigned char *b) -{ - double fl, fcr, fcb, fr, fg, fb; - - fl = (double) l; - fcr = ((double) cr) - 128.0; - fcb = ((double) cb) - 128.0; - - - fr = fl + (1.40200 * fcb); - fg = fl - (0.71414 * fcb) - (0.34414 * fcr); - fb = fl + (1.77200 * fcr); - - if (fr < 0.0) fr = 0.0; - else if (fr > 255.0) fr = 255.0; - - if (fg < 0.0) fg = 0.0; - else if (fg > 255.0) fg = 255.0; - - if (fb < 0.0) fb = 0.0; - else if (fb > 255.0) fb = 255.0; - - *r = (unsigned char) fr; - *g = (unsigned char) fg; - *b = (unsigned char) fb; - -} - -#ifdef SH_MEM - -int gXErrorFlag = 0; - -int HandleXError(Display * dpy, XErrorEvent * event) -{ - gXErrorFlag = 1; - return 0; -} - -void InstallXErrorHandler() -{ - int HandleXError(Display *,XErrorEvent *); - - XSetErrorHandler(HandleXError); - XFlush(display); -} - -void DeInstallXErrorHandler() -{ - XSetErrorHandler(NULL); - XFlush(display); -} -#endif - -/* - *-------------------------------------------------------------- - * - * MakeWindow -- - * - * Create X Window for image display - * - * Results: - * Read the code. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -#ifdef SH_MEM -int CompletionType = -1; -#endif - -// int XShmGetEventBase (Display*); - -static void -MakeWindow(void) -{ - - XSizeHints hint; - unsigned int fg, bg; - char *hello = "MPEG Play"; - int screen; - - if (ditherType == NO_DITHER) return; -/* - UICreate(); -*/ - -#ifdef SH_MEM - if (shmemFlag && display != NULL) - { - if (!XShmQueryExtension(display)) - { - shmemFlag = 0; - fprintf(stderr, "VP: Shared memory not supported, Reverting to normal Xlib.\n"); - } - else - { - shmemFlag = 1; - /* - fprintf(stderr, "VP: try using shared mem, but STOPPED temporarily.\n"); - shmemFlag = 0; - */ - } - } - else if (shmemFlag) - { - fprintf(stderr, "VP unexpected: display is NULL.\n"); - exit(1); - } - if(shmemFlag) - CompletionType = /*XShmGetEventBase(display) +*/ ShmCompletion; -#endif - - screen = DefaultScreen (display); - - /* Fill in hint structure */ - - hint.x = 0; - hint.y = 0; - hint.width = 150; - hint.height = 150; - hint.flags = PPosition | PSize; - - /* Get some colors */ - - bg = WhitePixel (display, screen); - fg = BlackPixel (display, screen); - - /* Make the window */ - - if (ditherType == FULL_COLOR_DITHER) { - window = CreateFullColorWindow (display, hint.x, hint.y, hint.width, hint.height); - if (window == 0) { - fprintf (stderr, "-color option only valid on full color display\n"); - exit (-1); - } - } else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD) { - window = XCreateSimpleWindow (display, - MonitorWindow(), - hint.x, hint.y, - hint.width, hint.height, - 4, fg, bg); - UISetwin(window); - } else { - XVisualInfo vinfo; - - if (!XMatchVisualInfo (display, screen, 8, PseudoColor, - &vinfo)) { - - if (!XMatchVisualInfo(display, screen, 8, GrayScale, - &vinfo)) { - fprintf(stderr, "It seems you have a true-color/mono monitor,\n"); - fprintf(stderr, "please try 'vcr -dither color' or 'vcr -dither mono'\n"); - exit(-1); - } - } - - window = XCreateSimpleWindow (display, - MonitorWindow(), - hint.x, hint.y, - hint.width, hint.height, - 4, fg, bg); - UISetwin(window); - } - - XSelectInput(display, window, StructureNotifyMask); - - /* Tell other applications about this window */ - - XSetStandardProperties (display, window, hello, hello, None, NULL, 0, &hint); - - /* Map window. */ - - XMapWindow(display, window); - - /* Wait for map. */ - while(1) { - XEvent xev; - - XNextEvent(display, &xev); - if(xev.type == MapNotify && xev.xmap.event == window) - break; - } - XSelectInput(display, window, NoEventMask); -} - - -/* - *-------------------------------------------------------------- - * - * InitDisplay -- - * - * Initialized display, sets up colormap, etc. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - - -static char window_name[64]; -#include <string.h> - -void InitDisplay(char *name) -{ - - int ncolors = LUM_RANGE*CB_RANGE*CR_RANGE; - XColor xcolor; - int i, lum_num, cr_num, cb_num; - unsigned char r, g, b; - Colormap dcmap; - - if (ditherType == NO_DITHER) return; - - strcpy(window_name, name); - - MakeWindow(); - - gc = XCreateGC(display, window, 0, 0); - - dcmap = cmap = XDefaultColormap(display, DefaultScreen(display)); - - xcolor.flags = DoRed | DoGreen | DoBlue; - - retry_alloc_colors: - for (i=0; i<ncolors; i++) { - - lum_num = (i / (CR_RANGE*CB_RANGE))%LUM_RANGE; - cr_num = (i / CB_RANGE)%CR_RANGE; - cb_num = i % CB_RANGE; - - ConvertColor(lum_values[lum_num], cr_values[cr_num], cb_values[cb_num], &r, &g, &b); - - xcolor.red = r * 256; - xcolor.green = g * 256; - xcolor.blue = b * 256; - - if(XAllocColor(display, cmap, &xcolor) == 0 && cmap == dcmap) { - int j; - unsigned long tmp_pixel; - XWindowAttributes xwa; - - Fprintf(stderr, "Using private colormap.\n"); - - /* Free colors. */ - for(j = 0; j < i; j ++) { - tmp_pixel = pixel[j]; - XFreeColors(display, cmap, &tmp_pixel, 1, 0); - } - - XGetWindowAttributes(display, window, &xwa); - cmap = XCreateColormap(display, window, xwa.visual, AllocNone); - XSetWindowColormap(display, window, cmap); - UISetColormap(); - - goto retry_alloc_colors; - } - pixel[i] = xcolor.pixel; - } - - /* - Fprintf(stderr, "Pixel values allocated for colormap:"); - for (i = 0; i < ncolors; i++) { - if (!(i % 20)) Fprintf(stderr, "\n"); - Fprintf(stderr, "%3d ", pixel[i]); - } - */ - - ximage = NULL; -} - - -/* - *-------------------------------------------------------------- - * - * InitGrayDisplay -- - * - * Initialized display for gray scale dither. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -#define NUM_COLORS 128 - -void InitGrayDisplay(char *name) -{ - int ncolors = NUM_COLORS; - XColor xcolor; - int i; - Colormap dcmap; - - MakeWindow(); - - gc = XCreateGC(display, window, 0, 0); - - dcmap = cmap = XDefaultColormap(display, DefaultScreen(display)); - - xcolor.flags = DoRed | DoGreen | DoBlue; - - retry_alloc_grays: - for (i=0; i<ncolors; i++) { - - xcolor.red = (i*2) * 256; - xcolor.green = (i*2) * 256; - xcolor.blue = (i*2) * 256; - - if(XAllocColor(display, cmap, &xcolor) == 0 && cmap == dcmap) { - int j; - unsigned long tmp_pixel; - XWindowAttributes xwa; - - Fprintf(stderr, "Using private colormap.\n"); - - /* Free colors. */ - for(j = 0; j < i; j ++) { - tmp_pixel = pixel[j*2]; - XFreeColors(display, cmap, &tmp_pixel, 1, 0); - } - - XGetWindowAttributes(display, window, &xwa); - cmap = XCreateColormap(display, window, xwa.visual, AllocNone); - XSetWindowColormap(display, window, cmap); - UISetColormap(); - - goto retry_alloc_grays; - } - pixel[(i*2)] = xcolor.pixel; - pixel[(i*2)+1] = xcolor.pixel; - } - - ximage = NULL; -} - - -/* - *-------------------------------------------------------------- - * - * InitMonoDisplay -- - * - * Initialized display for monochrome dither. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void InitMonoDisplay(char *name) -{ - XGCValues xgcv; - - MakeWindow(); - - xgcv.background = BlackPixel(display, DefaultScreen(display)); - xgcv.foreground = WhitePixel(display, DefaultScreen(display)); - - gc = XCreateGC(display, window, GCForeground | GCBackground, &xgcv); - - ximage = NULL; -} - - -/* - *-------------------------------------------------------------- - * - * InitColorDisplay -- - * - * Initialized display for full color output. - * - * Results: - * None. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ - -void InitColorDisplay(char *name) -{ - - MakeWindow(); - - gc = XCreateGC(display, window, 0, 0); - ximage = NULL; -} - - -static void ClearWindow(void) -{ - int size; - char * data; - if ((ditherType == Twox2_DITHER) || (ditherType == FULL_COLOR_DITHER)) - size = win_width * win_height * 4; - else - size = win_width * win_height; - data = (char *)malloc(size); - if (data != NULL) { - memset(data, 0, size); - ximage->data = data; - XPutImage(display, window, gc, ximage, 0, 0, 0, 0, - ximage->width, ximage->height); - XFlush(display); - ximage->data = NULL; - free(data); - } -} - - -void VPresizeWindow(int h, int w) -{ - int i; - char dummy; - Visual *fc_visual; - int depth; - static int ph = 0; - static int pw = 0; - - if (ph == h && pw == w) { - ClearWindow(); - return; - } - ph = h; - pw = w; - - /* Excerpt from man page of XDestroyImage(3X11): - Note that when the image is created using XCreateImage(), - XGetImage(), or XSubImage(), the destroy procedure that the - XDestroyImage function call frees both the image structure - and the data pointed to by the image structure. */ - if (ximage != NULL) ximage->data = NULL; - - if (ditherType == NO_DITHER) return; - - win_width = ((w + 15)>>4)<<4; - win_height = ((h + 15)>>4)<<4; - - i = (ditherType == Twox2_DITHER) ? 2 : 1; - XResizeWindow(display, window, w*i, h*i); - UIMinsize(w*i, h*i); - - /* ximage allocate/resize */ - -#ifdef SH_MEM - if (shmemFlag && display != NULL) - { - InstallXErrorHandler(); - } -#endif - - if (ximage != NULL) - { -#ifdef SH_MEM - if (shmemFlag && usingShm == 1) - { - XDestroyImage(ximage); - ximage = NULL; - } - else -#endif - { - XDestroyImage(ximage); - ximage = NULL; - } - } -#ifdef SH_MEM - if (shmemFlag) - { - /* - Visual *fc_visual; - int depth; - Visual *FindFullColorVisual(); - */ - usingShm = 1; - - if (ditherType == Twox2_DITHER) - { - ximage = XShmCreateImage(display, None, 8, ZPixmap, NULL, - &(shminfo), win_width * 2, win_height * 2); - } - else if (ditherType == FULL_COLOR_DITHER) - { - fc_visual = FindFullColorVisual(display, &depth); - ximage = XShmCreateImage(display, fc_visual, depth, ZPixmap, - NULL, &(shminfo), win_width, win_height); - } - else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD) - { - ximage = XShmCreateImage(display, None, 1, XYBitmap, - NULL, &(shminfo), win_width, win_height); - } - else - { - ximage = XShmCreateImage(display, None, 8, ZPixmap, NULL, - &(shminfo), win_width, win_height); - } - if (ximage == NULL) - { - fprintf(stderr, "Shared memory error, disabling.\n"); - goto shmemerror; - } - - if (gXErrorFlag) - { - XDestroyImage(ximage); - ximage = NULL; - fprintf(stderr, "Shared memory error, disabling.\n"); - gXErrorFlag = 0; - goto shmemerror; - } - } - else -#endif - { -shmemerror: - - usingShm = 0; - - if (ditherType == Twox2_DITHER) - { - ximage = XCreateImage(display, None, 8, ZPixmap, 0, &dummy, - win_width * 2, - win_height * 2, 8, 0); - } - else if (ditherType == FULL_COLOR_DITHER) - { - fc_visual = FindFullColorVisual(display, &depth); - ximage = XCreateImage (display, fc_visual, depth, ZPixmap, - 0, &dummy, win_width, - win_height, 32, 0); - } - else if (ditherType == MONO_DITHER || ditherType == MONO_THRESHOLD) - { - ximage = XCreateImage (display, None, 1, XYBitmap, 0, &dummy, - win_width, - win_height, 8, 0); - ximage->byte_order = MSBFirst; - ximage->bitmap_bit_order = MSBFirst; - } - else - { - ximage = XCreateImage(display, None, 8, ZPixmap, 0, &dummy, - win_width, - win_height, 8, 0); - } - if (ximage == NULL) - { - perror("VP error: fails to XCreateImage ximage"); - exit(1); - } - } -#ifdef SH_MEM - if (shmemFlag && display != NULL) - { - DeInstallXErrorHandler(); - } -#endif - ximage->data = NULL; - /* - fprintf(stderr, "win_width %d, win_height %d, times %d\n", - win_width, win_height, win_width * win_height); - */ - ClearWindow(); - /* - fprintf(stderr, "VP window resized as width-%d, height-%d.\n", w, h); - */ -} - -/* parameter 'position' is for VPcontinuous command only */ -void VPcommand(int cmd, char * ptr) -{ - FrameBlock *buf = (FrameBlock *)ptr; - /* - fprintf(stderr, "VP get cmd %d.\n", cmd); - */ - switch (cmd) - { - case CmdVPdisplayFrame: - if (shared->cmd != CmdSTOP) { - shared->currentGroup = buf->gop; - shared->currentFrame = buf->frame; - shared->currentDisplay = buf->display; - ximage->data = (char *)buf->data; - VPexpose(); - } - VDreclaimMsg(buf); - return; - - case CmdVPinitScreen: - - VPresizeWindow(shared->verticalSize, shared->horizontalSize); - return; - - case CmdVPclearScreen: - - ClearWindow(); - /* - fprintf(stderr, "VP screen cleaned for audio-only case.\n"); - */ - break; - - default: /* all unknown cmds shall be processed by UI */ - - break; - } -} - -void VPexpose(void) -{ - if (ximage == NULL) { - return; - } - else if (ximage->data == NULL) { - return; - } -#ifdef SH_MEM - if (shmemFlag && usingShm) - { - XShmPutImage(display, window, gc, ximage, 0, 0, 0, 0, - ximage->width, ximage->height, True); - XFlush(display); - while(1) - { - XEvent xev; - - XNextEvent(display, &xev); - if(xev.type == CompletionType) - break; - } - } - else -#endif - { - XPutImage(display, window, gc, ximage, 0, 0, 0, 0, - ximage->width, ximage->height); - XFlush(display); - } -} - -static void DisplayInitialization(void) -{ -/* - printf("to initialize display.\n"); -*/ - switch (ditherType) { - - case HYBRID_DITHER: - - InitColor(); - InitDisplay(displayName); - break; - - case HYBRID2_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case FS4_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case FS2_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case FS2FAST_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case Twox2_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case GRAY_DITHER: - InitGrayDisplay(displayName); - break; - - case FULL_COLOR_DITHER: - InitColorDisplay(displayName); - break; - - case NO_DITHER: - shmemFlag = 0; - break; - - case ORDERED_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case MONO_DITHER: - case MONO_THRESHOLD: - InitMonoDisplay(displayName); - break; - - case ORDERED2_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - case MBORDERED_DITHER: - InitColor(); - InitDisplay(displayName); - break; - - } -/* - printf("finished init display.\n"); -*/ -} - -void VPinitWindow(Widget shell, Window monitorWindow, int cmdSock) -{ - cmdSocket = cmdSock; - lum_values = (int *) malloc(LUM_RANGE*sizeof(int)); - cr_values = (int *) malloc(CR_RANGE*sizeof(int)); - cb_values = (int *) malloc(CB_RANGE*sizeof(int)); - - DisplayInitialization(); - memcpy(shared->pixel, pixel, 256); - shared->pixelValid = 1; - - free(lum_values); - free(cr_values); - free(cb_values); -#ifdef SH_MEM - if (shmemFlag && display != NULL) - { - InstallXErrorHandler(); - - shminfo.shmid = shared->VDbufId; - shminfo.shmaddr = shared->VDbufAddr; - shminfo.readOnly = False; - XShmAttach(display, &(shminfo)); - XSync(display, False); - - if (gXErrorFlag) - { - Fprintf(stderr, "Shared memory error, disabling.\n"); - gXErrorFlag = 0; - shmemFlag = 0; - } - DeInstallXErrorHandler(); - } -#endif - - remove_shmem_id(shared->VDbufId); - VPresizeWindow(150, 200); -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/Makefile deleted file mode 100644 index 20d9de633e9..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/Makefile +++ /dev/null @@ -1,271 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -LIBNAME = libmpeg_mib -LIB = $(LIBNAME).a -SHLIB = $(LIBNAME).$(SOEXT) - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES= mibButton \ - mibDrawArea \ - mibFrame \ - mibLabel \ - mibList \ - mibMenu \ - mibRadioBox \ - mibScale \ - mibScrollBar \ - mibTextBig \ - mibTextBox \ - mibToggle \ - mibload \ - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - -##LIBS += -lTAO -lACE - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -LDFLAGS += -L/project/doc/pkg/X11/lib/ -lXm -lXt -lXext -lSM -lICE -lX11 -L/project/doc/pkg/X11/lib -lsocket -lnsl -ldl -CPPFLAGS += -DSH_MEM -DNDEBUG -I/project/doc/pkg/X11/include - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/mibButton.o .obj/mibButton.so .shobj/mibButton.o .shobj/mibButton.so: mibButton.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibDrawArea.o .obj/mibDrawArea.so .shobj/mibDrawArea.o .shobj/mibDrawArea.so: mibDrawArea.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibFrame.o .obj/mibFrame.so .shobj/mibFrame.o .shobj/mibFrame.so: mibFrame.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibLabel.o .obj/mibLabel.so .shobj/mibLabel.o .shobj/mibLabel.so: mibLabel.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibList.o .obj/mibList.so .shobj/mibList.o .shobj/mibList.so: mibList.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibMenu.o .obj/mibMenu.so .shobj/mibMenu.o .shobj/mibMenu.so: mibMenu.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibRadioBox.o .obj/mibRadioBox.so .shobj/mibRadioBox.o .shobj/mibRadioBox.so: mibRadioBox.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibScale.o .obj/mibScale.so .shobj/mibScale.o .shobj/mibScale.so: mibScale.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibScrollBar.o .obj/mibScrollBar.so .shobj/mibScrollBar.o .shobj/mibScrollBar.so: mibScrollBar.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibTextBig.o .obj/mibTextBig.so .shobj/mibTextBig.o .shobj/mibTextBig.so: mibTextBig.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibTextBox.o .obj/mibTextBox.so .shobj/mibTextBox.o .shobj/mibTextBox.so: mibTextBox.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibToggle.o .obj/mibToggle.so .shobj/mibToggle.o .shobj/mibToggle.so: mibToggle.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h -.obj/mibload.o .obj/mibload.so .shobj/mibload.o .shobj/mibload.so: mibload.cpp mibload.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i mibwidgets.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibButton.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibButton.cpp deleted file mode 100644 index 27fb20ab24a..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibButton.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for Button */ -/*****************************************************************************/ - -mib_Widget *mib_create_Button(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Button *myres; - unsigned char *label_text; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - myres = (mib_Button *)ACE_OS::malloc(sizeof(mib_Button)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(7); - sprintf(temp->mib_class,"Button"); - temp->mib_class_num = MIB_BUTTON; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - - if (mib_fill == WDEFAULT) - { - myres->label = (char *)ACE_OS::malloc(strlen(label)+1); - strcpy(myres->label,label); - } - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - label_text = XmStringCreateLtoR(label, XmSTRING_DEFAULT_CHARSET); - - XtSetArg (args[n], XmNlabelString, label_text); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - temp->me = XtCreateManagedWidget(name, xmPushButtonWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WDEFAULT) - { - XmStringFree(label_text); - } - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_Button(mib_Widget *thisw) -{ - mib_Button *temp = (mib_Button *)thisw->myres; - - ACE_OS::free(temp->label); - ACE_OS::free(temp); -} - -void mib_save_Button(mib_Widget *thisw, FILE *fout) -{ - mib_Button *temp = (mib_Button *)thisw->myres; - - fprintf(fout,"label: \\\"%s\\\"\\n\\\n", temp->label); -} - -void mib_code_gen_Button(mib_Widget *thisw, FILE *fout) -{ -} - -int mib_load_Button(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_Button *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[20]; - int n, got_line, vallen; - - myres = (mib_Button *)thisw->myres; - - got_line = mib_read_line(fin, res, val); - if (!got_line) - return 0; - - if (!strcmp(res,"label")) - { - vallen = strlen(val); - if (vallen < 2) - return 0; - val[vallen-1] = '\0'; - myres->label = (char *)ACE_OS::malloc(vallen-1); - sprintf(myres->label,"%s",&(val[1])); - - label_text = XmStringCreateLtoR(myres->label, XmSTRING_DEFAULT_CHARSET); - - n = 0; - XtSetArg (args[n], XmNlabelString, label_text); n++; - XtSetValues(thisw->me, args, n); - - XmStringFree(label_text); - - } - else - return 0; - - got_line = mib_read_line(fin, res, val); - if (!got_line) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibDrawArea.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibDrawArea.cpp deleted file mode 100644 index d293ca412bc..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibDrawArea.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for DrawingArea */ -/*****************************************************************************/ - -mib_Widget *mib_create_DrawingArea(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_DrawingArea *myres; - Widget wtemp; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - myres = (mib_DrawingArea *)ACE_OS::malloc(sizeof(mib_DrawingArea)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(12); - sprintf(temp->mib_class,"DrawingArea"); - temp->mib_class_num = MIB_DRAWINGAREA; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->nothing = 0; - - /* create Xt widget */ - - - n = 0; - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNbackground, WhitePixel(dpy, DefaultScreen(dpy))); n++; - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - temp->me = XtCreateManagedWidget(name, xmDrawingAreaWidgetClass, - temp->parent->me, args, n); - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_DrawingArea(mib_Widget *thisw) -{ - mib_DrawingArea *temp = (mib_DrawingArea *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_DrawingArea(mib_Widget *thisw, FILE *fout) -{ -} - -int mib_load_DrawingArea(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibFrame.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibFrame.cpp deleted file mode 100644 index 0a6c9f16fb6..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibFrame.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for Frames */ -/*****************************************************************************/ - -mib_Widget *mib_create_Frame(mib_Widget *parent, char *name, char *frame_type, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Frame *myres; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_Frame *)ACE_OS::malloc(sizeof(mib_Frame)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(6); - sprintf(temp->mib_class,"Frame"); - temp->mib_class_num = MIB_FRAME; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->shadowtype = 0; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - - if (mib_fill == WDEFAULT) - if (!strcmp("InFrame",frame_type)) - { - XtSetArg (args[n], XmNshadowType, XmSHADOW_IN); n++; - } - else - if (!strcmp("OutFrame",frame_type)) - { - XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT); n++; - myres->shadowtype = 1; - } - else - if (!strcmp("EtchedInFrame",frame_type)) - { - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++; - myres->shadowtype = 2; - } - else - if (!strcmp("EtchedOutFrame",frame_type)) - { - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_OUT); n++; - myres->shadowtype = 3; - } - - temp->me = XtCreateManagedWidget(name, xmFrameWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_Frame(mib_Widget *thisw) -{ - mib_Frame *temp = (mib_Frame *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_Frame(mib_Widget *thisw, FILE *fout) -{ - mib_Frame *temp = (mib_Frame *)thisw->myres; - - fprintf(fout,"shadowtype: %d\\n\\\n", temp->shadowtype); -} - -int mib_load_Frame(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_Frame *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[5]; - int n; - - myres = (mib_Frame *)thisw->myres; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"shadowtype")) - { - sscanf(val,"%d",&(myres->shadowtype)); - - n = 0; - switch (myres->shadowtype) { - case 0: - XtSetArg (args[n], XmNshadowType, XmSHADOW_IN); n++; - break; - case 1: - XtSetArg (args[n], XmNshadowType, XmSHADOW_OUT); n++; - break; - case 2: - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++; - break; - case 3: - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_OUT); n++; - break; - default: - break; - } - XtSetValues(thisw->me, args, n); - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibLabel.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibLabel.cpp deleted file mode 100644 index 9ee5cf87b3e..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibLabel.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for Label */ -/*****************************************************************************/ - -mib_Widget *mib_create_Label(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Label *myres; - unsigned char *label_text; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_Label *)ACE_OS::malloc(sizeof(mib_Label)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(6); - sprintf(temp->mib_class,"Label"); - temp->mib_class_num = MIB_LABEL; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - - if (mib_fill == WDEFAULT) - { - myres->label = (char *)ACE_OS::malloc(strlen(label)+1); - strcpy(myres->label,label); - } - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - label_text = XmStringCreateLtoR(label, XmSTRING_DEFAULT_CHARSET); - - XtSetArg (args[n], XmNlabelString, label_text); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - temp->me = XtCreateManagedWidget(name, xmLabelWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WDEFAULT) - XmStringFree(label_text); - - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_Label(mib_Widget *thisw) -{ - mib_Label *temp = (mib_Label *)thisw->myres; - - ACE_OS::free(temp->label); - ACE_OS::free(temp); -} - -void mib_save_Label(mib_Widget *thisw, FILE *fout) -{ - mib_Label *temp = (mib_Label *)thisw->myres; - - fprintf(fout,"label: \\\"%s\\\"\\n\\\n", temp->label); -} - -int mib_load_Label(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_Label *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[5]; - int n, vallen; - - myres = (mib_Label *)thisw->myres; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"label")) - { - vallen = strlen(val); - if (vallen < 2) - return 0; - val[vallen-1] = '\0'; - myres->label = (char *)ACE_OS::malloc(vallen-1); - sprintf(myres->label,"%s",&(val[1])); - label_text = XmStringCreateLtoR(myres->label, XmSTRING_DEFAULT_CHARSET); - - n = 0; - XtSetArg (args[n], XmNlabelString, label_text); n++; - XtSetValues(thisw->me, args, n); - - XmStringFree(label_text); - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibList.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibList.cpp deleted file mode 100644 index 5fd19422b39..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibList.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; -static Widget real_list; - -/* Code for Lists */ -/*****************************************************************************/ - -mib_Widget *mib_create_List(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_List *myres; - Widget wtemp; - unsigned char *label_text; - char ttext[30]; - Arg args[20]; - String myname; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_List *)ACE_OS::malloc(sizeof(mib_List)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(5); - sprintf(temp->mib_class,"List"); - temp->mib_class_num = MIB_LIST; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy); n++; - } - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++; - - temp->me = XtCreateManagedWidget(name, xmFrameWidgetClass, - temp->parent->me, args, n); - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNorientation, XmVERTICAL); n++; - - if (mib_fill == WEMPTY) - { - XtSetArg (args[n], XmNlistSizePolicy, XmCONSTANT); n++; - } - - wtemp = XmCreateScrolledList(temp->me, name, args, n); - myres->real_list = wtemp; - real_list = wtemp; - - XtManageChild(wtemp); - - if (mib_fill != WEMPTY) - real_list = NULL; - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - label_text = XmStringCreateLtoR("Simple", XmSTRING_DEFAULT_CHARSET); - XmListAddItem(wtemp, label_text, 0); - XmStringFree(label_text); - label_text = XmStringCreateLtoR("List", XmSTRING_DEFAULT_CHARSET); - XmListAddItem(wtemp, label_text, 0); - XmStringFree(label_text); - for (n=0;n<200;n++) - { - sprintf(ttext,"Item %d ",n); - label_text = XmStringCreateLtoR(ttext, XmSTRING_DEFAULT_CHARSET); - XmListAddItem(wtemp, label_text, 0); - XmStringFree(label_text); - } - - mib_apply_eventhandlers(temp->me, temp); - mib_apply_eventhandlers(wtemp, temp); - } - - return temp; -} - -void mib_delete_List(mib_Widget *thisw) -{ - mib_List *temp = (mib_List *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_List(mib_Widget *thisw, FILE *fout) -{ -} - -int mib_load_List(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - - - if (real_list) - thisw->me = real_list; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibMenu.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibMenu.cpp deleted file mode 100644 index aa1c96b5546..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibMenu.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; -static int delhandler; /* delay adding event handler until menu - is actually created */ - -/* Code for Menu */ -/*****************************************************************************/ - -mib_Widget *mib_create_Menu(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Menu *myres; - Widget wtemp; - char label_temp[50]; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_Menu *)ACE_OS::malloc(sizeof(mib_Menu)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(8); - sprintf(temp->mib_class,"Menu"); - temp->mib_class_num = MIB_MENU; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 0; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->numitems = 0; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - } - XtSetArg (args[n], XmNrubberPositioning, False); n++; - - temp->me = XtCreateManagedWidget(name, xmRowColumnWidgetClass, - temp->parent->me, args, n); - - n = 0; - - delhandler = 1; - if (mib_fill == WDEFAULT) - { - delhandler = 0; - myres->numitems = 3; - myres->my_menu = (MenuItem *)ACE_OS::malloc(sizeof(MenuItem) * (myres->numitems+1)); - myres->items = (Widget *)ACE_OS::malloc(sizeof(Widget) * myres->numitems); - sprintf(label_temp, "Item 1"); - myres->my_menu[0].label = (char *)ACE_OS::malloc(strlen(label_temp)+1); - strcpy(myres->my_menu[0].label,label_temp); - myres->my_menu[0].wclass = &xmPushButtonGadgetClass; - myres->my_menu[0].mnemonic = '1'; - myres->my_menu[0].accelerator = NULL; - myres->my_menu[0].accel_text = NULL; - myres->my_menu[0].accel_text = NULL; - myres->my_menu[0].callback = NULL; - myres->my_menu[0].callback_data = NULL; - myres->my_menu[0].subitems = (struct _menu_item *)1; - - sprintf(label_temp, "Item 2"); - myres->my_menu[1].label = (char *)ACE_OS::malloc(strlen(label_temp)+1); - strcpy(myres->my_menu[1].label,label_temp); - myres->my_menu[1].wclass = &xmPushButtonGadgetClass; - myres->my_menu[1].mnemonic = '2'; - myres->my_menu[1].accelerator = NULL; - myres->my_menu[1].accel_text = NULL; - myres->my_menu[1].accel_text = NULL; - myres->my_menu[1].callback = NULL; - myres->my_menu[1].callback_data = NULL; - myres->my_menu[1].subitems = (struct _menu_item *)1; - - sprintf(label_temp, "Item 3"); - myres->my_menu[2].label = (char *)ACE_OS::malloc(strlen(label_temp)+1); - strcpy(myres->my_menu[2].label,label_temp); - myres->my_menu[2].wclass = &xmPushButtonGadgetClass; - myres->my_menu[2].mnemonic = '2'; - myres->my_menu[2].accelerator = NULL; - myres->my_menu[2].accel_text = NULL; - myres->my_menu[2].accel_text = NULL; - myres->my_menu[2].callback = NULL; - myres->my_menu[2].callback_data = NULL; - myres->my_menu[2].subitems = (struct _menu_item *)1; - - myres->my_menu[3].label = NULL; - - wtemp = BuildMenu(temp->me, XmMENU_OPTION, NULL, 'M', myres->my_menu); - XtManageChild(wtemp); - } - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - - /* default menu */ - - if (!delhandler) - { - mib_apply_eventhandlers(wtemp, temp); - mib_apply_eventhandlers(temp->me, temp); - } - } - - if (mib_fill == WEMPTY) - delhandler = 0; - - return temp; -} - -void mib_delete_Menu(mib_Widget *thisw) -{ - mib_Menu *temp = (mib_Menu *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_Menu(mib_Widget *thisw, FILE *fout) -{ - mib_Menu *temp = (mib_Menu *)thisw->myres; - int count; - - fprintf(fout, "numitems: %d\\n\\\n", temp->numitems); - - for (count=0; count < temp->numitems; count++) - { - fprintf(fout, "item: \\\"%s\\\"\\n\\\n", temp->my_menu[count].label); - } - -} - -int mib_load_Menu(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - int count, vallen; - Widget wtemp; - mib_Menu *myres = (mib_Menu *)thisw->myres; - - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res, "numitems")) - { - myres->numitems = 0; - sscanf(val, "%d", &(myres->numitems)); - if (!(myres->numitems)) - return 0; - - myres->my_menu = (MenuItem *)ACE_OS::malloc(sizeof(MenuItem) * (myres->numitems+1)); - myres->items = (Widget *)ACE_OS::malloc(sizeof(Widget) * myres->numitems); - for (count = 0; count < myres->numitems; count++) - { - if (!mib_read_line(fin, res, val)) - return 0; - vallen = strlen(val); - if (vallen < 2) - return 0; - val[vallen-1] = '\0'; - myres->my_menu[count].label = (char *)ACE_OS::malloc(vallen-1); - sprintf(myres->my_menu[count].label, "%s", &(val[1])); - myres->my_menu[count].wclass = &xmPushButtonGadgetClass; - myres->my_menu[count].mnemonic = NULL; - myres->my_menu[count].accelerator = NULL; - myres->my_menu[count].accel_text = NULL; - myres->my_menu[count].accel_text = NULL; - myres->my_menu[count].callback = NULL; - myres->my_menu[count].callback_data = NULL; - myres->my_menu[count].subitems = (struct _menu_item *)1; - } - myres->my_menu[myres->numitems].label = NULL; - - wtemp = BuildMenu(thisw->me, XmMENU_OPTION, NULL, NULL, myres->my_menu); - XtManageChild(wtemp); - - if (delhandler) - { - mib_apply_eventhandlers(wtemp, thisw); - mib_apply_eventhandlers(thisw->me, thisw); - } - else - thisw->me = wtemp; - - for (count = 0; count < myres->numitems; count++) - { - /* thisw hack extracts the widget for each item in the menu - for possible use by the programmer */ - myres->items[count] = (Widget)(myres->my_menu[count].subitems); - } - - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibRadioBox.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibRadioBox.cpp deleted file mode 100644 index c76992b8e96..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibRadioBox.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for RadioBox */ -/*****************************************************************************/ - -mib_Widget *mib_create_RadioBox(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_RadioBox *myres; - Widget wtemp; - unsigned char *label_text; - char label_temp[50]; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_RadioBox *)ACE_OS::malloc(sizeof(mib_RadioBox)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(9); - sprintf(temp->mib_class,"RadioBox"); - temp->mib_class_num = MIB_RADIOBOX; - - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 0; - - /* initialize private resources */ - - temp->myres = (void *)myres; - - myres->numlabel = 0; - - if (mib_fill == WDEFAULT) - { - myres->numlabel = 2; - myres->labels = (char **)ACE_OS::malloc(10); - myres->buttons = (Widget *)ACE_OS::malloc(sizeof(Widget) * myres->numlabel); - sprintf(label_temp, "Radio 1"); - myres->labels[0] = (char *)ACE_OS::malloc(strlen(label_temp)+1); - strcpy(myres->labels[0],label_temp); - sprintf(label_temp, "Radio 2"); - myres->labels[1] = (char *)ACE_OS::malloc(strlen(label_temp)+1); - strcpy(myres->labels[1],label_temp); - } - - - /* create Xt widget */ - - n = 0; - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - temp->me = XmCreateRadioBox(temp->parent->me, "Radio", args, n); - wtemp = temp->me; - - - if (mib_fill == WDEFAULT) - { - n = 0; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - XtCreateManagedWidget("Radio 1", xmToggleButtonGadgetClass, - wtemp, args, n); - - n = 0; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - XtCreateManagedWidget("Radio 2", xmToggleButtonGadgetClass, - wtemp, args, n); - } - - - XtManageChild(wtemp); - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_RadioBox(mib_Widget *thisw) -{ - mib_RadioBox *temp = (mib_RadioBox *)thisw->myres; - int count; - - for (count=0; count < temp->numlabel; count++) - ACE_OS::free(temp->labels[count]); - - ACE_OS::free(temp); -} - -void mib_save_RadioBox(mib_Widget *thisw, FILE *fout) -{ - mib_RadioBox *temp = (mib_RadioBox *)thisw->myres; - int count; - - fprintf(fout,"numlabel: %d\\n\\\n", temp->numlabel); - - for (count=0; count < temp->numlabel; count++) - { - fprintf(fout,"label: \\\"%s\\\"\\n\\\n", temp->labels[count]); - } -} - -int mib_load_RadioBox(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - int count, vallen, n; - Arg args[5]; - mib_RadioBox *myres; - - myres = (mib_RadioBox *)thisw->myres; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"numlabel")) - { - myres->numlabel = 0; - sscanf(val,"%d",&(myres->numlabel)); - if (!(myres->numlabel)) - return 0; - - myres->labels = (char **)ACE_OS::malloc((myres->numlabel+1)*4); - myres->buttons = (Widget *)ACE_OS::malloc(sizeof(Widget)*(myres->numlabel)); - for (count=0; count < myres->numlabel; count++) - { - if (!mib_read_line(fin, res, val)) - return 0; - vallen = strlen(val); - if (vallen < 2) - return 0; - val[vallen-1] = '\0'; - myres->labels[count] = (char *)ACE_OS::malloc(vallen-1); - sprintf(myres->labels[count],"%s",&(val[1])); - - n = 0; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - myres->buttons[count] = XtCreateManagedWidget(myres->labels[count], - xmToggleButtonGadgetClass, thisw->me, args, n); - - } - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScale.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScale.cpp deleted file mode 100644 index eb58f655481..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScale.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; -static int scaleflag; - -/* Code for Scale */ -/*****************************************************************************/ - -mib_Widget *mib_create_Scale(mib_Widget *parent, char *name, char *orient, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Scale *myres; - Arg args[20]; - int n; - - - scaleflag = 0; - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_Scale *)ACE_OS::malloc(sizeof(mib_Scale)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(10); - sprintf(temp->mib_class,"Scale"); - temp->mib_class_num = MIB_SCALE; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->orientation = 0; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - - - if (mib_fill == WDEFAULT) - if (!strcmp("VertScale",orient)) - { - XtSetArg (args[n], XmNorientation, XmVERTICAL); n++; - } - else - if (!strcmp("HorzScale",orient)) - { - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - myres->orientation = 1; - } - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNshowArrows, False); n++; - XtSetArg (args[n], XmNsliderSize, 30); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - temp->me = XtCreateManagedWidget(name, xmScrollBarWidgetClass, - temp->parent->me, args, n); - else - temp->me = XtCreateManagedWidget(name, xmScaleWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WEMPTY) - scaleflag = 1; - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_Scale(mib_Widget *thisw) -{ - mib_Scale *temp = (mib_Scale *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_Scale(mib_Widget *thisw, FILE *fout) -{ - mib_Scale *temp = (mib_Scale *)thisw->myres; - - fprintf(fout,"orientation: %d\\n\\\n", temp->orientation); -} - -int mib_load_Scale(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_Scale *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[5]; - int n; - Dimension myht,mywd; - - - myres = (mib_Scale *)thisw->myres; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"orientation")) - { - sscanf(val,"%d",&(myres->orientation)); - - n = 0; - if (scaleflag) - { - if (!myres->orientation) - { - XtSetArg (args[n], XmNscaleWidth, thisw->width); n++; - } - else - { - XtSetArg (args[n], XmNscaleWidth, thisw->height); n++; - } - - XtSetValues(thisw->me, args, n); - - } - - n = 0; - switch (myres->orientation) { - case 0: - XtSetArg (args[n], XmNorientation, XmVERTICAL); n++; - break; - case 1: - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - break; - default: - break; - } - XtSetValues(thisw->me, args, n); - - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScrollBar.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScrollBar.cpp deleted file mode 100644 index f8123d8a139..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibScrollBar.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for ScrollBars */ -/*****************************************************************************/ - -mib_Widget *mib_create_ScrollBar(mib_Widget *parent, char *name, char *orient, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_ScrollBar *myres; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_ScrollBar *)ACE_OS::malloc(sizeof(mib_ScrollBar)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(10); - sprintf(temp->mib_class,"ScrollBar"); - temp->mib_class_num = MIB_SCROLLBAR; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->orientation = 0; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - - if (mib_fill == WDEFAULT) - if (!strcmp("VertScrollBar",orient)) - { - XtSetArg (args[n], XmNorientation, XmVERTICAL); n++; - } - else - if (!strcmp("HorzScrollBar",orient)) - { - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - myres->orientation = 1; - } - - temp->me = XtCreateManagedWidget(name, xmScrollBarWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_ScrollBar(mib_Widget *thisw) -{ - mib_ScrollBar *temp = (mib_ScrollBar *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_ScrollBar(mib_Widget *thisw, FILE *fout) -{ - mib_ScrollBar *temp = (mib_ScrollBar *)thisw->myres; - - fprintf(fout,"orientation: %d\\n\\\n", temp->orientation); -} - -int mib_load_ScrollBar(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_ScrollBar *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[5]; - int n; - - myres = (mib_ScrollBar *)thisw->myres; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"orientation")) - { - sscanf(val,"%d",&(myres->orientation)); - - n = 0; - switch (myres->orientation) { - case 0: - XtSetArg (args[n], XmNorientation, XmVERTICAL); n++; - break; - case 1: - XtSetArg (args[n], XmNorientation, XmHORIZONTAL); n++; - break; - default: - break; - } - XtSetValues(thisw->me, args, n); - } - else - return 0; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBig.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBig.cpp deleted file mode 100644 index af814a39fb4..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBig.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; -static Widget real_text; - -/* Code of TextBig */ -/*****************************************************************************/ - -mib_Widget *mib_create_TextBig(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_TextBig *myres; - Widget wtemp; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_TextBig *)ACE_OS::malloc(sizeof(mib_TextBig)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(8); - sprintf(temp->mib_class,"TextBig"); - temp->mib_class_num = MIB_TEXTBIG; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->nothing = 0; - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - } - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNshadowType, XmSHADOW_ETCHED_IN); n++; - - temp->me = XtCreateManagedWidget(name, xmFrameWidgetClass, - temp->parent->me, args, n); - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - XtSetArg (args[n], XmNrows, 200); n++; - XtSetArg (args[n], XmNcolumns, 200); n++; - } - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - wtemp = XmCreateScrolledText(temp->me, name, args, n); - real_text = wtemp; - - XtManageChild(wtemp); - - if (mib_fill != WEMPTY) - real_text = NULL; - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - XmTextSetString(wtemp,"Big Text Field\nwith Scrollbars\n\n\n\n\n\n\n "); - - mib_apply_eventhandlers(wtemp, temp); - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_TextBig(mib_Widget *thisw) -{ - mib_TextBig *temp = (mib_TextBig *)thisw->myres; - - ACE_OS::free(temp); -} - -void mib_save_TextBig(mib_Widget *thisw, FILE *fout) -{ -} - -int mib_load_TextBig(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - - if (real_text) - thisw->me = real_text; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBox.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBox.cpp deleted file mode 100644 index 6e537539e40..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibTextBox.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for TextBox */ -/*****************************************************************************/ - -mib_Widget *mib_create_TextBox(mib_Widget *parent, char *name, char *contents, - int posx, int posy, int width, int height, - int mib_fill) -{ - mib_Widget *temp; - mib_TextBox *myres; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - myres = (mib_TextBox *)ACE_OS::malloc(sizeof(mib_TextBox)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(8); - sprintf(temp->mib_class,"TextBox"); - temp->mib_class_num = MIB_TEXTBOX; - temp->width = width; - temp->height = height; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 1; - - /* initialize private resources */ - - temp->myres = (void *)myres; - myres->init_contents = NULL; - - if (mib_fill == WDEFAULT) - { - if (contents != NULL) - { - myres->init_contents = (char *)ACE_OS::malloc(strlen(contents)+1); - strcpy(myres->init_contents, contents); - } - } - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - } - - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - - temp->me = XtCreateManagedWidget(name, xmTextFieldWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - XmTextFieldSetString(temp->me, "Text Field"); - - } - - return temp; -} - -void mib_delete_TextBox(mib_Widget *thisw) -{ - mib_TextBox *temp = (mib_TextBox *)thisw->myres; - - if (temp->init_contents != NULL) - ACE_OS::free(temp->init_contents); -} - -void mib_save_TextBox(mib_Widget *thisw, FILE *fout) -{ -} - -int mib_load_TextBox(mib_Widget *thisw, mib_Buffer *fin) -{ - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - - if (!mib_read_line(fin, res, val)) - return 0; - - if (!strcmp(res,"EndWidget.")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibToggle.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibToggle.cpp deleted file mode 100644 index 95338eb76ab..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibToggle.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - - -/* Author: Daeron Meyer */ - -#include "mibload.h" -#include "mibwidgets.h" - -extern Display *dpy; -extern GC mib_gc; - -/* Code for Toggle */ -/*****************************************************************************/ - -mib_Widget *mib_create_Toggle(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill) -{ - mib_Widget *temp; - mib_Toggle *myres; - unsigned char *label_text; - Arg args[20]; - int n; - - /* create the new widget and add it to the tree */ - - temp = mib_new_mib_Widget(); - if (mib_fill == WDEFAULT) - mib_add_backward(temp, parent); - else - mib_add_mib_Widget(temp, parent); - - myres = (mib_Toggle *)ACE_OS::malloc(sizeof(mib_Toggle)); - - /* initialize public resources */ - - if (mib_fill == WDEFAULT) - { - temp->name = (char *)ACE_OS::malloc(strlen(name)+1); - strcpy(temp->name,name); - } - temp->mib_class = (char *)ACE_OS::malloc(7); - sprintf(temp->mib_class,"Toggle"); - temp->mib_class_num = MIB_TOGGLE; - temp->width = 0 /*width*/; - temp->height = 0 /*height*/; - temp->topOffset = posy; - temp->leftOffset = posx; - temp->bottomOffset = 0; - temp->rightOffset = 0; - temp->topAttachment = 1; - temp->leftAttachment = 1; - temp->bottomAttachment = 0; - temp->rightAttachment = 0; - - temp->mib_allowresize = 0; - - /* initialize private resources */ - - temp->myres = (void *)myres; - - myres->isize = 0; - if (mib_fill == WDEFAULT) - { - myres->label = (char *)ACE_OS::malloc(strlen(label)+1); - strcpy(myres->label,label); - } - - /* create Xt widget */ - - n = 0; - - if (mib_fill == WDEFAULT) - { - label_text = XmStringCreateLtoR(label, XmSTRING_DEFAULT_CHARSET); - - XtSetArg (args[n], XmNlabelString, label_text); n++; - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, posx);n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, posy);n++; -/* XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++;*/ - } - - XtSetArg (args[n], XmNwidth, width); n++; - XtSetArg (args[n], XmNheight, height); n++; - XtSetArg (args[n], XmNspacing, 4); n++; - XtSetArg (args[n], XmNhighlightThickness, 0); n++; - XtSetArg (args[n], XmNrubberPositioning, False); n++; - XtSetArg (args[n], XmNindicatorType, XmN_OF_MANY); - - temp->me = XtCreateManagedWidget(name, xmToggleButtonWidgetClass, - temp->parent->me, args, n); - - if (mib_fill == WDEFAULT) - { - XmStringFree(label_text); - } - - if (mib_fill == WEDIT || mib_fill == WDEFAULT) - { - mib_apply_eventhandlers(temp->me, temp); - } - - return temp; -} - -void mib_delete_Toggle(mib_Widget *thisw) -{ - mib_Toggle *temp = (mib_Toggle *)thisw->myres; - - ACE_OS::free(temp->label); - ACE_OS::free(temp); -} - -void mib_save_Toggle(mib_Widget *thisw, FILE *fout) -{ - mib_Toggle *temp = (mib_Toggle *)thisw->myres; - - fprintf(fout,"label: \\\"%s\\\"\\n\\\n", temp->label); - fprintf(fout,"indicatorSize: %d\\n\\\n", temp->isize); -} - -int mib_load_Toggle(mib_Widget *thisw, mib_Buffer *fin) -{ - mib_Toggle *myres; - unsigned char *label_text; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - Arg args[20]; - int n, got_line, vallen; - - myres = (mib_Toggle *)thisw->myres; - - got_line = mib_read_line(fin, res, val); - if (!got_line) - return 0; - - if (!strcmp(res,"label")) - { - vallen = strlen(val); - if (vallen < 2) - return 0; - val[vallen-1] = '\0'; - myres->label = (char *)ACE_OS::malloc(vallen-1); - sprintf(myres->label,"%s",&(val[1])); - - label_text = XmStringCreateLtoR(myres->label, XmSTRING_DEFAULT_CHARSET); - - n = 0; - XtSetArg (args[n], XmNlabelString, label_text); n++; - thisw->width = 0; - thisw->height = 0; - XtSetArg (args[n], XmNwidth, thisw->width); n++; - XtSetArg (args[n], XmNheight, thisw->height); n++; - XtSetValues(thisw->me, args, n); - XmStringFree(label_text); - - } - else - return 0; - - got_line = mib_read_line(fin, res, val); - if (!got_line) - return 0; - - if (!strcmp(res, "indicatorSize")) - { - sscanf(val, "%d", &(myres->isize)); - if (myres->isize) - XtVaSetValues(thisw->me, XmNindicatorSize, (Dimension)myres->isize, - XmNmarginBottom, 0, XmNmarginTop, 0, XmNmarginLeft, 0, - XmNmarginRight, 0, XmNspacing, 0, NULL); - got_line = mib_read_line(fin, res, val); - if (!got_line) - return 0; - } - - if (strcmp(res,"EndWidget")) - return 0; - - return 1; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.cpp deleted file mode 100644 index c71bc031b67..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.cpp +++ /dev/null @@ -1,801 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with thisw file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include <stdlib.h> -#include "mibload.h" -#include "mibwidgets.h" - -mib_Widget *mib_root_Widget; -Display *dpy; -GC mib_gc; -static struct _mib_event_handle_funcs { -#ifdef __cplusplus - void (*mib_pick_mib_Widget)( Widget, XtPointer, - XEvent *, Boolean * ); - void (*mib_move_mib_Widget)( Widget, XtPointer, - XEvent *, Boolean *); - void (*mib_unpick_mib_Widget)( Widget, XtPointer, - XEvent *, Boolean * ); -#else - void (*mib_pick_mib_Widget)(/* Widget, XtPointer, - XButtonPressedEvent *, Boolean * */); - void (*mib_move_mib_Widget)(/* Widget, XtPointer, - XPointerMovedEvent *, Boolean * */); - void (*mib_unpick_mib_Widget)(/* Widget, XtPointer, - XButtonReleasedEvent *, Boolean * */); -#endif -} mib_events; - -mib_widget_funcs mwfuncs[] = -{ - { NULL, NULL, NULL, NULL, NULL }, - { "TextBox", mib_create_TextBox, mib_delete_TextBox, - mib_save_TextBox, mib_load_TextBox}, - { "Button", mib_create_Button, mib_delete_Button, - mib_save_Button, mib_load_Button}, - { "Toggle", mib_create_Toggle, mib_delete_Toggle, - mib_save_Toggle, mib_load_Toggle}, - { "RadioBox", mib_create_RadioBox, mib_delete_RadioBox, - mib_save_RadioBox, mib_load_RadioBox}, - { "DrawingArea", mib_create_DrawingArea, mib_delete_DrawingArea, - mib_save_DrawingArea, mib_load_DrawingArea}, - { "Label", mib_create_Label, mib_delete_Label, - mib_save_Label, mib_load_Label}, - { "Frame", mib_create_Frame, mib_delete_Frame, - mib_save_Frame, mib_load_Frame}, - { "ScrollBar", mib_create_ScrollBar, mib_delete_ScrollBar, - mib_save_ScrollBar, mib_load_ScrollBar}, - { "TextBig", mib_create_TextBig, mib_delete_TextBig, - mib_save_TextBig, mib_load_TextBig}, - { "List", mib_create_List, mib_delete_List, - mib_save_List, mib_load_List}, - { "Scale", mib_create_Scale, mib_delete_Scale, - mib_save_Scale, mib_load_Scale}, - { "Menu", mib_create_Menu, mib_delete_Menu, - mib_save_Menu, mib_load_Menu}, - { NULL, NULL, NULL, NULL, NULL }, -}; - -/*****************************************************************************/ - -void mib_add_mib_Widget(mib_Widget *thisw, mib_Widget *parent) -{ - mib_Widget *tmp; - - if (parent->child == NULL) - { - parent->child = thisw; - thisw->prev = parent; - thisw->parent = parent; - thisw->sibling = NULL; - thisw->child = NULL; - } - else - { - tmp = parent->child; - while (tmp->sibling != NULL) - tmp = tmp->sibling; - tmp->sibling = thisw; - thisw->prev = tmp; - thisw->parent = parent; - thisw->sibling = NULL; - thisw->child = NULL; - } -} - -/*****************************************************************************/ - -void mib_add_backward(mib_Widget *thisw, mib_Widget *parent) -{ - mib_Widget *tmp; - - if (parent->child == NULL) - { - parent->child = thisw; - thisw->prev = parent; - thisw->parent = parent; - thisw->sibling = NULL; - thisw->child = NULL; - } - else - { - tmp = parent->child; - parent->child = thisw; - thisw->prev = parent; - thisw->parent = parent; - thisw->sibling = tmp; - thisw->child = NULL; - tmp->prev = thisw; - } -} - -/*****************************************************************************/ - -void mib_remove_mib_Widget(mib_Widget *thisw) -{ - int count; - mib_Widget *pnt; - - XtVaSetValues(mib_root_Widget->me, XmNresizePolicy, XmRESIZE_NONE, NULL); - XtDestroyWidget(thisw->me); - - while (thisw->child != NULL) - mib_remove_mib_Widget(thisw->child); - - if (thisw->parent == thisw) - { - mib_clear_myres(thisw); - return; - } - - if (thisw->prev == thisw->parent) - { - thisw->parent->child = thisw->sibling; - if (thisw->sibling != NULL) - thisw->sibling->prev = thisw->parent; - } - else - { - thisw->prev->sibling = thisw->sibling; - if (thisw->sibling != NULL) - thisw->sibling->prev = thisw->prev; - } - - mib_clear_myres(thisw); -} - -/*****************************************************************************/ - -void mib_clear_myres(mib_Widget *thisw) -{ - ACE_OS::free(thisw->mib_class); - ACE_OS::free(thisw->name); - - if ((thisw->mib_class_num < 1) || (thisw->mib_class_num > MI_NUMCLASSES)) - return; - - mwfuncs[thisw->mib_class_num].mib_delete(thisw); - ACE_OS::free(thisw); -} - -/*****************************************************************************/ - -mib_Widget *mib_new_mib_Widget() -{ - mib_Widget *thisw; - thisw = (mib_Widget *)ACE_OS::malloc(sizeof(mib_Widget)); - thisw->me = NULL; - thisw->mib_class_num = MIB_NULL; - thisw->mib_selected = 0; - thisw->mib_resizing = 0; - thisw->myres = NULL; - thisw->parent = NULL; - thisw->sibling = NULL; - thisw->prev = NULL; - thisw->child = NULL; - thisw->width = 0; - thisw->height = 0; - thisw->topAttachment = 0; - thisw->bottomAttachment = 0; - thisw->leftAttachment = 0; - thisw->rightAttachment = 0; - thisw->topOffset = 0; - thisw->bottomOffset = 0; - thisw->leftOffset = 0; - thisw->rightOffset = 0; - - return thisw; -} - -/*****************************************************************************/ - -mib_Widget *mib_find_name(mib_Widget *temp, char *name) -{ - mib_Widget *child = temp->child; - mib_Widget *ret = NULL; - - if (!strcmp(temp->name, name)) - return temp; - - if (child != NULL) - if (ret = mib_find_name(child, name)) - return ret; - - child = temp->sibling; - if (child != NULL) - if (ret = mib_find_name(child, name)) - return ret; - - return NULL; -} - -/*****************************************************************************/ - -Widget -BuildMenu(Widget parent, int menu_type, char *menu_title, char menu_mnemonic, - MenuItem *items) -{ - Widget menu, cascade, widget; - int i; - XmString str; - - if (menu_type == XmMENU_PULLDOWN || menu_type == XmMENU_OPTION) - menu = XmCreatePulldownMenu(parent, "_pulldown", NULL, 0); - else if (menu_type == XmMENU_POPUP) - menu = XmCreatePopupMenu(parent, "_popup", NULL, 0); - else { - XtWarning("Invalid menu type passed to BuildMenu()"); - return NULL; - } - - /* Pulldown menus require a cascade button to be made */ - if (menu_type == XmMENU_PULLDOWN) { - str = XmStringCreateSimple(menu_title); - cascade = XtVaCreateManagedWidget(menu_title, - xmCascadeButtonGadgetClass, parent, - XmNsubMenuId, menu, - XmNlabelString, str, - XmNmnemonic, menu_mnemonic, - NULL); - XmStringFree(str); - } else if (menu_type == XmMENU_OPTION) { - /* Option menus are a special case, but not hard to handle */ - Arg args[2]; - str = XmStringCreateSimple(menu_title); - XtSetArg(args[0], XmNsubMenuId, menu); - XtSetArg(args[1], XmNlabelString, str); - /* This really isn't a cascade, but thisw is the widget handle - * we're going to return at the end of the function. - */ - cascade = XmCreateOptionMenu(parent, menu_title, args, 2); - XmStringFree(str); - } - - /* Now add the menu items */ - for (i = 0; items[i].label != NULL; i++) { - /* If subitems exist, create the pull-right menu by calling thisw - * function recursively. Since the function returns a cascade - * button, the widget returned is used.. - */ - if (items[i].subitems) - if (menu_type == XmMENU_OPTION) { - widget = XtVaCreateManagedWidget(items[i].label, - *items[i].wclass, menu, NULL); - items[i].subitems = (struct _menu_item *) widget; - /* daeron mod (tm) :-) ... we now use thisw to pass back each - widget we create to the mibMenu functions so that it can - be stored as part of the mibMenu structure */ - - /* XtWarning("You can't have submenus from option menu items."); - continue;*/ - } else - widget = BuildMenu(menu, XmMENU_PULLDOWN, - items[i].label, items[i].mnemonic, items[i].subitems); - else - { - widget = XtVaCreateManagedWidget(items[i].label, - *items[i].wclass, menu, - NULL); - /* ditto here from above ... - Daeron mod (tm) */ - items[i].subitems = (struct _menu_item *) widget; - } - - /* Whether the item is a real item or a cascade button with a - * menu, it can still have a mnemonic. - */ - if (items[i].mnemonic) - XtVaSetValues(widget, XmNmnemonic, items[i].mnemonic, NULL); - - /* any item can have an accelerator, except cascade menus. But, - * we don't worry about that; we know better in our declarations. - */ - if (items[i].accelerator) { - str = XmStringCreateSimple(items[i].accel_text); - XtVaSetValues(widget, - XmNaccelerator, items[i].accelerator, - XmNacceleratorText, str, - NULL); - XmStringFree(str); - } - - if (items[i].callback) - XtAddCallback(widget, - (items[i].wclass == &xmToggleButtonWidgetClass || - items[i].wclass == &xmToggleButtonGadgetClass)? - XmNvalueChangedCallback : /* ToggleButton class */ - XmNactivateCallback, /* PushButton class */ - items[i].callback, items[i].callback_data); - } - - /* for popup menus, just return the menu; pulldown menus, return - * the cascade button; option menus, return the thing returned - * from XmCreateOptionMenu(). This isn't a menu, or a cascade button! - */ - return menu_type == XmMENU_POPUP? menu : cascade; -} - -/*****************************************************************************/ - -mib_Widget *mib_load_interface(Widget parent, char *from, int file_type) -{ - mib_Buffer thiswfile; - mib_Widget *thisw; - FILE *infile; - char *instring; - char ch; - - thiswfile.buf_type = file_type; - - dpy = XtDisplay(parent); - - if ((file_type == MI_FROMFILE) || (file_type == MI_EDITFROMFILE)) - { - if (!(infile = fopen(from,"r"))) - return NULL; - - ch = '\0'; - while ((ch != '\n')&&(!feof(infile))) /* throw away first line */ - ch = (char)fgetc(infile); - - thiswfile.buffer = (void *)infile; - thiswfile.point = 0; - - if (!mib_load_Root(parent, &thisw, &thiswfile)) - { - /* delete thisw */ - return NULL; - } - else - { - fclose(infile); - return thisw; - } - } - else - if ((file_type == MI_FROMSTRING) || (file_type == MI_EDITFROMSTRING)) - { - instring = from; - if (instring == NULL) - return NULL; - - thiswfile.buffer = (void *)instring; - thiswfile.buflen = strlen(instring); - thiswfile.point = 0; - - if (!mib_load_Root(parent, &thisw, &thiswfile)) - { - /* delete thisw */ - return NULL; - } - else - return thisw; - } - else - return NULL; - -} - -/*****************************************************************************/ - -int mib_load_mib_class(mib_Widget **thisw, mib_Widget *parent, char *name, - char *iname, mib_Buffer *fin ) -{ - int namelen, editstate, count, set; - - if ((fin->buf_type == MI_EDITFROMFILE) || - (fin->buf_type == MI_EDITFROMSTRING)) - editstate = WEDIT; - else - editstate = WEMPTY; - - namelen = strlen(name); - if (namelen < 2) - return 0; - - name[namelen-1] = '\0'; - name[0] = ' '; - - count = 1; - - while (mwfuncs[count].name) - { - if (!strcmp(&(name[1]), mwfuncs[count].name)) - { - *thisw = mwfuncs[count].mib_create(parent, iname, NULL, 0, 0, 0, 0, - editstate); - return 1; - } - count++; - } - - (*thisw)->parent = (*thisw); - return 1; -} - -/*****************************************************************************/ - -mib_Widget *mib_load_public(mib_Widget *root, mib_Widget *thisw, mib_Buffer *fin) -{ - int got_line, done; - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - char valcp[MI_MAXSTRLEN]; - Arg args[20]; - int mynum, n; - - got_line = 1; - done = 0; - - /* thisw loop reads basic info about Widget */ - while (got_line && (!done)) - { - got_line = mib_read_line(fin, res, val); - if (!strcmp(res,"Ref")) - sscanf(val, "%d", &mynum); - else - if (!strcmp(res,"Widget")) - { - strcpy(valcp,val); - done = 1; - } - } - - done = 0; - - while (got_line && (!done)) - { - got_line = mib_read_line(fin, res, val); - if (!strcmp(res, "Children")) - n = 0; - else - if (!strcmp(res, "Parent")) /* don't support complete widget tree yet */ - n = 0; - else - if (!strcmp(res,"Public-")) - n = 0; - else - if (!strcmp(res,"Name")) - { - val[strlen(val)-1] = '\0'; - mib_load_mib_class(&thisw, root, valcp, &(val[1]), fin); - thisw->name = (char *)ACE_OS::malloc(strlen(val)); - sprintf(thisw->name,"%s",&(val[1])); - thisw->mib_mynum = mynum; - done = 1; - } - else - return 0; - } - - if (!got_line) - return NULL; - - done = 0; - - /* second loop reads public info */ - while (got_line && (!done)) - { - got_line = mib_read_line(fin, res, val); - if (!strcmp(res,"Xmwidth")) - sscanf(val,"%d",&(thisw->width)); - else - if (!strcmp(res,"Xmheight")) - sscanf(val,"%d",&(thisw->height)); - else - if (!strcmp(res,"XmtopAttachment")) - sscanf(val,"%d",&(thisw->topAttachment)); - else - if (!strcmp(res,"XmbottomAttachment")) - sscanf(val,"%d",&(thisw->bottomAttachment)); - else - if (!strcmp(res,"XmleftAttachment")) - sscanf(val,"%d",&(thisw->leftAttachment)); - else - if (!strcmp(res,"XmrightAttachment")) - sscanf(val,"%d",&(thisw->rightAttachment)); - else - if (!strcmp(res,"XmtopOffset")) - sscanf(val,"%d",&(thisw->topOffset)); - else - if (!strcmp(res,"XmbottomOffset")) - sscanf(val,"%d",&(thisw->bottomOffset)); - else - if (!strcmp(res,"XmleftOffset")) - sscanf(val,"%d",&(thisw->leftOffset)); - else - if (!strcmp(res,"XmrightOffset")) - sscanf(val,"%d",&(thisw->rightOffset)); - else - if (!strcmp(res,"Private-")) - done = 1; - } - - n = 0; - if ((fin->buf_type == MI_EDITFROMFILE) || - (fin->buf_type == MI_EDITFROMSTRING)) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, thisw->leftOffset); n++; - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, thisw->topOffset); n++; - if (thisw == root) - { - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightOffset, thisw->rightOffset); n++; - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, thisw->bottomOffset); n++; - } - } - else - { - if (thisw->leftAttachment) - { - XtSetArg (args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNleftOffset, thisw->leftOffset);n++; - } - if (thisw->topAttachment) - { - XtSetArg (args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNtopOffset, thisw->topOffset);n++; - } - if (thisw->bottomAttachment) - { - XtSetArg (args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNbottomOffset, thisw->bottomOffset);n++; - } - if (thisw->rightAttachment) - { - XtSetArg (args[n], XmNrightAttachment, XmATTACH_FORM); n++; - XtSetArg (args[n], XmNrightOffset, thisw->rightOffset);n++; - } - } - - XtSetArg (args[n], XmNwidth, thisw->width); n++; - XtSetArg (args[n], XmNheight, thisw->height); n++; - - XtSetValues(thisw->me, args, n); - - return thisw; -} - -/*****************************************************************************/ - -int mib_load_private(mib_Widget *thisw, mib_Buffer *fin) -{ - - if (thisw->mib_class_num == MIB_NULL) - return 1; - - if ((thisw->mib_class_num < 1) || (thisw->mib_class_num > MI_NUMCLASSES)) - return 0; - - mwfuncs[thisw->mib_class_num].mib_load(thisw, fin); - - return 1; -} - -/*****************************************************************************/ - -int mib_load_Root(Widget parent, mib_Widget **thisw, mib_Buffer *fin) -{ - - char res[MI_MAXSTRLEN]; - char val[MI_MAXSTRLEN]; - char name[MI_MAXSTRLEN]; - int num_widgets, count, n, got_line; - Arg args[20]; - XGCValues gcvals; - XtGCMask val_mask; - mib_Widget *temp; - - got_line = mib_read_line(fin, res, val); - if (!strcmp(res,"TotalWidgets")) - sscanf(val, "%d", &num_widgets); - else - return 0; - - (*thisw) = mib_new_mib_Widget(); - (*thisw)->mib_class = (char*)ACE_OS::malloc(9); - sprintf((*thisw)->mib_class,"RootForm"); - -/* (*thisw)->me = XmCreateForm(parent, "MainForm", args, 0); */ - - (*thisw)->me = parent; - - if (!mib_load_public((*thisw), (*thisw), fin)) - return 0; - - /* we don't expect any private resources for the root widget */ - - got_line = mib_read_line(fin, res, val); - if (strcmp(res,"EndWidget.")) - return 0; - -/* XtManageChild((*thisw)->me); -*/ - XtVaSetValues((*thisw)->me, XmNresizePolicy, XmRESIZE_NONE, NULL); - - count = num_widgets - 1; - while (count > 0) - { - - if (!(temp = mib_load_public((*thisw), temp, fin))) - { - /* delete temp */ - return 0; - } - - if (!mib_load_private(temp,fin)) - { - /* delete temp */ - return 0; - } - count--; - - } - - mib_reset_size((*thisw)); - - XtVaSetValues((*thisw)->me, XmNresizePolicy, XmRESIZE_ANY, NULL); - - val_mask = (long)0; - mib_gc = XtGetGC((*thisw)->me, val_mask, &gcvals); - - return 1; -} - -/*****************************************************************************/ - -int mib_read_line(mib_Buffer *bufin, char *res, char *val) -{ - FILE *fin; - char *strin; - char ch; - int count, mark; - char inbuf[MI_MAXSTRLEN]; - - if ((bufin->buf_type == MI_FROMFILE) || (bufin->buf_type == MI_EDITFROMFILE)) - { - fin = (FILE *)bufin->buffer; - ch = '\0'; - count = 0; - mark = 0; - while ((ch != '\n')&&(!feof(fin))&&(count<MI_MAXSTRLEN)) - { - ch = (char)fgetc(fin); - if ((mark == 0) && (ch == ':')) - mark = count; - if ((ch != '\\')&&(ch != '\n')) - { - inbuf[count] = ch; - count++; - } - } - if (feof(fin)) - return 0; - inbuf[count] = '\0'; - if (count > 0) - { - if (inbuf[count-1] == 'n') - inbuf[count-1] = '\0'; - } - else - return 0; - - } - else - if ((bufin->buf_type == MI_FROMSTRING) || - (bufin->buf_type == MI_EDITFROMSTRING)) - { - strin = (char *)bufin->buffer; - count = bufin->point; - mark = 0; - - if (count >= bufin->buflen) - return 0; - - while ((strin[count] != '\n') && (count < bufin->buflen)) - { - if ((mark == 0) && (strin[count] == ':')) - mark = count; - count++; - } - - strin[count] = '\0'; - if (count >= bufin->buflen) - return 0; - sprintf(inbuf,"%s",&(strin[bufin->point])); - strin[count] = '\n'; - if (mark != 0) - mark -= bufin->point; - bufin->point = count+1; - } - else - return 0; - - if (mark == 0) - { - sprintf(res,"%s",inbuf); - sprintf(val,"\0"); - } - else - { - inbuf[mark] = '\0'; - sprintf(res,"%s",inbuf); - inbuf[mark] = ' '; - if ((int)(strlen(inbuf)-mark) > 1) - sprintf(val,"%s",&(inbuf[mark+2])); - else - sprintf(val,"\0"); - } - - return 1; -} - -/*****************************************************************************/ - -void mib_reset_size(mib_Widget *temp) -{ - Arg args[5]; - int n; - - mib_Widget *child = temp->child; - - if (temp->mib_class_num != MIB_NULL) - { - n = 0; - XtSetArg (args[n], XmNwidth, temp->width); n++; - XtSetArg (args[n], XmNheight, temp->height); n++; - - XtSetValues(temp->me, args, n); - } - - if (child != NULL) - mib_reset_size(child); - - child = temp->sibling; - if (child != NULL) - mib_reset_size(child); -} - -/*****************************************************************************/ - -#ifdef __cplusplus -void mib_set_eventhandlers(void a(Widget, XtPointer, - XEvent *, Boolean * ), - void b( Widget, XtPointer, - XEvent *, Boolean* ), - void c(Widget, XtPointer, - XEvent *, Boolean *) - ) -#else -void mib_set_eventhandlers(void * a, void * b, void * c) -#endif -{ - mib_events.mib_pick_mib_Widget = a; - mib_events.mib_move_mib_Widget = b; - mib_events.mib_unpick_mib_Widget = c; -} - -/*****************************************************************************/ - -void mib_apply_eventhandlers(Widget thisw, mib_Widget *actual) -{ - XtAddEventHandler(thisw, ButtonPressMask, FALSE, - mib_events.mib_pick_mib_Widget, (XtPointer)actual); - XtAddEventHandler(thisw, Button3MotionMask, FALSE, - mib_events.mib_move_mib_Widget, (XtPointer)actual); - XtAddEventHandler(thisw, ButtonReleaseMask, FALSE, - mib_events.mib_unpick_mib_Widget, (XtPointer)actual); - -} - -/*****************************************************************************/ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.h deleted file mode 100644 index 3b20908a333..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibload.h +++ /dev/null @@ -1,168 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with this file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -#include <stdio.h> -#include <X11/Intrinsic.h> -#include <X11/Shell.h> -#include <Xm/Xm.h> -#include <Xm/Text.h> -#include <Xm/TextF.h> -#include <Xm/RowColumn.h> -#include <Xm/MainW.h> -#include <Xm/Label.h> -#include <Xm/PushB.h> -#include <Xm/PushBG.h> -#include <Xm/ToggleB.h> -#include <Xm/ToggleBG.h> -#include <Xm/DrawingA.h> -#include <Xm/CascadeBG.h> -#include <Xm/SeparatoG.h> -#include <Xm/Frame.h> -#include <Xm/BulletinB.h> -#include <Xm/Scale.h> -#include <Xm/ScrollBar.h> -#include <Xm/Form.h> -#include <Xm/List.h> -#include <Xm/FileSB.h> -#include <Xm/AtomMgr.h> -#include <Xm/Protocols.h> -#include <Xm/MwmUtil.h> -#include "ace/OS.h" - - -/* Structure of mib_Widget */ -/*****************************************************************************/ - -typedef struct _mib_Widget { - char *mib_class; /* name of mib class (Button, TextBox, etc..)*/ - int mib_class_num; /* class number for ez reference :) */ - int mib_mynum; /* numbering for storage format */ - Widget me; /* Xt widget */ - int mib_selected; /* is selected */ - int mib_resizing; /* is resizing 1, or being moved 0 */ - int mib_resizetype;/* 1 = upper left, 2 = upper, 3 = ... */ - int mib_allowresize; /* can this widget be resized ? */ - - int clkx, clky; /* where user clicked */ - - void *myres; /* my resources (different for each widget) */ - - char *name; /* reference name of this widget */ - int width, height; /* width and height */ - - int topAttachment, bottomAttachment, leftAttachment, rightAttachment; - /* attachments 1=attached 0=not-attached */ - - int topOffset, bottomOffset, leftOffset, rightOffset; - /* offsets if attached */ - - struct _mib_Widget *parent; /* pointer to parent */ - struct _mib_Widget *sibling; /* remaining linked list of sibling widgets */ - struct _mib_Widget *prev; /* previous sibling or parent */ - struct _mib_Widget *child; /* linked list of children widgets */ -} mib_Widget; - -/* mib_Buffer structure */ -/*****************************************************************************/ - -typedef struct _mib_Buffer { - void *buffer; /* pointer to either a file or a char string */ - int buf_type; /* type of buffer (defined above) */ - int point; /* pointer for string */ - int buflen; /* length of string buffer */ -} mib_Buffer; - -/* mib_Widget functions */ -/*****************************************************************************/ - -void mib_add_mib_Widget(mib_Widget *, mib_Widget *); -void mib_add_backward(mib_Widget *, mib_Widget *); -void mib_remove_mib_Widget(mib_Widget *); -void mib_clear_myres(mib_Widget *); -#ifdef __cplusplus -mib_Widget *mib_new_mib_Widget(); -#else -mib_Widget *mib_new_mib_Widget(); -#endif -mib_Widget *mib_find_name(mib_Widget *, char *); -mib_Widget *mib_load_interface(Widget, char *, int); -int mib_count_all(mib_Widget *, int); -int mib_load_Root(Widget, mib_Widget **, mib_Buffer *); -mib_Widget *mib_load_public(mib_Widget *, mib_Widget *, mib_Buffer *); -int mib_load_mib_class(mib_Widget **, mib_Widget *, char *, char *, - mib_Buffer *); -int mib_load_private(mib_Widget *, mib_Buffer *); -void mib_reset_size(mib_Widget *); -int mib_read_line(mib_Buffer *, char *, char *); -#ifdef __cplusplus -void mib_set_eventhandlers(void (a)(...), void (b)(...), void (c)(...)); -#else -void mib_set_eventhandlers(void *, void *, void *); -#endif -void mib_apply_eventhandlers(Widget, mib_Widget *); - -/* supporting functions and structures */ -/*****************************************************************************/ - -typedef struct _menu_item { - char *label; - WidgetClass *wclass; - char mnemonic; - char *accelerator; - char *accel_text; -#ifdef __cplusplus - void (*callback)(Widget,void*,void*); -#else - void (*callback)(); -#endif - XtPointer callback_data; - struct _menu_item *subitems; -} MenuItem; - -Widget BuildMenu(Widget, int, char *, char, MenuItem *); - -/* mib class numbers */ - -#define MIB_NULL 0 -#define MIB_TEXTBOX 1 -#define MIB_BUTTON 2 -#define MIB_TOGGLE 3 -#define MIB_RADIOBOX 4 -#define MIB_DRAWINGAREA 5 -#define MIB_LABEL 6 -#define MIB_FRAME 7 -#define MIB_SCROLLBAR 8 -#define MIB_TEXTBIG 9 -#define MIB_LIST 10 -#define MIB_SCALE 11 -#define MIB_MENU 12 - -/* number of classes */ -#define MI_NUMCLASSES 12 - -/* for specifying creation of a widget with - default private values, no values at all (empty), - or no values and editable */ - -#define WDEFAULT 1 -#define WEMPTY 2 -#define WEDIT 3 - -/* for specifing whether we are loading an - interface from a file or from a string and whether it - is editable :) */ - -#define MI_FROMFILE 1 -#define MI_EDITFROMFILE 2 -#define MI_FROMSTRING 3 -#define MI_EDITFROMSTRING 4 - -#define MI_MAXSTRLEN 200 /* maximum string length */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibwidgets.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibwidgets.h deleted file mode 100644 index 778e2338682..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_mib/mibwidgets.h +++ /dev/null @@ -1,225 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1994 The Geometry Center; University of Minnesota - 1300 South Second Street; Minneapolis, MN 55454, USA; - -This file is free software; you can redistribute it and/or modify it only -under the the terms of the GNU GENERAL PUBLIC LICENSE which should be -included along with this file. This software may be obtained via anonymous -ftp from geom.umn.edu; email: software@geom.umn.edu. */ - -/* Author: Daeron Meyer */ - -/* Structure of mib_TextBox */ -/*****************************************************************************/ - -typedef struct _mib_TextBox { - char *init_contents; /* initial text contents */ - -} mib_TextBox; - -/* mib_TextBox functions */ -/*****************************************************************************/ -mib_Widget *mib_create_TextBox(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_TextBox(mib_Widget *); -void mib_save_TextBox(mib_Widget *, FILE *); -int mib_load_TextBox(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_Button */ -/*****************************************************************************/ - -typedef struct _mib_Button { - char *label; /* label on button */ - -} mib_Button; - -/* mib_Button functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Button(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Button(mib_Widget *); -void mib_save_Button(mib_Widget *, FILE *); -int mib_load_Button(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_Toggle */ -/*****************************************************************************/ - -typedef struct _mib_Toggle { - char *label; /* label on toggle */ - int isize; - -} mib_Toggle; - -/* mib_Toggle functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Toggle(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Toggle(mib_Widget *); -void mib_save_Toggle(mib_Widget *, FILE *); -int mib_load_Toggle(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_RadioBox */ -/*****************************************************************************/ -typedef struct _mib_RadioBox { - char **labels; /* array of labels */ - int numlabel; /* number of labels */ - Widget *buttons; /* pointers to each button */ - -} mib_RadioBox; - -/* mib_RadioBox functions */ - -/*****************************************************************************/ -mib_Widget *mib_create_RadioBox(mib_Widget *, char *, char*, int, int, int, - int, int); -void mib_delete_RadioBox(mib_Widget *); -void mib_save_RadioBox(mib_Widget *, FILE *); -int mib_load_RadioBox(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_DrawingArea */ -/*****************************************************************************/ -typedef struct _mib_DrawingArea { - int nothing; /* couldn't think of anything yet */ - -} mib_DrawingArea; - -/* mib_DrawingArea functions */ -/*****************************************************************************/ -mib_Widget *mib_create_DrawingArea(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_DrawingArea(mib_Widget *); -void mib_save_DrawingArea(mib_Widget *, FILE *); -int mib_load_DrawingArea(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_Label */ -/*****************************************************************************/ -typedef struct _mib_Label { - char *label; /* text in label */ - -} mib_Label; - -/* mib_Label functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Label(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Label(mib_Widget *); -void mib_save_Label(mib_Widget *, FILE *); -int mib_load_Label(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_Frame */ -/*****************************************************************************/ -typedef struct _mib_Frame { - int shadowtype; /* 0 = in, 1 = out, 2 = etched_in, 3 = etched_out */ - -} mib_Frame; - -/* mib_Frame functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Frame(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Frame(mib_Widget *); -void mib_save_Frame(mib_Widget *, FILE *); -int mib_load_Frame(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_ScrollBar */ -/*****************************************************************************/ -typedef struct _mib_ScrollBar { - int orientation; - -} mib_ScrollBar; - -/* mib_ScrollBar functions */ -/*****************************************************************************/ -mib_Widget *mib_create_ScrollBar(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_ScrollBar(mib_Widget *); -void mib_save_ScrollBar(mib_Widget *, FILE *); -int mib_load_ScrollBar(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_TextBig */ -/*****************************************************************************/ -typedef struct _mib_TextBig { - int nothing; /* couldn't think of anything yet */ - -} mib_TextBig; - -/* mib_TextBig functions */ -/*****************************************************************************/ -mib_Widget *mib_create_TextBig(mib_Widget *, char *, char *, int, int, int, int, int); -void mib_delete_TextBig(mib_Widget *); -void mib_save_TextBig(mib_Widget *, FILE *); -int mib_load_TextBig(mib_Widget *, mib_Buffer *); - - -/* Structure of mib_List */ -/*****************************************************************************/ -typedef struct _mib_List { - Widget real_list; - -} mib_List; - -/* mib_List functions */ -/*****************************************************************************/ -mib_Widget *mib_create_List(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_List(mib_Widget *); -void mib_save_List(mib_Widget *, FILE *); -int mib_load_List(mib_Widget *, mib_Buffer *); - -/* Structure of mib_Scale */ -/*****************************************************************************/ -typedef struct _mib_Scale { - int orientation; - -} mib_Scale; - -/* mib_Scale functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Scale(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Scale(mib_Widget *); -void mib_save_Scale(mib_Widget *, FILE *); -int mib_load_Scale(mib_Widget *, mib_Buffer *); - -/* Structure of mib_Menu */ -/*****************************************************************************/ -typedef struct _mib_Menu { - int numitems; /* number of items in menu*/ - MenuItem *my_menu; /* array of menu items */ - Widget *items; /* pointers to each item */ - -} mib_Menu; - -/* mib_Menu functions */ -/*****************************************************************************/ -mib_Widget *mib_create_Menu(mib_Widget *, char *, char *, int, int, int, - int, int); -void mib_delete_Menu(mib_Widget *); -void mib_save_Menu(mib_Widget *, FILE *); -int mib_load_Menu(mib_Widget *, mib_Buffer *); - -/*****************************************************************************/ - -typedef struct _mib_widget_funcs { - char *name; -#ifdef __cplusplus - mib_Widget *(*mib_create)(mib_Widget *parent, char *name, char *label, - int posx, int posy, int width, int height, int mib_fill); - void (*mib_delete)(mib_Widget *thisw); - void (*mib_save)(mib_Widget *thisw, FILE *fout); - int (*mib_load)(mib_Widget *thisw, mib_Buffer *fin); -#else - mib_Widget *(*mib_create)(); - void (*mib_delete)(); - void (*mib_save)(); - int (*mib_load)(); -#endif -} mib_widget_funcs; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp deleted file mode 100644 index 4df0a7e095d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.cpp +++ /dev/null @@ -1,763 +0,0 @@ -// $Id$ -#include "Audio_Server.h" - -Audio_Global::Audio_Global (void) - :bytes_sent (0), - start_time (0), - conn_tag (0), - serviceSocket (-1), - audioSocket (-1), - fd (0), - totalSamples (0), - fileSize (0), - cmd (0), - live_source (0), - databuf_size (0), - cmdsn (0), - nextsample (0), - sps (0), - spslimit (0), - spp (0), - pktbuf (0), - fbpara (0) -{ -} - -int -Audio_Global::CmdRead(char *buf, int psize) -{ - int res = wait_read_bytes(serviceSocket, buf, psize); - if (res == 0) return (1); - if (res == -1) { - fprintf(stderr, "AS error on read cmdSocket, size %d", psize); - perror(""); - return (-1); - } - return 0; -} - -void -Audio_Global::CmdWrite(char *buf, int size) -{ - int res = wait_write_bytes(serviceSocket, buf, size); - if (res == -1) { - if (errno != EPIPE) perror("AS writes to serviceSocket"); - exit(errno != EPIPE); - } -} - -int -Audio_Global::INITaudio(void) -{ - int result; - int failureType; /* 0 - can't open file, 1 - can't open live source */ - INITaudioPara para; - - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.version = ntohl(para.version); - para.nameLength = ntohl(para.nameLength); - para.para.encodeType = ntohl(para.para.encodeType); - para.para.channels = ntohl(para.para.channels); - para.para.samplesPerSecond = ntohl(para.para.samplesPerSecond); - para.para.bytesPerSample = ntohl(para.para.bytesPerSample); -#endif - if (para.nameLength>0) - result = CmdRead(audioFile, para.nameLength); - if (result != 0) - return result; - if (Mpeg_Global::session_num > Mpeg_Global::session_limit || para.version != VERSION) { - char errmsg[128]; - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - if (Mpeg_Global::session_num > Mpeg_Global::session_limit) { - sprintf(errmsg, - "Too many sessions being serviced, please try again later.\n"); - } - else { - sprintf(errmsg, "Version # not match, AS %d.%02d, Client %d.%02d", - VERSION / 100, VERSION % 100, - para.version / 100, para.version % 100); - } - write_string(serviceSocket, errmsg); - return(1); - } - memcpy(&audioPara, ¶.para, sizeof(audioPara)); - /* - fprintf(stderr, "Client Audio para: encode %d, ch %d, sps %d, bps %d.\n", - para.para.encodeType, para.para.channels, - para.para.samplesPerSecond, para.para.bytesPerSample); - */ - audioFile[para.nameLength] = 0; - { - int len = strlen(audioFile); - if (strncasecmp("LiveAudio", audioFile, 9) && - strcasecmp(".au", audioFile+len-3)) { - char errmsg[128]; - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - sprintf(errmsg, "%s without suffix .au", audioFile); - write_string(serviceSocket, errmsg); - return(1); - } - } - /* - fprintf(stderr, "Audio file %s got.\n", audioFile); - */ - - if (!strncasecmp("LiveAudio", audioFile, 9)) { - fd = OpenLiveAudio(&(para.para)); - if (fd == -1) { - failureType = 1; - goto failure; - } - fileSize =0x7fffffff; - totalSamples = fileSize / audioPara.bytesPerSample; - live_source = 1; - } - else { - LeaveLiveAudio(); - fd = open(audioFile, O_RDONLY); - if (fd == -1) - { - fprintf(stderr, "AS error on opening audio file %s", audioFile); - perror(""); - failureType = 0; - goto failure; - } - - /* Try to get audioFile format audioPara here */ - - /* figure out totalsamples */ - fileSize = lseek(fd, 0L, SEEK_END); - lseek(fd, 0L, SEEK_SET); - totalSamples = fileSize / audioPara.bytesPerSample; - /* - fprintf(stderr, "Total Samples=%d in audio file %ss.\n", totalSamples, audioFile); - */ - } - { - INITaudioReply reply; - - reply.para.encodeType = htonl(audioPara.encodeType); - reply.para.channels = htonl(audioPara.channels); - reply.para.samplesPerSecond = htonl(audioPara.samplesPerSecond); - reply.para.bytesPerSample = htonl(audioPara.bytesPerSample); - reply.totalSamples = htonl(totalSamples); - - reply.live = htonl(live_source); - reply.format = htonl(AUDIO_RAW); - - CmdWrite((char *)&cmd, 1); - CmdWrite((char *)&reply, sizeof(reply)); - } - return 0; - - failure: - { - /* - fprintf(stderr, "AS error: failed initializing audio file.\n"); - */ - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - write_string(serviceSocket, - failureType == 0 ? "Failed to open audio file for read." : - "Failed to connect to live audio source."); - return(1); - } -} - -/* send a packet of audio samples to audioSocket - returns: 0 - no more data from audio file: EOF reached; - 1 - More data is available from the audio file */ -int -Audio_Global::send_packet(int firstSample, int samples) -{ - long offset = firstSample * audioPara.bytesPerSample; - int size = samples * audioPara.bytesPerSample; - char * buf = (char *)pktbuf + sizeof(*pktbuf); - int len; - int resent = 0; - int segsize, sentsize; - - if (live_source) { - len = ReadLiveAudioSamples(buf, samples); - len *= audioPara.bytesPerSample; - } - else { - lseek(fd, offset, SEEK_SET); - while ((len = read(fd, buf, size)) == -1) { - if (errno == EINTR) - continue; /* interrupted */ - perror("AS error on read audio file"); - return(-1); - } - if (len < audioPara.bytesPerSample) { - return 0; - } - } - - samples = len / audioPara.bytesPerSample; - len = samples * audioPara.bytesPerSample; - bytes_sent += len; - pktbuf->firstSample = htonl(firstSample); - pktbuf->samples = htonl(samples); - pktbuf->actualSamples = htonl(samples); - pktbuf->dataBytes = htonl(len); - if (spslimit < sps) { /* interpolation needed */ - SFprintf(stderr, "AS audio sample interpolation not available yet.\n"); - } - segsize = sizeof(*pktbuf) + len; - if (conn_tag != 0) { - while ((sentsize = write(audioSocket, (char *)pktbuf, segsize)) == -1) { - if (errno == EINTR) /* interrupted */ - continue; - if (errno == ENOBUFS) { - if (resent) { - perror("AS Warning, pkt discarded because"); - break; - } - else { - resent = 1; - usleep(5000); - continue; - } - } - if (errno != EPIPE) { - fprintf(stderr, "AS error on send audio packet %d(%d):", - firstSample, samples); - perror(""); - } - exit((errno != EPIPE)); - } - } - else { - sentsize = wait_write_bytes(audioSocket, (char *)pktbuf, segsize); - if (sentsize == -1) { - if (errno != EPIPE) { - fprintf(stderr, "AS error on send audio packet %d(%d):", - firstSample, samples); - perror(""); - } - exit((errno != EPIPE)); - } - } - if (sentsize < segsize) { - SFprintf(stderr, "AS warning: message size %dB, sent only %dB\n", - segsize, sentsize); - } - /* - SFprintf(stderr, "AS sent audio packet %d(%d).\n", - firstSample, samples); - */ - return (len < size ? 0 : 1); -} - -/* send a packet of audio samples to audioSocket - returns: 0 - no more data from audio file: EOF reached; - 1 - More data is available from the audio file */ -int -Audio_Global::SendPacket(void) -{ - int moredata; - pktbuf->cmdsn = htonl(cmdsn); - pktbuf->resend = htonl(0); - pktbuf->samplesPerSecond = htonl(sps); - moredata = send_packet(nextsample, spp); - if (moredata) { - nextsample += spp; - } - return moredata; -} - -void -Audio_Global::ResendPacket(int firstsample, int samples) -{ - pktbuf->cmdsn = htonl(cmdsn); - pktbuf->resend = htonl(1); - pktbuf->samplesPerSecond = htonl(sps); - while (samples > 0) { - int size = samples < spp ? samples : spp; - send_packet(firstsample, size); - firstsample += size; - samples -= size; - if (samples > 0) { - usleep(10000); - } - } -} - -int -Audio_Global::PLAYaudio(void) -{ - int hasdata = 1; - int addSamples; - int packets = 0; - unsigned nextTime; - int upp; /* micro-seconds per packet */ - int delta_sps = 0; /* compensation for sps from feedback msgs */ - int nfds = (serviceSocket > audioSocket ? serviceSocket : audioSocket) + 1; - int result; - /* - fprintf(stderr, "PLAY . . .\n"); - */ - { - PLAYaudioPara para; - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.nextSample = ntohl(para.nextSample); - para.samplesPerSecond = ntohl(para.samplesPerSecond); - para.samplesPerPacket = ntohl(para.samplesPerPacket); - para.ABsamples = ntohl(para.ABsamples); - para.spslimit = ntohl(para.spslimit); -#endif - nextsample = para.nextSample; - cmdsn = para.sn; - sps = para.samplesPerSecond; - spslimit = para.spslimit; - spp = para.samplesPerPacket; - addSamples = para.ABsamples / 2; - if (spp * audioPara.bytesPerSample > databuf_size) { - spp = databuf_size / audioPara.bytesPerSample; - } - /* - SFprintf(stderr, "AS got CmdPLAY: sps %d\n", sps); - */ - } - /* - fprintf(stderr, "AS: nextSampe=%d for PLAY.\n", para.nextSample); - */ - - upp = (int)(1000000.0 / ((double)sps / (double)spp)); - nextTime = get_usec(); - - CmdWrite((char *)&nextTime, sizeof(int)); - - if (live_source) { - StartPlayLiveAudio(); - } - - for (;;) - { - struct fd_set read_mask, write_mask; - struct timeval tval; - unsigned curTime = get_usec(); - - if (hasdata) { - if (addSamples < - spp) { /* slow down by not sending packets */ - nextTime += upp; - addSamples += spp; - } - else { - int need_sleep = 0; - while (nextTime <= curTime && hasdata) { - if (need_sleep) usleep(5000); - hasdata = SendPacket(); - need_sleep = 1; - packets ++; - nextTime += upp; - if (addSamples > 0 && packets % SPEEDUP_SCALE == 0) { - addSamples -= spp; - usleep(5000); - hasdata = SendPacket(); - packets ++; - } - } - } - } - curTime = nextTime - curTime; - if (curTime > 5000000) curTime = 5000000; /* limit on 5 second weit time - in case error happens */ - tval.tv_sec = curTime / 1000000; - tval.tv_usec = curTime % 1000000; - FD_ZERO(&read_mask); - FD_SET(serviceSocket, &read_mask); - FD_SET(audioSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, hasdata ? &tval : NULL) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, hasdata ? &tval : NULL) == -1) -#endif - { - if (errno == EINTR) - continue; - perror("AS error on select reading or writing"); - return(-1); - } - if (FD_ISSET(serviceSocket, &read_mask)){ /* STOP, SPEED, or CLOSE*/ - unsigned char tmp; - result = CmdRead((char *)&tmp, 1); - if (result != 0) - return result; - switch (tmp) - { - case CmdSPEED: - { - SPEEDaudioPara para; - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.samplesPerSecond = ntohl(para.samplesPerSecond); - para.samplesPerPacket = ntohl(para.samplesPerPacket); - para.spslimit = ntohl(para.spslimit); -#endif - sps = para.samplesPerSecond; - spslimit = para.spslimit; - spp = para.samplesPerPacket; - if (spp * audioPara.bytesPerSample > databuf_size) { - spp = databuf_size / audioPara.bytesPerSample; - } - delta_sps = 0; /* reset compensation value */ - upp = (int)(1000000.0 / ((double)sps / (double)spp)); - /* - SFprintf(stderr, "AS got CmdSPEED: sps %d\n", sps); - */ - } - break; - case CmdSTOP: - { - int val; - cmd = tmp; - /* - fprintf(stderr, "AS: CmdSTOP. . .\n"); - */ - result = CmdRead((char *)&val, sizeof(int)); - if (result != 0) - return result; - /* - CmdWrite(AUDIO_STOP_PATTERN, strlen(AUDIO_STOP_PATTERN)); - */ - if (live_source) { - StopPlayLiveAudio(); - } - return 0; /* return from PLAYaudio() */ - } - case CmdCLOSE: - if (live_source) { - StopPlayLiveAudio(); - } - return(1); /* The whole AS session terminates */ - default: - if (live_source) { - StopPlayLiveAudio(); - } - fprintf(stderr, "AS error: cmd=%d while expects STOP/SPEED/CLOSE.\n", tmp); - return(-1); - } - } - - if (FD_ISSET(audioSocket, &read_mask)){ /* Feedback packet */ - int bytes, len; - for (;;) { - if (conn_tag >= 0) { - len = wait_read_bytes(audioSocket, (char *)fbpara, sizeof(*fbpara)); - if (len == 0) return(1); /* connection broken */ - else if (len < 0) { /* unexpected error */ - perror("AS read1 FB"); - return(-1); - } - } - else { /* discard mode packet stream, read the whole packet */ - len = read(audioSocket, (char *)fbpara, FBBUF_SIZE); - } - if (len == -1) { - if (errno == EINTR) continue; /* interrupt */ - else { - if (errno != EPIPE && errno != ECONNRESET) perror("AS failed to read() fbmsg header"); - break; - } - } - break; - } - if (len < sizeof(*fbpara)) { - if (len > 0) fprintf(stderr, - "AS warn read() len %dB < sizeof(*fbpara) %dB\n", - len, sizeof(*fbpara)); - continue; - } -#ifdef NeedByteOrderConversion - fbpara->type = ntohl(fbpara->type); -#endif - bytes = (fbpara->type > 0) ? - sizeof(APdescriptor) * (fbpara->type - 1) : - 0; - if (bytes > 0) { - if (conn_tag >= 0) { /* not discard mode packet stream, - read the rest of packet */ - len = wait_read_bytes(audioSocket, - ((char *)fbpara) + sizeof(*fbpara), - bytes); - if (len == 0) return(1); /* connection broken */ - else if (len < 0) { /* unexpected error */ - perror("AS read2 FB"); - return(-1); - } - len += sizeof(*fbpara); - } - } - bytes += sizeof(*fbpara); - if (len < bytes) { - if (len > 0) fprintf(stderr, - "AS only read partial FBpacket, %dB out of %dB.\n", - len, bytes); - continue; - } - if (live_source) { /* ignore all feedback messags for live source */ - continue; - } - -#ifdef NeedByteOrderConversion - fbpara->cmdsn = ntohl(fbpara->cmdsn); -#endif - if (len != sizeof(*fbpara) + - (fbpara->type ? (fbpara->type -1) * sizeof(APdescriptor) : 0)) { - /* unknown message, discard */ - SFprintf(stderr, "AS Unkown fb msg: len = %d, type = %d\n", - len, fbpara->type); - continue; - } - if (fbpara->cmdsn != cmdsn) { /* discard the outdated message */ - continue; - } -#ifdef NeedByteOrderConversion - { - int i, * ptr = (int *)fbpara + 2; - for (i = 0; i < (len >> 2) - 2; i++) *ptr = ntohl(*ptr); - } -#endif - if (fbpara->type == 0) { /* feedback message */ - /* - SFprintf(stderr, "AS got fbmsg: addsamples %d, addsps %d\n", - fbpara->data.fb.addSamples, fbpara->data.fb.addsps); - */ - addSamples += fbpara->data.fb.addSamples; - if (fbpara->data.fb.addsps) { - delta_sps += fbpara->data.fb.addsps; - upp = (int)(1000000.0 / ((double)(sps + delta_sps) / (double)spp)); - } - } - else { /* resend requests */ - APdescriptor * req = &(fbpara->data.ap); - int i; - /* - SFprintf(stderr, "AS got %d resend reqs\n", fbpara->type); - */ - for (i = 0; i < fbpara->type; i ++) { - ResendPacket(req->firstSample, req->samples); - req ++; - } - } - } - } -} - -void -Audio_Global::on_exit_routine(void) -{ - struct sockaddr_in peeraddr_in; - int size = sizeof(peeraddr_in); - - /* - fprintf(stderr, "An AS session terminated\n"); - */ - if (getpeername(serviceSocket, - (struct sockaddr *)&peeraddr_in, &size) == 0 && - peeraddr_in.sin_family == AF_INET) { - if (strncmp(inet_ntoa(peeraddr_in.sin_addr), "129.95.50", 9)) { - struct hostent *hp; - time_t val = time(NULL); - char * buf = ctime(&start_time); - - hp = gethostbyaddr((char *)&(peeraddr_in.sin_addr), 4, AF_INET); - buf[strlen(buf)-1] = 0; - printf("%s: %s %3dm%02ds %dB %s\n", - buf, - hp == NULL ? inet_ntoa(peeraddr_in.sin_addr) : hp->h_name, - (val - start_time) / 60, (val - start_time) % 60, - bytes_sent, audioFile); - } - } - ComCloseConn(serviceSocket); - ComCloseConn(audioSocket); -} - -Audio_Server::Audio_Server (void) -{ -} - -Audio_Server::Audio_Server (ACE_SOCK_Stream& control, - int rttag, - int max_pkt_size) -{ - this->init (control, - rttag, - max_pkt_size); -} - -int -Audio_Server::init (ACE_SOCK_Stream& control, - int rttag, - int max_pkt_size) -{ - int result; - int junk; - u_short port; - ACE_UINT32 ip; - - ACE_INET_Addr server_data_addr; - ACE_INET_Addr client_data_addr; - - // do the handshaking. - // Client is sending us JUNK - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - control.recv_n (&junk, sizeof junk); - ACE_DEBUG ((LM_DEBUG,"%s,%d,received %d\n",__FILE__,__LINE__,junk)); - // Client is sending us it's port number - control.recv_n (&port, sizeof port); - ACE_DEBUG ((LM_DEBUG,"%s,%d,received %u\n",__FILE__,__LINE__,port)); - // Client is sending us it's IP addr - control.recv_n (&ip, sizeof ip); - ACE_DEBUG ((LM_DEBUG,"%s,%d,received %d\n",__FILE__,__LINE__,ip)); - - client_data_addr.set (port, - ip, - 0); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Client IP == %s, " - "Client Port == %d\n", - client_data_addr.get_host_name (), - client_data_addr.get_port_number ())); - - server_data_addr.set ((unsigned short)0); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - // "Connect" our dgram to the client endpoint. - if (this->dgram_.open (client_data_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) UDP open failed: %p\n"), - -1); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - if (this->dgram_.get_local_addr (server_data_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) UDP get_local_addr failed: %p\n", - "address:"), - -1); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - port = server_data_addr.get_port_number (); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - // %% we need to fix this ? - // XXX this is a hack to get my IP address set correctly! By default, - // get_ip_address is returning 0.0.0.0, even after calling - // get_local_addr () !! - server_data_addr.set (port, - server_data_addr.get_host_name ()); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) UDP IP address is %s, and the port number is %d\n", - server_data_addr.get_host_addr (), - server_data_addr.get_port_number ())); - - ip = server_data_addr.get_ip_address (); - - port = htons (port); - ip = htonl (ip); - // Client wants us to send the port number first - control.send_n (&port, - (int) sizeof (u_short)); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); - // Client wants us to send it the IP address - control.send_n (&ip, - (int) sizeof (ACE_UINT32)); - ACE_DEBUG ((LM_DEBUG,"%s,%d\n",__FILE__,__LINE__)); -// // Client is sending us a command -// u_char cmd; -// if (control.recv_n (&cmd, -// 1) == -1) -// ACE_ERROR_RETURN ((LM_ERROR, -// "%P|%t, Command recieve failed: %p"), -// -1); - - // end of handshaking. - this->audio_global_.serviceSocket = control.get_handle (); - this->audio_global_.audioSocket = this->dgram_.get_handle (); - this->audio_global_.conn_tag = max_pkt_size; - - if (max_pkt_size < 0) max_pkt_size = -max_pkt_size; - else if (max_pkt_size == 0) max_pkt_size = 1024 * 1024; - - this->audio_global_.start_time = time(NULL); - - // atexit(on_exit_routine); - - result = this->audio_global_.INITaudio (); - - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Audio_Server: "), - result); - - this->audio_global_.fbpara = (AudioFeedBackPara *)malloc(FBBUF_SIZE); - if (this->audio_global_.fbpara == NULL) { - perror("AS failed to allocate mem for fbpara"); - return (-1); - } - - this->audio_global_.databuf_size = max_pkt_size - sizeof(AudioPacket); - if (this->audio_global_.databuf_size > DATABUF_SIZE) - this->audio_global_.databuf_size = DATABUF_SIZE; - - this->audio_global_.pktbuf = (AudioPacket *)malloc(sizeof(AudioPacket) + - this->audio_global_.databuf_size); - if (this->audio_global_.pktbuf == NULL) { - perror("AS failed to allocate mem for pktbuf"); - return(-1); - } - return 0; -} - -int -Audio_Server::set_peer (void) -{ - return 0; -} -int -Audio_Server::run (void) -{ - int result; - for (;;) - { - /* - fprintf(stderr, "AS: waiting for a new command...\n"); - */ - result = this->audio_global_.CmdRead((char *)&(this->audio_global_.cmd), 1); - if (result != 0) - return result; - switch (this->audio_global_.cmd) - { - case CmdPLAY: - result = this->audio_global_.PLAYaudio(); - if (result != 0) - return result; - break; - case CmdCLOSE: - /* - fprintf(stderr, "a session closed.\n"); - */ - return(0); - break; - default: - fprintf(stderr, "audio channel command %d not recoganizeable\n", - this->audio_global_.cmd); - break; - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.h deleted file mode 100644 index b8fb4c6e1fd..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Audio_Server.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- C++ -*- */ -//$Id$ - -#if !defined (_AUDIO_SERVER_H) -#define _AUDIO_SERVER_H - -#include <sys/types.h> -#include <netdb.h> -#include <string.h> -#include <stdlib.h> - -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <time.h> -#include <sys/time.h> -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include "include/common.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/com.h" -#include "server_proto.h" - -#include "ace/SOCK_CODgram.h" -#include "ace/SOCK_Stream.h" - -#define DATABUF_SIZE 500 - -#define SPEEDUP_SCALE 5 -#define MAX_RESEND_REQS 10 -#define FBBUF_SIZE (sizeof(AudioFeedBackPara) + \ - (MAX_RESEND_REQS - 1) * sizeof(APdescriptor)) - - - class Audio_Global - { - public: - Audio_Global (void); - // Default constructor. - int CmdRead(char *buf, int psize); - void CmdWrite(char *buf, int size); - int INITaudio(void); - int send_packet(int firstSample, int samples); - int SendPacket(void); - void ResendPacket(int firstsample, int samples); - int PLAYaudio(void); - void on_exit_routine(void); - - public: - int bytes_sent ; - time_t start_time; - - int conn_tag; - - int serviceSocket; - int audioSocket ; - - char audioFile[PATH_SIZE]; - int fd; - AudioParameter audioPara; - int totalSamples; - int fileSize; - unsigned char cmd; - int live_source ; - - int databuf_size; - int cmdsn; - int nextsample; - int sps; /* audio play speed given by the client: samples per second */ - int spslimit; - int spp; /* samples per packet */ - AudioPacket * pktbuf ; - AudioFeedBackPara * fbpara ; - }; - -class Audio_Server -{ -public: - Audio_Server (void); - // Default constructor - Audio_Server (ACE_SOCK_Stream& control, - int rttag, - int max_pkt_size); - // Taking the control,data fd's and rttag. - int init (ACE_SOCK_Stream& control, - int rttag, - int max_pkt_size); - // inits the Audio_Server - int run (void); - // runs the loop. - int set_peer (void); - // sets the peer endpoint. -private: - Audio_Global audio_global_; - ACE_SOCK_CODgram dgram_; -}; -#endif diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp deleted file mode 100644 index 94aa88dbd77..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.cpp +++ /dev/null @@ -1,2230 +0,0 @@ -// $Id$ - -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#include "Globals.h" - -int Mpeg_Global::parentpid = -1; -int Mpeg_Global::listenSocketIn = -1; -int Mpeg_Global::listenSocketUn = -1; -struct linger Mpeg_Global::linger = {1,1}; -int Mpeg_Global::live_audio = 0; -int Mpeg_Global::live_video = 0; /* 0 - no, 1 - to open, 2 - opened */ -int Mpeg_Global::drift_ppm = 0; /* clock drift in ppm */ -int Mpeg_Global::session_limit = SESSION_NUM; -int Mpeg_Global::session_num = 0; -int Mpeg_Global::rttag = 0; - -int Video_Timer_Global::timerHeader = 0; -int Video_Timer_Global::timerGroup = 0; -int Video_Timer_Global::timerFrame = 0; -int Video_Timer_Global::timerOn = 0; -int Video_Timer_Global::timerAdjust = 0; -int Video_Timer_Global::preTimerVal = 0; - -// Initialize the nasty int's, doubles and their friends. - -Video_Global::Video_Global (void) -{ - live_source = 0; - video_format = 0; - - pkts_sent = 0; - start_time = 0; - - conn_tag = -1; - - normalExit = 1; - - serviceSocket = 0; - videoSocket = -1; - - ACE_OS::memset (videoFile, - 0, - PATH_SIZE); - fp = 0; - - needHeader = 0; - - lastRef [0] = lastRef [1] = 0; - - lastRefPtr = 0; - currentUPF = 0; - addedUPF = 0; - addedSignals = 0; - VStimeAdvance = 0; - fps = 0; /* current frames-per-second: playback speed */ - frameRateLimit = 0; - - packet = 0; - packetBufSize = 0; - msgsn = 0; - packetsn = 0; - msgsize = 0; - - precmd = 0; - cmd = 0; - cmdsn = 0; - nextFrame = 0; - nextGroup = 0; - firstPatternSize = 0; - firstSendPattern = 0; - sendPatternGops = 0; - ACE_OS::memset (sendPattern, - 0, - PATTERN_SIZE); - -#ifdef STAT - framesSent = 0; -#endif /* STAT */ - - fileSize = 0; - maxS = 0; - maxG = 0; - maxI = 0; - maxP = 0; - maxB = 0; - minS = 0x7fffffff; - minG = 0x7fffffff; - minI = 0x7fffffff; - minP = 0x7fffffff; - minB = 0x7fffffff; - - numS = 0; - numG = 0; - numF = 0; - numI = 0; - numP = 0; - numB = 0; - - averageFrameSize = 0; - horizontalSize = 0; - verticalSize = 0; - pelAspectRatio = 0; - pictureRate = 0; - vbvBufferSize = 0; - firstGopFrames = 0; - patternSize = 0; - - ACE_OS::memset (pattern, - 0, - PATTERN_SIZE); - - // struct pointers - systemHeader = 0; - - gopTable = 0; - - frameTable = 0; - - // playvideo local vars - - preGroup = -1; - preHeader = -1; - preFrame = -1; - - fast_preGroup = -1; - fast_preHeader= -1; -} - -int -Video_Global::FBread (char *buf, int size) -{ - int res; - - while ((res = (this->conn_tag >= 0 ? wait_read_bytes (this->videoSocket, buf, size) : - read (this->videoSocket, buf, size))) == -1) - { - if (errno == EINTR) {errno = 0; continue; } - if (errno == EPIPE || errno == ECONNRESET) exit (0); - perror ("VS reads Feedback this->packet"); - return -1; - } - - if (res < size) - { - if (res) - // @@ Can you please convert the printfs() and perrors to use - // the appropriate ACE_DEBUG and ACE_ERROR macros? - fprintf (stderr, "VS warn: FBread () res %dB < size %dB\n", res, size); - return -1; - } - return 0; -} - -// send a given this->packet pointed by 'this->packet' to the network. - -int -Video_Global::first_packet_send_to_network (int timeToUse) -{ - int count = 0; - VideoMessage * msghd = (VideoMessage *) (((char *) this->packet) - sizeof (VideoMessage)); - int sent = 0; - int packetSize = ntohl (this->packet->dataBytes); - - msghd->packetsn = htonl (this->packetsn ++); - msghd->packetSize = htonl (packetSize + sizeof (* this->packet)); - - // fprintf (stderr, "VS to send FIRST pkt %d of size %d.\n", - // ntohl (msghd->packetsn), ntohl (msghd->packetSize)); - - - { - VideoMessage * msg = NULL; - int size = packetSize + sizeof (* this->packet); /* msghd->this->packetSize */ - int offset = 0; - int targetTime; - - if (size > this->msgsize) - { - if (!timeToUse) - { - timeToUse = (this->msgsize + sizeof (*msg) + 28) * 2; - /* - set the max network as 500KB. - 28 - UDP header size - */ - /* - fprintf (stderr, "computed timeToUse %d. ", timeToUse); - */ - } - else - { - timeToUse = (timeToUse * 7) >> 3; - /* - fprintf (stderr, "preset timeToUse %d.", timeToUse); - */ - timeToUse /= (size + this->msgsize - 1) / this->msgsize; - timeToUse = min (timeToUse, (this->msgsize + sizeof (*msg) + 28) * 100); - /* limit min network bandwidth = 10K */ - } - - } - while (size > 0) - { - int segsize, sentsize; - int resent = 0; - - if (msg == NULL) - { /* first message for current this->packet - */ - count = 0; - msg = msghd; - targetTime = get_usec (); - } - else { -#if 0 - /* the select () is not precise enough for being used here*/ - int sleepTime; - targetTime += timeToUse; - sleepTime = get_duration (get_usec (), targetTime); - if (sleepTime >= 5000) { /* resolution of timer is 10,000 usec */ - usleep (sleepTime); /* not first message, wait for a while */ - } -#endif - /* - count ++; - if (! (count % 10)) usleep (10000); - */ - msg = (VideoMessage *) ((char *)msg + this->msgsize); - memcpy ((char *)msg, (char *)msghd, sizeof (* msg)); - } - - msg->msgsn = htonl (this->msgsn++); - msg->msgOffset = htonl (offset); - msg->msgSize = htonl (min (size, this->msgsize)); - // send the header seperately first - segsize = sizeof (*msg); - // ACE_DEBUG ((LM_DEBUG, - // "(%P|%t) Sending the header, of size %d\n", - // segsize)); - - while (write (this->videoSocket, - (char *)msg, - segsize) == -1) - { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - if (resent) { - perror ("Warning, pkt discarded because"); - sent = -1; - break; - } - else { - resent = 1; - perror ("VS to sleep 5ms"); - usleep (5000); - continue; - } - } - if (errno != EPIPE) { - fprintf (stderr, "VS error on send this->packet %d of size %d ", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - perror (""); - } - exit (errno != EPIPE); - } - - - // segsize = min (size, this->msgsize)+sizeof (*msg); - segsize = min (size, this->msgsize); - - if (this->conn_tag != 0) { /* this->packet stream */ - cerr << "sending " << segsize << " on fd = " << this->videoSocket << endl; - while ((sentsize = write (this->videoSocket, - (char *)msg + sizeof (*msg), - segsize)) == -1) { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - if (resent) { - perror ("Warning, pkt discarded because"); - sent = -1; - break; - } - else { - resent = 1; - perror ("VS to sleep 5ms"); - usleep (5000); - continue; - } - } - if (errno != EPIPE) { - fprintf (stderr, "VS error on send this->packet %d of size %d ", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - perror (""); - } - exit (errno != EPIPE); - } - } - else { - sentsize = wait_write_bytes (this->videoSocket, (char *)msg, segsize); - if (sentsize == -1) { - if (errno != EPIPE) { - fprintf (stderr, "VS error on send this->packet %d of size %d ", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - perror (""); - } - exit (errno != EPIPE); - } - } - if (sentsize < segsize) { - SFprintf (stderr, "VS warning: message size %dB, sent only %dB\n", - segsize, sentsize); - } - if (sent == -1) - break; - /* - fprintf (stderr, "VS: message %d of size %d sent.\n", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - */ - size -= this->msgsize; - offset += this->msgsize; - } - } - /* - fprintf (stderr, "sent = %d\n", sent); - */ - if (!sent) this->pkts_sent ++; - return sent; -} - -/* - * send a this->packet with given this->systemHeader (optional), gop (optional) and frame. - * - * sh - system header id, if -1, then no system header will be sent. - * otherwise, only when frame == 0, the given system header will be sent. - * gop - group of pictures, gop header will be sent when frame == 0 - * (first I frame ); - * frame - frame to be sent, offset internal to given gop. - */ - -/* returns: 0 - this->packet sent, -1 - this->packet not sent (failed) */ - -int -Video_Global::SendPacket (int shtag, - int gop, - int frame, - int timeToUse, - int first_time) -/* frame maybe out of range (PLAY, STEP), in this case, END_SEQ is sent - to force display of last frame in VD */ -{ - char * buf = ((char *) this->packet) + sizeof (VideoPacket); - int f = this->gopTable[gop].previousFrames + frame; - int sh = this->gopTable[gop].systemHeader; - /* - SFprintf (stderr, "VS to send this->packet gop-%d, frame-%d.\n", gop, frame); - */ - - this->packet->currentUPF = ntohl (this->currentUPF); - - if (frame >= this->gopTable[gop].totalFrames) - { - this->packet->cmd = htonl (this->cmd); - this->packet->cmdsn = htonl (this->cmdsn); - this->packet->sh = htonl (sh); - this->packet->gop = htonl (gop); - this->packet->frame = htonl (this->numF); - this->packet->display = htonl (this->numF-1); - this->packet->future = htonl ((unsigned)-1); - this->packet->past = htonl ((unsigned)-1); - this->packet->dataBytes = htonl (4); - * (int*) ((char*)this->packet + sizeof (*this->packet)) = htonl (SEQ_END_CODE); - - return send_to_network (timeToUse); - } - - if (frame) - shtag = 0; - else if (this->needHeader) - { - shtag = 1; - this->needHeader = 0; - } - - this->packet->cmd = htonl (this->cmd); - this->packet->cmdsn = htonl (this->cmdsn); - this->packet->sh = htonl (sh); - this->packet->gop = htonl (gop); - this->packet->frame = htonl (f); - if (this->frameTable[f].type == 'B') - { - int pre1 = -1, pre2 = -1, i = f; - while (i>0) - if (this->frameTable[--i].type != 'B') - { - pre1 = i; - break; - } - while (i>0) - if (this->frameTable[--i].type != 'B') - { - pre2 = i; - break; - } - if (pre2 == -1) - { - /* - fprintf (stderr, - "frame %d-%d (%d) is a B without past ref, no to be sent.\n", - gop, frame, f); - */ - return -1; - } - if (pre1 != this->lastRef[this->lastRefPtr] || - pre2 != this->lastRef[1 - this->lastRefPtr]) - { - /* - fprintf (stderr, - "send of B frame %d gaveup for past %d/future %d ref not sent.\n", - f, pre2, pre1); - */ - return -1; - } - this->packet->display = htonl (f); - this->packet->future = htonl (pre1); - this->packet->past = htonl (pre2); - } - else - { - int next = f; - int pre = f; - - while (next < this->numF && this->frameTable[++next].type == 'B'); - while (pre > 0 && this->frameTable[--pre].type == 'B'); - if (this->frameTable[f].type == 'P' && pre != this->lastRef[this->lastRefPtr]) - { - /* - fprintf (stderr, - "send of P frame %d gaveup for past ref %d not sent.\n", - f, pre); - fprintf (stderr, "ref0=%d, ref1=%d, ptr=%d.\n", - this->lastRef[0], this->lastRef[1], this->lastRefPtr); - */ - return -1; - } - this->packet->display = htonl (next); - this->packet->future = htonl ((unsigned)-1); - this->packet->past = htonl (this->frameTable[f].type == 'P' ? pre : (unsigned)-1); - } - { - char * ptr = buf; - int size = 0, offset = 0, i; - if (shtag) /* send system header */ - { - size = this->systemHeader[sh].size; - FileRead (this->systemHeader[sh].offset, ptr, size); - ptr += size; - } - if (!frame) /* send gop header */ - { - size = this->gopTable[gop].headerSize; - FileRead (this->gopTable[gop].offset, ptr, size); - ptr += size; - } - size = this->frameTable[f].size; - for (i=this->gopTable[gop].previousFrames; i<f; i++) - offset += this->frameTable[i].size; - FileRead ((this->gopTable[gop].firstIoffset + offset), ptr, size); - ptr += size; - this->packet->dataBytes = htonl (ptr - buf); - } - - { - int sent; - if (first_time == 1) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Sending first frame to client\n")); - sent = first_packet_send_to_network (timeToUse); - } - else - sent = send_to_network (timeToUse); - if (!sent) - { - /* - fprintf (stderr, "%c%d\n", this->frameTable[f].type, f); - fprintf (stderr, "%c frame %d sent.\n", this->frameTable[f].type, f); - */ - if (this->frameTable[f].type != 'B') - { - this->lastRefPtr = 1 - this->lastRefPtr; - this->lastRef[this->lastRefPtr] = f; - } - } - return sent; - } -} - -int -Video_Global::CmdRead (char *buf, int psize) -{ - int res = wait_read_bytes (this->serviceSocket, - buf, - psize); - if (res == 0) return (1); - if (res == -1) { - fprintf (stderr, "VS error on read this->cmdSocket, size %d", psize); - perror (""); - return (-1); - } - return 0; -} - -int -Video_Global::CmdWrite (char *buf, int size) -{ - int res = wait_write_bytes (this->serviceSocket, buf, size); - if (res == -1) { - if (errno != EPIPE) perror ("VS writes to this->serviceSocket"); - return (-1); - } - return 0; -} - -int -Video_Global::PLAYliveVideo (PLAYpara * para) -{ - int doscale; - int count; - int first_frame; - int frame = para->nextFrame; - int nfds = (this->serviceSocket > this->videoSocket ? this->serviceSocket : this->videoSocket) + 1; - struct fd_set read_mask; - struct timeval tval = {0, 0}; - double ratio; - int result; - - this->currentUPF = (int) (1000000.0 / this->fps); /* ignore para.usecPerFrame */ - if (this->frameRateLimit < this->fps) { - doscale = 1; - ratio = min (this->frameRateLimit, this->fps) / this->fps; - first_frame = frame; - count = 0; - /* - fprintf (stderr, "doscale %d, this->frameRateLimit %5.2f, this->fps %5.2f, ratio %5.2f\n", - doscale, this->frameRateLimit, this->fps, ratio); - */ - } - else doscale = 0; - StartPlayLiveVideo (); - - for (;;) { - - if (doscale) { - for (;;) { - if ((int) ((frame - first_frame) * ratio + 0.5) < count) frame ++; - else break; - } - count ++; - } - SendPicture (&frame); - frame ++; - - FD_ZERO (&read_mask); - FD_SET (this->serviceSocket, &read_mask); - FD_SET (this->videoSocket, &read_mask); - - // @@ Is this code actually used anymore, i.e., do we need to - // ACE-ify it? - -#ifdef _HPUX_SOURCE - if (select (nfds, (int *)&read_mask, NULL, NULL, &tval) == -1) -#else - if (select (nfds, &read_mask, NULL, NULL, &tval) == -1) -#endif - { - if (errno == EINTR) - continue; - perror ("Error - VS select between service and video sockets"); - StopPlayLiveVideo (); - exit (1); - - } - if (FD_ISSET (this->serviceSocket, &read_mask)) /* stop */ - { - u_char tmp; - result = CmdRead ((char *)&tmp, 1); - if (result != 0) - return result; - if (tmp == CmdCLOSE) { - StopPlayLiveVideo (); - exit (0); - } - else if (tmp == CmdSTOP) { - this->cmd = tmp; - /* - fprintf (stderr, "VS: this->CmdSTOP. . .\n"); - */ - result = CmdRead ((char *)&this->cmdsn, sizeof (int)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - this->cmdsn = ntohl (this->cmdsn); -#endif - StopPlayLiveVideo (); - break; - } - else if (tmp == CmdSPEED) - { - SPEEDpara speed_para; - /* - fprintf (stderr, "VS: this->CmdSPEED. . .\n"); - */ - result = CmdRead ((char *)&speed_para, sizeof (speed_para)); - if (result != 0) - return result; - /* ignore this thing for live video */ - } - else - { - fprintf (stderr, "VS error (live): this->cmd=%d while expect STOP/SPEED.\n", tmp); - this->normalExit = 0; - StopPlayLiveVideo (); - exit (1); - } - } - if (FD_ISSET (this->videoSocket, &read_mask)) /* feedback, only for frame rate - adjustment */ - { - VideoFeedBackPara fb_para; - if (FBread ((char *)&fb_para, sizeof (fb_para)) == -1 || - ntohl (fb_para.cmdsn) != this->cmdsn) { - /* - SFprintf (stderr, "VS warning: a FB this->packet discarded.\n"); - */ - return 0; - } -#ifdef NeedByteOrderConversion - fb_para.this->frameRateLimit1000 = ntohl (fb_para.this->frameRateLimit1000); -#endif - this->frameRateLimit = fb_para.frameRateLimit1000 / 1000.0; - if (this->frameRateLimit < this->fps) { - doscale = 1; - ratio = min (this->frameRateLimit, this->fps) / this->fps; - first_frame = frame; - count = 0; - /* - fprintf (stderr, "doscale %d, this->frameRateLimit %5.2f, this->fps %5.2f, ratio %5.2f\n", - doscale, this->frameRateLimit, this->fps, ratio); - */ - } - else doscale = 0; - } - } - return 0; -} - -void -Video_Global::ComputeFirstSendPattern (float limit) -{ - char * buf = this->firstSendPattern; - int len = this->firstPatternSize; - char * pat = (char *)malloc (len); - int f; - - if (pat == NULL) { - fprintf (stderr, "VS error on allocating %d bytes for computing first SP", len); - perror (""); - exit (1); - } - for (f = 0; f < len; f ++) { - pat[f] = this->frameTable[f].type; - } - memset (buf, 0, len); - - if (limit <= 0) - limit = 1.0; - - f = (int) ((double)len * - ((double)limit / (1000000.0 / (double)this->currentUPF)) + 0.5); - /* rounded to integer, instead of truncated */ - if (f >= len) - f = len; - else if (f <= 1) - f = 1; - - ComputeSendPattern (pat, buf, len, f); - - /* - f = len - f; - fprintf (stderr, "this->Firstthis->Sendthis->Pattern (%d frames dropped): ", f); - { - int i; - for (i = 0; i < len; i ++) - fputc (buf[i] ? pat[i] : '-', stderr); - } - fputc ('\n', stderr); - */ - free (pat); -} - -int -Video_Global::FrameToGroup (int * frame) -{ - int f = * frame; - int i = 0; - while (i < this->numG && this->gopTable[i].previousFrames <= f) i++; - i --; - * frame = f - this->gopTable[i].previousFrames; - return i; -} - -int -Video_Global::SendReferences (int group, int frame) -{ - u_char orgcmd; - int i, base; - int pregroup; - int result; - - if (group < 0 || group >= this->numG) return 0; - if (frame <= 0 || frame >= this->gopTable[group].totalFrames) return 0; - - orgcmd = this->cmd; - this->cmd = CmdREF; - - if (group > 0) { - pregroup = 1; - base = this->gopTable[group].previousFrames; - for (i = 0; i <= frame; i ++) { - if (this->frameTable[i + base].type == 'P') { - pregroup = 0; - break; - } - } - } - else pregroup = 0; - - if (pregroup) { /* reference frame can be in previous group */ - pregroup = group -1; - base = this->gopTable[pregroup].previousFrames; - for (i = 0; i < this->gopTable[pregroup].totalFrames; i ++) { - if (this->frameTable[i + base].type != 'B') { - /* - SFprintf (stderr, "REF group%d, frame%d\n", pregroup, i); - */ - result = SendPacket (i == 0, pregroup, i, 0); - if (result != 0) - return result; - } - } - } - - base = this->gopTable[group].previousFrames; - for (i = 0; i < frame; i ++) { - if (this->frameTable[i + base].type != 'B') { - /* - SFprintf (stderr, "REF group%d, frame%d\n", group, i); - */ - SendPacket (i == 0, group, i, 0); - } - } - this->cmd = orgcmd; -} - -int -Video_Global::GetFeedBack () -{ - VideoFeedBackPara para; - struct itimerval val; - int timerUsec; - - if (FBread ((char *)¶, sizeof (para)) == -1 || - ntohl (para.cmdsn) != this->cmdsn) { - /* - SFprintf (stderr, "VS warning: a FB this->packet discarded.\n"); - */ - return -1; - } -#ifdef NeedByteOrderConversion - para.this->needHeader = ntohl (para.this->needHeader); - para.addUsecPerFrame = ntohl (para.addUsecPerFrame); - para.addFrames = ntohl (para.addFrames); - para.this->sendthis->PatternGops = ntohl (para.this->sendthis->PatternGops); - para.this->frameRateLimit1000 = ntohl (para.this->frameRateLimit1000); -#endif - this->frameRateLimit = para.frameRateLimit1000 / 1000.0; - this->sendPatternGops = para.sendPatternGops; - - if (!Video_Timer_Global::timerOn) return 0; - - this->needHeader = para.needHeader; - memcpy (this->sendPattern, para.sendPattern, PATTERN_SIZE); - if (para.addFrames <= 0 || Video_Timer_Global::timerAdjust < MAX_TIMER_ADJUST) - { - Video_Timer_Global::timerAdjust += para.addFrames * SPEEDUP_INV_SCALE; - Video_Timer_Global::TimerSpeed (); - } - else /* drastic compensation for big gap */ - this->addedSignals += para.addFrames; - if (para.addUsecPerFrame) { - this->addedUPF += para.addUsecPerFrame; - Video_Timer_Global::TimerSpeed (); - } - /* - SFprintf (stderr, "VS fb: addf %d, addupf %d\n", - para.addFrames, para.addUsecPerFrame); - */ - - return 0; -} - -int -Video_Global::SendPicture (int * frame) -{ - int size; - char * buf = ((char *) this->packet) + sizeof (VideoPacket); - /* - SFprintf (stderr, "VS to send picture %d.\n", *frame); - */ - - size = ReadLiveVideoPicture (frame, buf, this->packetBufSize); - - this->packet->currentUPF = ntohl (this->currentUPF); - this->packet->cmd = htonl (this->cmd); - this->packet->cmdsn = htonl (this->cmdsn); - this->packet->sh = this->packet->gop = this->packet->frame = this->packet->display = htonl (*frame); - this->packet->future = htonl ((unsigned)-1); - this->packet->past = htonl ((unsigned)-1); - - this->packet->dataBytes = htonl (size); - - return send_to_network (this->currentUPF); -} - -int -Video_Global::ReadInfoFromFile (void) -{ - int fd = -1, i; - int fnlen = strlen (this->videoFile); - - strcpy (&this->videoFile[fnlen], ".Info"); - fd = open (this->videoFile, O_RDONLY); - if (fd == -1) - { - fprintf (stderr, "Reminder: VS fails to open %s for read, ", this->videoFile); - perror ("try create one"); - goto fail_ReadInfoFromFile; - } - read_int (fd, &i); - if (i != this->fileSize) - { - fprintf (stderr, "Warning: this->fileSize in Info: %d not the same as actual %d.\n", - i, this->fileSize); - goto fail_ReadInfoFromFile; - } - - read_int (fd, &this->maxS); - read_int (fd, &this->maxG); - read_int (fd, &this->maxI); - read_int (fd, &this->maxP); - read_int (fd, &this->maxB); - read_int (fd, &this->minS); - read_int (fd, &this->minG); - read_int (fd, &this->minI); - read_int (fd, &this->minP); - read_int (fd, &this->minB); - read_int (fd, &this->numS); - read_int (fd, &this->numG); - read_int (fd, &this->numF); - read_int (fd, &this->numI); - read_int (fd, &this->numP); - read_int (fd, &this->numB); - read_int (fd, &this->averageFrameSize); - read_int (fd, &this->horizontalSize); - read_int (fd, &this->verticalSize); - read_int (fd, &this->pelAspectRatio); - read_int (fd, &this->pictureRate); - read_int (fd, &this->vbvBufferSize); - read_int (fd, &this->patternSize); - - memset (this->pattern, 0, PATTERN_SIZE); - read_bytes (fd, this->pattern, this->patternSize); -#ifdef STAT - this->framesSent = (char *)malloc ((this->numF + 7)>>3); - if (this->framesSent == NULL) - { - fprintf (stderr, "Error: VS fails to alloc mem for this->framesSent for %d frames", this->numF); - perror (""); - exit (1); - } -#endif - this->systemHeader = (struct Video_Global::SystemHeader *)malloc (sizeof (struct Video_Global::SystemHeader) * this->numS); - if (this->systemHeader == NULL) - { - perror ("Error: VS error on malloc this->SystemHeader"); - exit (1); - } - this->gopTable = (struct Video_Global::GopTable *)malloc (sizeof (struct Video_Global::GopTable) * this->numG); - if (this->gopTable == NULL) - { - perror ("Error: VS error on malloc GopHeader"); - exit (1); - } - this->frameTable = (struct Video_Global::FrameTable *)malloc (sizeof (Video_Global::FrameTable) * this->numF); - if (this->frameTable == NULL) - { - perror ("Error: VS error on malloc this->frameTable"); - exit (1); - } - this->packetBufSize = this->maxS + this->maxG + max (this->maxI, max (this->maxP, this->maxB)); - this->packet = (VideoPacket *)malloc (sizeof (VideoMessage) + sizeof (VideoPacket) + - this->packetBufSize); - if (this->packet == NULL) - { - perror ("Error: VS error on malloc this->packet buffer"); - exit (1); - } - this->packet = (VideoPacket *) ((char *)this->packet + sizeof (VideoMessage)); - - for (i = 0; i < this->numS; i ++) - { - read_int (fd, (int *)&this->systemHeader[i].offset); - read_int (fd, &this->systemHeader[i].size); - } - for (i = 0; i < this->numG; i ++) - { - read_int (fd, &this->gopTable[i].systemHeader); - read_int (fd, (int *)&this->gopTable[i].offset); - read_int (fd, &this->gopTable[i].headerSize); - read_int (fd, &this->gopTable[i].size); - read_int (fd, &this->gopTable[i].totalFrames); - read_int (fd, &this->gopTable[i].previousFrames); - read_int (fd, (int *)&this->gopTable[i].firstIoffset); - } - for (i = 0; i < this->numF; i ++) - { - read_byte (fd, &this->frameTable[i].type); - read_short (fd, (short *)&this->frameTable[i].size); - } - - close (fd); - /* - fprintf (stderr, "Read Info from %s\n", this->videoFile); - */ - this->videoFile[fnlen] = 0; - return 0; -fail_ReadInfoFromFile: - if (fd >= 0) - close (fd); - this->videoFile[fnlen] = 0; - /* - fprintf (stderr, "To scan Info from %s\n", this->videoFile); - */ - return -1; -} - -void -Video_Global::WriteInfoToFile (void) -{ - int fd = -1, i; - int fnlen = strlen (this->videoFile); - - strcpy (&this->videoFile[fnlen], ".Info"); - fd = open (this->videoFile, O_WRONLY | O_CREAT, 0444); - if (fd == -1) - { - fprintf (stderr, "VS fails to open %s for write", this->videoFile); - perror (""); - goto fail_WriteInfoToFile; - } - write_int (fd, this->fileSize); - write_int (fd, this->maxS); - write_int (fd, this->maxG); - write_int (fd, this->maxI); - write_int (fd, this->maxP); - write_int (fd, this->maxB); - write_int (fd, this->minS); - write_int (fd, this->minG); - write_int (fd, this->minI); - write_int (fd, this->minP); - write_int (fd, this->minB); - write_int (fd, this->numS); - write_int (fd, this->numG); - write_int (fd, this->numF); - write_int (fd, this->numI); - write_int (fd, this->numP); - write_int (fd, this->numB); - write_int (fd, this->averageFrameSize); - write_int (fd, this->horizontalSize); - write_int (fd, this->verticalSize); - write_int (fd, this->pelAspectRatio); - write_int (fd, this->pictureRate); - write_int (fd, this->vbvBufferSize); - write_int (fd, this->patternSize); - - write_bytes (fd, this->pattern, this->patternSize); - - for (i = 0; i < this->numS; i ++) - { - write_int (fd, this->systemHeader[i].offset); - write_int (fd, this->systemHeader[i].size); - } - for (i = 0; i < this->numG; i ++) - { - write_int (fd, this->gopTable[i].systemHeader); - write_int (fd, this->gopTable[i].offset); - write_int (fd, this->gopTable[i].headerSize); - write_int (fd, this->gopTable[i].size); - write_int (fd, this->gopTable[i].totalFrames); - write_int (fd, this->gopTable[i].previousFrames); - write_int (fd, this->gopTable[i].firstIoffset); - } - for (i = 0; i < this->numF; i ++) - { - write_byte (fd, this->frameTable[i].type); - write_short (fd, this->frameTable[i].size); - } - - close (fd); - this->videoFile[fnlen] = 0; - return; -fail_WriteInfoToFile: - if (fd >= 0) - close (fd); - this->videoFile[fnlen] = 0; - return; -} - -int -Video_Global::init_MPEG1_video_file (void) -{ - u_char nb; - int state = 0; - u_long fileptr = 0; - u_long i, j, k; - int shptr, gopptr, ftptr; - int inpic = 0; - u_long picptr = 0; - int pictype = 0; - int first = 0; - int failureType = 0; - - this->fp = fopen (this->videoFile, "r"); - if (this->fp == NULL) - { - fprintf (stderr, "error on opening video file %s", this->videoFile); - perror (""); - return 2; - } - if (fseek (this->fp, 0, 2) == -1) - { - fprintf (stderr, "File %s not seekable", this->videoFile); - perror (""); - return 3; - } - this->fileSize = ftell (this->fp); - - fseek (this->fp, 0, 0); - - if (ReadInfoFromFile ()) - { - for (;;) - { - nextByte; - if (state >= 0 && nb == 0x00) - state ++; - else if (state >= 2 && nb == 0x01) - state = -1; - else if (state == -1) - { - if (!first) first ++; - else if (first == 1) first ++; - - switch (nb) - { - case 0xb7: /* seq_end_code */ - goto exit_phase1; - break; - case 0xb3: /* seq_start_code */ - if (first == 1) first = 3; - if (first != 3) - { - fprintf (stderr, "VS error: given file is not in MPEG format.\n"); - return 4; - } - this->numS ++; - break; - case 0xb8: /* gop_start_code */ - this->numG ++; - break; - case 0x00: /* picture_start_code */ - nextByte; - nextByte; - nb &= 0x38; - if (nb == 0x08) - { - this->numI ++; - if (this->numG == 2) - this->pattern[this->patternSize++] = 'I'; - } - else if (nb == 0x10) - { - this->numP ++; - if (this->numG == 2) - this->pattern[this->patternSize++] = 'P'; - } - else if (nb == 0x18) - { - this->numB ++; - if (this->numG == 2) - this->pattern[this->patternSize++] = 'B'; - } - /* - else - fprintf (stderr, "VS error: unkonw picture type %d\n", nb); - */ - break; - default: - break; - } - state = 0; - } - else - state = 0; - } - exit_phase1: - - if (first != 3) - { - fprintf (stderr, "VS error: given file \"%s\" is not of MPEG format.\n", this->videoFile); - return 4; - } - - this->pattern[this->patternSize] = 0; - memset (this->sendPattern, 1, PATTERN_SIZE); - - this->numF = this->numI + this->numP + this->numB; - this->averageFrameSize = fileptr / (unsigned)this->numF; - /* - fprintf (stderr, "Pass one finished, total bytes read: %u, average frame size %d\n", - fileptr, this->averageFrameSize); - fprintf (stderr, "this->numS-%d, this->numG-%d, this->numF-%d, this->numI-%d, this->numP-%d, this->numB-%d\n", - this->numS, this->numG, this->numI, this->numI, this->numP, this->numB); - fprintf (stderr, "this->Pattern detected: %s\n", this->pattern); - */ - if (this->numF > MAX_FRAMES) - { - fprintf (stderr, "VS error: this->Number of frames (%d) is bigger than MAX_FRAMES (%d).\n\ -you need to update the constant definition in common.h and recompile.\n", - this->numF, MAX_FRAMES); - return 5; - } - -#ifdef STAT - this->framesSent = (char *)malloc ((this->numF + 7)>>3); - if (this->framesSent == NULL) - { - fprintf (stderr, "VS fails to alloc mem for this->framesSent for %d frames", this->numF); - perror (""); - return 6; - } -#endif - - this->systemHeader = (struct Video_Global::SystemHeader *)malloc (sizeof (struct Video_Global::SystemHeader) * this->numS); - if (this->systemHeader == NULL) - { - perror ("VS error on malloc this->SystemHeader"); - return 7; - } - this->gopTable = (struct Video_Global::GopTable *)malloc (sizeof (struct Video_Global::GopTable) * this->numG); - if (this->gopTable == NULL) - { - perror ("VS error on malloc GopHeader"); - return 8; - } - this->frameTable = (struct Video_Global::FrameTable *)malloc (sizeof (Video_Global::FrameTable) * this->numF); - if (this->frameTable == NULL) - { - perror ("VS error on malloc this->frameTable"); - return 9; - } - - rewind (this->fp); - fileptr = 0; - state = 0; - inpic = 0; - shptr = -1; - gopptr = -1; - ftptr = 0; - - for (;;) - { - nextByte; - if (state >= 0 && nb == 0x00) - state ++; - else if (state >= 2 && nb == 0x01) - state = -1; - else if (state == -1) - { - switch (nb) - { - case 0xb7: /* seq_end_code */ - if (gopptr >= 0 && this->gopTable[gopptr].size == 0) - this->gopTable[gopptr].size = fileptr - this->gopTable[gopptr].offset - 4; - computePicSize; - goto exit_phase2; - break; - case 0xb3: /* seq_start_code */ - if (gopptr >= 0 && this->gopTable[gopptr].size == 0) - this->gopTable[gopptr].size = fileptr - this->gopTable[gopptr].offset - 4; - computePicSize; - shptr ++; - this->systemHeader[shptr].offset = fileptr - 4; - this->systemHeader[shptr].size = 0; - break; - case 0xb8: /* gop_start_code */ - if (this->systemHeader[shptr].size == 0) - this->systemHeader[shptr].size =fileptr - this->systemHeader[shptr].offset - 4; - if (gopptr >= 0 && this->gopTable[gopptr].size == 0) - this->gopTable[gopptr].size = fileptr - this->gopTable[gopptr].offset - 4; - computePicSize; - gopptr ++; - this->gopTable[gopptr].systemHeader = shptr; - this->gopTable[gopptr].offset = fileptr - 4; - this->gopTable[gopptr].headerSize = 0; - this->gopTable[gopptr].size = 0; - this->gopTable[gopptr].totalFrames = 0; - this->gopTable[gopptr].previousFrames = gopptr ? - (this->gopTable[gopptr - 1].totalFrames + this->gopTable[gopptr - 1].previousFrames) : 0; - - break; - case 0x00: /* picture_start_code */ - if (this->gopTable[gopptr].headerSize == 0) - { - this->gopTable[gopptr].headerSize = fileptr - this->gopTable[gopptr].offset - 4; - this->gopTable[gopptr].firstIoffset = fileptr - 4; - } - this->gopTable[gopptr].totalFrames ++; - computePicSize; - picptr = fileptr - 4; - nextByte; - nextByte; - nb &= 0x38; - if (nb == 0x08) - { - pictype = 'I'; - inpic = 1; - } - else if (nb == 0x10) - { - pictype = 'P'; - inpic = 1; - } - else if (nb == 0x18) - { - pictype = 'B'; - inpic = 1; - } - break; - default: - - break; - } - state = 0; - } - else - state = 0; - } - - exit_phase2: - for (shptr = 0; shptr<this->numS; shptr++) - { - this->maxS = max (this->maxS, this->systemHeader[shptr].size); - this->minS = min (this->minS, this->systemHeader[shptr].size); - } - for (gopptr = 0; gopptr<this->numG; gopptr++) - { - this->maxG = max (this->maxG, this->gopTable[gopptr].headerSize); - this->minG = min (this->minG, this->gopTable[gopptr].headerSize); - } - this->packetBufSize = this->maxS + this->maxG + max (this->maxI, max (this->maxP, this->maxB)); - this->packet = (VideoPacket *)malloc (sizeof (VideoMessage) + sizeof (VideoPacket) + - this->packetBufSize); - if (this->packet == NULL) - { - perror ("VS error on malloc this->packet buffer"); - return 10; - } - this->packet = (VideoPacket *) ((char *)this->packet + sizeof (VideoMessage)); - /* - fprintf (stderr, "Pass 2 finished.\n"); - fprintf (stderr, "this->maxS-%d, this->maxG-%d, this->maxI-%d, this->maxP-%d, this->maxB-%d.\n", this->maxS, this->maxG, this->maxI, this->maxP, this->maxB); - fprintf (stderr, "this->minS-%d, this->minG-%d, this->minI-%d, this->minP-%d, this->minB-%d.\n", this->minS, this->minG, this->minI, this->minP, this->minB); - */ - /* - { - int i; - - fprintf (stderr, "id: offset size -- system header table:\n"); - for (i=0; i<this->numS; i++) - fprintf (stderr, "%-3d %-9u %d\n", i, this->systemHeader[i].offset, this->systemHeader[i].size); - fprintf (stderr, - "id: header offset hdsize totSize frames preframs Ioffset Isize -- GOP\n"); - for (i=0; i<this->numG; i++) - { - fprintf (stderr, "%-4d %-8d %-8u %-8d %-8d %-8d %-8d %-8u %d\n", - i, - this->gopTable[i].this->systemHeader, - this->gopTable[i].offset, - this->gopTable[i].headerSize, - this->gopTable[i].size, - this->gopTable[i].totalFrames, - this->gopTable[i].previousFrames, - this->gopTable[i].firstIoffset, - this->frameTable[this->gopTable[i].previousFrames].size - ); - } - - fprintf (stderr, "\nframe information:"); - for (i=0; i<this->numF; i++) - fprintf (stderr, "%c%c%-8d", (i%10 ? '\0' : '\n'), this->frameTable[i].type, this->frameTable[i].size); - fprintf (stderr, "\n"); - - } - */ - fseek (this->fp, this->systemHeader[0].offset+4, 0); - nextByte; - this->horizontalSize = ((int)nb <<4) & 0xff0; - nextByte; - this->horizontalSize |= (nb >>4) & 0x0f; - this->verticalSize = ((int)nb <<8) & 0xf00; - nextByte; - this->verticalSize |= (int)nb & 0xff; - nextByte; - this->pelAspectRatio = ((int)nb >> 4) & 0x0f; - this->pictureRate = (int)nb & 0x0f; - nextByte; - nextByte; - nextByte; - this->vbvBufferSize = ((int)nb << 5) & 0x3e0; - nextByte; - this->vbvBufferSize |= ((int)nb >>3) & 0x1f; - /* - fprintf (stderr, "SysHeader info: hsize-%d, vsize-%d, pelAspect-%d, rate-%d, vbv-%d.\n", - this->horizontalSize, this->verticalSize, this->pelAspectRatio, this->pictureRate, this->vbvBufferSize); - */ - WriteInfoToFile (); - } -#if 0 - { - int i, j = 20; - - for (i = this->numG - 1;; i --) { - if (this->gopTable[i].offset < 4235260) { - fprintf (stderr, "group %d: offset %ld\n", i, this->gopTable[i].offset); - if (j -- == 0) break; - } - } - /* - for (i = 0; i < this->numG; i ++) { - if (this->gopTable[i].previousFrames > 1800) { - fprintf (stderr, "group %d: offset %ld pre-frames %d\n", - i, this->gopTable[i].offset, this->gopTable[i].previousFrames); - break; - } - } - */ - } -#endif - { - this->firstPatternSize = this->gopTable[0].totalFrames; - this->firstSendPattern = (char *)malloc (this->firstPatternSize); - if (this->firstSendPattern == NULL) - { - fprintf (stderr, "VS failed to allocate this->firstthis->Sendthis->Pattern for %d frames", - this->firstPatternSize); - perror (""); - return 11; - } - } - this->firstGopFrames = this->gopTable[0].totalFrames; - return 0; -} -int -Video_Global::play_send (int debug) -{ - // ACE_DEBUG ((LM_DEBUG,"play_send: sending the frame \n")); - int curGroup = Video_Timer_Global::timerGroup; - int curFrame = Video_Timer_Global::timerFrame; - int curHeader = Video_Timer_Global::timerHeader; - char * sp; - - if (this->preGroup != curGroup || - curFrame != this->preFrame) - { - int sendStatus = -1; - int frameStep = 1; - if (debug) - cerr << " curgroup = " << curGroup << endl ; - if (curGroup == 0) - { - - int i = curFrame + 1; - while (i < this->firstPatternSize && - !this->firstSendPattern[i]) - { - frameStep ++; - i++; - } - } - else /* (curGroup > 0) */ - { - int i = curFrame + 1; - sp = this->sendPattern + ((curGroup - 1) % this->sendPatternGops) * this->patternSize; - while (i < this->patternSize && !sp[i]) - { - frameStep ++; - i++; - } - } - if (curGroup == 0) - { - if (debug) - cerr << "first : " << - this->firstSendPattern[curFrame] << endl; - if (this->firstSendPattern[curFrame]) - sendStatus = 0; - else /* (!this->firstthis->Sendthis->Pattern[curFrame]) */ - { - int i = curFrame - 1; - while (i > 0 && !this->firstSendPattern[i]) - i--; - if (i > this->preFrame) - /* the frame (curGroup, i) hasn't been sent yet */ - { - sendStatus = 0; - curFrame = i; - } - else - sendStatus = -1; - if (debug) - cerr << "SendStatus = " << sendStatus << endl; - } - } - else if (sp[curFrame]) /* curGroup > 0 */ - sendStatus = 0; - else /* (!sp[curFrame]) */ - { - int i = curFrame - 1; - while (i > 0 && !sp[i]) - i--; - if (curGroup == this->preGroup && i > this->preFrame) - /* the frame (curGroup, i) hasn't been sent yet */ - { - sendStatus = 0; - curFrame = i; - } - else - sendStatus = -1; - } - if (!sendStatus) - { - // Send the current video frame, calls send_to_network which - // fragments and sends via blocking write . - sendStatus = this->SendPacket (this->preHeader != curHeader, - curGroup, curFrame, - (this->currentUPF + this->addedUPF) * frameStep); - if (!sendStatus) - { - this->preHeader = curHeader; - this->preGroup = curGroup; - this->preFrame = curFrame; -#ifdef STAT - if (this->play_para.collectStat) - { - int f = this->gopTable[curGroup].previousFrames + curFrame; - this->framesSent[f>>3] |= (1 << (f % 8)); - } -#endif - } - } - } - return 0; -} - -int -Video_Global::fast_play_send (void) -{ - if (this->fast_preGroup != Video_Timer_Global::timerGroup) - { - this->SendPacket (this->fast_preHeader != Video_Timer_Global::timerHeader, Video_Timer_Global::timerGroup, 0, - this->fast_para.usecPerFrame * this->patternSize >> 2); - this->fast_preHeader = Video_Timer_Global::timerHeader; - this->fast_preGroup = Video_Timer_Global::timerGroup; - } - return 0; -} - -int -Video_Global::position (void) -{ - int result; - POSITIONpara pos_para; - /* - fprintf (stderr, "POSITION . . .\n"); - */ - result = CmdRead ((char *)&pos_para, sizeof (pos_para)); - if (result != 0) - return result; - - if (this->live_source) return 0; - -#ifdef NeedByteOrderConversion - pos_para.nextGroup = ntohl (pos_para.nextGroup); - pos_para.sn = ntohl (pos_para.sn); -#endif - - CheckGroupRange (pos_para.nextGroup); - this->cmdsn = pos_para.sn; - result = SendPacket (this->numS>1 || pos_para.nextGroup == 0, pos_para.nextGroup, 0, 0); - return result; -} - -int -Video_Global::step_video () -{ - int group; - STEPpara step_para; - int tag = 0; - int result; - - result = CmdRead ((char *)&step_para, sizeof (step_para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - step_para.sn = ntohl (step_para.sn); - step_para.this->nextFrame = ntohl (step_para.this->nextFrame); -#endif - - this->cmdsn = step_para.sn; - - if (!this->live_source) { - if (step_para.nextFrame >= this->numF) /* send SEQ_END */ - { - tag = 1; - step_para.nextFrame --; - } - /* - fprintf (stderr, "STEP . . .frame-%d\n", step_para.this->nextFrame); - */ - CheckFrameRange (step_para.nextFrame); - group = FrameToGroup (&step_para.nextFrame); - if (this->precmd != CmdSTEP && !tag ) { - result = SendReferences (group, step_para.nextFrame); - if (result < 0 ) - return result; - } - } - if (this->live_source) StartPlayLiveVideo (); - - if (this->live_source) { - SendPicture (&step_para.nextFrame); - } - else if (this->video_format == VIDEO_MPEG1) { - SendPacket (this->numS>1, group, tag ? this->numF : step_para.nextFrame, 0); - } - else { - fprintf (stderr, "VS: wierd1\n"); - } - - if (this->live_source) StopPlayLiveVideo (); - return 0; -} - -int -Video_Global::fast_forward (void) -{ - // return this->init_fast_play () - return 0; -} - -int -Video_Global::fast_backward (void) -{ -// return this->init_fast_play (); - return 0; -} - -int -Video_Global::stat_stream (void) -{ - int i, j = 0; - for (i = 0; i < this->numF; i++) - { - short size = htons (this->frameTable[i].size); - char type = this->frameTable[i].type; - if (i == this->gopTable[j].previousFrames) - { - type = tolower (type); - j ++; - } - CmdWrite ((char *)&type, 1); - CmdWrite ((char *)&size, 2); - } - return 0; -} - -int -Video_Global::stat_sent (void) -{ -#ifdef STAT - CmdWrite ((char *)this->framesSent, (this->numF + 7) / 8); -#else - int i; - char zeroByte = 0; - for (i = 0; i < (this->numF + 7) / 8; i++) - CmdWrite ((char *)&zeroByte, 1); -#endif - return 0; -} - -int -Video_Global::init_play (Video_Control::PLAYpara para, - CORBA::Long_out vts) -{ - // ~~ why do we need the play_para in Video_Global , why can't just use - // the para that's passed. - int result; - - ACE_DEBUG ((LM_DEBUG, - " (%P|%t) Video_Global::init_play ()")); - - // this gets the parameters for the play command - // result = this->CmdRead ((char *)&this->play_para, sizeof (this->play_para)); - // if (result != 0) - // return result; - - // Assign the passed play - this->play_para = para ; -#ifdef NeedByteOrderConversion - this->play_para.sn = ntohl (this->play_para.sn); - this->play_para.nextFrame = ntohl (this->play_para.nextFrame); - this->play_para.usecPerFrame = ntohl (this->play_para.usecPerFrame); - this->play_para.framesPerSecond = ntohl (this->play_para.framesPerSecond); - this->play_para.frameRateLimit1000 = ntohl (this->play_para.frameRateLimit1000); - this->play_para.collectStat = ntohl (this->play_para.collectStat); - this->play_para.sendPatternGops = ntohl (this->play_para.sendPatternGops); - this->play_para.VStimeAdvance = ntohl (this->play_para.VStimeAdvance); -#endif - - this->frameRateLimit = this->play_para.frameRateLimit1000 / 1000.0; - this->cmdsn = this->play_para.sn; - this->currentUPF = this->play_para.usecPerFrame; - this->VStimeAdvance = this->play_para.VStimeAdvance; - - vts = get_usec (); - cerr << "vts is " << vts << endl; - // begin evil code - // { - // int vts = get_usec (); - // this->CmdWrite ((char *)&ts, sizeof (int)); - // } - // end evil code - - if (this->live_source || this->video_format != VIDEO_MPEG1) { - PLAYpara live_play_para; // xxx hack to compile the code - if (this->live_source) - this->PLAYliveVideo (&live_play_para); - return 0; - } - - fprintf (stderr, "this->VStimeAdvance from client: %d\n", this->VStimeAdvance); - - this->sendPatternGops = this->play_para.sendPatternGops; - ComputeFirstSendPattern (this->frameRateLimit); -#ifdef STAT - if (this->play_para.collectStat) - memset (this->framesSent, 0, (this->numF + 7)>>3); -#endif - CheckFrameRange (this->play_para.nextFrame); - Video_Timer_Global::timerFrame = this->play_para.nextFrame; - Video_Timer_Global::timerGroup = FrameToGroup (&Video_Timer_Global::timerFrame); - Video_Timer_Global::timerHeader = this->gopTable[Video_Timer_Global::timerGroup].systemHeader; - // memcpy (this->sendPattern, this->play_para.sendPattern, PATTERN_SIZE); - // Do a sequence copy.. - - for (int i=0; i<PATTERN_SIZE ; i++) - this->sendPattern[i] = this->play_para.sendPattern[i]; - result = SendReferences (Video_Timer_Global::timerGroup, Video_Timer_Global::timerFrame); - if (result < 0) - return result; - Video_Timer_Global::StartTimer (); - - // Sends the first frame of the video... - result = play_send (0); - return 0; -} - -CORBA::Boolean -Video_Global::init_fast_play (const Video_Control::FFpara &ff_para ) -{ - // save the parameters for future reference - this->fast_para = ff_para; - int result; - - // result = CmdRead ((char *)&this->ff_para, sizeof (this->ff_para)); - // if (result != 0) - // return result; - - if (this->live_source) return 0; - - this->VStimeAdvance = ff_para.VStimeAdvance; - /* - fprintf (stderr, "this->VStimeAdvance from client: %d\n", this->VStimeAdvance); - */ - CheckGroupRange (ff_para.nextGroup); - this->cmdsn = ff_para.sn; - Video_Timer_Global::timerGroup = ff_para.nextGroup; - Video_Timer_Global::timerFrame = 0; - Video_Timer_Global::timerHeader = this->gopTable[Video_Timer_Global::timerGroup].systemHeader; - this->currentUPF = ff_para.usecPerFrame; - Video_Timer_Global::StartTimer (); - - fast_play_send (); - return 0; -} - -int -Video_Global::init_video (void) -{ - INITvideoPara para; - int failureType = 0; - int result; - /* - fprintf (stderr, "VS about to read Para.\n"); - */ - result = CmdRead ((char *)¶, sizeof (para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl (para.sn); - para.version = ntohl (para.version); - para.nameLength = ntohl (para.nameLength); -#endif - if (para.nameLength>0) - { - result = CmdRead (this->videoFile, para.nameLength); - if (result != 0) - return result; - } - if (Mpeg_Global::session_num > Mpeg_Global::session_limit || para.version != VERSION) { - char errmsg[128]; - this->cmd = CmdFAIL; - CmdWrite ((char *)&this->cmd, 1); - if (Mpeg_Global::session_num > Mpeg_Global::session_limit) { - sprintf (errmsg, - "Too many sessions being serviced, please try again later.\n"); - } - else { - sprintf (errmsg, "Version # not match, VS %d.%02d, Client %d.%02d", - VERSION / 100, VERSION % 100, - para.version / 100, para.version % 100); - } - write_string (this->serviceSocket, errmsg); - exit (0); - } - this->cmdsn = para.sn; - /* - fprintf (stderr, "MPEG file %s got.\n", this->videoFile); - */ - this->videoFile[para.nameLength] = 0; - - if (!strncasecmp ("LiveVideo", this->videoFile, 9)) { - if (OpenLiveVideo (&this->video_format, &this->horizontalSize, - &this->verticalSize, &this->averageFrameSize, - &this->fps, &this->pelAspectRatio) == -1) { - failureType = 100; - goto failure; - } - if (this->video_format == VIDEO_MPEG2) { - failureType = 101; - goto failure; - } - this->live_source = 1; - - this->fileSize =0x7fffffff; - this->maxS = this->maxG = this->maxI = this->maxP = this->maxB = this->minS = this->minG = this->minI = this->minP = this->minB = 1; - this->numS = this->numG = this->numF = this->numI = 0x7fffffff; - this->numP = this->numB = 0; - this->vbvBufferSize = 1; - this->firstGopFrames = 1; - this->patternSize = 1; - this->pattern[0] = 'I'; - this->pattern[1] = 0; - this->packetBufSize = this->verticalSize * this->horizontalSize * 3; - this->packet = (VideoPacket *)malloc (sizeof (VideoMessage) + sizeof (VideoPacket) + - this->packetBufSize); - if (this->packet == NULL) - { - perror ("Error: VS error on malloc this->packet buffer"); - exit (1); - } - this->packet = (VideoPacket *) ((char *)this->packet + sizeof (VideoMessage)); - - } - else { - static double pictureRateTable[] = {23.976, 24, 25, 29.97, 30, 50, 59.94, 60}; - - this->video_format = VIDEO_MPEG1; - failureType = init_MPEG1_video_file (); - if (failureType) goto failure; - this->fps = pictureRateTable[this->pictureRate - 1]; - } - - { - INITvideoReply reply; - - reply.totalHeaders = htonl (this->numS); - reply.totalGroups = htonl (this->numG); - reply.totalFrames = htonl (this->numF); - reply.sizeIFrame = htonl (this->maxI); - reply.sizePFrame = htonl (this->maxP); - reply.sizeBFrame = htonl (this->maxB); - reply.sizeSystemHeader = htonl (this->maxS); - reply.sizeGop = htonl (this->maxG); - reply.averageFrameSize = htonl (this->averageFrameSize); - reply.verticalSize = htonl (this->verticalSize); - reply.horizontalSize = htonl (this->horizontalSize); - reply.pelAspectRatio = htonl (this->pelAspectRatio); - reply.pictureRate1000 = htonl ((int) (this->fps * 1000)); - reply.vbvBufferSize = htonl (this->vbvBufferSize); - reply.firstGopFrames = htonl (this->firstGopFrames); - reply.patternSize = htonl (this->patternSize); - strncpy (reply.pattern, this->pattern, PATTERN_SIZE); - - reply.live = htonl (this->live_source); - reply.format = htonl (this->video_format); - - CmdWrite ((char *)&this->cmd, 1); - - CmdWrite ((char *)&reply, sizeof (reply)); - - /* write the first SH, GOP and IFrame to this->serviceSocket (TCP), - using code for SendPacket () */ - { - int tmpSocket = this->videoSocket; - - if (this->live_source) StartPlayLiveVideo (); - - this->videoSocket = this->serviceSocket; - - if (this->live_source) { - int frame = 0; - SendPicture (&frame); - } - else if (this->video_format == VIDEO_MPEG1) { - SendPacket (1, 0, 0, 0); - } - else { - fprintf (stderr, "VS: this->video_format %d not supported.\n", - this->video_format); - } - this->videoSocket = tmpSocket; - - if (this->live_source) StopPlayLiveVideo (); - } - - return 0; - - } -failure: - { - char * msg; - char errmsg[64]; - this->cmd = CmdFAIL; - sprintf (errmsg, "VS failed to alloc internal buf (type %d)", failureType); - CmdWrite ((char *)&this->cmd, 1); - msg = failureType == 1 ? "not a complete MPEG stream" : - failureType == 2 ? "can't open MPEG file" : - failureType == 3 ? "MPEG file is not seekable" : - failureType == 4 ? "not an MPEG stream" : - failureType == 5 ? - "too many frames in MPEG file, need change MAX_FRAMES and recompile VS" : - failureType == 100 ? "failed to connect to live video source" : - failureType == 101 ? "live MPEG2 not supported" : - errmsg; - write_string (this->serviceSocket, msg); - exit (0); - } -} - -//-------------------------------------------------------- -// Video_Timer_Global methods -void -Video_Timer_Global::StartTimer (void) -{ - VIDEO_SINGLETON::instance ()->addedUPF = 0; - VIDEO_SINGLETON::instance ()->addedSignals = 0; - timerAdjust = (VIDEO_SINGLETON::instance ()->VStimeAdvance * SPEEDUP_INV_SCALE) / VIDEO_SINGLETON::instance ()->currentUPF; - /* - SFprintf (stderr, "VS StartTimer (): fast-start frames %d\n", - timerAdjust / SPEEDUP_INV_SCALE); - */ - TimerSpeed (); - // setsignal (SIGALRM, timerHandler); - timerOn = 1; - preTimerVal = get_usec (); - /* - fprintf (stderr, "VS: timer started at %d upf.\n", VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF); - */ -} - -void -Video_Timer_Global::StopTimer (void) -{ - struct itimerval val; - // ## I have to incorporate this logic into the changed code - // setsignal (SIGALRM, SIG_IGN); - val.it_interval.tv_sec = val.it_value.tv_sec = 0; - val.it_interval.tv_usec = val.it_value.tv_usec = 0; - setitimer (ITIMER_REAL, &val, NULL); - timerOn = 0; - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Timer_Global::StopTimer: timer stopped\n")); -} - -void -Video_Timer_Global::TimerSpeed (void) -{ - struct itimerval val; - int usec = VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF; - if (Mpeg_Global::drift_ppm) { - /* - int drift = (double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0; - SFprintf (stderr, "Mpeg_Global::drift_ppm %d, usec %d, drift %d, new usec %d\n", - Mpeg_Global::drift_ppm, usec, drift, usec - drift); - */ - usec -= (int) ((double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0); - } - if (timerAdjust > 1) - usec = (int) (((double)usec * (double) (SPEEDUP_INV_SCALE - 1)) / - (double)SPEEDUP_INV_SCALE); - val.it_interval.tv_sec = val.it_value.tv_sec = usec / 1000000; - val.it_interval.tv_usec = val.it_value.tv_usec = usec % 1000000; - setitimer (ITIMER_REAL, &val, NULL); - /* - SFprintf (stderr, - "VS TimerSpeed () at %s speed, timerAdjust %d VIDEO_SINGLETON::instance ()->addedSignals %d.\n", - (timerAdjust > 1) ? "higher" : "normal", timerAdjust, VIDEO_SINGLETON::instance ()->addedSignals); - */ - -} - -void -Video_Timer_Global::TimerProcessing (void) -{ - /* - fprintf (stderr, "VS: timerHandler...\n"); - */ - if (!timerOn) { - return; - } - if (timerAdjust < 0) - { - timerAdjust += SPEEDUP_INV_SCALE; - return; - } - if (timerAdjust >0) - { - if ((--timerAdjust) == 0) - TimerSpeed (); - } - if (VIDEO_SINGLETON::instance ()->cmd == CmdPLAY) - { - if (timerGroup == VIDEO_SINGLETON::instance ()->numG - 1 && timerFrame >= VIDEO_SINGLETON::instance ()->gopTable[timerGroup].totalFrames - 1) - { - timerFrame ++; /* force sending of END_SEQ when PLAY VIDEO_SINGLETON::instance ()->cmd */ - StopTimer (); - return; - } - else - { - timerFrame ++; - if (timerFrame >= VIDEO_SINGLETON::instance ()->gopTable[timerGroup].totalFrames) - { - timerGroup ++; - timerFrame = 0; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - } - } - else { - if (VIDEO_SINGLETON::instance ()->cmd == CmdFF) { - if (timerGroup == VIDEO_SINGLETON::instance ()->numG - 1) { - StopTimer (); - return; - } - timerGroup ++; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - else { - if (timerGroup == 0) { - StopTimer (); - return; - } - timerGroup --; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - } - -} - -void -Video_Timer_Global::timerHandler (int sig) -{ - // ACE_DEBUG ((LM_DEBUG, - // "Video_Timer_Global::timerHandler\n")); - - int val2, val3; - int usec = VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF; - - if (Mpeg_Global::drift_ppm) { - usec -= (int) ((double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0); - } - - if (timerAdjust > 1) - usec = (int) (((double)usec * (double) (SPEEDUP_INV_SCALE - 1)) / - (double)SPEEDUP_INV_SCALE); - val3 = get_duration (preTimerVal, (val2 = get_usec ())); - /* - if (val3 >= usec<< 1)) - fprintf (stderr, "Slower: %d out of VIDEO_SINGLETON::instance ()->currentUPF %d.\n", - val3, usec); - else - fprintf (stderr, "+\n"); - */ - preTimerVal = val2; - if (val3 < 0 || val3 > 100000000) - val3 = usec; - val2 = (val3 + (usec>>1)) / usec; - if (val2 < 0) val2 = 0; - if (val2) { - TimerProcessing (); - val2 --; - } - VIDEO_SINGLETON::instance ()->addedSignals += val2; - - if (VIDEO_SINGLETON::instance ()->addedSignals) { - val2 = timerAdjust; - if (timerAdjust < MAX_TIMER_ADJUST) { - timerAdjust += VIDEO_SINGLETON::instance ()->addedSignals * SPEEDUP_INV_SCALE; - if (val2 < SPEEDUP_INV_SCALE) { - TimerSpeed (); - } - } - else { - /* - fprintf (stderr, "VS timerAdjust %d, VIDEO_SINGLETON::instance ()->addedSignals %d, timerFrame %d\n", - timerAdjust, VIDEO_SINGLETON::instance ()->addedSignals, timerFrame); - */ - for (val3 = 0; val3 < VIDEO_SINGLETON::instance ()->addedSignals; val3 ++) - TimerProcessing (); - } - VIDEO_SINGLETON::instance ()->addedSignals = 0; - } -} - -// send the first packet, given by packet pointed by -// 'this->packet' to the network. -int -Video_Global::send_to_network (int timeToUse) -{ - int count = 0; - VideoMessage * msghd = (VideoMessage *) (((char *) this->packet) - sizeof (VideoMessage)); - int sent = 0; - int packetSize = ntohl (this->packet->dataBytes); - - msghd->packetsn = htonl (this->packetsn ++); - msghd->packetSize = htonl (packetSize + sizeof (* this->packet)); - - // fprintf (stderr, "VS to send pkt %d of size %d.\n", - // ntohl (msghd->packetsn), ntohl (msghd->packetSize)); - - - { - VideoMessage * msg = NULL; - int size = packetSize + sizeof (* this->packet); /* msghd->this->packetSize */ - int offset = 0; - int targetTime; - - if (size > this->msgsize) - { - if (!timeToUse) - { - timeToUse = (this->msgsize + sizeof (*msg) + 28) * 2; - /* - set the max network as 500KB. - 28 - UDP header size - */ - /* - fprintf (stderr, "computed timeToUse %d. ", timeToUse); - */ - } - else - { - timeToUse = (timeToUse * 7) >> 3; - /* - fprintf (stderr, "preset timeToUse %d.", timeToUse); - */ - timeToUse /= (size + this->msgsize - 1) / this->msgsize; - timeToUse = min (timeToUse, (this->msgsize + sizeof (*msg) + 28) * 100); - /* limit min network bandwidth = 10K */ - } - - } - while (size > 0) - { - int segsize, sentsize; - int resent = 0; - - if (msg == NULL) { /* first message for current this->packet */ - count = 0; - msg = msghd; - targetTime = get_usec (); - } - else { -#if 0 - /* the select () is not precise enough for being used here*/ - int sleepTime; - targetTime += timeToUse; - sleepTime = get_duration (get_usec (), targetTime); - if (sleepTime >= 5000) { /* resolution of timer is 10,000 usec */ - usleep (sleepTime); /* not first message, wait for a while */ - } -#endif - /* - count ++; - if (! (count % 10)) usleep (10000); - */ - msg = (VideoMessage *) ((char *)msg + this->msgsize); - memcpy ((char *)msg, (char *)msghd, sizeof (* msg)); - } - msg->msgsn = htonl (this->msgsn++); - msg->msgOffset = htonl (offset); - msg->msgSize = htonl (min (size, this->msgsize)); - - segsize = min (size, this->msgsize)+sizeof (*msg); - if (this->conn_tag != 0) { /* this->packet stream */ - // cerr << "sending " << segsize << " on fd = " << this->videoSocket << endl; - while ((sentsize = write (this->videoSocket, (char *)msg, segsize)) == -1) { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - if (resent) { - perror ("Warning, pkt discarded because"); - sent = -1; - break; - } - else { - resent = 1; - perror ("VS to sleep 5ms"); - usleep (5000); - continue; - } - } - if (errno != EPIPE) { - fprintf (stderr, "VS error on send this->packet %d of size %d ", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - perror (""); - } - exit (errno != EPIPE); - } - } - else { - sentsize = wait_write_bytes (this->videoSocket, (char *)msg, segsize); - if (sentsize == -1) { - if (errno != EPIPE) { - fprintf (stderr, "VS error on send this->packet %d of size %d ", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - perror (""); - } - exit (errno != EPIPE); - } - } - if (sentsize < segsize) { - SFprintf (stderr, "VS warning: message size %dB, sent only %dB\n", - segsize, sentsize); - } - if (sent == -1) - break; - /* - fprintf (stderr, "VS: message %d of size %d sent.\n", - this->msgsn-1, min (size, this->msgsize)+sizeof (*msg)); - */ - size -= this->msgsize; - offset += this->msgsize; - } - } - /* - fprintf (stderr, "sent = %d\n", sent); - */ - if (!sent) this->pkts_sent ++; - return sent; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h deleted file mode 100644 index 5c62c74936a..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h +++ /dev/null @@ -1,318 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#if !defined (MPEG_GLOBAL_H) -#define MPEG_GLOBAL_H - -#include "ace/SOCK_CODgram.h" -// Global symbols, these need to become enums eventually. - -#define SESSION_NUM 4 -#define CONN_INET 1 -#define CONN_UNIX 2 -#define CONN_ATM 3 - -#define SERVER_FDTABLE_SIZE 50 -#define CLIENT_FDTABLE_SIZE 10 - -#define STATE_PENDING 1 -#define STATE_CONTROL 2 -#define STATE_DATA 3 -#define STATE_SINGLE 4 - -#define min(a, b) ((a) > (b) ? (b) : (a)) -#define max(a, b) ((a) > (b) ? (a) : (b)) - -/* Start codes. */ - -#define READ_BLOCK_SIZE 512 -#define MAX_TIMER_ADJUST (100 * SPEEDUP_INV_SCALE) - -#define SEQ_END_CODE 0x000001b7 -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 -#define SLICE_MIN_START_CODE 0x00000101 -#define SLICE_MAX_START_CODE 0x000001af -#define EXT_START_CODE 0x000001b5 -#define USER_START_CODE 0x000001b2 - -// Global definitions -#define nextByte {int val; fileptr ++; \ - if ((val = getc(VIDEO_SINGLETON::instance ()->fp)) == EOF) \ - {\ - perror("Crossed EOF or error while scanning"); \ - return 1; \ - } nb = val;} - -#define computePicSize \ - if (inpic) \ - { \ - if (pictype == 'I') \ - { \ - VIDEO_SINGLETON::instance ()->maxI = max(VIDEO_SINGLETON::instance ()->maxI, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minI = min(VIDEO_SINGLETON::instance ()->minI, (int)(fileptr - picptr - 4)); \ - } \ - else if (pictype == 'P') \ - { \ - VIDEO_SINGLETON::instance ()->maxP = max(VIDEO_SINGLETON::instance ()->maxP, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minP = min(VIDEO_SINGLETON::instance ()->minP, (int)(fileptr - picptr - 4)); \ - } \ - else \ - { \ - VIDEO_SINGLETON::instance ()->maxB = max(VIDEO_SINGLETON::instance ()->maxB, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minB = min(VIDEO_SINGLETON::instance ()->minB, (int)(fileptr - picptr - 4)); \ - } \ - VIDEO_SINGLETON::instance ()->frameTable[ftptr].type = pictype; \ - VIDEO_SINGLETON::instance ()->frameTable[ftptr++].size = (int)(fileptr - picptr - 4); \ - inpic = 0; \ - } - - -#define FileRead(position, buf, size) \ - { \ - if (fseek(VIDEO_SINGLETON::instance ()->fp, (position), 0) == -1) \ - { \ - perror("VS error on fseek VideoFile"); \ - return (-1); \ - } \ - while (fread((buf), (size), 1, VIDEO_SINGLETON::instance ()->fp) == 0) \ - { if (errno == EINTR) { errno = 0; continue;}\ - perror("VS error on fread VideoFile"); \ - return (-1); \ - } \ - } - -#define CheckFrameRange(pnextFrame) \ -{ if ((pnextFrame) < 0 || (pnextFrame) >= VIDEO_SINGLETON::instance ()->numF) \ - { fprintf(stderr, "VS: %d.VIDEO_SINGLETON::instance ()->nextFrame(%d) out of range (%d).\n", VIDEO_SINGLETON::instance ()->cmd, (pnextFrame), VIDEO_SINGLETON::instance ()->numF); \ - return 0; } } - -#define CheckGroupRange(pnextGroup) \ -{ if ((pnextGroup) < 0 || (pnextGroup) >= VIDEO_SINGLETON::instance ()->numG) \ - { fprintf(stderr, "VS: %d.VIDEO_SINGLETON::instance ()->nextGroup(%d) out of range (%d).\n", VIDEO_SINGLETON::instance ()->cmd, (pnextGroup), VIDEO_SINGLETON::instance ()->numG); \ - return 0; } } - -#include "ace/Singleton.h" -#include "include/common.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" -#include "mpeg_shared/sendpt.h" -#include "mpeg_server/server_proto.h" -#include "mpeg_server/Video_Server.h" -#include "mpeg_shared/Video_ControlS.h" - -class Mpeg_Global -{ -public: - static int parentpid; - - static int listenSocketIn; - static int listenSocketUn; - - static struct linger linger; - - static int live_audio; - static int live_video; /* 0 - no, 1 - to open, 2 - opened */ - - static int drift_ppm; /* clock drift in ppm */ - - static int session_limit; - static int session_num; - static int rttag; -}; - -class Video_Global -{ -public: - Video_Global (); - - ACE_SOCK_CODgram dgram; - // the UDP data socket - - int live_source; - int video_format; - - int pkts_sent; - time_t start_time; - - int conn_tag; - - int normalExit; - - int serviceSocket; - int videoSocket; - - char videoFile[PATH_SIZE]; - FILE *fp; - int needHeader; - int lastRef[2]; - int lastRefPtr; - int currentUPF; - int addedUPF; - int addedSignals; - int VStimeAdvance; - double fps; /* current frames-per-second: playback speed */ - double frameRateLimit; - - VideoPacket * packet; - int packetBufSize; - int msgsn; - int packetsn; - int msgsize; - - unsigned char precmd; - unsigned char cmd; - int cmdsn; - int nextFrame; - int nextGroup; - int firstPatternSize; - char *firstSendPattern; - int sendPatternGops; - char sendPattern [PATTERN_SIZE]; - -#ifdef STAT - char * framesSent; -#endif - - int fileSize; - int maxS; - int maxG; - int maxI; - int maxP; - int maxB; - int minS; - int minG; - int minI; - int minP; - int minB; - int numS; - int numG; - int numF; - int numI; - int numP; - int numB; - int averageFrameSize; - int horizontalSize; - int verticalSize; - int pelAspectRatio; - int pictureRate; - int vbvBufferSize; - int firstGopFrames; - int patternSize; - char pattern [PATTERN_SIZE]; - - struct SystemHeader - { - long offset; - int size; - } * systemHeader; - - struct GopTable - { - int systemHeader; - long offset; - int headerSize; - int size; - int totalFrames; - int previousFrames; - long firstIoffset; - } * gopTable; - - struct FrameTable - { - char type; - unsigned short size; - } * frameTable; - - int preGroup; - int preHeader; - int preFrame; - - // fast video play locals - Video_Control::FFpara fast_para; - Video_Control::PLAYpara play_para; - int fast_preGroup; - int fast_preHeader; - - // globals functions - int CmdRead (char *buf, int psize); - int CmdWrite (char *buf, int size); - int SendPacket (int shtag, - int gop, - int frame, - int timeToUse, - int first_time = 0); - int FBread (char *buf, int size); - int PLAYliveVideo (PLAYpara * para); - void ComputeFirstSendPattern (float limit); - int FrameToGroup (int * frame); - int SendReferences (int group, int frame); - int send_to_network (int timeToUse); - int first_packet_send_to_network (int timeToUse); - int GetFeedBack (void); - int SendPicture (int *frame); - int ReadInfoFromFile (void); - void WriteInfoToFile (void); - int init_MPEG1_video_file (void); - int play_send (int debug=0); - int fast_play_send (void); - int position (void); - int step_video (void); - int fast_forward (void); - int fast_backward (void); - int stat_stream (void); - int stat_sent (void); - int init_play (Video_Control::PLAYpara para, - CORBA::Long_out vts); - CORBA::Boolean init_fast_play (const Video_Control::FFpara ¶); - int init_video (void); -}; - -typedef ACE_Singleton <Video_Global, ACE_SYNCH_MUTEX> VIDEO_SINGLETON; - -class Video_Timer_Global -// A class that holds the static timer variables defined in the middle -// of vs.cpp -{ -public: - static int timerHeader; - static int timerGroup; - static int timerFrame; - static int timerOn ; - static int timerAdjust ; - static int preTimerVal ; - static void StartTimer (void); - static void StopTimer(void); - static void TimerSpeed(void); - static void TimerProcessing(void); - static void timerHandler (int sig); -}; - -#endif /* define MPEG_GLOBAL_H */ - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Makefile deleted file mode 100644 index 49a803517ea..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Makefile +++ /dev/null @@ -1,1802 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -LIBNAME = libmpeg_server -LIB = $(LIBNAME).a -SHLIB = $(LIBNAME).$(SOEXT) - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES= as las lvs vs Globals Video_Server Video_Control_State Video_Control_i Audio_Server - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - - -LIBS += -lTAO -lACE -lorbsvcs -MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source -CPPFLAGS += -I$(MPEG_ROOT) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -#LDFLAGS += -L/project/doc/pkg/X11/lib/ -lXm -lXt -lXext -lSM -lICE -lX11 -L/project/doc/pkg/X11/lib -lsocket -lnsl -ldl -LDFLAGS += -lsocket -lnsl -ldl -CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG)#-H -CPPFLAGS += -DSH_MEM -I/project/doc/pkg/X11/include - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/as.o .obj/as.so .shobj/as.o .shobj/as.so: as.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - server_proto.h Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/las.o .obj/las.so .shobj/las.o .shobj/las.so: las.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - server_proto.h Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/lvs.o .obj/lvs.so .shobj/lvs.o .shobj/lvs.so: lvs.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - server_proto.h Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/vs.o .obj/vs.so .shobj/vs.o .shobj/vs.so: vs.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - server_proto.h Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/Globals.o .obj/Globals.so .shobj/Globals.o .shobj/Globals.so: Globals.cpp Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_IO.h \ - $(ACE_ROOT)/ace/SOCK.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/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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/Video_Server.o .obj/Video_Server.so .shobj/Video_Server.o .shobj/Video_Server.so: Video_Server.cpp Video_Server.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 \ - $(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/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i -.obj/Video_Control_State.o .obj/Video_Control_State.so .shobj/Video_Control_State.o .shobj/Video_Control_State.so: Video_Control_State.cpp Video_Control_State.h \ - $(ACE_ROOT)/ace/Singleton.h \ - $(ACE_ROOT)/ace/Synch.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/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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.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/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/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(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/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.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(TAO_ROOT)/tao/TAO.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - Video_Server.h -.obj/Video_Control_i.o .obj/Video_Control_i.so .shobj/Video_Control_i.o .shobj/Video_Control_i.so: Video_Control_i.cpp Video_Control_i.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlC.h \ - $(TAO_ROOT)/tao/corba.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(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/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(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.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.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/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/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(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.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - Video_Server.h $(TAO_ROOT)/tao/TAO.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h -.obj/Audio_Server.o .obj/Audio_Server.so .shobj/Audio_Server.o .shobj/Audio_Server.so: Audio_Server.cpp Audio_Server.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - server_proto.h Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.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/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Singleton.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/Singleton.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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 \ - $(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/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/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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.cpp deleted file mode 100644 index 8850a72decf..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.cpp +++ /dev/null @@ -1,481 +0,0 @@ -// $Id$ - -#include "Video_Control_State.h" -#include "Video_Server.h" - -Video_Control_State::Video_Control_State () - : vci_ (VIDEO_CONTROL_I::instance ()) -{ -} - -Video_Control_State::Video_States -Video_Control_State::get_state (void) -{ - return this->state_; -} - -CORBA::Boolean -Video_Control_State::init_video (const Video_Control::INITvideoPara &init_para, - Video_Control::INITvideoReply_out reply) -{ - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Video_Control_State::init_video called\n")); - int failureType = 0; - // This is independent of the state and hence we implement it here - - // video file string - for (int i=0;i<init_para.videofile.length (); i++) - VIDEO_SINGLETON::instance ()->videoFile[i] = init_para.videofile[i]; - - VIDEO_SINGLETON::instance ()->videoFile [init_para.videofile.length ()] = 0; - - if (Mpeg_Global::session_num > Mpeg_Global::session_limit || init_para.version != VERSION) { - return CORBA::B_FALSE; - // ~~ We should be throwing exceptions here. - } - VIDEO_SINGLETON::instance ()->cmdsn = init_para.sn; - /* - fprintf (stderr, "MPEG file %s got.\n", VIDEO_SINGLETON::instance ()->videoFile); - */ - if (!strncasecmp ("LiveVideo", VIDEO_SINGLETON::instance ()->videoFile, 9)) { - if (OpenLiveVideo (&VIDEO_SINGLETON::instance ()->video_format, &VIDEO_SINGLETON::instance ()->horizontalSize, - &VIDEO_SINGLETON::instance ()->verticalSize, &VIDEO_SINGLETON::instance ()->averageFrameSize, - &VIDEO_SINGLETON::instance ()->fps, &VIDEO_SINGLETON::instance ()->pelAspectRatio) == -1) { - failureType = 100; - return CORBA::B_FALSE; - } - if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG2) { - failureType = 101; - return CORBA::B_FALSE; - } - VIDEO_SINGLETON::instance ()->live_source = 1; - - VIDEO_SINGLETON::instance ()->fileSize =0x7fffffff; - VIDEO_SINGLETON::instance ()->maxS = VIDEO_SINGLETON::instance ()->maxG = VIDEO_SINGLETON::instance ()->maxI = VIDEO_SINGLETON::instance ()->maxP = VIDEO_SINGLETON::instance ()->maxB = VIDEO_SINGLETON::instance ()->minS = VIDEO_SINGLETON::instance ()->minG = VIDEO_SINGLETON::instance ()->minI = VIDEO_SINGLETON::instance ()->minP = VIDEO_SINGLETON::instance ()->minB = 1; - VIDEO_SINGLETON::instance ()->numS = VIDEO_SINGLETON::instance ()->numG = VIDEO_SINGLETON::instance ()->numF = VIDEO_SINGLETON::instance ()->numI = 0x7fffffff; - VIDEO_SINGLETON::instance ()->numP = VIDEO_SINGLETON::instance ()->numB = 0; - VIDEO_SINGLETON::instance ()->vbvBufferSize = 1; - VIDEO_SINGLETON::instance ()->firstGopFrames = 1; - VIDEO_SINGLETON::instance ()->patternSize = 1; - VIDEO_SINGLETON::instance ()->pattern[0] = 'I'; - VIDEO_SINGLETON::instance ()->pattern[1] = 0; - VIDEO_SINGLETON::instance ()->packetBufSize = VIDEO_SINGLETON::instance ()->verticalSize * VIDEO_SINGLETON::instance ()->horizontalSize * 3; - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)malloc (sizeof (VideoMessage) + sizeof (VideoPacket) + - VIDEO_SINGLETON::instance ()->packetBufSize); - if (VIDEO_SINGLETON::instance ()->packet == NULL) - { - perror ("Error: VS error on malloc VIDEO_SINGLETON::instance ()->packet buffer"); - exit (1); - } - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *) ((char *)VIDEO_SINGLETON::instance ()->packet + sizeof (VideoMessage)); - - } - else { - static double pictureRateTable[] = {23.976, 24, 25, 29.97, 30, 50, 59.94, 60}; - - VIDEO_SINGLETON::instance ()->video_format = VIDEO_MPEG1; - failureType = VIDEO_SINGLETON::instance ()->init_MPEG1_video_file (); - if (failureType) - return CORBA::B_FALSE; - VIDEO_SINGLETON::instance ()->fps = pictureRateTable[VIDEO_SINGLETON::instance ()->pictureRate - 1]; - } - - // Set the Reply parameter values - ACE_NEW_RETURN (reply, - Video_Control::INITvideoReply, - CORBA::B_FALSE); - - reply->totalHeaders = VIDEO_SINGLETON::instance ()->numS; - reply->totalGroups = VIDEO_SINGLETON::instance ()->numG; - reply->totalFrames = VIDEO_SINGLETON::instance ()->numF; - reply->sizeIFrame = VIDEO_SINGLETON::instance ()->maxI; - reply->sizePFrame = VIDEO_SINGLETON::instance ()->maxP; - reply->sizeBFrame = VIDEO_SINGLETON::instance ()->maxB; - reply->sizeSystemHeader = VIDEO_SINGLETON::instance ()->maxS; - reply->sizeGop = VIDEO_SINGLETON::instance ()->maxG; - reply->averageFrameSize = VIDEO_SINGLETON::instance ()->averageFrameSize; - reply->verticalSize = VIDEO_SINGLETON::instance ()->verticalSize; - reply->horizontalSize = VIDEO_SINGLETON::instance ()->horizontalSize; - reply->pelAspectRatio = VIDEO_SINGLETON::instance ()->pelAspectRatio; - reply->pictureRate1000 = (int) (VIDEO_SINGLETON::instance ()->fps * 1000); - reply->vbvBufferSize = VIDEO_SINGLETON::instance ()->vbvBufferSize; - reply->firstGopFrames = VIDEO_SINGLETON::instance ()->firstGopFrames; - - reply->pattern.length (VIDEO_SINGLETON::instance ()->patternSize); - - // copy the sequence of char.. - for ( i = 0; i < VIDEO_SINGLETON::instance ()->patternSize; i++) - reply->pattern [i] = VIDEO_SINGLETON::instance ()->pattern [i]; - - reply->live = VIDEO_SINGLETON::instance ()->live_source; - reply->format = VIDEO_SINGLETON::instance ()->video_format; - - /* write the first SH, GOP and IFrame to VIDEO_SINGLETON::instance ()->serviceSocket (TCP), - using code for SendPacket () */ - { - - // ~~ He sends the first frame thru the connected TCP socket, - // we replace it to send thru the UDP data socket instead!! - if (VIDEO_SINGLETON::instance ()->live_source) StartPlayLiveVideo (); - - if (VIDEO_SINGLETON::instance ()->live_source) { - int frame = 0; - VIDEO_SINGLETON::instance ()->SendPicture (&frame); - } - else if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG1) { - VIDEO_SINGLETON::instance ()->SendPacket (1, 0, 0, 0, 1); // - // make the first_time flag = 1, so that the packet gets sent - // correctly using UDP - } - else { - fprintf (stderr, "VS: VIDEO_SINGLETON::instance ()->video_format %d not supported.\n", - VIDEO_SINGLETON::instance ()->video_format); - } - if (VIDEO_SINGLETON::instance ()->live_source) StopPlayLiveVideo (); - } - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_State::stat_stream (CORBA::Char_out ch, - CORBA::Long_out size) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::close (void) -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::stat_sent (void) -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::fast_forward (const Video_Control::FFpara ¶) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::fast_backward (const Video_Control::FFpara ¶) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::step (const Video_Control::STEPpara ¶) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::position (const Video_Control::POSITIONpara ¶) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::speed (const Video_Control::SPEEDpara ¶) - -{ - return CORBA::B_FALSE; -} - - -CORBA::Boolean -Video_Control_State::stop (CORBA::Long cmdsn) - -{ - return CORBA::B_FALSE; -} - -// ---------------------------------------------------------------------- - -Video_Control_Waiting_State::Video_Control_Waiting_State (void) -{ - //%% - this->state_ = VIDEO_WAITING; -} - -CORBA::Boolean -Video_Control_Waiting_State::stat_stream (CORBA::Char_out ch, - CORBA::Long_out size) - -{ - return 0; -} - -CORBA::Boolean -Video_Control_Waiting_State::close (void) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Waiting_State::close \n")); - VIDEO_SINGLETON::instance ()->normalExit = 1; - TAO_ORB_Core_instance ()->reactor ()->end_event_loop (); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_Waiting_State::stat_sent (void) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Waiting_State::stat_sent \n")); - return 0; -} - -// We are in the waiting state - and the client sent us -// the command fast-forward. -CORBA::Boolean -Video_Control_Waiting_State::fast_forward (const Video_Control::FFpara ¶) - -{ - // Many guys in legacy code depend on this variable. - VIDEO_SINGLETON::instance ()-> cmd = CmdFF; - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_Waiting_State::fast_forward () called\n")); - VIDEO_SINGLETON::instance ()->init_fast_play (para); - this->vci_->change_state (VIDEO_CONTROL_FAST_FORWARD_STATE::instance ()); - return CORBA::B_TRUE; -} - - -// We are in the waiting state - and the client sent us -// the command fast-backward. -CORBA::Boolean -Video_Control_Waiting_State::fast_backward (const Video_Control::FFpara ¶) - -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_Waiting_State::fast_backward () called\n")); - // Many guys in legacy code depend on this variable. - VIDEO_SINGLETON::instance ()-> cmd = CmdFB; - VIDEO_SINGLETON::instance ()->init_fast_play (para); - this->vci_->change_state (VIDEO_CONTROL_FAST_BACKWARD_STATE::instance ()); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_Waiting_State::step (const Video_Control::STEPpara ¶) - -{ - Video_Control::STEPpara step_para = para; - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_Waiting_State::step () called\n")); - - int group; - int tag = 0; - int result; - - VIDEO_SINGLETON::instance ()->cmdsn = step_para.sn; - - if (!VIDEO_SINGLETON::instance ()-> live_source) { - if (step_para.nextFrame >= VIDEO_SINGLETON::instance ()->numF) /* send SEQ_END */ - { - tag = 1; - step_para.nextFrame --; - } - /* - fprintf (stderr, "STEP . . .frame-%d\n", step_para.this->nextFrame); - */ - CheckFrameRange (step_para.nextFrame); - group = VIDEO_SINGLETON::instance ()->FrameToGroup (&step_para.nextFrame); - if (VIDEO_SINGLETON::instance ()-> precmd != CmdSTEP && !tag ) { - result = VIDEO_SINGLETON::instance ()->SendReferences (group, step_para.nextFrame); - if (result < 0 ) - return CORBA::B_FALSE; - } - } - if (VIDEO_SINGLETON::instance ()->live_source) - StartPlayLiveVideo (); - - if (VIDEO_SINGLETON::instance ()->live_source) { - VIDEO_SINGLETON::instance ()->SendPicture (&step_para.nextFrame); - } - else if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG1) { - VIDEO_SINGLETON::instance ()->SendPacket (VIDEO_SINGLETON::instance ()->numS>1, group, tag ? VIDEO_SINGLETON::instance ()->numF : step_para.nextFrame, 0); - } - else { - fprintf (stderr, "VS: wierd1\n"); - } - - if (VIDEO_SINGLETON::instance ()->live_source) StopPlayLiveVideo (); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_Waiting_State::play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts) - -{ - // Many guys in legacy code depend on this variable. - VIDEO_SINGLETON::instance ()-> cmd = CmdPLAY; - //ACE_DEBUG ((LM_DEBUG, - // "(%P|%t)Video_Control_Waiting_State::play () called \n")); - VIDEO_SINGLETON::instance ()->init_play (para, - vts); - cerr << "vts is " << vts << endl; - this->vci_->change_state (VIDEO_CONTROL_PLAY_STATE::instance ()); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_Waiting_State::position (const Video_Control::POSITIONpara &pos_para) - -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_Waiting_State::position () called \n")); - - if (VIDEO_SINGLETON::instance ()->live_source) - return CORBA::B_TRUE; - - CheckGroupRange (pos_para.nextGroup); - VIDEO_SINGLETON::instance ()-> cmd = CmdPOSITION; - VIDEO_SINGLETON::instance ()-> cmdsn = pos_para.sn; - - int result = VIDEO_SINGLETON::instance ()->SendPacket - (VIDEO_SINGLETON::instance () ->numS > 1 - || pos_para.nextGroup == 0, - pos_para.nextGroup, 0, 0); - - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_Waiting_State::speed (const Video_Control::SPEEDpara ¶) - -{ - return 0; -} - - -CORBA::Boolean -Video_Control_Waiting_State::stop (CORBA::Long cmdsn) - -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Waiting_State::stop ()\n")); - VIDEO_SINGLETON::instance ()->cmd = CmdSTOP; - VIDEO_SINGLETON::instance ()->cmdsn = cmdsn; - Video_Timer_Global::StopTimer(); - this->vci_->change_state (VIDEO_CONTROL_WAITING_STATE::instance ()); - return CORBA::B_TRUE; -} - -// Video_Control_Play_State methods - -Video_Control_Play_State::Video_Control_Play_State (void) -{ - this->state_ = VIDEO_PLAY; -} - -CORBA::Boolean -Video_Control_Play_State::stop (CORBA::Long cmdsn) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Play_State::stop ()\n")); - VIDEO_SINGLETON::instance ()->cmd = CmdSTOP; - VIDEO_SINGLETON::instance ()->cmdsn = cmdsn; - Video_Timer_Global::StopTimer(); - this->vci_->change_state (VIDEO_CONTROL_WAITING_STATE::instance ()); - return 0; -} - - -CORBA::Boolean -Video_Control_Play_State::speed (const Video_Control::SPEEDpara ¶) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Play_State::speed ()\n")); - VIDEO_SINGLETON::instance ()->frameRateLimit = para.frameRateLimit1000 / 1000.0; - VIDEO_SINGLETON::instance ()->sendPatternGops = para.sendPatternGops; - VIDEO_SINGLETON::instance ()->currentUPF = para.usecPerFrame; - VIDEO_SINGLETON::instance ()->addedUPF = 0; - - for (int i=0; i<para.sendPattern.length (); i++) - VIDEO_SINGLETON::instance ()->sendPattern [i] = para.sendPattern [i]; - // memcpy(VIDEO_SINGLETON::instance ()->sendPattern, para.sendPattern, PATTERN_SIZE); - - Video_Timer_Global::TimerSpeed (); - VIDEO_SINGLETON::instance ()->play_send (); - return CORBA::B_TRUE; -} - - -Video_Control_Fast_Forward_State::Video_Control_Fast_Forward_State (void) -{ - this->state_ = VIDEO_FAST_FORWARD; -} - -CORBA::Boolean -Video_Control_Fast_Forward_State::stop (CORBA::Long cmdsn) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Fast_Forward_State::stop ()\n")); - VIDEO_SINGLETON::instance ()->cmd = CmdSTOP; - VIDEO_SINGLETON::instance ()->cmdsn = cmdsn; - Video_Timer_Global::StopTimer(); - this->vci_->change_state (VIDEO_CONTROL_WAITING_STATE::instance ()); - return CORBA::B_TRUE; -} - -CORBA::Boolean -Video_Control_Fast_Forward_State::close (void) -{ - return CORBA::B_TRUE; -} - -// ---------------------------------------------------------------------- - -Video_Control_Fast_Backward_State::Video_Control_Fast_Backward_State (void) -{ - this->state_ = VIDEO_FAST_BACKWARD; -} - -CORBA::Boolean -Video_Control_Fast_Backward_State::stop (CORBA::Long cmdsn) -{ - ACE_DEBUG ((LM_DEBUG, - "Video_Control_Fast_Backward_State::stop ()\n")); - VIDEO_SINGLETON::instance ()->cmd = CmdSTOP; - VIDEO_SINGLETON::instance ()->cmdsn = cmdsn; - Video_Timer_Global::StopTimer(); - this->vci_->change_state (VIDEO_CONTROL_WAITING_STATE::instance ()); - return CORBA::B_TRUE; -} - -CORBA::Boolean -Video_Control_Fast_Backward_State::close (void) -{ - return CORBA::B_TRUE; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h deleted file mode 100644 index c68c074b56b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- C++ -*- */ - -/* $Id$ */ - -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#if !defined (MPEG_VIDEO_CONTROL_STATE_H) -#define MPEG_VIDEO_CONTROL_STATE_H - -#include "ace/Singleton.h" -#include "mpeg_shared/Video_ControlS.h" -#include "mpeg_server/Video_Control_i.h" - -class Video_Control_i; - -class Video_Control_State -{ - // = TITLE - // Defines an abstract class that is used to implement the state - // pattern for the video control. - // - // = DESCRIPTION - // The various states of the video control are defined by the - // Video_States enum. They can be implemented by subclassing from - // this class and overriding the handle_input method. -public: - Video_Control_State (void); - // constructor - - enum Video_States - { - VIDEO_WAITING, - VIDEO_PLAY = 1, - VIDEO_FAST_FORWARD = 2, - VIDEO_FAST_BACKWARD = 3 - }; - - Video_States get_state (void); - // returns the current state - - void set_state (Video_States state); - // sets the state - - virtual CORBA::Boolean init_video (const Video_Control::INITvideoPara ¶, - Video_Control::INITvideoReply_out reply) ; - - virtual CORBA::Boolean stat_stream (CORBA::Char_out ch, - CORBA::Long_out size); - - virtual CORBA::Boolean close (void); - - virtual CORBA::Boolean stat_sent (void); - - virtual CORBA::Boolean fast_forward (const Video_Control::FFpara ¶) ; - - virtual CORBA::Boolean fast_backward (const Video_Control::FFpara ¶) ; - - virtual CORBA::Boolean step (const Video_Control::STEPpara ¶) ; - - virtual CORBA::Boolean play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts) ; - - virtual CORBA::Boolean position (const Video_Control::POSITIONpara ¶) ; - - virtual CORBA::Boolean speed (const Video_Control::SPEEDpara ¶) ; - - virtual CORBA::Boolean stop (CORBA::Long cmdsn) ; - -protected: - Video_States state_; - // State of this object - - Video_Control_i *vci_; - -}; - -class Video_Control_Waiting_State : public virtual Video_Control_State -{ - // = TITLE - // Defines a class that implements the waiting state of the video - // control state pattern. -public: - Video_Control_Waiting_State (void); - // Default constructor, sets the state to WAITING - - virtual CORBA::Boolean stat_stream (CORBA::Char_out ch, - CORBA::Long_out size); - - virtual CORBA::Boolean close (void); - - virtual CORBA::Boolean stat_sent (void); - - virtual CORBA::Boolean fast_forward (const Video_Control::FFpara ¶); - - virtual CORBA::Boolean fast_backward (const Video_Control::FFpara ¶); - - virtual CORBA::Boolean step (const Video_Control::STEPpara ¶); - - - virtual CORBA::Boolean play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts); - - virtual CORBA::Boolean position (const Video_Control::POSITIONpara ¶); - - virtual CORBA::Boolean speed (const Video_Control::SPEEDpara ¶); - - virtual CORBA::Boolean stop (CORBA::Long cmdsn); -}; - -class Video_Control_Play_State : public virtual Video_Control_State -{ - // = TITLE - // Defines a class that implements the playing state of the video - // control state pattern. -public: - Video_Control_Play_State (void); - // Default constructor, sets the state to VIDEO_PLAY - - virtual CORBA::Boolean stop (CORBA::Long cmdsn); - - virtual CORBA::Boolean speed (const Video_Control::SPEEDpara ¶); -}; - -class Video_Control_Fast_Forward_State : public virtual Video_Control_State -{ - // = TITLE - // Defines a class that implements the fast_forward state of the video - // control state pattern. -public: - Video_Control_Fast_Forward_State (void); - // Default constructor, sets the state to VIDEO_FAST_FORWARD - - CORBA::Boolean close (void); - - CORBA::Boolean stop (CORBA::Long cmdsn); -}; - -class Video_Control_Fast_Backward_State : public virtual Video_Control_State -{ - // = TITLE - // Defines a class that implements the fast_backward state of the video - // control state pattern. -public: - Video_Control_Fast_Backward_State (void); - // Default constructor, sets the state to VIDEO_FAST_BACKWARD - - CORBA::Boolean close (void); - - CORBA::Boolean stop (CORBA::Long cmdsn); -}; - -typedef ACE_Singleton <Video_Control_Waiting_State, ACE_SYNCH_MUTEX> - VIDEO_CONTROL_WAITING_STATE; -typedef ACE_Singleton <Video_Control_Play_State, ACE_SYNCH_MUTEX> - VIDEO_CONTROL_PLAY_STATE; -typedef ACE_Singleton <Video_Control_Fast_Forward_State, ACE_SYNCH_MUTEX> - VIDEO_CONTROL_FAST_FORWARD_STATE; -typedef ACE_Singleton <Video_Control_Fast_Backward_State, ACE_SYNCH_MUTEX> - VIDEO_CONTROL_FAST_BACKWARD_STATE; - -#endif /* MPEG_VIDEO_SERVER_STATE_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp deleted file mode 100644 index 79f5438fe58..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// $Id$ - -#include "Video_Control_i.h" -#include "mpeg_server/Video_Server.h" - -Video_Control_i::Video_Control_i () - : reactor_ (TAO_ORB_Core_instance ()->reactor ()) -{ - -} - -int -Video_Control_i::create_handlers (void) -{ - ACE_NEW_RETURN (this->data_handler_, - Video_Data_Handler, - -1); - - ACE_NEW_RETURN (this->sig_handler_, - Video_Sig_Handler, - -1); - return 0; -} -CORBA::Boolean -Video_Control_i::init_video (const Video_Control::INITvideoPara ¶, - Video_Control::INITvideoReply_out reply, - CORBA::Environment& env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_i::init_video () called\n")); - - CORBA::Boolean result = this->state_->init_video (para, - reply); - - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Video_Control_State::init_video returned %d\n", result)); - return result; - -} - - -CORBA::Boolean -Video_Control_i::stat_stream (CORBA::Char_out ch, - CORBA::Long_out size, - CORBA::Environment& env) -{ - return 0; -} - - -CORBA::Boolean -Video_Control_i::close (CORBA::Environment& env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_i::close:" - "shutting down the ORB\n")); - - TAO_ORB_Core_instance ()-> orb ()-> shutdown (); - return CORBA::B_TRUE; -} - - -CORBA::Boolean -Video_Control_i::stat_sent (CORBA::Environment& env) -{ - return 0; -} - - -CORBA::Boolean -Video_Control_i::fast_forward (const Video_Control::FFpara ¶, - CORBA::Environment& env) -{ - return this->state_->fast_forward (para); -} - - -CORBA::Boolean -Video_Control_i::fast_backward (const Video_Control::FFpara ¶, - CORBA::Environment& env) -{ - return this->state_->fast_backward (para); -} - - -CORBA::Boolean -Video_Control_i::step (const Video_Control::STEPpara ¶, - CORBA::Environment& env) -{ - return this->state_->step (para); -} - - -// this gets called by the client, when it wants -// to start playback -CORBA::Boolean -Video_Control_i::play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts, - CORBA::Environment& env) -{ - return this->state_->play (para, - vts); -} - - -CORBA::Boolean -Video_Control_i::position (const Video_Control::POSITIONpara ¶, - CORBA::Environment& env) -{ - return this->state_->position (para); -} - - -CORBA::Boolean -Video_Control_i::speed (const Video_Control::SPEEDpara ¶, - CORBA::Environment& env) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_i::speed () called\n")); - return this->state_->speed (para); -} - - -CORBA::Boolean -Video_Control_i::stop (CORBA::Long cmdsn, - CORBA::Environment& env) -{ - return this->state_->stop (cmdsn); -} - -CORBA::UShort -Video_Control_i::set_peer (const char *peer, - CORBA::Environment &_tao_environment) -{ - ACE_INET_Addr client_data_addr (peer); - // Data (UDP) Address of the client. - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) set_peer called: %s,%s,%d\n", - peer, - client_data_addr.get_host_addr (), - client_data_addr.get_port_number ())); - - - if (VIDEO_SINGLETON::instance ()->dgram.open (client_data_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) UDP open failed: %p\n"), - -1); - - ACE_INET_Addr server_data_addr; - // Data (UDP) Address of this server. - - if (VIDEO_SINGLETON::instance ()-> dgram.get_local_addr - (server_data_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) UDP get_local_addr failed: %p\n"), - -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Server: My UDP port number is %d\n", - server_data_addr.get_port_number ())); - - if (this->register_handlers () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Video_Control_i::set_peer: register_handlers failed\n"), - -1); - - VIDEO_SINGLETON::instance ()->videoSocket = VIDEO_SINGLETON::instance ()->dgram.get_handle (); - - ACE_DEBUG ((LM_DEBUG,"(%P|%t) set_peer: server port = %d\n",server_data_addr.get_port_number ())); - return server_data_addr.get_port_number (); - -} - -int -Video_Control_i::register_handlers (void) -{ - int result; - - // Register the event handlers with the Reactor - - // first the data handler, i.e. UDP - result = this->reactor_->register_handler (this->data_handler_, - ACE_Event_Handler::READ_MASK); - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) register_handler for data_handler failed\n"), - -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) registered fd for data handler = (%d)\n", - this->data_handler_->get_handle ())); - - // finally, the signal handler, for periodic transmission - // of packets - result = this->sig_handler_->register_handler (); - - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) register_handler for sig_handler" - "failed!\n"), - -1); - - return 0; -} - -// Changes the state of the video control handler from the current -// state to the state represented by the argument. -void -Video_Control_i::change_state (Video_Control_State *state) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Video_Control_i::Changing to state %d\n", - state->get_state ())); - this->state_ = state; -} - -// Returns the current state object . -Video_Control_State * -Video_Control_i::get_state (void) -{ - return this->state_; -} - - -Video_Control_i::~Video_Control_i () -{ - delete this->data_handler_; - delete this->sig_handler_; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h deleted file mode 100644 index b7cc53ebaaf..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -#if !defined (AV_VIDEO_CONTROL_H) -#define AV_VIDEO_CONTROL_H - -#include "mpeg_shared/Video_ControlS.h" -#include "Video_Server.h" - -class Video_Data_Handler; -class Video_Sig_Handler; -class Video_Control_State; - -class Video_Control_i - : public virtual POA_Video_Control -{ -public: - Video_Control_i (); - // constructor - - int create_handlers (void); - // creates the data and signal handlers - - virtual CORBA::Boolean init_video (const Video_Control::INITvideoPara ¶, - Video_Control::INITvideoReply_out reply, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean stat_stream (CORBA::Char_out ch, - CORBA::Long_out size, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean close (CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean stat_sent (CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean fast_forward (const Video_Control::FFpara ¶, - CORBA::Environment &_tao_environment - ); - - virtual CORBA::Boolean fast_backward (const Video_Control::FFpara ¶, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean step (const Video_Control::STEPpara ¶, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean play (const Video_Control::PLAYpara ¶, - CORBA::Long_out vts, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean position (const Video_Control::POSITIONpara ¶, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean speed (const Video_Control::SPEEDpara ¶, - CORBA::Environment &_tao_environment); - - virtual CORBA::Boolean stop (CORBA::Long cmdsn, - CORBA::Environment &_tao_environment); - - virtual CORBA::UShort set_peer (const char *peer, - CORBA::Environment &_tao_environment); - // called by the client to inform us about it's ip and - // udp address. - - void change_state (Video_Control_State *state); - // Used to change the state - - Video_Control_State *get_state (void); - // Accessor for the state_ - - virtual ~Video_Control_i (void); - // Destructor - -protected: - int register_handlers (void); - // called by set_peer to install the data_handler and - // the sig_handler - - ACE_Reactor *reactor_; - // The Reactor - - TAO_ORB_Manager *orb_manager_; - // The ORB manager - - Video_Control_State *state_; - // State pattern - pointer to abstract State object - - Video_Data_Handler *data_handler_; - // Data Socket Event Handler - - Video_Sig_Handler *sig_handler_; - // signal handler for SIGALRM to periodically send the video frames - // to the client - -}; - -// Video_Control_i instance singleton. -// %% -typedef ACE_Singleton <Video_Control_i, ACE_Null_Mutex> VIDEO_CONTROL_I; - -#endif /* if !defined (AV_VIDEO_CONTROL_H) */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp deleted file mode 100644 index 3f8c83f889e..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.cpp +++ /dev/null @@ -1,374 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#include "Video_Server.h" -#include "orbsvcs/CosNamingC.h" - -// Video_Sig_Handler methods -// handles the timeout SIGALRM signal -Video_Sig_Handler::Video_Sig_Handler () - : vci_ (VIDEO_CONTROL_I::instance ()) -{ -} - -int -Video_Sig_Handler::register_handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != -1); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. - if (TAO_ORB_Core_instance ()->reactor ()->register_handler - (this, ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - - // Create a sigset_t corresponding to the signals we want to catch. - ACE_Sig_Set sig_set; - - // sig_set.sig_add (SIGINT); - // sig_set.sig_add (SIGQUIT); - sig_set.sig_add (SIGALRM); - - // Register the signal handler object to catch the signals. - if (TAO_ORB_Core_instance ()->reactor ()->register_handler (sig_set, - this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - return 0; -} -// Called by the ACE_Reactor to extract the fd. - -ACE_HANDLE -Video_Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -int -Video_Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handling asynchonrous input...\n")); - return 0; -} - -int -Video_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, -// the behavior triggered by the signal is handled in the main event -// loop, rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -Video_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - // ACE_DEBUG ((LM_DEBUG, "(%t) received signal %S\n", signum)); - - switch (signum) - { - case SIGALRM: - // Handle the timeout - Video_Timer_Global::timerHandler (SIGALRM); - // send the frame - // cerr << "current state = " << this->vci_->get_state ()->get_state (); - switch (this->vci_->get_state ()->get_state ()) - { - case Video_Control_State::VIDEO_PLAY: - VIDEO_SINGLETON::instance ()->play_send (); - break; - case Video_Control_State::VIDEO_FAST_FORWARD: - // this handles the forward play case! - VIDEO_SINGLETON::instance ()->fast_play_send (); - break; - case Video_Control_State::VIDEO_FAST_BACKWARD: - // this handles the backward play case! - VIDEO_SINGLETON::instance ()->fast_play_send (); - break; - default: - break; - } - break; - default: - ACE_DEBUG ((LM_DEBUG, - "(%t) %S: not handled, returning to program\n", - signum)); - break; - } - // ACE_DEBUG ((LM_DEBUG,"returning from handle_signal")); - return 0; -} - -// Video_Data_Handler methods - -Video_Data_Handler::Video_Data_Handler () - : vci_ (VIDEO_CONTROL_I::instance ()) -{ -} - -ACE_HANDLE -Video_Data_Handler::get_handle (void) const -{ - return VIDEO_SINGLETON::instance ()->dgram.get_handle (); -} - -int -Video_Data_Handler::handle_input (ACE_HANDLE handle) -{ - // fprintf (stderr,"Video_Data_Handler::handle_input ()\n"); - - switch (this->vci_->get_state ()->get_state ()) - { - case Video_Control_State::VIDEO_PLAY: - if (VIDEO_SINGLETON::instance ()->GetFeedBack () == -1) - { - ACE_DEBUG ((LM_DEBUG, "(%P|%t) Error reading feedback. Ending the reactor event loop\n")); - TAO_ORB_Core_instance ()-> orb ()->shutdown (); - return -1; - } - - VIDEO_SINGLETON::instance ()->play_send (); // simulating the for loop in playvideo () in vs.cpp - break; - case Video_Control_State::VIDEO_FAST_FORWARD: - case Video_Control_State::VIDEO_FAST_BACKWARD: - VIDEO_SINGLETON::instance ()->GetFeedBack (); - VIDEO_SINGLETON::instance ()->fast_play_send (); // simulating the for loop in fast_play - break; - } - return 0; -} - -// Video_Control_Handler methods - - - -// ---------------------------------------------------------------------- -// Video_Server methods - -// Do-nothing default constructor. -Video_Server::Video_Server () -{ -} - -int -Video_Server::init (int argc, - char **argv, - CORBA::Environment &env) -{ - int result; - - if (this->initialize_orb (argc, - argv, - env) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Video_Server: orb initialization failed!"), - -1); - - // ACE_DEBUG ((LM_DEBUG, - // "(%P|%t) Video_Server::init () ORB init success \n")); - - // @@ Can you please change the use of "fd" to "handle" globally? - // Set the global socket fd's from the arguments. - int max_pkt_size = -INET_SOCKET_BUFFER_SIZE; - VIDEO_SINGLETON::instance ()->serviceSocket = -1; - - VIDEO_SINGLETON::instance ()->conn_tag = max_pkt_size; - - if (max_pkt_size > 0) - VIDEO_SINGLETON::instance ()->msgsize - = max_pkt_size; - else - if (max_pkt_size < 0) - VIDEO_SINGLETON::instance ()->msgsize - = - max_pkt_size; - else - VIDEO_SINGLETON::instance ()->msgsize - = 1024 * 1024; - /* - SFprintf(stderr, "VS VIDEO_SINGLETON::instance ()->msgsize = %d\n", VIDEO_SINGLETON::instance ()->msgsize); - */ - VIDEO_SINGLETON::instance ()->msgsize -= sizeof(VideoMessage); - - VIDEO_SINGLETON::instance ()->start_time = time(NULL); - - // Set the atexit routine - atexit (on_exit_routine); - - VIDEO_SINGLETON::instance ()->lastRef [0] - = VIDEO_SINGLETON::instance ()->lastRef[1] - = -1; - - VIDEO_SINGLETON::instance ()->lastRefPtr = 0; - - return 0; -} - -int -Video_Server::run (CORBA::Environment &env) -{ - return this->orb_manager_.run (env); -} - -int -Video_Server::initialize_orb (int argc, - char **argv, - CORBA::Environment &env) -{ - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - int result; - - - - - // Initialize the orb_manager - this->orb_manager_.init_child_poa (argc, - argv, - "child_poa", - env); - TAO_CHECK_ENV_RETURN (env, - -1); - - - // %% hack to make the ORB manager pick its own port - // we create an Ace_Time_Value of time out zero, - // and then call a dummy orb run - ACE_Time_Value tv (0); - if (this->orb_manager_.orb ()-> run (tv) == -1) - ACE_ERROR_RETURN ( (LM_ERROR, - "(%P|%t) ORB_run %p\n", - "run"), - -1); - - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - - VIDEO_CONTROL_I::instance ()-> create_handlers (); - - this->orb_manager_.activate_under_child_poa ("Video_Control", - VIDEO_CONTROL_I::instance (), - env); - TAO_CHECK_ENV_RETURN (env,-1); - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - CORBA::Object_var naming_obj = - this->orb_manager_.orb ()->resolve_initial_references ("NameService"); - if (CORBA::is_nil (naming_obj.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to resolve the Name Service.\n"), - -1); - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in (), - env); - TAO_CHECK_ENV_RETURN (env, - -1); - - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - // Create a name for the video control object - CosNaming::Name video_control_name (1); - video_control_name.length (1); - video_control_name [0].id = CORBA::string_dup ("Video_Control"); - - // Register the video control object with the naming server. - naming_context->bind (video_control_name, - VIDEO_CONTROL_I::instance ()->_this (env), - env); - - if (env.exception () != 0) - { - env.clear (); - naming_context->rebind (video_control_name, - VIDEO_CONTROL_I::instance ()->_this (env), - env); - TAO_CHECK_ENV_RETURN (env, - -1); - } - - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - VIDEO_CONTROL_I::instance ()->change_state (VIDEO_CONTROL_WAITING_STATE::instance ()); - // ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - return 0; -} - -void -Video_Server::on_exit_routine(void) -{ - struct sockaddr_in peeraddr_in; - int size = sizeof(peeraddr_in); - /* - if (!VIDEO_SINGLETON::instance ()->normalExit) { - fprintf(stderr, "VS exitting abnormally, dump core...\n"); - kill(getpid(), SIGSEGV); - usleep(2000000); - } - */ - /* - fprintf(stderr, "A VS session terminated.\n"); - */ - if (getpeername(VIDEO_SINGLETON::instance ()->serviceSocket, - (struct sockaddr *)&peeraddr_in, &size) == 0 && - peeraddr_in.sin_family == AF_INET) { - if (strncmp(inet_ntoa(peeraddr_in.sin_addr), "129.95.50", 9)) { - struct hostent *hp; - time_t val = time(NULL); - char * buf = ctime(&VIDEO_SINGLETON::instance ()->start_time); - - hp = gethostbyaddr((char *)&(peeraddr_in.sin_addr), 4, AF_INET); - buf[strlen(buf)-1] = 0; - printf("%s: %s %3dm%02ds %dP %s\n", - buf, - hp == NULL ? inet_ntoa(peeraddr_in.sin_addr) : hp->h_name, - (val - VIDEO_SINGLETON::instance ()->start_time) / 60, (val - VIDEO_SINGLETON::instance ()->start_time) % 60, - VIDEO_SINGLETON::instance ()->pkts_sent, VIDEO_SINGLETON::instance ()->videoFile); - } - } - /* - ComCloseConn(VIDEO_SINGLETON::instance ()->serviceSocket); - ComCloseConn(VIDEO_SINGLETON::instance ()->videoSocket);*/ -} - -// Destructor -Video_Server::~Video_Server () -{ -} - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h deleted file mode 100644 index de50b83adcf..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h +++ /dev/null @@ -1,154 +0,0 @@ -/* -*- C++ -*- */ -/* $Id$ */ - -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#if !defined (MPEG_VIDEO_SERVER_H) -#define MPEG_VIDEO_SERVER_H - -#include "ace/Reactor.h" -#include "ace/Event_Handler.h" - -#include "tao/TAO.h" -#include "include/common.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/sendpt.h" -#include "mpeg_shared/Video_ControlS.h" -#include "mpeg_server/server_proto.h" -#include "mpeg_server/Video_Control_State.h" -#include "mpeg_server/Globals.h" -#include "mpeg_server/Video_Control_i.h" - -class Video_Control_i; - -class Video_Sig_Handler - : public virtual ACE_Event_Handler -{ - // = TITLE - // Defines a video signal handler class which registers itself with the - // default ACE_Reactor::instance () . Handles the - // SIGALRM signal. - // - // = DESCRIPTION - // This class contains a pointer to a Video_Control_Handler - // instance and decides the signal action depending on its state. - // An object of this class is used to periodically send the video - // frames to the client using the Video_Timer_Global class. -public: - Video_Sig_Handler (); - - virtual ACE_HANDLE get_handle (void) const; - - int register_handler (void); - // this will register this sig_handler - // with the reactor for SIGALRM - - virtual int shutdown (ACE_HANDLE, - ACE_Reactor_Mask); - - virtual int handle_input (ACE_HANDLE); - - virtual int handle_signal (ACE_HANDLE signum, - siginfo_t * = 0, - ucontext_t* = 0); -private: - ACE_HANDLE handle_; - // my handle - - Video_Control_i *vci_; - // Pointer to the Video_Control_i for accessing - // the current state of the server. -}; - -class Video_Data_Handler : public virtual ACE_Event_Handler -{ - - // = TITLE - // Defines a event handler for video data using a datagram i.e UDP - // socket. - // - // = DESCRIPTION - // This takes a pointer to a Video_Control_Handler instance and - // reacts differently to the events based on the - // video_control_handler's state. -public: - Video_Data_Handler (); - // Constructor - - virtual int handle_input (ACE_HANDLE fd = ACE_INVALID_HANDLE); - // Called when data shows up. - - virtual ACE_HANDLE get_handle (void) const; - // Get the handle used by this event handler - -private: - Video_Control_i *vci_; - -}; - -class Video_Server -{ - // = TITLE - // Defines a class that abstracts the functionality of a - // video_server. - // - // = DESCRIPTION - // This registers 3 event handlers with the <ACE_Reactor::instance>, - // namely a control,data and signal handlers. -public: - Video_Server (void); - // Default constructor - - ~Video_Server (); - // Destructor - - int init (int argc, - char **argv, - CORBA::Environment &env); - // initialize the Video Server. - - - int run (CORBA::Environment &env); - // Runs the ORB event loop - - static void on_exit_routine(void); - -private: - - int initialize_orb (int argc, - char **argv, - CORBA::Environment &env); - // Initialize the orb using the orb_manager_ - // Also registers the video_control_ object in the poa - // and in the naming service - TAO_ORB_Manager orb_manager_; - // the TAO ORB manager. - -}; - -#endif /* MPEG_VIDEO_SERVER_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/as.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/as.cpp deleted file mode 100644 index 560ab606b87..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/as.cpp +++ /dev/null @@ -1,705 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <sys/types.h> -#include <netdb.h> -#include <string.h> -#include <stdlib.h> - -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <unistd.h> -#include <time.h> -#include <sys/time.h> -#include <stdio.h> -#include <errno.h> -#include <signal.h> -#include "include/common.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/com.h" -#include "server_proto.h" - -//extern int Mpeg_Global::session_limit, Mpeg_Global::session_num; - -static bytes_sent = 0; -static time_t start_time; - -static int conn_tag; - -static int serviceSocket; -static int audioSocket = -1; - -static char audioFile[PATH_SIZE]; -static int fd; -static AudioParameter audioPara; -static int totalSamples; -static int fileSize; -static unsigned char cmd; -static live_source = 0; - -static int CmdRead(char *buf, int psize) -{ - int res = wait_read_bytes(serviceSocket, buf, psize); - if (res == 0) return (1); - if (res == -1) { - fprintf(stderr, "AS error on read cmdSocket, size %d", psize); - perror(""); - return (-1); - } - return 0; -} - -static void CmdWrite(char *buf, int size) -{ - int res = wait_write_bytes(serviceSocket, buf, size); - if (res == -1) { - if (errno != EPIPE) perror("AS writes to serviceSocket"); - exit(errno != EPIPE); - } -} - -static int INITaudio(void) -{ - int result; - int failureType; /* 0 - can't open file, 1 - can't open live source */ - INITaudioPara para; - - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.version = ntohl(para.version); - para.nameLength = ntohl(para.nameLength); - para.para.encodeType = ntohl(para.para.encodeType); - para.para.channels = ntohl(para.para.channels); - para.para.samplesPerSecond = ntohl(para.para.samplesPerSecond); - para.para.bytesPerSample = ntohl(para.para.bytesPerSample); -#endif - if (para.nameLength>0) - result = CmdRead(audioFile, para.nameLength); - if (result != 0) - return result; - if (Mpeg_Global::session_num > Mpeg_Global::session_limit || para.version != VERSION) { - char errmsg[128]; - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - if (Mpeg_Global::session_num > Mpeg_Global::session_limit) { - sprintf(errmsg, - "Too many sessions being serviced, please try again later.\n"); - } - else { - sprintf(errmsg, "Version # not match, AS %d.%02d, Client %d.%02d", - VERSION / 100, VERSION % 100, - para.version / 100, para.version % 100); - } - write_string(serviceSocket, errmsg); - return(1); - } - memcpy(&audioPara, ¶.para, sizeof(audioPara)); - /* - fprintf(stderr, "Client Audio para: encode %d, ch %d, sps %d, bps %d.\n", - para.para.encodeType, para.para.channels, - para.para.samplesPerSecond, para.para.bytesPerSample); - */ - audioFile[para.nameLength] = 0; - { - int len = strlen(audioFile); - if (strncasecmp("LiveAudio", audioFile, 9) && - strcasecmp(".au", audioFile+len-3)) { - char errmsg[128]; - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - sprintf(errmsg, "%s without suffix .au", audioFile); - write_string(serviceSocket, errmsg); - return(1); - } - } - /* - fprintf(stderr, "Audio file %s got.\n", audioFile); - */ - - if (!strncasecmp("LiveAudio", audioFile, 9)) { - fd = OpenLiveAudio(&(para.para)); - if (fd == -1) { - failureType = 1; - goto failure; - } - fileSize =0x7fffffff; - totalSamples = fileSize / audioPara.bytesPerSample; - live_source = 1; - } - else { - LeaveLiveAudio(); - fd = open(audioFile, O_RDONLY); - if (fd == -1) - { - fprintf(stderr, "AS error on opening audio file %s", audioFile); - perror(""); - failureType = 0; - goto failure; - } - - /* Try to get audioFile format audioPara here */ - - /* figure out totalsamples */ - fileSize = lseek(fd, 0L, SEEK_END); - lseek(fd, 0L, SEEK_SET); - totalSamples = fileSize / audioPara.bytesPerSample; - /* - fprintf(stderr, "Total Samples=%d in audio file %ss.\n", totalSamples, audioFile); - */ - } - { - INITaudioReply reply; - - reply.para.encodeType = htonl(audioPara.encodeType); - reply.para.channels = htonl(audioPara.channels); - reply.para.samplesPerSecond = htonl(audioPara.samplesPerSecond); - reply.para.bytesPerSample = htonl(audioPara.bytesPerSample); - reply.totalSamples = htonl(totalSamples); - - reply.live = htonl(live_source); - reply.format = htonl(AUDIO_RAW); - - CmdWrite((char *)&cmd, 1); - CmdWrite((char *)&reply, sizeof(reply)); - } - return 0; - - failure: - { - /* - fprintf(stderr, "AS error: failed initializing audio file.\n"); - */ - cmd = CmdFAIL; - CmdWrite((char *)&cmd, 1); - write_string(serviceSocket, - failureType == 0 ? "Failed to open audio file for read." : - "Failed to connect to live audio source."); - return(1); - } -} - -#define DATABUF_SIZE 500 - -static int databuf_size; -static int cmdsn; -static int nextsample; -static int sps; /* audio play speed given by the client: samples per second */ -static int spslimit; -static int spp; /* samples per packet */ -static AudioPacket * pktbuf = NULL; - -/* send a packet of audio samples to audioSocket - returns: 0 - no more data from audio file: EOF reached; - 1 - More data is available from the audio file */ -static int send_packet(int firstSample, int samples) -{ - long offset = firstSample * audioPara.bytesPerSample; - int size = samples * audioPara.bytesPerSample; - char * buf = (char *)pktbuf + sizeof(*pktbuf); - int len; - int resent = 0; - int segsize, sentsize; - - if (live_source) { - len = ReadLiveAudioSamples(buf, samples); - len *= audioPara.bytesPerSample; - } - else { - lseek(fd, offset, SEEK_SET); - while ((len = read(fd, buf, size)) == -1) { - if (errno == EINTR) - continue; /* interrupted */ - perror("AS error on read audio file"); - return(-1); - } - if (len < audioPara.bytesPerSample) { - return 0; - } - } - - samples = len / audioPara.bytesPerSample; - len = samples * audioPara.bytesPerSample; - bytes_sent += len; - pktbuf->firstSample = htonl(firstSample); - pktbuf->samples = htonl(samples); - pktbuf->actualSamples = htonl(samples); - pktbuf->dataBytes = htonl(len); - if (spslimit < sps) { /* interpolation needed */ - SFprintf(stderr, "AS audio sample interpolation not available yet.\n"); - } - segsize = sizeof(*pktbuf) + len; - if (conn_tag != 0) { - while ((sentsize = write(audioSocket, (char *)pktbuf, segsize)) == -1) { - if (errno == EINTR) /* interrupted */ - continue; - if (errno == ENOBUFS) { - if (resent) { - perror("AS Warning, pkt discarded because"); - break; - } - else { - resent = 1; - usleep(5000); - continue; - } - } - if (errno != EPIPE) { - fprintf(stderr, "AS error on send audio packet %d(%d):", - firstSample, samples); - perror(""); - } - exit((errno != EPIPE)); - } - } - else { - sentsize = wait_write_bytes(audioSocket, (char *)pktbuf, segsize); - if (sentsize == -1) { - if (errno != EPIPE) { - fprintf(stderr, "AS error on send audio packet %d(%d):", - firstSample, samples); - perror(""); - } - exit((errno != EPIPE)); - } - } - if (sentsize < segsize) { - SFprintf(stderr, "AS warning: message size %dB, sent only %dB\n", - segsize, sentsize); - } - /* - SFprintf(stderr, "AS sent audio packet %d(%d).\n", - firstSample, samples); - */ - return (len < size ? 0 : 1); -} - -/* send a packet of audio samples to audioSocket - returns: 0 - no more data from audio file: EOF reached; - 1 - More data is available from the audio file */ -static int SendPacket(void) -{ - int moredata; - pktbuf->cmdsn = htonl(cmdsn); - pktbuf->resend = htonl(0); - pktbuf->samplesPerSecond = htonl(sps); - moredata = send_packet(nextsample, spp); - if (moredata) { - nextsample += spp; - } - return moredata; -} - -static void ResendPacket(int firstsample, int samples) -{ - pktbuf->cmdsn = htonl(cmdsn); - pktbuf->resend = htonl(1); - pktbuf->samplesPerSecond = htonl(sps); - while (samples > 0) { - int size = samples < spp ? samples : spp; - send_packet(firstsample, size); - firstsample += size; - samples -= size; - if (samples > 0) { - usleep(10000); - } - } -} - -#define SPEEDUP_SCALE 5 -#define MAX_RESEND_REQS 10 -#define FBBUF_SIZE (sizeof(AudioFeedBackPara) + \ - (MAX_RESEND_REQS - 1) * sizeof(APdescriptor)) - -static AudioFeedBackPara * fbpara = NULL; - -static int PLAYaudio(void) -{ - int hasdata = 1; - int addSamples; - int packets = 0; - unsigned nextTime; - int upp; /* micro-seconds per packet */ - int delta_sps = 0; /* compensation for sps from feedback msgs */ - int nfds = (serviceSocket > audioSocket ? serviceSocket : audioSocket) + 1; - int result; - /* - fprintf(stderr, "PLAY . . .\n"); - */ - { - PLAYaudioPara para; - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.nextSample = ntohl(para.nextSample); - para.samplesPerSecond = ntohl(para.samplesPerSecond); - para.samplesPerPacket = ntohl(para.samplesPerPacket); - para.ABsamples = ntohl(para.ABsamples); - para.spslimit = ntohl(para.spslimit); -#endif - nextsample = para.nextSample; - cmdsn = para.sn; - sps = para.samplesPerSecond; - spslimit = para.spslimit; - spp = para.samplesPerPacket; - addSamples = para.ABsamples / 2; - if (spp * audioPara.bytesPerSample > databuf_size) { - spp = databuf_size / audioPara.bytesPerSample; - } - /* - SFprintf(stderr, "AS got CmdPLAY: sps %d\n", sps); - */ - } - /* - fprintf(stderr, "AS: nextSampe=%d for PLAY.\n", para.nextSample); - */ - - upp = (int)(1000000.0 / ((double)sps / (double)spp)); - nextTime = get_usec(); - - CmdWrite((char *)&nextTime, sizeof(int)); - - if (live_source) { - StartPlayLiveAudio(); - } - - for (;;) - { - struct fd_set read_mask, write_mask; - struct timeval tval; - unsigned curTime = get_usec(); - - if (hasdata) { - if (addSamples < - spp) { /* slow down by not sending packets */ - nextTime += upp; - addSamples += spp; - } - else { - int need_sleep = 0; - while (nextTime <= curTime && hasdata) { - if (need_sleep) usleep(5000); - hasdata = SendPacket(); - need_sleep = 1; - packets ++; - nextTime += upp; - if (addSamples > 0 && packets % SPEEDUP_SCALE == 0) { - addSamples -= spp; - usleep(5000); - hasdata = SendPacket(); - packets ++; - } - } - } - } - curTime = nextTime - curTime; - if (curTime > 5000000) curTime = 5000000; /* limit on 5 second weit time - in case error happens */ - tval.tv_sec = curTime / 1000000; - tval.tv_usec = curTime % 1000000; - FD_ZERO(&read_mask); - FD_SET(serviceSocket, &read_mask); - FD_SET(audioSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, hasdata ? &tval : NULL) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, hasdata ? &tval : NULL) == -1) -#endif - { - if (errno == EINTR) - continue; - perror("AS error on select reading or writing"); - return(-1); - } - if (FD_ISSET(serviceSocket, &read_mask)){ /* STOP, SPEED, or CLOSE*/ - unsigned char tmp; - result = CmdRead((char *)&tmp, 1); - if (result != 0) - return result; - switch (tmp) - { - case CmdSPEED: - { - SPEEDaudioPara para; - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.samplesPerSecond = ntohl(para.samplesPerSecond); - para.samplesPerPacket = ntohl(para.samplesPerPacket); - para.spslimit = ntohl(para.spslimit); -#endif - sps = para.samplesPerSecond; - spslimit = para.spslimit; - spp = para.samplesPerPacket; - if (spp * audioPara.bytesPerSample > databuf_size) { - spp = databuf_size / audioPara.bytesPerSample; - } - delta_sps = 0; /* reset compensation value */ - upp = (int)(1000000.0 / ((double)sps / (double)spp)); - /* - SFprintf(stderr, "AS got CmdSPEED: sps %d\n", sps); - */ - } - break; - case CmdSTOP: - { - int val; - cmd = tmp; - /* - fprintf(stderr, "AS: CmdSTOP. . .\n"); - */ - result = CmdRead((char *)&val, sizeof(int)); - if (result != 0) - return result; - /* - CmdWrite(AUDIO_STOP_PATTERN, strlen(AUDIO_STOP_PATTERN)); - */ - if (live_source) { - StopPlayLiveAudio(); - } - return 0; /* return from PLAYaudio() */ - } - case CmdCLOSE: - if (live_source) { - StopPlayLiveAudio(); - } - return(1); /* The whole AS session terminates */ - default: - if (live_source) { - StopPlayLiveAudio(); - } - fprintf(stderr, "AS error: cmd=%d while expects STOP/SPEED/CLOSE.\n", tmp); - return(-1); - } - } - - if (FD_ISSET(audioSocket, &read_mask)){ /* Feedback packet */ - int bytes, len; - for (;;) { - if (conn_tag >= 0) { - len = wait_read_bytes(audioSocket, (char *)fbpara, sizeof(*fbpara)); - if (len == 0) return(1); /* connection broken */ - else if (len < 0) { /* unexpected error */ - perror("AS read1 FB"); - return(-1); - } - } - else { /* discard mode packet stream, read the whole packet */ - len = read(audioSocket, (char *)fbpara, FBBUF_SIZE); - } - if (len == -1) { - if (errno == EINTR) continue; /* interrupt */ - else { - if (errno != EPIPE && errno != ECONNRESET) perror("AS failed to read() fbmsg header"); - break; - } - } - break; - } - if (len < sizeof(*fbpara)) { - if (len > 0) fprintf(stderr, - "AS warn read() len %dB < sizeof(*fbpara) %dB\n", - len, sizeof(*fbpara)); - continue; - } -#ifdef NeedByteOrderConversion - fbpara->type = ntohl(fbpara->type); -#endif - bytes = (fbpara->type > 0) ? - sizeof(APdescriptor) * (fbpara->type - 1) : - 0; - if (bytes > 0) { - if (conn_tag >= 0) { /* not discard mode packet stream, - read the rest of packet */ - len = wait_read_bytes(audioSocket, - ((char *)fbpara) + sizeof(*fbpara), - bytes); - if (len == 0) return(1); /* connection broken */ - else if (len < 0) { /* unexpected error */ - perror("AS read2 FB"); - return(-1); - } - len += sizeof(*fbpara); - } - } - bytes += sizeof(*fbpara); - if (len < bytes) { - if (len > 0) fprintf(stderr, - "AS only read partial FBpacket, %dB out of %dB.\n", - len, bytes); - continue; - } - if (live_source) { /* ignore all feedback messags for live source */ - continue; - } - -#ifdef NeedByteOrderConversion - fbpara->cmdsn = ntohl(fbpara->cmdsn); -#endif - if (len != sizeof(*fbpara) + - (fbpara->type ? (fbpara->type -1) * sizeof(APdescriptor) : 0)) { - /* unknown message, discard */ - SFprintf(stderr, "AS Unkown fb msg: len = %d, type = %d\n", - len, fbpara->type); - continue; - } - if (fbpara->cmdsn != cmdsn) { /* discard the outdated message */ - continue; - } -#ifdef NeedByteOrderConversion - { - int i, * ptr = (int *)fbpara + 2; - for (i = 0; i < (len >> 2) - 2; i++) *ptr = ntohl(*ptr); - } -#endif - if (fbpara->type == 0) { /* feedback message */ - /* - SFprintf(stderr, "AS got fbmsg: addsamples %d, addsps %d\n", - fbpara->data.fb.addSamples, fbpara->data.fb.addsps); - */ - addSamples += fbpara->data.fb.addSamples; - if (fbpara->data.fb.addsps) { - delta_sps += fbpara->data.fb.addsps; - upp = (int)(1000000.0 / ((double)(sps + delta_sps) / (double)spp)); - } - } - else { /* resend requests */ - APdescriptor * req = &(fbpara->data.ap); - int i; - /* - SFprintf(stderr, "AS got %d resend reqs\n", fbpara->type); - */ - for (i = 0; i < fbpara->type; i ++) { - ResendPacket(req->firstSample, req->samples); - req ++; - } - } - } - } -} - -static void on_exit_routine(void) -{ - struct sockaddr_in peeraddr_in; - int size = sizeof(peeraddr_in); - - /* - fprintf(stderr, "An AS session terminated\n"); - */ - if (getpeername(serviceSocket, - (struct sockaddr *)&peeraddr_in, &size) == 0 && - peeraddr_in.sin_family == AF_INET) { - if (strncmp(inet_ntoa(peeraddr_in.sin_addr), "129.95.50", 9)) { - struct hostent *hp; - time_t val = time(NULL); - char * buf = ctime(&start_time); - - hp = gethostbyaddr((char *)&(peeraddr_in.sin_addr), 4, AF_INET); - buf[strlen(buf)-1] = 0; - printf("%s: %s %3dm%02ds %dB %s\n", - buf, - hp == NULL ? inet_ntoa(peeraddr_in.sin_addr) : hp->h_name, - (val - start_time) / 60, (val - start_time) % 60, - bytes_sent, audioFile); - } - } - ComCloseConn(serviceSocket); - ComCloseConn(audioSocket); -} - -int AudioServer(int ctr_fd, int data_fd, int rttag, int max_pkt_size) -{ - int result; - - serviceSocket = ctr_fd; - audioSocket = data_fd; - conn_tag = max_pkt_size; - - if (max_pkt_size < 0) max_pkt_size = -max_pkt_size; - else if (max_pkt_size == 0) max_pkt_size = 1024 * 1024; - - start_time = time(NULL); - - atexit(on_exit_routine); - - result = INITaudio(); - - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) AudioServer: "), - result); - - fbpara = (AudioFeedBackPara *)malloc(FBBUF_SIZE); - if (fbpara == NULL) { - perror("AS failed to allocate mem for fbpara"); - return (-1); - } - - databuf_size = max_pkt_size - sizeof(*pktbuf); - if (databuf_size > DATABUF_SIZE) databuf_size = DATABUF_SIZE; - - pktbuf = (AudioPacket *)malloc(sizeof(*pktbuf) + databuf_size); - if (pktbuf == NULL) { - perror("AS failed to allocate mem for pktbuf"); - return(-1); - } - - for (;;) - { - /* - fprintf(stderr, "AS: waiting for a new command...\n"); - */ - result = CmdRead((char *)&cmd, 1); - if (result != 0) - return result; - switch (cmd) - { - case CmdPLAY: - result = PLAYaudio(); - if (result != 0) - return result; - break; - case CmdCLOSE: - /* - fprintf(stderr, "a session closed.\n"); - */ - return(0); - break; - default: - fprintf(stderr, "audio channel command %d not recoganizeable\n", cmd); - break; - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/las.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/las.cpp deleted file mode 100644 index 3460aa34a3c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/las.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#if 1 - -#include <stdio.h> -#include <errno.h> -#include <sys/types.h> -#include <unistd.h> -#include <time.h> -#include <signal.h> -#include <sys/time.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#include "include/common.h" -#include "server_proto.h" - -#ifdef LIVE_AUDIO - -#include <AF/AFlib.h> -#include <AF/AFUtils.h> - -static AFAudioConn *aud; -static AC ac; -static AFSetACAttributes attributes; -static int bps; -static int nextSample; -static audioActive = 0; - -/* - * Find a suitable default device - * Returns -1 if no suitable device can be found. - */ -static int FindDefaultDevice(AFAudioConn *aud) -{ - AFDeviceDescriptor *audioDevice; - int i; - for(i=0; i<ANumberOfAudioDevices(aud); i++) - { - audioDevice = AAudioDeviceDescriptor(aud, i); - if(audioDevice->inputsFromPhone == 0 && audioDevice->outputsToPhone == 0) - return i; - } - return -1; -} -#endif - - -int OpenLiveAudio(AudioParameter * ap) -{ -#ifndef LIVE_AUDIO - return -1; -#else - int device; - int gain; - unsigned int channels; - int endianflag = 0; - - if (!audioActive) return -1; - - device = -1; - attributes.rec_gain = 0; - attributes.type = UNKNOWN_ENCODETYPE; - - if ( (aud = AFOpenAudioConn(NULL)) == NULL) - { - fprintf(stderr, "SA error: fails to open default AF connection.\n"); - return -1; - } - - /* set up audio context, find sample size and sample rate - At this time, we only support default setings */ - device = FindDefaultDevice(aud); - attributes.type = aud->devices[device].playBufType; - ac = AFCreateAC(aud, device, - ACRecordGain | ACEncodingType | endianflag, - &attributes); - if (ac == NULL) - { - perror("AS error: failed to create ac"); - AFCloseAudioConn(aud); - return -1; - } - if (attributes.type == ap->encodeType) { - bps = ap->bytesPerSample; - return 0; - } - else { - fprintf(stderr, "AS error: encodeType %d, client encodeType %d\n", - attributes.type, ap->encodeType); - return -1; - } -#endif -} - -void StartPlayLiveAudio(void) -{ -#ifndef LIVE_AUDIO - return; -#else - nextSample = AFGetTime(ac); - SFprintf(stderr, "LAS nextSample %d\n", nextSample); - return; -#endif -} - -void StopPlayLiveAudio(void) -{ -#ifndef LIVE_AUDIO - return; -#else - return; -#endif -} - -int ReadLiveAudioSamples(char * buf, int samples) -{ -#ifndef LIVE_AUDIO - return 0; -#else - /* - SFprintf(stderr, "LAS to read %d bytes\n", samples * bps); - */ - AFRecordSamples(ac, nextSample, samples * bps, (unsigned char *)buf, ABlock); - nextSample += samples; - /* - SFprintf(stderr, "LAS read live %d samples\n", samples); - */ - return samples; -#endif -} - -#endif - -#if 0 - -/* Following is a version using /dev/audio directly, since /dev/audio can't be - shared by different sessions, at most one session can be served. */ - -#include <stdio.h> -#include <errno.h> -/* -#include <sys/types.h> -#include <sys/socket.h> -*/ -#include <fcntl.h> -#include <sys/types.h> -#include <sys/file.h> -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/filio.h> -#include <sys/stropts.h> - -#include <time.h> -#include <signal.h> -#include <sys/time.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -static int sunfd1; -static int bps; -static int nextSample; - - -int OpenLiveAudio(AudioParameter * ap) -{ - if (!audioActive) return -1; - - if ((sunfd1 = open("/dev/audio", O_RDONLY, 0)) < 0) { - fprintf(stderr, "dda can't open /dev/audio, errno message \" %d \"\n", - errno); - return -1; - } - bps = ap->bytesPerSample; - ioctl(sunfd1, I_FLUSH, FLUSHR); - return 0; -} - -void StartPlayLiveAudio(void) -{ - ioctl(sunfd1, I_FLUSH, FLUSHR); -} - -void StopPlayLiveAudio(void) -{ -} - -int ReadLiveAudioSamples(char * buf, int samples) -{ - int bytes = samples * bps; - int len = read(sunfd1, buf, bytes); - if (len != bytes) { - fprintf(stderr, "ReadLive: need %d samples (%dB), read %dB\n", - samples, bytes, len); - return len / bps; - } - return samples; -} - -#endif - -int InitLiveAudio(int argc, char ** argv) -{ -#ifndef LIVE_AUDIO - return -1; -#else - - audioActive = 1; - - fprintf(stderr, "LAS initialized.\n"); - return 0; -#endif -} - -void ExitLiveAudio(void) -{ - return; -} - -void LeaveLiveAudio(void) -{ - return; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/lvs.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/lvs.cpp deleted file mode 100644 index 96390dbc218..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/lvs.cpp +++ /dev/null @@ -1,410 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#include <stdio.h> -#include <errno.h> - -#include <sys/types.h> -#include <sys/socket.h> -#include <unistd.h> -#include <stdlib.h> - -#include <time.h> -#include <signal.h> -#include <sys/time.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Intrinsic.h> - -#include "include/common.h" -#include "mpeg_shared/routine.h" -#include "server_proto.h" - -#ifdef LIVE_VIDEO -#include "lvs_shared.h" - -LvsSharedData * shared = NULL; -static int lvspid = -1; /* -1: no lvs, 0 - lvs child, >0 - vs proc */ -static int prefid = -1, first_fid, first_frame; -static int curbuf; - -#define PID_FILE "~/.vcr/lvsPid" -#define QUALITY_FILE "~/.vcr/lvsQuality" - -static int count = 0; -static unsigned session_time; - -static int curpid = 0; - -static void on_exit_routine(void) -{ - char buf[256]; - if (getpid() != curpid) return; - get_full_path(PID_FILE, buf, 256); - unlink(buf); -} - -static void register_pid(void) -{ - char buf[256]; - FILE *fp; - get_full_path(PID_FILE, buf, 256); - fp = fopen(buf, "w"); - fprintf(fp, "%d -- pid of current VS process\n", getpid()); - fclose(fp); -} - -static void set_quality_level(void) -{ - char buf[256]; - FILE *fp; - int qos = -1; - get_full_path(QUALITY_FILE, buf, 256); - fp = fopen(buf, "r"); - if (fp == NULL) return; - - fscanf(fp, "%d", &qos); - fclose(fp); - if (qos >= 0 && qos <= 100) { - shared->qos_val = qos; - } -} - -static void hup_handler(int status) -{ - setsignal(SIGHUP, SIG_IGN); - if (getpid() != curpid) return; - set_quality_level(); - setsignal(SIGHUP, hup_handler); -} - -#endif - -int InitLiveVideo(int argc, char ** argv) /* -1 -- failed, 0 - succ */ -{ -#ifndef LIVE_VIDEO - return -1; -#else -/* -#define BUFSIZE 768 * 576 * 3 / 8 -#define BUFSIZE 640 * 480 * 3 / 2 -*/ -#define BUFSIZE 1024 * 1024 - - char * buf = creat_shared_mem(BUFSIZE); - int sid = creat_semaphore(); - int susid = creat_semaphore(); - - enter_cs(susid); - - shared = (LvsSharedData *)buf; - shared->sid = sid; - shared->susid = susid; - shared->initState = 0; - shared->bufDataBytes = BUFSIZE - sizeof(*shared); - shared->buf = (LvsBuffer *)((char *)shared + sizeof(*shared)); - - register_pid(); - set_quality_level(); - - /* all other fields to be initialized by LVS process */ - - while ((lvspid = fork()) == -1); - - if (lvspid == 0) { /* child process, reading from camera */ - LiveVideoProcess(argc, argv); - exit(1); - } - - while (shared->initState == 0) usleep(100000); /* wait for SunVideo to init */ - - if (shared->initState == -1) { - fprintf(stderr, "LVS error: init of child process failed\n"); - kill(lvspid, SIGINT); - remove_shared_mem(buf); - remove_semaphore(sid); - remove_semaphore(susid); - lvspid = -1; - return -1; - } - else { - - fprintf(stderr, "LVS initialized.\n"); - - curpid = getpid(); - - atexit(on_exit_routine); - - setsignal(SIGHUP, hup_handler); - - return 0; - } -#endif -} - -void LeaveLiveVideo(void) -{ -#ifndef LIVE_VIDEO - return; -#else - if (lvspid == -1) return; - remove_shared_mem((char *)shared); - shared = NULL; -#endif -} - -void ExitLiveVideo(void) -{ -#ifndef LIVE_VIDEO - return; -#else - if (lvspid == -1) return; - kill(lvspid, SIGINT); - remove_semaphore(shared->sid); - remove_semaphore(shared->susid); - remove_shared_mem((char *)shared); - lvspid = -1; - shared = NULL; -#endif -} - -int OpenLiveVideo(int * format, - int * width, int * height, - int * averageFrameSize, - double * fps, - int * pelAspectRatio /* MPEG1 encoding used here */ - ) /* -1 -- failed, 0 - succ */ -{ -#ifndef LIVE_VIDEO - return -1; -#else - if (lvspid == -1) return -1; - *format = shared->format; - *width = shared->width; - *height = shared->height; - *averageFrameSize = shared->averageFrameSize; - *fps = shared->fps; - *pelAspectRatio = shared->pelAspectRatio; - - fprintf(stderr, "LVS session %d opened.\n", getpid()); - - return 0; -#endif -} - -void StartPlayLiveVideo(void) -{ -#ifndef LIVE_VIDEO - return; -#else - if (lvspid == -1) return; - - count = 0; - session_time = get_msec(); - - enter_cs(shared->sid); - - prefid = -1; - first_fid = -1; - first_frame = -1; - - if (shared->activeSessions <= 0) shared->activeSessions = 1; - else shared->activeSessions ++; - - leave_cs(shared->sid); - - while (shared->curbuf <= shared->wait_curbuf) { - /* - fprintf(stderr, "curbuf %d, wait_curbuf %d\n", - shared->curbuf, shared->wait_curbuf); - */ - usleep(10000); - } - - fprintf(stderr, "LVS session %d started\n", getpid()); - - return; -#endif -} - -void StopPlayLiveVideo(void) -{ -#ifndef LIVE_VIDEO - return; -#else - if (lvspid == -1) return; - enter_cs(shared->sid); - shared->activeSessions --; - leave_cs(shared->sid); - - fprintf(stderr, "LVS session %d stopped, at %5.2f fps.\n", getpid(), - ((double)count * 1000.0) / get_duration(session_time, get_msec())); - - return; -#endif -} - -#if 1 -int ReadLiveVideoPicture(int * frame, char * buf, int size) /* ret # bytes */ -{ -#ifndef LIVE_VIDEO - return 0; -#else - int pframe = * frame; - int ssize; - int bufptr; - - if (lvspid == -1) return 0; - - if (first_frame == -1) { /* first frame in current session */ - curbuf = shared->curbuf - 1; - bufptr = curbuf % shared->bufnum; - enter_cs(shared->sid); - } - else { - int bufnum = shared->bufnum < 3 ? shared->bufnum : 3; - do { - curbuf ++; - if (curbuf <= shared->curbuf - bufnum) { - /* - fprintf(stderr, "LVS session %d skipped %d buffers\n", - getpid(), shared->curbuf - bufnum + 1 - curbuf); - */ - curbuf = shared->curbuf - bufnum + 1; - } - bufptr = curbuf % shared->bufnum; - while (shared->buf[bufptr].fid <= prefid) { - /* - fprintf(stderr, - "LVS session %d wait: curbuf %d, shared->curbuf %d, prefid %d, shared->fid %d\n", - getpid(), curbuf, shared->curbuf, prefid, shared->buf[bufptr].fid); - */ - enter_cs(shared->sid); - shared->suscount ++; - leave_cs(shared->sid); - enter_cs(shared->susid); - } - } while (pframe > first_frame + (shared->buf[bufptr].fid - first_fid)); - - enter_cs(shared->sid); - /* - fprintf(stderr, "pframe %d, aframe %d\n", - pframe, first_frame + (shared->buf[bufptr].fid - first_fid)); - */ - } - shared->buf[bufptr].refcnt ++; - leave_cs(shared->sid); - - ssize = shared->buf[bufptr].size; - - ssize = (ssize < size ? ssize : size); - memcpy(buf, shared->buf[bufptr].data, ssize); - - enter_cs(shared->sid); - - shared->buf[bufptr].refcnt --; - prefid = shared->buf[bufptr].fid; - if (first_frame == -1) { - first_fid = prefid; - first_frame = * frame; - } - else { - * frame = first_frame + (prefid - first_fid); - } - leave_cs(shared->sid); - /* - fprintf(stderr, - "LVS session %d read curbuf %d fid %d, frame %d size %d (ffid %d, fframe %d)\n", - getpid(), curbuf, prefid, *frame, ssize, first_fid, first_frame); - */ - /* - fprintf(stderr, "LVS read fid %d, frame %d\n", prefid, *frame); - */ - count ++; - return ssize; -#endif -} -#endif - -#if 0 -/* following version is for testing the speed of the vcr path, excluding the - xil stuff */ - -static long start_time; - -int ReadLiveVideoPicture(int * frame, char * buf, int size) /* ret # bytes */ -{ -#ifndef LIVE_VIDEO - return 0; -#else - int pframe = * frame; - int ssize; - char * sbuf; - if (lvspid == -1) return 0; - - loop_begin: - /* - enter_cs(shared->sid); - */ - if (first_frame == -1) { - first_frame = *frame; - first_fid = shared->fid; - start_time = get_msec(); - } - else { - int f = first_frame + ((double)get_duration(start_time, get_msec()) / - ((double)1000.0 / (double)shared->fps)); - if (f < *frame) { - - leave_cs(shared->sid); - /* - fprintf(stderr, "f=%d < *frame=%d\n", f, *frame); - */ - usleep(10000); - goto loop_begin; - } - *frame = f; - } - - prefid = shared->fid; - sbuf = shared->buf[shared->curbuf].data; - ssize = shared->buf[shared->curbuf].size; - - ssize = (ssize < size ? ssize : size); - memcpy(buf, sbuf, ssize); - /* - leave_cs(shared->sid); - */ - /* - fprintf(stderr, "LVS read fid %d, frame %d size %d (ffid %d, fframe %d)\n", - shared->fid, *frame, ssize, first_fid, first_frame); - */ - count ++; - return ssize; -#endif -} -#endif - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h deleted file mode 100644 index 12aab8421c5..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -#include "Globals.h" - -/* las.c */ -int InitLiveAudio(int argc, char ** argv); /* -1 -- failed, 0 - succ */ -void LeaveLiveAudio(void); - /* each child forked not doing live audio should call this */ -void ExitLiveAudio(void); -int OpenLiveAudio(AudioParameter * ap); /* -1 -- failed, 0 - succ */ -void StartPlayLiveAudio(void); -void StopPlayLiveAudio(void); -int ReadLiveAudioSamples(char * buf, int samples); /* ret # samples */ - -/* lvs.c */ - -int InitLiveVideo(int argc, char ** argv); /* -1 -- failed, 0 - succ */ -void LeaveLiveVideo(void); - /* each child forked not doing live video should call this */ -void ExitLiveVideo(void); -int OpenLiveVideo(int * format, - int * width, int * height, - int * averageFrameSize, - double * fps, - int * pelAspactRatio /* MPEG1 encoding used here */ - ); /* -1 -- failed, 0 - succ */ -void StartPlayLiveVideo(void); -void StopPlayLiveVideo(void); -int ReadLiveVideoPicture(int * frame, char * buf, int size); /* ret # bytes */ - -/*from camera driver definitions */ - -int LiveVideoProcess(int argc, char ** argv); - -/* as.c */ -int AudioServer(int ctr_fd, int data_fd, int rttag, int max_pkt_size); - -/* vs.c */ -int VideoServer(int ctr_fd, int data_fd, int rttag, int max_pkt_size); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/vs.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/vs.cpp deleted file mode 100644 index 69ae6898adb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/vs.cpp +++ /dev/null @@ -1,2205 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> -#include <netdb.h> -#include <string.h> -#include <stdlib.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <time.h> -#include <sys/time.h> -#include <stdio.h> -#include <errno.h> -#include <signal.h> - -#include "include/common.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/com.h" -#include "mpeg_shared/sendpt.h" -#include "server_proto.h" - - -// %% Move all these functions to the VIDEO_SINGLETON class and remove -// zombie code like VideoServer ()... -static int CmdRead(char *buf, int psize) -{ - int res = wait_read_bytes (VIDEO_SINGLETON::instance ()->serviceSocket, - buf, - psize); - if (res == 0) return(1); - if (res == -1) { - fprintf(stderr, "VS error on read VIDEO_SINGLETON::instance ()->cmdSocket, size %d", psize); - perror(""); - return(-1); - } - return 0; -} - -static void CmdWrite(char *buf, int size) -{ - int res = wait_write_bytes(VIDEO_SINGLETON::instance ()->serviceSocket, buf, size); - if (res == -1) { - if (errno != EPIPE) perror("VS writes to VIDEO_SINGLETON::instance ()->serviceSocket"); - exit(errno != EPIPE); - } -} - -int FBread(char * buf, int size) -{ int res; - while ((res = (VIDEO_SINGLETON::instance ()->conn_tag >= 0 ? wait_read_bytes(VIDEO_SINGLETON::instance ()->videoSocket, buf, size) : - read(VIDEO_SINGLETON::instance ()->videoSocket, buf, size))) == -1) - { - if (errno == EINTR) {errno = 0; continue; } - if (errno == EPIPE || errno == ECONNRESET) exit(0); - perror("VS reads Feedback VIDEO_SINGLETON::instance ()->packet"); - return -1; - } - if (res < size) { - if (res) fprintf(stderr, "VS warn: FBread() res %dB < size %dB\n", res, size); - return -1; - } - return 0; -} - - -/* send a given VIDEO_SINGLETON::instance ()->packet pointed by 'VIDEO_SINGLETON::instance ()->packet' to the network */ - -int send_to_network(int timeToUse) -{ - int count = 0; - VideoMessage * msghd = (VideoMessage *)(((char *)VIDEO_SINGLETON::instance ()->packet) - sizeof(VideoMessage)); - int sent = 0; - int packetSize = ntohl(VIDEO_SINGLETON::instance ()->packet->dataBytes); - - msghd->packetsn = htonl(VIDEO_SINGLETON::instance ()->packetsn ++); - msghd->packetSize = htonl(packetSize + sizeof(* VIDEO_SINGLETON::instance ()->packet)); - /* - fprintf(stderr, "VS to send pkt %d of size %d.\n", - ntohl(msghd->VIDEO_SINGLETON::instance ()->packetsn), ntohl(msghd->VIDEO_SINGLETON::instance ()->packetSize)); - */ - { - VideoMessage * msg = NULL; - int size = packetSize + sizeof(* VIDEO_SINGLETON::instance ()->packet); /* msghd->VIDEO_SINGLETON::instance ()->packetSize */ - int offset = 0; - int targetTime; - - if (size > VIDEO_SINGLETON::instance ()->msgsize) - { - - if (!timeToUse) - { - timeToUse = (VIDEO_SINGLETON::instance ()->msgsize + sizeof(*msg) + 28) * 2; - /* - set the max network as 500KB. - 28 - UDP header size - */ - /* - fprintf(stderr, "computed timeToUse %d. ", timeToUse); - */ - } - else - { - timeToUse = (timeToUse * 7) >> 3; - /* - fprintf(stderr, "preset timeToUse %d.", timeToUse); - */ - timeToUse /= (size + VIDEO_SINGLETON::instance ()->msgsize - 1) / VIDEO_SINGLETON::instance ()->msgsize; - timeToUse = min(timeToUse, (VIDEO_SINGLETON::instance ()->msgsize + sizeof(*msg) + 28) * 100); - /* limit min network bandwidth = 10K */ - } - - } - while (size > 0) - { - int segsize, sentsize; - int resent = 0; - - if (msg == NULL) { /* first message for current VIDEO_SINGLETON::instance ()->packet */ - count = 0; - msg = msghd; - targetTime = get_usec(); - } - else { -#if 0 - /* the select() is not precise enough for being used here*/ - int sleepTime; - targetTime += timeToUse; - sleepTime = get_duration(get_usec(), targetTime); - if (sleepTime >= 5000) { /* resolution of timer is 10,000 usec */ - usleep(sleepTime); /* not first message, wait for a while */ - } -#endif - /* - count ++; - if (!(count % 10)) usleep(10000); - */ - msg = (VideoMessage *)((char *)msg + VIDEO_SINGLETON::instance ()->msgsize); - memcpy((char *)msg, (char *)msghd, sizeof(* msg)); - } - msg->msgsn = htonl(VIDEO_SINGLETON::instance ()->msgsn++); - msg->msgOffset = htonl(offset); - msg->msgSize = htonl(min(size, VIDEO_SINGLETON::instance ()->msgsize)); - - segsize = min(size, VIDEO_SINGLETON::instance ()->msgsize)+sizeof(*msg); - if (VIDEO_SINGLETON::instance ()->conn_tag != 0) { /* VIDEO_SINGLETON::instance ()->packet stream */ - while ((sentsize = write(VIDEO_SINGLETON::instance ()->videoSocket, (char *)msg, segsize)) == -1) { - if (errno == EINTR) - continue; - if (errno == ENOBUFS) { - if (resent) { - perror("Warning, pkt discarded because"); - sent = -1; - break; - } - else { - resent = 1; - perror("VS to sleep 5ms"); - usleep(5000); - continue; - } - } - if (errno != EPIPE) { - fprintf(stderr, "VS error on send VIDEO_SINGLETON::instance ()->packet %d of size %d ", - VIDEO_SINGLETON::instance ()->msgsn-1, min(size, VIDEO_SINGLETON::instance ()->msgsize)+sizeof(*msg)); - perror(""); - } - exit(errno != EPIPE); - } - } - else { - sentsize = wait_write_bytes(VIDEO_SINGLETON::instance ()->videoSocket, (char *)msg, segsize); - if (sentsize == -1) { - if (errno != EPIPE) { - fprintf(stderr, "VS error on send VIDEO_SINGLETON::instance ()->packet %d of size %d ", - VIDEO_SINGLETON::instance ()->msgsn-1, min(size, VIDEO_SINGLETON::instance ()->msgsize)+sizeof(*msg)); - perror(""); - } - exit(errno != EPIPE); - } - } - if (sentsize < segsize) { - SFprintf(stderr, "VS warning: message size %dB, sent only %dB\n", - segsize, sentsize); - } - if (sent == -1) - break; - /* - fprintf(stderr, "VS: message %d of size %d sent.\n", - VIDEO_SINGLETON::instance ()->msgsn-1, min(size, VIDEO_SINGLETON::instance ()->msgsize)+sizeof(*msg)); - */ - size -= VIDEO_SINGLETON::instance ()->msgsize; - offset += VIDEO_SINGLETON::instance ()->msgsize; - } - } - /* - fprintf(stderr, "sent = %d\n", sent); - */ - if (!sent) VIDEO_SINGLETON::instance ()->pkts_sent ++; - return sent; -} - -/* - * send a VIDEO_SINGLETON::instance ()->packet with given VIDEO_SINGLETON::instance ()->systemHeader (optional), gop (optional) and frame. - * - * sh - system header id, if -1, then no system header will be sent. - * otherwise, only when frame == 0, the given system header will be sent. - * gop - group of pictures, gop header will be sent when frame == 0 - * (first I frame ); - * frame - frame to be sent, offset internal to given gop. - */ - -/* returns: 0 - VIDEO_SINGLETON::instance ()->packet sent, -1 - VIDEO_SINGLETON::instance ()->packet not sent (failed) */ -static int SendPacket(int shtag, int gop, int frame, int timeToUse) -/* frame maybe out of range (PLAY, STEP), in this case, END_SEQ is sent - to force display of last frame in VD */ -{ - char * buf = ((char *) VIDEO_SINGLETON::instance ()->packet) + sizeof(VideoPacket); - int f = VIDEO_SINGLETON::instance ()->gopTable[gop].previousFrames + frame; - int sh = VIDEO_SINGLETON::instance ()->gopTable[gop].systemHeader; - /* - SFprintf(stderr, "VS to send VIDEO_SINGLETON::instance ()->packet gop-%d, frame-%d.\n", gop, frame); - */ - - VIDEO_SINGLETON::instance ()->packet->currentUPF = ntohl(VIDEO_SINGLETON::instance ()->currentUPF); - - if (frame >= VIDEO_SINGLETON::instance ()->gopTable[gop].totalFrames) - { - VIDEO_SINGLETON::instance ()->packet->cmd = htonl(VIDEO_SINGLETON::instance ()->cmd); - VIDEO_SINGLETON::instance ()->packet->cmdsn = htonl(VIDEO_SINGLETON::instance ()->cmdsn); - VIDEO_SINGLETON::instance ()->packet->sh = htonl(sh); - VIDEO_SINGLETON::instance ()->packet->gop = htonl(gop); - VIDEO_SINGLETON::instance ()->packet->frame = htonl(VIDEO_SINGLETON::instance ()->numF); - VIDEO_SINGLETON::instance ()->packet->display = htonl(VIDEO_SINGLETON::instance ()->numF-1); - VIDEO_SINGLETON::instance ()->packet->future = htonl((unsigned)-1); - VIDEO_SINGLETON::instance ()->packet->past = htonl((unsigned)-1); - VIDEO_SINGLETON::instance ()->packet->dataBytes = htonl(4); - *(int*)((char*)VIDEO_SINGLETON::instance ()->packet + sizeof(*VIDEO_SINGLETON::instance ()->packet)) = htonl(SEQ_END_CODE); - - return send_to_network(timeToUse); - } - - if (frame) - shtag = 0; - else if (VIDEO_SINGLETON::instance ()->needHeader) - { - shtag = 1; - VIDEO_SINGLETON::instance ()->needHeader = 0; - } - - VIDEO_SINGLETON::instance ()->packet->cmd = htonl(VIDEO_SINGLETON::instance ()->cmd); - VIDEO_SINGLETON::instance ()->packet->cmdsn = htonl(VIDEO_SINGLETON::instance ()->cmdsn); - VIDEO_SINGLETON::instance ()->packet->sh = htonl(sh); - VIDEO_SINGLETON::instance ()->packet->gop = htonl(gop); - VIDEO_SINGLETON::instance ()->packet->frame = htonl(f); - if (VIDEO_SINGLETON::instance ()->frameTable[f].type == 'B') - { - int pre1 = -1, pre2 = -1, i = f; - while (i>0) - if (VIDEO_SINGLETON::instance ()->frameTable[--i].type != 'B') - { - pre1 = i; - break; - } - while (i>0) - if (VIDEO_SINGLETON::instance ()->frameTable[--i].type != 'B') - { - pre2 = i; - break; - } - if (pre2 == -1) - { - /* - fprintf(stderr, - "frame %d-%d (%d) is a B without past ref, no to be sent.\n", - gop, frame, f); - */ - return -1; - } - if (pre1 != VIDEO_SINGLETON::instance ()->lastRef[VIDEO_SINGLETON::instance ()->lastRefPtr] || - pre2 != VIDEO_SINGLETON::instance ()->lastRef[1 - VIDEO_SINGLETON::instance ()->lastRefPtr]) - { - /* - fprintf(stderr, - "send of B frame %d gaveup for past %d/future %d ref not sent.\n", - f, pre2, pre1); - */ - return -1; - } - VIDEO_SINGLETON::instance ()->packet->display = htonl(f); - VIDEO_SINGLETON::instance ()->packet->future = htonl(pre1); - VIDEO_SINGLETON::instance ()->packet->past = htonl(pre2); - } - else - { - int next = f; - int pre = f; - - while (next < VIDEO_SINGLETON::instance ()->numF && VIDEO_SINGLETON::instance ()->frameTable[++next].type == 'B'); - while (pre > 0 && VIDEO_SINGLETON::instance ()->frameTable[--pre].type == 'B'); - if (VIDEO_SINGLETON::instance ()->frameTable[f].type == 'P' && pre != VIDEO_SINGLETON::instance ()->lastRef[VIDEO_SINGLETON::instance ()->lastRefPtr]) - { - /* - fprintf(stderr, - "send of P frame %d gaveup for past ref %d not sent.\n", - f, pre); - fprintf(stderr, "ref0=%d, ref1=%d, ptr=%d.\n", - VIDEO_SINGLETON::instance ()->lastRef[0], VIDEO_SINGLETON::instance ()->lastRef[1], VIDEO_SINGLETON::instance ()->lastRefPtr); - */ - return -1; - } - VIDEO_SINGLETON::instance ()->packet->display = htonl(next); - VIDEO_SINGLETON::instance ()->packet->future = htonl((unsigned)-1); - VIDEO_SINGLETON::instance ()->packet->past = htonl(VIDEO_SINGLETON::instance ()->frameTable[f].type == 'P' ? pre : (unsigned)-1); - } - { - char * ptr = buf; - int size = 0, offset = 0, i; - if (shtag) /* send system header */ - { - size = VIDEO_SINGLETON::instance ()->systemHeader[sh].size; - FileRead(VIDEO_SINGLETON::instance ()->systemHeader[sh].offset, ptr, size); - ptr += size; - } - if (!frame) /* send gop header */ - { - size = VIDEO_SINGLETON::instance ()->gopTable[gop].headerSize; - FileRead(VIDEO_SINGLETON::instance ()->gopTable[gop].offset, ptr, size); - ptr += size; - } - size = VIDEO_SINGLETON::instance ()->frameTable[f].size; - for (i=VIDEO_SINGLETON::instance ()->gopTable[gop].previousFrames; i<f; i++) - offset += VIDEO_SINGLETON::instance ()->frameTable[i].size; - FileRead((VIDEO_SINGLETON::instance ()->gopTable[gop].firstIoffset + offset), ptr, size); - ptr += size; - VIDEO_SINGLETON::instance ()->packet->dataBytes = htonl(ptr - buf); - } - - { - int sent = send_to_network(timeToUse); - if (!sent) - { - /* - fprintf(stderr, "%c%d\n", VIDEO_SINGLETON::instance ()->frameTable[f].type, f); - fprintf(stderr, "%c frame %d sent.\n", VIDEO_SINGLETON::instance ()->frameTable[f].type, f); - */ - if (VIDEO_SINGLETON::instance ()->frameTable[f].type != 'B') - { - VIDEO_SINGLETON::instance ()->lastRefPtr = 1 - VIDEO_SINGLETON::instance ()->lastRefPtr; - VIDEO_SINGLETON::instance ()->lastRef[VIDEO_SINGLETON::instance ()->lastRefPtr] = f; - } - } - return sent; - } -} - - -int SendReferences(int group, int frame) -{ - unsigned char orgcmd; - int i, base; - int pregroup; - int result; - - if (group < 0 || group >= VIDEO_SINGLETON::instance ()->numG) return 0; - if (frame <= 0 || frame >= VIDEO_SINGLETON::instance ()->gopTable[group].totalFrames) return 0; - - orgcmd = VIDEO_SINGLETON::instance ()->cmd; - VIDEO_SINGLETON::instance ()->cmd = CmdREF; - - if (group > 0) { - pregroup = 1; - base = VIDEO_SINGLETON::instance ()->gopTable[group].previousFrames; - for (i = 0; i <= frame; i ++) { - if (VIDEO_SINGLETON::instance ()->frameTable[i + base].type == 'P') { - pregroup = 0; - break; - } - } - } - else pregroup = 0; - - if (pregroup) { /* reference frame can be in previous group */ - pregroup = group -1; - base = VIDEO_SINGLETON::instance ()->gopTable[pregroup].previousFrames; - for (i = 0; i < VIDEO_SINGLETON::instance ()->gopTable[pregroup].totalFrames; i ++) { - if (VIDEO_SINGLETON::instance ()->frameTable[i + base].type != 'B') { - /* - SFprintf(stderr, "REF group%d, frame%d\n", pregroup, i); - */ - result = SendPacket(i == 0, pregroup, i, 0); - if (result != 0) - return result; - } - } - } - - base = VIDEO_SINGLETON::instance ()->gopTable[group].previousFrames; - for (i = 0; i < frame; i ++) { - if (VIDEO_SINGLETON::instance ()->frameTable[i + base].type != 'B') { - /* - SFprintf(stderr, "REF group%d, frame%d\n", group, i); - */ - SendPacket(i == 0, group, i, 0); - } - } - VIDEO_SINGLETON::instance ()->cmd = orgcmd; -} - -int SendPicture(int * frame) -{ - int size; - char * buf = ((char *) VIDEO_SINGLETON::instance ()->packet) + sizeof(VideoPacket); - /* - SFprintf(stderr, "VS to send picture %d.\n", *frame); - */ - - size = ReadLiveVideoPicture(frame, buf, VIDEO_SINGLETON::instance ()->packetBufSize); - - VIDEO_SINGLETON::instance ()->packet->currentUPF = ntohl(VIDEO_SINGLETON::instance ()->currentUPF); - VIDEO_SINGLETON::instance ()->packet->cmd = htonl(VIDEO_SINGLETON::instance ()->cmd); - VIDEO_SINGLETON::instance ()->packet->cmdsn = htonl(VIDEO_SINGLETON::instance ()->cmdsn); - VIDEO_SINGLETON::instance ()->packet->sh = VIDEO_SINGLETON::instance ()->packet->gop = VIDEO_SINGLETON::instance ()->packet->frame = VIDEO_SINGLETON::instance ()->packet->display = htonl(*frame); - VIDEO_SINGLETON::instance ()->packet->future = htonl((unsigned)-1); - VIDEO_SINGLETON::instance ()->packet->past = htonl((unsigned)-1); - - VIDEO_SINGLETON::instance ()->packet->dataBytes = htonl(size); - - return send_to_network(VIDEO_SINGLETON::instance ()->currentUPF); -} - -static int ReadInfoFromFile(void) -{ - int fd = -1, i; - int fnlen = strlen(VIDEO_SINGLETON::instance ()->videoFile); - - strcpy(&VIDEO_SINGLETON::instance ()->videoFile[fnlen], ".Info"); - fd = open(VIDEO_SINGLETON::instance ()->videoFile, O_RDONLY); - if (fd == -1) - { - fprintf(stderr, "Reminder: VS fails to open %s for read, ", VIDEO_SINGLETON::instance ()->videoFile); - perror("try create one"); - goto fail_ReadInfoFromFile; - } - read_int(fd, &i); - if (i != VIDEO_SINGLETON::instance ()->fileSize) - { - fprintf(stderr, "Warning: VIDEO_SINGLETON::instance ()->fileSize in Info: %d not the same as actual %d.\n", - i, VIDEO_SINGLETON::instance ()->fileSize); - goto fail_ReadInfoFromFile; - } - - read_int(fd, &VIDEO_SINGLETON::instance ()->maxS); - read_int(fd, &VIDEO_SINGLETON::instance ()->maxG); - read_int(fd, &VIDEO_SINGLETON::instance ()->maxI); - read_int(fd, &VIDEO_SINGLETON::instance ()->maxP); - read_int(fd, &VIDEO_SINGLETON::instance ()->maxB); - read_int(fd, &VIDEO_SINGLETON::instance ()->minS); - read_int(fd, &VIDEO_SINGLETON::instance ()->minG); - read_int(fd, &VIDEO_SINGLETON::instance ()->minI); - read_int(fd, &VIDEO_SINGLETON::instance ()->minP); - read_int(fd, &VIDEO_SINGLETON::instance ()->minB); - read_int(fd, &VIDEO_SINGLETON::instance ()->numS); - read_int(fd, &VIDEO_SINGLETON::instance ()->numG); - read_int(fd, &VIDEO_SINGLETON::instance ()->numF); - read_int(fd, &VIDEO_SINGLETON::instance ()->numI); - read_int(fd, &VIDEO_SINGLETON::instance ()->numP); - read_int(fd, &VIDEO_SINGLETON::instance ()->numB); - read_int(fd, &VIDEO_SINGLETON::instance ()->averageFrameSize); - read_int(fd, &VIDEO_SINGLETON::instance ()->horizontalSize); - read_int(fd, &VIDEO_SINGLETON::instance ()->verticalSize); - read_int(fd, &VIDEO_SINGLETON::instance ()->pelAspectRatio); - read_int(fd, &VIDEO_SINGLETON::instance ()->pictureRate); - read_int(fd, &VIDEO_SINGLETON::instance ()->vbvBufferSize); - read_int(fd, &VIDEO_SINGLETON::instance ()->patternSize); - - memset(VIDEO_SINGLETON::instance ()->pattern, 0, PATTERN_SIZE); - read_bytes(fd, VIDEO_SINGLETON::instance ()->pattern, VIDEO_SINGLETON::instance ()->patternSize); -#ifdef STAT - VIDEO_SINGLETON::instance ()->framesSent = (char *)malloc((VIDEO_SINGLETON::instance ()->numF + 7)>>3); - if (VIDEO_SINGLETON::instance ()->framesSent == NULL) - { - fprintf(stderr, "Error: VS fails to alloc mem for VIDEO_SINGLETON::instance ()->framesSent for %d frames", VIDEO_SINGLETON::instance ()->numF); - perror(""); - exit(1); - } -#endif - VIDEO_SINGLETON::instance ()->systemHeader = (struct Video_Global::SystemHeader *)malloc(sizeof(struct Video_Global::SystemHeader) * VIDEO_SINGLETON::instance ()->numS); - if (VIDEO_SINGLETON::instance ()->systemHeader == NULL) - { - perror("Error: VS error on malloc VIDEO_SINGLETON::instance ()->SystemHeader"); - exit(1); - } - VIDEO_SINGLETON::instance ()->gopTable = (struct Video_Global::GopTable *)malloc(sizeof(struct Video_Global::GopTable) * VIDEO_SINGLETON::instance ()->numG); - if (VIDEO_SINGLETON::instance ()->gopTable == NULL) - { - perror("Error: VS error on malloc GopHeader"); - exit(1); - } - VIDEO_SINGLETON::instance ()->frameTable = (struct Video_Global::FrameTable *)malloc(sizeof(Video_Global::FrameTable) * VIDEO_SINGLETON::instance ()->numF); - if (VIDEO_SINGLETON::instance ()->frameTable == NULL) - { - perror("Error: VS error on malloc VIDEO_SINGLETON::instance ()->frameTable"); - exit(1); - } - VIDEO_SINGLETON::instance ()->packetBufSize = VIDEO_SINGLETON::instance ()->maxS + VIDEO_SINGLETON::instance ()->maxG + max(VIDEO_SINGLETON::instance ()->maxI, max(VIDEO_SINGLETON::instance ()->maxP, VIDEO_SINGLETON::instance ()->maxB)); - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)malloc(sizeof(VideoMessage) + sizeof(VideoPacket) + - VIDEO_SINGLETON::instance ()->packetBufSize); - if (VIDEO_SINGLETON::instance ()->packet == NULL) - { - perror("Error: VS error on malloc VIDEO_SINGLETON::instance ()->packet buffer"); - exit(1); - } - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)((char *)VIDEO_SINGLETON::instance ()->packet + sizeof(VideoMessage)); - - for (i = 0; i < VIDEO_SINGLETON::instance ()->numS; i ++) - { - read_int(fd, (int *)&VIDEO_SINGLETON::instance ()->systemHeader[i].offset); - read_int(fd, &VIDEO_SINGLETON::instance ()->systemHeader[i].size); - } - for (i = 0; i < VIDEO_SINGLETON::instance ()->numG; i ++) - { - read_int(fd, &VIDEO_SINGLETON::instance ()->gopTable[i].systemHeader); - read_int(fd, (int *)&VIDEO_SINGLETON::instance ()->gopTable[i].offset); - read_int(fd, &VIDEO_SINGLETON::instance ()->gopTable[i].headerSize); - read_int(fd, &VIDEO_SINGLETON::instance ()->gopTable[i].size); - read_int(fd, &VIDEO_SINGLETON::instance ()->gopTable[i].totalFrames); - read_int(fd, &VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames); - read_int(fd, (int *)&VIDEO_SINGLETON::instance ()->gopTable[i].firstIoffset); - } - for (i = 0; i < VIDEO_SINGLETON::instance ()->numF; i ++) - { - read_byte(fd, &VIDEO_SINGLETON::instance ()->frameTable[i].type); - read_short(fd, (short *)&VIDEO_SINGLETON::instance ()->frameTable[i].size); - } - - close(fd); - /* - fprintf(stderr, "Read Info from %s\n", VIDEO_SINGLETON::instance ()->videoFile); - */ - VIDEO_SINGLETON::instance ()->videoFile[fnlen] = 0; - return 0; - fail_ReadInfoFromFile: - if (fd >= 0) - close(fd); - VIDEO_SINGLETON::instance ()->videoFile[fnlen] = 0; - /* - fprintf(stderr, "To scan Info from %s\n", VIDEO_SINGLETON::instance ()->videoFile); - */ - return -1; -} - -static void WriteInfoToFile(void) -{ - int fd = -1, i; - int fnlen = strlen(VIDEO_SINGLETON::instance ()->videoFile); - - strcpy(&VIDEO_SINGLETON::instance ()->videoFile[fnlen], ".Info"); - fd = open(VIDEO_SINGLETON::instance ()->videoFile, O_WRONLY | O_CREAT, 0444); - if (fd == -1) - { - fprintf(stderr, "VS fails to open %s for write", VIDEO_SINGLETON::instance ()->videoFile); - perror(""); - goto fail_WriteInfoToFile; - } - write_int(fd, VIDEO_SINGLETON::instance ()->fileSize); - write_int(fd, VIDEO_SINGLETON::instance ()->maxS); - write_int(fd, VIDEO_SINGLETON::instance ()->maxG); - write_int(fd, VIDEO_SINGLETON::instance ()->maxI); - write_int(fd, VIDEO_SINGLETON::instance ()->maxP); - write_int(fd, VIDEO_SINGLETON::instance ()->maxB); - write_int(fd, VIDEO_SINGLETON::instance ()->minS); - write_int(fd, VIDEO_SINGLETON::instance ()->minG); - write_int(fd, VIDEO_SINGLETON::instance ()->minI); - write_int(fd, VIDEO_SINGLETON::instance ()->minP); - write_int(fd, VIDEO_SINGLETON::instance ()->minB); - write_int(fd, VIDEO_SINGLETON::instance ()->numS); - write_int(fd, VIDEO_SINGLETON::instance ()->numG); - write_int(fd, VIDEO_SINGLETON::instance ()->numF); - write_int(fd, VIDEO_SINGLETON::instance ()->numI); - write_int(fd, VIDEO_SINGLETON::instance ()->numP); - write_int(fd, VIDEO_SINGLETON::instance ()->numB); - write_int(fd, VIDEO_SINGLETON::instance ()->averageFrameSize); - write_int(fd, VIDEO_SINGLETON::instance ()->horizontalSize); - write_int(fd, VIDEO_SINGLETON::instance ()->verticalSize); - write_int(fd, VIDEO_SINGLETON::instance ()->pelAspectRatio); - write_int(fd, VIDEO_SINGLETON::instance ()->pictureRate); - write_int(fd, VIDEO_SINGLETON::instance ()->vbvBufferSize); - write_int(fd, VIDEO_SINGLETON::instance ()->patternSize); - - write_bytes(fd, VIDEO_SINGLETON::instance ()->pattern, VIDEO_SINGLETON::instance ()->patternSize); - - for (i = 0; i < VIDEO_SINGLETON::instance ()->numS; i ++) - { - write_int(fd, VIDEO_SINGLETON::instance ()->systemHeader[i].offset); - write_int(fd, VIDEO_SINGLETON::instance ()->systemHeader[i].size); - } - for (i = 0; i < VIDEO_SINGLETON::instance ()->numG; i ++) - { - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].systemHeader); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].offset); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].headerSize); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].size); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].totalFrames); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames); - write_int(fd, VIDEO_SINGLETON::instance ()->gopTable[i].firstIoffset); - } - for (i = 0; i < VIDEO_SINGLETON::instance ()->numF; i ++) - { - write_byte(fd, VIDEO_SINGLETON::instance ()->frameTable[i].type); - write_short(fd, VIDEO_SINGLETON::instance ()->frameTable[i].size); - } - - close(fd); - VIDEO_SINGLETON::instance ()->videoFile[fnlen] = 0; - return; - fail_WriteInfoToFile: - if (fd >= 0) - close(fd); - VIDEO_SINGLETON::instance ()->videoFile[fnlen] = 0; - return; -} - -/* -#define nextByte {fileptr ++; \ - if (fread(&nb, 1, 1, fp) == 0) \ - { \ - perror("VS Crossed EOF or error while scanning"); \ - return 1; \ - } } - -*/ - -#define nextByte {int val; fileptr ++; \ - if ((val = getc(VIDEO_SINGLETON::instance ()->fp)) == EOF) \ - {\ - perror("Crossed EOF or error while scanning"); \ - return 1; \ - } nb = val;} - -#define computePicSize \ - if (inpic) \ - { \ - if (pictype == 'I') \ - { \ - VIDEO_SINGLETON::instance ()->maxI = max(VIDEO_SINGLETON::instance ()->maxI, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minI = min(VIDEO_SINGLETON::instance ()->minI, (int)(fileptr - picptr - 4)); \ - } \ - else if (pictype == 'P') \ - { \ - VIDEO_SINGLETON::instance ()->maxP = max(VIDEO_SINGLETON::instance ()->maxP, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minP = min(VIDEO_SINGLETON::instance ()->minP, (int)(fileptr - picptr - 4)); \ - } \ - else \ - { \ - VIDEO_SINGLETON::instance ()->maxB = max(VIDEO_SINGLETON::instance ()->maxB, (int)(fileptr - picptr - 4)); \ - VIDEO_SINGLETON::instance ()->minB = min(VIDEO_SINGLETON::instance ()->minB, (int)(fileptr - picptr - 4)); \ - } \ - VIDEO_SINGLETON::instance ()->frameTable[ftptr].type = pictype; \ - VIDEO_SINGLETON::instance ()->frameTable[ftptr++].size = (int)(fileptr - picptr - 4); \ - inpic = 0; \ - } - -static int init_MPEG1_video_file(void) -{ - unsigned char nb; - int state = 0; - unsigned long fileptr = 0; - unsigned long i, j, k; - int shptr, gopptr, ftptr; - int inpic = 0; - unsigned long picptr = 0; - int pictype = 0; - int first = 0; - int failureType = 0; - - VIDEO_SINGLETON::instance ()->fp = fopen(VIDEO_SINGLETON::instance ()->videoFile, "r"); - if (VIDEO_SINGLETON::instance ()->fp == NULL) - { - fprintf(stderr, "error on opening video file %s", VIDEO_SINGLETON::instance ()->videoFile); - perror(""); - return 2; - } - if (fseek(VIDEO_SINGLETON::instance ()->fp, 0, 2) == -1) - { - fprintf(stderr, "File %s not seekable", VIDEO_SINGLETON::instance ()->videoFile); - perror(""); - return 3; - } - VIDEO_SINGLETON::instance ()->fileSize = ftell(VIDEO_SINGLETON::instance ()->fp); - - fseek(VIDEO_SINGLETON::instance ()->fp, 0, 0); - - if (ReadInfoFromFile()) - { - for (;;) - { - nextByte; - if (state >= 0 && nb == 0x00) - state ++; - else if (state >= 2 && nb == 0x01) - state = -1; - else if (state == -1) - { - if (!first) first ++; - else if (first == 1) first ++; - - switch (nb) - { - case 0xb7: /* seq_end_code */ - goto exit_phase1; - break; - case 0xb3: /* seq_start_code */ - if (first == 1) first = 3; - if (first != 3) - { - fprintf(stderr, "VS error: given file is not in MPEG format.\n"); - return 4; - } - VIDEO_SINGLETON::instance ()->numS ++; - break; - case 0xb8: /* gop_start_code */ - VIDEO_SINGLETON::instance ()->numG ++; - break; - case 0x00: /* picture_start_code */ - nextByte; - nextByte; - nb &= 0x38; - if (nb == 0x08) - { - VIDEO_SINGLETON::instance ()->numI ++; - if (VIDEO_SINGLETON::instance ()->numG == 2) - VIDEO_SINGLETON::instance ()->pattern[VIDEO_SINGLETON::instance ()->patternSize++] = 'I'; - } - else if (nb == 0x10) - { - VIDEO_SINGLETON::instance ()->numP ++; - if (VIDEO_SINGLETON::instance ()->numG == 2) - VIDEO_SINGLETON::instance ()->pattern[VIDEO_SINGLETON::instance ()->patternSize++] = 'P'; - } - else if (nb == 0x18) - { - VIDEO_SINGLETON::instance ()->numB ++; - if (VIDEO_SINGLETON::instance ()->numG == 2) - VIDEO_SINGLETON::instance ()->pattern[VIDEO_SINGLETON::instance ()->patternSize++] = 'B'; - } - /* - else - fprintf(stderr, "VS error: unkonw picture type %d\n", nb); - */ - break; - default: - break; - } - state = 0; - } - else - state = 0; - } - exit_phase1: - - if (first != 3) - { - fprintf(stderr, "VS error: given file \"%s\" is not of MPEG format.\n", VIDEO_SINGLETON::instance ()->videoFile); - return 4; - } - - VIDEO_SINGLETON::instance ()->pattern[VIDEO_SINGLETON::instance ()->patternSize] = 0; - memset(VIDEO_SINGLETON::instance ()->sendPattern, 1, PATTERN_SIZE); - - VIDEO_SINGLETON::instance ()->numF = VIDEO_SINGLETON::instance ()->numI + VIDEO_SINGLETON::instance ()->numP + VIDEO_SINGLETON::instance ()->numB; - VIDEO_SINGLETON::instance ()->averageFrameSize = fileptr / (unsigned)VIDEO_SINGLETON::instance ()->numF; - /* - fprintf(stderr, "Pass one finished, total bytes read: %u, average frame size %d\n", - fileptr, VIDEO_SINGLETON::instance ()->averageFrameSize); - fprintf(stderr, "VIDEO_SINGLETON::instance ()->numS-%d, VIDEO_SINGLETON::instance ()->numG-%d, VIDEO_SINGLETON::instance ()->numF-%d, VIDEO_SINGLETON::instance ()->numI-%d, VIDEO_SINGLETON::instance ()->numP-%d, VIDEO_SINGLETON::instance ()->numB-%d\n", - VIDEO_SINGLETON::instance ()->numS, VIDEO_SINGLETON::instance ()->numG, VIDEO_SINGLETON::instance ()->numI, VIDEO_SINGLETON::instance ()->numI, VIDEO_SINGLETON::instance ()->numP, VIDEO_SINGLETON::instance ()->numB); - fprintf(stderr, "VIDEO_SINGLETON::Instance ()->Pattern detected: %s\n", VIDEO_SINGLETON::instance ()->pattern); - */ - if (VIDEO_SINGLETON::instance ()->numF > MAX_FRAMES) - { - fprintf(stderr, "VS error: VIDEO_SINGLETON::instance ()->Number of frames (%d) is bigger than MAX_FRAMES (%d).\n\ - you need to update the constant definition in common.h and recompile.\n", - VIDEO_SINGLETON::instance ()->numF, MAX_FRAMES); - return 5; - } - -#ifdef STAT - VIDEO_SINGLETON::instance ()->framesSent = (char *)malloc((VIDEO_SINGLETON::instance ()->numF + 7)>>3); - if (VIDEO_SINGLETON::instance ()->framesSent == NULL) - { - fprintf(stderr, "VS fails to alloc mem for VIDEO_SINGLETON::instance ()->framesSent for %d frames", VIDEO_SINGLETON::instance ()->numF); - perror(""); - return 6; - } -#endif - - VIDEO_SINGLETON::instance ()->systemHeader = (struct Video_Global::SystemHeader *)malloc(sizeof(struct Video_Global::SystemHeader) * VIDEO_SINGLETON::instance ()->numS); - if (VIDEO_SINGLETON::instance ()->systemHeader == NULL) - { - perror("VS error on malloc VIDEO_SINGLETON::instance ()->SystemHeader"); - return 7; - } - VIDEO_SINGLETON::instance ()->gopTable = (struct Video_Global::GopTable *)malloc(sizeof(struct Video_Global::GopTable) * VIDEO_SINGLETON::instance ()->numG); - if (VIDEO_SINGLETON::instance ()->gopTable == NULL) - { - perror("VS error on malloc GopHeader"); - return 8; - } - VIDEO_SINGLETON::instance ()->frameTable = (struct Video_Global::FrameTable *)malloc(sizeof(Video_Global::FrameTable) * VIDEO_SINGLETON::instance ()->numF); - if (VIDEO_SINGLETON::instance ()->frameTable == NULL) - { - perror("VS error on malloc VIDEO_SINGLETON::instance ()->frameTable"); - return 9; - } - - rewind(VIDEO_SINGLETON::instance ()->fp); - fileptr = 0; - state = 0; - inpic = 0; - shptr = -1; - gopptr = -1; - ftptr = 0; - - for (;;) - { - nextByte; - if (state >= 0 && nb == 0x00) - state ++; - else if (state >= 2 && nb == 0x01) - state = -1; - else if (state == -1) - { - switch (nb) - { - case 0xb7: /* seq_end_code */ - if (gopptr >= 0 && VIDEO_SINGLETON::instance ()->gopTable[gopptr].size == 0) - VIDEO_SINGLETON::instance ()->gopTable[gopptr].size = fileptr - VIDEO_SINGLETON::instance ()->gopTable[gopptr].offset - 4; - computePicSize; - goto exit_phase2; - break; - case 0xb3: /* seq_start_code */ - if (gopptr >= 0 && VIDEO_SINGLETON::instance ()->gopTable[gopptr].size == 0) - VIDEO_SINGLETON::instance ()->gopTable[gopptr].size = fileptr - VIDEO_SINGLETON::instance ()->gopTable[gopptr].offset - 4; - computePicSize; - shptr ++; - VIDEO_SINGLETON::instance ()->systemHeader[shptr].offset = fileptr - 4; - VIDEO_SINGLETON::instance ()->systemHeader[shptr].size = 0; - break; - case 0xb8: /* gop_start_code */ - if (VIDEO_SINGLETON::instance ()->systemHeader[shptr].size == 0) - VIDEO_SINGLETON::instance ()->systemHeader[shptr].size =fileptr - VIDEO_SINGLETON::instance ()->systemHeader[shptr].offset - 4; - if (gopptr >= 0 && VIDEO_SINGLETON::instance ()->gopTable[gopptr].size == 0) - VIDEO_SINGLETON::instance ()->gopTable[gopptr].size = fileptr - VIDEO_SINGLETON::instance ()->gopTable[gopptr].offset - 4; - computePicSize; - gopptr ++; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].systemHeader = shptr; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].offset = fileptr - 4; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].headerSize = 0; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].size = 0; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].totalFrames = 0; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].previousFrames = gopptr ? - (VIDEO_SINGLETON::instance ()->gopTable[gopptr - 1].totalFrames + VIDEO_SINGLETON::instance ()->gopTable[gopptr - 1].previousFrames) : 0; - - break; - case 0x00: /* picture_start_code */ - if (VIDEO_SINGLETON::instance ()->gopTable[gopptr].headerSize == 0) - { - VIDEO_SINGLETON::instance ()->gopTable[gopptr].headerSize = fileptr - VIDEO_SINGLETON::instance ()->gopTable[gopptr].offset - 4; - VIDEO_SINGLETON::instance ()->gopTable[gopptr].firstIoffset = fileptr - 4; - } - VIDEO_SINGLETON::instance ()->gopTable[gopptr].totalFrames ++; - computePicSize; - picptr = fileptr - 4; - nextByte; - nextByte; - nb &= 0x38; - if (nb == 0x08) - { - pictype = 'I'; - inpic = 1; - } - else if (nb == 0x10) - { - pictype = 'P'; - inpic = 1; - } - else if (nb == 0x18) - { - pictype = 'B'; - inpic = 1; - } - break; - default: - - break; - } - state = 0; - } - else - state = 0; - } - - exit_phase2: - for (shptr = 0; shptr<VIDEO_SINGLETON::instance ()->numS; shptr++) - { - VIDEO_SINGLETON::instance ()->maxS = max(VIDEO_SINGLETON::instance ()->maxS, VIDEO_SINGLETON::instance ()->systemHeader[shptr].size); - VIDEO_SINGLETON::instance ()->minS = min(VIDEO_SINGLETON::instance ()->minS, VIDEO_SINGLETON::instance ()->systemHeader[shptr].size); - } - for (gopptr = 0; gopptr<VIDEO_SINGLETON::instance ()->numG; gopptr++) - { - VIDEO_SINGLETON::instance ()->maxG = max(VIDEO_SINGLETON::instance ()->maxG, VIDEO_SINGLETON::instance ()->gopTable[gopptr].headerSize); - VIDEO_SINGLETON::instance ()->minG = min(VIDEO_SINGLETON::instance ()->minG, VIDEO_SINGLETON::instance ()->gopTable[gopptr].headerSize); - } - VIDEO_SINGLETON::instance ()->packetBufSize = VIDEO_SINGLETON::instance ()->maxS + VIDEO_SINGLETON::instance ()->maxG + max(VIDEO_SINGLETON::instance ()->maxI, max(VIDEO_SINGLETON::instance ()->maxP, VIDEO_SINGLETON::instance ()->maxB)); - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)malloc(sizeof(VideoMessage) + sizeof(VideoPacket) + - VIDEO_SINGLETON::instance ()->packetBufSize); - if (VIDEO_SINGLETON::instance ()->packet == NULL) - { - perror("VS error on malloc VIDEO_SINGLETON::instance ()->packet buffer"); - return 10; - } - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)((char *)VIDEO_SINGLETON::instance ()->packet + sizeof(VideoMessage)); - /* - fprintf(stderr, "Pass 2 finished.\n"); - fprintf(stderr, "VIDEO_SINGLETON::instance ()->maxS-%d, VIDEO_SINGLETON::instance ()->maxG-%d, VIDEO_SINGLETON::instance ()->maxI-%d, VIDEO_SINGLETON::instance ()->maxP-%d, VIDEO_SINGLETON::instance ()->maxB-%d.\n", VIDEO_SINGLETON::instance ()->maxS, VIDEO_SINGLETON::instance ()->maxG, VIDEO_SINGLETON::instance ()->maxI, VIDEO_SINGLETON::instance ()->maxP, VIDEO_SINGLETON::instance ()->maxB); - fprintf(stderr, "VIDEO_SINGLETON::instance ()->minS-%d, VIDEO_SINGLETON::instance ()->minG-%d, VIDEO_SINGLETON::instance ()->minI-%d, VIDEO_SINGLETON::instance ()->minP-%d, VIDEO_SINGLETON::instance ()->minB-%d.\n", VIDEO_SINGLETON::instance ()->minS, VIDEO_SINGLETON::instance ()->minG, VIDEO_SINGLETON::instance ()->minI, VIDEO_SINGLETON::instance ()->minP, VIDEO_SINGLETON::instance ()->minB); - */ - /* - { - int i; - - fprintf(stderr, "id: offset size -- system header table:\n"); - for (i=0; i<VIDEO_SINGLETON::instance ()->numS; i++) - fprintf(stderr, "%-3d %-9u %d\n", i, VIDEO_SINGLETON::instance ()->systemHeader[i].offset, VIDEO_SINGLETON::instance ()->systemHeader[i].size); - fprintf(stderr, - "id: header offset hdsize totSize frames preframs Ioffset Isize -- GOP\n"); - for (i=0; i<VIDEO_SINGLETON::instance ()->numG; i++) - { - fprintf(stderr, "%-4d %-8d %-8u %-8d %-8d %-8d %-8d %-8u %d\n", - i, - VIDEO_SINGLETON::instance ()->gopTable[i].VIDEO_SINGLETON::instance ()->systemHeader, - VIDEO_SINGLETON::instance ()->gopTable[i].offset, - VIDEO_SINGLETON::instance ()->gopTable[i].headerSize, - VIDEO_SINGLETON::instance ()->gopTable[i].size, - VIDEO_SINGLETON::instance ()->gopTable[i].totalFrames, - VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames, - VIDEO_SINGLETON::instance ()->gopTable[i].firstIoffset, - VIDEO_SINGLETON::instance ()->frameTable[VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames].size - ); - } - - fprintf(stderr, "\nframe information:"); - for (i=0; i<VIDEO_SINGLETON::instance ()->numF; i++) - fprintf(stderr, "%c%c%-8d", (i%10 ? '\0' : '\n'), VIDEO_SINGLETON::instance ()->frameTable[i].type, VIDEO_SINGLETON::instance ()->frameTable[i].size); - fprintf(stderr, "\n"); - - } - */ - fseek(VIDEO_SINGLETON::instance ()->fp, VIDEO_SINGLETON::instance ()->systemHeader[0].offset+4, 0); - nextByte; - VIDEO_SINGLETON::instance ()->horizontalSize = ((int)nb <<4) & 0xff0; - nextByte; - VIDEO_SINGLETON::instance ()->horizontalSize |= (nb >>4) & 0x0f; - VIDEO_SINGLETON::instance ()->verticalSize = ((int)nb <<8) & 0xf00; - nextByte; - VIDEO_SINGLETON::instance ()->verticalSize |= (int)nb & 0xff; - nextByte; - VIDEO_SINGLETON::instance ()->pelAspectRatio = ((int)nb >> 4) & 0x0f; - VIDEO_SINGLETON::instance ()->pictureRate = (int)nb & 0x0f; - nextByte; - nextByte; - nextByte; - VIDEO_SINGLETON::instance ()->vbvBufferSize = ((int)nb << 5) & 0x3e0; - nextByte; - VIDEO_SINGLETON::instance ()->vbvBufferSize |= ((int)nb >>3) & 0x1f; - /* - fprintf(stderr, "SysHeader info: hsize-%d, vsize-%d, pelAspect-%d, rate-%d, vbv-%d.\n", - VIDEO_SINGLETON::instance ()->horizontalSize, VIDEO_SINGLETON::instance ()->verticalSize, VIDEO_SINGLETON::instance ()->pelAspectRatio, VIDEO_SINGLETON::instance ()->pictureRate, VIDEO_SINGLETON::instance ()->vbvBufferSize); - */ - WriteInfoToFile(); - } -#if 0 - { - int i, j = 20; - - for (i = VIDEO_SINGLETON::instance ()->numG - 1;; i --) { - if (VIDEO_SINGLETON::instance ()->gopTable[i].offset < 4235260) { - fprintf(stderr, "group %d: offset %ld\n", i, VIDEO_SINGLETON::instance ()->gopTable[i].offset); - if (j -- == 0) break; - } - } - /* - for (i = 0; i < VIDEO_SINGLETON::instance ()->numG; i ++) { - if (VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames > 1800) { - fprintf(stderr, "group %d: offset %ld pre-frames %d\n", - i, VIDEO_SINGLETON::instance ()->gopTable[i].offset, VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames); - break; - } - } - */ - } -#endif - { - VIDEO_SINGLETON::instance ()->firstPatternSize = VIDEO_SINGLETON::instance ()->gopTable[0].totalFrames; - VIDEO_SINGLETON::instance ()->firstSendPattern = (char *)malloc(VIDEO_SINGLETON::instance ()->firstPatternSize); - if (VIDEO_SINGLETON::instance ()->firstSendPattern == NULL) - { - fprintf(stderr, "VS failed to allocate VIDEO_SINGLETON::instance ()->firstVIDEO_SINGLETON::instance ()->SendVIDEO_SINGLETON::Instance ()->Pattern for %d frames", - VIDEO_SINGLETON::instance ()->firstPatternSize); - perror(""); - return 11; - } - } - VIDEO_SINGLETON::instance ()->firstGopFrames = VIDEO_SINGLETON::instance ()->gopTable[0].totalFrames; - return 0; -} - - int INITvideo(void) -{ - INITvideoPara para; - int failureType = 0; - int result; - /* - fprintf(stderr, "VS about to read Para.\n"); - */ - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.version = ntohl(para.version); - para.nameLength = ntohl(para.nameLength); -#endif - if (para.nameLength>0) - { - result = CmdRead(VIDEO_SINGLETON::instance ()->videoFile, para.nameLength); - if (result != 0) - return result; - } - if (Mpeg_Global::session_num > Mpeg_Global::session_limit || para.version != VERSION) { - char errmsg[128]; - VIDEO_SINGLETON::instance ()->cmd = CmdFAIL; - CmdWrite((char *)&VIDEO_SINGLETON::instance ()->cmd, 1); - if (Mpeg_Global::session_num > Mpeg_Global::session_limit) { - sprintf(errmsg, - "Too many sessions being serviced, please try again later.\n"); - } - else { - sprintf(errmsg, "Version # not match, VS %d.%02d, Client %d.%02d", - VERSION / 100, VERSION % 100, - para.version / 100, para.version % 100); - } - write_string(VIDEO_SINGLETON::instance ()->serviceSocket, errmsg); - exit(0); - } - VIDEO_SINGLETON::instance ()->cmdsn = para.sn; - /* - fprintf(stderr, "MPEG file %s got.\n", VIDEO_SINGLETON::instance ()->videoFile); - */ - VIDEO_SINGLETON::instance ()->videoFile[para.nameLength] = 0; - - if (!strncasecmp("LiveVideo", VIDEO_SINGLETON::instance ()->videoFile, 9)) { - if (OpenLiveVideo(&VIDEO_SINGLETON::instance ()->video_format, &VIDEO_SINGLETON::instance ()->horizontalSize, - &VIDEO_SINGLETON::instance ()->verticalSize, &VIDEO_SINGLETON::instance ()->averageFrameSize, - &VIDEO_SINGLETON::instance ()->fps, &VIDEO_SINGLETON::instance ()->pelAspectRatio) == -1) { - failureType = 100; - goto failure; - } - if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG2) { - failureType = 101; - goto failure; - } - VIDEO_SINGLETON::instance ()->live_source = 1; - - VIDEO_SINGLETON::instance ()->fileSize =0x7fffffff; - VIDEO_SINGLETON::instance ()->maxS = VIDEO_SINGLETON::instance ()->maxG = VIDEO_SINGLETON::instance ()->maxI = VIDEO_SINGLETON::instance ()->maxP = VIDEO_SINGLETON::instance ()->maxB = VIDEO_SINGLETON::instance ()->minS = VIDEO_SINGLETON::instance ()->minG = VIDEO_SINGLETON::instance ()->minI = VIDEO_SINGLETON::instance ()->minP = VIDEO_SINGLETON::instance ()->minB = 1; - VIDEO_SINGLETON::instance ()->numS = VIDEO_SINGLETON::instance ()->numG = VIDEO_SINGLETON::instance ()->numF = VIDEO_SINGLETON::instance ()->numI = 0x7fffffff; - VIDEO_SINGLETON::instance ()->numP = VIDEO_SINGLETON::instance ()->numB = 0; - VIDEO_SINGLETON::instance ()->vbvBufferSize = 1; - VIDEO_SINGLETON::instance ()->firstGopFrames = 1; - VIDEO_SINGLETON::instance ()->patternSize = 1; - VIDEO_SINGLETON::instance ()->pattern[0] = 'I'; - VIDEO_SINGLETON::instance ()->pattern[1] = 0; - VIDEO_SINGLETON::instance ()->packetBufSize = VIDEO_SINGLETON::instance ()->verticalSize * VIDEO_SINGLETON::instance ()->horizontalSize * 3; - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)malloc(sizeof(VideoMessage) + sizeof(VideoPacket) + - VIDEO_SINGLETON::instance ()->packetBufSize); - if (VIDEO_SINGLETON::instance ()->packet == NULL) - { - perror("Error: VS error on malloc VIDEO_SINGLETON::instance ()->packet buffer"); - exit(1); - } - VIDEO_SINGLETON::instance ()->packet = (VideoPacket *)((char *)VIDEO_SINGLETON::instance ()->packet + sizeof(VideoMessage)); - - } - else { - static double pictureRateTable[] = {23.976, 24, 25, 29.97, 30, 50, 59.94, 60}; - - VIDEO_SINGLETON::instance ()->video_format = VIDEO_MPEG1; - failureType = init_MPEG1_video_file(); - if (failureType) goto failure; - VIDEO_SINGLETON::instance ()->fps = pictureRateTable[VIDEO_SINGLETON::instance ()->pictureRate - 1]; - } - - { - INITvideoReply reply; - - reply.totalHeaders = htonl(VIDEO_SINGLETON::instance ()->numS); - reply.totalGroups = htonl(VIDEO_SINGLETON::instance ()->numG); - reply.totalFrames = htonl(VIDEO_SINGLETON::instance ()->numF); - reply.sizeIFrame = htonl(VIDEO_SINGLETON::instance ()->maxI); - reply.sizePFrame = htonl(VIDEO_SINGLETON::instance ()->maxP); - reply.sizeBFrame = htonl(VIDEO_SINGLETON::instance ()->maxB); - reply.sizeSystemHeader = htonl(VIDEO_SINGLETON::instance ()->maxS); - reply.sizeGop = htonl(VIDEO_SINGLETON::instance ()->maxG); - reply.averageFrameSize = htonl(VIDEO_SINGLETON::instance ()->averageFrameSize); - reply.verticalSize = htonl(VIDEO_SINGLETON::instance ()->verticalSize); - reply.horizontalSize = htonl(VIDEO_SINGLETON::instance ()->horizontalSize); - reply.pelAspectRatio = htonl(VIDEO_SINGLETON::instance ()->pelAspectRatio); - reply.pictureRate1000 = htonl((int)(VIDEO_SINGLETON::instance ()->fps * 1000)); - reply.vbvBufferSize = htonl(VIDEO_SINGLETON::instance ()->vbvBufferSize); - reply.firstGopFrames = htonl(VIDEO_SINGLETON::instance ()->firstGopFrames); - reply.patternSize = htonl(VIDEO_SINGLETON::instance ()->patternSize); - strncpy(reply.pattern, VIDEO_SINGLETON::instance ()->pattern, PATTERN_SIZE); - - reply.live = htonl(VIDEO_SINGLETON::instance ()->live_source); - reply.format = htonl(VIDEO_SINGLETON::instance ()->video_format); - - CmdWrite((char *)&VIDEO_SINGLETON::instance ()->cmd, 1); - - CmdWrite((char *)&reply, sizeof(reply)); - - /* write the first SH, GOP and IFrame to VIDEO_SINGLETON::instance ()->serviceSocket (TCP), - using code for SendPacket() */ - { - int tmpSocket = VIDEO_SINGLETON::instance ()->videoSocket; - - if (VIDEO_SINGLETON::instance ()->live_source) StartPlayLiveVideo(); - - VIDEO_SINGLETON::instance ()->videoSocket = VIDEO_SINGLETON::instance ()->serviceSocket; - - if (VIDEO_SINGLETON::instance ()->live_source) { - int frame = 0; - SendPicture(&frame); - } - else if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG1) { - SendPacket(1, 0, 0, 0); - } - else { - fprintf(stderr, "VS: VIDEO_SINGLETON::instance ()->video_format %d not supported.\n", - VIDEO_SINGLETON::instance ()->video_format); - } - VIDEO_SINGLETON::instance ()->videoSocket = tmpSocket; - - if (VIDEO_SINGLETON::instance ()->live_source) StopPlayLiveVideo(); - } - - return 0; - - } - failure: - { - char * msg; - char errmsg[64]; - VIDEO_SINGLETON::instance ()->cmd = CmdFAIL; - sprintf(errmsg, "VS failed to alloc internal buf (type %d)", failureType); - CmdWrite((char *)&VIDEO_SINGLETON::instance ()->cmd, 1); - msg = failureType == 1 ? "not a complete MPEG stream" : - failureType == 2 ? "can't open MPEG file" : - failureType == 3 ? "MPEG file is not seekable" : - failureType == 4 ? "not an MPEG stream" : - failureType == 5 ? - "too many frames in MPEG file, need change MAX_FRAMES and recompile VS" : - failureType == 100 ? "failed to connect to live video source" : - failureType == 101 ? "live MPEG2 not supported" : - errmsg; - write_string(VIDEO_SINGLETON::instance ()->serviceSocket, msg); - exit(0); - } -} - -#define CheckGroupRange(pnextGroup) \ -{ if ((pnextGroup) < 0 || (pnextGroup) >= VIDEO_SINGLETON::instance ()->numG) \ - { fprintf(stderr, "VS: %d.VIDEO_SINGLETON::instance ()->nextGroup(%d) out of range (%d).\n", VIDEO_SINGLETON::instance ()->cmd, (pnextGroup), VIDEO_SINGLETON::instance ()->numG); \ - return 0; } } - -#define CheckFrameRange(pnextFrame) \ -{ if ((pnextFrame) < 0 || (pnextFrame) >= VIDEO_SINGLETON::instance ()->numF) \ - { fprintf(stderr, "VS: %d.VIDEO_SINGLETON::instance ()->nextFrame(%d) out of range (%d).\n", VIDEO_SINGLETON::instance ()->cmd, (pnextFrame), VIDEO_SINGLETON::instance ()->numF); \ - return 0; } } - -int FrameToGroup(int * frame) -{ - int f = * frame; - int i = 0; - while (i < VIDEO_SINGLETON::instance ()->numG && VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames <= f) i++; - i --; - * frame = f - VIDEO_SINGLETON::instance ()->gopTable[i].previousFrames; - return i; -} - -static int POSITIONvideo() -{ - int result; - POSITIONpara para; - /* - fprintf(stderr, "POSITION . . .\n"); - */ - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; - - if (VIDEO_SINGLETON::instance ()->live_source) return 0; - -#ifdef NeedByteOrderConversion - para.VIDEO_SINGLETON::instance ()->nextGroup = ntohl(para.VIDEO_SINGLETON::instance ()->nextGroup); - para.sn = ntohl(para.sn); -#endif - - CheckGroupRange(para.nextGroup); - VIDEO_SINGLETON::instance ()->cmdsn = para.sn; - result = SendPacket(VIDEO_SINGLETON::instance ()->numS>1 || para.nextGroup == 0, para.nextGroup, 0, 0); - return result; -} - -static int STEPvideo() -{ - int group; - STEPpara para; - int tag = 0; - int result; - - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.VIDEO_SINGLETON::instance ()->nextFrame = ntohl(para.VIDEO_SINGLETON::instance ()->nextFrame); -#endif - - VIDEO_SINGLETON::instance ()->cmdsn = para.sn; - - if (!VIDEO_SINGLETON::instance ()->live_source) { - if (para.nextFrame >= VIDEO_SINGLETON::instance ()->numF) /* send SEQ_END */ - { - tag = 1; - para.nextFrame --; - } - /* - fprintf(stderr, "STEP . . .frame-%d\n", para.VIDEO_SINGLETON::instance ()->nextFrame); - */ - CheckFrameRange(para.nextFrame); - group = FrameToGroup(¶.nextFrame); - if (VIDEO_SINGLETON::instance ()->precmd != CmdSTEP && !tag ) { - result = SendReferences(group, para.nextFrame); - if (result < 0 ) - return result; - } - } - if (VIDEO_SINGLETON::instance ()->live_source) StartPlayLiveVideo(); - - if (VIDEO_SINGLETON::instance ()->live_source) { - SendPicture(¶.nextFrame); - } - else if (VIDEO_SINGLETON::instance ()->video_format == VIDEO_MPEG1) { - SendPacket(VIDEO_SINGLETON::instance ()->numS>1, group, tag ? VIDEO_SINGLETON::instance ()->numF : para.nextFrame, 0); - } - else { - fprintf(stderr, "VS: wierd1\n"); - } - - if (VIDEO_SINGLETON::instance ()->live_source) StopPlayLiveVideo(); - return 0; -} - -static int timerHeader, timerGroup, timerFrame; -static int timerOn = 0; -static int timerAdjust = 0; -static int preTimerVal = 0; -static void StopTimer(void); -static void TimerSpeed(void); -static void TimerProcessing(void); - -static void timerHandler(int sig) -{ - int val2, val3; - int usec = VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF; - - if (Mpeg_Global::drift_ppm) { - usec -= (int)((double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0); - } - - if (timerAdjust > 1) - usec = (int)(((double)usec * (double)(SPEEDUP_INV_SCALE - 1)) / - (double)SPEEDUP_INV_SCALE); - val3 = get_duration(preTimerVal, (val2 = get_usec())); - /* - if (val3 >= usec<< 1)) - fprintf(stderr, "Slower: %d out of VIDEO_SINGLETON::instance ()->currentUPF %d.\n", - val3, usec); - else - fprintf(stderr, "+\n"); - */ - preTimerVal = val2; - if (val3 < 0 || val3 > 100000000) - val3 = usec; - val2 = (val3 + (usec>>1)) / usec; - if (val2 < 0) val2 = 0; - if (val2) { - TimerProcessing(); - val2 --; - } - VIDEO_SINGLETON::instance ()->addedSignals += val2; - - if (VIDEO_SINGLETON::instance ()->addedSignals) { - val2 = timerAdjust; - if (timerAdjust < MAX_TIMER_ADJUST) { - timerAdjust += VIDEO_SINGLETON::instance ()->addedSignals * SPEEDUP_INV_SCALE; - if (val2 < SPEEDUP_INV_SCALE) { - TimerSpeed(); - } - } - else { - /* - fprintf(stderr, "VS timerAdjust %d, VIDEO_SINGLETON::instance ()->addedSignals %d, timerFrame %d\n", - timerAdjust, VIDEO_SINGLETON::instance ()->addedSignals, timerFrame); - */ - for (val3 = 0; val3 < VIDEO_SINGLETON::instance ()->addedSignals; val3 ++) - TimerProcessing(); - } - VIDEO_SINGLETON::instance ()->addedSignals = 0; - } -} - -static void TimerProcessing(void) -{ -/* - fprintf(stderr, "VS: timerHandler...\n"); -*/ - if (!timerOn) { - return; - } - if (timerAdjust < 0) - { - timerAdjust += SPEEDUP_INV_SCALE; - return; - } - if (timerAdjust >0) - { - if ((--timerAdjust) == 0) - TimerSpeed(); - } - if (VIDEO_SINGLETON::instance ()->cmd == CmdPLAY) - { - if (timerGroup == VIDEO_SINGLETON::instance ()->numG - 1 && timerFrame >= VIDEO_SINGLETON::instance ()->gopTable[timerGroup].totalFrames - 1) - { - timerFrame ++; /* force sending of END_SEQ when PLAY VIDEO_SINGLETON::instance ()->cmd */ - StopTimer(); - return; - } - else - { - timerFrame ++; - if (timerFrame >= VIDEO_SINGLETON::instance ()->gopTable[timerGroup].totalFrames) - { - timerGroup ++; - timerFrame = 0; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - } - } - else { - if (VIDEO_SINGLETON::instance ()->cmd == CmdFF) { - if (timerGroup == VIDEO_SINGLETON::instance ()->numG - 1) { - StopTimer(); - return; - } - timerGroup ++; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - else { - if (timerGroup == 0) { - StopTimer(); - return; - } - timerGroup --; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - } - } -} - -static void StartTimer(void) -{ - VIDEO_SINGLETON::instance ()->addedUPF = 0; - VIDEO_SINGLETON::instance ()->addedSignals = 0; - timerAdjust = (VIDEO_SINGLETON::instance ()->VStimeAdvance * SPEEDUP_INV_SCALE) / VIDEO_SINGLETON::instance ()->currentUPF; - /* - SFprintf(stderr, "VS StartTimer(): fast-start frames %d\n", - timerAdjust / SPEEDUP_INV_SCALE); - */ - TimerSpeed(); - setsignal(SIGALRM, timerHandler); - timerOn = 1; - preTimerVal = get_usec(); - /* - fprintf(stderr, "VS: timer started at %d upf.\n", VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF); - */ -} - -static void TimerSpeed(void) -{ - struct itimerval val; - int usec = VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF; - if (Mpeg_Global::drift_ppm) { - /* - int drift = (double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0; - SFprintf(stderr, "Mpeg_Global::drift_ppm %d, usec %d, drift %d, new usec %d\n", - Mpeg_Global::drift_ppm, usec, drift, usec - drift); - */ - usec -= (int)((double)usec * (double)Mpeg_Global::drift_ppm / 1000000.0); - } - if (timerAdjust > 1) - usec = (int)(((double)usec * (double)(SPEEDUP_INV_SCALE - 1)) / - (double)SPEEDUP_INV_SCALE); - val.it_interval.tv_sec = val.it_value.tv_sec = usec / 1000000; - val.it_interval.tv_usec = val.it_value.tv_usec = usec % 1000000; - setitimer(ITIMER_REAL, &val, NULL); - /* - SFprintf(stderr, - "VS TimerSpeed() at %s speed, timerAdjust %d VIDEO_SINGLETON::instance ()->addedSignals %d.\n", - (timerAdjust > 1) ? "higher" : "normal", timerAdjust, VIDEO_SINGLETON::instance ()->addedSignals); - */ -} - -static void StopTimer() -{ - struct itimerval val; - setsignal(SIGALRM, SIG_IGN); - val.it_interval.tv_sec = val.it_value.tv_sec = 0; - val.it_interval.tv_usec = val.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &val, NULL); - timerOn = 0; - /* - fprintf(stderr, "VS: timer stopped.\n"); - */ -} - -void GetFeedBack() -{ - VideoFeedBackPara para; - struct itimerval val; - int timerUsec; - - if (FBread((char *)¶, sizeof(para)) == -1 || - ntohl(para.cmdsn) != VIDEO_SINGLETON::instance ()->cmdsn) { - /* - SFprintf(stderr, "VS warning: a FB VIDEO_SINGLETON::instance ()->packet discarded.\n"); - */ - return; - } -#ifdef NeedByteOrderConversion - para.VIDEO_SINGLETON::instance ()->needHeader = ntohl(para.VIDEO_SINGLETON::instance ()->needHeader); - para.addUsecPerFrame = ntohl(para.addUsecPerFrame); - para.addFrames = ntohl(para.addFrames); - para.VIDEO_SINGLETON::instance ()->sendVIDEO_SINGLETON::Instance ()->PatternGops = ntohl(para.VIDEO_SINGLETON::instance ()->sendVIDEO_SINGLETON::Instance ()->PatternGops); - para.VIDEO_SINGLETON::instance ()->frameRateLimit1000 = ntohl(para.VIDEO_SINGLETON::instance ()->frameRateLimit1000); -#endif - VIDEO_SINGLETON::instance ()->frameRateLimit = para.frameRateLimit1000 / 1000.0; - VIDEO_SINGLETON::instance ()->sendPatternGops = para.sendPatternGops; - - if (!timerOn) return; - - VIDEO_SINGLETON::instance ()->needHeader = para.needHeader; - memcpy(VIDEO_SINGLETON::instance ()->sendPattern, para.sendPattern, PATTERN_SIZE); - if (para.addFrames <= 0 || timerAdjust < MAX_TIMER_ADJUST) - { - timerAdjust += para.addFrames * SPEEDUP_INV_SCALE; - TimerSpeed(); - } - else /* drastic compensation for big gap */ - VIDEO_SINGLETON::instance ()->addedSignals += para.addFrames; - if (para.addUsecPerFrame) { - VIDEO_SINGLETON::instance ()->addedUPF += para.addUsecPerFrame; - TimerSpeed(); - } - /* - SFprintf(stderr, "VS fb: addf %d, addupf %d\n", - para.addFrames, para.addUsecPerFrame); - */ -} - -static int FastVideoPlay(void) -{ - int result; - FFpara para; - int preGroup = -1; - int preHeader = -1; - int nfds = (VIDEO_SINGLETON::instance ()->serviceSocket > VIDEO_SINGLETON::instance ()->videoSocket ? VIDEO_SINGLETON::instance ()->serviceSocket : VIDEO_SINGLETON::instance ()->videoSocket) + 1; - - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.VIDEO_SINGLETON::instance ()->nextGroup = ntohl(para.VIDEO_SINGLETON::instance ()->nextGroup); - para.usecPerFrame = ntohl(para.usecPerFrame); - para.framesPerSecond = ntohl(para.framesPerSecond); - para.VIDEO_SINGLETON::instance ()->VStimeAdvance = ntohl(para.VIDEO_SINGLETON::instance ()->VStimeAdvance); -#endif - - if (VIDEO_SINGLETON::instance ()->live_source) return 0; - - VIDEO_SINGLETON::instance ()->VStimeAdvance = para.VStimeAdvance; - /* - fprintf(stderr, "VIDEO_SINGLETON::instance ()->VStimeAdvance from client: %d\n", VIDEO_SINGLETON::instance ()->VStimeAdvance); - */ - CheckGroupRange(para.nextGroup); - VIDEO_SINGLETON::instance ()->cmdsn = para.sn; - timerGroup = para.nextGroup; - timerFrame = 0; - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - VIDEO_SINGLETON::instance ()->currentUPF = para.usecPerFrame; - StartTimer(); - - for (;;) - { - struct fd_set read_mask; -/* - fprintf(stderr, "VS: FF/FB - a loop begines. . .\n"); -*/ - if (preGroup != timerGroup) - { - SendPacket(preHeader != timerHeader, timerGroup, 0, - para.usecPerFrame * VIDEO_SINGLETON::instance ()->patternSize >> 2); - preHeader = timerHeader; - preGroup = timerGroup; - } - - FD_ZERO(&read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, NULL) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, NULL) == -1) -#endif - { - if (errno == EINTR) - { - ACE_DEBUG ((LM_DEBUG, - "PLAYVIDEO:select EINTR signal \n")); - continue; - } - perror("Error - VS select between service and video sockets"); - exit(1); - - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask)) /* stop */ - { - result = CmdRead((char *)&VIDEO_SINGLETON::instance ()->cmd, 1); - if (result != 0) - return result; - if (VIDEO_SINGLETON::instance ()->cmd == CmdCLOSE) { - exit(0); - } - else if (VIDEO_SINGLETON::instance ()->cmd != CmdSTOP) { - fprintf(stderr, "VS error: VIDEO_SINGLETON::instance ()->cmd=%d while STOP is expected.\n", VIDEO_SINGLETON::instance ()->cmd); - VIDEO_SINGLETON::instance ()->normalExit = 0; - exit(1); - } - result = CmdRead((char *)&VIDEO_SINGLETON::instance ()->cmdsn, sizeof(int)); - if (result != 0 ) - return result; -#ifdef NeedByteOrderConversion - VIDEO_SINGLETON::instance ()->cmdsn = ntohl(VIDEO_SINGLETON::instance ()->cmdsn); -#endif - StopTimer(); - break; - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask)) /* feedback, speed adjustment */ - { - ACE_DEBUG((LM_DEBUG, - "FastVideo Play:Data socket selected")); - GetFeedBack(); - } - ACE_DEBUG((LM_DEBUG, - "none of the sockets selected \n")); - } - return 0; -} - -static void FFvideo() -{ - /* - fprintf(stderr, "FF . . .\n"); - */ - FastVideoPlay(); -} - -static void FBvideo() -{ - /* - fprintf(stderr, "FB . . . \n"); - */ - FastVideoPlay(); -} - -void ComputeFirstSendPattern(float limit) -{ - char * buf = VIDEO_SINGLETON::instance ()->firstSendPattern; - int len = VIDEO_SINGLETON::instance ()->firstPatternSize; - char * pat = (char *)malloc(len); - int f; - - if (pat == NULL) { - fprintf(stderr, "VS error on allocating %d bytes for computing first SP", len); - perror(""); - exit(1); - } - for (f = 0; f < len; f ++) { - pat[f] = VIDEO_SINGLETON::instance ()->frameTable[f].type; - } - memset(buf, 0, len); - - if (limit <= 0) - limit = 1.0; - - f = (int)((double)len * - ((double)limit / (1000000.0 / (double)VIDEO_SINGLETON::instance ()->currentUPF)) + 0.5); - /* rounded to integer, instead of truncated */ - if (f >= len) - f = len; - else if (f <= 1) - f = 1; - - ComputeSendPattern(pat, buf, len, f); - - /* - f = len - f; - fprintf(stderr, "VIDEO_SINGLETON::instance ()->FirstVIDEO_SINGLETON::instance ()->SendVIDEO_SINGLETON::Instance ()->Pattern (%d frames dropped): ", f); - { - int i; - for (i = 0; i < len; i ++) - fputc(buf[i] ? pat[i] : '-', stderr); - } - fputc('\n', stderr); - */ - free(pat); -} - - int PLAYliveVideo(PLAYpara * para) -{ - int doscale; - int count; - int first_frame; - int frame = para->nextFrame; - int nfds = (VIDEO_SINGLETON::instance ()->serviceSocket > VIDEO_SINGLETON::instance ()->videoSocket ? VIDEO_SINGLETON::instance ()->serviceSocket : VIDEO_SINGLETON::instance ()->videoSocket) + 1; - struct fd_set read_mask; - struct timeval tval = {0, 0}; - double ratio; - int result; - - VIDEO_SINGLETON::instance ()->currentUPF = (int)(1000000.0 / VIDEO_SINGLETON::instance ()->fps); /* ignore para.usecPerFrame */ - if (VIDEO_SINGLETON::instance ()->frameRateLimit < VIDEO_SINGLETON::instance ()->fps) { - doscale = 1; - ratio = min(VIDEO_SINGLETON::instance ()->frameRateLimit, VIDEO_SINGLETON::instance ()->fps) / VIDEO_SINGLETON::instance ()->fps; - first_frame = frame; - count = 0; - /* - fprintf(stderr, "doscale %d, VIDEO_SINGLETON::instance ()->frameRateLimit %5.2f, VIDEO_SINGLETON::instance ()->fps %5.2f, ratio %5.2f\n", - doscale, VIDEO_SINGLETON::instance ()->frameRateLimit, VIDEO_SINGLETON::instance ()->fps, ratio); - */ - } - else doscale = 0; - StartPlayLiveVideo(); - - for (;;) { - - if (doscale) { - for (;;) { - if ((int)((frame - first_frame) * ratio + 0.5) < count) frame ++; - else break; - } - count ++; - } - SendPicture(&frame); - frame ++; - - FD_ZERO(&read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, &tval) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, &tval) == -1) -#endif - { - if (errno == EINTR) - continue; - perror("Error - VS select between service and video sockets"); - StopPlayLiveVideo(); - exit(1); - - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask)) /* stop */ - { - unsigned char tmp; - result = CmdRead((char *)&tmp, 1); - if (result != 0) - return result; - if (tmp == CmdCLOSE) { - StopPlayLiveVideo(); - exit(0); - } - else if (tmp == CmdSTOP) { - VIDEO_SINGLETON::instance ()->cmd = tmp; - /* - fprintf(stderr, "VS: VIDEO_SINGLETON::Instance ()->CmdSTOP. . .\n"); - */ - result = CmdRead((char *)&VIDEO_SINGLETON::instance ()->cmdsn, sizeof(int)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - VIDEO_SINGLETON::instance ()->cmdsn = ntohl(VIDEO_SINGLETON::instance ()->cmdsn); -#endif - StopPlayLiveVideo(); - break; - } - else if (tmp == CmdSPEED) - { - SPEEDpara para; - /* - fprintf(stderr, "VS: VIDEO_SINGLETON::Instance ()->CmdSPEED. . .\n"); - */ - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; - /* ignore this thing for live video */ - } - else - { - fprintf(stderr, "VS error(live): VIDEO_SINGLETON::instance ()->cmd=%d while expect STOP/SPEED.\n", tmp); - VIDEO_SINGLETON::instance ()->normalExit = 0; - StopPlayLiveVideo(); - exit(1); - } - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask)) /* feedback, only for frame rate - adjustment */ - { - VideoFeedBackPara para; - if (FBread((char *)¶, sizeof(para)) == -1 || - ntohl(para.cmdsn) != VIDEO_SINGLETON::instance ()->cmdsn) { - /* - SFprintf(stderr, "VS warning: a FB VIDEO_SINGLETON::instance ()->packet discarded.\n"); - */ - return 0; - } -#ifdef NeedByteOrderConversion - para.VIDEO_SINGLETON::instance ()->frameRateLimit1000 = ntohl(para.VIDEO_SINGLETON::instance ()->frameRateLimit1000); -#endif - VIDEO_SINGLETON::instance ()->frameRateLimit = para.frameRateLimit1000 / 1000.0; - if (VIDEO_SINGLETON::instance ()->frameRateLimit < VIDEO_SINGLETON::instance ()->fps) { - doscale = 1; - ratio = min(VIDEO_SINGLETON::instance ()->frameRateLimit, VIDEO_SINGLETON::instance ()->fps) / VIDEO_SINGLETON::instance ()->fps; - first_frame = frame; - count = 0; - /* - fprintf(stderr, "doscale %d, VIDEO_SINGLETON::instance ()->frameRateLimit %5.2f, VIDEO_SINGLETON::instance ()->fps %5.2f, ratio %5.2f\n", - doscale, VIDEO_SINGLETON::instance ()->frameRateLimit, VIDEO_SINGLETON::instance ()->fps, ratio); - */ - } - else doscale = 0; - } - } - return 0; -} - -static int PLAYvideo() -{ - PLAYpara para; - int preGroup = -1; - int preHeader = -1; - int preFrame = -1; - int result; - - fprintf(stderr, "PLAY . . .\n"); - - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.VIDEO_SINGLETON::instance ()->nextFrame = ntohl(para.VIDEO_SINGLETON::instance ()->nextFrame); - para.usecPerFrame = ntohl(para.usecPerFrame); - para.framesPerSecond = ntohl(para.framesPerSecond); - para.VIDEO_SINGLETON::instance ()->frameRateLimit1000 = ntohl(para.VIDEO_SINGLETON::instance ()->frameRateLimit1000); - para.collectStat = ntohl(para.collectStat); - para.VIDEO_SINGLETON::instance ()->sendVIDEO_SINGLETON::Instance ()->PatternGops = ntohl(para.VIDEO_SINGLETON::instance ()->sendVIDEO_SINGLETON::Instance ()->PatternGops); - para.VIDEO_SINGLETON::instance ()->VStimeAdvance = ntohl(para.VIDEO_SINGLETON::instance ()->VStimeAdvance); -#endif - - VIDEO_SINGLETON::instance ()->frameRateLimit = para.frameRateLimit1000 / 1000.0; - VIDEO_SINGLETON::instance ()->cmdsn = para.sn; - VIDEO_SINGLETON::instance ()->currentUPF = para.usecPerFrame; - VIDEO_SINGLETON::instance ()->VStimeAdvance = para.VStimeAdvance; - - { - int ts = htonl(get_usec()); - CmdWrite((char *)&ts, sizeof(int)); - } - - if (VIDEO_SINGLETON::instance ()->live_source || VIDEO_SINGLETON::instance ()->video_format != VIDEO_MPEG1) { - if (VIDEO_SINGLETON::instance ()->live_source) - PLAYliveVideo (¶); - return 0; - } - - - fprintf(stderr, "VIDEO_SINGLETON::instance ()->VStimeAdvance from client: %d\n", VIDEO_SINGLETON::instance ()->VStimeAdvance); - - VIDEO_SINGLETON::instance ()->sendPatternGops = para.sendPatternGops; - ComputeFirstSendPattern(VIDEO_SINGLETON::instance ()->frameRateLimit); -#ifdef STAT - if (para.collectStat) - memset(VIDEO_SINGLETON::instance ()->framesSent, 0, (VIDEO_SINGLETON::instance ()->numF + 7)>>3); -#endif - CheckFrameRange(para.nextFrame); - timerFrame = para.nextFrame; - timerGroup = FrameToGroup(&timerFrame); - timerHeader = VIDEO_SINGLETON::instance ()->gopTable[timerGroup].systemHeader; - memcpy(VIDEO_SINGLETON::instance ()->sendPattern, para.sendPattern, PATTERN_SIZE); - result = SendReferences(timerGroup, timerFrame); - if (result < 0) - return result; - StartTimer(); - - fprintf (stderr, "VS Going into the for loop\n"); - for (;;) - { - int curGroup = timerGroup; - int curFrame = timerFrame; - int curHeader = timerHeader; - char * sp; - struct fd_set read_mask; - int nfds = (VIDEO_SINGLETON::instance ()->serviceSocket > VIDEO_SINGLETON::instance ()->videoSocket ? VIDEO_SINGLETON::instance ()->serviceSocket : VIDEO_SINGLETON::instance ()->videoSocket) + 1; - - if (preGroup != curGroup || curFrame != preFrame) - { - int sendStatus = -1; - int frameStep = 1; - if (curGroup == 0) - { - int i = curFrame + 1; - while (i < VIDEO_SINGLETON::instance ()->firstPatternSize && !VIDEO_SINGLETON::instance ()->firstSendPattern[i]) - { - frameStep ++; - i++; - } - } - else /* (curGroup > 0) */ - { - int i = curFrame + 1; - sp = VIDEO_SINGLETON::instance ()->sendPattern + ((curGroup - 1) % VIDEO_SINGLETON::instance ()->sendPatternGops) * VIDEO_SINGLETON::instance ()->patternSize; - while (i < VIDEO_SINGLETON::instance ()->patternSize && !sp[i]) - { - frameStep ++; - i++; - } - } - if (curGroup == 0) - { - if (VIDEO_SINGLETON::instance ()->firstSendPattern[curFrame]) - sendStatus = 0; - else /* (!VIDEO_SINGLETON::instance ()->firstVIDEO_SINGLETON::instance ()->SendVIDEO_SINGLETON::Instance ()->Pattern[curFrame]) */ - { - int i = curFrame - 1; - while (i > 0 && !VIDEO_SINGLETON::instance ()->firstSendPattern[i]) - i--; - if (i > preFrame) - /* the frame (curGroup, i) hasn't been sent yet */ - { - sendStatus = 0; - curFrame = i; - } - else - sendStatus = -1; - } - } - else if (sp[curFrame]) /* curGroup > 0 */ - sendStatus = 0; - else /* (!sp[curFrame]) */ - { - int i = curFrame - 1; - while (i > 0 && !sp[i]) - i--; - if (curGroup == preGroup && i > preFrame) - /* the frame (curGroup, i) hasn't been sent yet */ - { - sendStatus = 0; - curFrame = i; - } - else - sendStatus = -1; - } - if (!sendStatus) - { - // Send the current video frame, calls send_to_network which - // fragments and sends via blocking write . - sendStatus = SendPacket(preHeader != curHeader, - curGroup, curFrame, - (VIDEO_SINGLETON::instance ()->currentUPF + VIDEO_SINGLETON::instance ()->addedUPF) * frameStep); - if (!sendStatus) - { - preHeader = curHeader; - preGroup = curGroup; - preFrame = curFrame; -#ifdef STAT - if (para.collectStat) - { - int f = VIDEO_SINGLETON::instance ()->gopTable[curGroup].previousFrames + curFrame; - VIDEO_SINGLETON::instance ()->framesSent[f>>3] |= (1 << (f % 8)); - } -#endif - } - } - } - - // Wait for a command on serviceSocket or Feedback on videoSocket (UDP) - FD_ZERO(&read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask); - FD_SET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask); -#ifdef _HPUX_SOURCE - if (select(nfds, (int *)&read_mask, NULL, NULL, NULL) == -1) -#else - if (select(nfds, &read_mask, NULL, NULL, NULL) == -1) -#endif - { - if (errno == EINTR) /* select() interrupted */ - { - ACE_DEBUG ((LM_DEBUG, - "PLAYVideo:Select interrupted coninuing..\n")); - continue; - } - perror("Error - VS select between service and video sockets"); - exit(1); - - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->serviceSocket, &read_mask)) /* stop, speed change, loop swap */ - { - ACE_DEBUG ((LM_DEBUG, - "PLAYvideo:serviceSocket selected \n")); - unsigned char tmp; - result = CmdRead((char *)&tmp, 1); - if (result != 0) - return result; - - if (tmp == CmdCLOSE) { - exit(0); - } - else if (tmp == CmdSTOP) { - VIDEO_SINGLETON::instance ()->cmd = tmp; - /* - fprintf(stderr, "VS: VIDEO_SINGLETON::Instance ()->CmdSTOP. . .\n"); - */ - result = CmdRead((char *)&VIDEO_SINGLETON::instance ()->cmdsn, sizeof(int)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - VIDEO_SINGLETON::instance ()->cmdsn = ntohl(VIDEO_SINGLETON::instance ()->cmdsn); -#endif - StopTimer(); - break; - } - else if (tmp == CmdSPEED) - { - SPEEDpara para; - /* - fprintf(stderr, "VS: VIDEO_SINGLETON::Instance ()->CmdSPEED. . .\n"); - */ - result = CmdRead((char *)¶, sizeof(para)); - if (result != 0) - return result; -#ifdef NeedByteOrderConversion - para.sn = ntohl(para.sn); - para.usecPerFrame = ntohl(para.usecPerFrame); - para.framesPerSecond = ntohl(para.framesPerSecond); - para.sendPatternGops = ntohl(para.sendPatternGops); - para.frameRateLimit1000 = ntohl(para.frameRateLimit1000); -#endif - VIDEO_SINGLETON::instance ()->frameRateLimit = para.frameRateLimit1000 / 1000.0; - VIDEO_SINGLETON::instance ()->sendPatternGops = para.sendPatternGops; - VIDEO_SINGLETON::instance ()->currentUPF = para.usecPerFrame; - VIDEO_SINGLETON::instance ()->addedUPF = 0; - memcpy(VIDEO_SINGLETON::instance ()->sendPattern, para.sendPattern, PATTERN_SIZE); - TimerSpeed(); - } - else - { - fprintf(stderr, "VS error: VIDEO_SINGLETON::instance ()->cmd=%d while expect STOP/SPEED.\n", tmp); - VIDEO_SINGLETON::instance ()->normalExit = 0; - exit(1); - } - } - if (FD_ISSET(VIDEO_SINGLETON::instance ()->videoSocket, &read_mask)) /* feedBack, speed adjustment */ - { - ACE_DEBUG ((LM_DEBUG, - "PLAYVIDEO:Data SOCKET selected\n")); - GetFeedBack(); - } - ACE_DEBUG ((LM_DEBUG, - "PLAYVIDEO:none selected\n")); - } - return 0; -} - -#include <ctype.h> - -static void STATstream(void) -{ - int i, j = 0; - for (i = 0; i < VIDEO_SINGLETON::instance ()->numF; i++) - { - short size = htons(VIDEO_SINGLETON::instance ()->frameTable[i].size); - char type = VIDEO_SINGLETON::instance ()->frameTable[i].type; - if (i == VIDEO_SINGLETON::instance ()->gopTable[j].previousFrames) - { - type = tolower(type); - j ++; - } - CmdWrite((char *)&type, 1); - CmdWrite((char *)&size, 2); - } -} - -static void STATsent(void) -{ -#ifdef STAT - CmdWrite((char *)VIDEO_SINGLETON::instance ()->framesSent, (VIDEO_SINGLETON::instance ()->numF + 7) / 8); -#else - int i; - char zeroByte = 0; - for (i = 0; i < (VIDEO_SINGLETON::instance ()->numF + 7) / 8; i++) - CmdWrite((char *)&zeroByte, 1); -#endif -} - -static void on_exit_routine(void) -{ - struct sockaddr_in peeraddr_in; - int size = sizeof(peeraddr_in); - /* - if (!VIDEO_SINGLETON::instance ()->normalExit) { - fprintf(stderr, "VS exitting abnormally, dump core...\n"); - kill(getpid(), SIGSEGV); - usleep(2000000); - } - */ - /* - fprintf(stderr, "A VS session terminated.\n"); - */ - if (getpeername(VIDEO_SINGLETON::instance ()->serviceSocket, - (struct sockaddr *)&peeraddr_in, &size) == 0 && - peeraddr_in.sin_family == AF_INET) { - if (strncmp(inet_ntoa(peeraddr_in.sin_addr), "129.95.50", 9)) { - struct hostent *hp; - time_t val = time(NULL); - char * buf = ctime(&VIDEO_SINGLETON::instance ()->start_time); - - hp = gethostbyaddr((char *)&(peeraddr_in.sin_addr), 4, AF_INET); - buf[strlen(buf)-1] = 0; - printf("%s: %s %3dm%02ds %dP %s\n", - buf, - hp == NULL ? inet_ntoa(peeraddr_in.sin_addr) : hp->h_name, - (val - VIDEO_SINGLETON::instance ()->start_time) / 60, (val - VIDEO_SINGLETON::instance ()->start_time) % 60, - VIDEO_SINGLETON::instance ()->pkts_sent, VIDEO_SINGLETON::instance ()->videoFile); - } - } - ComCloseConn(VIDEO_SINGLETON::instance ()->serviceSocket); - ComCloseConn(VIDEO_SINGLETON::instance ()->videoSocket); -} - -int VideoServer(int ctr_fd, int data_fd, int rttag, int max_pkt_size) -{ - int result; - - VIDEO_SINGLETON::instance ()->serviceSocket = ctr_fd; - VIDEO_SINGLETON::instance ()->videoSocket = data_fd; - VIDEO_SINGLETON::instance ()->conn_tag = max_pkt_size; - - if (max_pkt_size > 0) VIDEO_SINGLETON::instance ()->msgsize = max_pkt_size; - else if (max_pkt_size < 0) VIDEO_SINGLETON::instance ()->msgsize = - max_pkt_size; - else VIDEO_SINGLETON::instance ()->msgsize = 1024 * 1024; - /* - SFprintf(stderr, "VS VIDEO_SINGLETON::instance ()->msgsize = %d\n", VIDEO_SINGLETON::instance ()->msgsize); - */ - VIDEO_SINGLETON::instance ()->msgsize -= sizeof(VideoMessage); - - VIDEO_SINGLETON::instance ()->start_time = time(NULL); - - atexit(on_exit_routine); - - VIDEO_SINGLETON::instance ()->lastRef[0] = VIDEO_SINGLETON::instance ()->lastRef[1] = -1; - VIDEO_SINGLETON::instance ()->lastRefPtr = 0; - - result = INITvideo(); - - if (result != 0) - return result; - - if (rttag) { - if (SetRTpriority("VS", 0) == -1) rttag = 0; - } - - for (;;) - { - - fprintf(stderr, "VS: waiting for a new command...\n"); - - VIDEO_SINGLETON::instance ()->precmd = VIDEO_SINGLETON::instance ()->cmd; - result = CmdRead((char *)&VIDEO_SINGLETON::instance ()->cmd, 1); - if (result != 0) - { - cerr << result; - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) VideoServer "), - result); - } - fprintf(stderr, "VS got VIDEO_SINGLETON::instance ()->cmd %d\n", VIDEO_SINGLETON::instance ()->cmd); - - switch (VIDEO_SINGLETON::instance ()->cmd) - { - case CmdPOSITION: - case CmdPOSITIONrelease: - result = POSITIONvideo(); - if (result != 0) - return result; - break; - case CmdSTEP: - result = STEPvideo(); - if (result != 0) - return result; - break; - case CmdFF: - FFvideo(); - break; - case CmdFB: - FBvideo(); - break; - case CmdPLAY: - result = PLAYvideo(); - if (result != 0) - return result; - break; - case CmdCLOSE: - /* - fprintf(stderr, "a session closed.\n"); - VIDEO_SINGLETON::instance ()->normalExit =1; - */ - // exit(0); - return 0; - break; - case CmdSTATstream: - STATstream(); - break; - case CmdSTATsent: - STATsent(); - break; - default: - fprintf(stderr, - "VS error: video channel command %d not known.\n", VIDEO_SINGLETON::instance ()->cmd); - VIDEO_SINGLETON::instance ()->normalExit = 0; - return -1; - break; - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Audio_Control.idl b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Audio_Control.idl deleted file mode 100644 index 1056fddbcfb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Audio_Control.idl +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -// $Id$ - -interface Audio_Control -{ - - /* CmdINITaudio parameter of fixed structure of 3 integers and a AudioPara, - replys with CmdINITaudio followed by reply or CmdFAIL followed by a string */ - struct INITaudioPara - { - int sn; - int version; - AudioParameter para; - int nameLength; - sequence <char> audiofile; - /* char audioFile[] */ - }; - - struct INITaudioReply - { - int live; - int format; - - AudioParameter para; - int totalSamples; - }; - - - /* CmdPLAY parameter */ - struct PLAYPara - { - int sn; - int nextSample; - int samplesPerSecond; /* audio playback speed */ - int samplesPerPacket; /* Number of samples in a packet */ - int ABsamples; /* size of client VB buffer in samples */ - int spslimit; /* QoS parameter: sps supported by the audio channel */ - }; - - /* STOP followed only by SN */ - - /* CmdSPEED parameter */ - struct SPEEDPara - { - int sn; - int samplesPerSecond; - int samplesPerPacket; /* Number of samples in a packet */ - int spslimit; - }; - - boolean init_audio (in INITaudioPara para, - out INITaudioReply reply_para); - boolean play (in PLAYPara para, out long ats); - - boolean speed (in SPEEDPara para); - - boolean stop (in long cmdsn); - - unsigned short set_peer (in string peer); - // Initializes the server to communicate to the <peer>, which can be - // "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or - // "128.252.166.57:1234"). If there is no ':' in the <address> it - // is assumed to be a port number, with the IP address being - // INADDR_ANY. - // Server returns it's UDP data port number. -}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Makefile deleted file mode 100644 index e756c22337f..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Makefile +++ /dev/null @@ -1,492 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -LIBNAME = libmpeg_shared -LIB = $(LIBNAME).a -SHLIB = $(LIBNAME).$(SOEXT) - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES = $(IDL_FILES) - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - - -#TAO_IDLFLAGS = -Wb,export_macro=TAO_ORBSVCS_Export -Wb,export_include=orbsvcs_export.h - -IDL_FILES = Video_ControlS Video_ControlC - -FILES += com fileio filters routine sendpt - -LDFLAGS += -L$(TAO_ROOT)/tao -CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG)#-H - -MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source -CPPFLAGS += -I$(MPEG_ROOT) - -LIBS += -lTAO -lACE - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -##LDFLAGS += -L$(TAO_ROOT)/tao -CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG)#-H -CPPFLAGS += -DSH_MEM -DNDEBUG - -.PRECIOUS: Video_ControlS.cpp Video_ControlC.cpp - -idl_stubs: $(addsuffix .h, $(IDL_FILES)) - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/Video_ControlS.o .obj/Video_ControlS.so .shobj/Video_ControlS.o .shobj/Video_ControlS.so: Video_ControlS.cpp Video_ControlS.h Video_ControlC.h \ - $(TAO_ROOT)/tao/corba.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(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/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(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.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.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/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/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(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 \ - Video_ControlC.i Video_ControlS.i -.obj/Video_ControlC.o .obj/Video_ControlC.so .shobj/Video_ControlC.o .shobj/Video_ControlC.so: Video_ControlC.cpp Video_ControlC.h \ - $(TAO_ROOT)/tao/corba.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i \ - $(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/Synch_T.h \ - $(ACE_ROOT)/ace/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(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.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.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/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/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(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 \ - Video_ControlC.i Video_ControlS.h Video_ControlS.i -.obj/com.o .obj/com.so .shobj/com.o .shobj/com.so: com.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i fileio.h routine.h \ - com.h -.obj/fileio.o .obj/fileio.so .shobj/fileio.o .shobj/fileio.so: fileio.cpp routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i fileio.h -.obj/filters.o .obj/filters.so .shobj/filters.o .shobj/filters.so: filters.cpp filters.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i -.obj/routine.o .obj/routine.so .shobj/routine.o .shobj/routine.so: routine.cpp routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.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/ACE.h \ - $(ACE_ROOT)/ace/Version.h \ - $(ACE_ROOT)/ace/ACE.i \ - $(ACE_ROOT)/ace/Log_Priority.h \ - $(ACE_ROOT)/ace/Log_Record.i -.obj/sendpt.o .obj/sendpt.so .shobj/sendpt.o .shobj/sendpt.so: sendpt.cpp sendpt.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_Control.idl b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_Control.idl deleted file mode 100644 index 4440e8a7923..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_Control.idl +++ /dev/null @@ -1,111 +0,0 @@ -// -*- C++ -*- - -// $Id$ - -interface Video_Control -{ - - const long VIDEO_PATTERN_SIZE = 100; - struct INITvideoPara - { - long sn; - long version; - sequence <char> videofile; - }; - - struct INITvideoReply - { - long live; - long format; - - long totalHeaders; - long totalFrames; - long totalGroups; - long horizontalSize; - long verticalSize; - long pelAspectRatio; - long pictureRate1000; - long vbvBufferSize; - long sizeIFrame; - long sizePFrame; - long sizeBFrame; - long sizeSystemHeader; - long sizeGop; - long averageFrameSize; - long firstGopFrames; - sequence <char> pattern; - }; - - /* CmdPOSITION, CmdPOSITIONrelease: followed by following parameter */ - struct POSITIONpara - { - long sn; - long nextGroup; - }; - - /* CmdSTEP: followed by following parameter */ - struct STEPpara - { - long sn; - long nextFrame; - }; - - /* CmdFF, CmdFB: followed by following parameter */ - struct FFpara - { - long sn; - long nextGroup; - long usecPerFrame; - long framesPerSecond; - long VStimeAdvance; - }; - - typedef FFpara FBpara; - - /*CmdPLAY: followed by following parameter */ - struct PLAYpara - { - long sn; - long collectStat; - long nextFrame; - long usecPerFrame; - long framesPerSecond; - long frameRateLimit1000; - long VStimeAdvance; - long sendPatternGops; - sequence <char> sendPattern; - }; - - /* CmdSPEED: parameter */ - struct SPEEDpara - { - long sn; - long usecPerFrame; - long framesPerSecond; - long frameRateLimit1000; - long sendPatternGops; - sequence <char> sendPattern; - }; - - - boolean init_video (in INITvideoPara para, - out INITvideoReply reply_para); - boolean stat_stream (out char ch, out long size); - boolean close (); - boolean stat_sent (); - boolean fast_forward (in FFpara para); - boolean fast_backward (in FFpara para); - boolean step (in STEPpara para); - boolean play (in PLAYpara para, out long vts); - boolean position (in POSITIONpara para); - boolean speed (in SPEEDpara para); - boolean stop (in long cmdsn); - - unsigned short set_peer (in string peer); - // Initializes the server to communicate to the <peer>, which can be - // "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or - // "128.252.166.57:1234"). If there is no ':' in the <address> it - // is assumed to be a port number, with the IP address being - // INADDR_ANY. - // Server returns it's UDP data port number. -}; diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.cpp deleted file mode 100644 index 7c219eb1d1b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.cpp +++ /dev/null @@ -1,2133 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ - -// #include <stdio.h> -// #include <errno.h> -// #include <stdlib.h> -// #include <sys/types.h> -// #include <unistd.h> -// #include <string.h> -// #include <netdb.h> -// #include <ctype.h> -// #include <sys/select.h> -// #include <sys/socket.h> -// #include <netinet/in.h> -// #include <netinet/tcp.h> -// #include <arpa/inet.h> -// #include <sys/un.h> -// #include <time.h> -// #include <sys/time.h> -#include "include/common.h" -#include "fileio.h" -#include "routine.h" -#include "com.h" -#include "ace/OS.h" - -#ifdef NATIVE_ATM -#include "atmcom.h" -#endif - -#define CONN_INET 1 -#define CONN_UNIX 2 -#define CONN_ATM 3 - -#define SERVER_FDTABLE_SIZE 50 -#define CLIENT_FDTABLE_SIZE 10 - -#define STATE_PENDING 1 -#define STATE_CONTROL 2 -#define STATE_DATA 3 -#define STATE_SINGLE 4 - -static int inet_port; -static char * unix_port, * atm_port; - -static struct FdTable -{ - int fd; /* -1 -- free item, >=0 -- fd value */ - int type; - unsigned stime; /* setup time, in seconds */ - int state; -} * fdTable = NULL; -static int size = 0; - -int ComInitClient(int pinet_port, char * punix_port, char * patm_port) -{ - int i; - - inet_port = pinet_port; - unix_port = punix_port; - atm_port = patm_port; - if (size) { - fprintf(stderr, - "Error ComInitClient: pid %d already done ComInitClient/Server\n", - getpid()); - return -1; - } - size = CLIENT_FDTABLE_SIZE; - fdTable = (struct FdTable *)ACE_OS::malloc(size * sizeof(*fdTable)); - if (fdTable == NULL) { - fprintf(stderr, - "Error ComInitClient: pid %d failed to allocated fdTable space:", - getpid()); - perror(""); - return -1; - } - for (i = 0; i < size; i ++) { - fdTable[i].fd = -1; - } -#ifdef NATIVE_ATM - return ATMinitClient(atm_port); -#else - return 0; -#endif -} - -void ComCloseClient(void) -{ - int i; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd >= 0) ComCloseConn(fdTable[i].fd); - } -#ifdef NATIVE_ATM - ATMcloseClient(); -#endif - return; -} - -int ComCloseFd(int fd) -{ - int i; - if (!size) { - fprintf(stderr, - "Error ComCloseFd: pid %d not done ComInitClient/Server yet.\n", - getpid()); - return -1; - } - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == fd) break; - } - if (i < size) { - fdTable[i].fd = -1; - if (fdTable[i].type == CONN_ATM) { -#ifdef NATIVE_ATM - return ATMcloseFd(fd); -#else - fprintf(stderr, - "Error ComCloseFd: pid %d CONN_ATM not supported.\n", - getpid()); - return -1; -#endif - } - else { - close(fd); - } - return 0; - } - else { - fprintf(stderr, - "Error ComCloseFd: pid %d can't find fd %d in table\n", - getpid(), fd); - return -1; - } -} - -int ComCloseConn(int fd) -{ - int i; - if (!size) { - fprintf(stderr, - "Error ComCloseConn: pid %d not done ComInitClient/Server yet.\n", - getpid()); - return -1; - } - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == fd) break; - } - if (i < size) { - fdTable[i].fd = -1; - if (fdTable[i].type == CONN_ATM) { -#ifdef NATIVE_ATM - return ATMcloseConn(fd); -#else - fprintf(stderr, - "Error ComCloseConn: pid %d CONN_ATM not supported.\n", - getpid()); - return -1; -#endif - } - else { - close(fd); - } - return 0; - } - else { - fprintf(stderr, - "Error ComCloseConn: pid %d can't find fd %d in table\n", - getpid(), fd); - return -1; - } -} - -int ComOpenConnPair(char * address, int *ctr_fd, int *data_fd, int *max_pkt_size) -{ - - // This is right now called only by the audio client. - // The protocol is slightly modified as after connecting we need to - // inform that we are a audio client so that it can fork a process. - int i; - int cfd, dfd, csocktype, dsocktype; - int conn_tag = !(*max_pkt_size); - struct sockaddr_in addressIn; - struct sockaddr_un addressUn; - - if (!size) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d not done ComInitClient/Server yet.\n", - getpid()); - return -1; - } - - cfd = 0; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) cfd ++; - } - if (cfd < 2) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d no faTable entry for the pair", - getpid()); - return -1; - } - - /* tell the type of connections to establish: - If the server is on the same host, then UNIX socket is used */ - if (address[0] == 0) { - csocktype = CONN_UNIX; - dsocktype = CONN_UNIX; - } - else if (!strncasecmp(address, "atm:", 4)) { - address += 4; - csocktype = CONN_ATM; - dsocktype = CONN_ATM; - } - else if (!strncasecmp(address, "datm:", 5)) { - address += 5; - csocktype = CONN_INET; - dsocktype = CONN_ATM; - } - else { - csocktype = CONN_INET; - dsocktype = CONN_INET; - } - if (csocktype == CONN_INET || dsocktype == CONN_INET) { - struct hostent *hp; - char hostname[100]; - addressIn.sin_family = AF_INET; - if (!strncasecmp(address, "inet:", 5)) { - address += 5; - } - if (isascii(address[0]) && isdigit(address[0])) - addressIn.sin_addr.s_addr = inet_addr(address); - else { - if ((hp = gethostbyname(address)) == NULL) { /* No such host! */ - fprintf(stderr, - "Error ComOpenConnPair: pid %d host %s can't be found:", - getpid(), address); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d host %s is not of INET type address.\n", - getpid(), address); - return -1; - } - memcpy((char *)&addressIn.sin_addr.s_addr, (char *)hp->h_addr, - sizeof(addressIn.sin_addr.s_addr)); - /* - bcopy((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr)); - */ - } - if (get_hostname(hostname, 100)) { - fprintf(stderr, "Error ComOpenConnPair: pid %d failed to get_hostname:", - getpid()); - perror(""); - return -1; - } - if ((hp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to its own IP address:", - getpid()); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d own address is not INET type", - getpid()); - return -1; - } - - if (!memcmp((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr))) { - if (csocktype == CONN_INET) csocktype = CONN_UNIX; - if (dsocktype == CONN_INET) dsocktype = CONN_UNIX; - } - } - - /* build appropriate type of Connections to Server */ - if (csocktype == CONN_UNIX && dsocktype == CONN_UNIX) { - /* build UNIX connection to server */ - addressUn.sun_family = AF_UNIX; - strncpy(addressUn.sun_path, unix_port, - sizeof(struct sockaddr_un) - sizeof(short)); - cfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open UNIX cfd:", - getpid()); - perror(""); - return -1; - } - usleep(10000); /* this is for waiting for the uncaught signal mentioned - below */ - if (connect(cfd, (struct sockaddr *)&addressUn, sizeof(addressUn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn UNIX cfd to server:", - getpid()); - perror(""); - i = -3; /* I don't understand why when connect() returns EINTR, the connection - is still built, and the other end can still get what written at - this end, 'i = -3' is a garbage to be written. */ - write(cfd, &i, 4); - close(cfd); - return -1; - } - if (time_write_int(cfd, -1) == -1 || time_read_int(cfd, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write -1 to UNIX cfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - - dfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open UNIX dfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - usleep(10000); - if (connect(dfd, (struct sockaddr *)&addressUn, sizeof(addressUn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn UNIX dfd to server:", - getpid()); - perror(""); - i = -3; - write(dfd, &i, 4); - close(cfd); - close(dfd); - return -1; - } - if (time_write_int(dfd, i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (cfd) to UNIX dfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - *max_pkt_size = 0; - } - else if (csocktype == CONN_INET && dsocktype == CONN_INET) { - /* build TCP connection to server */ - addressIn.sin_port = htons(inet_port); - cfd = socket(AF_INET, SOCK_STREAM, 0); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open TCP cfd:", - getpid()); - perror(""); - return -1; - } - usleep(10000); - if (connect(cfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn TCP cfd to server:", - getpid()); - perror(""); - i = -3; - write(cfd, &i, 4); - close(cfd); - return -1; - } - if (conn_tag) { /* create a second connection with server */ - if (time_write_int(cfd, -1) == -1 || time_read_int(cfd, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write -1 to TCP cfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - dfd = socket(AF_INET, SOCK_STREAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open TCP dfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - usleep(10000); - if (connect(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn TCP dfd to server:", - getpid()); - perror(""); - i = -3; - write(dfd, &i, 4); - close(cfd); - close(dfd); - return -1; - } - if (time_write_int(dfd, i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (cfd) to TCP dfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - *max_pkt_size = 0; - } - else { /* create a UDP socket for data */ - // Write a byte saying that we are a audio client. - - if (time_write_int(cfd,CmdINITaudio) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write -2 to TCP cfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - - dfd = socket(AF_INET, SOCK_DGRAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open UDP dfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - memset((char *)&addressIn, 0, sizeof(addressIn)); - - i = sizeof(addressIn); - if (getsockname(cfd, (struct sockaddr *)&addressIn, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to getsocketname on TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - - addressIn.sin_family = AF_INET; - addressIn.sin_port = 0; - if (bind(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to bind UDP dfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - if (time_write_int(cfd, -2) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write -2 to TCP cfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - - i = sizeof(addressIn); - if (getsockname(dfd, (struct sockaddr *)&addressIn, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to getsocketname on UDP fd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - if (time_write_bytes(cfd, (char *)&addressIn.sin_port, sizeof(short)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (port) to TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - - fprintf(stderr, "ComOpenConnPair local UDP socket: addr - %s,%d, port - %u.\n", - inet_ntoa(addressIn.sin_addr), addressIn.sin_addr.s_addr,ntohs(addressIn.sin_port)); - - - fprintf(stderr, "ComOpenConnPair UDP port %d (should be > 0)\n", - ntohs(addressIn.sin_port)); - - /* - i = sizeof(addressIn); - if (getsockname(cfd, (struct sockaddr *)&addressIn, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to getsocketname on TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - */ - if (time_write_bytes(cfd, (char *)&addressIn.sin_addr.s_addr, sizeof(int)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (IP addr) to TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - - fprintf(stderr, "ComOpenConnPair TCP cfd socket: addr - %s, port - %u.\n", - inet_ntoa(addressIn.sin_addr), ntohs(addressIn.sin_port)); - - if (time_read_bytes(cfd, (char *)&addressIn.sin_port, sizeof(short)) == -1 || - time_read_bytes(cfd, (char *)&addressIn.sin_addr.s_addr, sizeof(int)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to read (IP addr/port) from TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - usleep(10000); - if (connect(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed conn UDP dfd to peer:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - - fprintf(stderr, "ComOpenConnPair UDP dfd connects to host-%s (port %u)\n", - inet_ntoa(addressIn.sin_addr), - ntohs(addressIn.sin_port)); - -#ifndef LINUX - /* adjust the dfd REVBUF size */ - { - int len; - len = INET_SOCKET_BUFFER_SIZE + 100; - /* - if (setsockopt(dfd, SOL_SOCKET, SO_SNDBUF, (char *)&len, sizeof(len)) == -1) { - fprintf(stderr, - "Warning ComOpenConnPair: pid %d failed to set UDP dfd-snd to size %d:", - getpid(), len); - perror(""); - close(dfd); - close(cfd); - return -1; - } - */ - len = 65536; - while (setsockopt(dfd, SOL_SOCKET, SO_RCVBUF, (char *)&len, sizeof(len)) == -1) { - len -= 1024; - if (len < 8192) break; - /* - fprintf(stderr, - "Warning ComOpenConnPair: pid %d failed to set UDP dfd-rcv to size %d:", - getpid(), len); - perror(""); - close(dfd); - close(cfd); - return -1; - */ - } - if (getuid() == DEVELOPER_UID) - fprintf(stderr, "Set UDP dfd-rcv to %dB\n", len); - } -#endif - *max_pkt_size = - INET_SOCKET_BUFFER_SIZE; - /* UDP sockets on HP and SUN are discard mode */ - } - if (setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, - (const char *)&i, sizeof(i)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to setsockopt on TCP cfd with TCP_NODELAY:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - } - else if (dsocktype == CONN_ATM) { /* CONN_ATM */ -#ifdef NATIVE_ATM - if (csocktype == CONN_INET) { - /* build TCP connection to server */ - addressIn.sin_port = htons(inet_port); - cfd = socket(AF_INET, SOCK_STREAM, 0); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open TCP1 cfd:", - getpid()); - perror(""); - return -1; - } - usleep(10000); - if (connect(cfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn TCP1 cfd to server:", - getpid()); - perror(""); - i = -3; - write(cfd, &i, 4); - close(cfd); - return -1; - } - } - else if (csocktype == CONN_UNIX) { - /* build UNIX connection to server */ - addressUn.sun_family = AF_UNIX; - strncpy(addressUn.sun_path, unix_port, - sizeof(struct sockaddr_un) - sizeof(short)); - cfd = socket(AF_UNIX, SOCK_STREAM, 0); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open UNIX1 cfd:", - getpid()); - perror(""); - return -1; - } - usleep(10000); /* this is for waiting for the uncaught signal mentioned - below */ - if (connect(cfd, (struct sockaddr *)&addressUn, sizeof(addressUn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn UNIX1 cfd to server:", - getpid()); - perror(""); - i = -3; /* I don't understand why when select() returns EINTR, the connection - is still built, and the other end can still get what written at - this end, 'i = -3' is a garbage to be written. */ - write(cfd, &i, 4); - close(cfd); - return -1; - } - } - else { /* CONN_ATM */ - cfd = ATMopenConn(address, max_pkt_size); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open ATM cfd conn:", - getpid()); - perror(""); - return -1; - } - usleep(100000); /* be nice to buggy ATM driver */ - } - if (time_write_int(cfd, -1) == -1 || time_read_int(cfd, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write -1 to %s cfd:", - getpid(), - (csocktype == CONN_UNIX) ? "UNIX1" : - (csocktype == CONN_INET) ? "INET1" : "ATM"); - perror(""); - if (csocktype == CONN_ATM) ATMcloseConn(cfd); - else close(cfd); - return -1; - } - - dfd = ATMopenConn(address, max_pkt_size); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open ATM dfd conn:", - getpid()); - perror(""); - ATMcloseConn(cfd); - return -1; - } - usleep(100000); /* be nice to buggy ATM driver */ - if (time_write_int(dfd, i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (cfd) to ATM dfd:", - getpid()); - perror(""); - ATMcloseConn(cfd); - ATMcloseConn(dfd); - return -1; - } -#else - fprintf(stderr, - "Error ComOpenConnPair: pid %d addresstype %d not supported\n", - getpid(), dsocktype); - return -1; -#endif - } - for (i = 0; i < size; i ++) { /* guaranteed to succeed */ - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = cfd; - fdTable[i].type = csocktype; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_CONTROL; - } - else { - fprintf(stderr, "<Weird>Error ComOpenConnPair: no entry for cfd %d\n", cfd); - return -1; - } - for (; i < size; i ++) { - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = dfd; - fdTable[i].type = dsocktype; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_DATA; - } - else { - fprintf(stderr, "<Wierd>Error ComOpenConnPair: no entry for dfd %d\n", dfd); - return -1; - } - *ctr_fd = cfd; - *data_fd = dfd; - ACE_DEBUG ((LM_DEBUG,"(%P|%t)Returning from ComOpenConnpair\n")); - return 0; -} - -/* address format: [ATM:|INET:]real_address | "" - - "" -- UNIX socket, reliable byte stream - [INET:]real_address -- INET sockets, reliable control byte stream, and - *max_pkt_size == 0 : reliable data byte stream, or - != 0 : unreliable packet stream; - ATM:real_address -- ATM sockets, both data and control are - unreliable packet streams; - DATM:real_address -- INET/UNIX control reliable byte stream - and ATM unreliable byte stream; - - Communication between client and server: - - ctr_fd: client --> server server --> client - -2: conn-less INET Open udp sock, send addr in net byte order - <port, addr> <port(short), addr(long)> - -1: conn-orient Send value of fd, wait to be paired - cfd>=0: data sock Paired with cfd and return. - */ - -#if 0 -int VideoComOpenConnPair (char * address, - int *ctr_fd, - int *data_fd, - int *max_pkt_size) -{ - int i; - int cfd, dfd, csocktype, dsocktype; - int conn_tag = !(*max_pkt_size); - struct sockaddr_in addressIn; - struct sockaddr_un addressUn; - - ACE_DEBUG ((LM_DEBUG, - "%s %d\n", - __FILE__,__LINE__)); - - if (!size) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d not done ComInitClient/Server yet.\n", - getpid()); - return -1; - } - - cfd = 0; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) cfd ++; - } - if (cfd < 2) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d no faTable entry for the pair", - getpid()); - return -1; - } - - /* tell the type of connections to establish: - If the server is on the same host, then UNIX socket is used */ - if (address[0] == 0) { - csocktype = CONN_UNIX; - dsocktype = CONN_UNIX; - } - else if (!strncasecmp(address, "atm:", 4)) { - address += 4; - csocktype = CONN_ATM; - dsocktype = CONN_ATM; - } - else if (!strncasecmp(address, "datm:", 5)) { - address += 5; - csocktype = CONN_INET; - dsocktype = CONN_ATM; - } - else { - csocktype = CONN_INET; - dsocktype = CONN_INET; - } - if (csocktype == CONN_INET || dsocktype == CONN_INET) { - struct hostent *hp; - char hostname[100]; - addressIn.sin_family = AF_INET; - if (!strncasecmp(address, "inet:", 5)) { - address += 5; - } - if (isascii(address[0]) && isdigit(address[0])) - addressIn.sin_addr.s_addr = inet_addr(address); - else { - if ((hp = gethostbyname(address)) == NULL) { /* No such host! */ - fprintf(stderr, - "Error ComOpenConnPair: pid %d host %s can't be found:", - getpid(), address); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d host %s is not of INET type address.\n", - getpid(), address); - return -1; - } - memcpy((char *)&addressIn.sin_addr.s_addr, (char *)hp->h_addr, - sizeof(addressIn.sin_addr.s_addr)); - /* - bcopy((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr)); - */ - } - if (get_hostname(hostname, 100)) { - fprintf(stderr, "Error ComOpenConnPair: pid %d failed to get_hostname:", - getpid()); - perror(""); - return -1; - } - if ((hp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to its own IP address:", - getpid()); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d own address is not INET type", - getpid()); - return -1; - } - - if (!memcmp((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr))) { - if (csocktype == CONN_INET) csocktype = CONN_UNIX; - if (dsocktype == CONN_INET) dsocktype = CONN_UNIX; - } - } - - /* build appropriate type of Connections to Server */ - - if (csocktype == CONN_INET && dsocktype == CONN_INET) { - /* build TCP connection to server */ - addressIn.sin_port = htons(inet_port); - cfd = socket(AF_INET, SOCK_STREAM, 0); - if (cfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open TCP cfd:", - getpid()); - perror(""); - return -1; - } - usleep(10000); - if (connect(cfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn TCP cfd to server:", - getpid()); - perror(""); - i = -3; - write(cfd, &i, 4); - close(cfd); - return -1; - } -// if (conn_tag) { /* create a second connection with server */ -// if (time_write_int(cfd, -1) == -1 || time_read_int(cfd, &i) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write -1 to TCP cfd:", -// getpid()); -// perror(""); -// close(cfd); -// return -1; -// } - dfd = socket(AF_INET, SOCK_STREAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open TCP dfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - usleep(10000); - if (connect(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to conn TCP dfd to server:", - getpid()); - perror(""); - i = -3; - write(dfd, &i, 4); - close(cfd); - close(dfd); - return -1; - } - if (time_write_int(dfd, i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to write (cfd) to TCP dfd:", - getpid()); - perror(""); - close(cfd); - close(dfd); - return -1; - } - *max_pkt_size = 0; - } - else { /* create a UDP socket for data */ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) ::VideoComOpenConnPair: making UDP connection\n")); - dfd = socket(AF_INET, SOCK_DGRAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to open UDP dfd:", - getpid()); - perror(""); - close(cfd); - return -1; - } - memset((char *)&addressIn, 0, sizeof(addressIn)); - - i = sizeof(addressIn); - if (getsockname(cfd, (struct sockaddr *)&addressIn, &i) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to getsocketname on TCP cfd:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - -// addressIn.sin_family = AF_INET; -// addressIn.sin_port = 0; -// if (bind(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to bind UDP dfd:", -// getpid()); -// perror(""); -// close(cfd); -// close(dfd); -// return -1; -// } -// if (time_write_int(cfd, -2) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write -2 to TCP cfd:", -// getpid()); -// perror(""); -// close(cfd); -// close(dfd); -// return -1; -// } - -// i = sizeof(addressIn); -// if (getsockname(dfd, (struct sockaddr *)&addressIn, &i) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to getsocketname on UDP fd:", -// getpid()); -// perror(""); -// close(dfd); -// close(cfd); -// return -1; -// } -// if (time_write_bytes(cfd, (char *)&addressIn.sin_port, sizeof(short)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write (port) to TCP cfd:", -// getpid()); -// perror(""); -// close(dfd); -// close(cfd); -// return -1; -// } - -// fprintf(stderr, "ComOpenConnPair local UDP socket: addr - %s, port - %u.\n", -// inet_ntoa(addressIn.sin_addr), ntohs(addressIn.sin_port)); - - -// fprintf(stderr, "ComOpenConnPair UDP port %d (should be > 0)\n", -// ntohs(addressIn.sin_port)); - -// /* -// i = sizeof(addressIn); -// if (getsockname(cfd, (struct sockaddr *)&addressIn, &i) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to getsocketname on TCP cfd:", -// getpid()); -// perror(""); -// close(dfd); -// close(cfd); -// return -1; -// } -// */ -// if (time_write_bytes(cfd, (char *)&addressIn.sin_addr.s_addr, sizeof(int)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write (IP addr) to TCP cfd:", -// getpid()); -// perror(""); -// close(dfd); -// close(cfd); -// return -1; -// } - -// fprintf(stderr, "ComOpenConnPair TCP cfd socket: addr - %s, port - %u.\n", -// inet_ntoa(addressIn.sin_addr), ntohs(addressIn.sin_port)); - -// if (time_read_bytes(cfd, (char *)&addressIn.sin_port, sizeof(short)) == -1 || -// time_read_bytes(cfd, (char *)&addressIn.sin_addr.s_addr, sizeof(int)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to read (IP addr/port) from TCP cfd:", -// getpid()); -// perror(""); -// close(dfd); -// close(cfd); - // return -1; - // } - // usleep(10000); - // if (connect(dfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - // fprintf(stderr, - // "Error ComOpenConnPair: pid %d failed conn UDP dfd to peer:", - // getpid()); - // perror(""); - // close(cfd); - // close(dfd); - // return -1; - // } - - fprintf(stderr, "ComOpenConnPair UDP dfd connects to host-%s (port %u)\n", - inet_ntoa(addressIn.sin_addr), - ntohs(addressIn.sin_port)); - -#ifndef LINUX - /* adjust the dfd REVBUF size */ - { - int len; - len = INET_SOCKET_BUFFER_SIZE + 100; - /* - if (setsockopt(dfd, SOL_SOCKET, SO_SNDBUF, (char *)&len, sizeof(len)) == -1) { - fprintf(stderr, - "Warning ComOpenConnPair: pid %d failed to set UDP dfd-snd to size %d:", - getpid(), len); - perror(""); - close(dfd); - close(cfd); - return -1; - } - */ - len = 65536; - while (setsockopt(dfd, SOL_SOCKET, SO_RCVBUF, (char *)&len, sizeof(len)) == -1) { - len -= 1024; - if (len < 8192) break; - /* - fprintf(stderr, - "Warning ComOpenConnPair: pid %d failed to set UDP dfd-rcv to size %d:", - getpid(), len); - perror(""); - close(dfd); - close(cfd); - return -1; - */ - } - if (getuid() == DEVELOPER_UID) - fprintf(stderr, "Set UDP dfd-rcv to %dB\n", len); - } -#endif - *max_pkt_size = - INET_SOCKET_BUFFER_SIZE; - /* UDP sockets on HP and SUN are discard mode */ - } - if (setsockopt(cfd, IPPROTO_TCP, TCP_NODELAY, - (const char *)&i, sizeof(i)) == -1) { - fprintf(stderr, - "Error ComOpenConnPair: pid %d failed to setsockopt on TCP cfd with TCP_NODELAY:", - getpid()); - perror(""); - close(dfd); - close(cfd); - return -1; - } - // } -// else if (dsocktype == CONN_ATM) { /* CONN_ATM */ -// #ifdef NATIVE_ATM -// if (csocktype == CONN_INET) { -// /* build TCP connection to server */ -// addressIn.sin_port = htons(inet_port); -// cfd = socket(AF_INET, SOCK_STREAM, 0); -// if (cfd == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to open TCP1 cfd:", -// getpid()); -// perror(""); -// return -1; -// } -// usleep(10000); -// if (connect(cfd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to conn TCP1 cfd to server:", -// getpid()); -// perror(""); -// i = -3; -// write(cfd, &i, 4); -// close(cfd); -// return -1; -// } -// } -// else if (csocktype == CONN_UNIX) { -// /* build UNIX connection to server */ -// addressUn.sun_family = AF_UNIX; -// strncpy(addressUn.sun_path, unix_port, -// sizeof(struct sockaddr_un) - sizeof(short)); -// cfd = socket(AF_UNIX, SOCK_STREAM, 0); -// if (cfd == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to open UNIX1 cfd:", -// getpid()); -// perror(""); -// return -1; -// } -// usleep(10000); /* this is for waiting for the uncaught signal mentioned -// below */ -// if (connect(cfd, (struct sockaddr *)&addressUn, sizeof(addressUn)) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to conn UNIX1 cfd to server:", -// getpid()); -// perror(""); -// i = -3; /* I don't understand why when select() returns EINTR, the connection -// is still built, and the other end can still get what written at -// this end, 'i = -3' is a garbage to be written. */ -// write(cfd, &i, 4); -// close(cfd); -// return -1; -// } -// } -// else { /* CONN_ATM */ -// cfd = ATMopenConn(address, max_pkt_size); -// if (cfd == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to open ATM cfd conn:", -// getpid()); -// perror(""); -// return -1; -// } -// usleep(100000); /* be nice to buggy ATM driver */ -// } -// if (time_write_int(cfd, -1) == -1 || time_read_int(cfd, &i) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write -1 to %s cfd:", -// getpid(), -// (csocktype == CONN_UNIX) ? "UNIX1" : -// (csocktype == CONN_INET) ? "INET1" : "ATM"); -// perror(""); -// if (csocktype == CONN_ATM) ATMcloseConn(cfd); -// else close(cfd); -// return -1; -// } - -// dfd = ATMopenConn(address, max_pkt_size); -// if (dfd == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to open ATM dfd conn:", -// getpid()); -// perror(""); -// ATMcloseConn(cfd); -// return -1; -// } -// usleep(100000); /* be nice to buggy ATM driver */ -// if (time_write_int(dfd, i) == -1) { -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d failed to write (cfd) to ATM dfd:", -// getpid()); -// perror(""); -// ATMcloseConn(cfd); -// ATMcloseConn(dfd); -// return -1; -// } -// #else -// fprintf(stderr, -// "Error ComOpenConnPair: pid %d addresstype %d not supported\n", -// getpid(), dsocktype); -// return -1; -// #endif -// } - for (i = 0; i < size; i ++) { /* guaranteed to succeed */ - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = cfd; - fdTable[i].type = csocktype; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_CONTROL; - } - else { - fprintf(stderr, "<Weird>Error ComOpenConnPair: no entry for cfd %d\n", cfd); - return -1; - } - for (; i < size; i ++) { - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = dfd; - fdTable[i].type = dsocktype; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_DATA; - } - else { - fprintf(stderr, "<Wierd>Error ComOpenConnPair: no entry for dfd %d\n", dfd); - return -1; - } - *ctr_fd = cfd; - *data_fd = dfd; - return 0; -} -#endif - -/* returns: -1 -- failed, >=0 -- fd */ -int ComOpenConn(char * address, int *max_pkt_size) -{ - int i; - int fd, socktype; - struct sockaddr_in addressIn; - struct sockaddr_un addressUn; - - if (!size) { - fprintf(stderr, - "Error ComOpenConn: pid %d not done ComInitClient/Server yet.\n", - getpid()); - return -1; - } - - fd = 0; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) fd ++; - } - if (fd < 1) { - fprintf(stderr, - "Error ComOpenConn: pid %d no faTable entry for the pair", - getpid()); - return -1; - } - - /* tell the type of connections to establish: - If the server is on the same host, then UNIX socket is used */ - if (address[0] == 0) { - socktype = CONN_UNIX; - } - else if (!strncasecmp(address, "atm:", 4)) { - address += 4; - socktype = CONN_ATM; - } - else if (!strncasecmp(address, "datm:", 5)) { - address += 5; - socktype = CONN_ATM; - } - else { - socktype = CONN_INET; - } - if (socktype == CONN_INET) { - struct hostent *hp; - char hostname[100]; - addressIn.sin_family = AF_INET; - if (!strncasecmp(address, "inet:", 5)) { - address += 5; - } - if (isascii(address[0]) && isdigit(address[0])) - addressIn.sin_addr.s_addr = inet_addr(address); - else { - if ((hp = gethostbyname(address)) == NULL) { /* No such host! */ - fprintf(stderr, - "Error ComOpenConn: pid %d host %s can't be found:", - getpid(), address); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConn: pid %d host %s is not of INET type address.\n", - getpid(), address); - return -1; - } - memcpy((char *)&addressIn.sin_addr.s_addr, (char *)hp->h_addr, - sizeof(addressIn.sin_addr.s_addr)); - /* - bcopy((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr)); - */ - } - if (get_hostname(hostname, 100)) { - fprintf(stderr, "Error ComOpenConn: pid %d failed to get_hostname:", - getpid()); - perror(""); - return -1; - } - if ((hp = gethostbyname(hostname)) == NULL) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to its own IP address:", - getpid()); - perror(""); - return -1; - } - if (hp->h_addrtype != AF_INET) { - fprintf(stderr, - "Error ComOpenConn: pid %d own address is not INET type", - getpid()); - return -1; - } - - if (!memcmp((char *)hp->h_addr, (char *)&addressIn.sin_addr.s_addr, - sizeof(addressIn.sin_addr.s_addr))) { - if (socktype == CONN_INET) socktype = CONN_UNIX; - } - } - - /* build appropriate type of Connections to Server */ - if (socktype == CONN_UNIX) { - /* build UNIX connection to server */ - addressUn.sun_family = AF_UNIX; - strncpy(addressUn.sun_path, unix_port, - sizeof(struct sockaddr_un) - sizeof(short)); - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to open UNIX fd:", - getpid()); - perror(""); - return -1; - } - if (connect(fd, (struct sockaddr *)&addressUn, sizeof(addressUn)) == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to conn UNIX fd to server:", - getpid()); - perror(""); - close(fd); - return -1; - } - *max_pkt_size = 0; - } - else if (socktype == CONN_INET) { - /* build TCP connection to server */ - addressIn.sin_port = htons(inet_port); - fd = socket(AF_INET, SOCK_STREAM, 0); - if (fd == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to open TCP fd:", - getpid()); - perror(""); - return -1; - } - if (connect(fd, (struct sockaddr *)&addressIn, sizeof(addressIn)) == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to conn TCP fd to server:", - getpid()); - perror(""); - close(fd); - return -1; - } - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, - (const char *)&i, sizeof(i)) == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to setsockopt on TCP fd with TCP_NODELAY:", - getpid()); - perror(""); - close(fd); - return -1; - } - *max_pkt_size = 0; - } - else if (socktype == CONN_ATM) { /* CONN_ATM */ -#ifdef NATIVE_ATM - /* CONN_ATM */ - fd = ATMopenConn(address, max_pkt_size); - if (fd == -1) { - fprintf(stderr, - "Error ComOpenConn: pid %d failed to open ATM fd conn:", - getpid()); - perror(""); - return -1; - } -#else - fprintf(stderr, - "Error ComOpenConn: pid %d addresstype %d not supported\n", - getpid(), socktype); - return -1; -#endif - } - for (i = 0; i < size; i ++) { /* guaranteed to succeed */ - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = fd; - fdTable[i].type = socktype; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_SINGLE; - return fd; - } - else { - fprintf(stderr, "<Weird>Error ComOpenConn: no entry for fd %d\n", fd); - return -1; - } -} - - -static int fd_unix, fd_inet, fd_atm; /* for use in the server side */ - - -int ComInitServer(int pinet_port, char * punix_port, char * patm_port) -{ - int i; - - struct sockaddr_in myaddr_in; - struct sockaddr_un myaddr_un; - - inet_port = pinet_port; - unix_port = punix_port; - atm_port = patm_port; - - if (size) { - fprintf(stderr, - "Error ComInitServer: pid %d already done ComInitServer/Server\n", - getpid()); - return -1; - } - size = CLIENT_FDTABLE_SIZE; - // create and initialize the File Descriptor Table - fdTable = (struct FdTable *)ACE_OS::malloc(size * sizeof(*fdTable)); - if (fdTable == NULL) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to allocated fdTable space:", - getpid()); - perror(""); - return -1; - } - for (i = 0; i < size; i ++) { - fdTable[i].fd = -1; - } - // Set all the file descriptor for atm ,inet and unix to be -1 - fd_atm = fd_inet = fd_unix = -1; - - memset((char *)&myaddr_in, 0, sizeof(struct sockaddr_in)); - memset((char *)&myaddr_un, 0, sizeof(struct sockaddr_un)); - - myaddr_in.sin_family = AF_INET; - - myaddr_in.sin_addr.s_addr = htonl(INADDR_ANY); - myaddr_in.sin_port = htons((short)inet_port); - - /* setup INET listen socket */ - fd_inet = socket(AF_INET, SOCK_STREAM, 0); - if (fd_inet == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to open fd_inet:", - getpid()); - perror(""); - goto open_fd_unix; - } - - i = 1; - if (setsockopt(fd_inet, SOL_SOCKET, SO_REUSEADDR, - (const char *)&i, sizeof(i)) == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to setsockopt fd_inet with REUSEADDR:", - getpid()); - perror(""); - close(fd_inet); - fd_inet = -1; - goto open_fd_unix; - } - - if (bind(fd_inet, (struct sockaddr *)&myaddr_in, sizeof(struct sockaddr_in)) == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to bind fd_inet:", - getpid()); - perror(""); - close(fd_inet); - fd_inet = -1; - goto open_fd_unix; - } - if (listen(fd_inet, 2) == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to listen on fd_inet:", - getpid()); - perror(""); - close(fd_inet); - fd_inet = -1; - goto open_fd_unix; - } - - open_fd_unix: - - myaddr_un.sun_family = AF_UNIX; - strncpy(myaddr_un.sun_path, unix_port, - (sizeof(struct sockaddr_un) - sizeof(short))); - fd_unix = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd_unix == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to open fd_unix:", - getpid()); - perror(""); - goto open_fd_atm; - } - if ((bind(fd_unix, (struct sockaddr *)&myaddr_un, - sizeof(struct sockaddr_un))) == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to bind fd_unix:", - getpid()); - perror(""); - close(fd_unix); - fd_unix = -1; - goto open_fd_atm; - } - if ((listen(fd_unix, 2)) == -1) { - fprintf(stderr, - "Error ComInitServer: pid %d failed to liston on fd_unix:", - getpid()); - perror(""); - close(fd_unix); - fd_unix = -1; - goto open_fd_atm; - } - - open_fd_atm: - -#ifdef NATIVE_ATM - fd_atm = ATMinitServer(atm_port); -#endif - - if (fd_inet >= 0 || fd_unix >= 0 || fd_atm >= 0) return 0; - else return -1; -} - -void ComCloseListen(void) -{ - if (fd_atm >= 0) { -#ifdef NATIVE_ATM - /* fd_atm is not connected to a user_plane, ignore - ATMcloseFd(fd_atm); - */ - close(fd_atm); - fd_atm = -1; -#else - fprintf(stderr, "Error ComCloseListen: CONN_ATM not supported.\n"); -#endif - } - if (fd_unix >= 0) { - close(fd_unix); - fd_unix = -1; - } - if (fd_inet >= 0) { - close(fd_inet); - fd_inet = -1; - } - return; -} - -void ComCloseServer(void) -{ - int i; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd >= 0) ComCloseConn(fdTable[i].fd); - } - if (fd_atm >= 0) { -#ifdef NATIVE_ATM - /* fd_atm not connected to a user-plane, igore it - ATMcloseConn(fd_atm); - */ - close(fd_atm); - fd_atm = -1; -#else - fprintf(stderr, "Error ComCloseServer: CONN_ATM not supported.\n"); -#endif - } - if (fd_unix >= 0) { - close(fd_unix); - fd_unix = -1; - unlink(unix_port); - } - if (fd_inet >= 0) { - close(fd_inet); - fd_inet = -1; - } -#ifdef NATIVE_ATM - ATMcloseServer(); -#endif - return; -} - -static int change_option(int fd) -{ - struct linger linger = {1, 1}; - int i = 1; - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, - (const char *)&i, sizeof(i)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to setsockopt on fd_inet:", - getpid()); - perror(""); - return -1; - } - /* data socket also NODELAY */ - if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (const char *)&linger, - sizeof(linger)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to linger on fd_inet:", - getpid()); - perror(""); - return -1; - } - return 0; -} - -int ComGetConnPair(int *ctr_fd, int *data_fd, int *max_pkt_size) -{ - int i; - int fd, fdType; - int addrlen; - struct sockaddr_in peeraddr_in; - struct fd_set read_mask; - struct timeval tval; - int nfds; - - fd = 0; - addrlen = get_sec(); - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) { - fd ++; - } - else if (fdTable[i].type == STATE_PENDING && - get_duration(fdTable[i].stime, addrlen) > 10) { - fprintf(stderr, - "ComGetConnPair: pid %d closed fd %d (PENDING >= 10 sec)\n", - getpid(), fdTable[i].fd); - ComCloseConn(fdTable[i].fd); - fdTable[i].fd = -1; - fd ++; - } - } - if (fd < 2) { - fprintf(stderr, - "Error ComGetConnPair: pid %d no faTable entry for the pair", - getpid()); - return -1; - } - - FD_ZERO(&read_mask); - if (fd_inet >= 0) FD_SET(fd_inet, &read_mask); - if (fd_unix >= 0) FD_SET(fd_unix, &read_mask); - if (fd_atm >= 0) FD_SET(fd_atm, &read_mask); - - tval.tv_sec = 1; /* wait at most 1 second */ - tval.tv_usec = 0; - - - nfds = fd_inet; - if (fd_unix > nfds) nfds = fd_unix; - if (fd_atm > nfds) nfds = fd_atm; - // nfds now holds the highest numbered open file descriptor - nfds ++; // increment so that select can use o to nfds -1 no. of - // file descriptors. - errno = 0; - // fd is here used as the result of the select call -#ifdef _HPUX_SOURCE - if ((fd = select(nfds, (int *)&read_mask, NULL, NULL, &tval)) == -1) -#else - if ((fd = select(nfds, &read_mask, NULL, NULL, &tval)) == -1) -#endif - { - - if (errno == EINTR) return -1; - - fprintf(stderr, - "Error ComGetConnPair: pid %d failed on select():", - getpid()); - perror(""); - return -1; - } - if (fd == 0) return -1; /* time expire */ - - fd = -1; - // fd will be reused inside this code as the accepted socket. - if (fd == -1 && fd_unix >= 0 && FD_ISSET(fd_unix, &read_mask)) { - struct sockaddr_un peeraddr_un; - - fprintf(stderr, "Server to accept a UNIX connection.\n"); - - addrlen = sizeof(struct sockaddr_un); - fd = accept(fd_unix, (struct sockaddr *)&peeraddr_un, &addrlen); - if (fd == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to accpet on fd_unix:", - getpid()); - perror(""); - } - else fdType = CONN_UNIX; - *max_pkt_size = 0; - } - // fd here is the result of the accept for unix if fd_unix is valid - // Hence if fd_unix is present then this won't be called if the - // accept for the fd_unix succeeds. - if (fd == -1 && fd_inet >= 0 && FD_ISSET(fd_inet, &read_mask)) { - - fprintf(stderr, "Server to accept a INET connection.\n"); - - addrlen = sizeof(struct sockaddr_in); - fd = accept(fd_inet, (struct sockaddr *)&peeraddr_in, &addrlen); - if (fd == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to accpet on fd_inet:", - getpid()); - perror(""); - } - else fdType = CONN_INET; - *max_pkt_size = 0; - } - if (fd == -1 && fd_atm >= 0 && FD_ISSET(fd_atm, &read_mask)) { -#ifdef NATIVE_ATM - fd = ATMaccept(fd_atm, max_pkt_size); - fdType = CONN_ATM; -#else - fprintf(stderr, - "Error ComGetConnPair: pid %d CONN_ATM not supported.\n", - getpid()); -#endif - } - // fd = -1 implies accept failed in any of the active connections - // which came out of the select call. - if (fd == -1) return -1; - - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) break; - } - // Enter the accepted fd in the file descriptor Table - if (i < size) { - fdTable[i].fd = fd; - fdTable[i].type = fdType; - fdTable[i].stime = get_sec(); - } - else { - fprintf(stderr, "Weird\n"); - } - - // read the port number for the UDP socket of the client - if (time_read_int(fd, &nfds) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to read int from %s fd:", - getpid(), - fdType == CONN_ATM ? "ATM" : - fdType == CONN_INET ? "INET" : "UNIX"); - perror(""); - ComCloseConn(fd); - return -1; - } - fprintf (stderr, - " Received int nfds = %d \n", - nfds); - // nfds holds the int read in time_read_int - // if nfds is -1 then read int error. - fprintf(stderr, "ComGetConnPair got %s fd = %d with value %d\n", - fdType == CONN_ATM ? "ATM" : - fdType == CONN_INET ? "INET" : "UNIX", - fd, nfds); - - if (nfds >= 0) { /* can be paired and return */ - // This is the success case where you got a control fd and a data fd. - fdTable[i].state = STATE_DATA; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == nfds) break; - } - if (i < size && fdTable[i].state == STATE_PENDING) { - fdTable[i].state = STATE_CONTROL; - } - else { - if (i >= 0) fprintf(stderr, "<Weird> i %d\n", i); - ComCloseConn(fd); - return -1; - } - // ???? - *ctr_fd = fdTable[i].fd; - *data_fd = fd; - return 0; - } - else if (nfds == -1) { /* wait to be paired */ - fdTable[i].state = STATE_PENDING; - // fd is the inet or unix accepted socket. - // why is anyone writing the fd to the peer? - // looks like he is indicating an error to the client!! - // is this a hack ;-( - if (time_write_int(fd, fd) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to write (fd) to %s fd:", - getpid(), - fdType == CONN_ATM ? "ATM" : - fdType == CONN_INET ? "INET" : "UNIX"); - perror(""); - ComCloseConn(fd); - return -1; - } - if (fdType == CONN_INET && change_option(fd) == -1) { - ComCloseConn(fd); - } - return -1; - } - else if (nfds == -2) { /* inet case only, UDP data sock is requested */ - int dfd; - struct sockaddr_in * in = &(peeraddr_in); - - fdTable[i].state = STATE_CONTROL; - - if (fdType == CONN_INET && change_option(fd) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to change options of TCP cfd:", - getpid()); - ComCloseConn(fd); - return -1; - } - - dfd = socket(AF_INET, SOCK_DGRAM, 0); - if (dfd == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to open dfd:", - getpid()); - perror(""); - ComCloseConn(fd); - return -1; - } - memset((char *)in, 0, sizeof(* in)); - - addrlen = sizeof(*in); - if (getsockname(fd, (struct sockaddr *)in, &addrlen) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to getsockname of fd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - - in->sin_family = AF_INET; - in->sin_port = 0; - /* - in->sin_addr.s_addr = htonl(INADDR_ANY); - */ - if (bind(dfd, (struct sockaddr *)in, sizeof(* in)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to bind dfd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - addrlen = sizeof(*in); - if (getsockname(dfd, (struct sockaddr *)in, &addrlen) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to getsockname of dfd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - if (time_write_bytes(fd, (char *)&in->sin_port, sizeof(short)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to write (dfd.port) to fd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - /* - addrlen = sizeof(*in); - if (getsockname(fd, (struct sockaddr *)in, &addrlen) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to getsockname of fd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - */ - if (time_write_bytes(fd, (char *)&in->sin_addr.s_addr, sizeof(int)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to write (dfd.IPaddr) to fd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - - fprintf(stderr, "ComGetConnPair local UDP socket: addr - %s, port - %u.\n", - inet_ntoa(in->sin_addr), ntohs(in->sin_port)); - - if (time_read_bytes(fd, (char *)&in->sin_port, sizeof(short)) == -1 || - time_read_bytes(fd, (char *)&in->sin_addr.s_addr, sizeof(int)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to read (port, IPaddr) from fd:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - usleep(10000); - if (connect(dfd, (struct sockaddr *)in, sizeof(*in)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed conn UDP dfd to peer:", - getpid()); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } -#if 0 - { - int len; - len = 65536; /* INET_SOCKET_BUFFER_SIZE + 100; */ - /* - if (setsockopt(dfd, SOL_SOCKET, SO_SNDBUF, (char *)&len, sizeof(len)) == -1) { - fprintf(stderr, - "Error ComGetConnPair: pid %d failed to set UDP dfd-snd to size %d:", - getpid(), len); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - } - */ - len = 65536; - while (setsockopt(dfd, SOL_SOCKET, SO_RCVBUF, (char *)&len, sizeof(len)) == -1) { - len -= 1024; - if (len < 8192) break; - /* - fprintf(stderr, - "Warning ComGetConnPair: pid %d failed to set UDP dfd-rcv to size %d:", - getpid(), len); - perror(""); - ComCloseConn(fd); - close(dfd); - return -1; - */ - } - if (getuid() == DEVELOPER_UID) - fprintf(stderr,"Set UDP dfd-rcv to %dB\n", len); - } -#endif - // Most common return case where the server creates a UDP socket , - // writes the port and ip addr and also gets the client's UDP - // endpoint . - *max_pkt_size = - INET_SOCKET_BUFFER_SIZE; /* UDP sockets on HP and SUN - are known to be discard mode */ - - fprintf(stderr, "ComGetConnPair UDP dfd connects to host-%s (port %u)\n", - inet_ntoa(in->sin_addr), ntohs(in->sin_port)); - - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = dfd; - fdTable[i].type = CONN_INET; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_DATA; - - *ctr_fd = fd; - *data_fd = dfd; - return 0; - } - else { - fprintf(stderr, "ComGetConnPair <Weird>: no space left\n"); - return -1; - } - } - else { - fprintf(stderr, - "Error ComGetConnPair: pid %d get invalid value %d from fd\n", - getpid(), nfds); - ComCloseConn(fd); - } - return -1; -} - -/* returns: -1 -- failed, >= 0 -- fd */ -int ComGetConn(int *max_pkt_size) -{ - int i; - int fd, fdType; - int addrlen; - struct fd_set read_mask; - struct timeval tval; - int nfds; - - fd = 0; - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) { - fd ++; - } - } - if (fd < 1) { - fprintf(stderr, - "Error ComGetConn: pid %d no faTable entry for the pair", - getpid()); - return -1; - } - - FD_ZERO(&read_mask); - if (fd_inet >= 0) FD_SET(fd_inet, &read_mask); - if (fd_unix >= 0) FD_SET(fd_unix, &read_mask); - if (fd_atm >= 0) FD_SET(fd_atm, &read_mask); - - tval.tv_sec = 1; /* wait at most 1 second */ - tval.tv_usec = 0; - - nfds = fd_inet; - if (fd_unix > nfds) nfds = fd_unix; - if (fd_atm > nfds) nfds = fd_atm; - nfds ++; - errno = 0; -#ifdef _HPUX_SOURCE - if ((fd = select(nfds, (int *)&read_mask, NULL, NULL, &tval)) == -1) -#else - if ((fd = select(nfds, &read_mask, NULL, NULL, &tval)) == -1) -#endif - { - - if (errno == EINTR) return -1; - - fprintf(stderr, - "Error ComGetConn: pid %d failed on select():", - getpid()); - perror(""); - return -1; - } - if (fd == 0) return -1; /* time expire */ - - fd = -1; - - if (fd == -1 && fd_unix >= 0 && FD_ISSET(fd_unix, &read_mask)) { - struct sockaddr_un peeraddr_un; - - fprintf(stderr, "Server to accept a UNIX connection.\n"); - - addrlen = sizeof(struct sockaddr_un); - fd = accept(fd_unix, (struct sockaddr *)&peeraddr_un, &addrlen); - if (fd == -1) { - fprintf(stderr, - "Error ComGetConn: pid %d failed to accpet on fd_unix:", - getpid()); - perror(""); - } - else fdType = CONN_UNIX; - *max_pkt_size = 0; - } - if (fd == -1 && fd_inet >= 0 && FD_ISSET(fd_inet, &read_mask)) { - struct sockaddr_in peeraddr_in; - - fprintf(stderr, "Server to accept a INET connection.\n"); - - addrlen = sizeof(struct sockaddr_in); - fd = accept(fd_inet, (struct sockaddr *)&peeraddr_in, &addrlen); - if (fd == -1) { - fprintf(stderr, - "Error ComGetConn: pid %d failed to accpet on fd_inet:", - getpid()); - perror(""); - } - else fdType = CONN_INET; - *max_pkt_size = 0; - } - if (fd == -1 && fd_atm >= 0 && FD_ISSET(fd_atm, &read_mask)) { -#ifdef NATIVE_ATM - fd = ATMaccept(fd_atm, max_pkt_size); - fdType = CONN_ATM; -#else - fprintf(stderr, - "Error ComGetConn: pid %d CONN_ATM not supported.\n", - getpid()); -#endif - } - if (fd == -1) return -1; - - for (i = 0; i < size; i ++) { - if (fdTable[i].fd == -1) break; - } - if (i < size) { - fdTable[i].fd = fd; - fdTable[i].type = fdType; - fdTable[i].stime = get_sec(); - fdTable[i].state = STATE_SINGLE; - return fd; - } - else { - fprintf(stderr, "Weird\n"); - ComCloseConn(fd); - return -1; - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h deleted file mode 100644 index 98e82aeb26c..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h +++ /dev/null @@ -1,112 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* -Some assumptions about the streams created in this file: - - PACKET STREAM: - - * send(), recv() may not work, we can only use - read()/write(). - - * write(): either send the whole packet, or send nothing - - * read(): read() will read the minimun of the - requested number of bytes and current packet size. - read() can read part of a packet, but it - will not read cross packet boundaris - - There are two modes: non-discard and dicard. If a packets is - not read all its bytes, the remaining bytes will be - or not be discarded. - - This is indicated by if (*max_pkt_size) is positive - (non-discard) or negative (discard) - - BYTE_STREAM: reliable - - * write(): might write only part of requested bytes - each time. (this is the case in SunOS4) - - * read(): might read less than requested bytes. - (this is the case in SunOS4). -*/ - -/* returns: -1 -- failed, 0 -- successful */ -int ComInitClient(int inet_port, char * unix_port, char * atm_port); - -void ComCloseClient(void); - -/* address format: [ATM:|INET:]real_address | "" - - "" -- UNIX socket, reliable byte stream - [INET:]real_address -- INET sockets, reliable control byte stream, and - *max_pkt_size == 0 : reliable data byte stream, or - != 0 : unreliable packet stream; - ATM:real_address -- ATM sockets, both data and control are - unreliable packet streams; - DATM:real_address -- INET/UNIX control reliable byte stream - and ATM unreliable byte stream; - - returns: -1 -- failed, 0 -- successful - *ctr_fd -- control connection file descriptor - *data_fd -- data connection file descriptor - *max_pkt_size -- == 0 : reliable BYTE_STREAM - > 0 : unreliable non-discard PACKET STREAM - with given maximum packet size (bytes); - < 0 : unreliable discard PACKET STREAM - with given maximum packet size (bytes); - - It is suggested that if a BYTE_STREAM is not known to be discarded, - than it is safer to indicate it as discard. - */ -int ComOpenConnPair(char * address, int *ctr_fd, int *data_fd, int *max_pkt_size); -int VideoComOpenConnPair(char * address, int *ctr_fd, int *data_fd, int *max_pkt_size); - - -/* returns: -1 -- failed, >=0 -- fd */ -int ComOpenConn(char * address, int *max_pkt_size); - -/* returns: -1 -- failed, 0 -- successful */ -int ComCloseFd(int fd); - -/* returns: -1 -- failed, 0 -- successful */ -int ComCloseConn(int fd); - -/* returns: -1 -- failed, 0 -- successful */ -int ComInitServer(int inet_port, char * unix_port, char * atm_port); - -void ComCloseListen(void); - -void ComCloseServer(void); - -/* returns: -1 -- failed, 0 -- successful - *max_pkt_size is used only for returning value -*/ -int ComGetConnPair(int *ctr_fd, int *data_fd, int *max_pkt_size); - -/* returns: -1 -- failed, >= 0 -- fd */ -int ComGetConn(int *max_pkt_size); - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.cpp deleted file mode 100644 index b016ea5ff17..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <pwd.h> -#include <grp.h> -#include <time.h> -#include <sys/time.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <netinet/in.h> -#include "routine.h" -#include "fileio.h" -/* - Statfile(filename, sb) - input: filename - path name of a directory entry; - output: sb - StatBuf structure of the given directory entry; - returns: 0 - successful, -1 - failed, with errno indicating error - */ -int StatFile(char *filename, struct StatBuf * sb) -{ - struct stat statbuf; - struct passwd *pw; - struct group *grp; - - if (stat(filename, &statbuf) == -1) - return -1; - - sb->mode = statbuf.st_mode; - sb->size = statbuf.st_size; - - strcpy(sb->ctime, ctime(&(statbuf.st_ctime))); - sb->ctime[strlen(sb->ctime)-1] = 0; /* remove CR */ - - if ((pw = getpwuid(statbuf.st_uid)) == NULL) - sprintf(sb->uid, "%-10d", statbuf.st_uid); - else - strncpy(sb->uid, pw->pw_name, 32); - - if ((grp = getgrgid(statbuf.st_gid)) == NULL) - sprintf(sb->gid, "%-10d", statbuf.st_gid); - else - strncpy(sb->gid, grp->gr_name, 32); -} - -/* - read_bytes(s, buf, size) - input: s - socket to read from - buf - address of a buffer for the read - size - number of bytes to read - output: non - action: try read given number of bytes, all errors are reported, and - cause program to exit. -*/ -void read_bytes(int s, char * buf, int size) -{ - int val, remain = size; - char * ptr = buf; - - if (size == 0) return; - - for (;;) - { - val = read(s, ptr, remain); - - if (val == -1 && (errno == EINTR || errno == EAGAIN | errno == EWOULDBLOCK)) - { /* interrupted or need to wait, try again */ - if (errno == EAGAIN | errno == EWOULDBLOCK) usleep(10000); - errno = 0; - continue; - } - if (val == -1) - { - perror("Error -- Read from socket"); - exit(1); - } - if (val == 0) /* EOF encountered */ - { - fprintf(stderr, "Error -- EOF reached while trying to read %d bytes.\n", size); - exit(1); - } - ptr += val; - remain -= val; - if (remain < 0) /* weird thing is happening */ - { - fprintf(stderr, "Error: read too much from socket, %d out of %d bytes.\n", - size-remain, size); - exit(1); - } - if (remain == 0) - break; - } -} - -int wait_read_bytes(int s, char *buf, int size) -{ - int val, remain = size; - char * ptr = buf; - - if (size == 0) return 1; - - for (;;) - { - val = read(s, ptr, remain); - - if (val == -1 && (errno == EINTR || errno == EAGAIN | errno == EWOULDBLOCK)) - { /* interrupted or need to wait, try again */ - if (errno == EAGAIN | errno == EWOULDBLOCK) usleep(10000); - errno = 0; - continue; - } - if (val == -1) - { - /* - perror("Error -- wait_read from socket"); - */ - return -1; - } - if (val == 0) /* EOF encountered */ - { - /* - fprintf(stderr, "Warn pid %d -- EOF on wait_read %d bytes.\n", - getpid(), size); - */ - return 0; - } - ptr += val; - remain -= val; - if (remain < 0) /* weird thing is happening */ - { - fprintf(stderr, - "Error: weird, read too much from socket, %d out of %d bytes.\n", - size-remain, size); - return -1; - } - if (remain == 0) - break; - } - return size; -} - -#define WAIT_DURATION 5000000 - -int time_read_bytes(int s, char * buf, int size) -{ - int val, remain = size; - char * ptr = buf; - long start = get_usec(); - - int times = 0; - - if (size == 0) return 0; - - for (;;) { - struct fd_set read_mask; - struct timeval tval = {0, 0}; - - FD_ZERO(&read_mask); - FD_SET(s, &read_mask); -#ifdef _HPUX_SOURCE - if (select(s+1, (int *)&read_mask, NULL, NULL, &tval) <= 0) -#else - if (select(s+1, &read_mask, NULL, NULL, &tval) <= 0) -#endif - { - /* - if (get_duration(start, get_usec()) < WAIT_DURATION) { - usleep(10000); - continue; - } - */ - if (times < WAIT_DURATION / 10000) { - usleep(10000); - times ++; - continue; - } - else { - fprintf(stderr, "time_read_bytes() %d seconds expired\n", - WAIT_DURATION/1000000); - return -1; - } - } - - if (!(FD_ISSET(s, &read_mask))) continue; - - val = read(s, ptr, 1); - - if (val == -1 && (errno == EINTR)) - { /* interrupted or need to wait, try again */ - errno = 0; - continue; - } - if (val == -1) - { - perror("Error -- time_read_bytes() from socket"); - return -1; - } - if (val == 0) /* EOF encountered */ - { - /* - fprintf(stderr, "Error -- EOF reached while trying to read %d bytes.\n", size); - */ - return -1; - /* 'continue' causes infinite loop if the pipe is closed by peer - continue; - */ - } - ptr += val; - remain -= val; - if (remain == 0) - return 0; - } -} - -/* - write_bytes(sock, data, len): - try write len byte of data to sock, report all errors by - warning message. -*/ -void write_bytes(int sock, char * data, int len) -{ - while (len > 0) { - int res = write(sock, data, len); - if (res == -1) { - if (errno == EINTR || errno == EAGAIN) continue; - fprintf(stderr, "Error pid %d", getpid()); - perror(" -- failed to write all bytes to socket"); - exit(1); - } - len -= res; - data += res; - } -} - -int time_write_bytes(int sock, char * data, int plen) -{ - int len = plen; - while (len > 0) { - int res = write(sock, data, len); - if (res == -1) { - if (errno == EINTR || errno == EAGAIN) continue; - fprintf(stderr, "Error pid %d", getpid()); - perror(" -- failed to time_write all bytes to socket"); - return -1; - } - len -= res; - data += res; - } - return plen; -} - -int wait_write_bytes(int sock, char * data, int plen) -{ - int len = plen; - while (len > 0) { - int res = write(sock, data, len); - if (res == -1) { - if (errno == EINTR || errno == EAGAIN) continue; - /* - fprintf(stderr, "Error pid %d", getpid()); - perror(" -- failed to wait_write all bytes to socket"); - */ - return -1; - } - len -= res; - data += res; - } - return plen; -} - -/* read_byte: - read one byte from sock to buffer data */ - -void read_byte(int sock, char * data) -{ - read_bytes(sock, data, 1); -} - -/* read_short: - read a short integer from socket sock to buffer data, - byte order conversion is also done. -*/ -void read_short(int sock, short * data) -{ - read_bytes(sock, (char *)data, sizeof(short)); - *data = ntohs(*data); -} - -/* read_int: - read a integer from socket sock to buffer data, - byte order conversion is also done */ - -void read_int(int sock, int * data) -{ - read_bytes(sock, (char *)data, sizeof(int)); - *data = ntohl(*data); -} - -int time_read_int(int sock, int * data) -{ - if (time_read_bytes(sock, (char *)data, sizeof(int)) == -1) { - return -1; - } - *data = ntohl(*data); - return 0; -} - -/* read a string. Returns the length of the string. - transfer through the socket. - but the string in buffer might have been truncated. - the returned string is '\0' terminated */ - -int read_string(int sock, char *data, int maxlen) -{ - int len; - read_int(sock, &len); - if (len == 0) - { - data[0] = 0; - return 0; - } - if (len < maxlen) - { - read_bytes(sock, data, len); - data[len] = 0; - } - else - { - int i; - char tmp; - read_bytes(sock, data, maxlen-1); - data[maxlen-1] = 0; - for (i = 0; i < len - maxlen + 1; i ++) /* discard extra data */ - read_byte(sock, &tmp); - } - return len; -} - - -/* write_byte: - write a byte to socket sock */ - -void write_byte(int sock, char data) -{ - write_bytes(sock, &data, 1); -} - -/* write_short: - byte order convert the short integer in data and write to socket sock */ - -void write_short(int sock, short data) -{ - short val = htons(data); - write_bytes(sock, (char *)&val, sizeof(short)); -} - -/* write_int: - byte order convert the integer in data and write to socket sock */ -void write_int(int sock, int data) -{ - int val = htonl(data); - write_bytes(sock, (char *)&val, sizeof(int)); -} - -int time_write_int(int sock, int data) -{ - int val = htonl(data); - return time_write_bytes(sock, (char *)&val, sizeof(int)); -} - -/* write a string in data to socket sock, the string is led by a length */ - -void write_string(int sock, char *data) -{ - int len = strlen(data); - - write_int(sock, len); - write_bytes(sock, data, len); -} - diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h deleted file mode 100644 index 46432a71797..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h +++ /dev/null @@ -1,100 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* data structure used by StatFile() */ - -#if !defined (_MPEG_FILE_IO_H) -#define _MPEG_FILE_IO_H - -struct StatBuf -{ - unsigned short mode; - long size; - char uid[32]; - char gid[32]; - char ctime[32]; -}; - -/* protocol of functions defined in shared.c */ - -int StatFile(char *filename, struct StatBuf * sb); - - - -/* Following read...()'s would exit(1) if requested bytes can not be - read, and EOF or error other than EINTR, EAGAIN or EWOULDBLOCK is - encountered */ - -void read_bytes(int s, char * buf, int size); - -void read_byte(int sock, char * data); - -void read_short(int sock, short * data); - -void read_int(int sock, int * data); - -int read_string(int sock, char *data, int maxlen); /* returns the length of a stream */ - - -/* Following write...()'s would exit(1) if requested bytes can not - be written to socket because of error has happened*/ - -void write_bytes(int sock, char * data, int len); - -void write_byte(int sock, char data); - -void write_short(int sock, short data); - -void write_int(int sock, int data); - -void write_string(int sock, char *data); - - -/* following returns: 0 -- succ, -1 -- failed. - time_read*() will wait at most 5 seconds before they return */ - -int time_read_bytes(int s, char * buf, int size); - -int time_read_int(int sock, int * data); - -int time_write_bytes(int sock, char * data, int len); - -int time_write_int(int sock, int data); - - -/* Following read...()'s would return 0/-1 if requested bytes can not - be read, and EOF (return 0) or error (return -1) other than EINTR, - EAGAIN or EWOULDBLOCK is encountered */ - -int wait_read_bytes(int s, char *buf, int size); - - -/* Following write...()'s would return 0/-1 if requested bytes can not - be written and error (return -1) other than EINTR, EAGAIN or is - encountered */ - -int wait_write_bytes(int s, char *buf, int size); - -#endif /* _MPEG_FILE_IO_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.cpp deleted file mode 100644 index 05361167127..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <limits.h> /* INT_MIN, INT_MAX are defined here */ -#include <errno.h> -#include <stdlib.h> -#include <string.h> -/* -#include <stdlib.h> -#include <sys/time.h> -#include <sys/types.h> -*/ -#include "filters.h" -#include "ace/OS.h" - -#define BUFSIZE 256 -#define maxval(a,b) ((a) > (b) ? (a) : (b)) -#define minval(a,b) ((a) < (b) ? (a) : (b)) - -static float FLOAT_MIN = (float)INT_MIN; -static float FLOAT_MAX = (float)INT_MAX; - -AverageFilter * NewAverageFilter(int nsamples) -{ - AverageFilter * f; - f = (AverageFilter *) ACE_OS::malloc(sizeof(*f)); - if (f == NULL) - return NULL; - f->type = FILTER_AVERAGE; - f->nsamples = nsamples; - f->buf = (double *)ACE_OS::malloc(nsamples * sizeof(double)); - if (f->buf == NULL) { - ACE_OS::free(f); - return NULL; - } - f->count = 0; - f->ptr = 0; - f->sum = 0; - return f; -} - -AverageFilter * ResetAverageFilter(AverageFilter *f, int nsamples) -{ - if (f->nsamples != nsamples) { - ACE_OS::free(f->buf); - f->nsamples = nsamples; - f->buf = (double *)ACE_OS::malloc(nsamples * sizeof(double)); - if (f->buf == NULL) { - ACE_OS::free(f); - return NULL; - } - } - f->count = 0; - f->ptr = 0; - f->sum = 0; - return f; -} - -void FreeAverageFilter(AverageFilter * f) -{ - ACE_OS::free(f->buf); - ACE_OS::free(f); -} - -double DoAverageFilter(AverageFilter *f, double value) -{ - int offset; - double oldval = f->buf[f->ptr]; - f->buf[f->ptr] = value; - f->ptr = (f->ptr + 1) % f->nsamples; - f->sum += value; - if (f->count >= f->nsamples) { - f->sum -= oldval; - } - else { - f->count ++; - } - return (double)(f->sum) / (double)f->count; -} - - -LowPassFilter * NewLowPassFilter(double Rvalue) -{ - LowPassFilter * f; - f = (LowPassFilter *)ACE_OS::malloc(sizeof(*f)); - if (f == NULL) { - return NULL; - } - if (Rvalue > 1.0) { - Rvalue = 1.0; - } - else if (Rvalue < 0.0) { - Rvalue = 0.0; - } - f->type = FILTER_LOWPASS; - f->count = 0; - f->maxcount = (int)(1.0 / maxval(Rvalue, 0.0001)); - f->R = Rvalue; - f->result = FLOAT_MIN; - return f; -} - -LowPassFilter * ResetLowPassFilter(LowPassFilter * f, double Rvalue) -{ - if (Rvalue > 1.0) { - Rvalue = 1.0; - } - else if (Rvalue < 0.0) { - Rvalue = 0.0; - } - f->count = 0; - f->maxcount = (int)(1.0 / maxval(Rvalue, 0.0001)); - f->R = Rvalue; - f->result = FLOAT_MIN; - return f; -} - -void FreeLowPassFilter(LowPassFilter * f) -{ - ACE_OS::free(f); -} - -double DoLowPassFilter(LowPassFilter * f, double value) -{ - if (f->count <= f->maxcount) { - if (!f->count) { - f->count ++; - return (f->result = value); - } - f->count ++; - return (f->result = (1.0 - (1.0/(double)f->count)) * f->result + - (1.0/(double)f->count) * value); - } - return (f->result = (1.0 - f->R) * f->result + f->R * value); -} - -MedianFilter * NewMedianFilter(int nsamples) -{ - int minv = 0, maxv = 1; - MedianFilter * f; - f = (MedianFilter *) ACE_OS::malloc(sizeof(*f)); - if (f == NULL) - return NULL; - f->type = FILTER_MEDIAN; - f->nsamples = nsamples; - f->max = maxval(maxv, minv); - f->min = minval(maxv, minv); - f->statsize = f->max - f->min + 1; - f->buf = (int *)ACE_OS::malloc(nsamples * sizeof(int)); - if (f->buf == NULL) { - ACE_OS::free(f); - return NULL; - } - f->stat = (int *)ACE_OS::malloc(f->statsize * sizeof(int)); - if (f->stat == NULL) { - ACE_OS::free(f->buf); - ACE_OS::free(f); - return NULL; - } - f->count = 0; - f->ptr = 0; - f->med = 0; - f->below = 0; - memset(f->stat, 0, f->statsize * sizeof(int)); - return f; -} - -MedianFilter * ResetMedianFilter(MedianFilter * f, int nsamples) -{ - if (f->nsamples != nsamples) { - ACE_OS::free(f->buf); - f->nsamples = nsamples; - f->buf = (int *)ACE_OS::malloc(nsamples * sizeof(int)); - if (f->buf == NULL) { - ACE_OS::free(f); - return NULL; - } - } - f->count = 0; - f->ptr = 0; - f->med = 0; - f->below = 0; - memset(f->stat, 0, f->statsize * sizeof(int)); - return f; -} - -void FreeMedianFilter(MedianFilter * f) -{ - ACE_OS::free(f->buf); - ACE_OS::free(f->stat); - ACE_OS::free(f); -} - -double DoMedianFilter(MedianFilter *f, double pvalue) -{ - int value = (int)pvalue; - int offset; - int oldval = f->buf[f->ptr]; - if (value > f->max) { - int * oldstat = f->stat; - int oldsize = f->statsize; - f->max = value + 10; - f->statsize = f->max - f->min + 1; - f->stat = (int *)ACE_OS::malloc(f->statsize * sizeof(int)); - if (f->stat == NULL) { - fprintf(stderr, "MedianFilter Failed to extend up stat to % items", - f->statsize); - perror(""); - exit(1); - } - memset((char *)(f->stat) + sizeof(int) * oldsize, 0, - sizeof(int) * (f->statsize - oldsize)); - memcpy(f->stat, oldstat, oldsize * sizeof(int)); - } - else if (value < f->min) { - int * oldstat = f->stat; - int oldsize = f->statsize; - f->min = value - 10; - f->statsize = f->max - f->min + 1; - f->stat = (int *)ACE_OS::malloc(f->statsize * sizeof(int)); - if (f->stat == NULL) { - fprintf(stderr, "MedianFilter Failed to extend down stat to % items", - f->statsize); - perror(""); - exit(1); - } - memset(f->stat, 0, sizeof(int) * (f->statsize - oldsize)); - memcpy((char *)(f->stat) + sizeof(int) * (f->statsize - oldsize), - oldstat, sizeof(int) * oldsize); - f->med += f->statsize - oldsize; - } - f->buf[f->ptr] = value; - f->ptr = (f->ptr + 1) % f->nsamples; - offset = value - f->min; - if (offset < 0) { - offset = 0; - } - else if (offset >= f->statsize) { - offset = f->statsize - 1; - } - f->stat[offset] ++; - if (offset < f->med) { - f->below ++; - } - if (f->count >= f->nsamples) { - offset = oldval - f->min; - if (offset < 0) { - offset = 0; - } - else if (offset >= f->statsize) { - offset = f->statsize - 1; - } - f->stat[offset] --; - if (offset < f->med) { - f->below --; - } - } - else { - f->count ++; - } - oldval = f->count >> 1; - if (f->below > oldval) { - offset = f->med - 1; - while (offset >= 0 && (f->below - f->stat[offset]) > oldval) { - f->below -= f->stat[offset]; - offset --; - } - f->med = offset + 1; - } - else { - offset = f->med; - while (offset < f->statsize && (f->below + f->stat[offset]) <= oldval) { - f->below += f->stat[offset]; - offset ++; - } - f->med = offset; - } - return (double)(f->med + f->min); -} - -Filter * NewFilter(int type, int parameter) -{ - switch (type) { - case FILTER_LOWPASS: - return (Filter *)NewLowPassFilter(1.0/(double)parameter); - case FILTER_MEDIAN: - return (Filter *)NewMedianFilter(parameter); - case FILTER_AVERAGE: - return (Filter *)NewAverageFilter(parameter); - default: - break; - } - return NULL; -} - -Filter * ResetFilter(Filter * f, int parameter) -{ - switch (f->type) { - case FILTER_LOWPASS: - return (Filter *)ResetLowPassFilter((LowPassFilter *)f, 1.0/(double)parameter); - case FILTER_MEDIAN: - return (Filter *)ResetMedianFilter((MedianFilter *)f, parameter); - case FILTER_AVERAGE: - return (Filter *)ResetAverageFilter((AverageFilter *)f, parameter); - default: - break; - } - return NULL; -} - -void FreeFilter(Filter * f) -{ - switch (f->type) { - case FILTER_LOWPASS: - FreeLowPassFilter((LowPassFilter *)f); - break; - case FILTER_MEDIAN: - FreeMedianFilter((MedianFilter *)f); - break; - case FILTER_AVERAGE: - FreeAverageFilter((AverageFilter *)f); - break; - default: - break; - } -} - -double DoFilter(Filter *f, double value) -{ - switch (f->type) { - case FILTER_LOWPASS: - return DoLowPassFilter((LowPassFilter *)f, value); - break; - case FILTER_MEDIAN: - return DoMedianFilter((MedianFilter *)f, value); - break; - case FILTER_AVERAGE: - return DoAverageFilter((AverageFilter *)f, value); - break; - default: - break; - } - return FLOAT_MIN; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h deleted file mode 100644 index 7befdfaa20d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/filters.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#define FILTER_LOWPASS 0 -#define FILTER_MEDIAN 1 -#define FILTER_AVERAGE 2 - -typedef struct MedianFilter { - int type; - int * buf; - int nsamples; - int count; - int ptr; - int * stat; - int statsize; - int max, min; - int med; /* median offset to stat */ - int below; /* total points below the med entry */ -} MedianFilter; - -typedef struct LowPassFilter { - int type; - int count; - int maxcount; - double R; - double result; -} LowPassFilter; - -typedef struct AverageFilter { - int type; - double * buf; - int nsamples; - int ptr; - double sum; - int count; -} AverageFilter; - -typedef union Filter { - int type; - MedianFilter m; - AverageFilter a; - LowPassFilter l; -} Filter; - -Filter * NewFilter(int type, int parameter); -Filter * ResetFilter(Filter * f, int parameter); -void FreeFilter(Filter * f); -double DoFilter(Filter *f, double value); - -MedianFilter * NewMedianFilter(int nsamples); -MedianFilter * ResetMedianFilter(MedianFilter * f, int nsamples); -void FreeMedianFilter(MedianFilter * f); -double DoMedianFilter(MedianFilter *f, double value); - -AverageFilter * NewAverageFilter(int nsamples); -AverageFilter * ResetAverageFilter(AverageFilter * f, int nsamples); -void FreeAverageFilter(AverageFilter * f); -double DoAverageFilter(AverageFilter *f, double value); - -LowPassFilter * NewLowPassFilter(double R); -LowPassFilter * ResetLowPassFilter(LowPassFilter * f, double R); -void FreeLowPassFilter(LowPassFilter * f); -double DoLowPassFilter(LowPassFilter *f, double value); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp deleted file mode 100644 index 812410eb1c3..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.cpp +++ /dev/null @@ -1,506 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <stdio.h> -#include <errno.h> -#include <stdlib.h> -#include <time.h> -#include <unistd.h> -#include <limits.h> -#ifdef __svr4__ -#include <sys/systeminfo.h> -#endif -#ifdef _HPUX_SOURCE -#include <sys/rtprio.h> -#elif defined(__svr4__) -#include <sys/priocntl.h> -#include <sys/rtpriocntl.h> -#include <sys/tspriocntl.h> -#endif - -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <sys/sem.h> -#include <signal.h> -#include <sys/wait.h> -#include <sys/param.h> -#include <string.h> -#include "routine.h" - -#define TEST_TYPE 1 -#define SIGSETMASK 0 -#define stacksize 10000 -#define TIME_ROUND 4000 -#define BLOCK_NUM 5 -#define DELTA_MSEC 20 - -int get_hostname(char *name, int len) -{ -#ifdef __svr4__ - if (sysinfo(SI_HOSTNAME, name, len) == -1) return -1; - else return 0; -#else - return ACE_OS::hostname(name, len); -#endif -} - -long get_usec(void) -{ - struct timeval tp; - struct timezone tzp; - int err; - if (err=gettimeofday(&tp, &tzp)) - { - return 0; - } - else { - /* - return ((long)1000000)*(tp.tv_sec%TIME_ROUND) + (tp.tv_usec); - */ - return ((long)1000000)*(tp.tv_sec) + (tp.tv_usec); - } -} - -long get_msec(void) -{ - struct timeval tp; - struct timezone tzp; - int err; - if (err=gettimeofday(&tp, &tzp)) - { - return 0; - } - else - { - return ((long)1000)*(tp.tv_sec) + (tp.tv_usec / 1000); - } -} - -long get_sec(void) -{ - struct timeval tp; - struct timezone tzp; - int err; - if (err=gettimeofday(&tp, &tzp)) - { - return 0; - } - else - { - return tp.tv_sec; - } -} - -/* returns the difference of the two usec time values */ - -long get_duration(long val1, long val2) -{ - /* - return val2>=val1 ? val2-val1 : (val2+TIME_ROUND-val1); - */ - return val2>=val1 ? val2-val1 : ((LONG_MAX - val1) + (val2 - LONG_MIN) + 1); -} - -#ifdef LINUX -#else -void usleep(unsigned int usec) -{ - struct timeval val; - - if (usec <= 0) return; - val.tv_sec = usec / 1000000; - val.tv_usec = usec % 1000000; - if (select(0, NULL, NULL, NULL, &val) == -1 && errno != 4) - { - perror("sleep with select"); - exit(1); - } -} -#endif - -void beep(void) -{ - fprintf(stderr, "\007"); -} - -#ifndef FreeBSD -#include <malloc.h> -#endif -#include <sys/shm.h> - -void remove_shmem_id(int id) -{ - shmctl(id, IPC_RMID, NULL); -#if 0 - /* weird also on some sunOs4 machines */ - /* weird, HPUX always report error on this operation */ - if (errno) - { - fprintf(stderr, "shmctl shm_id:%d to IPC_RMID error:", id); - perror(""); - } -#endif -} - -char * creat_shared_mem_id(int size, int * id) -{ - char * shm; - int shm_id; - - shm_id = shmget(IPC_PRIVATE, size, IPC_CREAT | 0666); - if (shm_id == -1) - { - shm_id = shmget(IPC_PRIVATE, 0, IPC_CREAT | 0666); - if (shm_id == -1) - { - perror("Shared MEM shmget1 error"); - exit(1); - } - else - { - if (shmctl(shm_id, IPC_RMID, NULL) == -1) - { - perror("Shared MEM shmctl error"); - exit(1); - } - shm_id = shmget(IPC_PRIVATE, 0, IPC_CREAT | 0666); - if (shm_id == -1) - { - perror("Shared MEM shmget2 error"); - exit(1); - } - } - } - shm = (char *)shmat(shm_id, (char *)0, 0); - if ((int)shm == -1) - { - perror("Shared MEM shmat error"); - exit(1); - } - *id = shm_id; - return shm; -} - -char * creat_shared_mem(int size) -{ - int shm_id; - char * shm = creat_shared_mem_id(size, &shm_id); - remove_shmem_id(shm_id); - return shm; -} - -void remove_shared_mem(char *ptr) -{ - shmdt(ptr); -} - -#define SEM_NUM 6 -static int semId = -1; -static int masterPid = -1; -static int nextSem = -1; - -void enter_cs(int semaphore_id) -{ - struct sembuf sop; - sop.sem_num = semaphore_id; - sop.sem_op = -1; - sop.sem_flg = 0; - while (semop(semId, &sop, 1) == -1) - { - if (errno == EINTR) - continue; - fprintf(stderr, "semop(enter_cs) error: pid=%d", getpid()); - perror(""); - exit(1); - } -} - -void leave_cs(int semaphore_id) -{ - struct sembuf sop; - sop.sem_num = semaphore_id; - sop.sem_op = 1; - sop.sem_flg = 0; - while (semop(semId, &sop, 1) == -1) - { - if (errno == EINTR) - continue; - fprintf(stderr, "semop(leave_cs) error, pid=%d", getpid()); - perror(""); - exit(1); - } -} - -int creat_semaphore(void) -{ - int i; - int sem_val; - int semaphore_id; - if (semId == -1) { - semId = semget(IPC_PRIVATE, SEM_NUM, IPC_CREAT | 0666); - if (semId == -1) { - perror("Semaphore semget error"); - exit(1); - } - masterPid = getpid(); - nextSem = 0; - } - else if (masterPid != getpid()) { - fprintf(stderr, "Error: this creat_semaphore() assumes semaphores are allocated\n"); - fprintf(stderr, " only in single process %d, while current pid=%d\n", - masterPid, getpid()); - exit(1); - } - semaphore_id = nextSem ++; - if (semaphore_id >= SEM_NUM) { - fprintf(stderr, "Error: all of %d semaphores used up.\n", SEM_NUM); - exit(1); - } - sem_val = semctl(semId, semaphore_id, GETVAL, 0); -/* - fprintf(stderr, "Initial semaphore value: %d\n", sem_val); -*/ - if (sem_val == 0) - leave_cs(semaphore_id); - return semaphore_id; -} - -void delete_semaphore() -{ - if (masterPid == getpid() && semId >= 0) { - semctl(semId, 0, IPC_RMID, 0); - } else { - if (masterPid != getpid()) - fprintf(stderr, "Pid %d not supposed to remove semId created by pid %d\n", - getpid(), masterPid); - else - fprintf(stderr, "The semaphore has been deleted.\n"); - } - return; -} - -void remove_semaphore(int sid) -{ - return; - /* semctl(semId, semaphore_id, IPC_RMID, 0); */ -} - -int get_semval(int sid) -{ - int val, val1 = 0; - errno = 0; - val = semctl(semId, sid, GETVAL, 0); - if (val == -1) { - perror("getting value of a semaphore"); - exit(1); - } - /* - if (val == 0) { - fprintf(stderr, "pid %d to call semctl(%d, 0, GETZCNT)\n", getpid(), sid); - val = semctl(semId, 0, GETZCNT, 0); - if (val == -1) { - perror("getting semzcnt of a semaphore"); - exit(1); - } - - fprintf(stderr, "pid %d to call semctl(%d, 0, GETNCNT)\n", getpid(), sid); - usleep(10000000); - val1 = semctl(semId, sid, GETNCNT, 0); - if (val1 == -1) { - perror("getting semncnt of a semaphore"); - } - fprintf(stderr, "pid %d to called semctl(GETNCNT)\n", getpid()); - - fprintf(stderr, "Semval val %d, val1 %d\n", val, val1); - return (0-(val + val1)); - } - else - */ - return val; -} - -void get_full_path(char *filename, char * buffer, int bufsize) -{ - char path[MAXPATHLEN]; - - path[0] = 0; - - if (*filename == '/') - strncpy(path, filename, MAXPATHLEN); - else if (*filename == '~') - { - char * env = getenv("HOME"); - if (env != NULL) - { - strncpy(path, env, MAXPATHLEN); - strncat(path, filename+1, MAXPATHLEN - strlen(path)); - } - else - strncpy(path, filename, MAXPATHLEN); - } - else /* from current dir */ - { - getcwd(path, MAXPATHLEN); - if (errno) - strncpy(path, filename, MAXPATHLEN); - else - { - path[MAXPATHLEN-4] = 0; - strcat(path, "/"); - strncat(path, filename, MAXPATHLEN - strlen(path)); - } - } - path[MAXPATHLEN-1] = 0; - strncpy(buffer, path, bufsize); - buffer[bufsize-1] = 0; - /* - fprintf(stderr, "%s extended to %s\n", filename, buffer); - */ -} - -void setsignal(int sig, void (func)(int)) -{ -#ifdef _HPUX_SOURCE - struct sigvec sv; - - sv.sv_handler = func; - sv.sv_mask = 0; - sv.sv_flags = 0; - if (sigvector (sig, &sv, (struct sigvec *) NULL) == -1) { - fprintf(stderr, "sigvector(%d) error", sig); - perror(""); - exit(1); - } -#elif defined(__svr4__) || defined(IRIX) - if (sigset(sig, func) == SIG_ERR) { - fprintf(stderr, "sigset(%d,func) error", sig); - perror(""); - exit(1); - } -#elif defined(sun) || defined(FreeBSD) || defined(ULTRIX) || defined(LINUX) - { - struct sigaction act; - act.sa_handler = func; -#ifdef FreeBSD - act.sa_flags = SV_INTERRUPT; -#else - act.sa_flags =/* SA_INTERRUPT;*/ SA_RESTART; -#endif - // @@ Naga commented this line. - // act.sa_mask = 0; - if (!sigaction(sig, &act, NULL)) return; - fprintf(stderr, "sigaction(%d,...) error", sig); - perror(""); - exit(1); - } - /* - if (signal(sig, func) == SIG_ERR) { - fprintf(stderr, "signal(%d,func) error", sig); - perror(""); - exit(1); - } - */ -#else - fprintf(stderr, - "Error: code for setsignal(%d,func) is missing in source/mpeg_shared/routine.cpp\n", - sig); - exit(1); -#endif -} - -/* set to 'pri': 0 -lowest RT, higher value higher RT priority. -1 - Time Sharing. - For HPUX, 0 -> 127, 1 -> 127, ..., pri -> 127 - pri; - For Solaris, -> 0, 1 -> 1, pri -> pri; - - The function returns 0 on success, -1 on failure - */ -int SetRTpriority(char *msg, int pri) -{ - if (pri >= 0) { -#ifdef _HPUX_SOURCE - if (rtprio(0, 127 - pri) == -1) - { - fprintf(stderr, "%s fails to be set to RT priority %d", msg, 127 - pri); - perror(""); - return -1; - } - return 0; -#elif defined(__svr4__) - pcinfo_t pci; - pcparms_t pcp; - rtparms_t * rtp = (rtparms_t *)pcp.pc_clparms; - strcpy(pci.pc_clname, "RT"); - if (priocntl(P_PID, P_MYID, PC_GETCID, (char *)&pci) == -1) { - fprintf(stderr, "%s priocntl(PC_GETCID) failed for RT pri %d", msg, pri); - perror(""); - return -1; - } - pcp.pc_cid = pci.pc_cid; - rtp->rt_pri = pri; - rtp->rt_tqsecs = 0; - rtp->rt_tqnsecs = 10000000; /* 10 (ten) milliseconds */ - if (priocntl(P_PID, P_MYID, PC_SETPARMS, (char *)&pcp) == -1) { - fprintf(stderr, "%s priocntl(PC_SETPARMS) failed for RT pri %d", msg, pri); - perror(""); - return -1; - } - return 0; -#else - fprintf(stderr, "%s warning: RT priority not available on this arch.\n", msg); - return -1; -#endif - } - else { /* set to TS priority */ -#ifdef _HPUX_SOURCE - if (rtprio(0, RTPRIO_RTOFF) == -1) { - fprintf(stderr, "%s fails to be set to RTPRIO_RTOFF", msg); - perror(""); - return -1; - } - return 0; -#elif defined(__svr4__) - pcinfo_t pci; - pcparms_t pcp; - tsparms_t * tsp = (tsparms_t *)pcp.pc_clparms; - strcpy(pci.pc_clname, "TS"); - if (priocntl(P_PID, P_MYID, PC_GETCID, (char *)&pci) == -1) { - fprintf(stderr, "%s priocntl(PC_GETCID) failed for TS priority", msg); - perror(""); - return -1; - } - pcp.pc_cid = pci.pc_cid; - tsp->ts_uprilim = 0; - tsp->ts_upri = 0; - if (priocntl(P_PID, P_MYID, PC_SETPARMS, (char *)&pcp) == -1) { - fprintf(stderr, "%s priocntl(PC_SETPARMS) failed for TS priority", msg); - perror(""); - return -1; - } - return 0; -#endif - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h deleted file mode 100644 index 64ca7b138ee..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* routine.c */ -#if !defined (_MPEG_ROUTINE_H) -#define _MPEG_ROUTINE_H - -#include "include/common.h" -#ifdef LINUX -#else -void usleep(unsigned int usec); -#endif -void beep(void); -int get_hostname(char *name, int len); -long get_usec(void); -long get_msec(void); -long get_sec(void); -long get_duration(long valstart, long valstop); -void remove_shmem_id(int id); -char * creat_shared_mem_id(int size, int * id); -char * creat_shared_mem(int size); -void remove_shared_mem(char *ptr); -void enter_cs(int semaphore_id); -void leave_cs(int semaphore_id); -int creat_semaphore(void); -void remove_semaphore(int sid); -int get_semval(int sid); -void get_full_path(char *filename, char * buffer, int bufsize); -void setsignal(int sig, void (func)(int)); -int SetRTpriority(char *msg, int pri); - -#endif /* _MPEG_ROUTINE_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.cpp deleted file mode 100644 index e6e69f4228d..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.cpp +++ /dev/null @@ -1,137 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <string.h> -#include "sendpt.h" - -/* parameters: - pat -- pattern - buf -- buffer for holding sendpattern computed; - len -- length of pattern and send pattern (number of frames); - f -- number of frames to send (represented by result send pattern); -*/ -void ComputeSendPattern(char * pat, char * buf, int len, int f) -{ - memset(buf, 0, len); - if (f >= len) - { - memset(buf, 1, len); - } - else if (f <= 1) - { - buf[0] = 1; - } - else - { - int i, is = 0, ps = 0, bs = 0; - - memset(buf, 1, len); - for (i = 0; i < len; i++) - { - if (pat[i] == 'I') - is ++; - else if (pat[i] == 'P') - ps ++; - else /* B frame */ - bs ++; - } - f = len - f; /* number of frames to drop */ - if (f < bs) /* drops only B frames */ - { - double scale = (double)bs / (double)f; - int ptr = 0, ptr1 = 0; - for (i = 0; i < len; i ++) - { - if (pat[i] == 'B') - { - if ( ptr == (int) ((double)ptr1 * scale + 0.5)) - { - buf[i] = 0; - ptr1 ++; - } - ptr ++; - } - } - goto endOfCompute; - } - - /* drop all B frames */ - for (i = 0; i < len; i ++) - if (pat[i] == 'B') - buf[i] = 0; - - if (f == bs) - goto endOfCompute; - - if (f > bs && f < bs + ps) /* drop also some P frames */ - { - int ptr = len - 1; - for (i = 0; i < is; i ++) - { - int j; - for (j = 0; j < (f - bs) / is; j ++) - { - while (pat[ptr] != 'P') ptr --; - buf[ptr] = 0; - ptr --; - } - while (pat[ptr] != 'I') ptr --; - } - ptr = len - 1; - for (i = 0; i < (f - bs) % is; i ++) - { - while (pat[ptr] != 'P' || buf[ptr] == 0) ptr --; - buf[ptr] = 0; - while (pat[ptr] != 'I') ptr --; - } - goto endOfCompute; - } - - /* drop all P frames */ - for (i = 0; i < len; i ++) - if (pat[i] == 'P') - buf[i] = 0; - - if (f > bs + ps) /* needs to drop some I frames */ - { - double scale = (double)is / (double)(f - bs - ps); - int ptr = 0, ptr1 = 0; - for (i = 0; i < len; i ++) - { - if (pat[i] == 'I') - { - if ( ptr == (int) ((double)ptr1 * scale + 0.5)) - { - buf[i] = 0; - ptr1 ++; - } - ptr ++; - } - } - goto endOfCompute; - } - } - endOfCompute:; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h deleted file mode 100644 index f6c011916ff..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h +++ /dev/null @@ -1,32 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -/* parameters: - pat -- pattern - buf -- buffer for holding sendpattern computed; - len -- length of pattern and send pattern (number of frames); - f -- number of frames to send (represented by result send pattern); -*/ -void ComputeSendPattern(char * pat, char * buf, int len, int f); diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/Makefile b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/Makefile deleted file mode 100644 index af4f35917ff..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/Makefile +++ /dev/null @@ -1,472 +0,0 @@ -#---------------------------------------------------------------------------- -# -# $Id$ -# -#---------------------------------------------------------------------------- - -MAKEFILE = Makefile -BIN = server vs - -BUILD = $(BIN) - -AV_SERVER_OBJS = server.o -AV_VS_OBJS = vs.o - -# On non-Windows environment, we should at least define -# the export_include IDL flag. -FILES = server vs - -DEFS = $(addsuffix .h,$(FILES)) -LSRC = $(addsuffix .cpp,$(FILES)) - - -LIBS += -lTAO -lACE -lorbsvcs -lmpeg_server -lmpeg_shared - -MPEG_ROOT = $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source -CPPFLAGS += -I$(MPEG_ROOT) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(TAO_ROOT)/rules.tao.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -include $(ACE_ROOT)/include/makeinclude/rules.lib.GNU -#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Local targets (and local hacks) -#---------------------------------------------------------------------------- - -CPPFLAGS += -DSH_MEM -DNDEBUG -CPPFLAGS += -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat -I$(TAO_ROOT)/orbsvcs $(TSS_ORB_FLAG)#-H - -server:$(addprefix $(VDIR),$(AV_SERVER_OBJS)) - $(LINK.cc) $(LDFAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - -vs:$(addprefix $(VDIR),$(AV_VS_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) $(POSTLINK) - - -clean: - -/bin/rm -rf *.o Log $(BIN) obj.* core Templates.DB .make.state - -realclean: clean - -/bin/rm -rf $(addsuffix .h, $(IDL_FILES)) $(addsuffix .i, $(IDL_FILES)) $(addsuffix .cpp, $(IDL_FILES)) - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -.obj/server.o .obj/server.so .shobj/server.o .shobj/server.so: server.cpp server.h \ - $(ACE_ROOT)/ace/Get_Opt.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/Get_Opt.i \ - $(ACE_ROOT)/ace/Acceptor.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/Event_Handler.h \ - $(ACE_ROOT)/ace/Event_Handler.i \ - $(ACE_ROOT)/ace/Service_Object.i \ - $(ACE_ROOT)/ace/Signal.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/Synch_T.i \ - $(ACE_ROOT)/ace/Thread.h \ - $(ACE_ROOT)/ace/Thread.i \ - $(ACE_ROOT)/ace/Atomic_Op.i \ - $(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/Service_Config.i \ - $(ACE_ROOT)/ace/Reactor.h \ - $(ACE_ROOT)/ace/Handle_Set.h \ - $(ACE_ROOT)/ace/Handle_Set.i \ - $(ACE_ROOT)/ace/Timer_Queue.h \ - $(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/Reactor.i \ - $(ACE_ROOT)/ace/Reactor_Impl.h \ - $(ACE_ROOT)/ace/Svc_Conf_Tokens.h \ - $(ACE_ROOT)/ace/Svc_Handler.h \ - $(ACE_ROOT)/ace/Synch_Options.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/Strategies.h \ - $(ACE_ROOT)/ace/Strategies_T.h \ - $(ACE_ROOT)/ace/Hash_Map_Manager.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/Acceptor.i \ - $(ACE_ROOT)/ace/SOCK_Acceptor.h \ - $(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/Time_Value.h \ - $(ACE_ROOT)/ace/SOCK_Acceptor.i \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(ACE_ROOT)/ace/Select_Reactor.h \ - $(ACE_ROOT)/ace/Token.h \ - $(ACE_ROOT)/ace/Token.i \ - $(ACE_ROOT)/ace/Pipe.h \ - $(ACE_ROOT)/ace/Pipe.i \ - $(ACE_ROOT)/ace/Select_Reactor.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.h \ - $(TAO_ROOT)/tao/TAO.h \ - $(TAO_ROOT)/tao/corba.h \ - $(ACE_ROOT)/ace/SString.h \ - $(ACE_ROOT)/ace/SString.i \ - $(ACE_ROOT)/ace/SOCK_Connector.h \ - $(ACE_ROOT)/ace/SOCK_Connector.i \ - $(ACE_ROOT)/ace/Connector.h \ - $(ACE_ROOT)/ace/Map_Manager.h \ - $(ACE_ROOT)/ace/Map_Manager.i \ - $(ACE_ROOT)/ace/Connector.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_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Naming_Utils.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/IOR_Multicast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/CosNaming_i.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Entries.h \ - $(ACE_ROOT)/ace/Process.h \ - $(ACE_ROOT)/ace/Process.i -.obj/vs.o .obj/vs.so .shobj/vs.o .shobj/vs.so: vs.cpp \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Server.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 \ - $(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/include/common.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/fileio.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/com.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/routine.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/sendpt.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.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/tests/AVStreams/mpeg/source/mpeg_shared/Video_ControlS.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/server_proto.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Globals.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.h \ - $(ACE_ROOT)/ace/SOCK_CODgram.i \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_State.h \ - $(TAO_ROOT)/orbsvcs/tests/AVStreams/mpeg/source/mpeg_server/Video_Control_i.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp deleted file mode 100644 index 28e90998eae..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.cpp +++ /dev/null @@ -1,517 +0,0 @@ -// $Id$ - -#include "server.h" -#include "ace/Process.h" - -// Initialize the svc_handler, and the acceptor. - -AV_Svc_Handler::AV_Svc_Handler (ACE_Thread_Manager *t) -{ -} - -// Client connected to our control port called by the reactor -// (acceptor). - -int -AV_Svc_Handler::open (void *) -{ - // Lets use threads at a later point. The current scheme works fine - // with fork.. this will activate a thread this->activate - // (THR_BOUND); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Svc_Handler::open called\n")); - return this->svc (); - // return 0; -} - -// this will handle the connection -int -AV_Svc_Handler::svc (void) -{ - int result; - result = this->handle_connection (); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Svc_Handler::svc exiting\n")); - - return result; -} - -// handles the connection - -int -AV_Svc_Handler::handle_connection (ACE_HANDLE) -{ - // Client is sending us a command - int cmd; - if (this->peer ().recv_n (&cmd, - sizeof (cmd)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Command recieve failed: %p\n"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Command recieved is %d\n", - cmd)); - // Change these CMD's to enums and put them in a "appropriate" namespace - switch (cmd) - { - case CmdINITvideo: - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Spawning the video server process\n")); - - // %% what does this do ?!! - if (Mpeg_Global::live_audio) LeaveLiveAudio (); - /* result = VideoServer (this->peer ().get_handle (), - this->dgram_.get_handle (), - Mpeg_Global::rttag, - -INET_SOCKET_BUFFER_SIZE); - */ - - ACE_Process_Options video_process_options; - video_process_options.command_line ("./vs -ORBport 0"); - // ORBport of 0 makes the video server pick a port for itself - - ACE_Process video_process; - pid_t child_pid; - - if ((child_pid = video_process.spawn (video_process_options)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) ACE_Process:: spawn failed: %p\n", - "spawn"), - -1); - // %% need to close down the orb fd's - // in the child process!! - - char sem_str [BUFSIZ]; - - // create a unique semaphore name - ::sprintf (sem_str, - "%s:%d", - "Video_Server_Semaphore", - child_pid); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) semaphore is %s\n", - sem_str)); - // Create the semaphore - ACE_Process_Semaphore semaphore (0, // 0 means that the - // semaphore is locked initially - sem_str); - - // %% wait until the child finishes booting - if (semaphore.acquire () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) semaphore acquire failed: %p\n", - "acquire"), - -1); - // Wait until a ACE_SV_Semaphore's value is greater than 0, the - // decrement it by 1 and return. Dijkstra's P operation, Tannenbaums - // DOWN operation. - // ::sleep (5); - ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - int ack = 42; - if (this->peer ().send_n (&ack, - sizeof (ack)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t), ACK send failed: %p", - "AV_Svc_Handler::handle_connection"), - -1); - ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - } - // close down the connected socket in the main process - this->destroy (); - break; - case CmdINITaudio: - ACE_DEBUG ((LM_DEBUG,"(%P|%t) Received CmdINITaudio\n")); - // %% need to fork here - switch (ACE_OS::fork ("child")) - { - case 0: - ACE_DEBUG ((LM_DEBUG,"(%P|%t) New process forked \n")); - if (Mpeg_Global::live_audio) - LeaveLiveAudio (); - ACE_NEW_RETURN (this->as_, - Audio_Server, - -1); - ACE_DEBUG ((LM_DEBUG,"(%P|%t) AudioServer created\n")); - int result; - result = this->as_->init (this->peer (), - Mpeg_Global::rttag, - -INET_SOCKET_BUFFER_SIZE); - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) Audio_Server init failed ()\n"),-1); - result = as_->run (); - // ACE_Reactor::instance ()->end_event_loop (); - TAO_ORB_Core_instance ()->orb ()-> shutdown (); - if (result != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) handle_connection : %d\n"), - result); - return result; - break; - default: - this->destroy (); - return 0; - } - break; - default: - ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t)Unknown command received\n"),-1); - break; - } - - return 0; -} - -int -AV_Svc_Handler::close (u_long) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t)AV_Svc_Handler::close called \n")); - return 0; -} - -int -AV_Svc_Handler::handle_timeout (const ACE_Time_Value &, - const void *arg) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t)AV_Svc_Handler::handle_timeout called \n")); - return 0; -} - -// AV_Server_Sig_Handler routines - -AV_Server_Sig_Handler::AV_Server_Sig_Handler (void) -{ -} - -int -AV_Server_Sig_Handler::register_handler (void) -{ - // Assign the Sig_Handler a dummy I/O descriptor. Note that even - // though we open this file "Write Only" we still need to use the - // ACE_Event_Handler::NULL_MASK when registering this with the - // ACE_Reactor (see below). - this->handle_ = ACE_OS::open (ACE_DEV_NULL, O_WRONLY); - ACE_ASSERT (this->handle_ != -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) sig_handler == %d\n", - this->handle_)); - - // Register signal handler object. Note that NULL_MASK is used to - // keep the ACE_Reactor from calling us back on the "/dev/null" - // descriptor. - - if (TAO_ORB_Core_instance ()->reactor ()->register_handler - (this, ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - - // handles these signals. - // this->sig_set.fill_set (); - this->sig_set.sig_add (SIGCHLD); - this->sig_set.sig_add (SIGBUS); - this->sig_set.sig_add (SIGINT); - this->sig_set.sig_add (SIGTERM); - - // Register the signal handler object to catch the signals. if - if (TAO_ORB_Core_instance ()->reactor ()->register_handler - (this->sig_set, this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", - "register_handler"), - -1); - return 0; -} - -// Called by the ACE_Reactor to extract the fd. -ACE_HANDLE -AV_Server_Sig_Handler::get_handle (void) const -{ - return this->handle_; -} - -int -AV_Server_Sig_Handler::handle_input (ACE_HANDLE) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) handling asynchonrous input...\n")); - return 0; -} - -int -AV_Server_Sig_Handler::shutdown (ACE_HANDLE, ACE_Reactor_Mask) -{ - ACE_DEBUG ((LM_DEBUG, "(%t) closing down Sig_Handler...\n")); - return 0; -} - -// This method handles all the signals that are being caught by this -// object. In our simple example, we are simply catching SIGALRM, -// SIGINT, and SIGQUIT. Anything else is logged and ignored. -// -// There are several advantages to using this approach. First, -// the behavior triggered by the signal is handled in the main event -// loop, rather than in the signal handler. Second, the ACE_Reactor's -// signal handling mechanism eliminates the need to use global signal -// handler functions and data. - -int -AV_Server_Sig_Handler::handle_signal (int signum, siginfo_t *, ucontext_t *) -{ - ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum)); - - switch (signum) - { - case SIGCHLD: - // Handle the death of child signal. - this->clear_child (SIGCHLD); - break; - case SIGBUS: - // Handle the Bus error signal - case SIGINT: - // Handle the interrupt signal - case SIGTERM: - // Handle the process termination signal. - this->int_handler (signum); - break; - default: - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %S: not handled, returning to program\n", - signum)); - break; - } - return 0; -} - -// SIGCHLD handler -void -AV_Server_Sig_Handler::clear_child (int sig) -{ - int pid; - int status; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Server: Reaping the children\n")); - // reap the children - while ((pid = ACE_OS::waitpid (-1, - &status, - WNOHANG)) > 0) - { - // decrement the count of number of active children - Mpeg_Global::session_num --; - - if (status == 0) - continue; - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Server: child %d (status %d)\n", - pid, - status)); - } - return; -} - -// ctrl-c, Bus error, interrupt sig handler -void -AV_Server_Sig_Handler::int_handler (int sig) -{ - TAO_ORB_Core_instance ()->orb ()->shutdown (); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV server killed by signal %d\n", - sig)); -} - -AV_Server_Sig_Handler::~AV_Server_Sig_Handler (void) -{ - TAO_ORB_Core_instance ()->reactor ()->remove_handler (this->sig_set); -} - -// AV_Server routines - -// Default Constructor -AV_Server::AV_Server (void) -{ -} - -// %% move to the destructor or sig handler -void -AV_Server::on_exit_routine (void) -{ - // %% what does the following do - if (Mpeg_Global::parentpid != ACE_OS::getpid ()) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) Process is exiting\n")); - return; - } - - // %% what does the following do - if (Mpeg_Global::live_audio > 1) - ExitLiveAudio (); - if (Mpeg_Global::live_video > 1) - ExitLiveVideo (); - // ComCloseServer(); -} - - -// Parses the command line arguments -int -AV_Server::parse_args (int argc, - char **argv) -{ - ACE_Get_Opt get_opts (argc, argv, "rd:s:vamh"); - int c; - - while ((c = get_opts ()) != -1) - switch (c) - { - case 'r': // real time flag - Mpeg_Global::rttag = 1; - break; - case 'd': // clock drift in ppm - Mpeg_Global::drift_ppm = ACE_OS::atoi (get_opts.optarg); - break; - case 's':// limit on number of sessions - Mpeg_Global::session_limit = ACE_OS::atoi (get_opts.optarg); - break; - case 'v':// live video flag - Mpeg_Global::live_video = 1; - break; - case 'a':// live audio flag - Mpeg_Global::live_audio = 1; - break; - case 'm':// remove flag - ACE_OS::unlink (VCR_UNIX_PORT); - break; - case '?': - case 'h':// help flag - ACE_DEBUG ((LM_DEBUG, - "Usage: %s [-r ] [-m]\n" - " [-d#int(clock drift in ppm)]\n" - " [-s#int(limit on number of sessions)]\n" - " [-v] [-a] [-?] [-h]", - argv [0])); - return -1; - } - return 0; -} - - -// Initializes the mpeg server -int -AV_Server::init (int argc, - char **argv, - CORBA::Environment& env) -{ - int result; - - // Initialize the orb_manager - this->orb_manager_.init_child_poa (argc, - argv, - "child_poa", - env); - TAO_CHECK_ENV_RETURN (env, - -1); - - CORBA::ORB_var orb = - this->orb_manager_.orb (); - - PortableServer::POA_var child_poa = - this->orb_manager_.child_poa (); - // Initialize the Naming Server - // this->naming_server_.init (orb, - // child_poa); - - result = this->parse_args (argc, argv); - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Error parsing arguments"), - -1); - - // Register the various signal handlers with the reactor. - result = this->signal_handler_.register_handler (); - - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Error registering signal handler"), - -1); - - ::atexit (on_exit_routine); - return 0; -} - -// Runs the mpeg server -int -AV_Server::run (CORBA::Environment& env){ - int result; - this->server_control_addr_.set (VCR_TCP_PORT); - - // "listen" on the socket - if (this->acceptor_.open (this->server_control_addr_, - TAO_ORB_Core_instance ()->reactor ()) == -1) - // 0, - // 0 - // &this->thread_strategy_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) acceptor_handler == %d\n", - this->acceptor_.get_handle ())); - - // Run the ORB event loop - this->orb_manager_.run (env); - - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Server::run () " - "came out of the (acceptor) " - "event loop %p\n", - "run_event_loop")); - return 0; - -} - -AV_Server::~AV_Server (void) -{ - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) AV_Server: Removing handlers from the Reactor\n")); - - if (TAO_ORB_Core_instance ()->reactor ()->remove_handler - (this->acceptor_.get_handle (), - ACE_Event_Handler::ACCEPT_MASK) == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) remove_handler for acceptor failed\n")); - - if (TAO_ORB_Core_instance ()->reactor ()->remove_handler - (&this->signal_handler_, - ACE_Event_Handler::NULL_MASK) == -1) - ACE_ERROR ((LM_ERROR, - "(%P|%t) remove_handler for sig_handler failed\n")); - -} - -int -main (int argc, char **argv) -{ - AV_Server vcr_server; - - TAO_TRY - { - // Parses the arguments, and initializes the server. - if (vcr_server.init (argc, argv, TAO_TRY_ENV) == -1) - return 1; - - // Runs the reactor event loop. - vcr_server.run (TAO_TRY_ENV); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("Exception"); - return -1; - } - TAO_ENDTRY; - - return 0; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h deleted file mode 100644 index dca16183315..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/server.h +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- c++ -*- */ -/* $Id$ */ - -// ============================================================================ -// -// = LIBRARY -// server -// -// = FILENAME -// server.h -// -// = DESCRIPTION -// @@ Please add a synopsis of this file. -// -// = AUTHORS -// Sumedh Mungee (sumedh@cs.wustl.edu) -// Nagarajan Surendran (naga@cs.wustl.edu) -// -// ============================================================================ - -#if !defined (TAO_AV_SERVER_H) -#define TAO_AV_SERVER_H - -#include "ace/Get_Opt.h" -#include "ace/Acceptor.h" -#include "ace/Svc_Handler.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_CODgram.h" -#include "ace/Select_Reactor.h" - -#include "include/common.h" -#include "mpeg_server/server_proto.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/com.h" -#include "mpeg_server/Video_Control_i.h" -#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h" - -#if defined (NATIVE_ATM) -#include "atmcom.h" -#endif /* NATIVE_ATM */ - -#include "mpeg_server/Video_Server.h" -#include "mpeg_server/Audio_Server.h" - -// Forward declaration. -class AV_Svc_Handler; - -// @@ We should probably try to replace the ACE_Acceptor with the -// ACE_Strategy_Acceptor using the ACE_Process_Strategy... -// : public virtual ACE_Acceptor <AV_Svc_Handler, ACE_SOCK_ACCEPTOR> -// { -// // = TITLE -// // This defines a AV_Acceptor which is an Acceptor and -// // overrides the make_svc_handler method of the Acceptor. -// // -// // = DESCRIPTION -// // This class overrides the Acceptor's make_svc_handler so that a -// // AV_Svc_Handler can be created with a non-default constructor. -// public: -// virtual int make_svc_handler (AV_Svc_Handler *&sh); -// // Create a new <AV_Svc_Handler> passing 'this' to the service -// // handler. -// }; - -class AV_Svc_Handler - : public virtual ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH> -{ - // = TITLE - // This class defines the service handler for a new connection to - // the AV_Server. - // - // = DESCRIPTION - // This calls the handle_connection method for a new connection - // which demuxes the connection to a video or audio server - // depending on the connection request. -public: - // = Initialization method. - AV_Svc_Handler (ACE_Thread_Manager *t = 0); - - virtual int open (void *); - // Perform the work of the SVC_HANDLER. Called by the acceptor - // when a new connection shows up - - virtual int handle_connection (ACE_HANDLE = ACE_INVALID_HANDLE); - // Handle one client connection. - - virtual int svc (void); - // Thread method - - virtual int close (u_long); - // Called if ACE_Svc_Handler is closed down unexpectedly. - - int handle_timeout (const ACE_Time_Value &, - const void *arg); - // handle the timeout - -private: - - ACE_SOCK_CODgram dgram_; - // the UDP data socket - - ACE_INET_Addr server_data_addr_; - // Data (UDP) Address of this server. - - ACE_INET_Addr client_data_addr_; - // Data (UDP) Address of the client. - - Video_Server *vs_; - // @@ need a similar component for audio! - - Audio_Server *as_; - // the audio server. -}; - -class AV_Server_Sig_Handler - : public virtual ACE_Event_Handler -{ -public: - AV_Server_Sig_Handler (void); - - virtual ACE_HANDLE get_handle (void) const; - - int register_handler (void); - // this will register this sig_handler - // with the reactor for SIGCHLD,SIGTERM,SIGINT - - virtual int shutdown (ACE_HANDLE, - ACE_Reactor_Mask); - - virtual int handle_input (ACE_HANDLE); - // handle input on the dummy handle. - - virtual int handle_signal (ACE_HANDLE signum, - siginfo_t * = 0, - ucontext_t* = 0); - // handles the SIGCHLD,SIGTERM,SIGINT for the parent process i.e - // the main thread.. - - void int_handler (int sig); - // Signal handler function for SIGTERM,SIGBUS,SIGINT - - void clear_child (int sig); - // Signal handler function for SIGCHLD - - ~AV_Server_Sig_Handler (void); - // Destructor - -private: - ACE_HANDLE handle_; - // dummy handle for the sig handler. - ACE_Sig_Set sig_set; -}; - -class AV_Server -{ - // = TITLE - // Defines a class that abstracts the functionality of a - // video and audio server. - // - // = DESCRIPTION - // Using the class is as simple as calling init () first and then - // run. It uses an acceptor with the default ACE_Reactor::instance (). -public: - AV_Server (void); - // constructor - - int init (int argc, - char **argv, - CORBA::Environment& env); - // Initialize the AV_Server - - int run (CORBA::Environment& env); - // Run the AV_Server - - static void on_exit_routine (void); - // Routine called when this process exits. - - ~AV_Server (void); - // Destructor -private: - - // @@ Why are some of these data members pointers and others - // objects? Shouldn't we be consistent here? - - // TAO_Naming_Server naming_server_; - // the TAO naming server - - TAO_ORB_Manager orb_manager_; - // the TAO ORB manager. - - // %% need to comment!! - // typedef ACE_Strategy_Acceptor <AV_Svc_Handler, ACE_SOCK_ACCEPTOR> AV_ACCEPTOR; - // typedef ACE_Thread_Strategy <AV_Svc_Handler> AV_THREAD_STRATEGY; - typedef ACE_Acceptor <AV_Svc_Handler, ACE_SOCK_ACCEPTOR> AV_ACCEPTOR; - // AV_THREAD_STRATEGY thread_strategy_; - // the strategy - - AV_ACCEPTOR acceptor_; - // the acceptor - - AV_Server_Sig_Handler signal_handler_; - // Signal handler for SIGCHLD,SIGINT,SIGTERM,SIGBUS - - ACE_INET_Addr server_control_addr_; - // Control (TCP) Address of this server. - - int parse_args (int argcs, - char **argv); - // Parse the arguments. -}; - -#endif /* TAO_AV_SERVER_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/svc.conf b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/svc.conf deleted file mode 100644 index 0dc3a36726b..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/svc.conf +++ /dev/null @@ -1,50 +0,0 @@ -# $Id$ -# -# This file contains a sample ACE_Service_Config configuration -# file specifying the strategy factories utilized by an application -# using TAO. There are currently only two possible factories: -# Client_Strategy_Factory and Server_Strategy_Factory. These names -# must be used as the second argument to their corresponding line, -# because that's what the ORB uses to find the desired factory. -# -# Note that there are two unordinary characteristics of the way *this* -# file is set up: -# - both client and server strategies are specified in the same -# file, which would only make sense for co-located clients & servers -# - both of the factories are actually sourced out of libTAO.so -# (TAO.DLL on Win32), and they would normally be in a separate -# dll from the TAO ORB Core. -# -# The options which can be passed to the Resource Factory are: -# -# -ORBresources <which> -# where <which> can be 'global' to specify globally-held resources, -# or 'tss' to specify thread-specific resources. -# -# The options which can be passed to the Client are: -# <none currently> -# -# The options which can be passed to the Server are: -# -# -ORBconcurrency <which> -# where <which> can be 'thread-per-connection' to specify -# use of the ACE_Threaded_Strategy concurrency strategy, -# or 'reactive' to specify use of the ACE_Reactive_Strategy -# concurrency strategy. -# -# -ORBthreadflags <flags> -# specifies the default thread flags to use, where <flags> is a -# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, -# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid -# on every platform. -# -# -ORBdemuxstrategy <which> -# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', -# and specifies the type of object lookup strategy used internally. -# -ORBtablesize <unsigned> -# specifies the size of the object table -# -dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global" -dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() -###dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" -dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vcrs.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vcrs.cpp deleted file mode 100644 index fd232eb1a62..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vcrs.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* $Id$ */ -/* Copyright (c) 1995 Oregon Graduate Institute of Science and Technology - * P.O.Box 91000-1000, Portland, OR 97291, USA; - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of O.G.I. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. O.G.I. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * O.G.I. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * O.G.I. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN - * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Shanwei Cen - * Department of Computer Science and Engineering - * email: scen@cse.ogi.edu - */ -#include <sys/types.h> -#include <stdio.h> -#include <string.h> -#include <sys/uio.h> -#include <unistd.h> -#include <stdlib.h> - -#include <errno.h> -#include <signal.h> -#include <sys/wait.h> -#include <time.h> -#include <sys/time.h> -#include "../include/common.h" -#include "../mpeg_shared/com.h" -#include "../mpeg_shared/routine.h" -#include "../mpeg_server/proto.h" - -#define SESSION_NUM 4 - -static int parentpid = -1; - -static int listenSocketIn = -1; -static int listenSocketUn = -1; - -static struct linger linger = {1,1}; - -static int live_audio = 0, live_video = 0; /* 0 - no, 1 - to open, 2 - opened */ - -int drift_ppm = 0; /* clock drift in ppm */ - -int session_limit = SESSION_NUM; -int session_num = 0; - -static void int_handler(int sig) -{ - /* - fprintf(stderr, "process %d killed by sig %d\n", getpid(), sig); - */ - exit(0); -} - -static void on_exit_routine(void) -{ - if (parentpid != getpid()) { - /* - fprintf(stderr, "process %d exiting...\n", getpid()); - */ - return; - } - /* - fprintf(stderr, "deamon exiting . . .\n"); - */ - if (live_audio > 1) ExitLiveAudio(); - if (live_video > 1) ExitLiveVideo(); - ComCloseServer(); -} - -static void clear_child(int sig) -{ - int pid; - int status; - - while ((pid = waitpid(-1, &status, WNOHANG)) > 0) - { - session_num --; - - if (status == 0) { - continue; - } - fprintf(stderr, "VCRS: child %d (status %d) ", pid, status); - if (WIFEXITED(status)) { - fprintf(stderr, "exited with status %d\n", WEXITSTATUS(status)); - } - else if (WIFSIGNALED(status)) { -#if defined(_HPUX_SOURCE) || defined(__svr4__) || defined(IRIX) - fprintf(stderr, "terminated at signal %d%s.\n", WTERMSIG(status), - WCOREDUMP(status) ? ", core dumped" : ""); -#else - fprintf(stderr, "terminated at signal %d.\n", WTERMSIG(status)); -#endif - } - else if (WIFSTOPPED(status)) { - fprintf(stderr, "stopped at signal %d\n", WSTOPSIG(status)); - } - - } -} - -main(int argc, char *argv[]) -{ - int i, rttag = 0; - int addrlen; - - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-rt")) { - rttag = 1; - } - else if (!strcmp(argv[i], "-nrt")) { - rttag = 0; - } - else if (!strncmp(argv[i], "-d", 2)) { - sscanf(&argv[i][2], "%d", &drift_ppm); - } - else if (!strncmp(argv[i], "-s", 2)) { - sscanf(&argv[i][2], "%d", &session_limit); - if (session_limit < 1) - session_limit = SESSION_NUM; - } - else if (!strcmp(argv[i], "-lv")) { - live_video = 1; - } - else if (!strcmp(argv[i], "-la")) { - live_audio = 1; - } - else if (!strcmp(argv[i], "-rm")) { - unlink(VCR_UNIX_PORT); - } - else if (!strncmp(argv[i], "-he", 3)) { - fprintf(stderr, "Usage: %s [-rt] [-nrt] [-rm]\n", argv[0]); - fprintf(stderr, " [-d#int(clock drift in ppm)]\n"); - fprintf(stderr, " [-s#int(limit on number of sessions)]\n"); - exit(1); - } - } - if (drift_ppm) { - fprintf(stderr, "Clock set to drift at %d ppm (positive is faster and neg. slower)\n", - drift_ppm); - } - - setsignal(SIGCHLD, clear_child); - setsignal(SIGPIPE, SIG_IGN); - setsignal(SIGBUS, int_handler); - setsignal(SIGINT, int_handler); - setsignal(SIGTERM, int_handler); - setsignal(SIGALRM, SIG_IGN); - - parentpid = getpid(); - - atexit(on_exit_routine); - - if (live_audio) { - if (InitLiveAudio(argc, argv) == -1) - live_audio = 0; - else - live_audio = 2; - } - - if (live_video) { - if (InitLiveVideo(argc, argv) == -1) - live_video = 0; - else - live_video = 2; - } - - ComInitServer(VCR_TCP_PORT, VCR_UNIX_PORT, VCR_ATM_PORT); - - /* - setpgrp(); - */ - { - char buf[100]; - sprintf(buf, "%s%s", LOG_DIR, "vcrsSession.log"); - if (freopen(buf, "a", stdout) == NULL) { - freopen("/dev/null", "w", stdout); - } - } - - for (;;) - { - int val; - unsigned char cmd; - int serverpid = -1; - int cfd, dfd; - int max_pkt_size; - - if (ComGetConnPair(&cfd, &dfd, &max_pkt_size) == -1) continue; - - if ((serverpid = fork()) == -1) - { - perror("VCRS error on creating service process"); - exit(1); - } - session_num ++; - if (serverpid > 0) /* parent process for forking servers */ - { - ComCloseFd(cfd); - ComCloseFd(dfd); - continue; - } - else - { - if (session_num > session_limit) { - time_t t; - char *buf; - t = time(NULL); - buf = ctime(&t); - buf[strlen(buf) - 1] = 0; - fprintf(stderr, "VCRS: %s, session_limit %d, session_number %d\n", - buf, session_limit, session_num); - } - - if ((val = read(cfd, &cmd, 1)) < 0) - { - perror("VCRS fails to read command from service socket"); - exit(1); - } - if (val == 0) { - fprintf(stderr, "Remote client has closed connection.\n"); - ComCloseConn(cfd); - ComCloseConn(dfd); - /* continue; -- I don't know why I wrote this line? scen 5-12-96 */ - exit(0); - } - ComCloseListen(); - if (cmd == CmdINITvideo) - { - /* - fprintf(stderr, "Server forked a VideoServer process.\n"); - */ - if (live_audio) LeaveLiveAudio(); - VideoServer(cfd, dfd, rttag, max_pkt_size); - fprintf(stderr, "Weird: video server returned.\n"); - } - else - { - /* - fprintf(stderr, "Server forked a AudioServer process.\n"); - */ - if (live_video) LeaveLiveVideo(); - AudioServer(cfd, dfd, rttag, max_pkt_size); - fprintf(stderr, "Weird: audio server returned.\n"); - } - exit(1); - } - } -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp deleted file mode 100644 index 697f680bdcb..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// $Id$ - -#include "mpeg_server/Video_Server.h" - -int -main (int argc, char **argv) -{ - ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); - Video_Server video_server; - - TAO_TRY - { - // Parses the arguments, and initializes the server. - if (video_server.init (argc, - argv, - TAO_TRY_ENV) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Video_Server: init failed\n"), - -1); - - char sem_str [BUFSIZ]; - pid_t my_pid; - - if ((my_pid = ACE_OS::getpid ()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Unable to get my pid!\n"), - -1); - - - sprintf (sem_str, - "%s:%d", - "Video_Server_Semaphore", - my_pid); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) semaphore is %s\n", - sem_str)); - // Release the lock on which the server is waiting - ACE_Process_Semaphore semaphore (0, // 0 means that the semaphore is - // initially locked - sem_str); - - if (semaphore.release () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Error releasing semaphore %s: %p\n", - sem_str, - "semaphore.release ()"), - -1); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) %s:%d\n", - __FILE__, - __LINE__)); - // Increment ACE_SV_Semaphore by one. Dijkstra's V operation, - // Tannenbaums UP operation. - - // %% potential race condition if the client - // sends a request before we enter the event loop - // Runs the reactor event loop. - video_server.run (TAO_TRY_ENV); - TAO_CHECK_ENV; - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("Exception"); - return -1; - } - TAO_ENDTRY; - - return 0; -} diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.h b/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.h deleted file mode 100644 index a25d479af65..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/source/server/vs.h +++ /dev/null @@ -1,212 +0,0 @@ -/* -*- c++ -*- */ -/* $Id$ */ - -// ============================================================================ -// -// = LIBRARY -// server -// -// = FILENAME -// vs.h -// -// = DESCRIPTION -// @@ Please add a synopsis of this file. -// -// = AUTHORS -// Sumedh Mungee (sumedh@cs.wustl.edu) -// Nagarajan Surendran (naga@cs.wustl.edu) -// -// ============================================================================ - -#if !defined (TAO_AV_VS_H) -#define TAO_AV_VS_H - -#include "ace/Get_Opt.h" -#include "ace/Acceptor.h" -#include "ace/Svc_Handler.h" -#include "ace/SOCK_Acceptor.h" -#include "ace/INET_Addr.h" -#include "ace/SOCK_CODgram.h" -#include "ace/Select_Reactor.h" - -#include "include/common.h" -#include "mpeg_server/server_proto.h" -#include "mpeg_shared/fileio.h" -#include "mpeg_shared/routine.h" -#include "mpeg_shared/com.h" -#include "mpeg_server/Video_Control_i.h" -#include "orbsvcs/orbsvcs/Naming/Naming_Utils.h" - -#if defined (NATIVE_ATM) -#include "atmcom.h" -#endif /* NATIVE_ATM */ - -#include "mpeg_server/Video_Server.h" - -// Forward declaration. -class AV_Svc_Handler; - -// @@ We should probably try to replace the ACE_Acceptor with the -// ACE_Strategy_Acceptor using the ACE_Process_Strategy... -class AV_Acceptor - : public virtual ACE_Acceptor <AV_Svc_Handler, ACE_SOCK_ACCEPTOR> -{ - // = TITLE - // This defines a AV_Acceptor which is an Acceptor and - // overrides the make_svc_handler method of the Acceptor. - // - // = DESCRIPTION - // This class overrides the Acceptor's make_svc_handler so that a - // AV_Svc_Handler can be created with a non-default constructor. -public: - virtual int make_svc_handler (AV_Svc_Handler *&sh); - // Create a new <AV_Svc_Handler> passing 'this' to the service - // handler. -}; - -class AV_Svc_Handler - : public virtual ACE_Svc_Handler <ACE_SOCK_STREAM, ACE_NULL_SYNCH> -{ - // = TITLE - // This class defines the service handler for a new connection to - // the AV_Server. - // - // = DESCRIPTION - // This calls the handle_connection method for a new connection - // which demuxes the connection to a video or audio server - // depending on the connection request. -public: - // = Initialization method. - AV_Svc_Handler (ACE_Reactor * = 0, - AV_Acceptor * = 0); - - virtual int open (void *); - // Perform the work of the SVC_HANDLER. Called by the acceptor - // when a new connection shows up - - virtual int handle_connection (ACE_HANDLE = ACE_INVALID_HANDLE); - // Handle one client connection. - - virtual int svc (void); - // Thread method - - virtual int close (u_long); - // Called if ACE_Svc_Handler is closed down unexpectedly. - - int handle_timeout (const ACE_Time_Value &, - const void *arg); - // handle the timeout - -private: - - ACE_SOCK_CODgram dgram_; - // the UDP data socket - - ACE_INET_Addr server_data_addr_; - // Data (UDP) Address of this server. - - ACE_INET_Addr client_data_addr_; - // Data (UDP) Address of the client. - - AV_Acceptor *acceptor_; - // Pointer to the Acceptor that created us so that we can remove it - // from the <ACE_Reactor> when we <fork>. - - // @@ need a similar component for audio! - Video_Server *vs_; -}; - -class AV_Server_Sig_Handler - : public virtual ACE_Event_Handler -{ -public: - AV_Server_Sig_Handler (void); - - virtual ACE_HANDLE get_handle (void) const; - - int register_handler (void); - // this will register this sig_handler - // with the reactor for SIGCHLD,SIGTERM,SIGINT - - virtual int shutdown (ACE_HANDLE, - ACE_Reactor_Mask); - - virtual int handle_input (ACE_HANDLE); - // handle input on the dummy handle. - - virtual int handle_signal (ACE_HANDLE signum, - siginfo_t * = 0, - ucontext_t* = 0); - // handles the SIGCHLD,SIGTERM,SIGINT for the parent process i.e - // the main thread.. - - void int_handler (int sig); - // Signal handler function for SIGTERM,SIGBUS,SIGINT - - void clear_child (int sig); - // Signal handler function for SIGCHLD - - ~AV_Server_Sig_Handler (void); - // Destructor - -private: - ACE_HANDLE handle_; - // dummy handle for the sig handler. - ACE_Sig_Set sig_set; -}; - -class AV_Server -{ - // = TITLE - // Defines a class that abstracts the functionality of a - // video and audio server. - // - // = DESCRIPTION - // Using the class is as simple as calling init () first and then - // run. It uses an acceptor with the default ACE_Reactor::instance (). -public: - AV_Server (void); - // constructor - - int init (int argc, - char **argv, - CORBA::Environment& env); - // Initialize the AV_Server - - int run (CORBA::Environment& env); - // Run the AV_Server - - static void on_exit_routine (void); - // Routine called when this process exits. - - ~AV_Server (void); - // Destructor -private: - - // @@ Why are some of these data members pointers and others - // objects? Shouldn't we be consistent here? - - TAO_Naming_Server naming_server_; - // the TAO naming server - - TAO_ORB_Manager orb_manager_; - // the TAO ORB manager. - - Video_Control_i video_control_; - // The Video_Control implementation object. - - AV_Acceptor acceptor_; - // the acceptor - - AV_Server_Sig_Handler signal_handler_; - // Signal handler for SIGCHLD,SIGINT,SIGTERM,SIGBUS - - ACE_INET_Addr server_control_addr_; - // Control (TCP) Address of this server. - - int parse_args (int argcs, - char **argv); - // Parse the arguments. -}; - -#endif /* TAO_AV_VS_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/vcr.1 b/TAO/orbsvcs/tests/AVStreams/mpeg/vcr.1 deleted file mode 100644 index 24e9688f674..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/vcr.1 +++ /dev/null @@ -1,610 +0,0 @@ -.\" Copyright (c) 1995 Oregon Graduate Institute -.TH vcr 1 "November 1995" "MPEG video audio player" - -.SH NAME -.B vcr vcrs -\- Distributed, real-time synchronized video audio player, version 2.0 -.SH SYNOPSIS - -.B vcrs -[ -.B \-rt -] [ -.B \-rm -] [ -.B \-s\fIsession_limit\fP -] [ -.B \-help -] - -.B vcr -[ -.B\-rt -] [ -.B \-shmem -] [ -.B \-rmsem -] -.ti +5n -[ -.BR \-dither " ordered\||\|ordered2\||\|fs4\||\|fs2\||\|fs2fast\||\|hybrid\||\| -.if n .ti +5n - hybrid2\||\|2x2\||\|gray\||\|color\||\|mono\||\|threshold -] -.if n .ti +5n -[ -.I X-window options -] -.if n .ti +5n -[ -.BR \-v " \fI[hostname:]video-filename\fP" -] -.if n .ti +5n -[ -.BR \-a " \fI[hostname:]audio-filename\fP" -] -.if n .ti +5n -[ -.BR \-p " \fImovie-file-name\fP" -] -.if n .ti +5n -[ -.BR \-l " \fImovie-list-file-name\fP" -] -.if n .ti +5n -[ -.BR \-quiet -] -.if n .ti +5n -[ -.BR \-help -] -.SH DESCRIPTION - -The player plays \fBMPEG\-1\fP video and \fB8\-bit mu\-law (Sun -Sparc)\fP audio. It supports -following \fBfour types\fP of playback: -.TP -\ \ \ \(bu -Plays both video and audio synchronously, in real-time mode. Video -frames, or even audio samples are dropped if needed. -.TP -\ \ \ \(bu -Plays video only, in real-time mode. Video frames are dropped if -needed. -.TP -\ \ \ \(bu -Plays video only, in best-effort mode, video frames are played as fast -as possible. -.TP -\ \ \ \(bu -Plays audio only, in real time mode. -.PP - -When video/audio is played in \fBreal-time\fP mode, play speed (defined in -terms of frames-per-second (fps) for video and samples-per-second (sps) -for audio) can be specified through a speed scale. If audio is played at a -speed other than the recording (normal) speed, samples are interpolated. - -When video is played in \fBbest-effort\fP mode, the player tries its -best to play video frame by frame, and not to drop frames. This mode -is not supported very well. Now and then some frames may be -dropped. Audio is disabled in this mode. - -As well as various types of playback, the player also supports other -common VCR functions such as fast forward, rewind, step -(forward), random positioning, etc.. - -The player is of \fBdistributed architecture\fP, with servers and -clients communicating across Internet. A \fBserver\fP resides on a -host, and services coming audio/video retrieval requests from clients. -A \fBclient\fP receives instructions from the user, makes connection -to servers, buffers incoming streams, decodes video frames, -interpolates audio samples, and outputs audio and video to -corresponding devices in a timely manner. A client can connect to -different servers for audio and video streams, and still plays them -synchronously. - - -.SH SERVER - -To start the server, type: - -.B vcrs -[ -.B \-rt -] [ -.B \-rm -] [ -.B \-s\fIsession_limit\fP -] [ -.B \-help -] - -One host can have a SINGLE server running, which responds to -connection requests from all clients to that host. Subsequent -invocation is terminated with an error message. - -\fBOptions\fP - -.IP "\fB-rt\fP" -On \fBhpux\fP, \fBsparc-sunos5.3\fP and \fBi86pc-solaris2.4\fP, if you -have real-time execution privilege, you can start the server with -the option \fB\-rt\fP to get better service. - -.IP "\fB-rm\fP" -With option \fB\-rm\fP, the server will try to remove socket names -left by previous crashed invocations before initialization. - -.IP "\fB-s\fIsession_limit\fP" - -With the option of \fB\-s\fP followed by a positive integer, e.g. -\fB-s2\fP, \fB-s4\fP or \fB-s10\fP, the number of sessions -serviced by the server at any time will be limited to be no more than -the given number. Both audio and video sessions are counted. The -default session number limit is \fB4\fI. - -.IP "\fB-help\fP" -This option tells the server to print all available options and then -quit. - -.PP - -In a video session, the server tries to find a -corresponding \fB.Info\fP file describing the structure of the MPEG -file of the session. If this fails, the server scans the MPEG file for -structure information and tries to create the \fB.Info\fP file. For -big MPEG files, this scanning process may take quite a few minutes -(some times even tens of minutes). If the \fB.Info\fP file is found, -the server simply reads structure information from it. - -.SH CLIENT - -The client program is available on \fBsun4\fP, \fBhpux\fP and -\fBi86pc-solaris2.4\fP. It needs a \fBMotif\fP environment, and -outputs audio to the default \fBAudioFile\fP server. If the client -fails to connect to the default AudioFile server, then the audio is -disabled. - -To start the client, type: - -.B vcr -[ -.B\-rt -] [ -.B \-shmem -] [ -.B \-rmsem -] -.ti +5n -[ -.BR \-dither " ordered\||\|ordered2\||\|fs4\||\|fs2\||\|fs2fast\||\|hybrid\||\| -.if n .ti +5n - hybrid2\||\|2x2\||\|gray\||\|color\||\|mono\||\|threshold -] -.if n .ti +5n -[ -.I X-window options -] -.if n .ti +5n -[ -.BR \-v " \fI[hostname:]video-filename\fP" -] -.if n .ti +5n -[ -.BR \-a " \fI[hostname:]audio-filename\fP" -] -.if n .ti +5n -[ -.BR \-p " \fImovie-file-name\fP" -] -.if n .ti +5n -[ -.BR \-l " \fImovie-list-file-name\fP" -] -.if n .ti +5n -[ -.BR \-quiet -] -.if n .ti +5n -[ -.BR \-help -] - -\fBOptions\fP - -.IP \fB-rt\fP -On \fBhpux\fP, and \fBi86pc-solaris2.4\fP, if you have real-time -execution privilege, with this option you may get better service. -.IP \fB-shmem\fP -With this option, the client tries to output video frames to the -X-server via shared memory instead of sockets. -.IP \fB-rmsem\fP -With this option, prior to initialization, the client tries to remove -\fBall\fP existing semaphore and shared memory ids you have access to. -\fBBe careful\fP, with this option, you also face the danger of -removing semaphores or shared memory ids being used by other programs, -as well as all the ones created by failed invocation of the player. See -\fBSemaphore ids and shared memory ids used up\fP in \fBKNOWN PROBLEMS\fP -section. -.IP "\fB-dither\fP ordered|ordered2|fs4|fs2|fs2fast|hybrid|" - hybrid2|2x2|gray|color|mono|threshold - -This option specifies the type of dithering performed on video frames -in order to be displayed on an X-window. The default is -\fIordered\fP. \fIcolor\fP only works with full color (24-bit) -displays. All others work with 8-bit color displays. \fImono\fP and -\fIthreshold\fP also work with mono displays. Different types of -dithering have different computational complexity and offer different -image quality. -.IP "\fIX-window options\fP" -All standard X-window Toolkit command line options are accepted -(see \fBX\fP(1)). -.IP "\fB-v\fP \fI[hostname:]video-filename\fP" -The very first program for the player can be specified in command line -with \fB-v\fP and/or \fB-a\fP options, for video and/or audio streams -respectively. - -This option specifies a video stream. If the \fIhostname\fP part is -given, the client tries to connect to a running server on the given -host, and plays the given file. If the hostname part is missing, the -client assumes there is a running server on the local host or tries to -fork one. and tries to connect to it. - -.IP "\fB-a\fP \fI[hostname:]audio-filename\fP" -This option specifies an audio stream of the very first program. -Only file names with suffix \fB.au\fP are accepted as audio files. -.IP "\fB-p\fP \fImovie-file-name\fP" -This option specifies a file specifying a movie to be played upon -client startup. A movies file contains \fBfive lines\fP lines: title, -video host name, video file path, audio host name, and audio file path. -.IP "\fB-l\fP \fImovie-list-file-name\fP" -This option specifies a movie list file to replace the default movie -list file \fI$(HOME)/.vcr/vcrPrograms\fP. A movie list file contains a -banner line, followed by a list of movies. -.IP "\fB-quiet\fP" -This option tells the client not to print any text message. This is -useful when the player is invoked from within a web browser. -.IP "\fB-help\fP" -This option tells the client to print all available options and quit. - -.PP - -\fBOperations\fP - -There are \fBtwelve buttons\fP and \fBfour scales\fP defined in the top-level window. -Buttons from left to right are: -.PP -.IP \fIExit\fP -Exits the client right away. -.IP \fIInfo\fP -Pops up a window containing information about the player. -.IP \fIPara\fP -Pops up a window with a list of parameters. Parameter values -can be viewed and modified through this window. -.IP \fIProg\fP -Pops up a window with a list of programs. You -can select a program from this list to play. -.IP \fIFile\fP -This is an alternative way to select programs. pressing this button -pops up a standard Motif file selection window. You can select -audio/video file on local host to play. The client assumes a running -server on local host, or tries to fork one. - -File names with suffix \fB.au\fP are accepted as audio, and file -names with suffices \fB.mpg\fP, or \fB.mpeg\fP (some or all letters in -the suffices can be upper-case ones) as MPEG video. Other types of -file names are rejected. - -Selection of a new program causes the current program to be discarded. -.IP \fILoop\fP -A toggle button. When pressed, the current program is played -repeatedly until stopped explicitly by the user, otherwise, playback stops when -program end is hit. This button has no effect on rewind and fast -forward. -.IP \fINorm\fP -Restores play speed to the normal (recording) speed. -.IP \fIRewind\fP -For video programs. Plays backward from the current position at a -speed given by the parameter \fI(Rewind frames-per-second)\fP. Only first -frames of MPEG picture groups (I-frames) are played. Audio is -disabled. -.IP \fIStop\fP -Stops active playback, fast forward or rewind. -.IP \fIFast-Forward\fP -For video programs. Plays forward from the current position at a speed -given by the parameter \fI(FF frames-per-second)\fP. Only first frames of MPEG -picture groups (I-frames) are played. Audio is disabled. -.IP \fIPlay\fP -Plays the program from the current position in one of the two modes, -depending on if video is involved and the value of an parameter \fI(Real -time(audio on)(tag))\fP: -.RS -.IP - -Best-effort mode, if the parameter is off (0), and video is involved. -.IP - -Real-time mode, otherwise. -.RE -.IP \fIStep\fP -Steps forward for one frame from the current position. -.PP -Clicking on buttons \fIRewind\fP, \fIFast-Forward\fP, \fIPlay\fP and -\fIStep\fP and dragging the \fIPlay-Speed\fP scale all stop current -active rewind, fast forward, or play. - -.B "Four scales \fP from left to right are:" - -.IP \fIBalance\fP -Currently not functional, because only mono audio is -supported. -.IP \fIVolume\fP -Audio volume. -.IP \fIPlay-Speed\fP -Specifies play speed for real-time mode playback. This scale is not -completely linear, with a special middle point (\fB50\fP). -.RS -.IP \fB50\fP -normal (recording) speed. -.IP "\fB[1 - 50)\fP" -linear speed value increase from zero to the normal speed. -.IP "\fB(50 - 100]\fP" -Linear speed value increase from the normal speed to the maximum -speed given by the parameter \fI(Video max frames-per-second)\fP when -video is involved in the current program, or \fI(Audio max -samples-per-second)\fP when only audio is involved. -.RE -This scale also defines the upper-limit of the best-effort playback -speed. -.IP \fIPosition\fP -This scale has multiple functionalities: -.RS -.IP - -Indicates the beginning position for rewind, fast forward and -playback. -.IP - -Shows the current position during rewind, fast forward, and playback. -.IP - -Random positioning: you can set the position by dragging the -slider. when video is involved, the first frame of the picture group -at the current position is displayed. -.RE -.PP -.B "Program list" - -.B Program list -is maintained through the \fBprogram list\fP window, which is popped up by -clicking the \fIProg\fP button in the main window. Currently only \fISelect\fP -and \fIDismiss\fP buttons are fully functional, and contents of a selected -program can be viewed (but not modified) by pressing the \fIModify\fP -button. To select a program, \fBhighlight\fP the desired item and -click \fISelect\fP. To modify the program list, edit the program file given -below. - -.B "Parameters" - -.B Parameters -are viewed and maintained through the parameter window, which is activated -by clicking the \fIPara\fP button in the main window. To update a parameter, -\fBhighlight\fP the item, enter the new value in the text window next -to the \fIUpdate\fP button, and press \fIUpdate\fP. Following parameters -are supported: - -.IP "\fIReal time (audio on)(tag)\fP" -Best-effort play mode when this parameter is 0 and video is involved -in the current program, otherwise real-time play mode. Default: 1, -range: 0, non-0. -.IP "\fIVideo max frames-per-second\fP" -For video programs, real-time mode play speed when speed scale has a -value of 100. Default: 60, range: > the normal speed. -.IP "\fIAudio max samples-per-second\fP" -For audio-only programs, play speed when speed scale has a value of -100. Default: 16000, range: > the normal speed. -.IP "\fIFF frames-per-second\fP" -Fast forward speed. Default: 150, range: > 0. -.IP "\fIRewind frames-per-second\fP" -Rewind speed. Default: 150, range: > 0. -.IP "\fIFeedback delay (msec)\fP" -Currently not used. -.IP "\fIAudio output mask\fP" -Currently not used. -.IP "\fIAudio_para.encodeType\fP" -Currently not used. -.IP "\fIAudio_para.channels\fP" -Currently not used. -.IP "\fIAudio_para.samplesPerSecond\fP" -Currently not used. -.IP "\fIAudio_para.bytesPerSamples\fP" -Currently not used. -.IP "\fIAudio timer interval (millisec)\fP" -For audio-only programs. Playback -timer interval in milliseconds. Playback of audio and video is -driven by a timer in the client. Default: 500, range: > 0. -.IP "\fIAudio buffered intervals\fP" -For audio-only programs. This number of timer intervals of audio -samples are to be buffered in the AudioFile server internal buffer. This -parameter and the previous one determine how many milliseconds of -audio samples are to be buffered in AudioFile. Buffering too -many samples reduces responsiveness, too few may degrade playback -quality. Default: 2, range: > 0. -.IP "\fIFrames per audio play\fP" -For audio+video programs, this parameter determines the ratio of the -audio timer interval over the video timer interval. Default: 4, -range: > 0. -.IP "\fIAudio forward (samples)\fP" -For audio+video programs, this number of samples of audio is -played ahead of video stream. This is supposed to compensate the -delay in AudioFile server. Default: 800, range: > 0. -.IP "\fIVS work-ahead (milli-seconds)\fP" -For video program, this number of milli-seconds the player tries to -keep the video server ahead of the client during playback, rewind and -fast forward. - -If the parameter \fISync effective\fP has a value of non-0, then this -parameter gives the initial value of the VS work-ahead time, and the -actual work ahead time is adjusted according to current network delay -jitter level. If a value less than the default is set, then the -default instead of the given one is used by the player. - -Default: 100, range: >= Default. - -.IP "\fIFrame rate limit (fps, float)\fP" -For video programs. In real-time play mode, if current play speed is -higher than the value of this parameter, then this -parameter defines the maximum frame rate the player tries to play. -Default: 60.0, range: >0. -.IP "\fICollect statistics(tag)\fP" -For video programs. If both the server and the client programs are compiled -with STAT defined, this tag indicates that, at the end of a playback -session, when \fIStop\fP button is pressed (or in loop-back mode when the -end of the program is reached) statistics is collected to file -stat.\fIn\fP in current directory (from which the client is -invoked). Default: 0, range: 0, non-0. -.IP "\fICollect video structure info(tag)\fP" -For video programs. If both the server and the client programs are compiled -with STAT defined, this tag indicates that, upon successful -initialization of a video stream, structure information of the MPEG -stream is collected to a file named struct.\fIn\fP in -current directory Default: 0, range: 0, non-0. -.IP "\fISync effective(tag)\fP" -For video programs, when set, server/client synchronization control is -effective during playback, rewind and fast forward. Default: 1, range: -0, non-0. -.IP "\fIQoS effective(tag)\fP" -For video programs, when set, automatic frame rate control is -effective during playback. Default: 1, range: 0, non-0. -.IP "\fIAudio offset(samples)\fP" -For audio+video programs. The player assumes that in a program, audio -and video are recorded strictly synchronously. But it is usually not -the case, and there is a certain amount of timing shift between audio -and video. This parameter specifies audio forward offset against video -in order to compensate the shift. Default: 0, range: integer -.IP "\fIFilter parameter(1/R or n-samples)\fP" -Parameter of the filters for client/server synchronization and frame rate -control. Default: 50, range: > 0. -.IP "\fIMax send pattern frames\fP" -This parameter sets the granularity of the frame rate control -algorithm. Default: 60, range: > 0. -.IP "\fIReliable byte-stream audio (tag)\fP" -In the case when the server is on a remote host, when this tag is set, -the client establishes a TCP connection to the server for shipping -audio samples, otherwise a UDP is used. The client always setup a TCP -connection to the server for control messages, no matter what value -the tag is. -.IP "\fIReliable byte-stream video (tag)\fP" -Similar effort as previous tag, but for video channel. -.IP "\fIVerbose message(tag)\fP" -If this tag is set, then verbose message is printed (provided that -command line option \fB-quiet\fP is not specified. Otherwise the -client will still print some, but less verbose message. -.PP -Parameter setting is for experienced user only. It is suggested that -you leave values of most parameters as default. If you like to change -some of them, be careful. It may make the player behave improperly. In -case you made some change, the player fails to work, and you are -unable to undo the change, delete the parameter file shown below and -restart the client. - -.SH FILES - -.IP "\fI($HOME)/.vcr/vcrPrograms\fP" -Program file. If this file is absent, it is created with a default -movie list of several basketball game sample movies in it. The movies -in the default movies list are maintained at CSE OGI. In a movie list -file, the first line is a banner. Following this line, each contiguous -four lines describe a movie: video host, MPEG file path, audio host, -audio file path. You may edit the movie list fileto include any movies -you like. - -.IP "\fI($HOME)/.vcr/vcrParameters\fP" -Parameter file. When absent, the system default parameter values -apply. Whenever you update a parameter, this parameter file is also -created or updated. - -.SH KNOWN PROBLEMS - -.B "The player stalls" -when or after playing audio program at very \fBlow speed\fP, or the -product of \fI(Audio timer interval)\fP and \fI(Audio buffered intervals)\fP -parameters \fBtoo large\fP, or \fI(Frames per audio play)\fP too -large. This is because the client tries to put too many audio -samples to AudioFile each time, blocking itself for output. - -In this version of the player, when an video+audio program is played, -some conditions are checked and low speed limit is enforced. You -are not able to set too low play speed (even if you set the speed -slider to 0 position). But the conditions might not be sufficient. - -.B "Play at too high speed\fP," -or \fI(Audio timer interval)\fP too small, or \fI(Video max -frames-per-second)\fP, \fI(FF frames-per-second)\fP, or \fI(Rewind -frames-per-second)\fP too high, presentation quality may be worse than -expected. This is because of the resolution limit of the UNIX interval -timer, which is about 10 milliseconds. - -.B "When Play speed jump from high to very low\fP," -a few seconds of worse-than-expected video presentation quality may be -experienced. Because at high speed, the video server usually drops -frames, and play speed changes, the player does not flush the video -pipeline. - -Various problems may be experienced if the \fBparameter\fP values are too -far from their default. The parameter values are seldomly guarded. - -.B "Audio doesn't work when played across the Internet\fP." -This is because audio is retrieved from the audio server to the -client via TCP, and the Internet TCP connection fails to provide -enough (e.g. 8KB/s) sustained bandwidth. In this case, all audio -samples would be too late showing up at the client, and thus are -dropped. - -.B "X shared memory problem\fP." -Parts of the user interface may not work correctly when the player -outputs to X-window via shared memory (with option \fB-shmem\fP). For -example, some of the buttons may not show up. Usually, the missing -buttons will show up by iconifying the user interface. - -.B "Core dump." -The player may core dump when playing a specific MPEG stream, at a -specific position. This may be because the parameters in the MPEG -stream is out of the ability of the decoder code. Upon core dump, you -may want to reproduce the problem, and recompile the player with -option -DNDEBUG, run the player again to see if any assertions fails. - -.B "Semaphore or shared memory ids used up\fP." -When this happens, an error shmget() or semget() is reported by the -player. This may happen if previous invocation(s) of the player have -exit abnormally causing core dump, and you try to run the player -again. Because semaphores and shared memory segments might not be -reclaimed when the player exits abnormally. You may run the client -with option \fB\-rmsem\fP to remove all existing semaphores and shared -memory ids accessable by you. See description of \fB\-rmsem\fP. If -\fB-rmsem\fP does not work, you may need to use tools like -\fBipcrm(1)\fP. - -.B "Undeleted UNIX socket pathes /tmp/vcrs*\fP" -Some UNIX socket names may remain in /tmp directory as "vcrs*", if the -server or the client has terminated abnormally. - -.SH BUG REPORT - -If you experience problems, look at the above KNOWN PROBLEM section -first. If the problem is not described, try to reproduce the problem, and -\fBreport bug\fP to \fBscen@cse.ogi.edu\fP. Thanks. - -.SH COPYRIGHT - -This software is covered by copyrights. It contains code contributed -by the author and several other parties. Please see the beginning of -source files and copyright file(s) in the root directory of the source -kit. - -.SH SEE ALSO - -.B "AF\fP(1), \fBX\fP(1)" - -.SH AUTHOR - - Shanwei Cen - Department of Computer Science and Engineering - Oregon Graduate Institute of Science and Technology - scen@cse.ogi.edu diff --git a/TAO/orbsvcs/tests/AVStreams/mpeg/vcrs.1 b/TAO/orbsvcs/tests/AVStreams/mpeg/vcrs.1 deleted file mode 100644 index a9769fc8944..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/mpeg/vcrs.1 +++ /dev/null @@ -1 +0,0 @@ -.so vcr.1 diff --git a/TAO/orbsvcs/tests/AVStreams/server.cpp b/TAO/orbsvcs/tests/AVStreams/server.cpp deleted file mode 100644 index 849a7182826..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/server.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/tests/AVStreams -// -// = FILENAME -// server.cpp -// -// = DESCRIPTION -// Test server for the AVStreams demo -// -// = AUTHORS -// Sumedh Mungee <sumedh@cs.wustl.edu> -// -// ============================================================================ - -#include "server.h" - -// Callbacks made by the AVStreams library into the application. - -Video_Server_StreamEndPoint::Video_Server_StreamEndPoint (void) -{ -} - -void -Video_Server_StreamEndPoint::handle_stop (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ -} - -void -Video_Server_StreamEndPoint::handle_start (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ -} - -void -Video_Server_StreamEndPoint::handle_destroy (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ -} - -CORBA::Boolean -Video_Server_StreamEndPoint::handle_connection_requested (AVStreams::StreamEndPoint_ptr initiator, - CORBA::Boolean is_mcast, - AVStreams::streamQoS &qos, - AVStreams::flowSpec &the_spec, - CORBA::Environment &env) -{ - return 1; -} - -// Main program. - -int -main (int argc, char *argv[]) -{ - TAO_TRY - { - TAO_ORB_Manager orb_manager; - - // Initialize the ORB. - orb_manager.init (argc, - argv, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - // Create server-side MMDevice. - TAO_Server_MMDevice <Video_Server_StreamEndPoint> *mmdevice_impl; - ACE_NEW_RETURN (mmdevice_impl, - TAO_Server_MMDevice <Video_Server_StreamEndPoint>, - -1); - TAO_CHECK_ENV; - - // Activate the MMDevice, i.e., register with POA. - CORBA::String_var s = orb_manager.activate (mmdevice_impl, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - // Print the IOR. - ACE_DEBUG ((LM_DEBUG, - "\nThe IOR is: <%s>\n", - s.in ())); - - // Run the ORB Event loop. - orb_manager.run (TAO_TRY_ENV); - TAO_CHECK_ENV; - } - TAO_CATCH (CORBA::SystemException, sysex) - { - TAO_TRY_ENV.print_exception ("System Exception"); - return -1; - } - TAO_CATCH (CORBA::UserException, userex) - { - TAO_TRY_ENV.print_exception ("User Exception"); - return -1; - } - TAO_ENDTRY; - ACE_DEBUG ((LM_DEBUG, - "\nServer is terminating")); - return 0; -} - diff --git a/TAO/orbsvcs/tests/AVStreams/server.h b/TAO/orbsvcs/tests/AVStreams/server.h deleted file mode 100644 index a8222dea9c9..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/server.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/orbsvcs/tests/AVStreams -// -// = FILENAME -// server.h -// -// = DESCRIPTION -// Test server for the AVStreams demo -// -// = AUTHORS -// Sumedh Mungee <sumedh@cs.wustl.edu> -// -// ============================================================================ - -#if !defined (AVSTREAMS_SERVER_H) -#define AVSTREAMS_SERVER_H - -#include "orbsvcs/AV/AVStreams_i.h" -#include "tao/tao_util.h" - -class Video_Server_StreamEndPoint : public virtual TAO_Server_StreamEndPoint -{ - // = TITLE - // Server Stream Endpoint for A/V Streams demo. - // - // = DESCRIPTION - // Encapsulates server side transport functionality. -public: - Video_Server_StreamEndPoint (void); - // Constructor. - - virtual void handle_stop (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream stoppage. - - virtual void handle_start (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream start. Starts the flow of data. - - virtual void handle_destroy (const AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles the destruction of the stream, tears down the transport. - - virtual CORBA::Boolean handle_connection_requested (AVStreams::StreamEndPoint_ptr initiator, - CORBA::Boolean is_mcast, - AVStreams::streamQoS &qos, - AVStreams::flowSpec &the_spec, - CORBA::Environment &env); - // Handles stream bind, establishes the transport. -}; - -#endif /* AVSTREAMS_SERVER_H */ diff --git a/TAO/orbsvcs/tests/AVStreams/sfp/Makefile b/TAO/orbsvcs/tests/AVStreams/sfp/Makefile deleted file mode 100644 index 9a73f45dc64..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/sfp/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -#---------------------------------------------------------------------------- -# $Id$ -# -# Top-level Makefile for the AVStreams demo of the TAO ORB -# -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -LDLIBS = -lorbsvcs -lTAO - -PROG_SRCS = main.cpp - -LSRC = $(PROG_SRCS) - -AVStreams_SERVER_OBJS = server.o -AVStreams_CLIENT_OBJS = client.o - -COSPROPERTY_OBJS = main.o - -BIN = client - -BUILD = $(BIN) -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(ACE_ROOT)/include/makeinclude/macros.GNU -include $(ACE_ROOT)/include/makeinclude/rules.common.GNU -include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU -#include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU -include $(ACE_ROOT)/include/makeinclude/rules.local.GNU - -ifndef TAO_ROOT -TAO_ROOT = $(ACE_ROOT)/TAO -endif - -DCFLAGS = -g -LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao -CPPFLAGS += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) -I$(TAO_ROOT)/tao/compat $(TSS_ORB_FLAG)#-H - -server:$(addprefix $(VDIR),$(AVStreams_SERVER_OBJS)) - $(LINK.cc) $(LDFAGS) -o $@ $^ $(VLDLIBS) - -client:$(addprefix $(VDIR),$(AVStreams_CLIENT_OBJS)) - $(LINK.cc) $(LDFLAGS) -o $@ $^ $(VLDLIBS) - -#main: $(addprefix $(VDIR), $(COSPROPERTY_OBJS)) -# $(LINK.cc) $(LDFAGS) -o $@ $^ $(VLDLIBS) - - -realclean: clean - -/bin/rm -rf - - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - - - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/orbsvcs/tests/AVStreams/sfp/client.cpp b/TAO/orbsvcs/tests/AVStreams/sfp/client.cpp deleted file mode 100644 index 487b644b8ba..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/sfp/client.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// $Id$ - -#include "ace/Message_Block.h" -#include "orbsvcs/AV/sfp.h" - -const char *buf = "Hello Worldasdasda sda sdasd adasdaddd\n"; - -main () -{ - - // ---------------------------------------------------------------------- - // start message - - SFP_Encoder encoder; - - ACE_Message_Block *start_message = - encoder.encode_start_message (); - - SFP_Decoder decoder; - - decoder.decode_start_message (start_message); - - // ---------------------------------------------------------------------- - // start reply - - ACE_Message_Block *start_reply_message = - encoder.encode_start_reply_message (); - - decoder.decode_start_reply_message (start_reply_message); - - - // ---------------------------------------------------------------------- - // simple frame - - ACE_Message_Block *message; - - ACE_NEW_RETURN (message, - ACE_Message_Block (buf), - -1); - - message->length (::strlen (buf)); - - ACE_Message_Block *mb = encoder.encode_simple_frame (message); - - decoder.decode_simple_frame (mb); - - return 0; -} diff --git a/TAO/orbsvcs/tests/AVStreams/sfp/svc.conf b/TAO/orbsvcs/tests/AVStreams/sfp/svc.conf deleted file mode 100644 index 43c6a486c92..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/sfp/svc.conf +++ /dev/null @@ -1,49 +0,0 @@ -# $Id$ -# -# This file contains a sample ACE_Service_Config configuration -# file specifying the strategy factories utilized by an application -# using TAO. There are currently only two possible factories: -# Client_Strategy_Factory and Server_Strategy_Factory. These names -# must be used as the second argument to their corresponding line, -# because that's what the ORB uses to find the desired factory. -# -# Note that there are two unordinary characteristics of the way *this* -# file is set up: -# - both client and server strategies are specified in the same -# file, which would only make sense for co-located clients & servers -# - both of the factories are actually sourced out of libTAO.so -# (TAO.DLL on Win32), and they would normally be in a separate -# dll from the TAO ORB Core. -# -# The options which can be passed to the Resource Factory are: -# -# -ORBresources <which> -# where <which> can be 'global' to specify globally-held resources, -# or 'tss' to specify thread-specific resources. -# -# The options which can be passed to the Client are: -# <none currently> -# -# The options which can be passed to the Server are: -# -# -ORBconcurrency <which> -# where <which> can be 'thread-per-connection' to specify -# use of the ACE_Threaded_Strategy concurrency strategy, -# or 'reactive' to specify use of the ACE_Reactive_Strategy -# concurrency strategy. -# -# -ORBthreadflags <flags> -# specifies the default thread flags to use, where <flags> is a -# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, -# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid -# on every platform. -# -# -ORBdemuxstrategy <which> -# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', -# and specifies the type of object lookup strategy used internally. -# -ORBtablesize <unsigned> -# specifies the size of the object table -# -dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global" -dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() -dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" diff --git a/TAO/orbsvcs/tests/AVStreams/svc.conf b/TAO/orbsvcs/tests/AVStreams/svc.conf deleted file mode 100644 index 43c6a486c92..00000000000 --- a/TAO/orbsvcs/tests/AVStreams/svc.conf +++ /dev/null @@ -1,49 +0,0 @@ -# $Id$ -# -# This file contains a sample ACE_Service_Config configuration -# file specifying the strategy factories utilized by an application -# using TAO. There are currently only two possible factories: -# Client_Strategy_Factory and Server_Strategy_Factory. These names -# must be used as the second argument to their corresponding line, -# because that's what the ORB uses to find the desired factory. -# -# Note that there are two unordinary characteristics of the way *this* -# file is set up: -# - both client and server strategies are specified in the same -# file, which would only make sense for co-located clients & servers -# - both of the factories are actually sourced out of libTAO.so -# (TAO.DLL on Win32), and they would normally be in a separate -# dll from the TAO ORB Core. -# -# The options which can be passed to the Resource Factory are: -# -# -ORBresources <which> -# where <which> can be 'global' to specify globally-held resources, -# or 'tss' to specify thread-specific resources. -# -# The options which can be passed to the Client are: -# <none currently> -# -# The options which can be passed to the Server are: -# -# -ORBconcurrency <which> -# where <which> can be 'thread-per-connection' to specify -# use of the ACE_Threaded_Strategy concurrency strategy, -# or 'reactive' to specify use of the ACE_Reactive_Strategy -# concurrency strategy. -# -# -ORBthreadflags <flags> -# specifies the default thread flags to use, where <flags> is a -# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, -# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid -# on every platform. -# -# -ORBdemuxstrategy <which> -# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', -# and specifies the type of object lookup strategy used internally. -# -ORBtablesize <unsigned> -# specifies the size of the object table -# -dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global" -dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() -dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" |