RTSP-Lite
view release on metacpan or search on metacpan
}
# tag data onto end of buffer
$self->{RTSPReadBuffer}.=$inbuf;
}
my $newline;
my $buflen;
if (($buflen=length($self->{RTSPReadBuffer})) >= $bytes) {
$newline = substr($self->{RTSPReadBuffer},0,$bytes+1);
if ($bytes+1 < $buflen) {
$self->{RTSPReadBuffer} = substr($self->{RTSPReadBuffer},$bytes+1);
} else {
$self->{RTSPReadBuffer} = "";
}
} else {
$newline = substr($self->{RTSPReadBuffer},0);
$self->{RTSPReadBuffer} = "";
}
return length($newline) ? \$newline : 0;
}
sub upper
{
my ($str) = @_;
if (defined($str)) {
return uc($str);
} else {
return undef;
}
}
1;
__END__
=pod
=head1 NAME
RTSP::Lite - Lightweight RTSP implementation
=head1 SYNOPSIS
use RTSP::Lite;
$rtsp = new RTSP::Lite;
$rtsp->open("192.168.0.1",554);
$rtsp->method("DESCRIBE");
$rtsp->request("rtsp://192.168.0.1/realqt.mov");
$status_code = $rtsp->status();
$status_message = $rtsp->status_message();
print "$status_code $status_message\n";
print $rtsp->body();
=head1 DESCRIPTION
RTSP::Lite is a stand-alone lightweight RTSP/1.0 module for Perl. It
is based on Roy Hooper's HTTP::Lite (RTSP protocol is very similar to
HTTP protocol. I simply modified it to support RTSP).
The main focus of the module is to help you write simple RTSP clients
for monitoring and debugging streaming server. So far, full streaming
clients that need RTP handling are out of my scope.
The main modifications from the HTTP::Lite 2.1.4 are:
+ Supports continuous requests. Therefore explicit open operation is
now required.
+ Supports multiple debug level.
+ Callback function is not supported.
+ Deletes http style proxy support. Because RTSP requests to proxy
are the same style of requests to server.
=head1 METHODS
=item B<debug ( $level)>
Set the debug level.
0: no debug message (default),
1: display all network write and read
2: display all debug message
=item B<open ( $host, $port )>
Open a connection to $host:$port. $port can be left out.
=item B<method ( $method )>
Set the method name (OPTIONS, DESCRIBE, PLAY, ...).
=item B<add_req_header ( $header, $value )>
=item B<get_req_header ( $header )>
=item B<delete_req_header ( $header )>
Add, Delete, or get RTSP header(s) for the request.
=item B<user_agent( $agent_name)>
Set the agent name (Default is "RTSP::Lite 0.1").
=item B<request ( $url )>
Send a request to the connected host. If an I/O error is encountered,
it returns undef, otherwise RTSP status code is returned.
Note: user-agent and cseq headers are automatically added. If user
agent header is specified by add_req_header (), it overwrites the
user_agent () variable;
=item B<body ()>
Returns the body of the response.
=item B<status ()>
Returns the status code received from the RTSP server
=item B<status_message ()>
Returns the textual description of the status code received from the
RTSP server.
( run in 0.581 second using v1.01-cache-2.11-cpan-5837b0d9d2c )