#pragma once
#include <pthread.h>
#include <stdbool.h>
#include "tag.h"
#include "track_info.h"
/* Struct to pass stuff around with the stream decoder */
typedef struct
{
Track_info *tinfo; /* Shared structure with main() */
int cur_fd, next_fd;
ReplayGain_type rgtype;
_Atomic bool cancel_flag; /* To be killed by main() */
int pipefd_wr; /* Where to write the decoded PCM */
pthread_t tid;
void *ctx;
} Decoder;
bool decoder_init(Decoder *dec, int pipefd_wr, Track_info *tinfo,
ReplayGain_type rgtype, const char *next);
void decoder_clear(const Decoder *dec);
void decoder_end(const Decoder *dec);
bool decoder_spawn_thread(Decoder *dec);