Ticket #6497: mediaconv2.diff
File mediaconv2.diff, 4.2 KB (added by , 14 years ago) |
---|
-
src/apps/mediaconverter/MediaConverterWindow.cpp
271 271 MediaConverterWindow::MessageReceived(BMessage* msg) 272 272 { 273 273 status_t status; 274 entry_ref ref;275 274 entry_ref inRef; 276 275 277 276 BString string, string2; 278 277 279 // TODO: For preview, launch the default file app instead of hardcoded280 // MediaPlayer281 BEntry entry("/boot/system/apps/MediaPlayer", true);282 278 char buffer[40]; 283 279 char buffer2[B_PATH_NAME_LENGTH]; 284 280 const char* argv[3]; … … 431 427 break; 432 428 433 429 case PREVIEW_MESSAGE: 434 entry.GetRef(&ref);435 430 string = ""; 436 431 string << fStartDurationTC->Text(); 437 432 string << "000"; … … 450 445 argv[2] = buffer2; 451 446 } 452 447 453 status = be_roster->Launch(&ref, 3, argv); 448 status = be_roster->Launch( 449 "application/x-vnd.Haiku-MediaPlayer", 450 3, (char**)argv, NULL); 454 451 455 if (status != B_OK ) {452 if (status != B_OK && status != B_ALREADY_RUNNING) { 456 453 string2 << LAUNCH_ERROR << strerror(status); 457 454 (new BAlert("", string2.String(), OK_LABEL))->Go(); 458 455 } … … 756 753 fStartDurationTC->SetEnabled(enabled); 757 754 fEndDurationTC->SetEnabled(enabled); 758 755 759 fInfoView->Update(file, _ref); 756 if (enabled) 757 fInfoView->Update(file, _ref); 760 758 761 759 // HACK: get the fInfoView to update the duration "synchronously" 762 760 UpdateIfNeeded(); -
src/apps/mediaconverter/MediaConverterApp.cpp
10 10 #include <string.h> 11 11 12 12 #include <Alert.h> 13 #include <fs_attr.h> 13 14 #include <MediaFile.h> 14 15 #include <MediaTrack.h> 15 16 #include <Mime.h> … … 105 106 // from Open dialog or drag & drop 106 107 107 108 while (msg->FindRef("refs", i++, &ref) == B_OK) { 109 108 110 uint32 flags = 0; // B_MEDIA_FILE_NO_READ_AHEAD 109 111 BMediaFile* file = new(std::nothrow) BMediaFile(&ref, flags); 112 110 113 if (file == NULL || file->InitCheck() != B_OK) { 111 114 errorFiles << ref.name << "\n"; 112 115 errors++; … … 122 125 123 126 if (errors) { 124 127 BString alertText; 125 alertText << errors << ((errors > 1) ? FILES : FILE)128 alertText << errors << " " << ((errors > 1) ? FILES : FILE) 126 129 << NOTRECOGNIZE << "\n"; 127 130 alertText << errorFiles; 128 131 BAlert* alert = new BAlert(ERROR_LOAD_STRING, alertText.String(), … … 175 178 176 179 // #pragma mark - 177 180 178 179 181 BEntry 180 182 MediaConverterApp::_CreateOutputFile(BDirectory directory, 181 183 entry_ref* ref, media_file_format* outputFormat) -
src/apps/mediaconverter/MediaConverterApp.h
37 37 BEntry _CreateOutputFile(BDirectory directory, 38 38 entry_ref* ref, 39 39 media_file_format* outputFormat); 40 40 41 41 static int32 _RunConvertEntry(void* castToMediaConverterApp); 42 42 void _RunConvert(); 43 43 status_t _ConvertFile(BMediaFile* inFile, -
src/apps/mediaconverter/MediaFileInfoView.cpp
151 151 152 152 fMediaFile = file; 153 153 154 if (file != NULL && ref != NULL) 154 if (file != NULL && ref != NULL) { 155 155 fRef = *ref; 156 else 156 status_t ret = fInfo.LoadInfo(file); 157 if (ret != B_OK) { 158 BString error("An error has occurred reading the " 159 "file info.\n\nError : "); 160 error << strerror(ret); 161 BAlert* alert = new BAlert("File Error", error.String(), 162 "OK"); 163 alert->Go(NULL); 164 } 165 } else { 157 166 fRef = entry_ref(); 158 159 status_t ret = fInfo.LoadInfo(file);160 if (ret != B_OK) {161 BString error("An error has occurred reading the "162 "file info.\n\nError : ");163 error << strerror(ret);164 BAlert* alert = new BAlert("File Error", error.String(),165 "OK");166 alert->Go(NULL);167 167 } 168 169 168 InvalidateLayout(); 170 169 Invalidate(); 171 170 }