[MPlayer-dev-eng] [PATCH] avc1 in X-QT over RTSP

Diego Biurrun diego at biurrun.de
Sun Oct 1 19:35:23 CEST 2006


On Wed, Sep 27, 2006 at 12:45:59AM +0000, Carl Eugen Hoyos wrote:
> 
> Attached patch allows to play avc1 Videos sent over RTSP in subsession
> "X-QUICKTIME". That's the way Apple streams at the moment.
> 
> Original bugreport:
> http://lists.mplayerhq.hu/pipermail/mplayer-users/2006-January/057669.html
> (-fps 16.67 is needed to play the mentioned stream.)
> 
> Please comment, Carl Eugen
> 
> --- libmpdemux/demux_rtp_codec.cpp      (Revision 19984)
> +++ libmpdemux/demux_rtp_codec.cpp      (Arbeitskopie)
> @@ -86,6 +86,36 @@
>      } while (!parseQTState_video(qtRTPSource->qtState, fourcc));
> 
>      bih->biCompression = sh_video->format = fourcc;
> +    bih->biWidth = qtRTPSource->qtState.width;
> +    bih->biHeight = qtRTPSource->qtState.height;
> +
> +#define BE_32(x) (((unsigned char *)(x))[0] << 24 | \
> +                  ((unsigned char *)(x))[1] << 16 | \
> +                  ((unsigned char *)(x))[2] <<  8 | \
> +                  ((unsigned char *)(x))[3])
> +#define char2int(x,y)   BE_32(&(x)[(y)])
> +#define MOV_FOURCC(a,b,c,d) ((a<<24)|(b<<16)|(c<<8)|(d))
> +
> +    if (bih->biCompression == mmioFOURCC('a','v','c','1') &&
> +        qtRTPSource->qtState.sdAtomSize
> +                  < 0xffffffff-sizeof(BITMAPINFOHEADER)) {
> +      unsigned pos = 86;
> +      while (pos+8 < qtRTPSource->qtState.sdAtomSize) {
> +        unsigned atomLength = char2int(qtRTPSource->qtState.sdAtom, pos);
> +        if (char2int(qtRTPSource->qtState.sdAtom, pos+4)
> +            == MOV_FOURCC('a','v','c','C') && atomLength > 8) {
> +          sh_video->bih = bih
> +            = (BITMAPINFOHEADER*)realloc(bih, sizeof(BITMAPINFOHEADER)
> +                                              +atomLength-8);
> +          bih->biSize = sizeof(BITMAPINFOHEADER)+atomLength-8;
> +          memcpy((char*)bih+sizeof(BITMAPINFOHEADER),
> +                 qtRTPSource->qtState.sdAtom+pos+8, atomLength-8);
> +          break;
> +        }
> +        pos += atomLength;
> +      }
> +      needVideoFrameRate(demuxer, subsession);
> +    }
>    } else {
>      fprintf(stderr,
>             "Unknown MPlayer format code for MIME type \"video/%s\"\n",

Ross, is this patch OK?

Diego



More information about the MPlayer-dev-eng mailing list