- Main Page
- Modules
- Namespaces
- Classes
- Files

- Search for |

- File List
- File Members

# include/NvUtils.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
    00003  *
    00004  * Redistribution and use in source and binary forms, with or without
    00005  * modification, are permitted provided that the following conditions
    00006  * are met:
    00007  *  * Redistributions of source code must retain the above copyright
    00008  *    notice, this list of conditions and the following disclaimer.
    00009  *  * Redistributions in binary form must reproduce the above copyright
    00010  *    notice, this list of conditions and the following disclaimer in the
    00011  *    documentation and/or other materials provided with the distribution.
    00012  *  * Neither the name of NVIDIA CORPORATION nor the names of its
    00013  *    contributors may be used to endorse or promote products derived
    00014  *    from this software without specific prior written permission.
    00015  *
    00016  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
    00017  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    00018  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    00019  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    00020  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    00022  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    00023  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    00024  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    00026  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00027  */
    00028
    00029 /**
    00030  * @file NvUtils.h
    00031  *
    00032  * @brief Common functions used by applications
    00033  */
    00034
    00035 #ifndef __NV_UTILS_H_
    00036 #define __NV_UTILS_H_
    00037
    00038 #include <fstream>
    00039 #include "NvBuffer.h"
    00040
    00041 /**
    00042  * Read a video frame from a file to the Buffer structure
    00043  *
    00044  * This function reads data from the file into the buffer plane by plane.
    00045  * It reads width * height * byteperpixel of data for each plane while taking
    00046  * care of the stride of the plane.
    00047  *
    00048  * @param[in] stream Input file stream
    00049  * @param[in] buffer Buffer object into which the data has to be read
    00050  * @returns 0 for success, -1 for failure
    00051  */
    00052 int read_video_frame(std::ifstream * stream, NvBuffer & buffer);
    00053
    00054 /**
    00055  * Wite a video frame to a file from the Buffer structure
    00056  *
    00057  * This function writes data to the file from the buffer plane by plane.
    00058  * It writes width * height * byteperpixel of data for each plane while taking
    00059  * care of the stride of the plane.
    00060  *
    00061  * @param[in] stream Output file stream
    00062  * @param[in] buffer Buffer object from which the data has to be written
    00063  * @returns 0 for success, -1 for failure
    00064  */
    00065 int write_video_frame(std::ofstream * stream, NvBuffer & buffer);
    00066 #endif