All pastes #595607 Raw Edit

buffering.h

public text v1 · immutable
#595607 ·published 2007-06-29 16:10 UTC
rendered paste body
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2007 Nicolas Pennequin
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#ifndef _BUFFERING_H_
#define _BUFFERING_H_

#include <sys/types.h>

enum data_type {
    TYPE_UNKNOWN,
    TYPE_AUDIO,
    TYPE_ID3,
    TYPE_CUESHEET,
    TYPE_IMAGE
};

enum data_state {
    STATE_UNKNOWN,
    STATE_OUTDATED,
    STATE_IN_USE,
    STATE_TO_BE_USED
};

struct memory_handle {
    enum data_type type;
    enum data_state state;
    char path[MAX_PATH];
    size_t filerem;            /* Remaining bytes of file NOT in buffer */
    size_t filesize;           /* File total length */
    volatile size_t available; /* Available bytes to read from buffer */
    size_t start_pos;          /* Position to first bytes of file in buffer */
    size_t buf_idx;            /* Pointer to the data buffer */
};

void buffering_init(void);
void audio_reset_buffer(void);

#endif