Defines | Functions | Variables
patch_ffmpeg_ffmpeg.c File Reference
#include "config.h"
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
#include <stdint.h>
#include "libavformat/avformat.h"
#include "libavdevice/avdevice.h"
#include "libswresample/swresample.h"
#include "libavutil/opt.h"
#include "libavutil/channel_layout.h"
#include "libavutil/parseutils.h"
#include "libavutil/samplefmt.h"
#include "libavutil/fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
#include "libavutil/timestamp.h"
#include "libavutil/bprint.h"
#include "libavutil/time.h"
#include "libavutil/threadmessage.h"
#include "libavformat/os_support.h"
#include "libavformat/ffm.h"
#include "libavfilter/avcodec.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/buffersrc.h"
#include "libavfilter/buffersink.h"
#include <time.h>
#include "ffmpeg.h"
#include "cmdutils.h"
#include "libavutil/avassert.h"
Include dependency graph for patch_ffmpeg_ffmpeg.c:

Go to the source code of this file.

Defines

#define DEFAULT_PASS_LOGFILENAME_PREFIX   "ffmpeg2pass"

Functions

static void abort_codec_experimental (AVCodec *c, int encoder)
void assert_avoptions (AVDictionary *m)
static int check_keyboard_interaction (int64_t cur_time)
static int check_output_constraints (InputStream *ist, OutputStream *ost)
static int check_recording_time (OutputStream *ost)
static OutputStream * choose_output (void)
static void close_all_output_streams (OutputStream *ost, OSTFinished this_stream, OSTFinished others)
static void close_output_stream (OutputStream *ost)
static int compare_int64 (const void *a, const void *b)
static int decode_audio (InputStream *ist, AVPacket *pkt, int *got_output)
static int decode_interrupt_cb (void *ctx)
static int decode_video (InputStream *ist, AVPacket *pkt, int *got_output)
static void do_audio_out (AVFormatContext *s, OutputStream *ost, AVFrame *frame)
static void do_streamcopy (InputStream *ist, OutputStream *ost, const AVPacket *pkt)
static void do_subtitle_out (AVFormatContext *s, OutputStream *ost, InputStream *ist, AVSubtitle *sub)
static void do_video_out (AVFormatContext *s, OutputStream *ost, AVFrame *in_picture)
static void do_video_stats (OutputStream *ost, int frame_size)
static void ffmpeg_cleanup (int ret)
static void finish_output_stream (OutputStream *ost)
static void flush_encoders (void)
static void free_input_threads (void)
static int get_buffer (AVCodecContext *s, AVFrame *frame, int flags)
static enum AVPixelFormat get_format (AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
static const HWAccel * get_hwaccel (enum AVPixelFormat pix_fmt)
static int get_input_packet (InputFile *f, AVPacket *pkt)
static InputStream * get_input_stream (OutputStream *ost)
static int64_t getmaxrss (void)
static int64_t getutime (void)
static int got_eagain (void)
int guess_input_channel_layout (InputStream *ist)
static int init_input_stream (int ist_index, char *error, int error_len)
static void log_callback_null (void *ptr, int level, const char *fmt, va_list vl)
int main (int argc, char **argv)
static int need_output (void)
static void parse_forced_key_frames (char *kf, OutputStream *ost, AVCodecContext *avctx)
static void print_final_stats (int64_t total_size)
static void print_report (int is_last_report, int64_t timer_start, int64_t cur_time)
static void print_sdp (void)
static int process_input (int file_index)
static int process_input_packet (InputStream *ist, const AVPacket *pkt)
static double psnr (double d)
static int read_key (void)
static int reap_filters (void)
void remove_avoptions (AVDictionary **a, AVDictionary *b)
static void report_new_stream (int input_index, AVPacket *pkt)
static void reset_eagain (void)
static void set_encoder_id (OutputFile *of, OutputStream *ost)
static void sigterm_handler (int sig)
static void sub2video_copy_rect (uint8_t *dst, int dst_linesize, int w, int h, AVSubtitleRect *r)
static void sub2video_flush (InputStream *ist)
static int sub2video_get_blank_frame (InputStream *ist)
static void sub2video_heartbeat (InputStream *ist, int64_t pts)
static void sub2video_push_ref (InputStream *ist, int64_t pts)
static void sub2video_update (InputStream *ist, AVSubtitle *sub)
void term_exit (void)
static void term_exit_sigsafe (void)
void term_init (void)
static int transcode (void)
static int transcode_from_filter (FilterGraph *graph, InputStream **best_ist)
static int transcode_init (void)
static int transcode_step (void)
static int transcode_subtitles (InputStream *ist, AVPacket *pkt, int *got_output)
static void update_benchmark (const char *fmt,...)
static void write_frame (AVFormatContext *s, AVPacket *pkt, OutputStream *ost)

Variables

static int current_time
static int64_t decode_error_stat [2]
FilterGraph ** filtergraphs
const char *const forced_keyframes_const_names []
InputFile ** input_files = NULL
InputStream ** input_streams = NULL
const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }
static int main_return_code = 0
static int mainThreadId = 0
int nb_filtergraphs
static int nb_frames_drop = 0
static int nb_frames_dup = 0
int nb_input_files = 0
int nb_input_streams = 0
int nb_output_files = 0
int nb_output_streams = 0
OutputFile ** output_files = NULL
OutputStream ** output_streams = NULL
const int program_birth_year = 2000
const char program_name [] = "ffmpeg"
AVIOContext * progress_avio = NULL
static volatile int received_nb_signals = 0
static volatile int received_sigterm = 0
static int run_as_daemon = 0
static uint8_t * subtitle_out
static volatile int transcode_init_done = 0
static FILE * vstats_file

