mirror of https://git.ffmpeg.org/ffmpeg.git
vf_fps: use double constants for default/min/max for start_time
When using AV_NOPTS_VALUE (which expands to INT64_C(0x8000000000000000)) as union initializer for a double field, the c99 converter needs to interpret this constant when filling the union initializer, and it is interpreted as a positive value. When converting AV_NOPTS_VALUE to a double, MSVC 2010 ends up with the same positive value as the c99 converter, while MSVC 2012 gets a negative value. This results in an infite loop in various FATE tests on MSVC 2012. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
48f2e53ad0
commit
cb8f70c96e
|
@ -21,6 +21,8 @@
|
||||||
* a filter enforcing given constant framerate
|
* a filter enforcing given constant framerate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/fifo.h"
|
#include "libavutil/fifo.h"
|
||||||
#include "libavutil/mathematics.h"
|
#include "libavutil/mathematics.h"
|
||||||
|
@ -56,7 +58,7 @@ typedef struct FPSContext {
|
||||||
#define V AV_OPT_FLAG_VIDEO_PARAM
|
#define V AV_OPT_FLAG_VIDEO_PARAM
|
||||||
static const AVOption options[] = {
|
static const AVOption options[] = {
|
||||||
{ "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
|
{ "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
|
||||||
{ "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = AV_NOPTS_VALUE}, INT64_MIN, INT64_MAX, V },
|
{ "start_time", "Assume the first PTS should be this value.", OFFSET(start_time), AV_OPT_TYPE_DOUBLE, { .dbl = DBL_MAX}, -DBL_MAX, DBL_MAX, V },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (s->start_time != AV_NOPTS_VALUE) {
|
if (s->start_time != DBL_MAX) {
|
||||||
double first_pts = s->start_time * AV_TIME_BASE;
|
double first_pts = s->start_time * AV_TIME_BASE;
|
||||||
first_pts = FFMIN(FFMAX(first_pts, INT64_MIN), INT64_MAX);
|
first_pts = FFMIN(FFMAX(first_pts, INT64_MIN), INT64_MAX);
|
||||||
s->first_pts = s->pts = av_rescale_q(first_pts, AV_TIME_BASE_Q,
|
s->first_pts = s->pts = av_rescale_q(first_pts, AV_TIME_BASE_Q,
|
||||||
|
|
Loading…
Reference in New Issue