[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40951] trunk/blender: Fixes for #26837: MPEG Preseek does not work for some h264 files.

Sergey Sharybin g.ulairi at gmail.com
Wed Oct 12 14:49:45 CEST 2011


Revision: 40951
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40951
Author:   nazgul
Date:     2011-10-12 12:49:45 +0000 (Wed, 12 Oct 2011)
Log Message:
-----------
Fixes for #26837: MPEG Preseek does not work for some h264 files.

- Display running job template in all sequencer modes
  It was displayed only for sequencer mode without preview.
- Fixed proxy rebuild progress indicator
  It was alsways zero because of incorrect rounding.
- Fixed timecode saving on windows (and probably some other platforms)
  It was caused by incorrect opening file for writting -- it should
  be opened in binary format "wb". This error caused incorrect
  movie duration detection on windows.
- Fixed movie resolution detection for some movies.
  In file attached to report, Blender detected resolution 1920x1088
  instead of 1920x1080. Not sure if this fix is correct or it's
  issue in FFmpeg, but it's something what mplayer using: store
  width/height before running avcodec_open().
- Fixed frame number calculation when building timecodes.
  It was rounding error caused some frames be positioned incorrect
  in several cases (that each 6th frame rendered as next frame
  from report).

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
    trunk/blender/source/blender/imbuf/intern/anim_movie.c
    trunk/blender/source/blender/imbuf/intern/indexer.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2011-10-12 11:18:46 UTC (rev 40950)
+++ trunk/blender/release/scripts/startup/bl_ui/space_sequencer.py	2011-10-12 12:49:45 UTC (rev 40951)
@@ -60,7 +60,6 @@
 
             layout.separator()
             layout.operator("sequencer.refresh_all")
-            layout.template_running_jobs()
         elif st.view_type == 'SEQUENCER_PREVIEW':
             layout.separator()
             layout.operator("sequencer.refresh_all")
@@ -76,7 +75,9 @@
                     row.prop(ed, "overlay_frame", text="")
                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
 
+        layout.template_running_jobs()
 
+
 class SEQUENCER_MT_view_toggle(Menu):
     bl_label = "View Type"
 

Modified: trunk/blender/source/blender/imbuf/intern/anim_movie.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/anim_movie.c	2011-10-12 11:18:46 UTC (rev 40950)
+++ trunk/blender/source/blender/imbuf/intern/anim_movie.c	2011-10-12 12:49:45 UTC (rev 40951)
@@ -418,6 +418,7 @@
 	int frs_num;
 	double frs_den;
 	int streamcount;
+	int width, height;
 
 #ifdef FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
 	/* The following for color space determination */
@@ -474,6 +475,9 @@
 
 	pCodecCtx->workaround_bugs = 1;
 
+	width = pCodecCtx->width;
+	height = pCodecCtx->height;
+
 	if(avcodec_open(pCodecCtx, pCodec) < 0) {
 		av_close_input_file(pFormatCtx);
 		return -1;
@@ -498,8 +502,8 @@
 
 	anim->params = 0;
 
-	anim->x = pCodecCtx->width;
-	anim->y = pCodecCtx->height;
+	anim->x = width;
+	anim->y = height;
 	anim->interlacing = 0;
 	anim->orientation = 0;
 	anim->framesize = anim->x * anim->y * 4;

Modified: trunk/blender/source/blender/imbuf/intern/indexer.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/indexer.c	2011-10-12 11:18:46 UTC (rev 40950)
+++ trunk/blender/source/blender/imbuf/intern/indexer.c	2011-10-12 12:49:45 UTC (rev 40951)
@@ -87,7 +87,7 @@
 
 	BLI_make_existing_file(rv->temp_name);
 
-	rv->fp = fopen(rv->temp_name, "w");
+	rv->fp = fopen(rv->temp_name, "wb");
 
 	if (!rv->fp) {
 		fprintf(stderr, "Couldn't open index target: %s! "
@@ -797,7 +797,7 @@
 
 	while(av_read_frame(iFormatCtx, &next_packet) >= 0) {
 		int frame_finished = 0;
-		float next_progress =  ((int)floor(((double) next_packet.pos) * 100 /
+		float next_progress =  (float)((int)floor(((double) next_packet.pos) * 100 /
 		                                   ((double) stream_size)+0.5)) / 100;
 
 		if (*progress != next_progress) {
@@ -840,8 +840,8 @@
 				start_pts_set = TRUE;
 			}
 
-			frameno = (pts - start_pts) 
-				* pts_time_base * frame_rate; 
+			frameno = round((pts - start_pts) 
+				* pts_time_base * frame_rate);
 
 			/* decoding starts *always* on I-Frames,
 			   so: P-Frames won't work, even if all the




More information about the Bf-blender-cvs mailing list