#include <stdio.h>
#include <string.h>
#include <xvid.h>
#include "libavutil/avassert.h"
#include "libavutil/file.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "encode.h"
#include "internal.h"
#include "mpegutils.h"
#include "packet_internal.h"
Go to the source code of this file.
|
static int | xvid_encode_close (AVCodecContext *avctx) |
|
static int | xvid_encode_frame (AVCodecContext *avctx, AVPacket *pkt, const AVFrame *picture, int *got_packet) |
|
static int | xvid_ff_2pass_create (xvid_plg_create_t *param, void **handle) |
| Initialize the two-pass plugin and context. More...
|
|
static int | xvid_ff_2pass_destroy (struct xvid_context *ref, xvid_plg_destroy_t *param) |
| Destroy the two-pass plugin context. More...
|
|
static int | xvid_ff_2pass_before (struct xvid_context *ref, xvid_plg_data_t *param) |
| Enable fast encode mode during the first pass. More...
|
|
static int | xvid_ff_2pass_after (struct xvid_context *ref, xvid_plg_data_t *param) |
| Capture statistic data and write it during first pass. More...
|
|
static int | xvid_ff_2pass (void *ref, int cmd, void *p1, void *p2) |
| Dispatch function for our custom plugin. More...
|
|
static int | xvid_strip_vol_header (AVCodecContext *avctx, AVPacket *pkt, unsigned int header_len, unsigned int frame_len) |
| Routine to create a global VO/VOL header for MP4 container. More...
|
|
static void | xvid_correct_framerate (AVCodecContext *avctx) |
| Routine to correct a possibly erroneous framerate being fed to us. More...
|
|
static av_cold int | xvid_encode_init (AVCodecContext *avctx) |
|
Interface to xvidcore for MPEG-4 compliant encoding.
- Author
- Adam Thayer (krevn.nosp@m.ik@c.nosp@m.omcas.nosp@m.t.ne.nosp@m.t)
Definition in file libxvid.c.
◆ BUFFER_SIZE
Buffer management macros.
Definition at line 57 of file libxvid.c.
◆ BUFFER_REMAINING
#define BUFFER_REMAINING |
( |
|
x | ) |
(BUFFER_SIZE - strlen(x)) |
◆ BUFFER_CAT
#define BUFFER_CAT |
( |
|
x | ) |
(&((x)[strlen(x)])) |
◆ OFFSET
◆ VE
◆ xvid_encode_close()
◆ xvid_encode_frame()
◆ xvid_ff_2pass_create()
static int xvid_ff_2pass_create |
( |
xvid_plg_create_t * |
param, |
|
|
void ** |
handle |
|
) |
| |
|
static |
Initialize the two-pass plugin and context.
- Parameters
-
param | Input construction parameter structure |
handle | Private context handle |
- Returns
- Returns XVID_ERR_xxxx on failure, or 0 on success.
Definition at line 120 of file libxvid.c.
Referenced by xvid_ff_2pass().
◆ xvid_ff_2pass_destroy()
static int xvid_ff_2pass_destroy |
( |
struct xvid_context * |
ref, |
|
|
xvid_plg_destroy_t * |
param |
|
) |
| |
|
static |
Destroy the two-pass plugin context.
- Parameters
-
ref | Context pointer for the plugin |
param | Destroy context |
- Returns
- Returns 0, success guaranteed
Definition at line 151 of file libxvid.c.
Referenced by xvid_ff_2pass().
◆ xvid_ff_2pass_before()
static int xvid_ff_2pass_before |
( |
struct xvid_context * |
ref, |
|
|
xvid_plg_data_t * |
param |
|
) |
| |
|
static |
Enable fast encode mode during the first pass.
- Parameters
-
- Returns
- Returns 0, success guaranteed
Definition at line 168 of file libxvid.c.
Referenced by xvid_ff_2pass().
◆ xvid_ff_2pass_after()
static int xvid_ff_2pass_after |
( |
struct xvid_context * |
ref, |
|
|
xvid_plg_data_t * |
param |
|
) |
| |
|
static |
Capture statistic data and write it during first pass.
- Parameters
-
ref | Context pointer for the plugin |
param | Statistic data |
- Returns
- Returns XVID_ERR_xxxx on failure, or 0 on success
Definition at line 212 of file libxvid.c.
Referenced by xvid_ff_2pass().
◆ xvid_ff_2pass()
static int xvid_ff_2pass |
( |
void * |
ref, |
|
|
int |
cmd, |
|
|
void * |
p1, |
|
|
void * |
p2 |
|
) |
| |
|
static |
Dispatch function for our custom plugin.
This handles the dispatch for the Xvid plugin. It passes data on to other functions for actual processing.
- Parameters
-
ref | Context pointer for the plugin |
cmd | The task given for us to complete |
p1 | First parameter (varies) |
p2 | Second parameter (varies) |
- Returns
- Returns XVID_ERR_xxxx on failure, or 0 on success
Definition at line 249 of file libxvid.c.
Referenced by xvid_encode_init().
◆ xvid_strip_vol_header()
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.
- Parameters
-
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 |
- Returns
- Returns new length of frame data
Definition at line 281 of file libxvid.c.
Referenced by xvid_encode_frame().
◆ xvid_correct_framerate()
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.
- Parameters
-
avctx | Context that contains the framerate to correct. |
Definition at line 323 of file libxvid.c.
Referenced by xvid_encode_init().
◆ xvid_encode_init()
◆ options
Initial value:= {
{
"mpeg_quant",
"Use MPEG quantizers instead of H.263",
OFFSET(mpeg_quant),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
VE },
}
Definition at line 880 of file libxvid.c.
◆ xvid_class
Initial value:= {
.class_name = "libxvid",
}
Definition at line 894 of file libxvid.c.
◆ ff_libxvid_encoder
Initial value:= {
.name = "libxvid",
.wrapper_name = "libxvid",
}
Definition at line 901 of file libxvid.c.
Structure for the private Xvid context.