repeat play, in/out <> shortcuts, append to proj wording, cleanup
[goodguy/history.git] / cinelerra-5.1 / cinelerra / ffmpeg.h
index e70bcbfb266f404beba4ab9491d03a243d5c34f6..5c9b1ea1e1d0c5fe91f61d96eac480f6261ff332 100644 (file)
@@ -13,6 +13,7 @@
 #include "bcwindowbase.inc"
 #include "condition.h"
 #include "cstrdup.h"
+#include "edl.inc"
 #include "linklist.h"
 #include "ffmpeg.inc"
 #include "filebase.inc"
@@ -80,9 +81,9 @@ public:
 
        virtual int encode_activate();
        virtual int decode_activate();
+       virtual int write_packet(FFPacket &pkt);
        int read_packet();
        int seek(int64_t no, double rate);
-       int write_packet(FFPacket &pkt);
        int flush();
        int decode(AVFrame *frame);
        void load_markers(IndexMarks &marks, double rate);
@@ -99,6 +100,11 @@ public:
        int load_filter(AVFrame *frame);
        int read_filter(AVFrame *frame);
        int read_frame(AVFrame *frame);
+       int open_stats_file();
+       int close_stats_file();
+       int read_stats_file();
+       int write_stats_file();
+       int init_stats_file();
 
        FFMPEG *ffmpeg;
        AVStream *st;
@@ -124,6 +130,11 @@ public:
        int reading, writing;
        int seeked, eof;
 
+       FILE *stats_fp;
+       char *stats_filename;
+       char *stats_in;
+       int pass;
+
        int st_eof() { return eof; }
        void st_eof(int v) { eof = v; }
 };
@@ -145,11 +156,13 @@ class FFAudioStream : public FFStream {
        int write(const float *fp, long len);
        int zero(long len);
        int write(const double *dp, long len, int ch);
+       int write_packet(FFPacket &pkt);
 public:
        FFAudioStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx);
        virtual ~FFAudioStream();
        int is_audio() { return 1; }
        int is_video() { return 0; }
+       void init_swr(int ichs, int ifmt, int irate);
        int get_samples(float *&samples, uint8_t **data, int len);
        int load_history(uint8_t **data, int len);
        int decode_frame(AVFrame *frame);
@@ -168,6 +181,7 @@ public:
        int load(int64_t pos, int len);
        int audio_seek(int64_t pos);
        int encode(double **samples, int len);
+       int drain();
 
        int idx;
        int channel0, channels;
@@ -176,6 +190,7 @@ public:
        int64_t length;
 
        SwrContext *resample_context;
+       int swr_ichs, swr_ifmt, swr_irate;
        int aud_bfr_sz;
        float *aud_bfr;
 };
@@ -202,6 +217,7 @@ public:
 };
 
 class FFVideoStream : public FFStream, public FFVideoConvert {
+       int write_packet(FFPacket &pkt);
 public:
        FFVideoStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx);
        virtual ~FFVideoStream();
@@ -217,6 +233,7 @@ public:
        int load(VFrame *vframe, int64_t pos);
        int video_seek(int64_t pos);
        int encode(VFrame *vframe);
+       int drain();
 
        int idx;
        double frame_rate;
@@ -238,18 +255,29 @@ public:
        AVRational check_frame_rate(AVCodec *codec, double frame_rate);
        AVRational to_sample_aspect_ratio(Asset *asset);
        AVRational to_time_base(int sample_rate);
+       static int get_fmt_score(AVSampleFormat dst_fmt, AVSampleFormat src_fmt);
+       static AVSampleFormat find_best_sample_fmt_of_list(
+               const AVSampleFormat *sample_fmts, AVSampleFormat src_fmt);
 
        static void set_option_path(char *path, const char *fmt, ...);
        static void get_option_path(char *path, const char *type, const char *spec);
        static int get_format(char *format, const char *path, const char *spec);
        static int get_codec(char *codec, const char *path, const char *spec);
-       static int scan_option_line(char *cp,char *tag,char *val);
+       static int scan_option_line(const char *cp,char *tag,char *val);
        static int load_defaults(const char *path, const char *type,
                 char *codec, char *codec_options, int len);
-       static void set_asset_format(Asset *asset, const char *text);
+       static int can_render(const char *fformat, const char *type);
+       static int renders_audio(const char *fformat) { return can_render(fformat, "audio"); }
+       static int renders_video(const char *fformat) { return can_render(fformat, "video"); }
+       static int get_ff_option(const char *nm, const char *options, char *value);
+       static void scan_audio_options(Asset *asset, EDL *edl);
+       static void load_audio_options(Asset *asset, EDL *edl);
+       static void scan_video_options(Asset *asset, EDL *edl);
+       static void load_video_options(Asset *asset, EDL *edl);
+       static void set_asset_format(Asset *asset, EDL *edl, const char *text);
        int get_file_format();
-       int get_encoder(const char *options, char *format, char *codec, char *bsfilter);
-       int get_encoder(FILE *fp, char *format, char *codec, char *bsfilter);
+       static int get_encoder(const char *options, char *format, char *codec, char *bsfilter);
+       static int scan_encoder(const char *line, char *format, char *codec, char *bsfilter);
        int read_options(const char *options, AVDictionary *&opts, int skip=0);
        int scan_options(const char *options, AVDictionary *&opts, AVStream *st);
        int read_options(FILE *fp, const char *options, AVDictionary *&opts);
@@ -344,6 +372,7 @@ public:
        const char *ff_video_format(int stream);
        int64_t ff_video_frames(int stream);
        int ff_video_pid(int stream);
+       int ff_video_mpeg_color_range(int stream);
 
        int ff_cpus();
        void dump_context(AVCodecContext *ctx);