Author: miguel
Date: 2007-06-01 15:39:56 -0400 (Fri, 01 Jun 2007)
New Revision: 78451
Modified:
trunk/moon/src/demo.cpp
trunk/moon/src/ffvideo.cpp
Log:
Added ugly hack workaround to change the format of the video
Modified: trunk/moon/src/demo.cpp
===================================================================
--- trunk/moon/src/demo.cpp 2007-06-01 19:38:23 UTC (rev 78450)
+++ trunk/moon/src/demo.cpp 2007-06-01 19:39:56 UTC (rev 78451)
@@ -61,7 +61,7 @@
item_transform_set (r, (double *) (&trans));
surface_repaint (t, 0, 0, 300, 300);
-#ifdef VIDEO_DEMO
+#ifdef VIDEO_DEMO1
v = video_new ("file:///tmp/BoxerSmacksdownInhoffe.wmv", 0, 0);
//printf ("Got %d\n", v);
item_transform_set (v, (double *) (&trans));
@@ -72,6 +72,7 @@
#ifdef VIDEO_DEMO
Item *v2 = video_new ("file:///tmp/Countdown-Colbert-BestNailings.wmv",
100, 100);
+ //Item *v2 = video_new ("file:///tmp/red.wmv", 100, 100);
//Item *v2 = video_new ("file:///tmp/BoxerSmacksdownInhoffe.wmv", 100,
100);
panel_child_add (t, v2);
#endif
Modified: trunk/moon/src/ffvideo.cpp
===================================================================
--- trunk/moon/src/ffvideo.cpp 2007-06-01 19:38:23 UTC (rev 78450)
+++ trunk/moon/src/ffvideo.cpp 2007-06-01 19:39:56 UTC (rev 78451)
@@ -163,7 +163,8 @@
video->initial_pts = video->video_stream->start_time;
video->micro_to_pts = av_q2d (video->video_stream->codec->time_base);
- restart_timer (video);
+ if (video->timeout_handle == 0)
+ restart_timer (video);
return FALSE;
}
@@ -317,6 +318,27 @@
sws_scale (video->video_scale_context, frame->data, frame->linesize, 0,
video->video_stream->codec->height, rgb_dest, rgb_stride);
+
+ //
+ // This is horrible, the ffmpeg scaler wont produce a usable
+ // format (RGB32_1, BGR32_1 hang), so we have to manually swap
+ // some values here
+ //
+ unsigned char *p = video->video_rgb_buffer;
+
+// the stupid scaler gives us RGBA
+// we need BGRA (CAIRO_FORMAT_ARGB32)
+
+ for (int l = 0; l < cc->height; l++){
+ for (int c = 0; c < cc->width; c += 1){
+ unsigned char t;
+
+ t = p [2];
+ p [2] = p [0];
+ p [0] = t;
+ p += 4;
+ }
+ }
}
static gboolean
@@ -339,6 +361,7 @@
// We got more stuff on the queue, discard this one
if (g_async_queue_length (video->video_frames) > 1){
+#ifdef DEBUG
printf ("Initial PTS=%ld\n",
video->initial_pts);
printf ("Video Play Start: %ld\n",
video->play_start_time);
printf ("Current time: %ld\n", av_gettime ());
@@ -346,6 +369,7 @@
printf ("Frame PTS=%ld\n", frame->pts);
printf ("Target PTS=%ld\n", target_pts);
printf ("frame size=%d\n", video->frame_size);
+#endif
printf ("discarding frame at time=%g seconds
because it is late\n",
(frame->pts -
video->video_stream->start_time) *
av_q2d
(video->video_stream->time_base));
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches