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
3434 #include "libavutil/opt.h"
3535 #include "libavutil/thread.h"
3636 #include "avcodec.h"
37+#include "avcodec_internal.h"
3738 #include "bsf.h"
3839 #include "codec_internal.h"
3940 #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+
28+struct AVCodecContext;
29+struct AVFrame;
30+
31+/**
32+ * avcodec_receive_frame() implementation for decoders.
33+ */
34+int ff_decode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame);
35+
36+/**
37+ * avcodec_receive_frame() implementation for encoders.
38+ */
39+int 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+ */
45+int 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+ */
51+int 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
4141 #include "libavutil/opt.h"
4242
4343 #include "avcodec.h"
44+#include "avcodec_internal.h"
4445 #include "bytestream.h"
4546 #include "bsf.h"
4647 #include "codec_internal.h"
libavcodec/decode.h+0−11
@@ -53,11 +53,6 @@ typedef struct FrameDecodeData { · 52 unmodified lines
5353 void (*hwaccel_priv_free)(void *priv);
5454 } FrameDecodeData;
5555
56−/**
57− * avcodec_receive_frame() implementation for decoders.
58− */
59−int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame);
60−
6156 /**
6257 * Called by decoders to get the next packet for decoding.
6358 *
@@ -99,12 +94,6 @@ int ff_attach_decode_data(AVFrame *frame); · 35 unmodified lines
9994 */
10095 int ff_copy_palette(void *dst, const AVPacket *src, void *logctx);
10196
102−/**
103− * Perform decoder initialization and validation.
104− * Called when opening the decoder, before the FFCodec.init() call.
105− */
106−int ff_decode_preinit(AVCodecContext *avctx);
107−
10897 /**
10998 * Check that the provided frame dimensions are valid and set them on the codec
11099 * context.
libavcodec/encode.c+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include "libavutil/samplefmt.h"
2828
2929 #include "avcodec.h"
30+#include "avcodec_internal.h"
3031 #include "codec_internal.h"
3132 #include "encode.h"
3233 #include "frame_thread_encoder.h"
libavcodec/encode.h+0−11
@@ -26,11 +26,6 @@ · 25 unmodified lines
2626 #include "avcodec.h"
2727 #include "packet.h"
2828
29−/**
30− * avcodec_receive_frame() implementation for encoders.
31− */
32−int ff_encode_receive_frame(AVCodecContext *avctx, AVFrame *frame);
33−
3429 /**
3530 * Called by encoders to get the next frame for encoding.
3631 *
@@ -75,12 +70,6 @@ int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size); · 38 unmodified lines
7570 int ff_encode_reordered_opaque(AVCodecContext *avctx,
7671 AVPacket *pkt, const AVFrame *frame);
7772
78−/*
79− * Perform encoder initialization and validation.
80− * Called when opening the encoder, before the FFCodec.init() call.
81− */
82−int ff_encode_preinit(AVCodecContext *avctx);
83−
8473 int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
8574 AVFrame *frame, int *got_packet);
8675

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