ffmpeg index marker fix, layout fixes, quit deadlock fix
authorGood Guy <[email protected]>
Sun, 10 Jul 2016 23:31:04 +0000 (17:31 -0600)
committerGood Guy <[email protected]>
Sun, 10 Jul 2016 23:31:04 +0000 (17:31 -0600)
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/ffmpeg.h
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/resizetrackthread.C
cinelerra-5.1/cinelerra/tests/text2movie2
cinelerra-5.1/guicast/bclistbox.C
cinelerra-5.1/guicast/bcprogress.C
cinelerra-5.1/plugins/motion/motionwindow.C
cinelerra-5.1/plugins/titler/titlewindow.C

index fb5ef21016313563b27fd5f0fd5e6f6a550121ad..6c3789e84f5660672321a37837e72f0bddc56291 100644 (file)
@@ -240,7 +240,6 @@ FFStream::FFStream(FFMPEG *ffmpeg, AVStream *st, int fidx)
        nudge = AV_NOPTS_VALUE;
        seek_pos = curr_pos = 0;
        seeked = 1;  eof = 0;
-       index_markers = 0;
        reading = writing = 0;
        flushed = 0;
        need_packet = 1;
@@ -447,6 +446,7 @@ int FFStream::seek(int64_t no, double rate)
 // default ffmpeg native seek
        int npkts = 1;
        int64_t pos = no, plmt = -1;
