[FFmpeg-devel] [PATCH] Core Audio Format demuxer (v2)

Diego Biurrun diego
Mon Aug 10 16:00:39 CEST 2009


On Mon, Aug 10, 2009 at 11:19:27PM +1000, Peter Ross wrote:
> On Sun, Aug 09, 2009 at 07:41:05PM +1000, Peter Ross wrote:
> > Enclosed is a revised version of Justin Ruggles CAF demuxer.
> > 
> > Samples: http://samples.mplayerhq.hu/A-codecs/caf/
> > Original thread: http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-April/026491.html
> 
> Revised patch enclosed.
> 
> --- a/doc/general.texi
> +++ b/doc/general.texi
> @@ -61,6 +61,8 @@ library:
>      @tab Used in the game Flash Traffic: City of Angels.
>  @item Interplay C93             @tab   @tab X
>      @tab Used in the game Cyberia from Interplay.
> + at item Core Audio Format         @tab   @tab X
> +    @tab Apple Core Audio Format
>  @item Delphine Software International CIN @tab   @tab X
>      @tab Multimedia format used by Delphine Software games.
>  @item CRC testing format        @tab X @tab

Place your entry below CIN.

> --- /dev/null
> +++ b/libavformat/cafdec.c
> @@ -0,0 +1,425 @@
> +static int read_pakt(AVFormatContext *s, int64_t size)

I think either _pkt or _packet would be better.

> +    caf->has_packet_table = 1;
> +    caf->num_frames = get_be64(pb);  /* valid frames */
> +    caf->num_frames += get_be32(pb); /* priming frames */
> +    caf->num_frames += get_be32(pb); /* remainder frames */

align

> +    for(i=0; i<caf->num_packets; i++) {

a bit of whitespace could aid readability here, same below

for () {, same below

> +    if ((url_ftell(pb) - ccount) != size) {
> +        av_log(s, AV_LOG_WARNING, "error reading packet table\n");
> +        caf->has_packet_table = 0;
> +        caf->num_packets = 0;
> +        caf->num_frames = 0;

align

> +        default:
> +#define _(x) ((x)>=' '?(x):' ')
> +            av_log(s, AV_LOG_WARNING, "skipping CAF chunk: %08X (%c%c%c%c)\n",
> +                tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF));

a bit of whitespace could aid readability here

> +    pkt_frames = caf->frames_per_packet;
> +    pkt_size = caf->bytes_per_packet;

align

> +    pkt->size = res;
> +    pkt->stream_index = 0;

align

> +        caf->packet_cnt = bpos / caf->bytes_per_packet;
> +        caf->frame_cnt = caf->frames_per_packet * caf->packet_cnt;

align

> +        caf->packet_cnt = p;
> +        caf->frame_cnt = caf->packet_table[p].fpos;
> +        bpos = caf->packet_table[p].bpos;

align

Diego



More information about the ffmpeg-devel mailing list