Detailed Description

multimedia converter based on the FFmpeg libraries

Definition in file patch_ffmpeg_ffmpeg.c.


Define Documentation

#define DEFAULT_PASS_LOGFILENAME_PREFIX   "ffmpeg2pass"

Definition at line 136 of file patch_ffmpeg_ffmpeg.c.


Function Documentation

static void abort_codec_experimental ( AVCodec *  c,
int  encoder 
) [static]

Definition at line 559 of file patch_ffmpeg_ffmpeg.c.

void assert_avoptions ( AVDictionary *  m)

Definition at line 550 of file patch_ffmpeg_ffmpeg.c.

static int check_keyboard_interaction ( int64_t  cur_time) [static]

Definition at line 3099 of file patch_ffmpeg_ffmpeg.c.

static int check_output_constraints ( InputStream *  ist,
OutputStream *  ost 
) [static]

Definition at line 1605 of file patch_ffmpeg_ffmpeg.c.

static int check_recording_time ( OutputStream *  ost) [static]

Definition at line 734 of file patch_ffmpeg_ffmpeg.c.

static OutputStream* choose_output ( void  ) [static]

Select the output stream to process.

Returns:
selected output stream, or NULL if none available

Definition at line 3081 of file patch_ffmpeg_ffmpeg.c.

static void close_all_output_streams ( OutputStream *  ost,
OSTFinished  this_stream,
OSTFinished  others 
) [static]

Definition at line 581 of file patch_ffmpeg_ffmpeg.c.

static void close_output_stream ( OutputStream *  ost) [static]

Definition at line 723 of file patch_ffmpeg_ffmpeg.c.

static int compare_int64 ( const void *  a,
const void *  b 
) [static]

Definition at line 2338 of file patch_ffmpeg_ffmpeg.c.

static int decode_audio ( InputStream *  ist,
AVPacket *  pkt,
int *  got_output 
) [static]

Definition at line 1742 of file patch_ffmpeg_ffmpeg.c.

static int decode_interrupt_cb ( void *  ctx) [static]

Definition at line 423 of file patch_ffmpeg_ffmpeg.c.

