From a631b7668438014412fc70757fc3e766b4146db0 Mon Sep 17 00:00:00 2001 From: Fredrik Mellbin Date: Wed, 10 Sep 2008 20:49:05 +0000 Subject: [PATCH] FFmpegSource2: change the api because of an odd ffmpeg bug Originally committed to SVN as r2338. --- FFmpegSource2/ffms.cpp | 4 ++-- FFmpegSource2/ffms.h | 2 +- FFmpegSource2/ffvideosource.cpp | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/FFmpegSource2/ffms.cpp b/FFmpegSource2/ffms.cpp index 078c12b39..56aa01d6a 100644 --- a/FFmpegSource2/ffms.cpp +++ b/FFmpegSource2/ffms.cpp @@ -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) { diff --git a/FFmpegSource2/ffms.h b/FFmpegSource2/ffms.h index 2be9b17a7..b239b9f63 100644 --- a/FFmpegSource2/ffms.h +++ b/FFmpegSource2/ffms.h @@ -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); diff --git a/FFmpegSource2/ffvideosource.cpp b/FFmpegSource2/ffvideosource.cpp index b6762d7c0..942e07732 100644 --- a/FFmpegSource2/ffvideosource.cpp +++ b/FFmpegSource2/ffvideosource.cpp @@ -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) {