Commit Graph

95 Commits

Author SHA1 Message Date
Samuel Pitoiset 0e31088b6c rtmp: Add ff_rtmp_calc_digest_pos()
This function is used for calculating digest position for RTMP handshake
packets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-23 16:32:05 +03:00
Samuel Pitoiset 3505d5574e rtmp: Rename rtmp_calc_digest to ff_rtmp_calc_digest and make it global
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-23 16:32:03 +03:00
Samuel Pitoiset 86991ce2dd RTMPTS protocol support
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-17 14:02:55 +03:00
Samuel Pitoiset 6aedabc9b6 RTMPS protocol support
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-17 13:53:33 +03:00
Samuel Pitoiset 775c4d3625 rtmp: Rename rtmphttp to ffrtmphttp
The prefix makes it easier to distinguish the proper end-user
protocols from the internal ones.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-17 01:19:01 +03:00
Jordi Ortiz 08e087ccf7 rtmp: rtmp_parse_result() add case for video and audio packets to avoid undesired debug output.
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-07-16 13:45:15 +02:00
Samuel Pitoiset 46743a859c rtmp: Don't send every flv packet in a separate HTTP request in RTMPT
Add a new option 'rtmp_flush_interval' that allows specifying the
number of packets to write before sending it off as a HTTP request.

This is mostly relevant for RTMPT - for plain RTMP, it only controls
how often we check the socket for incoming packets, which shouldn't
affect the performance in any noticeable way.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-18 22:00:31 +03:00
Samuel Pitoiset 8e50c57dcb RTMPT protocol support
This adds two protocols, but one of them is an internal implementation
detail just used as an abstraction layer/generalization in the code. The
RTMPT protocol implementation uses rtmphttp:// as an alternative to the
tcp:// protocol. This allows moving most of the lower level logic out
from the higher level generic rtmp code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 22:56:56 +03:00
Samuel Pitoiset 7dc747f50b rtmp: Read and handle incoming packets while writing data
This makes sure all incoming packets are read and handled (and reacted
to) while sending an FLV stream over RTMP to a server. If there were
enough incoming data to fill the TCP buffers, this could potentially
make things block at unexpected places. For the upcoming RTMPT support,
we need to consume all incoming data before we can send the next
request.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-14 22:22:58 +03:00
Samuel Pitoiset 8517e9c476 rtmp: Add a new option 'rtmp_buffer', for setting the client buffer time
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-13 17:04:39 +03:00
Samuel Pitoiset 9477c035a7 rtmp: Set the client buffer time to 3s instead of 0.26s
This factorizes existing code into a new function gen_buffer_time(),
which generates the client buffer time message and sends it to the
server.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-13 16:53:32 +03:00
Samuel Pitoiset c2d38beab2 rtmp: Handle server bandwidth packets
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-13 16:52:52 +03:00
Samuel Pitoiset 9ff930aace rtmp: Display a verbose message when an unknown packet type is received
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-13 16:52:31 +03:00
Martin Storsjö 0533868642 rtmp: Tokenize the AMF connection parameters manually instead of using strtok_r
This fixes builds on platforms without strtok_r (windows).

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-13 11:36:47 +03:00
Samuel Pitoiset 0a9a225733 rtmp: Fix a possible access to invalid memory location when the playpath is too short.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-12 14:33:57 +03:00
Samuel Pitoiset f862537de8 rtmp: Do not send extension for flv files
This fixes bugzilla bug #304.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-11 13:48:39 +03:00
Samuel Pitoiset 8ee3e1874e rtmp: support connection parameters
Allow using connection parameters in order to append arbitrary
AMF data like "B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0" to the
Connect message. You can pass these parameters through the -rtmp_conn
option.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-11 13:46:50 +03:00
Luca Barbato c6eeb9b7b6 rtmp: fix url parsing
The application component can have a subcomponent to specify the
application instance even if it doesn't have a ":" in the playpath.
2012-05-25 14:20:34 -07:00
Samuel Pitoiset 177bcc9593 rtmp: Pass the proper return code in rtmp_handshake
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-24 22:16:46 +03:00
Samuel Pitoiset bba287fdac rtmp: Check return codes of net IO operations
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-24 22:16:46 +03:00
Samuel Pitoiset a4d3f3580b rtmp: Return a proper error code instead of -1
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-24 00:25:36 +03:00
Samuel Pitoiset 08e93f5b46 rtmp: Check malloc calls
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-24 00:25:35 +03:00
Samuel Pitoiset f645f1d6ea rtmp: Check ff_rtmp_packet_create calls
Check malloc calls used by ff_rtmp_packet_create, unify error
handling and pass on error codes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-24 00:25:35 +03:00
Martin Storsjö 4b7304e80d rtmp: Don't assume path points to a string of nonzero length
If using the new -rtmp_app and -rtmp_playpath parameters,
one can in many cases set the main url to just rtmp://server/.
If the trailing slash is omitted, path is a string of zero length,
and using path+1 will end up reading uninitialized data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-17 21:16:52 +03:00
Samuel Pitoiset d55961fa82 rtmp: Implement check bandwidth notification.
According to the behaviour of librtmp, it is recommended to send this
message to the server after receiving the 'onBWDone' callback in order
to do bandwidth checking and improve compatibility with some servers.
2012-05-10 13:55:32 +03:00
Samuel Pitoiset 05945db9ce rtmp: Support 'rtmp_swfurl', an option which specifies the URL of the SWF player. 2012-05-10 13:55:31 +03:00
Samuel Pitoiset e64673e4f4 rtmp: Support 'rtmp_flashver', an option which overrides the version of the Flash plugin. 2012-05-10 13:55:30 +03:00
Samuel Pitoiset 55c9320e06 rtmp: Support 'rtmp_tcurl', an option which overrides the URL of the target stream.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-10 13:55:26 +03:00
Samuel Pitoiset b2e495afa8 rtmp: Support 'rtmp_live', an option which specifies if the media is a live stream.
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-08 13:21:35 +03:00
Samuel Pitoiset b3b1751201 rtmp: Support 'rtmp_playpath', an option which overrides the stream identifier
This option is the stream identifier to play or to publish.
Sometimes the URL parser cannot determine the correct
playpath automatically, so it must be given explicitly
using this option (ie. -rtmp_playpath).

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-16 23:11:58 +03:00
Samuel Pitoiset 6465562e13 rtmp: Support 'rtmp_app', an option which overrides the name of application
This option is the name of application to connect on the RTMP server.
Sometimes the URL parser cannot determine the app name automatically,
so it must be given explicitly using this option (ie. -rtmp_app).

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-16 23:11:53 +03:00
Raffaele Sena 34d908c083 rtmp: implement bandwidth notification
Improve compatibility with some servers.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-04-03 12:37:31 -07:00
Samuel Pitoiset faba4a9b88 rtmp: update supported audio codecs value
The audio codecs property is composed by all values except
SUPPORT_SND_INTEL (0x0008) and SUPPORT_SND_UNUSED (0x0010) which are
unused.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-04-03 12:24:33 -07:00
Martin Storsjö 32b83aeec1 avio: Add an URLProtocol flag for indicating that a protocol uses network
This definition is in two files, since the definitions will move
to the private header at the next bump.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-05 23:56:52 +02:00
Mans Rullgard 3383a53e7d lavu: replace int/float punning functions
The existing functions defined in intfloat_readwrite.[ch] are
both slow and incorrect (infinities are not handled).

