- Main Page
- Modules
- Namespaces
- Classes
- Files

- Search for |

- File List
- File Members

# samples/04_video_dec_gie/video_dec_gie.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 #include "NvVideoDecoder.h"
    00030 #include "NvVideoConverter.h"
    00031 #include "EGL/egl.h"
    00032 #include "EGL/eglext.h"
    00033 #include <queue>
    00034 #include <fstream>
    00035 #include <pthread.h>
    00036 #include "gie_inference.h"
    00037 #include "nvosd.h"
    00038
    00039 using namespace std;
    00040
    00041 typedef struct
    00042 {
    00043     struct v4l2_buffer v4l2_buf;
    00044     NvBuffer           *buffer;
    00045     NvBuffer           *shared_buffer;
    00046     void               *arg;
    00047     int                bProcess;
    00048 } Shared_Buffer;
    00049
    00050 typedef struct
    00051 {
    00052     NvVideoDecoder *dec;
    00053     NvVideoConverter *conv;
    00054     uint32_t decoder_pixfmt;
    00055
    00056     char *in_file_path;
    00057     std::ifstream *in_file;
    00058
    00059     EGLDisplay egl_display;
    00060
    00061     queue<Shared_Buffer> *gie_buf_queue;
    00062     pthread_mutex_t       gie_lock; // for dec and conv
    00063     pthread_cond_t        gie_cond;
    00064     int                   gie_stop;
    00065     pthread_t             gie_thread_handle;
    00066     GIE_Context          *gie_ctx;
    00067
    00068     bool disable_dpb;
    00069     uint32_t dec_width;
    00070     uint32_t dec_height;
    00071
    00072     std::queue < NvBuffer * > *conv_output_plane_buf_queue;
    00073     pthread_mutex_t queue_lock;
    00074     pthread_cond_t queue_cond;
    00075
    00076     pthread_t dec_capture_loop;
    00077     bool got_error;
    00078     bool got_eos;
    00079
    00080     string deployfile;
    00081     string modelfile;
    00082 } context_t;
    00083
    00084 typedef struct
    00085 {
    00086     uint32_t window_height;
    00087     uint32_t window_width;
    00088 }display_resolution_t;
    00089
    00090 class GIE_Context;
    00091
    00092 int parseCsvArgs(context_t * ctx, GIE_Context *gie_ctx, int argc, char *argv[]);