diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 00:13:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-10-22 00:13:12 +0400 |
commit | 10af15b85b743a18215a1fc58799264b5c798403 (patch) | |
tree | 5c93a43229f31a9befdd2582d3fe382390add2cf /source/blender/imbuf | |
parent | 3c9d69744e0aca3ffe3ace103233679988769e91 (diff) | |
parent | aba149189b7f0ee08765d2ef63a94080d02bdbf4 (diff) |
Cycles: svn merge -r40934:41157 ^/trunk/blender
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/IMB_indexer.h | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 31 | ||||
-rw-r--r-- | source/blender/imbuf/intern/indexer.c | 11 |
3 files changed, 23 insertions, 21 deletions
diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index bd5a455df98..08fa51966f2 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -37,7 +37,7 @@ #include "IMB_anim.h" /* - seperate animation index files to solve the following problems: + separate animation index files to solve the following problems: a) different timecodes within one file (like DTS/PTS, Timecode-Track, "implicit" timecodes within DV-files and HDV-files etc.) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index b9500c2f798..34c39b1083a 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -745,9 +745,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim) " FRAME DONE: " "next_pts=%lld pkt_pts=%lld\n", (anim->pFrame->pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pts, + -1 : (long long int)anim->pFrame->pts, (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pkt_pts); + -1 : (long long int)anim->pFrame->pkt_pts); anim->next_pts = av_get_pts_from_frame(anim->pFormatCtx, anim->pFrame); @@ -767,9 +767,9 @@ static int ffmpeg_decode_video_frame(struct anim * anim) anim->next_packet.stream_index, anim->videoStream, (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1: - anim->next_packet.dts, + (long long int)anim->next_packet.dts, (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1: - anim->next_packet.pts, + (long long int)anim->next_packet.pts, (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); if (anim->next_packet.stream_index == anim->videoStream) { @@ -796,11 +796,11 @@ static int ffmpeg_decode_video_frame(struct anim * anim) " FRAME DONE: next_pts=%lld " "pkt_pts=%lld, guessed_pts=%lld\n", (anim->pFrame->pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pts, + -1 : (long long int)anim->pFrame->pts, (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? - -1 : anim->pFrame->pkt_pts, - anim->next_pts); + -1 : (long long int)anim->pFrame->pkt_pts, + (long long int)anim->next_pts); } } av_free_packet(&anim->next_packet); @@ -824,13 +824,13 @@ static void ffmpeg_decode_video_frame_scan( av_log(anim->pFormatCtx, AV_LOG_DEBUG, "SCAN start: considering pts=%lld in search of %lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); while (count > 0 && anim->next_pts < pts_to_search) { av_log(anim->pFormatCtx, AV_LOG_DEBUG, " WHILE: pts=%lld in search of %lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); if (!ffmpeg_decode_video_frame(anim)) { break; } @@ -841,7 +841,7 @@ static void ffmpeg_decode_video_frame_scan( AV_LOG_ERROR, "SCAN failed: completely lost in stream, " "bailing out at PTS=%lld, searching for PTS=%lld\n", - anim->next_pts, pts_to_search); + (long long int)anim->next_pts, (long long int)pts_to_search); } if (anim->next_pts == pts_to_search) { av_log(anim->pFormatCtx, @@ -938,13 +938,13 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: looking for PTS=%lld " "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", - pts_to_search, pts_time_base, frame_rate, st_time); + (long long int)pts_to_search, pts_time_base, frame_rate, st_time); if (anim->last_frame && anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){ av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: frame repeat: last: %lld next: %lld\n", - anim->last_pts, anim->next_pts); + (long long int)anim->last_pts, (long long int)anim->next_pts); IMB_refImBuf(anim->last_frame); anim->curposition = position; return anim->last_frame; @@ -957,7 +957,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: no seek necessary: " "next: %lld next undecoded: %lld\n", - anim->next_pts, anim->next_undecoded_pts); + (long long int)anim->next_pts, + (long long int)anim->next_undecoded_pts); /* we are already done :) */ @@ -1031,7 +1032,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position, "FETCH: " "error while seeking to DTS = %lld " "(frameno = %d, PTS = %lld): errcode = %d\n", - pos, position, pts_to_search, ret); + pos, position, (long long int)pts_to_search, ret); } avcodec_flush_buffers(anim->pCodecCtx); @@ -1174,7 +1175,7 @@ static struct ImBuf * anim_getnew(struct anim * anim) { case ANIM_SEQUENCE: ibuf = IMB_loadiffname(anim->name, anim->ib_flags); if (ibuf) { - strcpy(anim->first, anim->name); + BLI_strncpy(anim->first, anim->name, sizeof(anim->first)); anim->duration = 1; } break; diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index d79e881e5a2..e4abd8b329d 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -29,10 +29,11 @@ #include "AVI_avi.h" #include "imbuf.h" #include "MEM_guardedalloc.h" + #include "BLI_utildefines.h" #include "BLI_blenlib.h" #include "BLI_math_base.h" -#include "BLI_string.h" + #include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" #include "BKE_global.h" @@ -87,7 +88,7 @@ anim_index_builder * IMB_index_builder_create(const char * name) 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 +798,7 @@ static int index_rebuild_ffmpeg(struct anim * anim, 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 +841,8 @@ static int index_rebuild_ffmpeg(struct anim * anim, start_pts_set = TRUE; } - frameno = (pts - start_pts) - * pts_time_base * frame_rate; + frameno = floor((pts - start_pts) + * pts_time_base * frame_rate + 0.5f); /* decoding starts *always* on I-Frames, so: P-Frames won't work, even if all the |