+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ * Copyright (C) 2010 Monty Montgomery
+ * Copyright (C) 2012-2014 Paolo Rampino
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
#include <stdio.h>
#include <stdint.h>
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) ?
+ const 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 ) {
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) ?
+ const 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 ) {
int result = 0;
if( ff ) return 1;
ff = new FFMPEG(this);
-
+
if( rd ) {
result = ff->init_decoder(asset->path);
if( !result ) result = ff->open_decoder();
int video_layers = ff->ff_total_video_layers();
if( video_layers > 0 ) {
asset->video_data = 1;
+ asset->aspect_ratio = ff->ff_aspect_ratio(0);
+ if (!asset->interlace_mode) asset->interlace_mode = ff->ff_interlace(0);
+ if ( ff->ff_video_frames(0) > 1 ) {
+// ff->video_probe(1);
+ if (!asset->interlace_mode && (ff->interlace_from_codec) ) asset->interlace_mode = ff->video_probe(1);
+ }
if( !asset->layers ) asset->layers = video_layers;
asset->actual_width = ff->ff_video_width(0);
asset->actual_height = ff->ff_video_height(0);
audio_options = 0;
format_name = asset->fformat;
codec_name = asset->acodec;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Options for Render with FFmpeg");
}
FFMPEGConfigAudio::~FFMPEGConfigAudio()
bitrate = 0;
quality = 0;
video_options = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Options for Render with FFmpeg");
}
FFMPEGConfigVideo::~FFMPEGConfigVideo()
format_options = 0;
format_name = asset->fformat;
codec_name = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Modifying FFmpeg Format Options");
}
FFMPEGConfigFormat::~FFMPEGConfigFormat()
}
void FFMPEGConfigFormat::save_changes()
{
+ read_options();
char *options = asset->ff_format_options;
int options_len = sizeof(asset->ff_format_options)-1;
ff_options_dialog->store_options(options, options_len);
- format_options->update(options);
}
void FFMPEGConfigFormat::load_options()
case AV_OPT_TYPE_SAMPLE_FMT: cp = N_("<sample_fmt>"); break;
case AV_OPT_TYPE_DURATION: cp = N_("<duration>"); break;
case AV_OPT_TYPE_COLOR: cp = N_("<color>"); break;
- case AV_OPT_TYPE_CHANNEL_LAYOUT: cp = N_("<channel_layout>"); break;
+ case AV_OPT_TYPE_CHLAYOUT: cp = N_("<channel_layout>"); break;
case AV_OPT_TYPE_BOOL: cp = N_("<bool>"); break;
default: cp = N_("<undef>"); break;
}
this->dialog = dialog;
this->selected = 0;
this->kind = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("Modifying FFmpeg Format Options");
}
FFOptionsWindow::~FFOptionsWindow()
const char *name = asset->acodec;
char audio_format[BCSTRLEN]; audio_format[0] = 0;
char audio_codec[BCSTRLEN]; audio_codec[0] = 0;
- AVCodec *codec = !ret &&
+ const AVCodec *codec = !ret &&
!FFMPEG::get_format(audio_format, "audio", name) &&
!FFMPEG::get_codec(audio_codec, "audio", name) ?
avcodec_find_encoder_by_name(audio_codec) : 0;
const char *name = asset->vcodec;
char video_format[BCSTRLEN]; video_format[0] = 0;
char video_codec[BCSTRLEN]; video_codec[0] = 0;
- AVCodec *codec = !ret &&
+ const AVCodec *codec = !ret &&
!FFMPEG::get_format(video_format, "video", name) &&
!FFMPEG::get_codec(video_codec, "video", name) ?
avcodec_find_encoder_by_name(video_codec) : 0;
{
Asset *asset = fmt_config->asset;
char *format_name = asset->fformat;
+ char replace_name0[] = "mov";
+ char replace_name1[] = "mpegts";
+ char replace_name2[] = "matroska";
+ if (!strcmp(format_name, "qt"))
+ format_name = replace_name0; // fixup
+ if (!strcmp(format_name, "m2ts"))
+ format_name = replace_name1; // fixup
+ if (!strcmp(format_name, "mkv"))
+ format_name = replace_name2; // fixup
avformat_free_context(fmt_ctx); fmt_ctx = 0;
int ret = avformat_alloc_output_context2(&fmt_ctx, 0, format_name, 0);
if( ret || !fmt_ctx ) {
void FFOptionsFormatViewDialog::handle_done_event(int result)
{
- if( !result ) {
- cfg_window->lock_window("FFOptionsFormatViewDialog::handle_done_event");
+ if( !result )
cfg_window->save_changes();
- cfg_window->unlock_window();
- }
cfg_window = 0;
}