Plan 9 from Bell Labs’s /usr/web/sources/contrib/cnielsen/oggenc/flac.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



#ifndef __FLAC_H
#define __FLAC_H

#include "encode.h"
#include "audio.h"
#include <stdio.h>
#include "easyflac.h"

typedef struct {
	EasyFLAC__StreamDecoder *decoder;
	short channels;
	int rate;
	long totalsamples; /* per channel, of course */

	FLAC__StreamMetadata *comments;

	FILE *in;  /* Cache the FILE pointer so the FLAC read callback can use it */
	int eos;  /* End of stream read */


	/* Buffer for decoded audio */
	float **buf;  /* channels by buf_len array */
	int buf_len;
	int buf_start; /* Offset to start of audio data */
	int buf_fill; /* Number of bytes of audio data in buffer */

	/* Buffer for input data we already read in the id phase */
	unsigned char *oldbuf;
	int oldbuf_len;
	int oldbuf_start;
} flacfile;


int flac_id(unsigned char *buf, int len);
int oggflac_id(unsigned char *buf, int len);
int flac_open(FILE *in, oe_enc_opt *opt, unsigned char *buf, int buflen);
void flac_close(void *);

long flac_read(void *, float **buffer, int samples);

#endif /* __FLAC_H */


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.