2011-05-27 23:33:40 +00:00
|
|
|
/*
|
|
|
|
* compatibility macros to make every ffmpeg installation appear
|
|
|
|
* like the most current installation (wrapping some functionality sometimes)
|
|
|
|
* it also includes all ffmpeg header files at once, no need to do it
|
|
|
|
* seperately.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Peter Schlaile
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __FFMPEG_COMPAT_H__
|
|
|
|
#define __FFMPEG_COMPAT_H__
|
2011-05-27 23:33:40 +00:00
|
|
|
|
|
|
|
#include <libavformat/avformat.h>
|
2011-09-25 04:17:00 +00:00
|
|
|
|
|
|
|
/* check our ffmpeg is new enough, avoids user complaints */
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR < 52) || ((LIBAVFORMAT_VERSION_MAJOR == 52) && (LIBAVFORMAT_VERSION_MINOR <= 64))
|
2011-10-23 15:27:36 +00:00
|
|
|
# error "FFmpeg 0.7 or newer is needed, Upgrade your FFmpeg or disable it"
|
2011-09-25 04:17:00 +00:00
|
|
|
#endif
|
|
|
|
/* end sanity check */
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
/* visual studio 2012 does not define inline for C */
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#define FFMPEG_INLINE static __inline
|
|
|
|
#else
|
|
|
|
#define FFMPEG_INLINE static inline
|
|
|
|
#endif
|
2011-09-25 04:17:00 +00:00
|
|
|
|
2011-05-27 23:33:40 +00:00
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavutil/rational.h>
|
2012-01-26 11:16:49 +00:00
|
|
|
#include <libavutil/opt.h>
|
2013-01-12 12:51:10 +00:00
|
|
|
#include <libavutil/mathematics.h>
|
2011-05-27 23:33:40 +00:00
|
|
|
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
|
|
|
|
#define FFMPEG_HAVE_PARSE_UTILS 1
|
|
|
|
#include <libavutil/parseutils.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <libswscale/swscale.h>
|
|
|
|
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 105))
|
|
|
|
#define FFMPEG_HAVE_AVIO 1
|
|
|
|
#endif
|
|
|
|
|
2011-07-17 10:28:31 +00:00
|
|
|
#if (LIBAVCODEC_VERSION_MAJOR > 53) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR > 1)) || ((LIBAVCODEC_VERSION_MAJOR == 53) && (LIBAVCODEC_VERSION_MINOR == 1) && (LIBAVCODEC_VERSION_MICRO >= 1)) || ((LIBAVCODEC_VERSION_MAJOR == 52) && (LIBAVCODEC_VERSION_MINOR >= 121))
|
2011-05-27 23:33:40 +00:00
|
|
|
#define FFMPEG_HAVE_DEFAULT_VAL_UNION 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 101))
|
|
|
|
#define FFMPEG_HAVE_AV_DUMP_FORMAT 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LIBAVFORMAT_VERSION_MAJOR > 52) || ((LIBAVFORMAT_VERSION_MAJOR >= 52) && (LIBAVFORMAT_VERSION_MINOR >= 45))
|
|
|
|
#define FFMPEG_HAVE_AV_GUESS_FORMAT 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 23))
|
|
|
|
#define FFMPEG_HAVE_DECODE_AUDIO3 1
|
|
|
|
#define FFMPEG_HAVE_DECODE_VIDEO2 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (LIBAVCODEC_VERSION_MAJOR > 52) || ((LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 64))
|
|
|
|
#define FFMPEG_HAVE_AVMEDIA_TYPES 1
|
|
|
|
#endif
|
|
|
|
|
2011-05-28 00:07:33 +00:00
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR > 52) || (LIBAVCODEC_VERSION_MAJOR >= 52) && (LIBAVCODEC_VERSION_MINOR >= 29)) && \
|
|
|
|
((LIBSWSCALE_VERSION_MAJOR > 0) || (LIBSWSCALE_VERSION_MAJOR >= 0) && (LIBSWSCALE_VERSION_MINOR >= 10))
|
2011-05-27 23:33:40 +00:00
|
|
|
#define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
|
|
|
|
#endif
|
|
|
|
|
2013-04-14 13:44:04 +00:00
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR > 54) || (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR > 14))
|
|
|
|
#define FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
|
|
|
|
#endif
|
|
|
|
|
2013-04-19 17:23:08 +00:00
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR > 53) || (LIBAVCODEC_VERSION_MAJOR >= 53) && (LIBAVCODEC_VERSION_MINOR >= 60))
|
|
|
|
#define FFMPEG_HAVE_ENCODE_AUDIO2
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR > 53) || (LIBAVCODEC_VERSION_MAJOR >= 53) && (LIBAVCODEC_VERSION_MINOR >= 42))
|
|
|
|
#define FFMPEG_HAVE_DECODE_AUDIO4
|
|
|
|
#endif
|
|
|
|
|
2012-02-24 15:34:57 +00:00
|
|
|
#if ((LIBAVUTIL_VERSION_MAJOR > 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR >= 32))
|
|
|
|
#define FFMPEG_FFV1_ALPHA_SUPPORTED
|
2013-02-28 18:28:08 +00:00
|
|
|
#define FFMPEG_SAMPLE_FMT_S16P_SUPPORTED
|
2013-04-19 17:23:08 +00:00
|
|
|
#else
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-04-19 17:23:08 +00:00
|
|
|
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
|
|
|
|
{
|
|
|
|
/* no planar formats in FFmpeg < 0.9 */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-13 17:10:10 +00:00
|
|
|
#endif
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-04-14 13:44:04 +00:00
|
|
|
int av_get_cropped_height_from_codec(AVCodecContext *pCodecCtx)
|
|
|
|
{
|
|
|
|
int y = pCodecCtx->height;
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_CANON_H264_RESOLUTION_FIX
|
|
|
|
/* really bad hack to remove this dreadfull black bar at the bottom
|
|
|
|
with Canon footage and old ffmpeg versions.
|
|
|
|
(to fix this properly in older ffmpeg versions one has to write a new
|
|
|
|
demuxer...)
|
|
|
|
|
|
|
|
see the actual fix here for reference:
|
|
|
|
|
|
|
|
http://git.libav.org/?p=libav.git;a=commit;h=30f515091c323da59c0f1b533703dedca2f4b95d
|
|
|
|
|
|
|
|
We do our best to apply this only to matching footage.
|
|
|
|
*/
|
|
|
|
if (pCodecCtx->width == 1920 &&
|
|
|
|
pCodecCtx->height == 1088 &&
|
|
|
|
pCodecCtx->pix_fmt == PIX_FMT_YUVJ420P &&
|
|
|
|
pCodecCtx->codec_id == CODEC_ID_H264 ) {
|
|
|
|
y = 1080;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
|
|
|
|
2013-01-13 17:10:10 +00:00
|
|
|
#if ((LIBAVUTIL_VERSION_MAJOR < 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR < 22))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
|
|
|
|
{
|
|
|
|
const AVOption *rv = NULL;
|
|
|
|
av_set_string3(obj, name, val, 1, &rv);
|
|
|
|
return rv != NULL;
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
|
|
|
|
{
|
|
|
|
const AVOption *rv = NULL;
|
|
|
|
rv = av_set_int(obj, name, val);
|
|
|
|
return rv != NULL;
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
|
|
|
|
{
|
|
|
|
const AVOption *rv = NULL;
|
|
|
|
rv = av_set_double(obj, name, val);
|
|
|
|
return rv != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AV_OPT_TYPE_INT FF_OPT_TYPE_INT
|
|
|
|
#define AV_OPT_TYPE_INT64 FF_OPT_TYPE_INT64
|
|
|
|
#define AV_OPT_TYPE_STRING FF_OPT_TYPE_STRING
|
|
|
|
#define AV_OPT_TYPE_CONST FF_OPT_TYPE_CONST
|
|
|
|
#define AV_OPT_TYPE_DOUBLE FF_OPT_TYPE_DOUBLE
|
|
|
|
#define AV_OPT_TYPE_FLOAT FF_OPT_TYPE_FLOAT
|
2012-02-24 15:34:57 +00:00
|
|
|
#endif
|
|
|
|
|
2013-04-01 10:53:29 +00:00
|
|
|
#if ((LIBAVUTIL_VERSION_MAJOR < 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR < 54))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-04-01 10:53:29 +00:00
|
|
|
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
|
|
|
|
{
|
|
|
|
if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB)
|
|
|
|
return AV_SAMPLE_FMT_NONE;
|
|
|
|
return sample_fmt;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-06-18 10:29:11 +00:00
|
|
|
#if ((LIBAVFORMAT_VERSION_MAJOR < 53) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR < 24)) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR < 24) && (LIBAVFORMAT_VERSION_MICRO < 2)))
|
|
|
|
#define avformat_close_input(x) av_close_input_file(*(x))
|
|
|
|
#endif
|
|
|
|
|
2013-01-13 17:54:09 +00:00
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR < 53) || (LIBAVCODEC_VERSION_MAJOR == 53 && LIBAVCODEC_VERSION_MINOR < 35))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
|
|
|
|
{
|
|
|
|
/* TODO: no options are taking into account */
|
|
|
|
return avcodec_open(avctx, codec);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-01-13 17:54:09 +00:00
|
|
|
#if ((LIBAVFORMAT_VERSION_MAJOR < 53) || (LIBAVFORMAT_VERSION_MAJOR == 53 && LIBAVFORMAT_VERSION_MINOR < 21))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
|
|
|
|
{
|
|
|
|
/* TODO: no codec is taking into account */
|
|
|
|
return av_new_stream(s, 0);
|
|
|
|
}
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-01-12 12:51:10 +00:00
|
|
|
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
|
|
|
{
|
|
|
|
/* TODO: no options are taking into account */
|
|
|
|
return av_find_stream_info(ic);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-06-18 10:29:11 +00:00
|
|
|
#if ((LIBAVFORMAT_VERSION_MAJOR > 53) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR > 32)) || ((LIBAVFORMAT_VERSION_MAJOR == 53) && (LIBAVFORMAT_VERSION_MINOR == 24) && (LIBAVFORMAT_VERSION_MICRO >= 100)))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2012-06-25 07:14:21 +00:00
|
|
|
void my_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < s->nb_streams; i++) {
|
|
|
|
AVStream *st = s->streams[i];
|
|
|
|
|
|
|
|
st->cur_dts = av_rescale(timestamp,
|
|
|
|
st->time_base.den * (int64_t)ref_st->time_base.num,
|
|
|
|
st->time_base.num * (int64_t)ref_st->time_base.den);
|
|
|
|
}
|
|
|
|
}
|
2012-06-18 10:29:11 +00:00
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2012-06-18 10:29:11 +00:00
|
|
|
void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
|
|
|
|
{
|
2012-06-25 07:14:21 +00:00
|
|
|
my_update_cur_dts(s, ref_st, timestamp);
|
2012-06-18 10:29:11 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-04-01 20:51:52 +00:00
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR < 54) || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR < 28))
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2013-04-01 20:51:52 +00:00
|
|
|
void avcodec_free_frame(AVFrame **frame)
|
|
|
|
{
|
|
|
|
/* don't need to do anything with old AVFrame
|
|
|
|
* since it does not have malloced members */
|
|
|
|
(void)frame;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ((LIBAVCODEC_VERSION_MAJOR > 54) || (LIBAVCODEC_VERSION_MAJOR == 54 && LIBAVCODEC_VERSION_MINOR >= 13))
|
|
|
|
#define FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT
|
|
|
|
#endif
|
|
|
|
|
2011-05-27 23:33:40 +00:00
|
|
|
#ifndef FFMPEG_HAVE_AVIO
|
|
|
|
#define AVIO_FLAG_WRITE URL_WRONLY
|
|
|
|
#define avio_open url_fopen
|
|
|
|
#define avio_tell url_ftell
|
|
|
|
#define avio_close url_fclose
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
#define avio_size url_fsize
|
2011-05-27 23:33:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* there are some version inbetween, which have avio_... functions but no
|
2012-11-03 15:35:03 +00:00
|
|
|
* AVIO_FLAG_... */
|
2011-05-27 23:33:40 +00:00
|
|
|
#ifndef AVIO_FLAG_WRITE
|
|
|
|
#define AVIO_FLAG_WRITE URL_WRONLY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef AV_PKT_FLAG_KEY
|
|
|
|
#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_AV_DUMP_FORMAT
|
|
|
|
#define av_dump_format dump_format
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_AV_GUESS_FORMAT
|
|
|
|
#define av_guess_format guess_format
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_PARSE_UTILS
|
|
|
|
#define av_parse_video_rate av_parse_video_frame_rate
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef FFMPEG_HAVE_DEFAULT_VAL_UNION
|
|
|
|
#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val.i64
|
|
|
|
#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val.dbl
|
|
|
|
#else
|
|
|
|
#define FFMPEG_DEF_OPT_VAL_INT(OPT) OPT->default_val
|
|
|
|
#define FFMPEG_DEF_OPT_VAL_DOUBLE(OPT) OPT->default_val
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_AVMEDIA_TYPES
|
|
|
|
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
|
|
|
|
#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_DECODE_AUDIO3
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2011-05-27 23:33:40 +00:00
|
|
|
int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
|
|
|
|
int *frame_size_ptr, AVPacket *avpkt)
|
|
|
|
{
|
|
|
|
return avcodec_decode_audio2(avctx, samples,
|
|
|
|
frame_size_ptr, avpkt->data,
|
|
|
|
avpkt->size);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FFMPEG_HAVE_DECODE_VIDEO2
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
2011-05-27 23:33:40 +00:00
|
|
|
int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
|
|
|
|
int *got_picture_ptr,
|
|
|
|
AVPacket *avpkt)
|
|
|
|
{
|
|
|
|
return avcodec_decode_video(avctx, picture, got_picture_ptr,
|
|
|
|
avpkt->data, avpkt->size);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-04-29 19:15:56 +00:00
|
|
|
FFMPEG_INLINE
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
int64_t av_get_pts_from_frame(AVFormatContext *avctx, AVFrame * picture)
|
|
|
|
{
|
|
|
|
int64_t pts = picture->pkt_pts;
|
|
|
|
|
|
|
|
if (pts == AV_NOPTS_VALUE) {
|
|
|
|
pts = picture->pkt_dts;
|
|
|
|
}
|
|
|
|
if (pts == AV_NOPTS_VALUE) {
|
|
|
|
pts = 0;
|
|
|
|
}
|
2011-10-23 17:52:20 +00:00
|
|
|
|
|
|
|
(void)avctx;
|
== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
additionally to the way, Blender 2.49 worked, you can select several
strips at once and make Blender build proxies in the background (using
the job system)
Also a new thing: movie proxies are now build into AVI files, and
the proxy system is moved into ImBuf-library, so that other parts
of blender can also benefit from it.
* Timecode support: to fix seeking issues with files, that have
a) varying frame rates
b) very large GOP lengths
c) are broken inbetween
d) use different time code tracks
the proxy builder can now also build timecode indices, which are
used (optionally) for seeking.
For the first time, it is possible, to do frame exact seeking on
all file types.
* Support for different video-streams in one video file (can be
selected in sequencer, other parts of blender can also use it,
but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
older versions don't support the pkt_pts field, that is essential
for building timecode indices.
Windows and Mac libs are already updated, Linux-users have to build
their own ffmpeg verions until distros keep up.
2011-08-28 14:46:03 +00:00
|
|
|
return pts;
|
|
|
|
}
|
|
|
|
|
2013-04-15 11:08:02 +00:00
|
|
|
/* obsolete constant formerly defined in FFMpeg libavcodec/avcodec.h */
|
|
|
|
#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
|
|
|
|
# define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
|
|
|
|
#endif
|
|
|
|
|
2011-05-27 23:33:40 +00:00
|
|
|
#endif
|