[FFmpeg-devel] [PATCH/v2] Realmedia RTSP (RDT) support

Michael Niedermayer michaelni
Thu Jul 19 12:34:46 CEST 2007


Hi

On Mon, Jul 16, 2007 at 12:33:04AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On 6/23/07, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> 
> >Caveats, for now:
> >- I changed default from tcp/udp, I should probably make that dynamically
> >selectable (right now it always uses udp, even if the sdp says tcp)
> >- ap->initial_pause is not working for real, since you need to actually
> >parse frames for av_find_stream_info() to complete, and if you pause the
> >stream, data never comes in (don't forget that ffplay calls
> >av_find_stream_info before starting the rtsp stream), so I removed this for
> >now (if (0)...)
> >- not sure about the licensing of the checksum calculation code (it's from
> >librtsp == gpl)
> >- bitrate selection isn't working yet
> >- I only have AAC working so far. Cook doesn't work yet. Frames are
> >reshuffled (and I think it happens correctly), also things like frame sizes
> >are correct, but the final byte output (as compared through diff -q) is not
> >the same - still working on this.
> >
> 
> I have cook working too now, I think it's starting to look interesting at
> this point. I should still get the initial_pause and udp/tcp selection
> fixed, but that can't be all too big. At that point, I'll need input on
> bitrate selection and would like help with relicensing or rewriting of the
> checksum calculation code from librtsp. Has anyone looked at my patches yet?
> I've got newest versions of all 5 attached.
> 
> - memleak-fix fixes a memleak in rtsp.c (this should be applied regardless)
> - flags-field adds a flags field to the parse_packet functions, which real
> needs
> - protocol-declaration adds support for x-pn-tng/protocol in addition to
> rtp/avp/protocol
> - rmdec-split-functions splits functions in rmdec.c and exports relevant
> parts for use in rtp_rm.c (next patch)
> - realmedia adds rdt support to rtsp.c/rtp.c and implements most specific
> stuff in rtp_rm.c (new file)


[...]
> Index: ffmpeg/libavformat/rtsp.c
> ===================================================================
> --- ffmpeg.orig/libavformat/rtsp.c	2007-07-14 14:24:43.000000000 -0400
> +++ ffmpeg/libavformat/rtsp.c	2007-07-16 00:24:38.000000000 -0400
> @@ -609,11 +609,12 @@
>              p++;
>          get_word_sep(profile, sizeof(profile), "/;,", &p);
>          lower_transport[0] = '\0';
> -        if (*p == '/') {
> +        if (*p == '/') { /* rtp/avp/<protocol> */
>              p++;
>              get_word_sep(lower_transport, sizeof(lower_transport),
>                           ";,", &p);
> -        }
> +        } else /* x-pn-tng/<protocol> */
> +            av_strlcat(lower_transport, profile, sizeof(lower_transport));
>          if (!strcasecmp(lower_transport, "TCP"))
>              th->protocol = RTSP_PROTOCOL_RTP_TCP;
>          else

this will totally break normal rtp but iam not rt*p maintainer


> Index: ffmpeg/libavformat/rm.h
> ===================================================================
> --- ffmpeg.orig/libavformat/rm.h	2007-07-14 14:24:43.000000000 -0400
> +++ ffmpeg/libavformat/rm.h	2007-07-14 14:25:09.000000000 -0400
> @@ -57,4 +57,12 @@
>      int sub_packet_lengths[16]; /// Length of each aac subpacket
>  } RMContext;
>  
> +int ff_rm_read_mdpr_codecdata (ByteIOContext *pb, AVFormatContext *s,
> +                               RMContext *rm, AVStream *st, int read_all);
> +int ff_rm_parse_packet (ByteIOContext   *pb,  int len,
> +                        AVFormatContext *s, RMContext *rm,   AVStream *st,
> +                        AVPacket *pkt, int *seq, int *flags, int64_t  *ts);
> +void ff_rm_retrieve_cache (ByteIOContext *pb, AVFormatContext *s,
> +                           RMContext *rm, AVStream *st, AVPacket *pkt);
> +

