FFmpegSource2: change the api because of an odd ffmpeg bug

Originally committed to SVN as r2338.
This commit is contained in:
Fredrik Mellbin 2008-09-10 20:49:05 +00:00
parent e737471043
commit a631b76684
3 changed files with 11 additions and 8 deletions

View File

@ -53,8 +53,8 @@ FFMS_API(const AVFrameLite *) FFMS_GetFrame(VideoBase *VB, int n, char *ErrorMsg
return (AVFrameLite *)VB->GetFrame(n, ErrorMsg, MsgSize);
}
FFMS_API(int) FFMS_SetOutputFormat(VideoBase *VB, int TargetFormats, int Width, int Height) {
return VB->SetOutputFormat(TargetFormats, Width, Height);
FFMS_API(int) FFMS_SetOutputFormat(VideoBase *VB, int TargetFormat, int Width, int Height) {
return VB->SetOutputFormat(TargetFormat, Width, Height);
}
FFMS_API(void) FFMS_ResetOutputFormat(VideoBase *VB) {

View File

@ -138,7 +138,7 @@ FFMS_API(void) FFMS_DestroyVideoSource(VideoBase *VB);
FFMS_API(int) FFMS_GetVSTrack(VideoBase *VB);
FFMS_API(const VideoProperties *) FFMS_GetVideoProperties(VideoBase *VB);
FFMS_API(const AVFrameLite *) FFMS_GetFrame(VideoBase *VB, int n, char *ErrorMsg, unsigned MsgSize);
FFMS_API(int) FFMS_SetOutputFormat(VideoBase *VB, int TargetFormats, int Width, int Height);
FFMS_API(int) FFMS_SetOutputFormat(VideoBase *VB, int TargetFormat, int Width, int Height);
FFMS_API(void) FFMS_ResetOutputFormat(VideoBase *VB);
FFMS_API(void) FFMS_DestroyFrameIndex(FrameIndex *FI);
FFMS_API(int) FFMS_GetNumTracks(FrameIndex *TrackIndices, char *ErrorMsg, unsigned MsgSize);

View File

@ -116,11 +116,14 @@ AVFrame *GetFrameByTime(double Time, char *ErrorMsg, unsigned MsgSize) {
}
int VideoBase::SetOutputFormat(int TargetFormats, int Width, int Height) {
int Loss;
int OutputFormat = avcodec_find_best_pix_fmt(TargetFormats,
CodecContext->pix_fmt, 1 /* Required to prevent pointless RGB32 => RGB24 conversion */, &Loss);
if (OutputFormat == -1)
return -1;
// FIXME: investigate the possible bug in avcodec_find_best_pix_fmt
// int Loss;
// int OutputFormat = avcodec_find_best_pix_fmt(TargetFormats,
// CodecContext->pix_fmt, 1 /* Required to prevent pointless RGB32 => RGB24 conversion */, &Loss);
// if (OutputFormat == -1)
// return -1;
int OutputFormat = TargetFormats;
SwsContext *NewSWS = NULL;
if (CodecContext->pix_fmt != OutputFormat || Width != CodecContext->width || Height != CodecContext->height) {