#include <xvid.h>
#include <unistd.h>
#include "avcodec.h"
#include "libxvid_internal.h"
Go to the source code of this file.
Data Structures | |
struct | xvid_context |
Structure for the private XviD context. More... | |
struct | xvid_ff_pass1 |
Structure for the private first-pass plugin. More... | |
Defines | |
#define | BUFFER_SIZE 1024 |
Buffer management macros. | |
#define | BUFFER_REMAINING(x) (BUFFER_SIZE - strlen(x)) |
#define | BUFFER_CAT(x) (&((x)[strlen(x)])) |
Typedefs | |
typedef struct xvid_context | xvid_context_t |
Structure for the private XviD context. | |
typedef struct xvid_ff_pass1 | xvid_ff_pass1_t |
Structure for the private first-pass plugin. | |
Functions | |
int | xvid_strip_vol_header (AVCodecContext *avctx, unsigned char *frame, unsigned int header_len, unsigned int frame_len) |
Routine to create a global VO/VOL header for MP4 container. | |
int | xvid_ff_2pass (void *ref, int cmd, void *p1, void *p2) |
Dispatch function for our custom plugin. | |
void | xvid_correct_framerate (AVCodecContext *avctx) |
Routine to correct a possibly erroneous framerate being fed to us. | |
int | ff_xvid_encode_init (AVCodecContext *avctx) |
Creates the private context for the encoder. | |
int | ff_xvid_encode_frame (AVCodecContext *avctx, unsigned char *frame, int buf_size, void *data) |
Encodes a single frame. | |
int | ff_xvid_encode_close (AVCodecContext *avctx) |
Destroys the private context for the encoder. | |
static int | xvid_ff_2pass_create (xvid_plg_create_t *param, void **handle) |
Initializes the two-pass plugin and context. | |
static int | xvid_ff_2pass_destroy (xvid_context_t *ref, xvid_plg_destroy_t *param) |
Destroys the two-pass plugin context. | |
static int | xvid_ff_2pass_before (xvid_context_t *ref, xvid_plg_data_t *param) |
Enables fast encode mode during the first pass. | |
static int | xvid_ff_2pass_after (xvid_context_t *ref, xvid_plg_data_t *param) |
Captures statistic data and writes it during first pass. | |
Variables | |
AVCodec | libxvid_encoder |
XviD codec definition for libavcodec. |
#define BUFFER_CAT | ( | x | ) | (&((x)[strlen(x)])) |
Definition at line 38 of file libxvidff.c.
Referenced by xvid_ff_2pass_after(), and xvid_ff_2pass_create().
#define BUFFER_REMAINING | ( | x | ) | (BUFFER_SIZE - strlen(x)) |
Definition at line 37 of file libxvidff.c.
Referenced by xvid_ff_2pass_after(), and xvid_ff_2pass_create().
#define BUFFER_SIZE 1024 |
typedef struct xvid_context xvid_context_t |
Structure for the private XviD context.
This stores all the private context for the codec.
typedef struct xvid_ff_pass1 xvid_ff_pass1_t |
Structure for the private first-pass plugin.
int ff_xvid_encode_close | ( | AVCodecContext * | avctx | ) |
Destroys the private context for the encoder.
All buffers are freed, and the XviD encoder context is destroyed.
avctx | AVCodecContext pointer to context |
Definition at line 466 of file libxvidff.c.
int ff_xvid_encode_frame | ( | AVCodecContext * | avctx, | |
unsigned char * | frame, | |||
int | buf_size, | |||
void * | data | |||
) |
Encodes a single frame.
avctx | AVCodecContext pointer to context | |
frame | Pointer to encoded frame buffer | |
buf_size | Size of encoded frame buffer | |
data | Pointer to AVFrame of unencoded frame |
Definition at line 369 of file libxvidff.c.
int ff_xvid_encode_init | ( | AVCodecContext * | avctx | ) |
Creates the private context for the encoder.
All buffers are allocated, settings are loaded from the user, and the encoder context created.
avctx | AVCodecContext pointer to context |
Definition at line 86 of file libxvidff.c.
void xvid_correct_framerate | ( | AVCodecContext * | avctx | ) |
Routine to correct a possibly erroneous framerate being fed to us.
XviD currently chokes on framerates where the ticks per frame is extremely large. This function works to correct problems in this area by estimating a new framerate and taking the simpler fraction of the two presented.
avctx | Context that contains the framerate to correct. |
Definition at line 540 of file libxvidff.c.
Referenced by ff_xvid_encode_init().
int xvid_ff_2pass | ( | void * | ref, | |
int | cmd, | |||
void * | p1, | |||
void * | p2 | |||
) |
Dispatch function for our custom plugin.
This handles the dispatch for the XviD plugin. It passes data on to other functions for actual processing.
ref | Context pointer for the plugin | |
cmd | The task given for us to complete | |
p1 | First parameter (varies) | |
p2 | Second parameter (varies) |
Definition at line 732 of file libxvidff.c.
Referenced by ff_xvid_encode_init().
static int xvid_ff_2pass_after | ( | xvid_context_t * | ref, | |
xvid_plg_data_t * | param | |||
) | [static] |
Captures statistic data and writes it during first pass.
ref | Context pointer for the plugin | |
param | Statistic data |
Definition at line 696 of file libxvidff.c.
Referenced by xvid_ff_2pass().
static int xvid_ff_2pass_before | ( | xvid_context_t * | ref, | |
xvid_plg_data_t * | param | |||
) | [static] |
Enables fast encode mode during the first pass.
ref | Context pointer for the plugin | |
param | Frame data |
Definition at line 653 of file libxvidff.c.
Referenced by xvid_ff_2pass().
static int xvid_ff_2pass_create | ( | xvid_plg_create_t * | param, | |
void ** | handle | |||
) | [static] |
Initializes the two-pass plugin and context.
param | Input construction parameter structure | |
handle | Private context handle |
Definition at line 606 of file libxvidff.c.
Referenced by xvid_ff_2pass().
static int xvid_ff_2pass_destroy | ( | xvid_context_t * | ref, | |
xvid_plg_destroy_t * | param | |||
) | [static] |
Destroys the two-pass plugin context.
ref | Context pointer for the plugin | |
param | Destrooy context |
Definition at line 637 of file libxvidff.c.
Referenced by xvid_ff_2pass().
int xvid_strip_vol_header | ( | AVCodecContext * | avctx, | |
unsigned char * | frame, | |||
unsigned int | header_len, | |||
unsigned int | frame_len | |||
) |
Routine to create a global VO/VOL header for MP4 container.
What we do here is extract the header from the XviD bitstream as it is encoded. We also strip the repeated headers from the bitstream when a global header is requested for MPEG-4 ISO compliance.
avctx | AVCodecContext pointer to context | |
frame | Pointer to encoded frame data | |
header_len | Length of header to search | |
frame_len | Length of encoded frame data |
Definition at line 500 of file libxvidff.c.
Referenced by ff_xvid_encode_frame().
Initial value:
{ "libxvid", CODEC_TYPE_VIDEO, CODEC_ID_XVID, sizeof(xvid_context_t), ff_xvid_encode_init, ff_xvid_encode_frame, ff_xvid_encode_close, .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1}, }
Definition at line 758 of file libxvidff.c.