rework android-rmt display, add a few buttons
[goodguy/history.git] / cinelerra-5.0 / cinelerra / asset.C
index 7a33a7cedcd0d5e1912c41b42d9647f7be1de093..f5951cf2533771efea0442c12a97da0eacd3e7b5 100644 (file)
@@ -1,21 +1,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * 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
- * 
+ *
  */
 
 
@@ -88,7 +88,7 @@ int Asset::init_values()
        ff_video_bitrate = 0;
        ff_video_quality = 0;
 
-       jpeg_quality = 100;
+       jpeg_quality = 80;
        aspect_ratio = -1;
 
        ampeg_bitrate = 256;
@@ -106,14 +106,6 @@ int Asset::init_values()
        theora_keyframe_frequency = 64;
        theora_keyframe_force_frequency = 64;
 
-       mp3_bitrate = 256000;
-
-
-       mp4a_bitrate = 256000;
-       mp4a_quantqual = 100;
-
-
-
 // mpeg parameters
        vmpeg_iframe_distance = 45;
        vmpeg_pframe_distance = 0;
@@ -128,30 +120,6 @@ int Asset::init_values()
        vmpeg_preset = 0;
        vmpeg_field_order = 0;
 
-// Divx parameters.  BC_Hash from encore2
-       divx_bitrate = 2000000;
-       divx_rc_period = 50;
-       divx_rc_reaction_ratio = 45;
-       divx_rc_reaction_period = 10;
-       divx_max_key_interval = 250;
-       divx_max_quantizer = 31;
-       divx_min_quantizer = 1;
-       divx_quantizer = 5;
-       divx_quality = 5;
-       divx_fix_bitrate = 1;
-       divx_use_deblocking = 1;
-
-       h264_bitrate = 2000000;
-       h264_quantizer = 5;
-       h264_fix_bitrate = 0;
-
-       ms_bitrate = 1000000;
-       ms_bitrate_tolerance = 500000;
-       ms_quantization = 10;
-       ms_interlaced = 0;
-       ms_gop_size = 45;
-       ms_fix_bitrate = 1;
-
        ac3_bitrate = 128;
 
        png_use_alpha = 0;
@@ -228,8 +196,6 @@ void Asset::copy_format(Asset *asset, int do_index)
        header = asset->header;
        dither = asset->dither;
        mp3_bitrate = asset->mp3_bitrate;
-       mp4a_bitrate = asset->mp4a_bitrate;
-       mp4a_quantqual = asset->mp4a_quantqual;
        use_header = asset->use_header;
        aspect_ratio = asset->aspect_ratio;
 
@@ -263,7 +229,7 @@ void Asset::copy_format(Asset *asset, int do_index)
        vorbis_bitrate = asset->vorbis_bitrate;
        vorbis_max_bitrate = asset->vorbis_max_bitrate;
 
-       
+
        theora_fix_bitrate = asset->theora_fix_bitrate;
        theora_bitrate = asset->theora_bitrate;
        theora_quality = asset->theora_quality;
@@ -288,34 +254,8 @@ void Asset::copy_format(Asset *asset, int do_index)
        vmpeg_preset = asset->vmpeg_preset;
        vmpeg_field_order = asset->vmpeg_field_order;
 
-
-       divx_bitrate = asset->divx_bitrate;
-       divx_rc_period = asset->divx_rc_period;
-       divx_rc_reaction_ratio = asset->divx_rc_reaction_ratio;
-       divx_rc_reaction_period = asset->divx_rc_reaction_period;
-       divx_max_key_interval = asset->divx_max_key_interval;
-       divx_max_quantizer = asset->divx_max_quantizer;
-       divx_min_quantizer = asset->divx_min_quantizer;
-       divx_quantizer = asset->divx_quantizer;
-       divx_quality = asset->divx_quality;
-       divx_fix_bitrate = asset->divx_fix_bitrate;
-       divx_use_deblocking = asset->divx_use_deblocking;
-
-       h264_bitrate = asset->h264_bitrate;
-       h264_quantizer = asset->h264_quantizer;
-       h264_fix_bitrate = asset->h264_fix_bitrate;
-
-
-       ms_bitrate = asset->ms_bitrate;
-       ms_bitrate_tolerance = asset->ms_bitrate_tolerance;
-       ms_interlaced = asset->ms_interlaced;
-       ms_quantization = asset->ms_quantization;
-       ms_gop_size = asset->ms_gop_size;
-       ms_fix_bitrate = asset->ms_fix_bitrate;
-
-       
        ac3_bitrate = asset->ac3_bitrate;
-       
+
        png_use_alpha = asset->png_use_alpha;
        exr_use_alpha = asset->exr_use_alpha;
        exr_compression = asset->exr_compression;
@@ -363,8 +303,8 @@ printf("Asset::operator=\n");
 }
 
 
-int Asset::equivalent(Asset &asset, 
-       int test_audio, 
+int Asset::equivalent(Asset &asset,
+       int test_audio,
        int test_video)
 {
        int result = (!strcmp(asset.path, path) &&
@@ -375,25 +315,25 @@ int Asset::equivalent(Asset &asset,
 
        if(test_audio && result)
        {
-               result = (channels == asset.channels && 
-                       sample_rate == asset.sample_rate && 
-                       bits == asset.bits && 
-                       byte_order == asset.byte_order && 
-                       signed_ == asset.signed_ && 
-                       header == asset.header && 
+               result = (channels == asset.channels &&
+                       sample_rate == asset.sample_rate &&
+                       bits == asset.bits &&
+                       byte_order == asset.byte_order &&
+                       signed_ == asset.signed_ &&
+                       header == asset.header &&
                        dither == asset.dither &&
                        !strcmp(acodec, asset.acodec));
                if(result && format == FILE_FFMPEG)
                        result = !strcmp(ff_audio_options, asset.ff_audio_options) &&
                                ff_audio_bitrate == asset.ff_audio_bitrate;
-                               
+
        }
 
 
        if(test_video && result)
        {
-               result = (layers == asset.layers && 
-                       program == asset.program && 
+               result = (layers == asset.layers &&
+                       program == asset.program &&
                        frame_rate == asset.frame_rate &&
                        width == asset.width &&
                        height == asset.height &&
@@ -410,8 +350,8 @@ int Asset::equivalent(Asset &asset,
 int Asset::operator==(Asset &asset)
 {
 
-       return equivalent(asset, 
-               1, 
+       return equivalent(asset,
+               1,
                1);
 }
 
@@ -422,9 +362,9 @@ int Asset::operator!=(Asset &asset)
 
 int Asset::test_path(const char *path)
 {
-       if(!strcasecmp(this->path, path)) 
-               return 1; 
-       else 
+       if(!strcasecmp(this->path, path))
+               return 1;
+       else
                return 0;
 }
 
@@ -433,7 +373,7 @@ int Asset::test_plugin_title(const char *path)
        return 0;
 }
 
-int Asset::read(FileXML *file, 
+int Asset::read(FileXML *file,
        int expand_relative)
 {
        int result = 0;
@@ -490,7 +430,7 @@ int Asset::read(FileXML *file,
                        {
                                const char *string = file->tag.get_property("TYPE");
                                format = File::strtoformat(string);
-                               use_header = 
+                               use_header =
                                        file->tag.get_property("USE_HEADER", use_header);
                                file->tag.get_property("FFORMAT", fformat);
                        }
@@ -526,9 +466,9 @@ int Asset::read_audio(FileXML *file)
 {
        if(file->tag.title_is("AUDIO")) audio_data = 1;
        channels = file->tag.get_property("CHANNELS", 2);
-// This is loaded from the index file after the EDL but this 
+// This is loaded from the index file after the EDL but this
 // should be overridable in the EDL.
-       if(!sample_rate) sample_rate = file->tag.get_property("RATE", 44100);
+       if(!sample_rate) sample_rate = file->tag.get_property("RATE", 48000);
        bits = file->tag.get_property("BITS", 16);
        byte_order = file->tag.get_property("BYTE_ORDER", 1);
        signed_ = file->tag.get_property("SIGNED", 1);
@@ -551,7 +491,7 @@ int Asset::read_video(FileXML *file)
        width = file->tag.get_property("WIDTH", width);
        layers = file->tag.get_property("LAYERS", layers);
        program = file->tag.get_property("PROGRAM", program);
-// This is loaded from the index file after the EDL but this 
+// This is loaded from the index file after the EDL but this
 // should be overridable in the EDL.
        if(EQUIV(frame_rate, 0)) frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
        vcodec[0] = 0;
@@ -571,8 +511,8 @@ int Asset::read_index(FileXML *file)
 // Output path is the path of the output file if name truncation is desired.
 // It is a "" if complete names should be used.
 
-int Asset::write(FileXML *file, 
-       int include_index, 
+int Asset::write(FileXML *file,
+       int include_index,
        const char *output_path)
 {
        char new_path[BCTEXTLEN];
@@ -582,7 +522,7 @@ int Asset::write(FileXML *file,
 
 // Make path relative
        fs.extract_dir(asset_directory, path);
-       if(output_path && output_path[0]) 
+       if(output_path && output_path[0])
                fs.extract_dir(output_directory, output_path);
        else
                output_directory[0] = 0;
@@ -612,7 +552,7 @@ int Asset::write(FileXML *file,
 // Write the format information
        file->tag.set_title("FORMAT");
 
-       file->tag.set_property("TYPE", 
+       file->tag.set_property("TYPE",
                File::formattostr(format));
        file->tag.set_property("USE_HEADER", use_header);
        file->tag.set_property("FFORMAT", fformat);
@@ -621,14 +561,14 @@ int Asset::write(FileXML *file,
        file->append_newline();
 
 // Requiring data to exist caused batch render to lose settings.
-// But the only way to know if an asset doesn't have audio or video data 
+// But the only way to know if an asset doesn't have audio or video data
 // is to not write the block.
 // So change the block name if the asset doesn't have the data.
        write_audio(file);
        write_video(file);
 // index goes after source
-       if(index_state->index_status == INDEX_READY && include_index) 
-               write_index(file);  
+       if(index_state->index_status == INDEX_READY && include_index)
+               write_index(file);
 
        file->tag.set_title("/ASSET");
        file->append_tag();
@@ -653,7 +593,7 @@ int Asset::write_audio(FileXML *file)
        file->tag.set_property("DITHER", dither);
        if(acodec[0])
                file->tag.set_property("ACODEC", acodec);
-       
+
        file->tag.set_property("AUDIO_LENGTH", audio_length);
 
 
@@ -662,14 +602,14 @@ int Asset::write_audio(FileXML *file)
 
 //     file->tag.set_property("AMPEG_BITRATE", ampeg_bitrate);
 //     file->tag.set_property("AMPEG_DERIVATIVE", ampeg_derivative);
-// 
+//
 //     file->tag.set_property("VORBIS_VBR", vorbis_vbr);
 //     file->tag.set_property("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
 //     file->tag.set_property("VORBIS_BITRATE", vorbis_bitrate);
 //     file->tag.set_property("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
-// 
+//
 //     file->tag.set_property("MP3_BITRATE", mp3_bitrate);
-// 
+//
 
 
 
@@ -712,8 +652,8 @@ int Asset::write_index(FileXML *file)
 
 
 
-const char* Asset::construct_param(const char *param, 
-       const char *prefix, 
+const char* Asset::construct_param(const char *param,
+       const char *prefix,
        char *return_value)
 {
        if(prefix)
@@ -726,8 +666,8 @@ const char* Asset::construct_param(const char *param,
 #define UPDATE_DEFAULT(x, y) defaults->update(construct_param(x, prefix, string), y);
 #define GET_DEFAULT(x, y) defaults->get(construct_param(x, prefix, string), y);
 
-void Asset::load_defaults(BC_Hash *defaults, 
-       const char *prefix, 
+void Asset::load_defaults(BC_Hash *defaults,
+       const char *prefix,
        int do_format,
        int do_compression,
        int do_path,
@@ -773,7 +713,7 @@ void Asset::load_defaults(BC_Hash *defaults,
 
 
                channels = GET_DEFAULT("CHANNELS", 2);
-               if(!sample_rate) sample_rate = GET_DEFAULT("RATE", 44100);
+               if(!sample_rate) sample_rate = GET_DEFAULT("RATE", 48000);
                header = GET_DEFAULT("HEADER", 0);
                audio_length = GET_DEFAULT("AUDIO_LENGTH", (int64_t)0);
 
@@ -811,8 +751,6 @@ void Asset::load_defaults(BC_Hash *defaults,
        ff_video_quality = GET_DEFAULT("FF_VIDEO_QUALITY", ff_video_quality);
 
        mp3_bitrate = GET_DEFAULT("MP3_BITRATE", mp3_bitrate);
-       mp4a_bitrate = GET_DEFAULT("MP4A_BITRATE", mp4a_bitrate);
-       mp4a_quantqual = GET_DEFAULT("MP4A_QUANTQUAL", mp4a_quantqual);
 
        jpeg_quality = GET_DEFAULT("JPEG_QUALITY", jpeg_quality);
        aspect_ratio = GET_DEFAULT("ASPECT_RATIO", aspect_ratio);
@@ -831,30 +769,6 @@ void Asset::load_defaults(BC_Hash *defaults,
        vmpeg_preset = GET_DEFAULT("VMPEG_PRESET", vmpeg_preset);
        vmpeg_field_order = GET_DEFAULT("VMPEG_FIELD_ORDER", vmpeg_field_order);
 
-       h264_bitrate = GET_DEFAULT("H264_BITRATE", h264_bitrate);
-       h264_quantizer = GET_DEFAULT("H264_QUANTIZER", h264_quantizer);
-       h264_fix_bitrate = GET_DEFAULT("H264_FIX_BITRATE", h264_fix_bitrate);
-
-
-       divx_bitrate = GET_DEFAULT("DIVX_BITRATE", divx_bitrate);
-       divx_rc_period = GET_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
-       divx_rc_reaction_ratio = GET_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
-       divx_rc_reaction_period = GET_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
-       divx_max_key_interval = GET_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
-       divx_max_quantizer = GET_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
-       divx_min_quantizer = GET_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
-       divx_quantizer = GET_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
-       divx_quality = GET_DEFAULT("DIVX_QUALITY", divx_quality);
-       divx_fix_bitrate = GET_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
-       divx_use_deblocking = GET_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
-
-       ms_bitrate = GET_DEFAULT("MS_BITRATE", ms_bitrate);
-       ms_bitrate_tolerance = GET_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
-       ms_interlaced = GET_DEFAULT("MS_INTERLACED", ms_interlaced);
-       ms_quantization = GET_DEFAULT("MS_QUANTIZATION", ms_quantization);
-       ms_gop_size = GET_DEFAULT("MS_GOP_SIZE", ms_gop_size);
-       ms_fix_bitrate = GET_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
-
        ac3_bitrate = GET_DEFAULT("AC3_BITRATE", ac3_bitrate);
 
        png_use_alpha = GET_DEFAULT("PNG_USE_ALPHA", png_use_alpha);
@@ -866,7 +780,7 @@ void Asset::load_defaults(BC_Hash *defaults,
        boundaries();
 }
 
-void Asset::save_defaults(BC_Hash *defaults, 
+void Asset::save_defaults(BC_Hash *defaults,
        const char *prefix,
        int do_format,
        int do_compression,
@@ -923,12 +837,6 @@ void Asset::save_defaults(BC_Hash *defaults,
 
 
                UPDATE_DEFAULT("MP3_BITRATE", mp3_bitrate);
-               UPDATE_DEFAULT("MP4A_BITRATE", mp4a_bitrate);
-               UPDATE_DEFAULT("MP4A_QUANTQUAL", mp4a_quantqual);
-
-
-
-
 
                UPDATE_DEFAULT("JPEG_QUALITY", jpeg_quality);
                UPDATE_DEFAULT("ASPECT_RATIO", aspect_ratio);
@@ -947,29 +855,6 @@ void Asset::save_defaults(BC_Hash *defaults,
                UPDATE_DEFAULT("VMPEG_PRESET", vmpeg_preset);
                UPDATE_DEFAULT("VMPEG_FIELD_ORDER", vmpeg_field_order);
 
-               UPDATE_DEFAULT("H264_BITRATE", h264_bitrate);
-               UPDATE_DEFAULT("H264_QUANTIZER", h264_quantizer);
-               UPDATE_DEFAULT("H264_FIX_BITRATE", h264_fix_bitrate);
-
-               UPDATE_DEFAULT("DIVX_BITRATE", divx_bitrate);
-               UPDATE_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
-               UPDATE_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
-               UPDATE_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
-               UPDATE_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
-               UPDATE_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
-               UPDATE_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
-               UPDATE_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
-               UPDATE_DEFAULT("DIVX_QUALITY", divx_quality);
-               UPDATE_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
-               UPDATE_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
-
-
-               UPDATE_DEFAULT("MS_BITRATE", ms_bitrate);
-               UPDATE_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
-               UPDATE_DEFAULT("MS_INTERLACED", ms_interlaced);
-               UPDATE_DEFAULT("MS_QUANTIZATION", ms_quantization);
-               UPDATE_DEFAULT("MS_GOP_SIZE", ms_gop_size);
-               UPDATE_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
 
                UPDATE_DEFAULT("AC3_BITRATE", ac3_bitrate);
 
@@ -1042,13 +927,6 @@ int Asset::dump(FILE *fp)
                video_data, layers, program, frame_rate, width, height,
                vcodec[0], vcodec[1], vcodec[2], vcodec[3], aspect_ratio);
        fprintf(fp,"   video_length " _LD " \n", video_length);
-       fprintf(fp,"   ms_bitrate_tolerance=%d\n", ms_bitrate_tolerance);
-       fprintf(fp,"   ms_quantization=%d\n", ms_quantization);
-       fprintf(fp,"   ms_fix_bitrate=%d\n", ms_fix_bitrate);
-       fprintf(fp,"   ms_interlaced=%d\n", ms_interlaced);
-       fprintf(fp,"   h264_bitrate=%d\n", h264_bitrate);
-       fprintf(fp,"   h264_quantizer=%d\n", h264_quantizer);
-       fprintf(fp,"   h264_fix_bitrate=%d\n", h264_fix_bitrate);
        return 0;
 }