Blame libmp3lame/VbrTag.h

Packit 47f805
/*
Packit 47f805
 *      Xing VBR tagging for LAME.
Packit 47f805
 *
Packit 47f805
 *      Copyright (c) 1999 A.L. Faber
Packit 47f805
 *
Packit 47f805
 * This library is free software; you can redistribute it and/or
Packit 47f805
 * modify it under the terms of the GNU Library General Public
Packit 47f805
 * License as published by the Free Software Foundation; either
Packit 47f805
 * version 2 of the License, or (at your option) any later version.
Packit 47f805
 *
Packit 47f805
 * This library is distributed in the hope that it will be useful,
Packit 47f805
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 47f805
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 47f805
 * Library General Public License for more details.
Packit 47f805
 *
Packit 47f805
 * You should have received a copy of the GNU Library General Public
Packit 47f805
 * License along with this library; if not, write to the
Packit 47f805
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit 47f805
 * Boston, MA 02111-1307, USA.
Packit 47f805
 */
Packit 47f805
Packit 47f805
#ifndef LAME_VRBTAG_H
Packit 47f805
#define LAME_VRBTAG_H
Packit 47f805
Packit 47f805
Packit 47f805
/* -----------------------------------------------------------
Packit 47f805
 * A Vbr header may be present in the ancillary
Packit 47f805
 * data field of the first frame of an mp3 bitstream
Packit 47f805
 * The Vbr header (optionally) contains
Packit 47f805
 *      frames      total number of audio frames in the bitstream
Packit 47f805
 *      bytes       total number of bytes in the bitstream
Packit 47f805
 *      toc         table of contents
Packit 47f805
Packit 47f805
 * toc (table of contents) gives seek points
Packit 47f805
 * for random access
Packit 47f805
 * the ith entry determines the seek point for
Packit 47f805
 * i-percent duration
Packit 47f805
 * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
Packit 47f805
 * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
Packit 47f805
 */
Packit 47f805
Packit 47f805
Packit 47f805
#define FRAMES_FLAG     0x0001
Packit 47f805
#define BYTES_FLAG      0x0002
Packit 47f805
#define TOC_FLAG        0x0004
Packit 47f805
#define VBR_SCALE_FLAG  0x0008
Packit 47f805
Packit 47f805
#define NUMTOCENTRIES 100
Packit 47f805
Packit 47f805
#ifndef lame_internal_flags_defined
Packit 47f805
#define lame_internal_flags_defined
Packit 47f805
struct lame_internal_flags;
Packit 47f805
typedef struct lame_internal_flags lame_internal_flags;
Packit 47f805
#endif
Packit 47f805
Packit 47f805
Packit 47f805
/*structure to receive extracted header */
Packit 47f805
/* toc may be NULL*/
Packit 47f805
typedef struct {
Packit 47f805
    int     h_id;            /* from MPEG header, 0=MPEG2, 1=MPEG1 */
Packit 47f805
    int     samprate;        /* determined from MPEG header */
Packit 47f805
    int     flags;           /* from Vbr header data */
Packit 47f805
    int     frames;          /* total bit stream frames from Vbr header data */
Packit 47f805
    int     bytes;           /* total bit stream bytes from Vbr header data */
Packit 47f805
    int     vbr_scale;       /* encoded vbr scale from Vbr header data */
Packit 47f805
    unsigned char toc[NUMTOCENTRIES]; /* may be NULL if toc not desired */
Packit 47f805
    int     headersize;      /* size of VBR header, in bytes */
Packit 47f805
    int     enc_delay;       /* encoder delay */
Packit 47f805
    int     enc_padding;     /* encoder paddign added at end of stream */
Packit 47f805
} VBRTAGDATA;
Packit 47f805
Packit 47f805
int     GetVbrTag(VBRTAGDATA * pTagData, const unsigned char *buf);
Packit 47f805
Packit 47f805
int     InitVbrTag(lame_global_flags * gfp);
Packit 47f805
int     PutVbrTag(lame_global_flags const *gfp, FILE * fid);
Packit 47f805
void    AddVbrFrame(lame_internal_flags * gfc);
Packit 47f805
void    UpdateMusicCRC(uint16_t * crc, const unsigned char *buffer, int size);
Packit 47f805
Packit 47f805
#endif