# include/NvUtils.h File Reference

Common functions used by applications. More...

`#include <fstream>`
`#include "NvBuffer.h"`

Go to the source code of this file.

## Functions

int | read_video_frame (std::ifstream *stream, NvBuffer &buffer)
| Read a video frame from a file to the Buffer structure.
int | write_video_frame (std::ofstream *stream, NvBuffer &buffer)
| Wite a video frame to a file from the Buffer structure.

## Detailed Description

Common functions used by applications.

Definition in file NvUtils.h.

## Function Documentation

int read_video_frame | ( | std::ifstream * | stream,
|  | NvBuffer & | buffer |
| ) |  |  |

Read a video frame from a file to the Buffer structure.

This function reads data from the file into the buffer plane by plane. It reads width * height * byteperpixel of data for each plane while taking care of the stride of the plane.

Parameters:

  `[in]` | stream | Input file stream
  `[in]` | buffer | Buffer object into which the data has to be read

Returns:
  0 for success, -1 for failure

Definition at line 35 of file NvUtils.cpp.

int write_video_frame | ( | std::ofstream * | stream,
|  | NvBuffer & | buffer |
| ) |  |  |

Wite a video frame to a file from the Buffer structure.

This function writes data to the file from the buffer plane by plane. It writes width * height * byteperpixel of data for each plane while taking care of the stride of the plane.

Parameters:

  `[in]` | stream | Output file stream
  `[in]` | buffer | Buffer object from which the data has to be written

Returns:
  0 for success, -1 for failure

Definition at line 60 of file NvUtils.cpp.