Early LAVC implementation

Originally committed to SVN as r141.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-24 02:54:30 +00:00
parent 5d1d949f75
commit 02219d1e8b
10 changed files with 242 additions and 29 deletions

View File

@ -41,6 +41,7 @@
#include "ass_file.h" #include "ass_file.h"
#include "video_display.h" #include "video_display.h"
#include "validators.h" #include "validators.h"
#include "video_provider.h"
/////////////// ///////////////

View File

@ -44,6 +44,7 @@
#include "subs_grid.h" #include "subs_grid.h"
#include "validators.h" #include "validators.h"
#include "video_display.h" #include "video_display.h"
#include "video_provider.h"
/////////////// ///////////////

View File

@ -14,35 +14,14 @@
#include <wx/rawbmp.h> #include <wx/rawbmp.h>
#include "subs_grid.h" #include "subs_grid.h"
#include "frame_main.h" #include "frame_main.h"
#include "video_provider_avs.h"
#include "video_display.h" #include "video_display.h"
#include "video_slider.h"
#include "video_zoom.h"
#include "video_box.h" #include "video_box.h"
#include "ass_file.h" #include "ass_file.h"
#include "dialog_style_manager.h" #include "ass_dialogue.h"
#include "dialog_translation.h"
#include "dialog_jumpto.h"
#include "dialog_shift_times.h"
#include "dialog_search_replace.h"
#include "vfr.h" #include "vfr.h"
#include "subs_edit_box.h" #include "subs_edit_box.h"
#include "options.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 "FexTracker.h"
#include "FexTrackingFeature.h" #include "FexTrackingFeature.h"
#include "FexMovement.h" #include "FexMovement.h"
@ -97,7 +76,7 @@ void FrameMain::OnVideoTrackPoints(wxCommandEvent &event) {
// Get Video // Get Video
bool usedDirectshow; 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 // Create Tracker
if( curline->Tracker ) delete curline->Tracker; if( curline->Tracker ) delete curline->Tracker;

View File

@ -43,7 +43,9 @@
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include "subs_grid.h" #include "subs_grid.h"
#include "frame_main.h" #include "frame_main.h"
#include "avisynth_wrap.h"
#include "video_display.h" #include "video_display.h"
#include "video_provider.h"
#include "video_slider.h" #include "video_slider.h"
#include "video_zoom.h" #include "video_zoom.h"
#include "ass_file.h" #include "ass_file.h"

View File

@ -37,6 +37,8 @@
//////////// ////////////
// Includes // Includes
#include "video_display.h" #include "video_display.h"
#include "video_provider_avs.h"
#include "video_provider_lavc.h"
#include "vfr.h" #include "vfr.h"
#include "ass_file.h" #include "ass_file.h"
#include "ass_time.h" #include "ass_time.h"
@ -155,9 +157,13 @@ void VideoDisplay::SetVideo(const wxString &filename) {
try { try {
grid->CommitChanges(true); 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 // Set keyframes
wxString ext = filename.Right(4).Lower(); wxString ext = filename.Right(4).Lower();

View File

@ -43,7 +43,6 @@
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <windows.h> #include <windows.h>
#include <time.h> #include <time.h>
#include "video_provider_avs.h"
////////////// //////////////

View File

@ -40,7 +40,8 @@
#include "main.h" #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; RGB32Video = NULL;
SubtitledVideo = NULL; SubtitledVideo = NULL;
ResizedVideo = NULL; ResizedVideo = NULL;

View File

@ -77,7 +77,7 @@ private:
void LoadVSFilter(); void LoadVSFilter();
public: public:
AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow, bool mpeg2dec3_priority = true); AvisynthVideoProvider(wxString _filename, wxString _subfilename, double _zoom, bool &usedDirectshow);
~AvisynthVideoProvider(); ~AvisynthVideoProvider();
void RefreshSubtitles(); void RefreshSubtitles();

View File

@ -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 <wx/wxprec.h>
#include <lavc/avcodec.h>
#include <lavc/avformat.h>
#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

View File

@ -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