[FFmpeg-devel] [PATCH] RDT/Realmedia patches #2

Michael Niedermayer michaelni
Sun Nov 16 19:25:44 CET 2008


On Sun, Nov 16, 2008 at 11:18:17AM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Nov 16, 2008 at 10:32 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Sat, Nov 15, 2008 at 03:51:17PM -0500, Ronald S. Bultje wrote:
> >> +#define UPDATE_LEN(x) \
> >> +    buf += x; \
> >> +    len -= x; \
> >> +    consumed += x;
> >
> > this is very ugly
> > RTFS bitstream.c/h bytestream.h and the code using them
> 
> Attached patch makes the code use bitstream.h. It changes the return
> statement, in a previous email you asked what that's for, it's
> basically to be able to tell the length of the header. Here, it is
> always 10 so it doesn't really make much of a difference, although it
> works. In the next patch, I'd improve the header parsing
> implementation to more closely match the spec, which makes the header
> size variable, and then it's useful to have, so I already changed it
> here... I can do that in 2 patches also.
> 
> Ronald

> Index: ffmpeg-svn/libavformat/rdt.c
> ===================================================================
> --- ffmpeg-svn.orig/libavformat/rdt.c	2008-11-16 11:08:26.000000000 -0500
> +++ ffmpeg-svn/libavformat/rdt.c	2008-11-16 11:12:07.000000000 -0500
> @@ -33,6 +33,7 @@
>  #include "libavutil/md5.h"
>  #include "rm.h"
>  #include "internal.h"
> +#include <libavcodec/bitstream.h>
>  
>  struct RDTDemuxContext {
>      AVFormatContext *ic;
> @@ -178,7 +179,8 @@
>                      int *pset_id, int *pseq_no, int *pstream_id,
>                      int *pis_keyframe, uint32_t *ptimestamp)
>  {
> -    int consumed = 10;
> +    GetBitContext gb;
> +    int consumed = 0;
>  
>      /* skip status packets */
>      while (len >= 5 && buf[1] == 0xFF /* status packet */) {
> @@ -245,13 +247,18 @@
>       * [2] http://www.wireshark.org/docs/dfref/r/rdt.html and
>       *     http://anonsvn.wireshark.org/viewvc/trunk/epan/dissectors/packet-rdt.c
>       */
> -    if (pset_id)      *pset_id      = (buf[0]>>1) & 0x1f;
> -    if (pseq_no)      *pseq_no      = AV_RB16(buf+1);
> -    if (ptimestamp)   *ptimestamp   = AV_RB32(buf+4);
> -    if (pstream_id)   *pstream_id   = (buf[3]>>1) & 0x1f;
> -    if (pis_keyframe) *pis_keyframe = !(buf[3] & 0x1);
> +    init_get_bits(&gb, buf, len << 3);
> +    skip_bits(&gb, 2);
> +    if (pset_id)      *pset_id      = get_bits(&gb, 5);
> +    skip_bits(&gb, 1);
> +    if (pseq_no)      *pseq_no      = get_bits(&gb, 16);
> +    skip_bits(&gb, 2);
> +    if (pstream_id)   *pstream_id   = get_bits(&gb, 5);
> +    if (pis_keyframe) *pis_keyframe = get_bits1(&gb);
> +    if (ptimestamp)   *ptimestamp   = get_bits_long(&gb, 32);
> +    skip_bits(&gb, 16);

this code is not equivalent, and i suspect the new does not work


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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081116/a697147c/attachment.pgp>



More information about the ffmpeg-devel mailing list