+       IndexMarks *index_markers = get_markers();
        if( index_markers && index_markers->size() > 1 ) {
                IndexMarks &marks = *index_markers;
                int i = marks.find(pos);
@@ -703,11 +703,18 @@ int FFAudioStream::encode_frame(AVPacket *pkt, AVFrame *frame, int &got_packet)
 void FFAudioStream::load_markers()
 {
        IndexState *index_state = ffmpeg->file_base->asset->index_state;
-       if( index_state->marker_status == MARKERS_NOTTESTED ) return;
        if( !index_state || idx >= index_state->audio_markers.size() ) return;
+       if( index_state->marker_status == MARKERS_NOTTESTED ) return;
        FFStream::load_markers(*index_state->audio_markers[idx], sample_rate);
 }
 
+IndexMarks *FFAudioStream::get_markers()
+{
+       IndexState *index_state = ffmpeg->file_base->asset->index_state;
+       if( !index_state || idx >= index_state->audio_markers.size() ) return 0;
+       return index_state->audio_markers[idx];
+}
+
 FFVideoStream::FFVideoStream(FFMPEG *ffmpeg, AVStream *strm, int idx, int fidx)
  : FFStream(ffmpeg, strm, fidx)
 {
@@ -1041,10 +1048,17 @@ int FFVideoConvert::transfer_pixfmt(VFrame *frame,
 void FFVideoStream::load_markers()
 {
        IndexState *index_state = ffmpeg->file_base->asset->index_state;
-       if( idx >= index_state->video_markers.size() ) return;
+       if( !index_state || idx >= index_state->video_markers.size() ) return;
        FFStream::load_markers(*index_state->video_markers[idx], frame_rate);
 }
 
+IndexMarks *FFVideoStream::get_markers()
+{
+       IndexState *index_state = ffmpeg->file_base->asset->index_state;
+       if( !index_state || idx >= index_state->video_markers.size() ) return 0;
+       return !index_state ? 0 : index_state->video_markers[idx];
+}
+
 
 FFMPEG::FFMPEG(FileBase *file_base)
 {
@@ -2564,7 +2578,6 @@ printf("audio%d pad %ld %ld (%ld)\n", aud->idx, pos, aud->curr_pos, pos-aud->cur
 
 void FFStream::load_markers(IndexMarks &marks, double rate)
 {
-       index_markers = &marks;
        int in = 0;
        int64_t sz = marks.size();
        int max_entries = fmt_ctx->max_index_size / sizeof(AVIndexEntry) - 1;
index d60337fb2280fae079886751a8e423c4ea9380b6..f317d25a705cabef72c37662b7255843edca16dc 100644 (file)
@@ -95,6 +95,7 @@ public:
        virtual int create_filter(const char *filter_spec,
                AVCodecContext *src_ctx, AVCodecContext *sink_ctx) = 0;
        virtual void load_markers() = 0;
+       virtual IndexMarks *get_markers() = 0;
        int create_filter(const char *filter_spec);
        int load_filter(AVFrame *frame);
        int read_filter(AVFrame *frame);
@@ -132,7 +133,6 @@ public:
        int frm_count;
        List<FFrame> frms;
        Mutex *frm_lock;
-       IndexMarks *index_markers;
 
        int64_t nudge;
        int64_t seek_pos, curr_pos;
@@ -173,6 +173,7 @@ public:
        int create_filter(const char *filter_spec,
                AVCodecContext *src_ctx, AVCodecContext *sink_ctx);
        void load_markers();
+       IndexMarks *get_markers();
 
        int encode_activate();
        int nb_samples();
@@ -233,6 +234,7 @@ public:
        int create_filter(const char *filter_spec,
                AVCodecContext *src_ctx, AVCodecContext *sink_ctx);
        void load_markers();
+       IndexMarks *get_markers();
 
        int init_frame(AVFrame *picture);
        int load(VFrame *vframe, int64_t pos);
index 714e9dddd17d7d6b8441959f1cf1688598c1d0fb..27e0917ec7eabe59d3782ee1f8c5973d9e62fd2d 100644 (file)
@@ -339,8 +339,8 @@ MWindow::~MWindow()
 
 void MWindow::quit(int unlock)
 {
-       stop_playback(1);
        if(unlock) gui->unlock_window();
+       stop_playback(1);
 
        brender_lock->lock("MWindow::quit");
        delete brender;         brender = 0;
index 8ffd680a4a364de6fba4a8c76047e5e279dc1ee5..57dab4c8f571f0dc557738b62a0a32d34f046942 100644 (file)
@@ -103,15 +103,10 @@ ResizeVTrackWindow::ResizeVTrackWindow(MWindow *mwindow,
        int x,
        int y)
  : BC_Window(_(PROGRAM_NAME ": Resize Track"), 
-                               x - 320 / 2,
-                               y - get_resources()->ok_images[0]->get_h() + 100 / 2,
-                               340, 
-                               get_resources()->ok_images[0]->get_h() + 100, 
-                               340, 
-                               get_resources()->ok_images[0]->get_h() + 100, 
-                               0,
-                               0, 
-                               1)
+                               x - 320 / 2, y - get_resources()->ok_images[0]->get_h() + 100 / 2,
+                               400, get_resources()->ok_images[0]->get_h() + 100,
+                               400, get_resources()->ok_images[0]->get_h() + 100,
+                               0, 0, 1)
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -126,45 +121,30 @@ void ResizeVTrackWindow::create_objects()
        int x = 10, y = 10;
 
        lock_window("ResizeVTrackWindow::create_objects");
-       add_subwindow(new BC_Title(x, y, _("Size:")));
-       x += 50;
-       add_subwindow(w = new ResizeVTrackWidth(this, 
-               thread,
-               x,
-               y));
-       x += w->get_w() + 10;
-       add_subwindow(new BC_Title(x, y, _("x")));
-       x += 15;
-       add_subwindow(h = new ResizeVTrackHeight(this, 
-               thread,
-               x,
-               y));
-       x += h->get_w() + 5;
+       BC_Title *size_title = new BC_Title(x, y, _("Size:"));
+       add_subwindow(size_title);
+       int x1 = x + size_title->get_w();
+       int y1 = y + size_title->get_h() + 10;
+       BC_Title *scale_title = new BC_Title(x, y1, _("Scale:"));
+       add_subwindow(scale_title);
+       int x2 = x + scale_title->get_w();
+       if( x2 > x1 ) x1 = x2;
+       x1 += 10;
+       add_subwindow(w = new ResizeVTrackWidth(this, thread, x1, y));
+       x2 = x1 + w->get_w() + 5;
+       BC_Title *xy = new BC_Title(x2, y, _("x"));
+       add_subwindow(xy);
+       int x3 = x2 + xy->get_w() + 5;
+       add_subwindow(h = new ResizeVTrackHeight(this, thread, x3, y));
+       x = x3 + h->get_w() + 5;
        FrameSizePulldown *pulldown;
-       add_subwindow(pulldown = new FrameSizePulldown(mwindow->theme, 
-               w, 
-               h, 
-               x, 
-               y));
+       add_subwindow(pulldown = new FrameSizePulldown(mwindow->theme, w, h, x, y));
        x += pulldown->get_w() + 5;
        add_subwindow(new ResizeVTrackSwap(this, thread, x, y));
 
-
-       y += 30;
-       x = 10;
-       add_subwindow(new BC_Title(x, y, _("Scale:")));
-       x += 50;
-       add_subwindow(w_scale = new ResizeVTrackScaleW(this, 
-               thread,
-               x,
-               y));
-       x += 100;
-       add_subwindow(new BC_Title(x, y, _("x")));
-       x += 15;
-       add_subwindow(h_scale = new ResizeVTrackScaleH(this, 
-               thread,
-               x,
-               y));
+       add_subwindow(w_scale = new ResizeVTrackScaleW(this, thread, x1, y1));
+       add_subwindow(new BC_Title(x2, y1, _("x")));
+       add_subwindow(h_scale = new ResizeVTrackScaleH(this, thread, x3, y1));
 
        add_subwindow(new BC_OKButton(this));
        add_subwindow(new BC_CancelButton(this));
index 40023d2104ebf9de549ee259246d77ebbce61629..5b21ffa2bc1f78e75a16282e67e4319e796e8d52 100644 (file)
@@ -9,13 +9,13 @@ background: tree01.png
 LION
 
 # voice directory in festival/lib/voices/us/
-voice: cmu_us_bdl_arctic_hts
+voice: cmu_us_slt_arctic_hts
 # path to model file
 model: lion01
 
 HEROINE
 
-voice: nitech_us_clb_arctic_hts
+voice: nitech_us_slt_arctic_hts
 model: warrior01
 
 
index 683985feec863488fb4969639fef2f083d1423cb..1b5c66fdb077c5dc1826bdf6827c711cda96fe6e 100644 (file)
@@ -732,9 +732,10 @@ void BC_ListBox::calculate_last_coords_recursive(
 // Lowest right icon coordinate.
                                current_icon_x = item->icon_x;
                                if(current_icon_x > *icon_x) *icon_x = current_icon_x;
-                               if(current_icon_x + get_item_w(item) > *next_icon_x)
+                               if(current_icon_x + get_item_w(item) > *next_icon_x) {
                                        *next_icon_x = current_icon_x + get_item_w(item);
-
+                                       *next_icon_y = 0;
+                               }
                                current_icon_y = item->icon_y + get_item_h(item);
                                if(current_icon_y > *next_icon_y)
                                        *next_icon_y = current_icon_y;
index b2ba8cb474100d375aaaf7dae0c59d5b4ef34df8..92c3a222cc6e0f13c5e9bda9d911c9ef9b030f6b 100644 (file)
@@ -113,9 +113,12 @@ int BC_ProgressBar::draw(int force, int flush)
 
                if(do_text)
                {
+                       float pos = position > length ? (float)1 :
+                               length > 0 && position > 0 ? (float)position / length :
+                               (float)0;
                        set_font(MEDIUMFONT);
                        set_color(get_resources()->progress_text);     // draw decimal percentage
-                       sprintf(string, "%d%%", (int)(100 * (float)position / length + 0.5 / w));
+                       sprintf(string, "%d%%", (int)(100 * pos  + 0.5f));
                        draw_center_text(w / 2, h / 2 + get_text_ascent(MEDIUMFONT) / 2, string);
                }
                flash(flush);
index 6bbb9cd57a1546f97ae1f5423759512ab1ffc754..02972d15b1cbef590c20c6cb537b07387d1f1a96 100644 (file)
 
 
 MotionWindow::MotionWindow(MotionMain *plugin)
- : PluginClientWindow(plugin,
-       600,
-       650,
-       600,
-       650,
-       0)
+ : PluginClientWindow(plugin, 600, 650, 600, 650, 0)
 {
        this->plugin = plugin;
 }
index 72d91f3ed3cbd9729dc852d89df0b0777eccf98e..698edb26575146c2e01e5ec4336f537d39f4c0b0 100644 (file)
@@ -239,6 +239,7 @@ void TitleWindow::create_objects()
        pitch = new TitlePitch(client, this, x1, y2+10, &client->config.line_pitch);
        pitch->create_objects();
        x = x2 + size_tumbler->get_w() + margin;
+       int y3 = pitch->get_y() + pitch->get_h();
 
        add_tool(style_title = new BC_Title(x, y, _("Style:")));
        add_tool(italic = new TitleItalic(client, this, x, y + 20));
@@ -263,8 +264,8 @@ void TitleWindow::create_objects()
        add_tool(mid = new TitleMid(client, this, x, y + 50));
        add_tool(bottom= new TitleBottom(client, this, x, y + 80));
 
-       y += 50;
        x = 10;
+       y = y3;
 
        add_tool(x_title = new BC_Title(x, y, _("X:")));
        title_x = new TitleX(client, this, x, y + 20);