Go to the documentation of this file.
54 bytestream_put_byte(
data, 255);
72 bytestream_put_byte(
data, 0);
73 bytestream_put_byte(
data, 254);
82 }
else if (
len == 2) {
86 bytestream_put_byte(
data, 0);
90 bytestream_put_byte(
data, 0);
100 while (
delta >= 255) {
101 bytestream_put_byte(
data, 0);
102 bytestream_put_byte(
data, 2);
103 bytestream_put_byte(
data, 255);
104 bytestream_put_byte(
data, 0);
108 bytestream_put_byte(
data, 0);
109 bytestream_put_byte(
data, 2);
111 bytestream_put_byte(
data, 0);
123 while (yskip >= 255) {
124 bytestream_put_byte(
data, 0);
125 bytestream_put_byte(
data, 2);
126 bytestream_put_byte(
data, 0);
127 bytestream_put_byte(
data, 255);
131 bytestream_put_byte(
data, 0);
132 bytestream_put_byte(
data, 2);
133 bytestream_put_byte(
data, 0);
134 bytestream_put_byte(
data, yskip);
136 bytestream_put_be16(
data, 0x0000);
141 const uint8_t *
line,
int length)
143 int run = 0, last = -1, absstart = 0;
146 for (
int x = 0; x < length; x++) {
147 if (last ==
line[x]) {
167 const AVFrame *pict,
int keyframe,
int *got_keyframe)
188 for (
int y = avctx->
height-1; y >= 0; y--) {
191 bytestream_put_be16(&
data, 0x0000);
196 for (
int y = avctx->
height-1; y >= 0; y--) {
198 const uint8_t *prev = &
s->last_frame->data[0][y*
s->last_frame->linesize[0]];
200 int delta = 0, linestart = 0, encoded = 0;
201 for (
int x = 0; x < avctx->
width; x++) {
202 if (
line[x] == prev[x]) {
205 int len = x - linestart - 4;
234 bytestream_put_be16(&
data, 0x0000);
242 bytestream_put_be16(&
data, 0x0001);
248 const AVFrame *pict,
int *got_packet)
251 int ret, got_keyframe;
265 if ((
ret =
encode(avctx,
pkt, pict,
s->curframe == 0, &got_keyframe)))
static av_cold int msrle_encode_init(AVCodecContext *avctx)
AVPixelFormat
Pixel format.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void write_yskip(AVCodecContext *avctx, uint8_t **data, int yskip)
AVCodec p
The public AVCodec.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
#define FF_CODEC_ENCODE_CB(func)
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
static void write_delta(AVCodecContext *avctx, uint8_t **data, int delta)
int(* init)(AVBSFContext *ctx)
#define AV_INPUT_BUFFER_MIN_SIZE
static int msrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet)
#define CODEC_LONG_NAME(str)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
static void write_run(AVCodecContext *avctx, uint8_t **data, int len, int value)
int flags
A combination of AV_PKT_FLAG values.
static int encode(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int keyframe, int *got_keyframe)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
const char * name
Name of the codec implementation.
const FFCodec ff_msrle_encoder
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
static int msrle_encode_close(AVCodecContext *avctx)
int av_frame_replace(AVFrame *dst, const AVFrame *src)
Ensure the destination frame refers to the same data described by the source frame,...
main external API structure.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
static void write_absolute(AVCodecContext *avctx, uint8_t **data, const uint8_t *line, int len)
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static void encode_line(AVCodecContext *avctx, uint8_t **data, const uint8_t *line, int length)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.