render config sample/pixel fmt, piped files, ffmpeg raw yuv/rgb
authorGood Guy <good1.2guy@gmail.com>
Sat, 27 Jan 2018 00:01:30 +0000 (17:01 -0700)
committerGood Guy <good1.2guy@gmail.com>
Sat, 27 Jan 2018 00:01:30 +0000 (17:01 -0700)
46 files changed:
cinelerra-5.1/cinelerra/asset.C
cinelerra-5.1/cinelerra/asset.h
cinelerra-5.1/cinelerra/confirmsave.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/ffmpeg.h
cinelerra-5.1/cinelerra/file.C
cinelerra-5.1/cinelerra/fileac3.C
cinelerra-5.1/cinelerra/fileac3.h
cinelerra-5.1/cinelerra/filebase.h
cinelerra-5.1/cinelerra/filedv.C
cinelerra-5.1/cinelerra/filedv.h
cinelerra-5.1/cinelerra/fileexr.C
cinelerra-5.1/cinelerra/fileexr.h
cinelerra-5.1/cinelerra/fileffmpeg.C
cinelerra-5.1/cinelerra/fileffmpeg.h
cinelerra-5.1/cinelerra/fileflac.C
cinelerra-5.1/cinelerra/fileflac.h
cinelerra-5.1/cinelerra/filejpeg.C
cinelerra-5.1/cinelerra/filejpeg.h
cinelerra-5.1/cinelerra/filejpeglist.C
cinelerra-5.1/cinelerra/filejpeglist.h
cinelerra-5.1/cinelerra/filempeg.C
cinelerra-5.1/cinelerra/filempeg.h
cinelerra-5.1/cinelerra/fileogg.C
cinelerra-5.1/cinelerra/fileogg.h
cinelerra-5.1/cinelerra/filepng.C
cinelerra-5.1/cinelerra/filepng.h
cinelerra-5.1/cinelerra/fileppm.C
cinelerra-5.1/cinelerra/fileppm.h
cinelerra-5.1/cinelerra/filesndfile.C
cinelerra-5.1/cinelerra/filesndfile.h
cinelerra-5.1/cinelerra/filetga.C
cinelerra-5.1/cinelerra/filetga.h
cinelerra-5.1/cinelerra/filetiff.C
cinelerra-5.1/cinelerra/filetiff.h
cinelerra-5.1/cinelerra/filevorbis.C
cinelerra-5.1/cinelerra/filevorbis.h
cinelerra-5.1/cinelerra/formatpopup.C
cinelerra-5.1/cinelerra/formatpopup.h
cinelerra-5.1/cinelerra/formattools.C
cinelerra-5.1/cinelerra/formattools.h
cinelerra-5.1/ffmpeg/video/faststart_h264.mp4
cinelerra-5.1/ffmpeg/video/raw.rgb [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/raw.yuv [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/rgb.dfl [new file with mode: 0644]
cinelerra-5.1/ffmpeg/video/yuv.dfl [new file with mode: 0644]

index 0993b12fc1c47ff65e8c36da313f18dad53acbc2..07aa00b3e7891c8c1eb01c3a8251e80125acd8c7 100644 (file)
@@ -85,9 +85,11 @@ int Asset::init_values()
        strcpy(acodec, "");
 
        ff_audio_options[0] = 0;
-       ff_video_options[0] = 0;
+       ff_sample_format[0] = 0;
        ff_audio_bitrate = 0;
        ff_audio_quality = -1;
+       ff_video_options[0] = 0;
+       ff_pixel_format[0] = 0;
        ff_video_bitrate = 0;
        ff_video_quality = -1;
 
@@ -223,9 +225,11 @@ void Asset::copy_format(Asset *asset, int do_index)
        strcpy(acodec, asset->acodec);
 
        strcpy(ff_audio_options, asset->ff_audio_options);
-       strcpy(ff_video_options, asset->ff_video_options);
+       strcpy(ff_sample_format, asset->ff_sample_format);
        ff_audio_bitrate = asset->ff_audio_bitrate;
        ff_audio_quality = asset->ff_audio_quality;
+       strcpy(ff_video_options, asset->ff_video_options);
+       strcpy(ff_pixel_format, asset->ff_pixel_format);
        ff_video_bitrate = asset->ff_video_bitrate;
        ff_video_quality = asset->ff_video_quality;
 
@@ -353,6 +357,7 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl)
                        !strcmp(acodec, asset.acodec));
                if(result && format == FILE_FFMPEG)
                        result = !strcmp(ff_audio_options, asset.ff_audio_options) &&
+                               !strcmp(ff_sample_format, asset.ff_sample_format) &&
                                ff_audio_bitrate == asset.ff_audio_bitrate &&
                                ff_audio_quality == asset.ff_audio_quality;
        }
@@ -373,6 +378,7 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl)
                        jpeg_sphere == asset.jpeg_sphere);
                if(result && format == FILE_FFMPEG)
                        result = !strcmp(ff_video_options, asset.ff_video_options) &&
+                               !strcmp(ff_pixel_format, asset.ff_pixel_format) &&
                                ff_video_bitrate == asset.ff_video_bitrate &&
                                ff_video_quality == asset.ff_video_quality;
        }