This introduces a new header with fast, inline conversion
functions using direct union punning assuming an IEEE-754
system, an assumption already made throughout the code.

The one use of Intel/Motorola extended 80-bit format is
replaced by simpler code sufficient under the present
constraints (positive normal values).

The old functions are marked deprecated and retained for
compatibility.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-11 18:47:19 +00:00
Martin Storsjö 1eef08f98c rtmp: Use nb_invokes for all invoke commands
704af3e29c broke publishing
of rtmp streams, at least publishing to Wowza servers.

This changes all invoke commands to use nb_invokes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-07 09:01:55 +02:00
Martin Storsjö c3b05d2159 proto: Realign struct initializers
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 13:47:28 +02:00
Martin Storsjö 7e58050590 proto: Use .priv_data_size to allocate the private context
This simplifies the open functions by avoiding one function
call that needs error checking, reducing the amount of
extra bulk code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 13:47:26 +02:00
Martin Storsjö 02490bf358 rtmp: Clean up properly if the handshake failed
This prevents memory leaks if this function returns an error.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-12-01 13:47:25 +02:00
Josh Allmann 704af3e29c rtmp: do not hardcode invoke numbers
Note: FCPublish/FCUnpublish are adobe server specific and not described
in the rtmp specification. Some servers might not cope with them at
all.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-11-18 13:57:44 +01:00
Anton Khirnov ddffc2fdc3 avio: add support for passing options to protocols.
Not used anywhere yet, support for passing options from avio_open() will
follow.
2011-11-13 13:14:39 +01:00
Martin Storsjö 6f1b7b3944 avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
2011-11-13 13:12:17 +01:00
Martin Storsjö b14629e5ea rtmp: Make the input FLV parser handle data cut at any point
This makes the RTMP writing code able to handle FLV data
fed in arbitrarily small or large chunks, with multiple
consecutive packets in one write call, or having the FLV
packet header split over numerous write calls.

When used in conjunction with the flv muxer, the AVIO buffer
size still needs to be large enough to fit the initial metadata
packet though, since the size of that packet is written with a
seekback.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-22 10:36:16 +03:00
Martin Storsjö 3ffe32eb96 rtmp: Don't blindly skip the 4 trailer bytes from the FLV packets
If not enough bytes are available, keep track of them and skip
them on next call.

In practice, if these trailer bytes are written in a separate
call, there is no other data written in this call, making it
fall into the "FLV packet too small" case currently - working,
but not as intended.

This patch makes the code more robust, handling all cases
except for having the FLV packet header split over multiple
write calls.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-20 16:23:48 +03:00
Chiranjeevi Melam a14c784210 rtmp: Handle FLV packets written in more than one write call
If the FLV packet is larger than the AVIO buffer, a partial
FLV packet will be flushed to the RTMP protocol.

This commit handles the most common cases of FLV packets
being written in more than one call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-20 16:23:46 +03:00
Mans Rullgard ee8aecd23a Do not include intfloat_readwrite.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Mans Rullgard add41decd9 Remove return statements following infinite loops without break
These statements cannot be reached and are thus not needed.
This removes a number of compiler warnings.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:39:07 +01:00
Martin Storsjö 271c869cc3 rtmp: Don't try to do av_malloc(0)
Some received packets can have size 0. The return value from
av_malloc(0) may be NULL, which is ok if the size was 0. On
OS X, however, the returned pointer is non-null but leads to
crashes when trying to free it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-05-25 22:00:42 +03:00
Stefano Sabatini 59d96941f0 avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.

This breaks API.
2011-04-19 19:47:58 +02:00
Anton Khirnov 7f804085f1 lavf: remove FF_API_URL_CLASS cruft. 2011-04-19 18:31:12 +02:00