History

lavc: add a header for internal generic-layer APIs

The goal is to distinguish between APIs provided by the generic layer to individual codecs and APIs internal to the generic layer. Start by moving ff_{decode,encode}_receive_frame() and ff_{decode,encode}_preinit() into this new header, as those functions are called from generic code and should not be visible to individual codecs.

Anton Khirnov committed 3 years ago

Commit 5e7b5b01 parent 83c0f7b6 files · +56 −22Browse files

Unified · Split

6 files
  1. libavcodec/avcodec.c +1 −0
  2. libavcodec/avcodec_internal.h +53 −0
  3. libavcodec/decode.c +1 −0
  4. libavcodec/decode.h +0 −11
  5. libavcodec/encode.c +1 −0
  6. libavcodec/encode.h +0 −11
libavcodec/avcodec.c+1−0
@@ -34,6 +34,7 @@ · 33 unmodified lines
34#include "libavutil/opt.h"34#include "libavutil/opt.h"
35#include "libavutil/thread.h"35#include "libavutil/thread.h"
36#include "avcodec.h"36#include "avcodec.h"
37#include "avcodec_internal.h"
37#include "bsf.h"38#include "bsf.h"
38#include "codec_internal.h"39#include "codec_internal.h"
39#include "decode.h"40#include "decode.h"
libavcodec/avcodec_internal.h+53−0
@@ -0,0 +1,53 @@
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19/*
20 * APIs internal to the generic codec layer.
21 *
22 * MUST NOT be included by individual encoders or decoders.
23 */
24
25#ifndef AVCODEC_AVCODEC_INTERNAL_H
26#define AVCODEC_AVCODEC_INTERNAL_H
27
28struct AVCodecContext;
29struct AVFrame;
30
31/**
32 * avcodec_receive_frame() implementation for decoders.
33 */
34int ff_decode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame);
35
36/**
37 * avcodec_receive_frame() implementation for encoders.
38 */
39int ff_encode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame);
40
41/*
42 * Perform encoder initialization and validation.
43 * Called when opening the encoder, before the FFCodec.init() call.
44 */
45int ff_encode_preinit(struct AVCodecContext *avctx);
46
47/**
48 * Perform decoder initialization and validation.
49 * Called when opening the decoder, before the FFCodec.init() call.
50 */
51int ff_decode_preinit(struct AVCodecContext *avctx);
52
53#endif // AVCODEC_AVCODEC_INTERNAL_H
libavcodec/decode.c+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include "libavutil/opt.h"41#include "libavutil/opt.h"
42 42
43#include "avcodec.h"43#include "avcodec.h"
44#include "avcodec_internal.h"
44#include "bytestream.h"45#include "bytestream.h"
45#include "bsf.h"46#include "bsf.h"
46#include "codec_internal.h"47#include "codec_internal.h"
libavcodec/decode.h+0−11
@@ -53,11 +53,6 @@ typedef struct FrameDecodeData { · 52 unmodified lines
53 void (*hwaccel_priv_free)(void *priv);53 void (*hwaccel_priv_free)(void *priv);
54} FrameDecodeData;54} FrameDecodeData;
55 55
56/**
57 * avcodec_receive_frame() implementation for decoders.
58 */
59int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame);
60
61/**56/**
62 * Called by decoders to get the next packet for decoding.57 * Called by decoders to get the next packet for decoding.
63 *58 *
@@ -99,12 +94,6 @@ int ff_attach_decode_data(AVFrame *frame); · 35 unmodified lines
99 */94 */
100int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);95int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);
101 96
102/**
103 * Perform decoder initialization and validation.
104 * Called when opening the decoder, before the FFCodec.init() call.
105 */
106int ff_decode_preinit(AVCodecContext *avctx);
107
108/**97/**
109 * Check that the provided frame dimensions are valid and set them on the codec98 * Check that the provided frame dimensions are valid and set them on the codec
110 * context.99 * context.
libavcodec/encode.c+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
27#include "libavutil/samplefmt.h"27#include "libavutil/samplefmt.h"
28 28
29#include "avcodec.h"29#include "avcodec.h"
30#include "avcodec_internal.h"
30#include "codec_internal.h"31#include "codec_internal.h"
31#include "encode.h"32#include "encode.h"
32#include "frame_thread_encoder.h"33#include "frame_thread_encoder.h"
libavcodec/encode.h+0−11
@@ -26,11 +26,6 @@ · 25 unmodified lines
26#include "avcodec.h"26#include "avcodec.h"
27#include "packet.h"27#include "packet.h"
28 28
29/**
30 * avcodec_receive_frame() implementation for encoders.
31 */
32int ff_encode_receive_frame(AVCodecContext *avctx, AVFrame *frame);
33
34/**29/**
35 * Called by encoders to get the next frame for encoding.30 * Called by encoders to get the next frame for encoding.
36 *31 *
@@ -75,12 +70,6 @@ int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size); · 38 unmodified lines
75int ff_encode_reordered_opaque(AVCodecContext *avctx,70int ff_encode_reordered_opaque(AVCodecContext *avctx,
76 AVPacket *pkt, const AVFrame *frame);71 AVPacket *pkt, const AVFrame *frame);
77 72
78/*
79 * Perform encoder initialization and validation.
80 * Called when opening the encoder, before the FFCodec.init() call.
81 */
82int ff_encode_preinit(AVCodecContext *avctx);
83
84int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,73int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
85 AVFrame *frame, int *got_packet);74 AVFrame *frame, int *got_packet);
86 75

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t