[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSNegotiatorSink and UMSNegotiatorSource Interface

The UMSNegotiatorSink and UMSNegotiatorSource objects are an Ultimedia Services Version 2 feature and do not apply to Ultimedia Services Version 1.2.1.

The UMSNegotiatorSink and UMSNegotiatorSource classes define a consistent interface for negotiating a common data format between two objects. Doing so enables the two objects to communicate using the same data format.

Note: The UMSNegotiatorSink and UMSNegotiatorSource interfaces can actually be used to negotiate anything whose choices can be encoded as a list of strings.

By definition, UMSNegotiatorSink objects consume data and are therefore called sink objects. Likewise, UMSNegotiatorSource objects provide data and are therefore called source objects.

For introductory information, see Image Window and Negotiator Objects.

By deriving the interface of an object from either UMSNegotiatorSink or UMSNegotiatorSource (or both), you provide the ability to:

A typical negotiation between a UMSNegotiatorSink object and a UMSNegotiatorSource object occurs as follows (assuming the negotiation is over the image format the source object produces and the sink object consumes):

set_input_decision(sink, ev, "IMAGE_FORMAT");
set_output_decision(source, ev, "IMAGE_FORMAT");
get_input_choices_list(sink, ev, &list_of_sink_image_formats);
get_output_choices_list(source, ev, &list_of_source_image_formats);
common_image_format = ...;    /* find a common image format in
                               * list_of_sink_image_formats and
                               * list_of_source_image_formats */
 
set_input_choice(sink, ev, common_image_format);
set_output_choice(source, ev, common_image_format);

To define a class as either a source or a sink (or both), you should derive the class from UMSNegotiatorSource or UMSNegotiatorSink (or both) and then override and implement the corresponding UMSNegotiatorSource and UMSNegotiatorSink methods.

To learn more about the UMSNegotiatorSink and UMSNegotiatorSource, see:

Enumerated Lists

enum ReturnCode {
   Success,
   Failure,
   InvalidArgument,
   Failure,
   NotSupported,
   UnsupportedFormat,
   NullPointer
   };

UMSNegotiatorSink Method Descriptions

ReturnCode set_input_decision (in string decision_alias)

Description

This method can be used to set and verify the category of decision to which the remaining methods refer. Most often this relates to the general category of media that is given. A return of Success means that the object recognizes the decision alias and use of the other methods now relate to that question. A return of InvalidArgument means that the object is not able to participate in that way. Use of the other methods in this interface is inappropriate until a successful return from this method.

Arguments
in string decision_alias Use the decision_alias parameter to define the topic of the negotiation. For example, if you'd like to negotiate image formats, set the decision_alias to IMAGE_FORMAT.
Return Values

Success

NotAccepted

ReturnCode get_input_choices_list(out sequence<string> list)

Description

This method provides a list of acceptable choices for the decision. When the decision alias was IMAGE_FORMAT, then this is a list of image format strings. When more than one item appears in the list, the choice needs to be set as a way of specifying the desired input.

Arguments
out sequence<string> list List of choices available for this object. The number of items in the list is part of the sequence header. Software provided with the list is responsible for freeing the memory of each string, and then of the sequence header.
Return Values

Success

ReturnCode set_input_choice(in string choice)

Description

This method sets the choice for the decision. When the decision alias was IMAGE_FORMAT, then this sets the format of the image that is given to the object. A return of InvalidArgument means that the choice is not valid for this object; the choice should be one of those in the list returned by get_input_choices_list.

Arguments
in string choice Specifies the desired selection.
Return Values

Success

NotAccepted

ReturnCode get_input_choice(out string choice)

Description

This method can be used to retrieve the choice set by set_input_choice, or to get the value of the default if no choice has been made.

Arguments
out string choice Provides the desired selection. Software provided with the string is responsible for freeing this memory.

Return Values

Success

ReturnCode get_input_specifics_object(in string choice, out UMSDataFormatControl *object)

Description

Some choices allow further parametric specification of details. UMSNegociatorSource objects can provide additional interfaces to query or set these details. See UMSDataFormatControl for a discussion of these interfaces.

Arguments
in string choice The potential choice that specifies the control object to be returned.
out UMSDataFormatControl *object Provides the control object associated with the choice parameter. If the choice is not valid for this object, or the choice does not suggest a defined control object, a NULL is returned.
Return Values

Success

Failure

UMSNegociatorSource Method Descriptions

ReturnCode set_output_decision (in string decision_alias)

Description

This method can be used to set and verify the category of decision to which the remaining methods refer. Most often this relates to the general category of media to be supplied. A return of Success means that the object recognizes the decision alias and use of the other methods now relate to that question. A return of InvalidArgument means that the object is not able to participate in that way. Use of the other methods in this interface is inappropriate until a successful return from this method.

Arguments
in string decision_alias Use the decision_alias parameter to define the topic of the negotiation. For example, if you'd like to negotiate image formats, set the decision_alias to IMAGE_FORMAT.
Return Values

Success

NotAccepted

ReturnCode get_output_choices_list(out sequence<string> list)

Description

This method provides a list of acceptable choices for the decision. When the decision alias was IMAGE_FORMAT, then this is a list of image format strings. When more than one item appears in the list, the choice needs to be set as a way of specifying the desired output.

Arguments
out sequence<string> list List of choices available for this object. The number of items in the list is part of the sequence header. Software provided with the list is responsible for freeing the memory of each string, and then of the sequence header.
Return Values

Success

ReturnCode set_output_choice(in string choice)

Description

This method sets the choice for the decision. When the decision alias was IMAGE_FORMAT, then this sets the format of the image to be provided by the object. A return of InvalidArgument means that the choice is not valid for this object; the choice should be one of those in the list returned by get_output_choices_list.

Arguments
in string choice Specifies the desired selection
Return Values

Success

NotAccepted

ReturnCode get_output_choice(out string choice)

Description

This method can be used to retrieve the choice set by set_output_choice, or to get the value of the default if no choice has been made.

Arguments
out string choice Provides the desired selection. Software provided with the string is responsible for freeing this memory.
Return Values

Success

ReturnCode get_output_specifics_object(in string choice, out UMSDataFormatControl *object)

Description

Some choices allow further parametric specification of details. UMSNegociatorSource objects can provide additional interfaces to query or set these details. See UMSDataFormatControl for a discussion of these interfaces.

Arguments
in string choice The potential choice that specifies the control object to be returned.
out UMSDataFormatControl *object Provides the control object associated with the choice parameter. If the choice is not valid for this object, or the choice does not suggest a defined control object, a NULL is returned.
Return Values

Success

Failure

For introductory information, see Image Window and Negotiator Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]