FFmpeg
libavcodec
zlib_wrapper.h
Go to the documentation of this file.
1
/*
2
* Wrappers for zlib
3
* Copyright (C) 2022 Andreas Rheinhardt
4
*
5
* This file is part of FFmpeg.
6
*
7
* FFmpeg is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* FFmpeg is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with FFmpeg; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef AVCODEC_ZLIB_WRAPPER_H
23
#define AVCODEC_ZLIB_WRAPPER_H
24
25
#include <zlib.h>
26
27
typedef
struct
FFZStream
{
28
z_stream
zstream
;
29
int
inited
;
30
}
FFZStream
;
31
32
/**
33
* Wrapper around inflateInit(). It initializes the fields that zlib
34
* requires to be initialized before inflateInit().
35
* In case of error it also returns an error message to the provided logctx;
36
* in any case, it sets zstream->inited to indicate whether inflateInit()
37
* succeeded.
38
* @return Returns 0 on success or a negative error code on failure
39
*/
40
int
ff_inflate_init
(
FFZStream
*zstream,
void
*logctx);
41
42
/**
43
* Wrapper around inflateEnd(). It calls inflateEnd() iff
44
* zstream->inited is set and resets zstream->inited.
45
* It is therefore safe to be called even if
46
* ff_inflate_init() has never been called on it (or errored out)
47
* provided that the FFZStream (or just FFZStream.inited) has been zeroed.
48
*/
49
void
ff_inflate_end
(
FFZStream
*zstream);
50
51
/**
52
* Wrapper around deflateInit(). It works analogously to ff_inflate_init().
53
*/
54
int
ff_deflate_init
(
FFZStream
*zstream,
int
level
,
void
*logctx);
55
56
/**
57
* Wrapper around deflateEnd(). It works analogously to ff_inflate_end().
58
*/
59
void
ff_deflate_end
(
FFZStream
*zstream);
60
61
#endif
/* AVCODEC_ZLIB_WRAPPER_H */
level
uint8_t level
Definition:
svq3.c:205
FFZStream::zstream
z_stream zstream
Definition:
zlib_wrapper.h:28
ff_deflate_end
void ff_deflate_end(FFZStream *zstream)
Wrapper around deflateEnd().
ff_inflate_end
void ff_inflate_end(FFZStream *zstream)
Wrapper around inflateEnd().
FFZStream
Definition:
zlib_wrapper.h:27
FFZStream::inited
int inited
Definition:
zlib_wrapper.h:29
ff_inflate_init
int ff_inflate_init(FFZStream *zstream, void *logctx)
Wrapper around inflateInit().
ff_deflate_init
int ff_deflate_init(FFZStream *zstream, int level, void *logctx)
Wrapper around deflateInit().
Generated on Wed Dec 4 2024 19:22:23 for FFmpeg by
1.8.17