~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/transcode/mpglib/mpglib/VbrTag.h

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-31 09:49:54 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071231094954-ix1amvcsj9pk61ya
Tags: 1:1.4.1.57486.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #180254), remaining changes:
  - debian/rules;
    - Added dh_icons
  - Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      Xing VBR tagging for LAME.
 
3
 *
 
4
 *      Copyright (c) 1999 A.L. Faber
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Library General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Library General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Library General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02110-1301, USA.
 
20
 */
 
21
 
 
22
#ifndef LAME_VRBTAG_H
 
23
#define LAME_VRBTAG_H
 
24
 
 
25
#include "lame.h"
 
26
 
 
27
#if HAVE_INTTYPES_H
 
28
# include <inttypes.h>
 
29
#else
 
30
# if HAVE_STDINT_H
 
31
#  include <stdint.h>
 
32
# endif
 
33
#endif
 
34
 
 
35
/* -----------------------------------------------------------
 
36
 * A Vbr header may be present in the ancillary
 
37
 * data field of the first frame of an mp3 bitstream
 
38
 * The Vbr header (optionally) contains
 
39
 *      frames      total number of audio frames in the bitstream
 
40
 *      bytes       total number of bytes in the bitstream
 
41
 *      toc         table of contents
 
42
 
 
43
 * toc (table of contents) gives seek points
 
44
 * for random access
 
45
 * the ith entry determines the seek point for
 
46
 * i-percent duration
 
47
 * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
 
48
 * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
 
49
 */
 
50
 
 
51
 
 
52
#define FRAMES_FLAG     0x0001
 
53
#define BYTES_FLAG      0x0002
 
54
#define TOC_FLAG        0x0004
 
55
#define VBR_SCALE_FLAG  0x0008
 
56
 
 
57
#define NUMTOCENTRIES 100
 
58
 
 
59
#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG)
 
60
 
 
61
 
 
62
 
 
63
/*structure to receive extracted header */
 
64
/* toc may be NULL*/
 
65
typedef struct
 
66
{
 
67
  int           h_id;                   /* from MPEG header, 0=MPEG2, 1=MPEG1 */
 
68
  int           samprate;               /* determined from MPEG header */
 
69
  int           flags;                  /* from Vbr header data */
 
70
  int           frames;                 /* total bit stream frames from Vbr header data */
 
71
  int           bytes;                  /* total bit stream bytes from Vbr header data*/
 
72
  int           vbr_scale;              /* encoded vbr scale from Vbr header data*/
 
73
  unsigned char toc[NUMTOCENTRIES];     /* may be NULL if toc not desired*/
 
74
  int           headersize;             /* size of VBR header, in bytes */
 
75
  int           enc_delay;              /* encoder delay */
 
76
  int           enc_padding;            /* encoder paddign added at end of stream */
 
77
}   VBRTAGDATA;
 
78
 
 
79
int CheckVbrTag(unsigned char *buf);
 
80
int GetVbrTag(VBRTAGDATA *pTagData,  unsigned char *buf);
 
81
 
 
82
int SeekPoint(unsigned char TOC[NUMTOCENTRIES], int file_bytes, float percent);
 
83
int InitVbrTag(lame_global_flags *gfp);
 
84
int PutVbrTag(lame_global_flags *gfp,FILE *fid,int nVbrScale);
 
85
//int PutLameVBR(lame_global_flags *gfp, FILE *fpStream, uint8_t *pbtStreamBuffer, uint32_t id3v2size,  uint16_t crc);
 
86
void AddVbrFrame(lame_global_flags *gfp);
 
87
//void UpdateMusicCRC(uint16_t *crc,unsigned char *buffer, int size);
 
88
 
 
89
#endif
 
90