Nicholas J Humfrey > Net-SDP > Net::SDP::Media

Download:
Net-SDP-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.07   Source  

NAME ^

Net::SDP::Media - Media Description in an SDP file

SYNOPSIS ^

  my $audio = $sdp->new_media_desc( 'audio' );

  $audio->address('224.123.234.56');
  $audio->port(5004);
  $audio->attribute('quality', 5);

DESCRIPTION ^

This class represents a single Media Description (m=) in an SDP file. As well as the m= line, it also contains the information about all the following lines that make up that media description. When parsing an SDP file, Net::SDP will create an instance of Net::SDP::Media for each media description. New media descriptions can be created using the new_media_desc() method in Net::SDP.

METHODS

title()

Get or Set the title for this media description. [i=]

Example:

        $audio = $audio->title();
        $audio->title( 'English' );
address()

Get or Set the connection address for this media description. [c=]

Example:

        $addr = $audio->address();
        $audio->address( '224.123.234.56' );
address_type()

Get or Set the connection address type for this media description. Default is IP4. [c=]

Example:

        $addr = $audio->address_type();
        $audio->address_type( 'IP6' );
port()

Get or Set the connection port type for this media description. [m=]

Example:

        $port = $audio->port();
        $audio->port( 5004 );
ttl()

Get or Set the Time to Live for packets in this media description. [c=] To not specify a TTL, then set to 0.

Example:

        $ttl = $audio->ttl();
        $audio->ttl( 127 );
media_type()

Get or Set the media type this media description - eg audio, video etc. [m=]

Example:

        $media = $audio->media_type();
        $audio->media_type( 'audio' );
transport()

Get or Set the transport method for this media description. Default is RTP/AVP. [m=]

Example:

  $media = $audio->transport();
  $audio->transport( 'UDP' );
network_type()

Get or Set the network type for this media description. Default is 'IN' - Internet. [c=]

Example:

        $media = $audio->network_type();
        $audio->network_type( 'IN' );
attribute( name, [value] )

Get or Set an attribute for this media description. [a=]

When setting an attribute, if you pass in a scalar, then all attributes with the same name will be replaced. Alternively an attribute may be set to multiple values by passing an ARRAYREF. If an attribute does not require it, then the value parameter is optional - eg for 'recvonly' attribute.

When getting an attribute that has no value, then '' is returned, or if the attribute does not exists then undef is returned. If the attribute has a single value, then that value is returned, or if it has more than one value then an ARRAYREF is returned.

Example:

        $quality = $audio->attribute( 'quality' );
        $video->attribute( 'framerate',  10 );
attributes()

Get a HASHREF of all the attributes associated with this media description [a=]

Example:

        $hashref = $audio->attributes();
add_attribute( name, [value] )

Add a value for sepecified attribute. This method is intended to be used with attributes with multiple values - ie rtpmap and fmtp [a=]

Example:

        $audio->add_attribute( 'fmtp', '32 type=mpeg1');
remove_format_num( num )

Removes the specified format number from the list of payload IDs/formats that are allowed for this media description. [m=]

Example:

        $audio->remove_format_num( 0 );
default_format_num( num )

Gets or Set the default format number/payload ID in the list of formats. The format number doesn't need to already be in the list of formats. [m=]

Example:

        $default = $audio->default_format_num();
        $audio->default_format_num( 0 );
default_format()

Returns the default format for this media description as a MIME type.

Example:

        # eg audio/L16/44100/2
        $default = $audio->default_format();
format_num_list()

Get or Set an ARRAYREF containing a list of the format numbers/payload IDs for this media description. [m=]

Example:

        $fmt_list = $audio->format_num_list();
        $audio->format_num_list( [0, 8, 10] );
format_list()

Returns a HASHREF containing format numbers as keys and MIME types as values for all the formats allowed by this media description.

add_format( format_num, [mime_type] )

Add a format to the list of formats allowed in this media description. The first parameter is the format number/payload ID and the second (optional) parameter is the MIME type for that format.

Example:

        $audio->add_format( 96, 'audio/L16/22500/1' );
as_string()

Returns a textual representation/summary of the media description.

AUTHOR ^

Nicholas J Humfrey, njh@cpan.org

COPYRIGHT AND LICENSE ^

Copyright (C) 2004 University of Southampton

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.005 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: