# samples/common/classes/NvVideoEncoder.cpp File Reference

`#include "NvVideoEncoder.h"`
`#include "NvLogging.h"`
`#include <cstring>`
`#include <errno.h>`

Go to the source code of this file.

## Defines

#define | ENCODER_DEV "/dev/nvhost-msenc"
#define | ENCODER_COMP_NAME "NVENC"
#define | CHECK_V4L2_RETURN(ret, str)
#define | RETURN_ERROR_IF_FORMATS_SET()
#define | RETURN_ERROR_IF_BUFFERS_REQUESTED()
#define | RETURN_ERROR_IF_BUFFERS_NOT_REQUESTED()
#define | RETURN_ERROR_IF_FORMATS_NOT_SET()

## Define Documentation

#define CHECK_V4L2_RETURN | ( | ret,
|  | str |  | ) |

Value:

    if (ret < 0) {                               \
            COMP_SYS_ERROR_MSG(str << ": failed");   \
            return -1;                               \
        } else {                                     \
            COMP_DEBUG_MSG(str << ": success");      \
            return 0;                                \
        }

Definition at line 38 of file NvVideoEncoder.cpp.

#define ENCODER_COMP_NAME "NVENC"

Definition at line 36 of file NvVideoEncoder.cpp.

#define ENCODER_DEV "/dev/nvhost-msenc"

Definition at line 35 of file NvVideoEncoder.cpp.

#define RETURN_ERROR_IF_BUFFERS_NOT_REQUESTED | ( |  | ) |

Value:

    if (output_plane.getNumBuffers() == 0 || capture_plane.getNumBuffers() == 0) { \
            COMP_ERROR_MSG("Should be called before requesting buffers on either plane") \
            return -1; \
        }

Definition at line 59 of file NvVideoEncoder.cpp.

#define RETURN_ERROR_IF_BUFFERS_REQUESTED | ( |  | ) |

Value:

    if (output_plane.getNumBuffers() != 0 && capture_plane.getNumBuffers() != 0) { \
            COMP_ERROR_MSG("Should be called before requesting buffers on either plane") \
            return -1; \
        }

Definition at line 53 of file NvVideoEncoder.cpp.

#define RETURN_ERROR_IF_FORMATS_NOT_SET | ( |  | ) |

Value:

    if (output_plane_pixfmt == 0 || capture_plane_pixfmt == 0) { \
            COMP_ERROR_MSG("Should be called after setting plane formats") \
            return -1; \
        }

Definition at line 65 of file NvVideoEncoder.cpp.

#define RETURN_ERROR_IF_FORMATS_SET | ( |  | ) |

Value:

    if (output_plane_pixfmt != 0 || capture_plane_pixfmt != 0) { \
            COMP_ERROR_MSG("Should be called before setting plane formats") \
            return -1; \
        }

Definition at line 47 of file NvVideoEncoder.cpp.