oggz_constants.h 4.92 KB
Newer Older
andre's avatar
andre committed
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
/*
   Copyright (C) 2003 Commonwealth Scientific and Industrial Research
   Organisation (CSIRO) Australia

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:

   - Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

   - Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

   - Neither the name of CSIRO Australia nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
   PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ORGANISATION OR
   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef __OGGZ_CONSTANTS_H__
#define __OGGZ_CONSTANTS_H__

/** \file
 * General constants used by liboggz.
 */

/**
 * Flags to oggz_new(), oggz_open(), and oggz_openfd().
conrad's avatar
conrad committed
42
43
44
 * Can be or'ed together in the following combinations:
 * - OGGZ_READ | OGGZ_AUTO
 * - OGGZ_WRITE | OGGZ_NONSTRICT
andre's avatar
andre committed
45
46
47
48
49
50
51
52
53
54
 */
enum OggzFlags {
  /** Read only */
  OGGZ_READ         = 0x00,

  /** Write only */
  OGGZ_WRITE        = 0x01,

  /** Disable strict adherence to mapping constraints, eg for
   * handling an incomplete stream */
conrad's avatar
conrad committed
55
56
57
58
59
60
61
62
63
  OGGZ_NONSTRICT    = 0x10,

  /**
   * Scan for known headers while reading, and automatically set
   * metrics appropriately. Opening a file for reading with
   * \a flags = OGGZ_READ | OGGZ_AUTO will allow seeking on Speex,
   * Vorbis, Theora and all Annodex streams in units of milliseconds,
   * once all bos pages have been delivered. */
  OGGZ_AUTO         = 0x20
andre's avatar
andre committed
64
65
};

66
67
68
69
70
71
72
73
74
75
76
enum OggzStopCtl {
  /** Continue calling read callbacks */
  OGGZ_CONTINUE     = 0,

  /** Stop calling callbacks, but retain buffered packet data */
  OGGZ_STOP_OK      = 1,

  /** Stop calling callbacks, and purge buffered packet data */
  OGGZ_STOP_ERR     = -1
};

andre's avatar
andre committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
 * Flush options for oggz_write_feed; can be or'ed together
 */
enum OggzFlushOpts {
  /** Flush all streams before beginning this packet */
  OGGZ_FLUSH_BEFORE = 0x01,

  /** Flush after this packet */
  OGGZ_FLUSH_AFTER  = 0x02
};

/**
 * Definitions of error return values
 */
enum OggzError {
  /** No error */
  OGGZ_ERR_OK                           = 0,

  /** generic error */
  OGGZ_ERR_GENERIC                      = -1,

  /** oggz is not a valid OGGZ */
  OGGZ_ERR_BAD_OGGZ                     = -2,

  /** The requested operation is not suitable for this OGGZ */
  OGGZ_ERR_INVALID                      = -3,

  /** oggz contains no logical bitstreams */
  OGGZ_ERR_NO_STREAMS                   = -4,

  /** Operation is inappropriate for oggz in current bos state */
  OGGZ_ERR_BOS                          = -5,

  /** Operation is inappropriate for oggz in current eos state */
  OGGZ_ERR_EOS                          = -6,

conrad's avatar
conrad committed
113
114
115
  /** Operation requires a valid metric, but none has been set */
  OGGZ_ERR_BAD_METRIC                   = -7,

andre's avatar
andre committed
116
117
118
119
120
121
  /** System specific error; check errno for details */
  OGGZ_ERR_SYSTEM                       = -10,

  /** Functionality disabled at build time */
  OGGZ_ERR_DISABLED                     = -11,

conrad's avatar
conrad committed
122
123
124
  /** Seeking operation is not possible for this OGGZ */
  OGGZ_ERR_NOSEEK                       = -13,

andre's avatar
andre committed
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
  /** The requested serialno does not exist in this OGGZ */
  OGGZ_ERR_BAD_SERIALNO                 = -20,

  /** Packet disallowed due to invalid byte length */
  OGGZ_ERR_BAD_BYTES                    = -21,

  /** Packet disallowed due to invalid b_o_s (beginning of stream) flag */
  OGGZ_ERR_BAD_B_O_S                    = -22,

  /** Packet disallowed due to invalid e_o_s (end of stream) flag */
  OGGZ_ERR_BAD_E_O_S                    = -23,

  /** Packet disallowed due to invalid granulepos */
  OGGZ_ERR_BAD_GRANULEPOS               = -24,

  /** Packet disallowed due to invalid packetno */
  OGGZ_ERR_BAD_PACKETNO                 = -25,

  /** Guard provided by user has non-zero value */
  OGGZ_ERR_BAD_GUARD                    = -210,

  /** Attempt to call oggz_write() or oggz_write_output() from within
   * a hungry() callback */
  OGGZ_ERR_RECURSIVE_WRITE              = -266
};

#endif /* __OGGZ_CONSTANTS_H__ */