static int decode_video ( InputStream *  ist,
AVPacket *  pkt,
int *  got_output 
) [static]

Definition at line 1876 of file patch_ffmpeg_ffmpeg.c.

static void do_audio_out ( AVFormatContext *  s,
OutputStream *  ost,
AVFrame *  frame 
) [static]

Definition at line 747 of file patch_ffmpeg_ffmpeg.c.

static void do_streamcopy ( InputStream *  ist,
OutputStream *  ost,
const AVPacket *  pkt 
) [static]

Definition at line 1622 of file patch_ffmpeg_ffmpeg.c.

static void do_subtitle_out ( AVFormatContext *  s,
OutputStream *  ost,
InputStream *  ist,
AVSubtitle *  sub 
) [static]

Definition at line 796 of file patch_ffmpeg_ffmpeg.c.

static void do_video_out ( AVFormatContext *  s,
OutputStream *  ost,
AVFrame *  in_picture 
) [static]

Definition at line 876 of file patch_ffmpeg_ffmpeg.c.

static void do_video_stats ( OutputStream *  ost,
int  frame_size 
) [static]

Definition at line 1115 of file patch_ffmpeg_ffmpeg.c.

static void ffmpeg_cleanup ( int  ret) [static]

Definition at line 430 of file patch_ffmpeg_ffmpeg.c.

static void finish_output_stream ( OutputStream *  ost) [static]

Definition at line 1151 of file patch_ffmpeg_ffmpeg.c.

static void flush_encoders ( void  ) [static]

Definition at line 1527 of file patch_ffmpeg_ffmpeg.c.

static void free_input_threads ( void  ) [static]
static int get_buffer ( AVCodecContext *  s,
AVFrame *  frame,
int  flags 
) [static]

Definition at line 2274 of file patch_ffmpeg_ffmpeg.c.

static enum AVPixelFormat get_format ( AVCodecContext *  s,
const enum AVPixelFormat *  pix_fmts 
) [static]

Definition at line 2236 of file patch_ffmpeg_ffmpeg.c.

static const HWAccel* get_hwaccel ( enum AVPixelFormat  pix_fmt) [static]

Definition at line 2227 of file patch_ffmpeg_ffmpeg.c.

static int get_input_packet ( InputFile *  f,
AVPacket *  pkt 
) [static]

Definition at line 3285 of file patch_ffmpeg_ffmpeg.c.

static InputStream* get_input_stream ( OutputStream *  ost) [static]

Definition at line 2331 of file patch_ffmpeg_ffmpeg.c.

static int64_t getmaxrss ( void  ) [static]

Definition at line 3783 of file patch_ffmpeg_ffmpeg.c.

static int64_t getutime ( void  ) [static]

Definition at line 3765 of file patch_ffmpeg_ffmpeg.c.

static int got_eagain ( void  ) [static]

Definition at line 3305 of file patch_ffmpeg_ffmpeg.c.

int guess_input_channel_layout ( InputStream *  ist)

Definition at line 1722 of file patch_ffmpeg_ffmpeg.c.

static int init_input_stream ( int  ist_index,
char *  error,
int  error_len 
) [static]

Definition at line 2284 of file patch_ffmpeg_ffmpeg.c.

static void log_callback_null ( void *  ptr,
int  level,
const char *  fmt,
va_list  vl 
) [static]

Definition at line 3801 of file patch_ffmpeg_ffmpeg.c.

int main ( int  argc,
char **  argv 
)

Definition at line 3805 of file patch_ffmpeg_ffmpeg.c.

static int need_output ( void  ) [static]

Definition at line 3051 of file patch_ffmpeg_ffmpeg.c.

static void parse_forced_key_frames ( char *  kf,
OutputStream *  ost,
AVCodecContext *  avctx 
) [static]

Definition at line 2344 of file patch_ffmpeg_ffmpeg.c.

static void print_final_stats ( int64_t  total_size) [static]

Definition at line 1253 of file patch_ffmpeg_ffmpeg.c.

static void print_report ( int  is_last_report,
int64_t  timer_start,
int64_t  cur_time 
) [static]

Definition at line 1362 of file patch_ffmpeg_ffmpeg.c.

static void print_sdp ( void  ) [static]

Definition at line 2210 of file patch_ffmpeg_ffmpeg.c.

static int process_input ( int  file_index) [static]

Definition at line 3330 of file patch_ffmpeg_ffmpeg.c.

static int process_input_packet ( InputStream *  ist,
const AVPacket *  pkt 
) [static]

Definition at line 2068 of file patch_ffmpeg_ffmpeg.c.

static double psnr ( double  d) [static]

Definition at line 1110 of file patch_ffmpeg_ffmpeg.c.

static int read_key ( void  ) [static]

Definition at line 368 of file patch_ffmpeg_ffmpeg.c.

static int reap_filters ( void  ) [static]

Get and encode new output from any of the filtergraphs, without causing activity.

Returns:
0 for success, <0 for severe errors

Definition at line 1170 of file patch_ffmpeg_ffmpeg.c.

void remove_avoptions ( AVDictionary **  a,
AVDictionary *  b 
)

Definition at line 541 of file patch_ffmpeg_ffmpeg.c.

static void report_new_stream ( int  input_index,
AVPacket *  pkt 
) [static]

Definition at line 2407 of file patch_ffmpeg_ffmpeg.c.

static void reset_eagain ( void  ) [static]

Definition at line 3314 of file patch_ffmpeg_ffmpeg.c.

static void set_encoder_id ( OutputFile *  of,
OutputStream *  ost 
) [static]

Definition at line 2422 of file patch_ffmpeg_ffmpeg.c.

static void sigterm_handler ( int  sig) [static]

Definition at line 320 of file patch_ffmpeg_ffmpeg.c.

static void sub2video_copy_rect ( uint8_t *  dst,
int  dst_linesize,
int  w,
int  h,
AVSubtitleRect *  r 
) [static]

Definition at line 181 of file patch_ffmpeg_ffmpeg.c.

static void sub2video_flush ( InputStream *  ist) [static]

Definition at line 287 of file patch_ffmpeg_ffmpeg.c.

static int sub2video_get_blank_frame ( InputStream *  ist) [static]

Definition at line 166 of file patch_ffmpeg_ffmpeg.c.

static void sub2video_heartbeat ( InputStream *  ist,
int64_t  pts 
) [static]

Definition at line 258 of file patch_ffmpeg_ffmpeg.c.

static void sub2video_push_ref ( InputStream *  ist,
int64_t  pts 
) [static]

Definition at line 210 of file patch_ffmpeg_ffmpeg.c.

static void sub2video_update ( InputStream *  ist,
AVSubtitle *  sub 
) [static]

Definition at line 223 of file patch_ffmpeg_ffmpeg.c.

void term_exit ( void  )

Definition at line 307 of file patch_ffmpeg_ffmpeg.c.

static void term_exit_sigsafe ( void  ) [static]

Definition at line 299 of file patch_ffmpeg_ffmpeg.c.

void term_init ( void  )

Definition at line 330 of file patch_ffmpeg_ffmpeg.c.

static int transcode ( void  ) [static]

Definition at line 3646 of file patch_ffmpeg_ffmpeg.c.

static int transcode_from_filter ( FilterGraph *  graph,
InputStream **  best_ist 
) [static]

Perform a step of transcoding for the specified filter graph.

Parameters:
[in]graphfilter graph to consider
[out]best_istinput stream where a frame would allow to continue
Returns:
0 for success, <0 for error

Definition at line 3558 of file patch_ffmpeg_ffmpeg.c.

static int transcode_init ( void  ) [static]

Definition at line 2463 of file patch_ffmpeg_ffmpeg.c.