@@ -795,9 +801,11 @@ void Asset::load_defaults(BC_Hash *defaults,
        theora_keyframe_force_frequency = GET_DEFAULT("THEORA_FORCE_KEYFRAME_FREQUENCY", theora_keyframe_force_frequency);
 
        GET_DEFAULT("FF_AUDIO_OPTIONS", ff_audio_options);
+       GET_DEFAULT("FF_SAMPLE_FORMAT", ff_sample_format);
        ff_audio_bitrate = GET_DEFAULT("FF_AUDIO_BITRATE", ff_audio_bitrate);
        ff_audio_quality = GET_DEFAULT("FF_AUDIO_QUALITY", ff_audio_quality);
        GET_DEFAULT("FF_VIDEO_OPTIONS", ff_video_options);
+       GET_DEFAULT("FF_PIXEL_FORMAT", ff_pixel_format);
        ff_video_bitrate = GET_DEFAULT("FF_VIDEO_BITRATE", ff_video_bitrate);
        ff_video_quality = GET_DEFAULT("FF_VIDEO_QUALITY", ff_video_quality);
 
@@ -887,9 +895,11 @@ void Asset::save_defaults(BC_Hash *defaults,
                UPDATE_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
 
                UPDATE_DEFAULT("FF_AUDIO_OPTIONS", ff_audio_options);
+               UPDATE_DEFAULT("FF_SAMPLE_FORMAT", ff_sample_format);
                UPDATE_DEFAULT("FF_AUDIO_BITRATE", ff_audio_bitrate);
                UPDATE_DEFAULT("FF_AUDIO_QUALITY", ff_audio_quality);
                UPDATE_DEFAULT("FF_VIDEO_OPTIONS", ff_video_options);
+               UPDATE_DEFAULT("FF_PIXEL_FORMAT",  ff_pixel_format);
                UPDATE_DEFAULT("FF_VIDEO_BITRATE", ff_video_bitrate);
                UPDATE_DEFAULT("FF_VIDEO_QUALITY", ff_video_quality);
 
@@ -988,9 +998,11 @@ int Asset::dump(FILE *fp)
        fprintf(fp,"   format %d\n", format);
        fprintf(fp,"   fformat=\"%s\"\n", fformat);
        fprintf(fp,"   ff_audio_options=\"%s\"\n", ff_audio_options);
+       fprintf(fp,"   ff_sample_format=\"%s\"\n", ff_sample_format);
        fprintf(fp,"   ff_audio_bitrate=%d\n", ff_audio_bitrate);
        fprintf(fp,"   ff_audio_quality=%d\n", ff_audio_quality);
        fprintf(fp,"   ff_video_options=\"%s\"\n", ff_video_options);
+       fprintf(fp,"   ff_pixel_format=\"%s\"\n", ff_pixel_format);
        fprintf(fp,"   ff_video_bitrate=%d\n", ff_video_bitrate);
        fprintf(fp,"   ff_video_quality=%d\n", ff_video_quality);
        fprintf(fp,"   audio_data %d channels %d samplerate %d bits %d"
index b90cacfc9d433d66b61daf9502bbcb6db0adb09e..b877c47d938d1ccfb29184c673ceb12116f9da80 100644 (file)
@@ -208,12 +208,12 @@ public:
 
 // ffmpeg muxer file extension
        char fformat[BCSTRLEN];
-       char ff_audio_options[BCTEXTLEN];
        char ff_video_options[BCTEXTLEN];
-       int ff_audio_bitrate;
-       int ff_audio_quality;
-       int ff_video_bitrate;
-       int ff_video_quality;
+       char ff_pixel_format[BCSTRLEN];
+       int ff_video_bitrate, ff_video_quality;
+       char ff_audio_options[BCTEXTLEN];
+       char ff_sample_format[BCSTRLEN];
+       int ff_audio_bitrate, ff_audio_quality;
 
 // PNG video compression
        int png_use_alpha;
index 5fe6ab90baae8e4f811cbc6ad0f11d1fe3531d0e..3542a049d5f0be63886eb4654f36523bf33d1049 100644 (file)
@@ -47,14 +47,12 @@ int ConfirmSave::test_file(MWindow *mwindow, char *path)
 
 int ConfirmSave::test_files(MWindow *mwindow, ArrayList<char*> *paths)
 {
-       FILE *file;
        ArrayList<BC_ListBoxItem*> list;
        int result = 0;
 
        for(int i = 0; i < paths->size(); i++) {
                char *path = paths->values[i];
-               if( (file=fopen(path, "r")) != 0 ) {
-                       fclose(file);
+               if( !access(path, F_OK) ) {
                        list.append(new BC_ListBoxItem(path));
                }
        }
index 167ee479ae98252d0cf6b08342df22e4d43773bc..b0ba1c904be8f03b1543355c2d19305e0fa7fdd0 100644 (file)
 #include "asset.h"
 #include "bccmodels.h"
 #include "bchash.h"
-#include "fileffmpeg.h"
+#include "edl.h"
+#include "edlsession.h"
 #include "file.h"
+#include "fileffmpeg.h"
+#include "filesystem.h"
 #include "ffmpeg.h"
 #include "indexfile.h"
 #include "interlacemodes.h"
@@ -1384,6 +1387,37 @@ AVRational FFMPEG::to_time_base(int sample_rate)
        return (AVRational){1, sample_rate};
 }
 
+int FFMPEG::get_fmt_score(AVSampleFormat dst_fmt, AVSampleFormat src_fmt)
+{
+       int score = 0;
+       int dst_planar = av_sample_fmt_is_planar(dst_fmt);
+       int src_planar = av_sample_fmt_is_planar(src_fmt);
+       if( dst_planar != src_planar ) ++score;
+       int dst_bytes = av_get_bytes_per_sample(dst_fmt);
+       int src_bytes = av_get_bytes_per_sample(src_fmt);
+       score += (src_bytes > dst_bytes ? 100 : -10) * (src_bytes - dst_bytes);
+       int src_packed = av_get_packed_sample_fmt(src_fmt);
+       int dst_packed = av_get_packed_sample_fmt(dst_fmt);
+       if( dst_packed == AV_SAMPLE_FMT_S32 && src_packed == AV_SAMPLE_FMT_FLT ) score += 20;
+       if( dst_packed == AV_SAMPLE_FMT_FLT && src_packed == AV_SAMPLE_FMT_S32 ) score += 2;
+       return score;
+}
+
+AVSampleFormat FFMPEG::find_best_sample_fmt_of_list(
+               const AVSampleFormat *sample_fmts, AVSampleFormat src_fmt)
+{
+       AVSampleFormat best = AV_SAMPLE_FMT_NONE;
+       int best_score = get_fmt_score(best, src_fmt);
+       for( int i=0; sample_fmts[i] >= 0; ++i ) {
+               AVSampleFormat sample_fmt = sample_fmts[i];
+               int score = get_fmt_score(sample_fmt, src_fmt);
+               if( score >= best_score ) continue;
+               best = sample_fmt;  best_score = score;
+       }
+       return best;
+}
+
+
 void FFMPEG::set_option_path(char *path, const char *fmt, ...)
 {
        char *ep = path + BCTEXTLEN-1;
@@ -1480,10 +1514,10 @@ int FFMPEG::get_file_format()
        return ret;
 }
 
-int FFMPEG::scan_option_line(char *cp, char *tag, char *val)
+int FFMPEG::scan_option_line(const char *cp, char *tag, char *val)
 {
        while( *cp == ' ' || *cp == '\t' ) ++cp;
-       char *bp = cp;
+       const char *bp = cp;
        while( *cp && *cp != ' ' && *cp != '\t' && *cp != '=' && *cp != '\n' ) ++cp;
        int len = cp - bp;
        if( !len || len > BCSTRLEN-1 ) return 1;
@@ -1501,6 +1535,123 @@ int FFMPEG::scan_option_line(char *cp, char *tag, char *val)
        return 0;
 }
 
+int FFMPEG::can_render(const char *fformat, const char *type)
+{
+       FileSystem fs;
+       char option_path[BCTEXTLEN];
+       FFMPEG::set_option_path(option_path, type);
+       fs.update(option_path);
+       int total_files = fs.total_files();
+       for( int i=0; i<total_files; ++i ) {
+               const char *name = fs.get_entry(i)->get_name();
+               const char *ext = strrchr(name,'.');
+               if( !ext ) continue;
+               if( !strcmp(fformat, ++ext) ) return 1;
+       }
+       return 0;
+}
+
+int FFMPEG::get_ff_option(const char *nm, const char *options, char *value)
+{
+        for( const char *cp=options; *cp!=0; ) {
+                char line[BCTEXTLEN], *bp = line, *ep = bp+sizeof(line)-1;
+                while( bp < ep && *cp && *cp!='\n' ) *bp++ = *cp++;
+                if( *cp ) ++cp;
+                *bp = 0;
+                if( !line[0] || line[0] == '#' || line[0] == ';' ) continue;
+                char key[BCSTRLEN], val[BCTEXTLEN];
+                if( FFMPEG::scan_option_line(line, key, val) ) continue;
+                if( !strcmp(key, nm) ) {
+                        strncpy(value, val, BCSTRLEN);
+                        return 0;
+                }
+        }
+        return 1;
+}
+
+void FFMPEG::scan_audio_options(Asset *asset, EDL *edl)
+{
+       char cin_sample_fmt[BCSTRLEN];
+       int cin_fmt = AV_SAMPLE_FMT_NONE;
+       const char *options = asset->ff_audio_options;
+       if( !get_ff_option("cin_sample_fmt", options, cin_sample_fmt) )
+               cin_fmt = (int)av_get_sample_fmt(cin_sample_fmt);
+       if( cin_fmt < 0 ) {
+               char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
+               AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", asset->acodec) ?
+                       avcodec_find_encoder_by_name(audio_codec) : 0;
+               if( av_codec && av_codec->sample_fmts )
+                       cin_fmt = find_best_sample_fmt_of_list(av_codec->sample_fmts, AV_SAMPLE_FMT_FLT);
+       }
+       if( cin_fmt < 0 ) cin_fmt = AV_SAMPLE_FMT_S16;
+       const char *name = av_get_sample_fmt_name((AVSampleFormat)cin_fmt);
+       if( !name ) name = _("None");
+       strcpy(asset->ff_sample_format, name);
+
+       char value[BCSTRLEN];
+       if( !get_ff_option("cin_bitrate", options, value) )
+               asset->ff_audio_bitrate = atoi(value);
+       if( !get_ff_option("cin_quality", options, value) )
+               asset->ff_audio_quality = atoi(value);
+}
+
+void FFMPEG::load_audio_options(Asset *asset, EDL *edl)
+{
+       char options_path[BCTEXTLEN];
+       set_option_path(options_path, "audio/%s", asset->acodec);
+        if( !load_options(options_path,
+                       asset->ff_audio_options,
+                       sizeof(asset->ff_audio_options)) )
+               scan_audio_options(asset, edl);
+}
+
+void FFMPEG::scan_video_options(Asset *asset, EDL *edl)
+{
+       char cin_pix_fmt[BCSTRLEN];
+       int cin_fmt = AV_PIX_FMT_NONE;
+       const char *options = asset->ff_video_options;
+       if( !get_ff_option("cin_pix_fmt", options, cin_pix_fmt) )
+                       cin_fmt = (int)av_get_pix_fmt(cin_pix_fmt);
+       if( cin_fmt < 0 ) {
+               char video_codec[BCSTRLEN];  video_codec[0] = 0;
+               AVCodec *av_codec = !get_codec(video_codec, "video", asset->vcodec) ?
+                       avcodec_find_encoder_by_name(video_codec) : 0;
+               if( av_codec && av_codec->pix_fmts ) {
+                       if( edl ) {
+                               int color_model = edl->session->color_model;
+                               int max_bits = BC_CModels::calculate_pixelsize(color_model) * 8;
+                               max_bits /= BC_CModels::components(color_model);
+                               cin_fmt = avcodec_find_best_pix_fmt_of_list(av_codec->pix_fmts,
+                                       (BC_CModels::is_yuv(color_model) ?
+                                               (max_bits > 8 ? AV_PIX_FMT_AYUV64LE : AV_PIX_FMT_YUV444P) :
+                                               (max_bits > 8 ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB24)), 0, 0);
+                       }
+                       else
+                               cin_fmt = av_codec->pix_fmts[0];
+               }
+       }
+       if( cin_fmt < 0 ) cin_fmt = AV_PIX_FMT_YUV420P;
+       const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get((AVPixelFormat)cin_fmt);
+       const char *name = desc ? desc->name : _("None");
+       strcpy(asset->ff_pixel_format, name);
+
+       char value[BCSTRLEN];
+       if( !get_ff_option("cin_bitrate", options, value) )
+               asset->ff_video_bitrate = atoi(value);
+       if( !get_ff_option("cin_quality", options, value) )
+               asset->ff_video_quality = atoi(value);
+}
+
+void FFMPEG::load_video_options(Asset *asset, EDL *edl)
+{
+       char options_path[BCTEXTLEN];
+       set_option_path(options_path, "video/%s", asset->vcodec);
+        if( !load_options(options_path,
+                       asset->ff_video_options,
+                       sizeof(asset->ff_video_options)) )
+               scan_video_options(asset, edl);
+}
+
 int FFMPEG::load_defaults(const char *path, const char *type,
                 char *codec, char *codec_options, int len)
 {
@@ -1521,18 +1672,24 @@ int FFMPEG::load_defaults(const char *path, const char *type,
        return load_options(default_file, codec_options, len);
 }
 
-void FFMPEG::set_asset_format(Asset *asset, const char *text)
+void FFMPEG::set_asset_format(Asset *asset, EDL *edl, const char *text)
 {
        if( asset->format != FILE_FFMPEG ) return;
        if( text != asset->fformat )
                strcpy(asset->fformat, text);
-       if( !asset->ff_audio_options[0] ) {
-               asset->audio_data = !load_defaults("audio", text, asset->acodec,
-                       asset->ff_audio_options, sizeof(asset->ff_audio_options));
+       if( asset->audio_data && !asset->ff_audio_options[0] ) {
+               if( !load_defaults("audio", text, asset->acodec,
+                               asset->ff_audio_options, sizeof(asset->ff_audio_options)) )
+                       scan_audio_options(asset, edl);
+               else
+                       asset->audio_data = 0;
        }
-       if( !asset->ff_video_options[0] ) {
-               asset->video_data = !load_defaults("video", text, asset->vcodec,
-                       asset->ff_video_options, sizeof(asset->ff_video_options));
+       if( asset->video_data && !asset->ff_video_options[0] ) {
+               if( !load_defaults("video", text, asset->vcodec,
+                               asset->ff_video_options, sizeof(asset->ff_video_options)) )
+                       scan_video_options(asset, edl);
+               else
+                       asset->video_data = 0;
        }
 }
 
@@ -1544,19 +1701,18 @@ int FFMPEG::get_encoder(const char *options,
                eprintf(_("options open failed %s\n"),options);
                return 1;
        }
-       if( get_encoder(fp, format, codec, bsfilter) )
+       char line[BCTEXTLEN];
+       if( !fgets(line, sizeof(line), fp) ||
+           scan_encoder(line, format, codec, bsfilter) )
                eprintf(_("format/codec not found %s\n"), options);
        fclose(fp);
        return 0;
 }
 
-int FFMPEG::get_encoder(FILE *fp,
+int FFMPEG::scan_encoder(const char *line,
                char *format, char *codec, char *bsfilter)
 {
        format[0] = codec[0] = bsfilter[0] = 0;
-       char line[BCTEXTLEN];
-       if( !fgets(line, sizeof(line), fp) ) return 1;
-       line[sizeof(line)-1] = 0;
        if( scan_option_line(line, format, codec) ) return 1;
        char *cp = codec;
        while( *cp && *cp != '|' ) ++cp;
@@ -1890,14 +2046,18 @@ int FFMPEG::open_decoder()
 
 int FFMPEG::init_encoder(const char *filename)
 {
-       int fd = ::open(filename,O_WRONLY);
-       if( fd < 0 ) fd = open(filename,O_WRONLY+O_CREAT,0666);
-       if( fd < 0 ) {
+// try access first for named pipes
+       int ret = access(filename, W_OK);
+       if( ret ) {
+               int fd = ::open(filename,O_WRONLY);
+               if( fd < 0 ) fd = open(filename,O_WRONLY+O_CREAT,0666);
+               if( fd >= 0 ) { close(fd);  ret = 0; }
+       }
+       if( ret ) {
                eprintf(_("bad file path: %s\n"), filename);
                return 1;
        }
-       ::close(fd);
-       int ret = get_file_format();
+       ret = get_file_format();
        if( ret > 0 ) {
                eprintf(_("bad file format: %s\n"), filename);
                return 1;
@@ -2021,7 +2181,10 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                                break;
                        }
                        ctx->time_base = st->time_base = (AVRational){1, aud->sample_rate};
-                       ctx->sample_fmt = codec->sample_fmts[0];
+                       AVSampleFormat sample_fmt = av_get_sample_fmt(asset->ff_sample_format);
+                       if( sample_fmt == AV_SAMPLE_FMT_NONE )
+                               sample_fmt = codec->sample_fmts ? codec->sample_fmts[0] : AV_SAMPLE_FMT_S16;
+                       ctx->sample_fmt = sample_fmt;
                        uint64_t layout = av_get_default_channel_layout(ctx->channels);
                        aud->resample_context = swr_alloc_set_opts(NULL,
                                layout, ctx->sample_fmt, aud->sample_rate,
@@ -2070,18 +2233,10 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
                        vid->width = asset->width;
                        vid->height = asset->height;
                        vid->frame_rate = asset->frame_rate;
-                       AVPixelFormat pix_fmt = codec->pix_fmts ?
-                               codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
-                       AVDictionaryEntry *tag = av_dict_get(sopts, "cin_pix_fmt", NULL, 0);
-                       if( tag != 0 ) {
-                               int avfmt = av_get_pix_fmt(tag->value);
-                               if( avfmt < 0 ) {
-                                       eprintf(_("cin_pix_fmt unknown = %s\n"), tag->value);
-                                       ret = 1;
-                                       break;
-                               }
-                               pix_fmt = (AVPixelFormat)avfmt;
-                       }
+
+                       AVPixelFormat pix_fmt = av_get_pix_fmt(asset->ff_pixel_format);
+                       if( pix_fmt == AV_PIX_FMT_NONE )
+                               pix_fmt = codec->pix_fmts ? codec->pix_fmts[0] : AV_PIX_FMT_YUV420P;
                        ctx->pix_fmt = pix_fmt;
                        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
                        int mask_w = (1<<desc->log2_chroma_w)-1;
index 1119479288427506d4928ae5ea1c6d80a29ff144..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"
@@ -254,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);
index 67b731de35a23af6c0e255b8de0ad0fad8fae56c..264be2e8ff0c7d44efa338e4647f06c4c3c01d06 100644 (file)
@@ -165,24 +165,19 @@ int File::get_options(FormatTools *format,
        int audio_options, int video_options)
 {
        BC_WindowBase *parent_window = format->window;
-       //ArrayList<PluginServer*> *plugindb = format->plugindb;
        Asset *asset = format->asset;
-
+       EDL *edl = format->mwindow ? format->mwindow->edl : 0;
        format_window = 0;
        getting_options = 1;
        format_completion->lock("File::get_options");
        switch( asset->format ) {
-       case FILE_AC3:
-               FileAC3::get_parameters(parent_window,
-                       asset,
-                       format_window,
-                       audio_options,
-                       video_options);
+       case FILE_AC3: FileAC3::get_parameters(parent_window, asset, format_window,
+                       audio_options, video_options, edl);
                break;
 #ifdef HAVE_DV
        case FILE_RAWDV:
                FileDV::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
 #endif
        case FILE_PCM:
@@ -191,56 +186,56 @@ int File::get_options(FormatTools *format,
        case FILE_AIFF:
        case FILE_SND:
                FileSndFile::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_FFMPEG:
                FileFFMPEG::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_AMPEG:
        case FILE_VMPEG:
                FileMPEG::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_JPEG:
        case FILE_JPEG_LIST:
                FileJPEG::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
 #ifdef HAVE_OPENEXR
        case FILE_EXR:
        case FILE_EXR_LIST:
                FileEXR::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
 #endif
        case FILE_FLAC:
                FileFLAC::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_PNG:
        case FILE_PNG_LIST:
                FilePNG::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_PPM:
        case FILE_PPM_LIST:
                FilePPM::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_TGA:
        case FILE_TGA_LIST:
                FileTGA::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_TIFF:
        case FILE_TIFF_LIST:
                FileTIFF::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        case FILE_OGG:
                FileOGG::get_parameters(parent_window, asset, format_window,
-                       audio_options, video_options);
+                       audio_options, video_options, edl);
                break;
        default:
                break;
@@ -1430,7 +1425,7 @@ int File::renders_video(int format)
 int File::renders_video(Asset *asset)
 {
        return asset->format == FILE_FFMPEG ?
-               FileFFMPEG::renders_video(asset->fformat) :
+               FFMPEG::renders_video(asset->fformat) :
                renders_video(asset->format);
 }
 
@@ -1456,7 +1451,7 @@ int File::renders_audio(int format)
 int File::renders_audio(Asset *asset)
 {
        return asset->format == FILE_FFMPEG ?
-               FileFFMPEG::renders_audio(asset->fformat) :
+               FFMPEG::renders_audio(asset->fformat) :
                renders_audio(asset->format);
 }
 
index cc3cafae40ddf2418049274c4550ee451c6bb7ea..c573e38797ab5fb654b6e632fd64f8795abfcda1 100644 (file)
@@ -76,10 +76,8 @@ int FileAC3::reset_parameters_derived()
 }
 
 void FileAC3::get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options)
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index 9304a80f4303f6c5bf2e360b0031b1fd595ff1df..6683816b9e10a711a6829d13a96f5defeef353e3 100644 (file)
@@ -30,6 +30,7 @@ extern "C" {
 #include "libswresample/swresample.h"
 };
 
+#include "edl.inc"
 #include "filebase.h"
 #include "filempeg.inc"
 #include "indexfile.inc"
@@ -45,10 +46,8 @@ public:
 
        int reset_parameters_derived();
        static void get_parameters(BC_WindowBase *parent_window,
-                       Asset *asset,
-                       BC_WindowBase* &format_window,
-                       int audio_options,
-                       int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        static int check_sig();
        int open_file(int rd, int wr);
        int close_file();
index 5e8d291e747b3105a1f289847409e18a658c2112..3fb8be42087ac8195bc442357355cbaeeb2e35c7 100644 (file)
@@ -26,6 +26,7 @@
 #include "assets.inc"
 #include "bccmodels.h"
 #include "edit.inc"
+#include "edl.inc"
 #include "ffmpeg.inc"
 #include "guicast.h"
 #include "file.inc"
@@ -54,23 +55,9 @@ public:
        friend class FileList;
        friend class FrameWriter;
 
-
-
-
        void get_mode(char *mode, int rd, int wr);
        void reset_parameters();
 
-
-
-       virtual void get_parameters(BC_WindowBase *parent_window,
-                       Asset *asset,
-                       BC_WindowBase **format_window,
-                       int audio_options,
-                       int video_options,
-                       int lock_compressor) {};
-
-
-
        virtual int get_index(IndexFile *index_file, MainProgressBar *progress_bar) { return -1; }
        virtual int check_header() { return 0; }  // Test file to see if it is of this type.
        virtual int reset_parameters_derived() { return 0; }
index 1d22bc3d4edcebc10139825790171dd087ec0be8..1a543744898764cafc96c57b365e8420b60f27ba 100644 (file)
@@ -102,10 +102,8 @@ FileDV::~FileDV()
 }
 
 void FileDV::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index d0db5b5403e6dba18dad3544fa4365a3fa80abf6..843b59b83ebf2657fcfbac2d3df9381652b9fa25 100644 (file)
@@ -25,6 +25,7 @@
 #ifdef HAVE_DV
 
 #include "../config.h"
+#include "edl.inc"
 #include "filebase.h"
 #include "file.inc"
 
@@ -42,10 +43,8 @@ public:
        ~FileDV();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        int reset_parameters_derived();
        int open_file(int rd, int wr);
index 33b1bdd2a9b11f16463deea64c6fa6b65c3e382b..351da2a3acd4dacf4da3c5f591fe2fc89c610d58 100644 (file)
@@ -244,10 +244,8 @@ int FileEXR::check_sig(Asset *asset, char *test)
 }
 
 void FileEXR::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index d4cea0478ebab5d287f44e9c4023495569366592..3e474891d0f406c770d386837f7a9c657b67c242 100644 (file)
@@ -23,6 +23,7 @@
 #define FILEEXR_H
 
 
+#include "edl.inc"
 #include "file.inc"
 #include "fileexr.inc"
 #include "filelist.h"
@@ -36,10 +37,8 @@ public:
 
        static int check_sig(Asset *asset, char *test);
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        static int get_best_colormodel(Asset *asset, int driver);
        int colormodel_supported(int colormodel);
        int read_frame_header(char *path);
index cc8a5371b7c9749e2fb9d69be23ad05beab082f2..10f685c12769f3b4edcbbe675ab6ac700d20fa24 100644 (file)
@@ -11,6 +11,7 @@
 #include "bcwindowbase.h"
 #include "bitspopup.h"
 #include "ctype.h"
+#include "edl.h"
 #include "ffmpeg.h"
 #include "filebase.h"
 #include "file.h"
@@ -25,7 +26,7 @@
 #include "videodevice.inc"
 
 FileFFMPEG::FileFFMPEG(Asset *asset, File *file)
 : FileBase(asset, file)
+ : FileBase(asset, file)
 {
        ff = 0;
        if(asset->format == FILE_UNKNOWN)
@@ -60,8 +61,8 @@ void FFMpegConfigNum::create_objects()
 
 int FFMpegConfigNum::update_param(const char *param, const char *opts)
 {
-       char value[BCTEXTLEN];
-       if( !FileFFMPEG::get_ff_option(param, opts, value) ) {
+       char value[BCSTRLEN];
+       if( !FFMPEG::get_ff_option(param, opts, value) ) {
                if( (*output = atoi(value)) < 0 ) {
                        disable(1);
                        return 0;
@@ -134,7 +135,69 @@ int FFMpegVideoQuality::handle_event()
        return ret;
 }
 
-void FileFFMPEG::set_parameters(char *cp, int len, const char *bp)
+FFMpegPixelFormat::FFMpegPixelFormat(FFMPEGConfigVideo *vid_config,
+       int x, int y, int w, int list_h)
+ : BC_PopupTextBox(vid_config, 0, 0, x, y, w, list_h)
+{
+       this->vid_config = vid_config;
+}
+
+int FFMpegPixelFormat::handle_event()
+{
+       strncpy(vid_config->asset->ff_pixel_format, get_text(),
+               sizeof(vid_config->asset->ff_pixel_format));
+       return 1;
+}
+
+void FFMpegPixelFormat::update_formats()
+{
+       pixfmts.remove_all_objects();
+       char video_codec[BCSTRLEN]; video_codec[0] = 0;
+       const char *vcodec = vid_config->asset->vcodec;
+       AVCodec *av_codec = !FFMPEG::get_codec(video_codec, "video", vcodec) ?
+               avcodec_find_encoder_by_name(video_codec) : 0;
+       const AVPixelFormat *pix_fmts = av_codec ? av_codec->pix_fmts : 0;
+       if( pix_fmts ) {
+               for( int i=0; pix_fmts[i]>=0; ++i ) {
+                       const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmts[i]);
+                       if( desc ) pixfmts.append(new BC_ListBoxItem(desc->name));
+               }
+       }
+       update_list(&pixfmts);
+}
+
+FFMpegSampleFormat::FFMpegSampleFormat(FFMPEGConfigAudio *aud_config,
+       int x, int y, int w, int list_h)
+ : BC_PopupTextBox(aud_config, 0, 0, x, y, w, list_h)
+{
+       this->aud_config = aud_config;
+}
+
+int FFMpegSampleFormat::handle_event()
+{
+       strncpy(aud_config->asset->ff_sample_format, get_text(),
+               sizeof(aud_config->asset->ff_sample_format));
+       return 1;
+}
+
+void FFMpegSampleFormat::update_formats()
+{
+       samplefmts.remove_all_objects();
+       char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
+       const char *acodec = aud_config->asset->acodec;
+       AVCodec *av_codec = !FFMPEG::get_codec(audio_codec, "audio", acodec) ?
+               avcodec_find_encoder_by_name(audio_codec) : 0;
+       const AVSampleFormat *sample_fmts = av_codec ? av_codec->sample_fmts : 0;
+       if( sample_fmts ) {
+               for( int i=0; sample_fmts[i]>=0; ++i ) {
+                       const char *name = av_get_sample_fmt_name(sample_fmts[i]);
+                       if( name ) samplefmts.append(new BC_ListBoxItem(name));
+               }
+       }
+       update_list(&samplefmts);
+}
+
+void FileFFMPEG::set_options(char *cp, int len, const char *bp)
 {
        char *ep = cp + len-2, ch = 0;
        while( cp < ep && *bp != 0 ) { ch = *bp++; *cp++ = ch; }
@@ -144,26 +207,35 @@ void FileFFMPEG::set_parameters(char *cp, int len, const char *bp)
 
 void FileFFMPEG::get_parameters(BC_WindowBase *parent_window,
                Asset *asset, BC_WindowBase *&format_window,
-               int audio_options, int video_options)
+               int audio_options, int video_options, EDL *edl)
 {
-       if(audio_options) {
-               FFMPEGConfigAudio *window = new FFMPEGConfigAudio(parent_window, asset);
+       Asset *ff_asset = new Asset();
+       ff_asset->copy_from(asset, 0);
+       if( audio_options ) {
+               FFMPEGConfigAudio *window = new FFMPEGConfigAudio(parent_window, ff_asset, edl);
                format_window = window;
                window->create_objects();
-               if( !window->run_window() )
-                       set_parameters(asset->ff_audio_options, sizeof(asset->ff_audio_options),
-                                window->audio_options->get_text());
+               if( !window->run_window() ) {
+                       asset->copy_from(ff_asset,0);
+                       set_options(asset->ff_audio_options,
+                               sizeof(asset->ff_audio_options),
+                               window->audio_options->get_text());
+               }
                delete window;
        }
-       else if(video_options) {
-               FFMPEGConfigVideo *window = new FFMPEGConfigVideo(parent_window, asset);
+       else if( video_options ) {
+               FFMPEGConfigVideo *window = new FFMPEGConfigVideo(parent_window, ff_asset, edl);
                format_window = window;
                window->create_objects();
-               if( !window->run_window() )
-                       set_parameters(asset->ff_video_options, sizeof(asset->ff_video_options),
-                                window->video_options->get_text());
+               if( !window->run_window() ) {
+                       asset->copy_from(ff_asset,0);
+                       set_options(asset->ff_video_options,
+                               sizeof(asset->ff_video_options),
+                               window->video_options->get_text());
+               }
                delete window;
        }
+       ff_asset->remove_user();
 }
 
 int FileFFMPEG::check_sig(Asset *asset)
@@ -379,43 +451,9 @@ int FileFFMPEG::get_best_colormodel(Asset *asset, int driver)
        return BC_YUV420P;
 }
 
-int FileFFMPEG::can_render(const char *fformat, const char *type)
-{
-       FileSystem fs;
-       char option_path[BCTEXTLEN];
-       FFMPEG::set_option_path(option_path, type);
-       fs.update(option_path);
-       int total_files = fs.total_files();
-       for( int i=0; i<total_files; ++i ) {
-               const char *name = fs.get_entry(i)->get_name();
-               const char *ext = strrchr(name,'.');
-               if( !ext ) continue;
-               if( !strcmp(fformat, ++ext) ) return 1;
-       }
-       return 0;
-}
-
-int FileFFMPEG::get_ff_option(const char *nm, const char *options, char *value)
-{
-       for( const char *cp=options; *cp!=0; ) {
-               char line[BCTEXTLEN], *bp = line, *ep = bp+sizeof(line)-1;
-               while( bp < ep && *cp && *cp!='\n' ) *bp++ = *cp++;
-               if( *cp ) ++cp;
-               *bp = 0;
-               if( !line[0] || line[0] == '#' || line[0] == ';' ) continue;
-               char key[BCSTRLEN], val[BCTEXTLEN];
-               if( FFMPEG::scan_option_line(line, key, val) ) continue;
-               if( !strcmp(key, nm) ) {
-                       strcpy(value, val);
-                       return 0;
-               }
-       }
-       return 1;
-}
-
 //======
 
-FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
+FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset, EDL *edl)
  : BC_Window(_(PROGRAM_NAME ": Audio Preset"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
@@ -423,6 +461,7 @@ FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
 {
        this->parent_window = parent_window;
        this->asset = asset;
+       this->edl = edl;
        preset_popup = 0;
 
        bitrate = 0;
@@ -439,6 +478,11 @@ FFMPEGConfigAudio::~FFMPEGConfigAudio()
        unlock_window();
 }
 
+void FFMPEGConfigAudio::load_options()
+{
+       FFMPEG::load_audio_options(asset, edl);
+}
+
 void FFMPEGConfigAudio::create_objects()
 {
        int x = 10, y = 10;
@@ -483,8 +527,20 @@ void FFMPEGConfigAudio::create_objects()
        quality->create_objects();
        quality->set_increment(1);
        quality->set_boundaries((int64_t)-1, (int64_t)51);
-
        y += quality->get_h() + 10;
+
+       add_subwindow(new BC_Title(x, y, _("Samples:")));
+       sample_format = new FFMpegSampleFormat(this, x+90, y, 100, 120);
+       sample_format->create_objects();
+       if( asset->acodec[0] ) {
+               sample_format->update_formats();
+               if( !asset->ff_audio_options[0] )
+                       load_options();
+       }
+       if( !asset->ff_sample_format[0] ) strcpy(asset->ff_sample_format, _("None"));
+       sample_format->update(asset->ff_sample_format);
+       y += sample_format->get_h() + 10;
+
        BC_Title *title = new BC_Title(x, y, _("Audio Options:"));
        add_subwindow(title);
 
@@ -493,13 +549,7 @@ void FFMPEGConfigAudio::create_objects()
        add_subwindow(new FFOptionsViewAudio(this, x1, y, _("view")));
 
        y += 25;
-       if( !asset->ff_audio_options[0] && asset->acodec[0] ) {
-               FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-               FFMPEG::load_options(option_path, asset->ff_audio_options,
-                        sizeof(asset->ff_audio_options));
-       }
-
-       audio_options = new FFAudioOptions(this, x, y, get_w()-x-20, 10,
+       audio_options = new FFAudioOptions(this, x, y, get_w()-x-20, 8,
                 sizeof(asset->ff_audio_options)-1, asset->ff_audio_options);
        audio_options->create_objects();
        add_subwindow(new BC_OKButton(this));
@@ -538,17 +588,16 @@ FFMPEGConfigAudioPopup::FFMPEGConfigAudioPopup(FFMPEGConfigAudio *popup, int x,
 int FFMPEGConfigAudioPopup::handle_event()
 {
        strcpy(popup->asset->acodec, get_text());
+       popup->sample_format->update_formats();
        Asset *asset = popup->asset;
-       asset->ff_audio_bitrate = 0;
-       char option_path[BCTEXTLEN];
-       FFMPEG::set_option_path(option_path, "audio/%s", asset->acodec);
-       FFMPEG::load_options(option_path, asset->ff_audio_options,
-                        sizeof(asset->ff_audio_options));
+       asset->ff_audio_bitrate = 0;  asset->ff_audio_quality = -1;
+       popup->load_options();
        popup->audio_options->update(asset->ff_audio_options);
        popup->audio_options->set_text_row(0);
 
        popup->bitrate->update_param("cin_bitrate", asset->ff_audio_options);
        popup->quality->update_param("cin_quality", asset->ff_audio_options);
+       popup->sample_format->update(asset->ff_sample_format);
        return 1;
 }
 
@@ -568,7 +617,7 @@ int FFMPEGConfigAudioToggle::handle_event()
 
 //======
 
-FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
+FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset, EDL *edl)
  : BC_Window(_(PROGRAM_NAME ": Video Preset"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
@@ -576,6 +625,7 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset)
 {
        this->parent_window = parent_window;
        this->asset = asset;
+       this->edl = edl;
        preset_popup = 0;
 
        bitrate = 0;
@@ -592,6 +642,11 @@ FFMPEGConfigVideo::~FFMPEGConfigVideo()
        unlock_window();
 }
 
+void FFMPEGConfigVideo::load_options()
+{
+       FFMPEG::load_video_options(asset, edl);
+}
+
 void FFMPEGConfigVideo::create_objects()
 {
        int x = 10, y = 10;
@@ -641,8 +696,20 @@ void FFMPEGConfigVideo::create_objects()
        quality->create_objects();
        quality->set_increment(1);
        quality->set_boundaries((int64_t)-1, (int64_t)51);
-
        y += quality->get_h() + 10;
+
+       add_subwindow(new BC_Title(x, y, _("Pixels:")));
+       pixel_format = new FFMpegPixelFormat(this, x+90, y, 100, 120);
+       pixel_format->create_objects();
+       if( asset->vcodec[0] ) {
+               pixel_format->update_formats();
+               if( !asset->ff_video_options[0] )
+                       load_options();
+       }
+       if( !asset->ff_pixel_format[0] ) strcpy(asset->ff_pixel_format, _("None"));
+       pixel_format->update(asset->ff_pixel_format);
+       y += pixel_format->get_h() + 10;
+
        BC_Title *title = new BC_Title(x, y, _("Video Options:"));
        add_subwindow(title);
 
@@ -651,13 +718,7 @@ void FFMPEGConfigVideo::create_objects()
        add_subwindow(new FFOptionsViewVideo(this, x1, y, _("view")));
 
        y += 25;
-       if( !asset->ff_video_options[0] && asset->vcodec[0] ) {
-               FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-               FFMPEG::load_options(option_path, asset->ff_video_options,
-                        sizeof(asset->ff_video_options));
-       }
-
-       video_options = new FFVideoOptions(this, x, y, get_w()-x-20, 10,
+       video_options = new FFVideoOptions(this, x, y, get_w()-x-20, 8,
                 sizeof(asset->ff_video_options)-1, asset->ff_video_options);
        video_options->create_objects();
        add_subwindow(new BC_OKButton(this));
@@ -695,17 +756,16 @@ FFMPEGConfigVideoPopup::FFMPEGConfigVideoPopup(FFMPEGConfigVideo *popup, int x,
 int FFMPEGConfigVideoPopup::handle_event()
 {
        strcpy(popup->asset->vcodec, get_text());
+       popup->pixel_format->update_formats();
        Asset *asset = popup->asset;
-       char option_path[BCTEXTLEN];
        asset->ff_video_bitrate = 0;  asset->ff_video_quality = -1;
-       FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
-       FFMPEG::load_options(option_path, asset->ff_video_options,
-                        sizeof(asset->ff_video_options));
+       popup->load_options();
        popup->video_options->update(asset->ff_video_options);
        popup->video_options->set_text_row(0);
 
        popup->bitrate->update_param("cin_bitrate", asset->ff_video_options);
        popup->quality->update_param("cin_quality", asset->ff_video_options);
+       popup->pixel_format->update(asset->ff_pixel_format);
        return 1;
 }
 
@@ -900,16 +960,16 @@ char *FFOptions_Opt::get(char *vp, int sz)
        void *obj = (void *)options->obj;
        uint8_t *bp = 0;
        if( av_opt_get(obj, opt->name, 0, &bp) >= 0 && bp != 0 ) {
-                const char *val = (const char *)bp;
+       const char *val = (const char *)bp;
                if( opt->unit && *val ) {
                        int id = atoi(val);
                        const char *uid = unit_name(id);
                        if( uid ) val = uid;
                }
-                cp = sz >= 0 ? strncpy(vp,val,sz) : strcpy(vp, val);
-                if( sz > 0 ) vp[sz-1] = 0;
-                av_freep(&bp);
-        }
+               cp = sz >= 0 ? strncpy(vp,val,sz) : strcpy(vp, val);
+               if( sz > 0 ) vp[sz-1] = 0;
+               av_freep(&bp);
+       }
 
        return cp;
 }
index d3e22dd355bb5f2bb296f5769055841dcc755474..e3a9196c5ebcd3d924aa5db14f3bfd72415c1664 100644 (file)
@@ -5,6 +5,7 @@
 #include "bcdialog.h"
 #include "bcwindowbase.inc"
 #include "bitspopup.inc"
+#include "edl.inc"
 #include "ffmpeg.h"
 #include "filebase.h"
 #include "fileffmpeg.inc"
@@ -31,19 +32,16 @@ public:
        static void ff_lock(const char *cp=0);
        static void ff_unlock();
 
-       static void set_parameters(char *cp, int len, const char *bp);
-       static void get_parameters(BC_WindowBase *parent_window,Asset *asset,
-          BC_WindowBase *&format_window,int audio_options,int video_options);
+       static void set_options(char *cp, int len, const char *bp);
+       static void get_parameters(BC_WindowBase *parent_window,
+               Asset *asset, BC_WindowBase *&format_window,
+               int audio_options,int video_options, EDL *edl);
        static int check_sig(Asset *asset);
        int get_best_colormodel(int driver, int vstream);
        int get_video_info(int track, int &pid, double &framerate,
                int &width, int &height, char *title=0);
        int get_audio_for_video(int vstream, int astream, int64_t &channel_mask);
        static void get_info(char *path,char *text,int len);
-       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);
        int open_file(int rd,int wr);
        int get_index(IndexFile *index_file, MainProgressBar *progress_bar);
        int close_file(void);
@@ -126,15 +124,41 @@ public:
        int handle_event();
 };
 
+class FFMpegPixelFormat : public BC_PopupTextBox
+{
+public:
+       FFMpegPixelFormat(FFMPEGConfigVideo *vid_config, int x, int y, int w, int list_h);
+
+        FFMPEGConfigVideo *vid_config;
+       ArrayList<BC_ListBoxItem*> pixfmts;
+
+       int handle_event();
+       void update_formats();
+};
+
+class FFMpegSampleFormat : public BC_PopupTextBox
+{
+public:
+       FFMpegSampleFormat(FFMPEGConfigAudio *aud_config, int x, int y, int w, int list_h);
+
+        FFMPEGConfigAudio *aud_config;
+       ArrayList<BC_ListBoxItem*> samplefmts;
+
+       int handle_event();
+       void update_formats();
+};
+
 class FFMPEGConfigAudio : public BC_Window
 {
 public:
-       FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset);
+       FFMPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset, EDL *edl);
        ~FFMPEGConfigAudio();
 
        void create_objects();
        int close_event();
+       void load_options();
 
+       FFMpegSampleFormat *sample_format;
        ArrayList<BC_ListBoxItem*> presets;
        FFMPEGConfigAudioPopup *preset_popup;
        FFMpegAudioBitrate *bitrate;
@@ -142,6 +166,7 @@ public:
        FFAudioOptions *audio_options;
        BC_WindowBase *parent_window;
        Asset *asset;
+       EDL *edl;
        FFOptionsDialog *ff_options_dialog;
 };
 
@@ -177,12 +202,14 @@ public:
 class FFMPEGConfigVideo : public BC_Window
 {
 public:
-       FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset);
+       FFMPEGConfigVideo(BC_WindowBase *parent_window, Asset *asset, EDL *edl);
        ~FFMPEGConfigVideo();
 
        void create_objects();
        int close_event();
+       void load_options();
 
+       FFMpegPixelFormat *pixel_format;
        ArrayList<BC_ListBoxItem*> presets;
        FFMPEGConfigVideoPopup *preset_popup;
        BC_WindowBase *parent_window;
@@ -190,6 +217,7 @@ public:
        FFMpegVideoQuality *quality;
        FFVideoOptions *video_options;
        Asset *asset;
+       EDL *edl;
        FFOptionsDialog *ff_options_dialog;
 };
 
index 842fcb4b066deb370f6696267a65aec5b0586e30..96fdb8bde56908e365e196f82d3794a25327dd7f 100644 (file)
@@ -55,10 +55,8 @@ FileFLAC::~FileFLAC()
 }
 
 void FileFLAC::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index 70408792275b97784aaeccd4fba7861cef701daf..e85b64cf84fa57b3efe912619519c768e2387c3e 100644 (file)
 #define FILEFLAC_H
 
 #include "bitspopup.inc"
+#include "edl.inc"
 #include "file.inc"
 #include "filebase.h"
 
-
-
-
-
-
 class FileFLAC : public FileBase
 {
 public:
@@ -38,10 +34,8 @@ public:
        ~FileFLAC();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        int reset_parameters_derived();
 
        static int check_sig(Asset *asset, char *test);
index 3abfa99fad9515309f4a7a67990da2bd8ba12bd2..8c5687cc4f5badc79b6f25bc47e4c815d38c37ab 100644 (file)
@@ -75,10 +75,8 @@ int FileJPEG::check_sig(Asset *asset)
 
 
 void FileJPEG::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index b7c77ea0905a063412710fd68da4804a2d5ebca2..21846cf42ed282ec50615686bfac7c227b5296bc 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef FILEJPEG_H
 #define FILEJPEG_H
 
+#include "edl.inc"
 #include "file.inc"
 #include "filelist.h"
 #include "vframe.inc"
@@ -35,10 +36,8 @@ public:
 // basic commands for every file interpreter
        static int check_sig(Asset *asset);
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        static int get_best_colormodel(Asset *asset, int driver);
        int colormodel_supported(int colormodel);
index 891bead66b638eac0e0e322f4884c24992960f6e..b7755996a768f105abad469c84cd7345a19cf18e 100644 (file)
@@ -55,10 +55,8 @@ char* FileJPEGList::extension()
 }
 
 void FileJPEGList::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index db446abdbcce99ae893836b030fcf6c299786ad0..9b1a9d8e0a1e23d955ebb71f9a8c8d68ca458080 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef FILEJPEGLIST_H
 #define FILEJPEGLIST_H
 
+#include "edl.inc"
 #include "file.inc"
 #include "filebase.h"
 #include "filelist.h"
@@ -36,10 +37,8 @@ public:
 
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        int get_best_colormodel(int driver, int colormodel);
        int read_frame(VFrame *frame, VFrame *data);
index 9913a98b93a3c91c3ddb11c61944ab99fac2e5ad..9988673fe1215cfe1d41a9f64f2a2d8990205509 100644 (file)
@@ -105,10 +105,8 @@ FileMPEG::~FileMPEG()
 }
 
 void FileMPEG::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options && asset->format == FILE_AMPEG)
        {
index 9b8db9dd15ddad4f045a1a167f0926a649425d3a..a92f29b7f953b00b17bbd164fbed76d23175a389 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "bitspopup.inc"
 #include "condition.inc"
+#include "edl.inc"
 #include "file.inc"
 #include "filebase.h"
 #include "indexfile.inc"
@@ -63,10 +64,8 @@ public:
        friend class FileMPEGVideo;
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        static int check_sig(Asset *asset);
 
index a0fc9b18e01f3c617fedc91303610db681d9824a..b413066d200db285eca71ff11b3d6205e967e779 100644 (file)
@@ -100,10 +100,8 @@ FileOGG::~FileOGG()
 }
 
 void FileOGG::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index 01d9ef6ab4f56dc1a1a3a823d0ffe2c0dfe8b4f4..1538281bc2de4075d761830b75ec561ba1388f84 100644 (file)
@@ -23,6 +23,7 @@
 #define FILEOGG_H
 
 #include "../config.h"
+#include "edl.inc"
 #include "filebase.h"
 #include "file.inc"
 #include "packagingengine.h"
@@ -103,10 +104,8 @@ public:
        ~FileOGG();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        int reset_parameters_derived();
        int open_file(int rd, int wr);
index d6fd37966e7751d95d714eeb3e0982ff21a458c6..68ce488cc128f57dc40174dd94232417806fe364 100644 (file)
@@ -77,10 +77,8 @@ int FilePNG::check_sig(Asset *asset)
 
 
 void FilePNG::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index 859514443ef72cd6947407bdfd862dc500dc2b2d..2263bc381a8a526ad77eb700fe6f15dff4ce19b2 100644 (file)
@@ -23,6 +23,7 @@
 #define FILEPNG_H
 
 
+#include "edl.inc"
 #include "file.inc"
 #include "filebase.h"
 #include "filelist.h"
@@ -36,10 +37,8 @@ public:
 
        static int check_sig(Asset *asset);
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        static int get_best_colormodel(Asset *asset, int driver);
        int colormodel_supported(int colormodel);
        int read_frame(VFrame *frame, VFrame *data);
index ac991aa41f80789264d9ee0625ebeed848a46f2e..f8dc04153f40dcdd5c7fd8183b0108e9729abf29 100644 (file)
@@ -207,8 +207,9 @@ PPMConfigVideo::PPMConfigVideo(BC_WindowBase *gui, Asset *asset)
        unlock_window();
 }
 
-void FilePPM::get_parameters(BC_WindowBase *parent_window, Asset *asset,
-       BC_WindowBase* &format_window, int audio_options, int video_options)
+void FilePPM::get_parameters(BC_WindowBase *parent_window,
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options) {
                PPMConfigVideo *window = new PPMConfigVideo(parent_window, asset);
index 05f145d1c42187a0d095f9c97746080d4367d6a3..db476971b3a6316ad1abdca0d81cdae4abf4508b 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef FILEPPM_H
 #define FILEPPM_H
 
+#include "edl.inc"
 #include "filelist.h"
 #include "fileppm.inc"
 
@@ -43,8 +44,9 @@ public:
        int read_frame_header(char *path);
        int write_frame(VFrame *frame, VFrame *output, FrameWriterUnit *unit);
        FrameWriterUnit* new_writer_unit(FrameWriter *writer);
-       static void get_parameters(BC_WindowBase *parent_window, Asset *asset,
-               BC_WindowBase* &format_window, int audio_options, int video_options);
+       static void get_parameters(BC_WindowBase *parent_window,
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 };
 
 class PPMConfigVideo : public BC_Window
index 3ed55f01996e2f06b92fdcd10aa6f33f088528d2..f3370e16e091ee095872e90d5e767ef0df7a7fdb 100644 (file)
@@ -356,10 +356,8 @@ int FileSndFile::write_samples(double **buffer, int64_t len)
 }
 
 void FileSndFile::get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options)
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index ed86c1416663acf9b1df3d0de7d799e92d9ab8e9..74414c69bd19864868e6b4a61efeaa2e83a5088e 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdint.h>
 
 #include "bitspopup.inc"
+#include "edl.inc"
 #include "filebase.h"
 #include "filesndfile.h"
 #include "sndfile.h"
@@ -53,10 +54,8 @@ public:
        void asset_to_format();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
 
        SNDFILE *fd;
        SF_INFO fd_config;
index e970c1c8f2b8e6ac6be8a5e9214a74044117cfe2..21c53d1d9a49b402a1910465cd2ba1280384dcaf 100644 (file)
@@ -98,10 +98,8 @@ int FileTGA::check_sig(Asset *asset)
 }
 
 void FileTGA::get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index 60ec6feb7fcd7039557b3c12454b64643b1892f9..e539c6d696efca47051ab38148149b21024e677c 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef FILETGA_H
 #define FILETGA_H
 
+#include "edl.inc"
 #include "filelist.h"
 #include "guicast.h"
 
@@ -33,10 +34,8 @@ public:
 
        static int check_sig(Asset *asset);
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        int read_frame_header(char *path);
        static const char* compression_to_str(const char *compression);
        static const char* str_to_compression(const char *string);
index 994fd6d0a8e7b995af97532a8ecc53b4a4620a43..5621f0e3513d6fbd2c341345bde2220432c8b8cd 100644 (file)
@@ -46,10 +46,8 @@ FileTIFF::~FileTIFF()
 
 
 void FileTIFF::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(video_options)
        {
index 354b9d0727c9163dc8f92304a4f3ee3085b04cd7..321ea9be91f354fa6a851ed27eb9f917772a3c6b 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdlib.h>
 
+#include "edl.inc"
 #include "file.inc"
 #include "filelist.h"
 #include "mutex.inc"
@@ -39,10 +40,8 @@ public:
        ~FileTIFF();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        static int check_sig(Asset *asset);
        static const char* compression_to_str(int value);
        static const char* cmodel_to_str(int value);
index c3281212a698d3fd2a21774646b2e0e08171559a..65eedf71a7f57cf7eeddd2e085562f408260bd7c 100644 (file)
@@ -56,10 +56,8 @@ FileVorbis::~FileVorbis()
 }
 
 void FileVorbis::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
index b40eed50261ce8b1413b634d611dbff98eed2734..0e6c92cb56006eb3bd7622ecf8af169f6c6aaaa4 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef FILEVORBIS_H
 #define FILEVORBIS_H
 
+#include "edl.inc"
 #include "file.inc"
 #include "filebase.h"
 #include "vorbis/vorbisenc.h"
@@ -39,10 +40,8 @@ public:
        ~FileVorbis();
 
        static void get_parameters(BC_WindowBase *parent_window,
-               Asset *asset,
-               BC_WindowBase* &format_window,
-               int audio_options,
-               int video_options);
+               Asset *asset, BC_WindowBase* &format_window,
+               int audio_options, int video_options, EDL *edl);
        int reset_parameters_derived();
 
        static int check_sig(Asset *asset);
index 8977e55b6cc2b5e6f5a2eaa2898b42462d1048d5..0793e59ece6ab0db9df3fabe35cce580084af424 100644 (file)
 #include "ffmpeg.h"
 #include "formatpopup.h"
 #include "language.h"
-#include "pluginserver.h"
-
 
 
 FormatPopup::FormatPopup(int x, int y, int do_audio, int do_video, int use_brender)
  : BC_ListBox(x, y, 200, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
 {
-       this->plugindb = plugindb;
        this->do_audio = do_audio;
        this->do_video = do_video;
        this->use_brender = use_brender;
@@ -101,10 +98,9 @@ int FormatPopup::handle_event()
 }
 
 
-FFMPEGPopup::FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y)
+FFMPEGPopup::FFMPEGPopup(int x, int y)
  : BC_ListBox(x, y, 100, 200, LISTBOX_TEXT, 0, 0, 0, 1, 0, 1)
 {
-       this->plugindb = plugindb;
        set_tooltip(_("Set ffmpeg file type"));
 }
 
index f7ba7975087ef6f54d27293d7c7240b87611c48d..aec42efdf9c5c213268ffac375eea413f7811404 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "guicast.h"
 #include "formatpopup.inc"
-#include "pluginserver.inc"
 
 class FormatPopup : public BC_ListBox
 {
@@ -39,7 +38,6 @@ public:
        void create_objects();
        void post_item(int format);
        virtual int handle_event();  // user copies text to value here
-       ArrayList<PluginServer*> *plugindb;
        ArrayList<BC_ListBoxItem*> format_items;
        int use_brender, do_audio, do_video;
 };
@@ -48,12 +46,11 @@ public:
 class FFMPEGPopup : public BC_ListBox
 {
 public:
-       FFMPEGPopup(ArrayList<PluginServer*> *plugindb, int x, int y);
+       FFMPEGPopup(int x, int y);
        ~FFMPEGPopup();
 
        void create_objects();
        virtual int handle_event();
-       ArrayList<PluginServer*> *plugindb;
        ArrayList<BC_ListBoxItem*> ffmpeg_types;
 };
 
index 74c4cf09f17a3d2985e56d7a03db0cf12d025fd5..487019980b867314b802ed947da6ff9c076bc903 100644 (file)
@@ -46,7 +46,6 @@ FormatTools::FormatTools(MWindow *mwindow,
        this->mwindow = mwindow;
        this->window = window;
        this->asset = asset;
-       this->plugindb = mwindow->plugindb;
 
        aparams_button = 0;
        vparams_button = 0;
@@ -164,7 +163,7 @@ void FormatTools::create_objects(
        format_button->create_objects();
        x += format_button->get_w() + 5;
        window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 70, 1, asset->fformat));
-       FFMPEG::set_asset_format(asset, asset->fformat);
+       FFMPEG::set_asset_format(asset, mwindow->edl, asset->fformat);
        x += ffmpeg_type->get_w();
        window->add_subwindow(format_ffmpeg = new FormatFFMPEG(x, y, this));
        format_ffmpeg->create_objects();
@@ -753,7 +752,7 @@ int FormatFormat::handle_event()
 
 
 FormatFFMPEG::FormatFFMPEG(int x, int y, FormatTools *format)
- : FFMPEGPopup(format->plugindb, x, y)
+ : FFMPEGPopup(x, y)
 {
        this->format = format;
 }
@@ -770,7 +769,7 @@ int FormatFFMPEG::handle_event()
                format->ffmpeg_type->update(text);
                format->asset->ff_audio_options[0] = 0;
                format->asset->ff_video_options[0] = 0;
-               FFMPEG::set_asset_format(format->asset, text);
+               FFMPEG::set_asset_format(format->asset, format->mwindow->edl, text);
                format->update_extension();
                format->close_format_windows();
                format->update_format();
index e0946a1fa41827e53ba2a8553f204292c6cd154a..35415ae0a7d7858bcfc49a64c3775b2105c26d10 100644 (file)
 class FormatTools
 {
 public:
-       FormatTools(MWindow *mwindow,
-                               BC_WindowBase *window,
-                               Asset *asset);
+       FormatTools(MWindow *mwindow, BC_WindowBase *window, Asset *asset);
        virtual ~FormatTools();
 
-       void create_objects(int &init_x,
-                                               int &init_y,
-                                               int do_audio,    // Include tools for audio
-                                               int do_video,   // Include tools for video
-                                               int prompt_audio,  // Include checkbox for audio
-                                               int prompt_video,  // Include checkbox for video
-                                               int prompt_audio_channels,
-                                               int prompt_video_compression,
-                                               const char *locked_compressor,  // Select compressors to be offered
-                                               int recording, // Change captions for recording
-                                               int *file_per_label,  // prompt if nonzero
-                                               int brender,   // Supply file formats for background rendering
-                                               int horizontal_layout = 0);
+       void create_objects(int &init_x, int &init_y,
+               int do_audio, int do_video,   // Include tools for audio, video
+               int prompt_audio,  int prompt_video,  // Include checkbox for audio, video
+               int prompt_audio_channels, int prompt_video_compression,
+               const char *locked_compressor,  // Select compressors to be offered
+               int recording, // Change captions for recording
+               int *file_per_label,  // prompt if nonzero
+               int brender,   // Supply file formats for background rendering
+               int horizontal_layout = 0);
 // In recording preferences, aspects of the format are locked
 // depending on the driver used.
        void update_driver(int driver);
@@ -100,7 +94,6 @@ public:
 
        FormatFilePerLabel *labeled_files;
 
-       ArrayList<PluginServer*> *plugindb;
        MWindow *mwindow;
        const char *locked_compressor;
        int recording;
index db06202b6111d0fbe40a3f800d82540a366d9be2..9e7d6151f38948e9f975a7e793f5a552cbee4d39 100644 (file)
@@ -4,6 +4,7 @@ maxrate=20000000
 bufsize=20000000
 preset=veryslow
 profile=high
+cin_pix_fmt yuv420p
 level=41
 bf=8
 refs=4
diff --git a/cinelerra-5.1/ffmpeg/video/raw.rgb b/cinelerra-5.1/ffmpeg/video/raw.rgb
new file mode 100644 (file)
index 0000000..b794117
--- /dev/null
@@ -0,0 +1,2 @@
+rawvideo rawvideo
+cin_pix_fmt rgb24
diff --git a/cinelerra-5.1/ffmpeg/video/raw.yuv b/cinelerra-5.1/ffmpeg/video/raw.yuv
new file mode 100644 (file)
index 0000000..1f6a8ee
--- /dev/null
@@ -0,0 +1,2 @@
+rawvideo rawvideo
+cin_pix_fmt yuv420p
diff --git a/cinelerra-5.1/ffmpeg/video/rgb.dfl b/cinelerra-5.1/ffmpeg/video/rgb.dfl
new file mode 100644 (file)
index 0000000..0394fb8
--- /dev/null
@@ -0,0 +1 @@
+raw.rgb
diff --git a/cinelerra-5.1/ffmpeg/video/yuv.dfl b/cinelerra-5.1/ffmpeg/video/yuv.dfl
new file mode 100644 (file)
index 0000000..47b9a07
--- /dev/null
@@ -0,0 +1 @@
+raw.yuv