FFmpegSource2: fix ffmpeg init

Originally committed to SVN as r2307.
This commit is contained in:
Fredrik Mellbin 2008-09-01 23:18:50 +00:00
parent c4af6ea13d
commit 8f663c2336
4 changed files with 9 additions and 14 deletions

View file

@ -26,11 +26,6 @@
#include "utils.h"
AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
if (!UserData) {
av_register_all();
UserData = (void *)-1;
}
char ErrorMsg[1024];
unsigned MsgSize = sizeof(ErrorMsg);
@ -75,11 +70,6 @@ AVSValue __cdecl CreateFFIndex(AVSValue Args, void* UserData, IScriptEnvironment
}
AVSValue __cdecl CreateFFVideoSource(AVSValue Args, void* UserData, IScriptEnvironment* Env) {
if (!UserData) {
av_register_all();
UserData = (void *)-1;
}
char ErrorMsg[1024];
unsigned MsgSize = sizeof(ErrorMsg);

View file

@ -22,6 +22,13 @@
#include "ffvideosource.h"
#include "indexing.h"
FFMS_API(void) FFMS_Init() {
static bool InitDone = false;
if (!InitDone)
av_register_all();
InitDone = true;
}
FFMS_API(VideoBase *) FFMS_CreateVideoSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, const char *PP, int Threads, int SeekMode, char *ErrorMsg, unsigned MsgSize) {
switch (TrackIndices->Decoder) {
case 0: return new FFVideoSource(SourceFile, Track, TrackIndices, PP, Threads, SeekMode, ErrorMsg, MsgSize);

View file

@ -81,6 +81,7 @@ public:
int CropRight;
};
FFMS_API(void) FFMS_Init();
FFMS_API(VideoBase *) FFMS_CreateVideoSource(const char *SourceFile, int Track, FrameIndex *TrackIndices, const char *PP, int Threads, int SeekMode, char *ErrorMsg, unsigned MsgSize);
FFMS_API(void) FFMS_DestroyVideoSource(VideoBase *VB);
FFMS_API(int) FFMS_GetVSTrack(VideoBase *VB);

View file

@ -21,17 +21,14 @@
#ifndef UTILS_H
#define UTILS_H
#include <windows.h>
extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#include <libpostproc/postprocess.h>
#include "MatroskaParser.h"
}
#include <windows.h>
#include "avisynth.h"
#include "stdiostream.h"