4 * Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "assetedit.h"
25 #include "awindowgui.h"
26 #include "bcprogressbox.h"
27 #include "bcsignals.h"
28 #include "bitspopup.h"
31 #include "cplayback.h"
34 #include "edlsession.h"
37 #include "fileffmpeg.h"
38 #include "filesystem.h"
39 #include "indexable.h"
40 #include "indexfile.h"
41 #include "indexstate.h"
43 #include "mainindexes.h"
45 #include "mwindowgui.h"
48 #include "preferences.h"
49 #include "resizetrackthread.h"
50 #include "removefile.h"
52 #include "transportque.h"
53 #include "interlacemodes.h"
55 #include "edlsession.h"
61 AssetEdit::AssetEdit(MWindow *mwindow)
64 this->mwindow = mwindow;
67 changed_params = new Asset;
72 AssetEdit::~AssetEdit()
75 changed_params->remove_user();
79 void AssetEdit::edit_asset(Indexable *indexable)
82 this->indexable = indexable;
83 this->indexable->add_user();
85 // Copy asset parameters into temporary storage for editing.
86 if(indexable->is_asset)
88 changed_params->copy_from((Asset*)indexable, 0);
92 EDL *nested_edl = (EDL*)indexable;
94 strcpy(changed_params->path, nested_edl->path);
95 changed_params->sample_rate = nested_edl->session->sample_rate;
96 changed_params->channels = nested_edl->session->audio_channels;
98 //printf("AssetEdit::edit_asset %d %f\n", __LINE__, nested_edl->session->frame_rate);
99 changed_params->frame_rate = nested_edl->session->frame_rate;
100 changed_params->width = nested_edl->session->output_w;
101 changed_params->height = nested_edl->session->output_h;
104 BC_DialogThread::start();
107 void AssetEdit::handle_done_event(int result)
111 void AssetEdit::handle_close_event(int result)
118 if(indexable->is_asset) {
119 asset = (Asset*)indexable;
120 if( !changed_params->equivalent(*asset, 1, 1, mwindow->edl) )
124 nested_edl = (EDL*)indexable;
125 if( strcmp(changed_params->path, nested_edl->path)
126 // || changed_params->sample_rate != nested_edl->session->sample_rate
127 // || !EQUIV(changed_params->frame_rate, nested_edl->session->frame_rate
132 mwindow->gui->lock_window();
133 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
135 // Omit index status from copy since an index rebuild may have been
136 // happening when new_asset was created but not be happening anymore.
138 mwindow->remove_asset_from_caches(asset);
139 //printf("AssetEdit::handle_close_event %d %f\n", __LINE__, asset->get_frame_rate());
140 asset->copy_from(changed_params, 0);
141 //printf("AssetEdit::handle_close_event %d %d %d\n", __LINE__, changed_params->bits, asset->bits);
144 strcpy(nested_edl->path, changed_params->path);
145 // Other parameters can't be changed because they're defined in the other EDL
146 // nested_edl->session->frame_rate = changed_params->frame_rate;
147 // nested_edl->session->sample_rate = changed_params->sample_rate;
149 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
151 mwindow->gui->update(0, 2, 0, 0, 0, 0, 0);
152 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
154 // Start index rebuilding
155 if( (asset && asset->audio_data) || nested_edl) {
156 char source_filename[BCTEXTLEN];
157 char index_filename[BCTEXTLEN];
158 IndexFile::get_index_filename(source_filename,
159 mwindow->preferences->index_directory,
162 remove_file(index_filename);
163 indexable->index_state->index_status = INDEX_NOTTESTED;
164 mwindow->mainindexes->add_next_asset(0, indexable);
165 mwindow->mainindexes->start_build();
167 mwindow->gui->unlock_window();
168 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
169 mwindow->awindow->gui->update_picon(indexable);
170 mwindow->awindow->gui->async_update_assets();
172 mwindow->restart_brender();
173 mwindow->sync_parameters(CHANGE_ALL);
174 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
178 this->indexable->remove_user();
180 //printf("AssetEdit::handle_close_event %d\n", __LINE__);
183 BC_Window* AssetEdit::new_gui()
185 window = new AssetEditWindow(mwindow, this);
186 window->create_objects();
190 int AssetEdit::window_height()
193 if( indexable->have_audio() )
195 if( indexable->have_video() ) {
197 if( indexable->is_asset ) {
198 Asset *asset = (Asset *)indexable;
199 if( asset->format == FILE_MPEG ||
200 asset->format == FILE_FFMPEG ) {
208 AssetEditWindow::AssetEditWindow(MWindow *mwindow, AssetEdit *asset_edit)
209 : BC_Window(_(PROGRAM_NAME ": Asset Info"),
210 mwindow->gui->get_abs_cursor_x(1) - 400 / 2,
211 mwindow->gui->get_abs_cursor_y(1) - asset_edit->window_height() / 2,
212 450, asset_edit->window_height(), 0, 0, 1)
214 this->mwindow = mwindow;
215 this->asset_edit = asset_edit;
231 AssetEditWindow::~AssetEditWindow()
233 lock_window("AssetEditWindow::~AssetEditWindow");
234 if(bitspopup) delete bitspopup;
235 if(detail_thread) delete detail_thread;
242 void AssetEditWindow::create_objects()
244 int y = 10, x = 10, x1 = 10, x2 = 190;
245 char string[BCTEXTLEN];
249 BC_TextBox *textboxw;
250 BC_ListBox *listboxw;
251 Interlaceautofix *ilacefixoption_chkboxw;
255 if(asset_edit->indexable->is_asset)
256 asset = (Asset*)asset_edit->indexable;
258 nested_edl = (EDL*)asset_edit->indexable;
260 if(asset && asset->format == FILE_PCM)
265 lock_window("AssetEditWindow::create_objects");
271 add_subwindow(path_text = new AssetEditPathText(this, y));
272 add_subwindow(path_button = new AssetEditPath(mwindow,
276 asset_edit->indexable->path,
277 _(PROGRAM_NAME ": Asset path"), _("Select a file for this asset:")));
282 add_subwindow(new BC_Title(x, y, _("File format:")));
284 add_subwindow(new BC_Title(x, y, File::formattostr(mwindow->plugindb,
287 mwindow->theme->assetedit_color));
291 int64_t bytes = fs.get_size(asset->path);
292 add_subwindow(new BC_Title(x, y, _("Bytes:")));
293 sprintf(string, "%jd", bytes);
294 Units::punctuate(string);
297 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
298 if(asset->format == FILE_MPEG || asset->format == FILE_FFMPEG)
300 detail_thread = new DetailAssetThread(mwindow);
301 BC_GenericButton *detail = new DetailAssetButton(this, x2+120, y);
302 add_subwindow(detail);
312 if(asset->audio_length > 0)
313 length = (double)asset->audio_length / asset->sample_rate;
314 if(asset->video_length > 0)
315 length = MAX(length, (double)asset->video_length / asset->frame_rate);
317 if(!EQUIV(length, 0))
318 bitrate = (int64_t)(bytes * 8 / length);
321 add_subwindow(new BC_Title(x, y, _("Bitrate (bits/sec):")));
322 sprintf(string, "%jd", bitrate);
324 Units::punctuate(string);
325 add_subwindow(new BC_Title(x2, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
331 if((asset && asset->audio_data) || nested_edl)
333 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
336 add_subwindow(new BC_Title(x, y, _("Audio:"), LARGEFONT, RED));
342 if(asset->get_compression_text(1, 0))
344 add_subwindow(new BC_Title(x, y, _("Compression:")));
346 add_subwindow(new BC_Title(x,
348 asset->get_compression_text(1, 0),
350 mwindow->theme->assetedit_color));
356 add_subwindow(new BC_Title(x, y, _("Channels:")));
357 sprintf(string, "%d", asset_edit->changed_params->channels);
362 BC_TumbleTextBox *textbox = new AssetEditChannels(this,
366 textbox->create_objects();
371 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
376 add_subwindow(new BC_Title(x, y, _("Sample rate:")));
377 sprintf(string, "%d", asset_edit->changed_params->sample_rate);
383 add_subwindow(textbox = new AssetEditRate(this, string, x, y));
384 x += textbox->get_w();
385 add_subwindow(new SampleRatePulldown(mwindow, textbox, x, y));
389 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
397 add_subwindow(new BC_Title(x, y, _("Bits:")));
401 bitspopup = new BitsPopup(this,
404 &asset_edit->changed_params->bits,
410 bitspopup->create_objects();
413 add_subwindow(new BC_Title(x, y, File::bitstostr(asset->bits), MEDIUMFONT, mwindow->theme->assetedit_color));
418 add_subwindow(new BC_Title(x, y, _("Header length:")));
419 sprintf(string, "%d", asset->header);
423 add_subwindow(new AssetEditHeader(this, string, x, y));
425 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
430 add_subwindow(new BC_Title(x, y, _("Byte order:")));
436 add_subwindow(lohi = new AssetEditByteOrderLOHI(this,
441 add_subwindow(hilo = new AssetEditByteOrderHILO(this,
450 if(asset->byte_order)
451 add_subwindow(new BC_Title(x, y, _("Lo-Hi"), MEDIUMFONT, mwindow->theme->assetedit_color));
453 add_subwindow(new BC_Title(x, y, _("Hi-Lo"), MEDIUMFONT, mwindow->theme->assetedit_color));
461 // add_subwindow(new BC_Title(x, y, _("Values are signed:")));
462 add_subwindow(new AssetEditSigned(this, asset->signed_, x, y));
466 if(!asset->signed_ && asset->bits == 8)
467 add_subwindow(new BC_Title(x, y, _("Values are unsigned")));
469 add_subwindow(new BC_Title(x, y, _("Values are signed")));
477 if((asset && asset->video_data) || nested_edl)
479 add_subwindow(new BC_Bar(x, y, get_w() - x * 2));
482 add_subwindow(new BC_Title(x, y, _("Video:"), LARGEFONT, RED));
487 if(asset && asset->get_compression_text(0,1))
489 add_subwindow(new BC_Title(x, y, _("Compression:")));
491 add_subwindow(new BC_Title(x,
493 asset->get_compression_text(0,1),
495 mwindow->theme->assetedit_color));
500 add_subwindow(new BC_Title(x, y, _("Frame rate:")));
502 sprintf(string, "%.4f", asset_edit->changed_params->frame_rate);
504 //printf("AssetEditWindow::create_objects %d %f\n", __LINE__, asset_edit->changed_params->frame_rate);
507 BC_TextBox *framerate;
508 add_subwindow(framerate = new AssetEditFRate(this, string, x, y));
510 add_subwindow(new FrameRatePulldown(mwindow, framerate, x, y));
514 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
519 add_subwindow(new BC_Title(x, y, _("Width:")));
521 sprintf(string, "%d", asset_edit->changed_params->width);
522 win_width = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
523 add_subwindow(win_width);
527 add_subwindow(new BC_Title(x, y, _("Height:")));
529 sprintf(string, "%d", asset_edit->changed_params->height);
530 win_height = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
531 add_subwindow(win_height);
532 y += win_height->get_h() + 5;
534 if(asset && (asset->format == FILE_MPEG || asset->format == FILE_FFMPEG ) )
538 add_subwindow(new BC_Title(x, y, _("Actual width:")));
540 sprintf(string, "%d", asset->actual_width);
541 add_subwindow(new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color));
543 BC_GenericButton *resize = new ResizeAssetButton(this, x+64, y);
544 add_subwindow(resize);
548 add_subwindow(new BC_Title(x, y, _("Actual height:")));
550 sprintf(string, "%d", asset->actual_height);
551 title = new BC_Title(x, y, string, MEDIUMFONT, mwindow->theme->assetedit_color);
552 add_subwindow(title);
553 y += title->get_h() + 5;
556 // --------------------
557 add_subwindow(title = new BC_Title(x1, y, _("Fix interlacing:")));
558 add_subwindow(ilacefixoption_chkboxw = new Interlaceautofix(mwindow,this, x2, y));
559 y += ilacefixoption_chkboxw->get_h() + 5;
560 // --------------------
561 add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:")));
562 add_subwindow(textboxw = new AssetEditILacemode(this, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200));
563 ilacefixoption_chkboxw->ilacemode_textbox = textboxw;
564 add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow,
566 &asset_edit->changed_params->interlace_mode,
567 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_modes,
568 ilacefixoption_chkboxw,
569 x2 + textboxw->get_w(),
571 ilacefixoption_chkboxw->ilacemode_listbox = listboxw;
572 y += textboxw->get_h() + 5;
574 // --------------------
575 add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:")));
576 add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", ILACE_FIXDEFAULT, x2, y, 200));
577 ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw;
578 add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow,
580 &asset_edit->changed_params->interlace_fixmethod,
581 (ArrayList<BC_ListBoxItem*>*)&mwindow->interlace_asset_fixmethods,
582 x2 + textboxw->get_w(),
584 ilacefixoption_chkboxw->ilacefixmethod_listbox = listboxw;
585 ilacefixoption_chkboxw->showhideotherwidgets();
586 y += textboxw->get_h() + 5;
589 add_subwindow(new BC_OKButton(this));
590 add_subwindow(new BC_CancelButton(this));
595 void AssetEditWindow::show_info_detail()
597 detail_thread->start((Asset*)asset_edit->indexable);
601 AssetEditChannels::AssetEditChannels(AssetEditWindow *fwindow,
605 : BC_TumbleTextBox(fwindow,
613 this->fwindow = fwindow;
616 int AssetEditChannels::handle_event()
618 Asset *asset = fwindow->asset_edit->changed_params;
619 asset->channels = atol(get_text());
623 AssetEditRate::AssetEditRate(AssetEditWindow *fwindow, char *text, int x, int y)
624 : BC_TextBox(x, y, 100, 1, text)
626 this->fwindow = fwindow;
629 int AssetEditRate::handle_event()
631 Asset *asset = fwindow->asset_edit->changed_params;
632 asset->sample_rate = atol(get_text());
636 AssetEditFRate::AssetEditFRate(AssetEditWindow *fwindow, char *text, int x, int y)
637 : BC_TextBox(x, y, 100, 1, text)
639 this->fwindow = fwindow;
642 int AssetEditFRate::handle_event()
644 Asset *asset = fwindow->asset_edit->changed_params;
645 asset->frame_rate = atof(get_text());
649 Interlaceautofix::Interlaceautofix(MWindow *mwindow,AssetEditWindow *fwindow, int x, int y)
651 fwindow->asset_edit->changed_params->interlace_autofixoption,
652 _("Automatically Fix Interlacing"))
654 this->fwindow = fwindow;
655 this->mwindow = mwindow;
658 Interlaceautofix::~Interlaceautofix()
662 int Interlaceautofix::handle_event()
664 Asset *asset = fwindow->asset_edit->changed_params;
665 asset->interlace_autofixoption = get_value();
666 showhideotherwidgets();
670 void Interlaceautofix::showhideotherwidgets()
672 int thevalue = get_value();
674 Asset *asset = fwindow->asset_edit->changed_params;
675 if (thevalue == ILACE_AUTOFIXOPTION_AUTO)
677 this->ilacemode_textbox->enable();
678 this->ilacemode_listbox->enable();
679 this->ilacefixmethod_textbox->disable();
680 this->ilacefixmethod_listbox->disable();
681 int xx = ilaceautofixmethod(mwindow->edl->session->interlace_mode,asset->interlace_mode);
682 ilacefixmethod_to_text(string,xx);
683 this->ilacefixmethod_textbox->update(string);
685 if (thevalue == ILACE_AUTOFIXOPTION_MANUAL)
687 this->ilacemode_textbox->disable();
688 this->ilacemode_listbox->disable();
689 this->ilacefixmethod_textbox->enable();
690 this->ilacefixmethod_listbox->enable();
691 ilacefixmethod_to_text(string,asset->interlace_fixmethod);
692 this->ilacefixmethod_textbox->update(string);
696 InterlacefixmethodItem::InterlacefixmethodItem(const char *text, int value)
697 : BC_ListBoxItem(text)
702 InterlacefixmethodPulldown::InterlacefixmethodPulldown(MWindow *mwindow,
703 BC_TextBox *output_text, int *output_value,
704 ArrayList<BC_ListBoxItem*> *data, int x, int y)
705 : BC_ListBox(x, y, 200, 150, LISTBOX_TEXT, data, 0, 0, 1, 0, 1)
707 this->mwindow = mwindow;
708 this->output_text = output_text;
709 this->output_value = output_value;
710 output_text->update(interlacefixmethod_to_text());
713 int InterlacefixmethodPulldown::handle_event()
715 output_text->update(get_selection(0, 0)->get_text());
716 *output_value = ((InterlacefixmethodItem*)get_selection(0, 0))->value;
720 const char* InterlacefixmethodPulldown::interlacefixmethod_to_text()
722 ilacefixmethod_to_text(this->string,*output_value);
723 return (this->string);
726 AssetEditILaceautofixoption::AssetEditILaceautofixoption(AssetEditWindow *fwindow, char *text, int thedefault, int x, int y, int w)
727 : BC_TextBox(x, y, w, 1, text)
729 this->fwindow = fwindow;
730 this->thedefault = thedefault;
733 int AssetEditILaceautofixoption::handle_event()
735 Asset *asset = fwindow->asset_edit->changed_params;
736 asset->interlace_autofixoption = ilaceautofixoption_from_text(get_text(), this->thedefault);
741 AssetEditILacemode::AssetEditILacemode(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
742 : BC_TextBox(x, y, w, 1, text)
744 this->fwindow = fwindow;
745 this->thedefault = thedefault;
748 int AssetEditILacemode::handle_event()
750 Asset *asset = fwindow->asset_edit->changed_params;
751 asset->interlace_mode = ilacemode_from_text(get_text(),this->thedefault);
755 AssetEditInterlacemodePulldown::AssetEditInterlacemodePulldown(MWindow *mwindow,
756 BC_TextBox *output_text,
758 ArrayList<BC_ListBoxItem*> *data,
759 Interlaceautofix *fixoption_chkboxw,
774 this->fixoption_chkbox = fixoption_chkboxw;
775 this->mwindow = mwindow;
776 this->output_text = output_text;
777 this->output_value = output_value;
778 output_text->update(interlacemode_to_text());
781 int AssetEditInterlacemodePulldown::handle_event()
783 output_text->update(get_selection(0, 0)->get_text());
784 *output_value = ((InterlacemodeItem*)get_selection(0, 0))->value;
785 fixoption_chkbox->showhideotherwidgets();
789 char* AssetEditInterlacemodePulldown::interlacemode_to_text()
791 ilacemode_to_text(this->string,*output_value);
792 return (this->string);
795 AssetEditILacefixmethod::AssetEditILacefixmethod(AssetEditWindow *fwindow, const char *text, int thedefault, int x, int y, int w)
796 : BC_TextBox(x, y, w, 1, text)
798 this->fwindow = fwindow;
799 this->thedefault = thedefault;
802 int AssetEditILacefixmethod::handle_event()
804 Asset *asset = fwindow->asset_edit->changed_params;
805 asset->interlace_fixmethod = ilacefixmethod_from_text(get_text(),this->thedefault);
809 AssetEditHeader::AssetEditHeader(AssetEditWindow *fwindow, char *text, int x, int y)
810 : BC_TextBox(x, y, 100, 1, text)
812 this->fwindow = fwindow;
815 int AssetEditHeader::handle_event()
817 Asset *asset = fwindow->asset_edit->changed_params;
818 asset->header = atol(get_text());
822 AssetEditByteOrderLOHI::AssetEditByteOrderLOHI(AssetEditWindow *fwindow,
826 : BC_Radial(x, y, value, _("Lo-Hi"))
828 this->fwindow = fwindow;
831 int AssetEditByteOrderLOHI::handle_event()
833 Asset *asset = fwindow->asset_edit->changed_params;
834 asset->byte_order = 1;
835 fwindow->hilo->update(0);
840 AssetEditByteOrderHILO::AssetEditByteOrderHILO(AssetEditWindow *fwindow,
844 : BC_Radial(x, y, value, _("Hi-Lo"))
846 this->fwindow = fwindow;
849 int AssetEditByteOrderHILO::handle_event()
851 Asset *asset = fwindow->asset_edit->changed_params;
852 asset->byte_order = 0;
853 fwindow->lohi->update(0);
858 AssetEditSigned::AssetEditSigned(AssetEditWindow *fwindow,
862 : BC_CheckBox(x, y, value, _("Values are signed"))
864 this->fwindow = fwindow;
867 int AssetEditSigned::handle_event()
869 Asset *asset = fwindow->asset_edit->changed_params;
870 asset->signed_ = get_value();
880 AssetEditPathText::AssetEditPathText(AssetEditWindow *fwindow, int y)
881 : BC_TextBox(5, y, 300, 1, fwindow->asset_edit->changed_params->path)
883 this->fwindow = fwindow;
885 AssetEditPathText::~AssetEditPathText()
888 int AssetEditPathText::handle_event()
890 strcpy(fwindow->asset_edit->changed_params->path, get_text());
894 AssetEditPath::AssetEditPath(MWindow *mwindow, AssetEditWindow *fwindow,
895 BC_TextBox *textbox, int y, const char *text,
896 const char *window_title, const char *window_caption)
897 : BrowseButton(mwindow->theme, fwindow, textbox, 310, y, text,
898 window_title, window_caption, 0)
900 this->fwindow = fwindow;
903 AssetEditPath::~AssetEditPath() {}
910 AssetEditFormat::AssetEditFormat(AssetEditWindow *fwindow, char* default_, int y)
911 : FormatPopup(fwindow->mwindow->plugindb, 90, y)
913 this->fwindow = fwindow;
915 AssetEditFormat::~AssetEditFormat()
918 int AssetEditFormat::handle_event()
920 Asset *asset = fwindow->asset_edit->changed_params;
921 asset->format = File::strtoformat(fwindow->mwindow->plugindb,
922 get_selection(0, 0)->get_text());
929 DetailAssetButton::DetailAssetButton(AssetEditWindow *fwindow, int x, int y)
930 : BC_GenericButton(x, y, _("Detail"))
932 this->fwindow = fwindow;
936 DetailAssetButton::~DetailAssetButton()
940 int DetailAssetButton::handle_event()
942 fwindow->show_info_detail();
946 DetailAssetWindow::DetailAssetWindow(MWindow *mwindow, Asset *asset)
947 : BC_Window(_("Asset Detail"),
948 mwindow->gui->get_abs_cursor_x(1) - 600/2,
949 mwindow->gui->get_abs_cursor_y(1) - 500/2,
952 this->mwindow = mwindow;
959 DetailAssetWindow::~DetailAssetWindow()
961 asset->remove_user();
965 DetailAssetThread::DetailAssetThread(MWindow *mwindow)
968 this->mwindow = mwindow;
972 DetailAssetThread::~DetailAssetThread()
977 void DetailAssetThread::stop()
979 if( Thread::running() ) {
980 dwindow->lock_window("DetailAssetThread::stop");
981 dwindow->set_done(1);
982 dwindow->unlock_window();
987 void DetailAssetWindow::create_objects()
990 char file_name[BCTEXTLEN];
991 int len = sizeof(info);
992 strncpy(info,_("no info available"),len);
993 if( !mwindow->preferences->get_asset_file_path(asset, file_name) ) {
994 switch( asset->format ) {
996 FileMPEG::get_info(asset->path, file_name, &info[0],len);
999 FileFFMPEG::get_info(asset->path, &info[0],len);
1003 lock_window("DetailAssetThread::create_objects");
1004 text = new BC_ScrollTextBox(this, x, y, get_w()-32, 23, info, -len);
1005 text->create_objects(); text->set_text_row(0);
1006 add_subwindow(new BC_OKButton(this));
1011 void DetailAssetThread::start(Asset *asset)
1015 dwindow = new DetailAssetWindow(mwindow, asset);
1019 void DetailAssetThread::run()
1021 // Get length from TOC
1022 dwindow->create_objects();
1023 dwindow->run_window();