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 <fstream> 00030 #include "NvVideoEncoder.h" 00031 #include <sstream> 00032 #include <stdint.h> 00033 00034 typedef struct 00035 { 00036 NvVideoEncoder *enc; 00037 uint32_t encoder_pixfmt; 00038 00039 char *in_file_path; 00040 std::ifstream *in_file; 00041 00042 uint32_t width; 00043 uint32_t height; 00044 00045 char *out_file_path; 00046 std::ofstream *out_file; 00047 00048 char *ROI_Param_file_path; 00049 std::ifstream *roi_Param_file; 00050 00051 uint32_t bitrate; 00052 uint32_t profile; 00053 enum v4l2_mpeg_video_bitrate_mode ratecontrol; 00054 uint32_t iframe_interval; 00055 uint32_t idr_interval; 00056 enum v4l2_mpeg_video_h264_level level; 00057 uint32_t fps_n; 00058 uint32_t fps_d; 00059 00060 enum v4l2_enc_temporal_tradeoff_level_type temporal_tradeoff_level; 00061 v4l2_enc_slice_length_type slice_length_type; 00062 uint32_t slice_length; 00063 uint32_t virtual_buffer_size; 00064 uint32_t num_reference_frames; 00065 uint32_t slice_intrarefresh_interval; 00066 uint32_t num_b_frames; 00067 uint32_t nMinQpI; /* Minimum QP value to use for index frames */ 00068 uint32_t nMaxQpI; /* Maximum QP value to use for index frames */ 00069 uint32_t nMinQpP; /* Minimum QP value to use for P frames */ 00070 uint32_t nMaxQpP; /* Maximum QP value to use for P frames */ 00071 uint32_t nMinQpB; /* Minimum QP value to use for B frames */ 00072 uint32_t nMaxQpB; /* Maximum QP value to use for B frames */ 00073 bool insert_sps_pps_at_idr; 00074 00075 bool report_metadata; 00076 bool dump_mv; 00077 00078 std::stringstream *runtime_params_str; 00079 uint32_t next_param_change_frame; 00080 bool got_error; 00081 } context_t; 00082 00083 int parse_csv_args(context_t * ctx, int argc, char *argv[]);