Functions for working with AVPicture. More...
Modules | |
Utility functions | |
Miscellaneous utility functions related to both encoding and decoding (or neither). |
Data Structures | |
struct | AVPicture |
four components are given, that's all. More... |
Typedefs | |
typedef struct AVPicture | AVPicture |
four components are given, that's all. |
Functions | |
int | avpicture_alloc (AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height) |
Allocate memory for a picture. | |
void | avpicture_free (AVPicture *picture) |
Free a picture previously allocated by avpicture_alloc(). | |
int | avpicture_fill (AVPicture *picture, uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height) |
Fill in the AVPicture fields. | |
int | avpicture_layout (const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size) |
Copy pixel data from an AVPicture into a buffer. | |
int | avpicture_get_size (enum AVPixelFormat pix_fmt, int width, int height) |
Calculate the size in bytes that a picture of the given width and height would occupy if stored in the given picture format. | |
int | avpicture_deinterlace (AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) |
deinterlace - if not supported return -1 | |
void | av_picture_copy (AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) |
Copy image src to dst. | |
int | av_picture_crop (AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int top_band, int left_band) |
Crop image top and left side. | |
int | av_picture_pad (AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color) |
Pad image. |
Functions for working with AVPicture.
Private codec-specific defaults.
Initialize codec static data, called from avcodec_register().
Encode data to an AVPacket.
avctx | codec context | |
avpkt | output AVPacket (may contain a user-provided buffer) | |
[in] | frame | AVFrame containing the raw data to be encoded |
[out] | got_packet_ptr | encoder sets to 0 or 1 to indicate that a non-empty packet was returned in avpkt. |
Flush buffers. Will be called when seeking
Name of the hardware accelerated codec. The name is globally unique among encoders and among decoders (but an encoder and a decoder can share the same name).
Type of codec implemented by the hardware accelerator.
See AVMEDIA_TYPE_xxx
Codec implemented by the hardware accelerator.
See AV_CODEC_ID_xxx
Supported pixel format.
Only hardware accelerated formats are supported here.
Hardware accelerated codec capabilities. see FF_HWACCEL_CODEC_CAP_*
Called at the beginning of each frame or field picture.
Meaningful frame information (codec specific) is guaranteed to be parsed at this point. This function is mandatory.
Note that buf can be NULL along with buf_size set to 0. Otherwise, this means the whole frame is available at this point.
avctx | the codec context |
buf | the frame data buffer base |
buf_size | the size of the frame in bytes |
Callback for each slice.
Meaningful slice information (codec specific) is guaranteed to be parsed at this point. This function is mandatory.
avctx | the codec context |
buf | the slice data buffer base |
buf_size | the size of the slice in bytes |
Called at the end of each frame or field picture.
The whole picture is parsed at this point and can now be sent to the hardware accelerator. This function is mandatory.
avctx | the codec context |
Size of HW accelerator private data.
Private data is allocated with av_mallocz() before AVCodecContext.get_buffer() and deallocated after AVCodecContext.release_buffer().
Functions for working with AVPicture
Private codec-specific defaults.
Initialize codec static data, called from avcodec_register().
Encode data to an AVPacket.
avctx | codec context | |
avpkt | output AVPacket (may contain a user-provided buffer) | |
[in] | frame | AVFrame containing the raw data to be encoded |
[out] | got_packet_ptr | encoder sets to 0 or 1 to indicate that a non-empty packet was returned in avpkt. |
Flush buffers. Will be called when seeking
Name of the hardware accelerated codec. The name is globally unique among encoders and among decoders (but an encoder and a decoder can share the same name).
Type of codec implemented by the hardware accelerator.
See AVMEDIA_TYPE_xxx
Codec implemented by the hardware accelerator.
See AV_CODEC_ID_xxx
Supported pixel format.
Only hardware accelerated formats are supported here.
Hardware accelerated codec capabilities. see FF_HWACCEL_CODEC_CAP_*
Called at the beginning of each frame or field picture.
Meaningful frame information (codec specific) is guaranteed to be parsed at this point. This function is mandatory.
Note that buf can be NULL along with buf_size set to 0. Otherwise, this means the whole frame is available at this point.
avctx | the codec context |
buf | the frame data buffer base |
buf_size | the size of the frame in bytes |
Callback for each slice.
Meaningful slice information (codec specific) is guaranteed to be parsed at this point. This function is mandatory.
avctx | the codec context |
buf | the slice data buffer base |
buf_size | the size of the slice in bytes |
Called at the end of each frame or field picture.
The whole picture is parsed at this point and can now be sent to the hardware accelerator. This function is mandatory.
avctx | the codec context |
Size of HW accelerator private data.
Private data is allocated with av_mallocz() before AVCodecContext.get_buffer() and deallocated after AVCodecContext.release_buffer().
Functions for working with AVPicture
four components are given, that's all.
the last component is alpha
void av_picture_copy | ( | AVPicture * | dst, |
const AVPicture * | src, | ||
enum AVPixelFormat | pix_fmt, | ||
int | width, | ||
int | height | ||
) |
Copy image src to dst.
Wraps av_picture_data_copy() above.
Definition at line 119 of file avpicture.c.
Referenced by avcodec_default_reget_buffer(), copy_frame(), qtrle_encode_frame(), queue_picture(), and roq_decode_frame().
int av_picture_crop | ( | AVPicture * | dst, |
const AVPicture * | src, | ||
enum AVPixelFormat | pix_fmt, | ||
int | top_band, | ||
int | left_band | ||
) |
Crop image top and left side.
Definition at line 284 of file imgconvert.c.
int av_picture_pad | ( | AVPicture * | dst, |
const AVPicture * | src, | ||
int | height, | ||
int | width, | ||
enum AVPixelFormat | pix_fmt, | ||
int | padtop, | ||
int | padbottom, | ||
int | padleft, | ||
int | padright, | ||
int * | color | ||
) |
Pad image.
Definition at line 307 of file imgconvert.c.
int avpicture_alloc | ( | AVPicture * | picture, |
enum AVPixelFormat | pix_fmt, | ||
int | width, | ||
int | height | ||
) |
Allocate memory for a picture.
Call avpicture_free() to free it.
picture | the picture to be filled in |
pix_fmt | the format of the picture |
width | the width of the picture |
height | the height of the picture |
Definition at line 101 of file avpicture.c.
Referenced by ff_create_schro_frame(), and qtrle_encode_init().
int avpicture_deinterlace | ( | AVPicture * | dst, |
const AVPicture * | src, | ||
enum AVPixelFormat | pix_fmt, | ||
int | width, | ||
int | height | ||
) |
deinterlace - if not supported return -1
Definition at line 476 of file imgconvert.c.
Referenced by pre_process_video_frame().
int avpicture_fill | ( | AVPicture * | picture, |
uint8_t * | ptr, | ||
enum AVPixelFormat | pix_fmt, | ||
int | width, | ||
int | height | ||
) |
Fill in the AVPicture fields.
The fields of the given AVPicture are filled in by using the 'ptr' address which points to the image data buffer. Depending on the specified picture format, one or multiple image data pointers and line sizes will be set. If a planar format is specified, several pointers will be set pointing to the different picture planes and the line sizes of the different planes will be stored in the lines_sizes array. Call with ptr == NULL to get the required size for the ptr buffer.
To allocate the buffer and fill in the AVPicture fields in one call, use avpicture_alloc().
picture | AVPicture whose fields are to be filled in |
ptr | Buffer which will contain or contains the actual image data |
pix_fmt | The format in which the picture data is stored. |
width | the width of the image in pixels |
height | the height of the image in pixels |
Definition at line 34 of file avpicture.c.
Referenced by alloc_picture(), avpicture_get_size(), copy_frame(), pre_process_video_frame(), and raw_decode().
Free a picture previously allocated by avpicture_alloc().
The data buffer used by the AVPicture is freed, but the AVPicture structure itself is not.
picture | the AVPicture to be freed |
Definition at line 114 of file avpicture.c.
Referenced by free_schro_frame(), and qtrle_encode_end().
int avpicture_get_size | ( | enum AVPixelFormat | pix_fmt, |
int | width, | ||
int | height | ||
) |
Calculate the size in bytes that a picture of the given width and height would occupy if stored in the given picture format.
Note that this returns the size of a compact representation as generated by avpicture_layout(), which can be smaller than the size required for e.g. avpicture_fill().
pix_fmt | the given picture format |
width | the width of the image |
height | the height of the image |
Definition at line 85 of file avpicture.c.
Referenced by alloc_picture(), avpicture_layout(), dc1394_read_common(), encode_frame(), libschroedinger_encode_init(), pam_encode_frame(), pnm_encode_frame(), pnm_parse(), pre_process_video_frame(), raw_encode(), raw_init_decoder(), rawvideo_read_packet(), targa_encode_frame(), v4l2_read_header(), vble_decode_init(), and yuv4_read_packet().
int avpicture_layout | ( | const AVPicture * | src, |
enum AVPixelFormat | pix_fmt, | ||
int | width, | ||
int | height, | ||
unsigned char * | dest, | ||
int | dest_size | ||
) |
Copy pixel data from an AVPicture into a buffer.
The data is stored compactly, without any gaps for alignment or padding which may be applied by avpicture_fill().
[in] | src | AVPicture containing image data |
[in] | pix_fmt | The format in which the picture data is stored. |
[in] | width | the width of the image in pixels. |
[in] | height | the height of the image in pixels. |
[out] | dest | A buffer into which picture data will be copied. |
[in] | dest_size | The size of 'dest'. |
Definition at line 49 of file avpicture.c.
Referenced by encode_frame(), libschroedinger_frame_from_data(), and raw_encode().