chromium/third_party/ffmpeg/libavcodec/refstruct.c

/*
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#include <stdatomic.h>
#include <stdint.h>
#include <string.h>

#include "refstruct.h"

#include "libavutil/avassert.h"
#include "libavutil/error.h"
#include "libavutil/macros.h"
#include "libavutil/mem.h"
#include "libavutil/mem_internal.h"
#include "libavutil/thread.h"

#ifndef REFSTRUCT_CHECKED
#ifndef ASSERT_LEVEL
#define ASSERT_LEVEL
#endif
#define REFSTRUCT_CHECKED
#endif

#if REFSTRUCT_CHECKED
#define ff_assert
#else
#define ff_assert(cond)
#endif

#define REFSTRUCT_COOKIE

#if __STDC_VERSION__ >= 201112L && !defined(_MSC_VER)
#define REFCOUNT_OFFSET
#else
#define REFCOUNT_OFFSET
#endif

RefCount;

static RefCount *get_refcount(void *obj)
{}

static const RefCount *cget_refcount(const void *obj)
{}

static void *get_userdata(void *buf)
{}

static void refcount_init(RefCount *ref, FFRefStructOpaque opaque,
                          void (*free_cb)(FFRefStructOpaque opaque, void *obj))
{}

void *ff_refstruct_alloc_ext_c(size_t size, unsigned flags, FFRefStructOpaque opaque,
                               void (*free_cb)(FFRefStructOpaque opaque, void *obj))
{}

void ff_refstruct_unref(void *objp)
{}

void *ff_refstruct_ref(void *obj)
{}

const void *ff_refstruct_ref_c(const void *obj)
{}

void ff_refstruct_replace(void *dstp, const void *src)
{}

int ff_refstruct_exclusive(const void *obj)
{}

struct FFRefStructPool {};

static void pool_free(FFRefStructPool *pool)
{}

static void pool_free_entry(FFRefStructPool *pool, RefCount *ref)
{}

static void pool_return_entry(void *ref_)
{}

static void pool_reset_entry(FFRefStructOpaque opaque, void *entry)
{}

static int refstruct_pool_get_ext(void *datap, FFRefStructPool *pool)
{}

void *ff_refstruct_pool_get(FFRefStructPool *pool)
{}

/**
 * Hint: The content of pool_unref() and refstruct_pool_uninit()
 * could currently be merged; they are only separate functions
 * in case we would ever introduce weak references.
 */
static void pool_unref(void *ref)
{}

static void refstruct_pool_uninit(FFRefStructOpaque unused, void *obj)
{}

FFRefStructPool *ff_refstruct_pool_alloc(size_t size, unsigned flags)
{}

FFRefStructPool *ff_refstruct_pool_alloc_ext_c(size_t size, unsigned flags,
                                               FFRefStructOpaque opaque,
                                               int  (*init_cb)(FFRefStructOpaque opaque, void *obj),
                                               void (*reset_cb)(FFRefStructOpaque opaque, void *obj),
                                               void (*free_entry_cb)(FFRefStructOpaque opaque, void *obj),
                                               void (*free_cb)(FFRefStructOpaque opaque))
{}