tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

flac.h (2239B)


      1 /*
      2 * FLAC (Free Lossless Audio Codec) common stuff
      3 * Copyright (c) 2008 Justin Ruggles
      4 *
      5 * This file is part of FFmpeg.
      6 *
      7 * FFmpeg is free software; you can redistribute it and/or
      8 * modify it under the terms of the GNU Lesser General Public
      9 * License as published by the Free Software Foundation; either
     10 * version 2.1 of the License, or (at your option) any later version.
     11 *
     12 * FFmpeg is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15 * Lesser General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU Lesser General Public
     18 * License along with FFmpeg; if not, write to the Free Software
     19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
     20 */
     21 
     22 /**
     23 * @file
     24 * FLAC (Free Lossless Audio Codec) common stuff
     25 */
     26 
     27 #ifndef AVCODEC_FLAC_H
     28 #define AVCODEC_FLAC_H
     29 
     30 #include "libavutil/intreadwrite.h"
     31 
     32 #define FLAC_STREAMINFO_SIZE   34
     33 #define FLAC_MAX_CHANNELS       8
     34 #define FLAC_MIN_BLOCKSIZE     16
     35 #define FLAC_MAX_BLOCKSIZE  65535
     36 #define FLAC_MIN_FRAME_SIZE    10
     37 
     38 enum {
     39    FLAC_CHMODE_INDEPENDENT = 0,
     40    FLAC_CHMODE_LEFT_SIDE   = 1,
     41    FLAC_CHMODE_RIGHT_SIDE  = 2,
     42    FLAC_CHMODE_MID_SIDE    = 3,
     43 };
     44 
     45 enum {
     46    FLAC_METADATA_TYPE_STREAMINFO = 0,
     47    FLAC_METADATA_TYPE_PADDING,
     48    FLAC_METADATA_TYPE_APPLICATION,
     49    FLAC_METADATA_TYPE_SEEKTABLE,
     50    FLAC_METADATA_TYPE_VORBIS_COMMENT,
     51    FLAC_METADATA_TYPE_CUESHEET,
     52    FLAC_METADATA_TYPE_PICTURE,
     53    FLAC_METADATA_TYPE_INVALID = 127
     54 };
     55 
     56 /**
     57 * Parse the metadata block parameters from the header.
     58 * @param[in]  block_header header data, at least 4 bytes
     59 * @param[out] last indicator for last metadata block
     60 * @param[out] type metadata block type
     61 * @param[out] size metadata block size
     62 */
     63 static av_always_inline void flac_parse_block_header(const uint8_t *block_header,
     64                                                      int *last, int *type, int *size)
     65 {
     66    int tmp = *block_header;
     67    if (last)
     68        *last = tmp & 0x80;
     69    if (type)
     70        *type = tmp & 0x7F;
     71    if (size)
     72        *size = AV_RB24(block_header + 1);
     73 }
     74 
     75 #endif /* AVCODEC_FLAC_H */