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;
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;
!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;
}
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;
}
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);
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);
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"
// 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;
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));
}
}
#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"
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;
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;
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)
{
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;
}
}
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;
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;
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,
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;
#include "bcwindowbase.inc"
#include "condition.h"
#include "cstrdup.h"
+#include "edl.inc"
#include "linklist.h"
#include "ffmpeg.inc"
#include "filebase.inc"
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);
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:
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;
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);
}
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);
}
}
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)
{
#include "libswresample/swresample.h"
};
+#include "edl.inc"
#include "filebase.h"
#include "filempeg.inc"
#include "indexfile.inc"
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();
#include "assets.inc"
#include "bccmodels.h"
#include "edit.inc"
+#include "edl.inc"
#include "ffmpeg.inc"
#include "guicast.h"
#include "file.inc"
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; }
}
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)
{
#ifdef HAVE_DV
#include "../config.h"
+#include "edl.inc"
#include "filebase.h"
#include "file.inc"
~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);
}
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)
{
#define FILEEXR_H
+#include "edl.inc"
#include "file.inc"
#include "fileexr.inc"
#include "filelist.h"
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);
#include "bcwindowbase.h"
#include "bitspopup.h"
#include "ctype.h"
+#include "edl.h"
#include "ffmpeg.h"
#include "filebase.h"
#include "file.h"
#include "videodevice.inc"
FileFFMPEG::FileFFMPEG(Asset *asset, File *file)
- : FileBase(asset, file)
+ : FileBase(asset, file)
{
ff = 0;
if(asset->format == FILE_UNKNOWN)
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;
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; }
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)
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),
{
this->parent_window = parent_window;
this->asset = asset;
+ this->edl = edl;
preset_popup = 0;
bitrate = 0;
unlock_window();
}
+void FFMPEGConfigAudio::load_options()
+{
+ FFMPEG::load_audio_options(asset, edl);
+}
+
void FFMPEGConfigAudio::create_objects()
{
int x = 10, y = 10;
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);
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));
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;
}
//======
-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),
{
this->parent_window = parent_window;
this->asset = asset;
+ this->edl = edl;
preset_popup = 0;
bitrate = 0;
unlock_window();
}
+void FFMPEGConfigVideo::load_options()
+{
+ FFMPEG::load_video_options(asset, edl);
+}
+
void FFMPEGConfigVideo::create_objects()
{
int x = 10, y = 10;
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);
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));
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;
}
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;
}
#include "bcdialog.h"
#include "bcwindowbase.inc"
#include "bitspopup.inc"
+#include "edl.inc"
#include "ffmpeg.h"
#include "filebase.h"
#include "fileffmpeg.inc"
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);
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;
FFAudioOptions *audio_options;
BC_WindowBase *parent_window;
Asset *asset;
+ EDL *edl;
FFOptionsDialog *ff_options_dialog;
};
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;
FFMpegVideoQuality *quality;
FFVideoOptions *video_options;
Asset *asset;
+ EDL *edl;
FFOptionsDialog *ff_options_dialog;
};
}
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)
{
#define FILEFLAC_H
#include "bitspopup.inc"
+#include "edl.inc"
#include "file.inc"
#include "filebase.h"
-
-
-
-
-
class FileFLAC : public FileBase
{
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);
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)
{
#ifndef FILEJPEG_H
#define FILEJPEG_H
+#include "edl.inc"
#include "file.inc"
#include "filelist.h"
#include "vframe.inc"
// 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);
}
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)
{
#ifndef FILEJPEGLIST_H
#define FILEJPEGLIST_H
+#include "edl.inc"
#include "file.inc"
#include "filebase.h"
#include "filelist.h"
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);
}
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)
{
#include "bitspopup.inc"
#include "condition.inc"
+#include "edl.inc"
#include "file.inc"
#include "filebase.h"
#include "indexfile.inc"
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);
}
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)
{
#define FILEOGG_H
#include "../config.h"
+#include "edl.inc"
#include "filebase.h"
#include "file.inc"
#include "packagingengine.h"
~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);
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)
{
#define FILEPNG_H
+#include "edl.inc"
#include "file.inc"
#include "filebase.h"
#include "filelist.h"
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);
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);
#ifndef FILEPPM_H
#define FILEPPM_H
+#include "edl.inc"
#include "filelist.h"
#include "fileppm.inc"
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
}
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)
{
#include <stdint.h>
#include "bitspopup.inc"
+#include "edl.inc"
#include "filebase.h"
#include "filesndfile.h"
#include "sndfile.h"
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;
}
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)
{
#ifndef FILETGA_H
#define FILETGA_H
+#include "edl.inc"
#include "filelist.h"
#include "guicast.h"
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);
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)
{
#include <stdlib.h>
+#include "edl.inc"
#include "file.inc"
#include "filelist.h"
#include "mutex.inc"
~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);
}
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)
{
#ifndef FILEVORBIS_H
#define FILEVORBIS_H
+#include "edl.inc"
#include "file.inc"
#include "filebase.h"
#include "vorbis/vorbisenc.h"
~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);
#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;
}
-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"));
}
#include "guicast.h"
#include "formatpopup.inc"
-#include "pluginserver.inc"
class FormatPopup : public BC_ListBox
{
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;
};
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;
};
this->mwindow = mwindow;
this->window = window;
this->asset = asset;
- this->plugindb = mwindow->plugindb;
aparams_button = 0;
vparams_button = 0;
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();
FormatFFMPEG::FormatFFMPEG(int x, int y, FormatTools *format)
- : FFMPEGPopup(format->plugindb, x, y)
+ : FFMPEGPopup(x, y)
{
this->format = format;
}
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();
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);
FormatFilePerLabel *labeled_files;
- ArrayList<PluginServer*> *plugindb;
MWindow *mwindow;
const char *locked_compressor;
int recording;
bufsize=20000000
preset=veryslow
profile=high
+cin_pix_fmt yuv420p
level=41
bf=8
refs=4
--- /dev/null
+rawvideo rawvideo
+cin_pix_fmt rgb24
--- /dev/null
+rawvideo rawvideo
+cin_pix_fmt yuv420p