Skip to content
Extraits de code Groupes Projets
Valider 42dd5995 rédigé par Niels Martin Hansen's avatar Niels Martin Hansen
Parcourir les fichiers

Make ffmpeg and ffms video providers endianness-aware and always get the video...

Make ffmpeg and ffms video providers endianness-aware and always get the video in pixel format expected by the video display.

Originally committed to SVN as r2492.
parent e802fa3c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "video_provider_ffmpegsource.h" #include "video_provider_ffmpegsource.h"
#include "video_context.h" #include "video_context.h"
#include "options.h" #include "options.h"
#include "aegisub_endian.h"
/////////////// ///////////////
...@@ -217,13 +218,18 @@ const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n, int FormatType) ...@@ -217,13 +218,18 @@ const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n, int FormatType)
// this is what we'll return eventually // this is what we'll return eventually
AegiVideoFrame &DstFrame = CurFrame; AegiVideoFrame &DstFrame = CurFrame;
bool big_endian = Endian::BigToMachine((int)1)==(int)1;
// choose output format // choose output format
if (FormatType & FORMAT_RGB32) { if (FormatType & FORMAT_RGB32 && big_endian) {
DstFormat = FFMS_PIX_FMT_BGR32_1;
DstFrame.format = FORMAT_RGB32;
} else if (FormatType & FORMAT_RGB32 && !big_endian) {
DstFormat = FFMS_PIX_FMT_RGB32; DstFormat = FFMS_PIX_FMT_RGB32;
DstFrame.format = FORMAT_RGB32; DstFrame.format = FORMAT_RGB32;
} else if (FormatType & FORMAT_RGB24) { } else if (FormatType & FORMAT_RGB24) {
DstFormat = FFMS_PIX_FMT_RGB24; DstFormat = FFMS_PIX_FMT_BGR24;
DstFrame.format = FORMAT_RGB24; DstFrame.format = FORMAT_RGB24;
} else if (FormatType & FORMAT_YV12) { } else if (FormatType & FORMAT_YV12) {
DstFormat = FFMS_PIX_FMT_YUV420P; // may or may not work DstFormat = FFMS_PIX_FMT_YUV420P; // may or may not work
......
...@@ -283,7 +283,7 @@ const AegiVideoFrame LAVCVideoProvider::GetFrame(int n,int formatType) { ...@@ -283,7 +283,7 @@ const AegiVideoFrame LAVCVideoProvider::GetFrame(int n,int formatType) {
int w = codecContext->width; int w = codecContext->width;
int h = codecContext->height; int h = codecContext->height;
PixelFormat srcFormat = codecContext->pix_fmt; PixelFormat srcFormat = codecContext->pix_fmt;
PixelFormat dstFormat = PIX_FMT_RGB32; PixelFormat dstFormat = PIX_FMT_BGRA;
// Allocate RGB32 buffer // Allocate RGB32 buffer
if(!sws_context) //first frame if(!sws_context) //first frame
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter