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 "NvEglRenderer.h" 00032 #include <queue> 00033 #include <fstream> 00034 #include <pthread.h> 00035 00036 typedef struct 00037 { 00038 NvVideoDecoder *dec; 00039 NvVideoConverter *conv; 00040 uint32_t decoder_pixfmt; 00041 00042 NvEglRenderer *renderer; 00043 00044 char *in_file_path; 00045 std::ifstream *in_file; 00046 00047 char *out_file_path; 00048 std::ofstream *out_file; 00049 00050 bool disable_rendering; 00051 bool fullscreen; 00052 uint32_t window_height; 00053 uint32_t window_width; 00054 uint32_t window_x; 00055 uint32_t window_y; 00056 uint32_t out_pixfmt; 00057 float fps; 00058 00059 bool disable_dpb; 00060 00061 bool input_nalu; 00062 00063 bool stats; 00064 00065 bool enable_metadata; 00066 enum v4l2_skip_frames_type skip_frames; 00067 00068 std::queue < NvBuffer * > *conv_output_plane_buf_queue; 00069 pthread_mutex_t queue_lock; 00070 pthread_cond_t queue_cond; 00071 00072 pthread_t dec_capture_loop; 00073 bool got_error; 00074 bool got_eos; 00075 } context_t; 00076 00077 int parse_csv_args(context_t * ctx, int argc, char *argv[]);