flvdemux: Use gst_video_guess_framerate()

Use gst_video_guess_framerate() from libgstvideo to guess
sensible common framerates where possible from the
floating point fps in the stream.
This commit is contained in:
Jan Schmidt 2015-02-11 05:06:45 +11:00
parent f4b5107796
commit 2e00311fe1
2 changed files with 4 additions and 2 deletions

View file

@ -1,7 +1,8 @@
plugin_LTLIBRARIES = libgstflv.la
libgstflv_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstflv_la_LIBADD = -lgstpbutils-@GST_API_VERSION@ -lgstaudio-@GST_API_VERSION@\
libgstflv_la_LIBADD = -lgstpbutils-@GST_API_VERSION@ -lgstaudio-@GST_API_VERSION@ \
-lgstvideo-@GST_API_VERSION@ \
$(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)
libgstflv_la_LDFLAGS = ${GST_PLUGIN_LDFLAGS}
libgstflv_la_SOURCES = gstflvdemux.c gstflvmux.c

View file

@ -43,6 +43,7 @@
#include <gst/pbutils/descriptions.h>
#include <gst/pbutils/pbutils.h>
#include <gst/audio/audio.h>
#include <gst/video/video.h>
/* FIXME: don't rely on own GstIndex */
#include "gstindex.c"
@ -1255,7 +1256,7 @@ gst_flv_demux_video_negotiate (GstFlvDemux * demux, guint32 codec_tag)
if (G_LIKELY (demux->framerate)) {
gint num = 0, den = 0;
gst_util_double_to_fraction (demux->framerate, &num, &den);
gst_video_guess_framerate (GST_SECOND / demux->framerate, &num, &den);
GST_DEBUG_OBJECT (demux->video_pad,
"fps to be used on caps %f (as a fraction = %d/%d)", demux->framerate,
num, den);