Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / fileffmpeg.C
index 43ed758b7b56f5f541852abe32811f38ae2e9e78..2fbf6c86f80327055b703295b5d66017895aaf0e 100644 (file)
@@ -1,3 +1,24 @@
+/*
+ * 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>
@@ -159,7 +180,7 @@ 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) ?
+       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 ) {
@@ -190,7 +211,7 @@ 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) ?
+       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 ) {
@@ -343,10 +364,9 @@ int FileFFMPEG::open_file(int rd, int wr)
                        if( video_layers > 0 ) {
                                asset->video_data = 1;
                                asset->aspect_ratio = ff->ff_aspect_ratio(0);
-                               printf("ff_aspect_ratio, %f \n", asset->aspect_ratio);
                                if (!asset->interlace_mode) asset->interlace_mode = ff->ff_interlace(0);
                                if ( ff->ff_video_frames(0) > 1 ) {
-                               ff->video_probe(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;
@@ -517,6 +537,8 @@ FFMPEGConfigAudio::FFMPEGConfigAudio(BC_WindowBase *parent_window,
        audio_options = 0;
        format_name = asset->fformat;
        codec_name = asset->acodec;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Options for Render with FFmpeg");
 }
 
 FFMPEGConfigAudio::~FFMPEGConfigAudio()
@@ -682,6 +704,8 @@ FFMPEGConfigVideo::FFMPEGConfigVideo(BC_WindowBase *parent_window,
        bitrate = 0;
        quality = 0;
        video_options = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Options for Render with FFmpeg");
 }
 
 FFMPEGConfigVideo::~FFMPEGConfigVideo()
@@ -848,6 +872,8 @@ FFMPEGConfigFormat::FFMPEGConfigFormat(FFOptionsFormatViewDialog *view_dialog,
        format_options = 0;
        format_name = asset->fformat;
        codec_name = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Modifying FFmpeg Format Options");
 }
 
 FFMPEGConfigFormat::~FFMPEGConfigFormat()
@@ -1594,6 +1620,8 @@ FFOptionsWindow::FFOptionsWindow(FFOptionsDialog *dialog, int x, int y)
        this->dialog = dialog;
        this->selected = 0;
        this->kind = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Modifying FFmpeg Format Options");
 }
 
 FFOptionsWindow::~FFOptionsWindow()
@@ -1845,7 +1873,7 @@ int FFOptionsViewAudio::handle_event()
        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;
@@ -1883,7 +1911,7 @@ int FFOptionsViewVideo::handle_event()
        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;
@@ -1945,9 +1973,9 @@ int FFOptionsFormatView::handle_event()
 {
        Asset *asset = fmt_config->asset;
        char *format_name = asset->fformat;
-       char *replace_name0 = "mov";
-       char *replace_name1 = "mpegts";
-       char *replace_name2 = "matroska";
+       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"))