On Mon, Dec 31, 2007 at 02:57:52PM +0100, Luca Abeni wrote:
Hi all,
Luca Abeni wrote: [...]
Anyway, in the next days I'll work on a patch for adding a flag to
sorry, this is a typo; I obviously wanted to write "a field"
AVFormatContext and using it for selecting the transport protocol.
I attach a first version of such patch. To make the patch independent
from RTSP, I added an enum AVTransportProtocol. I also modified ffplay to properly set the new AVFormatContext field for selecting TCP when needed (since the transport protocol cannot be selected through an option in the URL, the "-rtp_tcp" option cannot be removed).
As I said, I have no problems in applying Ronald's patch first, and re-generating my patch after that.
And, BTW, happy new year to everyone!!! [...] -#ifdef CONFIG_RTSP_DEMUXER static void opt_rtp_tcp(void) { /* only tcp protocol */ - rtsp_default_protocols = (1 << RTSP_PROTOCOL_RTP_TCP); + rtsp_default_protocols = AVTRANSPORT_TCP; } -#endif
this would be unneeded if ffplay would use AVOptions, but thats seperate and belongs in some future patch ... if you want to volunteer to implement it :)
static void opt_sync(const char *arg) { Index: libavformat/avformat.h =================================================================== --- libavformat/avformat.h (revision 11361) +++ libavformat/avformat.h (working copy) @@ -371,6 +371,13 @@
#define MAX_STREAMS 20
+enum AVTransportProtocol { + AVTRANSPORT_UDP, /**< Use UDP as a transport protocol for networking formats */ + AVTRANSPORT_TCP, /**< Use UDP as a transport protocol for networking + formats */ + AVTRANSPORT_MULTICAST, /**< Use a multicast transport protocol for networking formats */ +}; + /** * format I/O context. * New fields can be added to the end with minor version bumps. @@ -476,6 +483,11 @@ * demuxing: set by user */ enum CodecID subtitle_codec_id; + /** + * Forced network protocol. + * demuxing: set by user + */ + enum AVTransportProtocol transport_protocol; } AVFormatContext;
you are forgetting to bump the minor version num and you have to add an entry to AVOption in utils.c [...]
+ switch (s->transport_protocol) { + case AVTRANSPORT_UDP: protocol_mask = (1<< RTSP_PROTOCOL_RTP_UDP); break; + case AVTRANSPORT_TCP: protocol_mask = (1<< RTSP_PROTOCOL_RTP_TCP); break; + case AVTRANSPORT_MULTICAST: protocol_mask = (1<< RTSP_PROTOCOL_RTP_UDP_MULTICAST); break; }
vertical align, and is this remapping needed? cant u use the AVTRANSPORT values in RTSP too? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I count him braver who overcomes his desires than him who conquers his enemies for the hardest victory is over self. -- Aristotle