[FFmpeg-devel] [PATCH 08/28] added: probe file header for cdxa

Reimar Döffinger Reimar.Doeffinger
Wed Jun 30 18:32:11 CEST 2010


On Wed, Jun 30, 2010 at 10:09:36AM +0100, Mans Rullgard wrote:
> From: Cory Fields <theuni-nospam- at xbmc.org>
> 
> ---
>  libavformat/mpeg.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
> index e6f0990..d132c63 100644
> --- a/libavformat/mpeg.c
> +++ b/libavformat/mpeg.c
> @@ -50,6 +50,18 @@ static int check_pes(uint8_t *p, uint8_t *end){
>      return pes1||pes2;
>  }
>  
> +static int cdxa_probe(AVProbeData *p)
> +{
> +    /* check file header */
> +    if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
> +        p->buf[2] == 'F' && p->buf[3] == 'F' &&
> +        p->buf[8] == 'C' && p->buf[9] == 'D' &&
> +        p->buf[10] == 'X' && p->buf[11] == 'A')
> +        return AVPROBE_SCORE_MAX;
> +    else
> +        return 0;
> +}

Seems a bit week for max score.

>  static int mpegps_probe(AVProbeData *p)
>  {
>      uint32_t code= -1;
> @@ -57,6 +69,10 @@ static int mpegps_probe(AVProbeData *p)
>      int i;
>      int score=0;
>  
> +    score = cdxa_probe(p);
> +    if (score > 0) return score;
> +
> +    /* Search for MPEG stream */
>      for(i=0; i<p->buf_size; i++){
>          code = (code<<8) + p->buf[i];
>          if ((code & 0xffffff00) == 0x100) {

Also do we have a sample file, and why is the default search code
not good enough to detect these files?



More information about the ffmpeg-devel mailing list