FFmpeg
Loading...
Searching...
No Matches
libtheoraenc.c File Reference

Theora encoder using libtheora. More...

#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/log.h"
#include "libavutil/base64.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include <theora/theoraenc.h>

Go to the source code of this file.

Data Structures

struct  TheoraContext
 

Functions

static int concatenate_packet (unsigned int *offset, AVCodecContext *avc_context, const ogg_packet *packet)
 Concatenate an ogg_packet into the extradata.
 
static int get_stats (AVCodecContext *avctx, int eos)
 
static int submit_stats (AVCodecContext *avctx)
 
static av_cold int encode_init (AVCodecContext *avc_context)
 
static int encode_frame (AVCodecContext *avc_context, AVPacket *pkt, const AVFrame *frame, int *got_packet)
 
static av_cold int encode_close (AVCodecContext *avc_context)
 

Variables

static const AVOption options []
 
static const AVClass theora_class
 
const FFCodec ff_libtheora_encoder
 AVCodec struct exposed to libavcodec.
 

Detailed Description

Theora encoder using libtheora.

Author
Paul Richards paul..nosp@m.rich.nosp@m.ards@.nosp@m.gmai.nosp@m.l.com

A lot of this is copy / paste from other output codecs in libavcodec or pure guesswork (or both).

I have used t_ prefixes on variables which are libtheora types and o_ prefixes on variables which are libogg types.

Definition in file libtheoraenc.c.

Function Documentation

◆ concatenate_packet()

static int concatenate_packet ( unsigned int * offset,
AVCodecContext * avc_context,
const ogg_packet * packet )
static

Concatenate an ogg_packet into the extradata.

Definition at line 73 of file libtheoraenc.c.

Referenced by encode_init().

◆ get_stats()

static int get_stats ( AVCodecContext * avctx,
int eos )
static

Definition at line 106 of file libtheoraenc.c.

Referenced by encode_frame(), and encode_init().

◆ submit_stats()

static int submit_stats ( AVCodecContext * avctx)
static

Definition at line 144 of file libtheoraenc.c.

Referenced by encode_frame(), and encode_init().

◆ encode_init()

static av_cold int encode_init ( AVCodecContext * avc_context)
static

Definition at line 181 of file libtheoraenc.c.

◆ encode_frame()

static int encode_frame ( AVCodecContext * avc_context,
AVPacket * pkt,
const AVFrame * frame,
int * got_packet )
static

Definition at line 301 of file libtheoraenc.c.

◆ encode_close()

static av_cold int encode_close ( AVCodecContext * avc_context)
static

Definition at line 388 of file libtheoraenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "speed_level", "Sets the encoding speed level", 0x42 , AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
}
#define NULL
Definition coverity.c:32
#define AV_OPT_FLAG_VIDEO_PARAM
Definition opt.h:357
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition opt.h:351
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 60 of file libtheoraenc.c.

◆ theora_class

const AVClass theora_class
static
Initial value:
= {
.class_name = "libtheora",
.item_name = av_default_item_name,
.option = options,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 65 of file libtheoraenc.c.

◆ ff_libtheora_encoder

const FFCodec ff_libtheora_encoder
Initial value:
= {
.p.name = "libtheora",
CODEC_LONG_NAME("libtheora Theora"),
.p.type = AVMEDIA_TYPE_VIDEO,
.p.capabilities = AV_CODEC_CAP_DR1 |
.priv_data_size = sizeof(TheoraContext),
.p.priv_class = &theora_class,
.color_ranges = AVCOL_RANGE_MPEG,
.p.wrapper_name = "libtheora",
}
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
static av_cold int encode_init(AVCodecContext *avctx)
Definition asvenc.c:373
#define CODEC_PIXFMTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
static av_cold int encode_close(AVCodecContext *avctx)
Definition dcaenc.c:354
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame, AVPacket *pkt)
Definition ffmpeg_enc.c:694
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition codec.h:147
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition codec.h:79
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_THEORA
Definition codec_id.h:80
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static const AVClass theora_class
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
Definition pixfmt.h:766
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition pixfmt.h:73
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition pixfmt.h:77
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition pixfmt.h:78

AVCodec struct exposed to libavcodec.

Definition at line 401 of file libtheoraenc.c.