summaryrefslogtreecommitdiff
path: root/plugins/liboggedit/oggedit_internal.h
blob: d050ac7241f233198d3dba6538a662831c981cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
  This file is part of Deadbeef Player source code
  http://deadbeef.sourceforge.net

  DeaDBeeF Ogg Edit library internal headers

  Copyright (C) 2014 Ian Nartowicz <deadbeef@nartowicz.co.uk>

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

*/

#ifndef __OGGEDIT_INT_H
#define __OGGEDIT_INT_H

#include <stdbool.h>
#include <ogg/ogg.h>
#if HAVE_SYS_SYSLIMITS_H
#include <sys/syslimits.h>
#endif
#include "../../deadbeef.h"
#include "oggedit.h"

#define OPUSNAME "Opus"
#define VORBISNAME "Vorbis"
#define FLACNAME "Flac"

#define CHUNKSIZE 4096
#define MAXPAGE 65536
#define MAXPAYLOAD 65025

void _oggpack_chars(oggpack_buffer *opb, const char *s, size_t length);
void _oggpack_string(oggpack_buffer *opb, const char *s);
void _oggpackB_string(oggpack_buffer *opb, const char *s);
int open_temp_file(const char *fname, char *tempname, FILE **out);
FILE *open_new_file(const char *outname);
off_t file_size(const char *fname);
void cleanup(DB_FILE *in, FILE *out, ogg_sync_state *oy, void *buffer);
int copy_up_to_codec(DB_FILE *in, FILE *out, ogg_sync_state *oy, ogg_page *og, const off_t start_offset, const off_t link_offset, const char *codec);
int copy_up_to_header(DB_FILE *in, FILE *out, ogg_sync_state *oy, ogg_page *og, const int codec_serial);
long flush_stream(FILE *out, ogg_stream_state *os);
char *codec_names(DB_FILE *in, ogg_sync_state *oy, const off_t link_offset);
off_t codec_stream_size(DB_FILE *in, ogg_sync_state *oy, const off_t start_offset, const off_t end_offset, const char *codec);
char *parse_vendor(const ogg_packet *op, const size_t magic_length);
int init_read_stream(DB_FILE *in, ogg_sync_state *oy, ogg_stream_state *os, ogg_page *og, const off_t offset, const char *codec);
int read_packet(DB_FILE *in, ogg_sync_state *oy, ogg_stream_state *os, ogg_page *og, ogg_packet *header, int pages);
ogg_packet *fill_vc_packet(const char *magic, const size_t magic_length, const char *vendor, const size_t num_tags, char **tags, const bool framing, const size_t padding, ogg_packet *op);
size_t vc_size(const char *vendor, size_t num_tags, char **tags);
int copy_remaining_pages(DB_FILE *in, FILE *out, ogg_sync_state *oy, const int codec_serial, uint32_t pageno);
int write_all_streams(DB_FILE *in, FILE *out, ogg_sync_state *oy, const off_t offset);
int write_one_stream(DB_FILE *in, FILE *out, ogg_sync_state *oy, const off_t offset, const char *codec);

#endif /* __OGGEDIT_INT_H */