[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23191] branches/blender2.4/source/blender /imbuf/intern/anim.c: == FFMPEG ==
Peter Schlaile
peter at schlaile.de
Sun Sep 13 21:23:11 CEST 2009
Revision: 23191
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23191
Author: schlaile
Date: 2009-09-13 21:22:36 +0200 (Sun, 13 Sep 2009)
Log Message:
-----------
== FFMPEG ==
fixes 2.4-branch according to trunk:
update anim->curposition even if video frame decoding failed.
Fixes nasty issues with DV-decoding on broken frames.
Also: cleans up color conversion a little bit.
Modified Paths:
--------------
branches/blender2.4/source/blender/imbuf/intern/anim.c
Modified: branches/blender2.4/source/blender/imbuf/intern/anim.c
===================================================================
--- branches/blender2.4/source/blender/imbuf/intern/anim.c 2009-09-13 18:09:13 UTC (rev 23190)
+++ branches/blender2.4/source/blender/imbuf/intern/anim.c 2009-09-13 19:22:36 UTC (rev 23191)
@@ -608,7 +608,7 @@
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 @@
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 @@
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 @@
if (frameFinished && !pos_found) {
if (packet.dts >= pts_to_search) {
pos_found = 1;
+ anim->curposition = position;
}
}
@@ -778,7 +779,7 @@
}
}
- if (G.order == B_ENDIAN) {
+ if (ENDIAN_ORDER == B_ENDIAN) {
int * dstStride
= anim->pFrameRGB->linesize;
uint8_t** dst = anim->pFrameRGB->data;
@@ -811,21 +812,21 @@
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 @@
0, 0, 0 };
int i;
unsigned char* r;
-
-
+
sws_scale(anim->img_convert_ctx,
input->data,
input->linesize,
@@ -857,8 +857,8 @@
anim->pCodecCtx->height,
dst2,
dstStride2);
-
- /* workaround: sws_scale
+
+ /* workaround: sws_scale
sets alpha = 0... */
r = (unsigned char*) ibuf->rect;
@@ -867,7 +867,7 @@
r[3] = 0xff;
r+=4;
}
-
+
av_free_packet(&packet);
break;
}
More information about the Bf-blender-cvs
mailing list