We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

Commit 602e47bf authored by Jan Schmidt's avatar Jan Schmidt

Remove mentions of ffmpegcolorspace now that it's in gst-plugins-base

Original commit message from CVS:
* HACKING:
* ext/ffmpeg/gstffmpegcolorspace.c:
Remove mentions of ffmpegcolorspace now that it's in
gst-plugins-base

* ext/ffmpeg/Makefile.am:
Link to gstreamer libraries
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_negotiate), (gst_ffmpegdec_frame):
Convert to fractional framerate
parent 93242ea4
2005-11-23 Jan Schmidt <thaytan@mad.scientist.com>
* HACKING:
* ext/ffmpeg/gstffmpegcolorspace.c:
Remove mentions of ffmpegcolorspace now that it's in
gst-plugins-base
* ext/ffmpeg/Makefile.am:
Link to gstreamer libraries
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt):
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_init),
(gst_ffmpegdec_close), (gst_ffmpegdec_setcaps),
(gst_ffmpegdec_negotiate), (gst_ffmpegdec_frame):
Convert to fractional framerate
2005-11-22 Andy Wingo <wingo@pobox.com>
* ext/ffmpeg/gstffmpegdec.c (gst_ffmpegdec_sink_event): Run
......
......@@ -195,19 +195,10 @@ Some notes on how ffmpeg wrapping inside GStreamer currently works:
* gstffmpeg{dec,enc,demux,mux}.c are wrappers for specific element types from
their ffmpeg counterpart. If you want to wrap a new type of element in
wrapper file.
* gstffmpegcolorspace.c is a wrapper for one specific function in ffmpeg:
colorspace conversion. This works different from the previously mentioned
ones, and we'll come to that in the next item. If you want to wrap one
specific function, then that, too, belongs in a new wrapper file.
* the important difference between all those is that the colorspace element
contains one element, so there is a 1<->1 mapping. This makes for a fairly
basic element implementation. gstffmpegcolorspace.c, therefore, doesn't
differ much from other colorspace elements. The ffmpeg element types,
however, define a whole *list* of elements (in GStreamer, each decoder etc.
needs to be its own element). We use a set of tricks for that to keep
coding simple: codec mapping and dynamic type creation.
The ffmpeg element types, define a whole *list* of elements (in
GStreamer, each decoder etc. needs to be its own element).
We use a set of tricks for that to keep coding simple: codec
mapping and dynamic type creation.
* ffmpeg uses CODEC_ID_* enumerations for their codecs. GStreamer uses caps,
which consists of a mimetype and a defined set of properties. In ffmpeg,
......
......@@ -7,17 +7,16 @@ libgstffmpeg_la_SOURCES = gstffmpeg.c \
# gstffmpegdemux.c \
# gstffmpegmux.c \
# gstffmpegprotocol.c \
# gstffmpegcolorspace.c \
# gstffmpegscale.c \
# gstffmpegdeinterlace.c
libgstffmpeg_la_CFLAGS = $(GST_CFLAGS) \
libgstffmpeg_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavformat \
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavutil \
-I $(top_srcdir)/gst-libs/ext/ffmpeg/libavcodec
libgstffmpeg_la_LIBADD = \
$(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.la
$(top_builddir)/gst-libs/ext/ffmpeg/libavformat/libavformat.la \
$(GST_LIBS)
libgstffmpeg_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = \
......
......@@ -86,17 +86,14 @@ gst_ffmpeg_set_palette (GstCaps *caps, AVCodecContext *context)
gst_caps_new_simple (mimetype, \
"width", G_TYPE_INT, context->width, \
"height", G_TYPE_INT, context->height, \
"framerate", G_TYPE_DOUBLE, (double) 1. * \
context->time_base.den / \
context->time_base.num, \
__VA_ARGS__, NULL) \
"framerate", GST_TYPE_FRACTION, context->time_base.den, \
context->time_base.num, __VA_ARGS__, NULL) \
: \
gst_caps_new_simple (mimetype, \
"width", GST_TYPE_INT_RANGE, 16, 4096, \
"height", GST_TYPE_INT_RANGE, 16, 4096, \
"framerate", GST_TYPE_DOUBLE_RANGE, (double) 1., \
G_MAXDOUBLE, \
__VA_ARGS__, NULL)
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, \
G_MAXINT, 1, __VA_ARGS__, NULL)
/* same for audio - now with channels/sample rate
*/
......@@ -1102,7 +1099,7 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
AVCodecContext * context, gboolean raw)
{
GstStructure *structure;
gdouble fps;
const GValue *fps;
g_return_if_fail (gst_caps_get_size (caps) == 1);
structure = gst_caps_get_structure (caps, 0);
......@@ -1111,23 +1108,16 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
gst_structure_get_int (structure, "height", &context->height);
gst_structure_get_int (structure, "bpp", &context->bits_per_sample);
if (gst_structure_get_double (structure, "framerate", &fps)) {
GValue dfps = { 0 };
GValue framerate = { 0 };
/* convert double to fraction for the framerate */
g_value_init (&dfps, G_TYPE_DOUBLE);
g_value_init (&framerate, GST_TYPE_FRACTION);
g_value_set_double (&dfps, fps);
g_value_transform (&dfps, &framerate);
fps = gst_structure_get_value (structure, "framerate");
g_return_if_fail (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps));
/* somehow these seem mixed up.. */
context->time_base.den = gst_value_get_fraction_numerator (&framerate);
context->time_base.num = gst_value_get_fraction_denominator (&framerate);
/* somehow these seem mixed up.. */
context->time_base.den = gst_value_get_fraction_numerator (fps);
context->time_base.num = gst_value_get_fraction_denominator (fps);
GST_DEBUG ("setting framerate %d/%d = %lf",
context->time_base.den, context->time_base.num, fps);
}
GST_DEBUG ("setting framerate %d/%d = %lf",
context->time_base.den, context->time_base.num,
1. * context->time_base.den / context->time_base.num);
if (!raw)
return;
......
This diff is collapsed.
......@@ -56,7 +56,9 @@ struct _GstFFMpegDec
struct
{
gint width, height;
gdouble fps, old_fps;
gint fps_n, fps_d;
gint old_fps_n, old_fps_d;
enum PixelFormat pix_fmt;
} video;
struct
......@@ -289,8 +291,8 @@ gst_ffmpegdec_init (GstFFMpegDec * ffmpegdec)
ffmpegdec->last_buffer = NULL;
ffmpegdec->format.video.fps = -1.0;
ffmpegdec->format.video.old_fps = -1.0;
ffmpegdec->format.video.fps_n = -1;
ffmpegdec->format.video.old_fps_n = -1;
}
static void
......@@ -402,8 +404,8 @@ gst_ffmpegdec_close (GstFFMpegDec * ffmpegdec)
ffmpegdec->pctx = NULL;
}
ffmpegdec->format.video.fps = -1.0;
ffmpegdec->format.video.old_fps = -1.0;
ffmpegdec->format.video.fps_n = -1;
ffmpegdec->format.video.old_fps_n = -1;
}
static gboolean
......@@ -466,6 +468,7 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
(GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
GstStructure *structure;
const GValue *par;
const GValue *fps;
GST_DEBUG ("setcaps called");
......@@ -498,13 +501,12 @@ gst_ffmpegdec_setcaps (GstPad * pad, GstCaps * caps)
gst_value_init_and_copy (ffmpegdec->par, par);
}
if (gst_structure_has_field (structure, "framerate")) {
ffmpegdec->format.video.old_fps = ffmpegdec->format.video.fps;
gst_structure_get_double (structure, "framerate",
&ffmpegdec->format.video.fps);
fps = gst_structure_get_value (structure, "framerate");
if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) {
ffmpegdec->format.video.fps_n = gst_value_get_fraction_numerator (fps);
ffmpegdec->format.video.fps_d = gst_value_get_fraction_denominator (fps);
} else {
ffmpegdec->format.video.old_fps = ffmpegdec->format.video.fps;
ffmpegdec->format.video.fps = -1.0;
ffmpegdec->format.video.fps_n = -1;
}
/* do *not* draw edges */
......@@ -635,16 +637,19 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec)
case CODEC_TYPE_VIDEO:
if (ffmpegdec->format.video.width == ffmpegdec->context->width &&
ffmpegdec->format.video.height == ffmpegdec->context->height &&
ffmpegdec->format.video.fps == ffmpegdec->format.video.old_fps &&
ffmpegdec->format.video.fps_n == ffmpegdec->format.video.old_fps_n &&
ffmpegdec->format.video.fps_d == ffmpegdec->format.video.old_fps_d &&
ffmpegdec->format.video.pix_fmt == ffmpegdec->context->pix_fmt)
return TRUE;
GST_DEBUG ("Renegotiating video from %dx%d@%0.2ffps to %dx%d@%0.2ffps",
GST_DEBUG ("Renegotiating video from %dx%d@ %d/%d fps to %dx%d@ %d/%d fps",
ffmpegdec->format.video.width, ffmpegdec->format.video.height,
ffmpegdec->format.video.old_fps, ffmpegdec->context->width,
ffmpegdec->context->height, ffmpegdec->format.video.old_fps);
ffmpegdec->format.video.old_fps_n, ffmpegdec->format.video.old_fps_n,
ffmpegdec->context->width, ffmpegdec->context->height,
ffmpegdec->format.video.fps_n, ffmpegdec->format.video.fps_d);
ffmpegdec->format.video.width = ffmpegdec->context->width;
ffmpegdec->format.video.height = ffmpegdec->context->height;
ffmpegdec->format.video.old_fps = ffmpegdec->format.video.fps;
ffmpegdec->format.video.old_fps_n = ffmpegdec->format.video.fps_n;
ffmpegdec->format.video.old_fps_d = ffmpegdec->format.video.fps_d;
ffmpegdec->format.video.pix_fmt = ffmpegdec->context->pix_fmt;
break;
case CODEC_TYPE_AUDIO:
......@@ -667,9 +672,10 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec)
if (caps) {
/* If a demuxer provided a framerate then use it (#313970) */
if (ffmpegdec->format.video.fps != -1.0) {
if (ffmpegdec->format.video.fps_n != -1) {
gst_structure_set (gst_caps_get_structure (caps, 0), "framerate",
G_TYPE_DOUBLE, ffmpegdec->format.video.fps, NULL);
GST_TYPE_FRACTION, ffmpegdec->format.video.fps_n,
ffmpegdec->format.video.fps_d, NULL);
}
/* Add pixel-aspect-ratio if we have it. Prefer
......@@ -835,15 +841,16 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec,
/* If we have used the framerate from the demuxer then
* also use the demuxer's timestamp information (#317596) */
if (ffmpegdec->format.video.fps != -1.0 && inbuf != NULL) {
if (ffmpegdec->format.video.fps_n != -1 && inbuf != NULL) {
gst_buffer_stamp (outbuf, inbuf);
} else {
GST_BUFFER_TIMESTAMP (outbuf) = ffmpegdec->next_ts;
if (ffmpegdec->context->time_base.num != 0 &&
ffmpegdec->context->time_base.den != 0) {
GST_BUFFER_DURATION (outbuf) = GST_SECOND *
ffmpegdec->context->time_base.num /
ffmpegdec->context->time_base.den;
GST_BUFFER_DURATION (outbuf) =
gst_util_clock_time_scale (GST_SECOND,
ffmpegdec->context->time_base.num,
ffmpegdec->context->time_base.den);
/* Take repeat_pict into account */
GST_BUFFER_DURATION (outbuf) += GST_BUFFER_DURATION (outbuf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment