DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/aviwriter/riff_wav_writer.h
00001 /*
00002  *  Copyright (C) 2018  Jon Campbell
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef __ISP_UTILS_V4_AVI_RIFF_WAV_WRITER_H
00020 #define __ISP_UTILS_V4_AVI_RIFF_WAV_WRITER_H
00021 
00022 #include <stdint.h>
00023 #include "riff.h"
00024 #include "waveformatex.h"
00025 #include "bitmapinfoheader.h"
00026 
00027 typedef struct riff_wav_writer {
00028         riff_stack*             riff;
00029         int                     state;
00030         int                     fd,own_fd;
00031         void*                   fmt;
00032         size_t                  fmt_len;
00033 } riff_wav_writer;
00034 
00035 enum {
00036         RIFF_WRITER_INIT,
00037         RIFF_WRITER_HEADER,
00038         RIFF_WRITER_DATA,
00039         RIFF_WRITER_FOOTER,
00040         RIFF_WRITER_DONE
00041 };
00042 
00043 riff_wav_writer *riff_wav_writer_create();
00044 int riff_wav_writer_set_format(riff_wav_writer *w,windows_WAVEFORMAT *f);
00045 int riff_wav_writer_set_format_old(riff_wav_writer *w,windows_WAVEFORMATOLD *f);
00046 int riff_wav_writer_set_format_ex(riff_wav_writer *w,windows_WAVEFORMATEX *f,size_t len);
00047 int riff_wav_writer_assign_file(riff_wav_writer *w,int fd);
00048 int riff_wav_writer_open_file(riff_wav_writer *w,const char *path);
00049 void riff_wav_writer_fsync(riff_wav_writer *w);
00050 int riff_wav_writer_begin_header(riff_wav_writer *w);
00051 int riff_wav_writer_begin_data(riff_wav_writer *w);
00052 int riff_wav_writer_end_data(riff_wav_writer *w);
00053 riff_wav_writer *riff_wav_writer_destroy(riff_wav_writer *w);
00054 int riff_wav_writer_data_write(riff_wav_writer *w,void *buffer,size_t len);
00055 int64_t riff_wav_writer_data_seek(riff_wav_writer *w,int64_t offset);
00056 int64_t riff_wav_writer_data_tell(riff_wav_writer *w);
00057 
00058 #endif /* __ISP_UTILS_V4_AVI_RIFF_WAV_WRITER_H */
00059