Eliminate the duplication between VideoContext::videoName and VideoContext::videoFile

Originally committed to SVN as r5969.
This commit is contained in:
Thomas Goyne 2011-12-06 00:17:54 +00:00
parent 2fa16a78c6
commit e49486201d
8 changed files with 14 additions and 16 deletions

View file

@ -151,7 +151,7 @@ struct audio_open_video : public Command {
void operator()(agi::Context *c) {
try {
c->audioController->OpenAudio(c->videoController->videoName);
c->audioController->OpenAudio(c->videoController->GetVideoName());
}
catch (agi::Exception const& e) {
wxMessageBox(lagi_wxString(e.GetChainedMessage()), "Error loading file", wxICON_ERROR | wxOK);

View file

@ -299,7 +299,7 @@ struct subtitle_open_video : public Command {
CMD_TYPE(COMMAND_VALIDATE)
void operator()(agi::Context *c) {
wxGetApp().frame->LoadSubtitles(c->videoController->videoName, "binary");
wxGetApp().frame->LoadSubtitles(c->videoController->GetVideoName(), "binary");
}
bool Validate(const agi::Context *c) {

View file

@ -480,13 +480,13 @@ struct video_frame_prev_large : public validator_video_loaded {
static void save_snapshot(agi::Context *c, bool raw) {
static const agi::OptionValue* ssPath = OPT_GET("Path/Screenshot");
wxString option = lagi_wxString(ssPath->GetString());
wxFileName videoFile(c->videoController->videoName);
wxFileName videoFile(c->videoController->GetVideoName());
wxString basepath;
// Is it a path specifier and not an actual fixed path?
if (option[0] == '?') {
// If dummy video is loaded, we can't save to the video location
if (option.StartsWith("?video") && (c->videoController->videoName.Find("?dummy") != wxNOT_FOUND)) {
if (option.StartsWith("?video") && (c->videoController->GetVideoName().Find("?dummy") != wxNOT_FOUND)) {
// So try the script location instead
option = "?script";
}

View file

@ -62,7 +62,7 @@ DialogDetachedVideo::DialogDetachedVideo(agi::Context *context, const wxSize &in
// Set obscure stuff
SetExtraStyle((GetExtraStyle() & ~wxWS_EX_BLOCK_EVENTS) | wxWS_EX_PROCESS_UI_UPDATES);
SetTitle(wxString::Format(_("Video: %s"), wxFileName(context->videoController->videoName).GetFullName()));
SetTitle(wxString::Format(_("Video: %s"), wxFileName(context->videoController->GetVideoName()).GetFullName()));
// Set a background panel
wxPanel *panel = new wxPanel(this,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL | wxCLIP_CHILDREN);

View file

@ -83,7 +83,7 @@ DialogVideoDetails::DialogVideoDetails(agi::Context *c)
double fps = c->videoController->FPS().FPS();
wxFlexGridSizer *fg = new wxFlexGridSizer(2, 5, 10);
make_field(this, fg, _("File name:"), c->videoController->videoName);
make_field(this, fg, _("File name:"), c->videoController->GetVideoName());
make_field(this, fg, _("FPS:"), wxString::Format("%.3f", fps));
make_field(this, fg, _("Resolution:"), wxString::Format("%dx%d (%s)", width, height, pretty_ar(width, height)));
make_field(this, fg, _("Length:"), wxString::Format(_("%d frames (%s)"), framecount, pretty_time_stamp(framecount, fps)));

View file

@ -606,7 +606,7 @@ void FrameMain::OnSubtitlesOpen() {
bool doLoad = false;
if (curSubsAudio != context->audioController->GetAudioURL() ||
curSubsVFR != context->videoController->GetTimecodesName() ||
curSubsVideo != context->videoController->videoName ||
curSubsVideo != context->videoController->GetVideoName() ||
curSubsKeyframes != context->videoController->GetKeyFramesName()
)
{
@ -620,7 +620,7 @@ void FrameMain::OnSubtitlesOpen() {
if (doLoad) {
// Video
if (!blockVideoLoad && curSubsVideo != context->videoController->videoName) {
if (!blockVideoLoad && curSubsVideo != context->videoController->GetVideoName()) {
context->videoController->SetVideo(curSubsVideo);
if (context->videoController->IsLoaded()) {
context->videoController->JumpToFrame(context->ass->GetScriptInfoAsInt("Video Position"));

View file

@ -119,7 +119,7 @@ void VideoContext::Reset() {
frame_n = 0;
// Clean up video data
videoName.clear();
videoFile.clear();
// Remove provider
provider.reset();
@ -188,10 +188,8 @@ void VideoContext::SetVideo(const wxString &filename) {
}
// Set filename
videoName = filename;
config::mru->Add("Video", STD_STR(filename));
wxFileName fn(filename);
StandardPaths::SetPathValue("?video",fn.GetPath());
StandardPaths::SetPathValue("?video", wxFileName(filename).GetPath());
// Get frame
frame_n = 0;
@ -256,7 +254,7 @@ void VideoContext::OnSubtitlesSave() {
else
ar = wxString::Format("%d", arType);
context->ass->SetScriptInfo("Video File", MakeRelativePath(videoName, context->ass->filename));
context->ass->SetScriptInfo("Video File", MakeRelativePath(videoFile, context->ass->filename));
context->ass->SetScriptInfo("Video Aspect Ratio", ar);
context->ass->SetScriptInfo("Video Position", wxString::Format("%d", frame_n));
context->ass->SetScriptInfo("VFR File", MakeRelativePath(GetTimecodesName(), context->ass->filename));

View file

@ -134,9 +134,6 @@ class VideoContext : public wxEvtHandler {
void Reset();
public:
/// File name of currently open video, if any
wxString videoName;
const agi::vfr::Framerate &VFR_Input;
const agi::vfr::Framerate &VFR_Output;
@ -158,6 +155,9 @@ public:
/// @brief Is there a video loaded?
bool IsLoaded() const { return !!videoProvider; }
/// Get the file name of the currently open video, if any
wxString GetVideoName() const { return videoFile; }
/// @brief Is the video currently playing?
bool IsPlaying() const { return playback.IsRunning(); }