please docuent these functions in this header with doxygen comments



>  #endif /* RM_H */
> Index: ffmpeg/libavformat/rmdec.c
> ===================================================================
> --- ffmpeg.orig/libavformat/rmdec.c	2007-07-14 14:24:43.000000000 -0400
> +++ ffmpeg/libavformat/rmdec.c	2007-07-14 14:25:09.000000000 -0400
> @@ -25,36 +25,37 @@
>  static void get_str(ByteIOContext *pb, char *buf, int buf_size)
>  {
>      int len, i;
> -    char *q;
> +    char *q, r;
>  
>      len = get_be16(pb);
>      q = buf;
>      for(i=0;i<len;i++) {
> +        r = get_byte(pb);
>          if (i < buf_size - 1)
> -            *q++ = get_byte(pb);
> +            *q++ = r;
>      }
> -    *q = '\0';
> +    if (buf_size > 0) *q = '\0';
>  }

this change has nothing to do wih spliting something out of rmdec.c


>  
>  static void get_str8(ByteIOContext *pb, char *buf, int buf_size)
>  {
>      int len, i;
> -    char *q;
> +    char *q, r;
>  
>      len = get_byte(pb);
>      q = buf;
>      for(i=0;i<len;i++) {
> +        r = get_byte(pb);
>          if (i < buf_size - 1)
> -            *q++ = get_byte(pb);
> +            *q++ = r;
>      }
> -    *q = '\0';
> +    if (buf_size > 0) *q = '\0';
>  }

same


>  
> -static int rm_read_audio_stream_info(AVFormatContext *s, AVStream *st,
> -                                      int read_all)
> +static int rm_read_audio_stream_info(ByteIOContext   *pb,
> +                                     AVFormatContext *s,  RMContext *rm,
> +                                     AVStream        *st, int        read_all)
>  {
> -    RMContext *rm = s->priv_data;
> -    ByteIOContext *pb = &s->pb;
>      char buf[256];
>      uint32_t version;
>      int i;
> @@ -66,10 +67,13 @@
>          /* very old version */
>          for(i = 0; i < 14; i++)
>              get_byte(pb);
> -        get_str8(pb, s->title, sizeof(s->title));
> -        get_str8(pb, s->author, sizeof(s->author));
> -        get_str8(pb, s->copyright, sizeof(s->copyright));
> -        get_str8(pb, s->comment, sizeof(s->comment));
> +        if (s != NULL) {
> +            get_str8(pb, s->title, sizeof(s->title));
> +            get_str8(pb, s->author, sizeof(s->author));
> +            get_str8(pb, s->copyright, sizeof(s->copyright));
> +            get_str8(pb, s->comment, sizeof(s->comment));
> +        } else for (i = 0; i < 4; i++)
> +            get_str8 (pb, NULL, 0);

same


[...]

> Index: ffmpeg/libavformat/rtsp.c
> ===================================================================
> --- ffmpeg.orig/libavformat/rtsp.c	2007-07-16 00:24:38.000000000 -0400
> +++ ffmpeg/libavformat/rtsp.c	2007-07-16 00:24:44.000000000 -0400
> @@ -25,6 +25,7 @@
>  #include "network.h"
>  #include "avstring.h"
>  
> +#include "md5.h"
>  #include "rtp_internal.h"
>  
>  //#define DEBUG
> @@ -76,7 +77,7 @@
>  /* XXX: currently, the only way to change the protocols consists in
>     changing this variable */
>  
> -int rtsp_default_protocols = (1 << RTSP_PROTOCOL_RTP_UDP);
> +int rtsp_default_protocols = (1 << RTSP_PROTOCOL_RTP_TCP);

not that iam rtsp maintainer but this does not look like it belongs
in here

please cleanup and split the patches more

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070719/3bb3a7ab/attachment.pgp>



More information about the ffmpeg-devel mailing list