summaryrefslogtreecommitdiff
path: root/src/mp3tl-priv.h
blob: cf07d3a77a0b88a7c4b228be50cddf9d82f255d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * FLUENDO S.A.
 * Copyright (C) <2005 - 2011>  <support@fluendo.com>
 */
#ifndef __MP3TL_PRIV_H__
#define __MP3TL_PRIV_H__

#include <gst/gst.h>
#include "mp3tl.h"

#ifdef USE_IPP
#include "mp3-ipp.h"
#endif
#include "mp3-c.h"

typedef short PCM[2][SSLIMIT][SBLIMIT];
typedef unsigned int SAM[2][3][SBLIMIT];
typedef float FRA[2][3][SBLIMIT];

/* Size of the temp buffer for output samples, max 2 channels * 
 * sub-bands * samples-per-sub-band * 2 buffers
 */
#define SAMPLE_BUF_SIZE (4 * 2 * SBLIMIT * SSLIMIT)

struct mp3tl
{
  void * alloc_memory;
  gboolean need_sync;
  gboolean need_header;
  gboolean at_eos;
  gboolean lost_sync;

  /* Bit stream to read the data from */
  Bit_stream_struc *bs;

  /* Layer number we're decoding, 0 if we don't know yet */
  guint8 stream_layer;

  guint64 frame_num;

  /* Bits consumed from the stream so far */
  gint64 bits_used;

  /* Number of samples output so far */
  guint32 sample_frames;

  /* Total number of errors encountered */
  guint error_count;

  /* Sample size configure for. Always 16-bits, for now */
  guint sample_size;

  /* Frame decoding info */
  frame_params fr_ps;

  /* Number of granules in this frame (1 or 2) */
  guint n_granules;
  /* CRC value read from the mpeg data */
  guint old_crc;

  __CACHE_LINE_DECL_ALIGN(PCM pcm_sample);
  __CACHE_LINE_DECL_ALIGN(SAM sample);
  __CACHE_LINE_DECL_ALIGN(FRA fraction);

  /* Output samples circular buffer and read and write ptrs */
  gint16 *sample_buf;
  guint32 sample_w;

  char *reason;                 /* Reason why an error was returned, if known */
#ifdef USE_IPP
  mp3ipp_info ipp;
#endif
  mp3cimpl_info c_impl;

  /*Free format bitrate */
  guint32 free_bitrate;

  /*Used for one time calculation of free bitrate */
  gboolean free_first;
};

void mp3_SubBandSynthesis (mp3tl * tl ATTR_UNUSED,
    frame_params * fr_ps, float *bandPtr, gint channel, short *samples);
#endif