Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Schlaile <peter@schlaile.de>2009-09-13 21:52:36 +0400
committerPeter Schlaile <peter@schlaile.de>2009-09-13 21:52:36 +0400
commitd47e1fee328d816e8f5c308556986669fc262616 (patch)
treec3541a361d93d58afce33b673d407ba1a1d60ff3 /source/blender/imbuf/intern
parent5c6eb9c4fad5871efc1d1c3d258b3ba65c221ea9 (diff)
== FFMPEG ==
This fixes the underlying problem of the DV crashings - within blender code. Problem was, that we tried to seek on decode errors. (Unintentionally, curposition wasn't advanced in that case). That triggered a bug within ffmpeg, that made blender crash. My workaround fix for 2.49 actually only prevented the crash, but didn't stop ffmpeg from only decoding black frames after that point... (The patch also cleans up the color conversion a little bit, by using PIX_FMT_RGBA (still need to find a way to make it work with video files that actually *have* an alpha channel. At least, latest FFMPEG-SVN swscaler has the ability to use alpha.) Looks like we can remove extern/ffmpeg now...
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r--source/blender/imbuf/intern/anim.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/imbuf/intern/anim.c b/source/blender/imbuf/intern/anim.c
index a2dbdfbe483..1aaba620f3a 100644
--- a/source/blender/imbuf/intern/anim.c
+++ b/source/blender/imbuf/intern/anim.c
@@ -608,7 +608,7 @@ static int startffmpeg(struct anim * anim) {
anim->pFrameDeinterlaced = avcodec_alloc_frame();
anim->pFrameRGB = avcodec_alloc_frame();
- if (avpicture_get_size(PIX_FMT_BGR32, anim->x, anim->y)
+ if (avpicture_get_size(PIX_FMT_RGBA, anim->x, anim->y)
!= anim->x * anim->y * 4) {
fprintf (stderr,
"ffmpeg has changed alloc scheme ... ARGHHH!\n");
@@ -642,7 +642,7 @@ static int startffmpeg(struct anim * anim) {
anim->pCodecCtx->pix_fmt,
anim->pCodecCtx->width,
anim->pCodecCtx->height,
- PIX_FMT_BGR32,
+ PIX_FMT_RGBA,
SWS_FAST_BILINEAR | SWS_PRINT_INFO,
NULL, NULL, NULL);
@@ -671,11 +671,11 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
if (anim == 0) return (0);
- ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect, 0);
+ ibuf = IMB_allocImBuf(anim->x, anim->y, 32, IB_rect, 0);
avpicture_fill((AVPicture*) anim->pFrameRGB,
(unsigned char*) ibuf->rect,
- PIX_FMT_BGR32, anim->x, anim->y);
+ PIX_FMT_RGBA, anim->x, anim->y);
if (position != anim->curposition + 1) {
if (position > anim->curposition + 1
@@ -748,6 +748,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
if (frameFinished && !pos_found) {
if (packet.dts >= pts_to_search) {
pos_found = 1;
+ anim->curposition = position;
}
}
@@ -811,21 +812,21 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
for (y = 0; y < h; y++) {
unsigned char tmp[4];
- unsigned long * tmp_l =
- (unsigned long*) tmp;
+ unsigned int * tmp_l =
+ (unsigned int*) tmp;
tmp[3] = 0xff;
for (x = 0; x < w; x++) {
- tmp[0] = bottom[3];
- tmp[1] = bottom[2];
- tmp[2] = bottom[1];
+ tmp[0] = bottom[0];
+ tmp[1] = bottom[1];
+ tmp[2] = bottom[2];
- bottom[0] = top[3];
- bottom[1] = top[2];
- bottom[2] = top[1];
+ bottom[0] = top[0];
+ bottom[1] = top[1];
+ bottom[2] = top[2];
bottom[3] = 0xff;
- *(unsigned long*) top
+ *(unsigned int*) top
= *tmp_l;
bottom +=4;
@@ -848,8 +849,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
0, 0, 0 };
int i;
unsigned char* r;
-
-
+
sws_scale(anim->img_convert_ctx,
input->data,
input->linesize,
@@ -857,8 +857,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
anim->pCodecCtx->height,
dst2,
dstStride2);
-
- /* workaround: sws_scale
+
+ /* workaround: sws_scale
sets alpha = 0... */
r = (unsigned char*) ibuf->rect;
@@ -867,7 +867,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position) {
r[3] = 0xff;
r+=4;
}
-
+
av_free_packet(&packet);
break;
}