⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ffmpeg.c

📁 F:图像处理资料264264书籍ffmpeg-0.4.9-pre1VideoStream.rar 一个视频解压缩源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
/* * FFmpeg main  * Copyright (c) 2000-2003 Fabrice Bellard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#define HAVE_AV_CONFIG_H#include <limits.h>#include "avformat.h"#include "framehook.h"#include "dsputil.h"#ifndef CONFIG_WIN32#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <sys/time.h>#include <termios.h>#include <sys/resource.h>#include <signal.h>#endif#ifdef CONFIG_OS2#include <sys/types.h>#include <sys/select.h>#include <stdlib.h>#endif#undef time //needed because HAVE_AV_CONFIG_H is defined on top#include <time.h>#include "cmdutils.h"#if !defined(INFINITY) && defined(HUGE_VAL)#define INFINITY HUGE_VAL#endif/* select an input stream for an output stream */typedef struct AVStreamMap {    int file_index;    int stream_index;} AVStreamMap;extern const OptionDef options[];static void show_help(void);static void show_license(void);#define MAX_FILES 20static AVFormatContext *input_files[MAX_FILES];static int64_t input_files_ts_offset[MAX_FILES];static int nb_input_files = 0;static AVFormatContext *output_files[MAX_FILES];static int nb_output_files = 0;static AVStreamMap stream_maps[MAX_FILES];static int nb_stream_maps;static AVInputFormat *file_iformat;static AVOutputFormat *file_oformat;static AVImageFormat *image_format;static int frame_width  = 160;static int frame_height = 128;static float frame_aspect_ratio = 0;static enum PixelFormat frame_pix_fmt = PIX_FMT_YUV420P;static int frame_padtop  = 0;static int frame_padbottom = 0;static int frame_padleft  = 0;static int frame_padright = 0;static int padcolor[3] = {16,128,128}; /* default to black */static int frame_topBand  = 0;static int frame_bottomBand = 0;static int frame_leftBand  = 0;static int frame_rightBand = 0;static int frame_rate = 25;static int frame_rate_base = 1;static int video_bit_rate = 200*1000;static int video_bit_rate_tolerance = 4000*1000;static float video_qscale = 0;static int video_qmin = 2;static int video_qmax = 31;static int video_lmin = 2*FF_QP2LAMBDA;static int video_lmax = 31*FF_QP2LAMBDA;static int video_mb_qmin = 2;static int video_mb_qmax = 31;static int video_qdiff = 3;static float video_qblur = 0.5;static float video_qcomp = 0.5;static uint16_t *intra_matrix = NULL;static uint16_t *inter_matrix = NULL;#if 0 //experimental, (can be removed)static float video_rc_qsquish=1.0;static float video_rc_qmod_amp=0;static int video_rc_qmod_freq=0;#endifstatic char *video_rc_override_string=NULL;static char *video_rc_eq="tex^qComp";static int video_rc_buffer_size=0;static float video_rc_buffer_aggressivity=1.0;static int video_rc_max_rate=0;static int video_rc_min_rate=0;static float video_rc_initial_cplx=0;static float video_b_qfactor = 1.25;static float video_b_qoffset = 1.25;static float video_i_qfactor = -0.8;static float video_i_qoffset = 0.0;static int video_intra_quant_bias= FF_DEFAULT_QUANT_BIAS;static int video_inter_quant_bias= FF_DEFAULT_QUANT_BIAS;static int me_method = ME_EPZS;static int video_disable = 0;static int video_codec_id = CODEC_ID_NONE;static int same_quality = 0;static int b_frames = 0;static int mb_decision = FF_MB_DECISION_SIMPLE;static int ildct_cmp = FF_CMP_VSAD;static int mb_cmp = FF_CMP_SAD;static int sub_cmp = FF_CMP_SAD;static int cmp = FF_CMP_SAD;static int pre_cmp = FF_CMP_SAD;static int pre_me = 0;static float lumi_mask = 0;static float dark_mask = 0;static float scplx_mask = 0;static float tcplx_mask = 0;static float p_mask = 0;static int use_4mv = 0;static int use_obmc = 0;static int use_loop = 0;static int use_aic = 0;static int use_aiv = 0;static int use_umv = 0;static int use_ss = 0;static int use_alt_scan = 0;static int use_trell = 0;static int use_scan_offset = 0;static int use_qpel = 0;static int use_qprd = 0;static int use_cbprd = 0;static int qns = 0;static int closed_gop = 0;static int do_deinterlace = 0;static int do_interlace_dct = 0;static int do_interlace_me = 0;static int workaround_bugs = FF_BUG_AUTODETECT;static int error_resilience = 2;static int error_concealment = 3;static int dct_algo = 0;static int idct_algo = 0;static int use_part = 0;static int packet_size = 0;static int error_rate = 0;static int strict = 0;static int top_field_first = -1;static int noise_reduction = 0;static int sc_threshold = 0;static int debug = 0;static int debug_mv = 0;static int me_threshold = 0;static int mb_threshold = 0;static int intra_dc_precision = 8;static int coder = 0;static int context = 0;static int predictor = 0;extern int loop_input; /* currently a hack */static int gop_size = 12;static int intra_only = 0;static int audio_sample_rate = 44100;static int audio_bit_rate = 64000;static int audio_disable = 0;static int audio_channels = 1;static int audio_codec_id = CODEC_ID_NONE;static int64_t recording_time = 0;static int64_t start_time = 0;static int64_t rec_timestamp = 0;static int64_t input_ts_offset = 0;static int file_overwrite = 0;static char *str_title = NULL;static char *str_author = NULL;static char *str_copyright = NULL;static char *str_comment = NULL;static int do_benchmark = 0;static int do_hex_dump = 0;static int do_pkt_dump = 0;static int do_psnr = 0;static int do_vstats = 0;static int do_pass = 0;static int bitexact = 0;static char *pass_logfilename = NULL;static int audio_stream_copy = 0;static int video_stream_copy = 0;static int video_sync_method= 1;static int audio_sync_method= 0;static int copy_ts= 0;static int rate_emu = 0;static char *video_grab_format = "video4linux";static char *video_device = NULL;static int  video_channel = 0;static char *video_standard = "ntsc";static char *audio_grab_format = "audio_device";static char *audio_device = NULL;static int using_stdin = 0;static int using_vhook = 0;static int verbose = 1;static int thread_count= 1;static int q_pressed = 0;static int me_range = 0;static int64_t video_size = 0;static int64_t audio_size = 0;static int64_t extra_size = 0;static int nb_frames_dup = 0;static int nb_frames_drop = 0;static int input_sync;#define DEFAULT_PASS_LOGFILENAME "ffmpeg2pass"typedef struct AVOutputStream {    int file_index;          /* file index */    int index;               /* stream index in the output file */    int source_index;        /* AVInputStream index */    AVStream *st;            /* stream in the output file */    int encoding_needed;     /* true if encoding needed for this stream */    int frame_number;    /* input pts and corresponding output pts       for A/V sync */    double sync_ipts;        /* dts from the AVPacket of the demuxer in second units */    int64_t sync_opts;       /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number    /* video only */    int video_resample;      /* video_resample and video_crop are mutually exclusive */    AVFrame pict_tmp;      /* temporary image for resampling */    ImgReSampleContext *img_resample_ctx; /* for image resampling */    int video_crop;          /* video_resample and video_crop are mutually exclusive */    int topBand;             /* cropping area sizes */    int leftBand;        int video_pad;           /* video_resample and video_pad are mutually exclusive */    int padtop;              /* padding area sizes */    int padbottom;    int padleft;    int padright;        /* audio only */    int audio_resample;    ReSampleContext *resample; /* for audio resampling */    FifoBuffer fifo;     /* for compression: one audio fifo per codec */    FILE *logfile;} AVOutputStream;typedef struct AVInputStream {    int file_index;    int index;    AVStream *st;    int discard;             /* true if stream data should be discarded */    int decoding_needed;     /* true if the packets must be decoded in 'raw_fifo' */    int64_t sample_index;      /* current sample */    int64_t       start;     /* time when read started */    unsigned long frame;     /* current frame */    int64_t       next_pts;  /* synthetic pts for cases where pkt.pts                                is not defined */    int64_t       pts;       /* current pts */    int is_start;            /* is 1 at the start and after a discontinuity */} AVInputStream;typedef struct AVInputFile {    int eof_reached;      /* true if eof reached */    int ist_index;        /* index of first stream in ist_table */    int buffer_size;      /* current total buffer size */    int buffer_size_max;  /* buffer size at which we consider we can stop                             buffering */    int nb_streams;       /* nb streams we are aware of */} AVInputFile;#ifndef CONFIG_WIN32/* init terminal so that we can grab keys */static struct termios oldtty;static void term_exit(void){    tcsetattr (0, TCSANOW, &oldtty);}static volatile sig_atomic_t received_sigterm = 0;static voidsigterm_handler(int sig){    received_sigterm = sig;    term_exit();}static void term_init(void){    struct termios tty;    tcgetattr (0, &tty);    oldtty = tty;    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP                          |INLCR|IGNCR|ICRNL|IXON);    tty.c_oflag |= OPOST;    tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);    tty.c_cflag &= ~(CSIZE|PARENB);    tty.c_cflag |= CS8;    tty.c_cc[VMIN] = 1;    tty.c_cc[VTIME] = 0;        tcsetattr (0, TCSANOW, &tty);    signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).  */    signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */    signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */    /*    register a function to be called at normal program termination    */    atexit(term_exit);#ifdef CONFIG_BEOS_NETSERVER    fcntl(0, F_SETFL, fcntl(0, F_GETFL) | O_NONBLOCK);#endif}/* read a key without blocking */static int read_key(void){    int n = 1;    unsigned char ch;#ifndef CONFIG_BEOS_NETSERVER    struct timeval tv;    fd_set rfds;    FD_ZERO(&rfds);    FD_SET(0, &rfds);    tv.tv_sec = 0;    tv.tv_usec = 0;    n = select(1, &rfds, NULL, NULL, &tv);#endif    if (n > 0) {        n = read(0, &ch, 1);        if (n == 1)            return ch;        return n;    }    return -1;}static int decode_interrupt_cb(void)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -