diff --git a/core/dialog_properties.cpp b/core/dialog_properties.cpp index 623111ac0..d542e7292 100644 --- a/core/dialog_properties.cpp +++ b/core/dialog_properties.cpp @@ -41,6 +41,7 @@ #include "ass_file.h" #include "video_display.h" #include "validators.h" +#include "video_provider.h" /////////////// diff --git a/core/dialog_resample.cpp b/core/dialog_resample.cpp index 850ef3e5e..05d6d601b 100644 --- a/core/dialog_resample.cpp +++ b/core/dialog_resample.cpp @@ -44,6 +44,7 @@ #include "subs_grid.h" #include "validators.h" #include "video_display.h" +#include "video_provider.h" /////////////// diff --git a/core/fextracker_main_events.cpp b/core/fextracker_main_events.cpp index 464074ce7..e60d0cbde 100644 --- a/core/fextracker_main_events.cpp +++ b/core/fextracker_main_events.cpp @@ -14,35 +14,14 @@ #include #include "subs_grid.h" #include "frame_main.h" +#include "video_provider_avs.h" #include "video_display.h" -#include "video_slider.h" -#include "video_zoom.h" #include "video_box.h" #include "ass_file.h" -#include "dialog_style_manager.h" -#include "dialog_translation.h" -#include "dialog_jumpto.h" -#include "dialog_shift_times.h" -#include "dialog_search_replace.h" +#include "ass_dialogue.h" #include "vfr.h" #include "subs_edit_box.h" #include "options.h" -#include "dialog_properties.h" -#include "main.h" -#include "fonts_collector.h" -#include "about.h" -#include "automation_gui.h" -#include "dialog_export.h" -#include "audio_box.h" -#include "aspell_wrap.h" -#include "dialog_spellcheck.h" -#include "dialog_selection.h" -#include "dialog_styling_assistant.h" -#include "dialog_resample.h" -#include "audio_display.h" -#include "toggle_bitmap.h" -#include "dialog_hotkeys.h" -#include "dialog_timing_processor.h" #include "FexTracker.h" #include "FexTrackingFeature.h" #include "FexMovement.h" @@ -97,7 +76,7 @@ void FrameMain::OnVideoTrackPoints(wxCommandEvent &event) { // Get Video bool usedDirectshow; - VideoProvider *movie = new AvisynthVideoProvider(videoBox->videoDisplay->videoName, wxString(_T("")), 1.0,usedDirectshow,true); + VideoProvider *movie = new AvisynthVideoProvider(videoBox->videoDisplay->videoName, wxString(_T("")), 1.0,usedDirectshow); // Create Tracker if( curline->Tracker ) delete curline->Tracker; diff --git a/core/frame_main.cpp b/core/frame_main.cpp index 91c5ea74c..5ea05e3c6 100644 --- a/core/frame_main.cpp +++ b/core/frame_main.cpp @@ -43,7 +43,9 @@ #include #include "subs_grid.h" #include "frame_main.h" +#include "avisynth_wrap.h" #include "video_display.h" +#include "video_provider.h" #include "video_slider.h" #include "video_zoom.h" #include "ass_file.h" diff --git a/core/video_display.cpp b/core/video_display.cpp index 93515bc28..be3f64040 100644 --- a/core/video_display.cpp +++ b/core/video_display.cpp @@ -37,6 +37,8 @@ //////////// // Includes #include "video_display.h" +#include "video_provider_avs.h" +#include "video_provider_lavc.h" #include "vfr.h" #include "ass_file.h" #include "ass_time.h" @@ -155,9 +157,13 @@ void VideoDisplay::SetVideo(const wxString &filename) { try { grid->CommitChanges(true); - bool usedDirectshow; + bool usedDirectshow = false; - provider = new AvisynthVideoProvider(filename,GetTempWorkFile(),zoomValue,usedDirectshow,true); + #ifndef USE_LAVC + provider = new AvisynthVideoProvider(filename,GetTempWorkFile(),zoomValue,usedDirectshow); + #else + provider = new LAVCVideoProvider(filename,GetTempWorkFile(),zoomValue); + #endif // Set keyframes wxString ext = filename.Right(4).Lower(); diff --git a/core/video_display.h b/core/video_display.h index 7c64fa0b7..7f4b12650 100644 --- a/core/video_display.h +++ b/core/video_display.h @@ -43,7 +43,6 @@ #include #include #include -#include "video_provider_avs.h" ////////////// diff --git a/core/video_provider_avs.cpp b/core/video_provider_avs.cpp index ad83ba5a2..15df3c1a0 100644 --- a/core/video_provider_avs.cpp +++ b/core/video_provider_avs.cpp @@ -40,7 +40,8 @@ #include "main.h" -AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow, bool mpeg2dec3_priority) { +AvisynthVideoProvider::AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow) { + bool mpeg2dec3_priority = true; RGB32Video = NULL; SubtitledVideo = NULL; ResizedVideo = NULL; diff --git a/core/video_provider_avs.h b/core/video_provider_avs.h index 4541efcbe..d1a500b43 100644 --- a/core/video_provider_avs.h +++ b/core/video_provider_avs.h @@ -77,7 +77,7 @@ private: void LoadVSFilter(); public: - AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow, bool mpeg2dec3_priority = true); + AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow); ~AvisynthVideoProvider(); void RefreshSubtitles(); diff --git a/core/video_provider_lavc.cpp b/core/video_provider_lavc.cpp new file mode 100644 index 000000000..be4cc7dca --- /dev/null +++ b/core/video_provider_lavc.cpp @@ -0,0 +1,153 @@ +// Copyright (c) 2006, Rodrigo Braz Monteiro +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the Aegisub Group nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// AEGISUB +// +// Website: http://aegisub.cellosoft.com +// Contact: mailto:zeratul@cellosoft.com +// + + +/////////// +// Headers +#ifdef USE_LAVC +#define EMULATE_INTTYPES +#include +#include +#include +#include "video_provider_lavc.h" + + +/////////////// +// Constructor +LAVCVideoProvider::LAVCVideoProvider(wxString filename, wxString subfilename, double zoom) { + // Register types + static bool avRegistered = false; + if (!avRegistered) { + av_register_all(); + avRegistered = true; + } +} + + +////////////// +// Destructor +LAVCVideoProvider::~LAVCVideoProvider() { +} + + +// +// +void LAVCVideoProvider::RefreshSubtitles() { +} + + +// +// +wxBitmap LAVCVideoProvider::GetFrame(int n) { + wxBitmap frame; + return frame; +} + + +// +// +void LAVCVideoProvider::GetFloatFrame(float* Buffer, int n) { +} + + +// +// +int LAVCVideoProvider::GetPosition() { + return 0; +} + + +// +// +int LAVCVideoProvider::GetFrameCount() { + return 0; +} + + +// +// +double LAVCVideoProvider::GetFPS() { + return 1; +} + + +// +// +void LAVCVideoProvider::SetDAR(double dar) { +} + + +// +// +void LAVCVideoProvider::SetZoom(double zoom) { +} + + +// +// +int LAVCVideoProvider::GetWidth() { + return 640; +} + + +// +// +int LAVCVideoProvider::GetHeight() { + return 480; +} + + +// +// +double LAVCVideoProvider::GetZoom() { + return 1; +} + + +// +// +int LAVCVideoProvider::GetSourceWidth() { + return 640; +} + + +// +// +int LAVCVideoProvider::GetSourceHeight() { + return 480; +} + + +#endif diff --git a/core/video_provider_lavc.h b/core/video_provider_lavc.h new file mode 100644 index 000000000..6f6ef04b6 --- /dev/null +++ b/core/video_provider_lavc.h @@ -0,0 +1,71 @@ +// Copyright (c) 2006, Rodrigo Braz Monteiro +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of the Aegisub Group nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +// +// ----------------------------------------------------------------------------- +// +// AEGISUB +// +// Website: http://aegisub.cellosoft.com +// Contact: mailto:zeratul@cellosoft.com +// + +#pragma once + + +/////////// +// Headers +#ifdef USE_LAVC +#include "video_provider.h" + + +/////////////////////// +// LibAVCodec provider +class LAVCVideoProvider : public VideoProvider { +public: + LAVCVideoProvider(wxString filename, wxString subfilename, double zoom); + ~LAVCVideoProvider(); + + void RefreshSubtitles(); + + wxBitmap GetFrame(int n); + void GetFloatFrame(float* Buffer, int n); + + int GetPosition(); + int GetFrameCount(); + double GetFPS(); + + void SetDAR(double dar); + void SetZoom(double zoom); + int GetWidth(); + int GetHeight(); + double GetZoom(); + + int GetSourceWidth(); + int GetSourceHeight(); +}; + +#endif