static int transcode_step ( void  ) [static]

Run a single step of transcoding.

Returns:
0 for success, <0 for error

Definition at line 3604 of file patch_ffmpeg_ffmpeg.c.

static int transcode_subtitles ( InputStream *  ist,
AVPacket *  pkt,
int *  got_output 
) [static]

Definition at line 2007 of file patch_ffmpeg_ffmpeg.c.

static void update_benchmark ( const char *  fmt,
  ... 
) [static]

Definition at line 564 of file patch_ffmpeg_ffmpeg.c.

static void write_frame ( AVFormatContext *  s,
AVPacket *  pkt,
OutputStream *  ost 
) [static]

Definition at line 590 of file patch_ffmpeg_ffmpeg.c.


Variable Documentation

int current_time [static]

Definition at line 131 of file patch_ffmpeg_ffmpeg.c.

int64_t decode_error_stat[2] [static]

Definition at line 129 of file patch_ffmpeg_ffmpeg.c.

FilterGraph** filtergraphs

Definition at line 148 of file patch_ffmpeg_ffmpeg.c.

const char* const forced_keyframes_const_names[]
Initial value:
 {
    "n",
    "n_forced",
    "prev_forced_n",
    "prev_forced_t",
    "t",
    NULL
}

Definition at line 113 of file patch_ffmpeg_ffmpeg.c.

InputFile** input_files = NULL

Definition at line 140 of file patch_ffmpeg_ffmpeg.c.

InputStream** input_streams = NULL

Definition at line 138 of file patch_ffmpeg_ffmpeg.c.

const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }

Definition at line 428 of file patch_ffmpeg_ffmpeg.c.

int main_return_code = 0 [static]

Definition at line 316 of file patch_ffmpeg_ffmpeg.c.

int mainThreadId = 0 [static]

Definition at line 317 of file patch_ffmpeg_ffmpeg.c.

Definition at line 149 of file patch_ffmpeg_ffmpeg.c.

int nb_frames_drop = 0 [static]

Definition at line 128 of file patch_ffmpeg_ffmpeg.c.

int nb_frames_dup = 0 [static]

Definition at line 127 of file patch_ffmpeg_ffmpeg.c.

int nb_input_files = 0

Definition at line 141 of file patch_ffmpeg_ffmpeg.c.

Definition at line 139 of file patch_ffmpeg_ffmpeg.c.

int nb_output_files = 0

Definition at line 146 of file patch_ffmpeg_ffmpeg.c.

Definition at line 144 of file patch_ffmpeg_ffmpeg.c.

OutputFile** output_files = NULL

Definition at line 145 of file patch_ffmpeg_ffmpeg.c.

OutputStream** output_streams = NULL

Definition at line 143 of file patch_ffmpeg_ffmpeg.c.

const int program_birth_year = 2000

Definition at line 109 of file patch_ffmpeg_ffmpeg.c.

const char program_name[] = "ffmpeg"

Definition at line 108 of file patch_ffmpeg_ffmpeg.c.

AVIOContext* progress_avio = NULL

Definition at line 132 of file patch_ffmpeg_ffmpeg.c.

volatile int received_nb_signals = 0 [static]

Definition at line 314 of file patch_ffmpeg_ffmpeg.c.

volatile int received_sigterm = 0 [static]

Definition at line 313 of file patch_ffmpeg_ffmpeg.c.

int run_as_daemon = 0 [static]

Definition at line 126 of file patch_ffmpeg_ffmpeg.c.

uint8_t* subtitle_out [static]

Definition at line 134 of file patch_ffmpeg_ffmpeg.c.

volatile int transcode_init_done = 0 [static]

Definition at line 315 of file patch_ffmpeg_ffmpeg.c.

FILE* vstats_file [static]

Definition at line 111 of file patch_ffmpeg_ffmpeg.c.



dji_ronin
Author(s):
autogenerated on Sat Jun 8 2019 20:15:32