forgot relative patch qualification for tiff patches
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / fileflac.C
index 96fdb8bde56908e365e196f82d3794a25327dd7f..946c9d84a790e1240ff8fd36aa9e8fe35cb6fc88 100644 (file)
@@ -72,17 +72,7 @@ void FileFLAC::get_parameters(BC_WindowBase *parent_window,
 
 int FileFLAC::check_sig(Asset *asset, char *test)
 {
-       if(test[0] == 'f' &&
-               test[1] == 'L' &&
-               test[2] == 'a' &&
-               test[3] == 'C')
-       {
-               return 1;
-       }
-       else
-       {
-               return 0;
-       }
+       return test[0]=='f' && test[1]=='L' && test[2]=='a' && test[3]=='C' ? 1 : 0;
 }
 
 int FileFLAC::reset_parameters_derived()
@@ -223,10 +213,8 @@ int FileFLAC::open_file(int rd, int wr)
                FLAC__stream_encoder_set_channels(flac_encode, asset->channels);
                FLAC__stream_encoder_set_bits_per_sample(flac_encode, asset->bits);
                FLAC__stream_encoder_set_sample_rate(flac_encode, asset->sample_rate);
-               FLAC__stream_encoder_init_file(flac_encode,
-                       asset->path,
-                       0,
-                       0);
+               FLAC__stream_encoder_set_compression_level(flac_encode, asset->flac_compression);
+               FLAC__stream_encoder_init_file(flac_encode, asset->path, 0, 0);
        }
 
        return result;
@@ -348,47 +336,58 @@ int FileFLAC::read_samples(double *buffer, int64_t len)
 }
 
 
-
-
-
-
-
-
-
-
 FLACConfigAudio::FLACConfigAudio(BC_WindowBase *parent_window,
        Asset *asset)
  : BC_Window(_(PROGRAM_NAME ": Audio Compression"),
-       parent_window->get_abs_cursor_x(1),
-       parent_window->get_abs_cursor_y(1),
-       350,
-       170,
-       -1,
-       -1,
-       0,
-       0,
-       1)
+       parent_window->get_abs_cursor_x(1), parent_window->get_abs_cursor_y(1),
+       xS(350), yS(170), -1, -1, 0, 0, 1)
 {
        this->parent_window = parent_window;
        this->asset = asset;
+       compression = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("Single File Rendering");
 }
 
 FLACConfigAudio::~FLACConfigAudio()
 {
+       delete compression;
 }
 
 void FLACConfigAudio::create_objects()
 {
-       int x = 10, y = 10;
+       BC_Title *title;
+       int ys5 = yS(5), xs100 = xS(100);
+       int x = xS(10), y = yS(10);
        lock_window("FLACConfigAudio::create_objects");
        bits_popup = new BitsPopup(this, x, y, &asset->bits, 0, 0, 0, 0, 0);
        bits_popup->create_objects();
-
+       y += bits_popup->get_h() + ys5;
+       add_subwindow(title = new BC_Title(x,y,_("Compression:")));
+        int x1 = x + title->get_w() + xs100;
+        compression = new FLACCompression(this, x1, y);
+        compression->create_objects();
+        y += compression->get_h() + ys5;
        add_subwindow(new BC_OKButton(this));
        show_window(1);
        unlock_window();
 }
 
+FLACCompression::FLACCompression(FLACConfigAudio *gui, int x, int y)
+: BC_TumbleTextBox(gui, (int64_t)gui->asset->flac_compression,
+  (int64_t)0, (int64_t)8, x, y, xS(40))
+
+{
+       this->gui = gui;
+}
+
+int FLACCompression::handle_event()
+{
+        gui->asset->flac_compression = atol(get_text());
+        return 1;
+}
+
+
 int FLACConfigAudio::close_event()
 {
        set_done(0);