audio chan pos rework, batchrender deadlock, titler/crikey grab_event tweak, thread...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / fileffmpeg.C
index 4d797431eeb9e57151d13c6afca9469a7cae19eb..cc8a5371b7c9749e2fb9d69be23ad05beab082f2 100644 (file)
@@ -87,6 +87,22 @@ FFMpegAudioNum::FFMpegAudioNum(BC_Window *window,
 int FFMpegAudioBitrate::handle_event()
 {
        int ret = FFMpegAudioNum::handle_event();
+       Asset *asset = window()->asset;
+       if( asset->ff_audio_bitrate > 0 )
+               window()->quality->disable();
+       else if( !window()->quality->get_textbox()->is_hidden() )
+               window()->quality->enable();
+       return ret;
+}
+
+int FFMpegAudioQuality::handle_event()
+{
+       int ret = FFMpegAudioNum::handle_event();
+       Asset *asset = window()->asset;
+       if( asset->ff_audio_quality >= 0 )
+               window()->bitrate->disable();
+       else if( !window()->bitrate->get_textbox()->is_hidden() )
+               window()->bitrate->enable();
        return ret;
 }
 
@@ -342,9 +358,9 @@ int FileFFMPEG::get_best_colormodel(int driver, int vstream)
        int is_mpeg = !ff ? 0 : ff->ff_video_mpeg_color_range(vstream);
 
        switch(driver) {
-       case PLAYBACK_X11: return is_mpeg ? BC_YUV888 : BC_RGB888;
+       case PLAYBACK_X11:
+       case PLAYBACK_X11_GL: return is_mpeg ? BC_YUV888 : BC_RGB888;
        case PLAYBACK_X11_XV: return BC_YUV420P;
-       case PLAYBACK_X11_GL: return BC_RGB_FLOAT;
        }
 
        return BC_RGB888;
@@ -354,9 +370,10 @@ int FileFFMPEG::get_best_colormodel(Asset *asset, int driver)
 {
        switch(driver) {
 // the direct X11 color model requires scaling in the codec
-       case PLAYBACK_X11: return BC_RGB888;
+       case SCREENCAPTURE:
+       case PLAYBACK_X11:
+       case PLAYBACK_X11_GL: return BC_RGB888;
        case PLAYBACK_X11_XV: return BC_YUV420P;
-       case PLAYBACK_X11_GL: return BC_RGB_FLOAT;
        }
 
        return BC_YUV420P;
@@ -461,8 +478,13 @@ void FFMPEGConfigAudio::create_objects()
        bitrate->create_objects();
        bitrate->set_increment(1000);
        bitrate->set_boundaries((int64_t)0, (int64_t)INT_MAX);
+       y += bitrate->get_h() + 5;
+       quality = new FFMpegAudioQuality(this, x, y, _("Quality:"), &asset->ff_audio_quality);
+       quality->create_objects();
+       quality->set_increment(1);
+       quality->set_boundaries((int64_t)-1, (int64_t)51);
 
-       y += bitrate->get_h() + 10;
+       y += quality->get_h() + 10;
        BC_Title *title = new BC_Title(x, y, _("Audio Options:"));
        add_subwindow(title);
 
@@ -485,6 +507,10 @@ void FFMPEGConfigAudio::create_objects()
        show_window(1);
 
        bitrate->update_param("cin_bitrate", asset->ff_audio_options);
+       quality->update_param("cin_quality", asset->ff_audio_options);
+
+       if( asset->ff_audio_bitrate > 0 ) quality->disable();
+       else if( asset->ff_audio_quality >= 0 ) bitrate->disable();
 
        unlock_window();
 }
@@ -522,6 +548,7 @@ int FFMPEGConfigAudioPopup::handle_event()
        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);
        return 1;
 }