|
HVE
HVE Hardware Video Encoder library
|
Data Structures | |
| struct | hve_config |
| Encoder configuration. More... | |
| struct | hve_frame |
| Data to be encoded (single frame). More... | |
| struct | hve |
| Internal library data passed around by the user. More... | |
Enumerations | |
| enum | hve_retval_enum { HVE_ERROR =-1, HVE_OK =0 } |
| Constants returned by most of library functions. More... | |
Functions | |
| struct hve * | hve_init (const struct hve_config *config) |
| initialize internal library data. More... | |
| void | hve_close (struct hve *h) |
| free library resources More... | |
| int | hve_send_frame (struct hve *h, struct hve_frame *frame) |
| Send frame to hardware for encoding. More... | |
| AVPacket * | hve_receive_packet (struct hve *h, int *error) |
| Retrieve encoded frame data from hardware. More... | |
| enum hve_retval_enum |
| void hve_close | ( | struct hve * | h | ) |
free library resources
Cleans and frees memory
| h | pointer to internal library data |
| struct hve* hve_init | ( | const struct hve_config * | config | ) |
initialize internal library data.
| config | encoder configuration |
| AVPacket* hve_receive_packet | ( | struct hve * | h, |
| int * | error | ||
| ) |
Retrieve encoded frame data from hardware.
Keep calling this functions after hve_send_frame until NULL is returned. The ownership of returned AVPacket remains with the library:
While beginning encoding you may have to send a few frames before you will get packets. When flushing the encoder you may get multiple packets afterwards.
| h | pointer to internal library data |
| error | pointer to error code |
Example (in encoding loop):
Send frame to hardware for encoding.
Call this for each frame you want to encode. Follow with hve_receive_packet to get encoded data from hardware. Call with NULL frame argument to flush the encoder when you want to finish encoding. After flushing follow with hve_receive_packet to get last encoded frames. After flushing it is not possible to reuse the encoder.
The pixel format of the frame should match the one specified in hve_init.
Hardware accelerated scaling is performed before encoding if non-zero input_width and input_height different from width and height were specified in hve_init.
Perfomance hints:
| h | pointer to internal library data |
| frame | data to encode |
Example flushing: