From: Good Guy Date: Sun, 10 Jul 2016 23:31:04 +0000 (-0600) Subject: ffmpeg index marker fix, layout fixes, quit deadlock fix X-Git-Url: http://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=318256a48938064b695268d03396977739ef4724;p=goodguy%2Fhistory.git ffmpeg index marker fix, layout fixes, quit deadlock fix --- diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C index fb5ef210..6c3789e8 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.C +++ b/cinelerra-5.1/cinelerra/ffmpeg.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/ffmpeg.h b/cinelerra-5.1/cinelerra/ffmpeg.h index d60337fb..f317d25a 100644 --- a/cinelerra-5.1/cinelerra/ffmpeg.h +++ b/cinelerra-5.1/cinelerra/ffmpeg.h @@ -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 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); diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 714e9ddd..27e0917e 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -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; diff --git a/cinelerra-5.1/cinelerra/resizetrackthread.C b/cinelerra-5.1/cinelerra/resizetrackthread.C index 8ffd680a..57dab4c8 100644 --- a/cinelerra-5.1/cinelerra/resizetrackthread.C +++ b/cinelerra-5.1/cinelerra/resizetrackthread.C @@ -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)); diff --git a/cinelerra-5.1/cinelerra/tests/text2movie2 b/cinelerra-5.1/cinelerra/tests/text2movie2 index 40023d21..5b21ffa2 100644 --- a/cinelerra-5.1/cinelerra/tests/text2movie2 +++ b/cinelerra-5.1/cinelerra/tests/text2movie2 @@ -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 diff --git a/cinelerra-5.1/guicast/bclistbox.C b/cinelerra-5.1/guicast/bclistbox.C index 683985fe..1b5c66fd 100644 --- a/cinelerra-5.1/guicast/bclistbox.C +++ b/cinelerra-5.1/guicast/bclistbox.C @@ -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; diff --git a/cinelerra-5.1/guicast/bcprogress.C b/cinelerra-5.1/guicast/bcprogress.C index b2ba8cb4..92c3a222 100644 --- a/cinelerra-5.1/guicast/bcprogress.C +++ b/cinelerra-5.1/guicast/bcprogress.C @@ -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); diff --git a/cinelerra-5.1/plugins/motion/motionwindow.C b/cinelerra-5.1/plugins/motion/motionwindow.C index 6bbb9cd5..02972d15 100644 --- a/cinelerra-5.1/plugins/motion/motionwindow.C +++ b/cinelerra-5.1/plugins/motion/motionwindow.C @@ -36,12 +36,7 @@ MotionWindow::MotionWindow(MotionMain *plugin) - : PluginClientWindow(plugin, - 600, - 650, - 600, - 650, - 0) + : PluginClientWindow(plugin, 600, 650, 600, 650, 0) { this->plugin = plugin; } diff --git a/cinelerra-5.1/plugins/titler/titlewindow.C b/cinelerra-5.1/plugins/titler/titlewindow.C index 72d91f3e..698edb26 100644 --- a/cinelerra-5.1/plugins/titler/titlewindow.C +++ b/cinelerra-5.1/plugins/titler/titlewindow.C @@ -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);