Commit 292fec2a authored by Ronald S. Bultje's avatar Ronald S. Bultje

New mimetypes gone into effect today - this commit changes all old mimetypes...

New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as descri...

Original commit message from CVS:
New mimetypes gone into effect today - this commit changes all old mimetypes over to the new mimetypes spec as described in the previous commit's document. Note: some plugins will break, some pipelines will break, expect HEAD to be broken or at least not 100% working for a few days, but don't forget to report bugs
parent a8183e9a
......@@ -409,34 +409,35 @@ dnl FIXME: add check if this platform can support linking to a
dnl non-PIC libXv, if not then don not use Xv.
dnl FIXME: perhaps warn user if they have a shared libXv since
dnl this is an error until XFree86 starts shipping one
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], xvideosink, [
if test -z $X_DISPLAY_MISSING; then
HAVE_XVIDEO=yes
translit(dnm, m, l) AM_CONDITIONAL(USE_XFREE, true)
GST_CHECK_FEATURE(XFREE, [X11 XFree86], xvideosink-X, [
if test "-DX_DISPLAY_MISSING" = "$X_CFLAGS"; then
HAVE_XFREE=no
else
HAVE_XVIDEO=no
HAVE_XFREE=yes
fi
])
dnl Check for Xv extension
if test x$HAVE_XVIDEO = xyes; then
AC_CHECK_LIB(Xv_pic, XvQueryExtension, HAVE_XV="yes", HAVE_XV="no", $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
if test x$HAVE_XV = xyes; then
AC_DEFINE(HAVE_XV, 1, [Define if Xv extension is available])
translit(dnm, m, l) AM_CONDITIONAL(USE_XVIDEO, true)
GST_CHECK_FEATURE(XVIDEO, [X11 XVideo extensions], xvideosink-Xv, [
if test x$HAVE_XFREE = xyes; then
AC_CHECK_LIB(Xv_pic, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
XVIDEO_LIBS="-lXv_pic -lXext"
AC_SUBST(XVIDEO_LIBS)
else
AC_CHECK_LIB(Xv, XvQueryExtension, HAVE_XVIDEO="yes", HAVE_XVIDEO="no", $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
if test x$HAVE_XV = xyes; then
AC_DEFINE(HAVE_XV, 1, [Define if Xv extension is available])
dnl try again using something else if we didn't find it first
if test x$HAVE_XVIDEO = xno; then
AC_CHECK_LIB(Xv, XvQueryExtension,
HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
XVIDEO_LIBS="-lXv -lXext"
AC_SUBST(XVIDEO_LIBS)
fi
AC_SUBST(XVIDEO_LIBS)
fi
fi
])
dnl Next, check for the optional libraries:
dnl These are all libraries used in building plug-ins
......
......@@ -26,6 +26,7 @@
#include <sys/time.h>
#include "gstaasink.h"
#include <gst/video/video.h>
/* elementfactory information */
static GstElementDetails gst_aasink_details = {
......@@ -65,10 +66,11 @@ GST_PAD_TEMPLATE_FACTORY (sink_template,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"aasink_caps",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
"video/x-raw-yuv",
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
)
)
......
......@@ -37,7 +37,7 @@
*/
static GstElementDetails dvdec_details = {
"DV (smpte314) decoder plugin",
"Codec/Video/Decoder/DV",
"Codec/Video/Decoder",
"LGPL",
"Uses libdv to decode DV video (libdv.sourceforge.net)",
VERSION,
......@@ -77,11 +77,8 @@ GST_PAD_TEMPLATE_FACTORY (sink_temp,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"dv_dec_sink",
"video/dv",
"format", GST_PROPS_LIST (
GST_PROPS_STRING ("PAL"),
GST_PROPS_STRING ("NTSC")
)
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
)
)
......@@ -92,36 +89,55 @@ GST_PAD_TEMPLATE_FACTORY (video_src_temp,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"dv_dec_src",
"video/raw",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y','U','Y','2')),
"width", GST_PROPS_INT (720),
"height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
"height", GST_PROPS_LIST (
GST_PROPS_INT (NTSC_HEIGHT),
GST_PROPS_INT (PAL_HEIGHT)
),
"framerate", GST_PROPS_LIST (
GST_PROPS_FLOAT (25.),
GST_PROPS_FLOAT (30/1.001)
)
),
GST_CAPS_NEW (
"dv_dec_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
"video/x-raw-rgb",
"bpp", GST_PROPS_INT(32),
"depth", GST_PROPS_INT(32),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"red_mask", GST_PROPS_INT(0x00ff0000),
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"red_mask", GST_PROPS_INT(0x000000ff),
"green_mask", GST_PROPS_INT(0x0000ff00),
"blue_mask", GST_PROPS_INT(0x000000ff),
"blue_mask", GST_PROPS_INT(0x00ff00),
"width", GST_PROPS_INT (720),
"height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
"height", GST_PROPS_LIST (
GST_PROPS_INT (NTSC_HEIGHT),
GST_PROPS_INT (PAL_HEIGHT)
),
"framerate", GST_PROPS_LIST (
GST_PROPS_FLOAT (25.),
GST_PROPS_FLOAT (30/1.001)
)
),
GST_CAPS_NEW (
"dv_dec_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
"video/x-raw-rgb",
"bpp", GST_PROPS_INT(24),
"depth", GST_PROPS_INT(24),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"red_mask", GST_PROPS_INT(0x0000ff),
"green_mask", GST_PROPS_INT(0x00ff00),
"blue_mask", GST_PROPS_INT(0xff0000),
"width", GST_PROPS_INT (720),
"height", GST_PROPS_INT_RANGE (NTSC_HEIGHT, PAL_HEIGHT)
"height", GST_PROPS_LIST (
GST_PROPS_INT (NTSC_HEIGHT),
GST_PROPS_INT (PAL_HEIGHT)
),
"framerate", GST_PROPS_LIST (
GST_PROPS_FLOAT (25.),
GST_PROPS_FLOAT (30/1.001)
)
)
)
......@@ -131,9 +147,7 @@ GST_PAD_TEMPLATE_FACTORY ( audio_src_temp,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"arts_sample",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"depth", GST_PROPS_INT (16),
"width", GST_PROPS_INT (16),
"signed", GST_PROPS_BOOLEAN (TRUE),
......@@ -160,15 +174,15 @@ dv_type_find (GstBuffer *buf, gpointer private)
format = "NTSC";
new = GST_CAPS_NEW ("dv_type_find",
"video/dv",
"format", GST_PROPS_STRING (format)
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (TRUE)
);
}
return new;
}
static GstTypeDefinition dv_definition = {
"dv_video/dv", "video/dv", ".dv", dv_type_find
"dv_video/dv", "video/x-dv", ".dv", dv_type_find
};
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
......@@ -690,6 +704,7 @@ gst_dvdec_loop (GstElement *element)
guint32 length, got_bytes;
GstFormat format;
guint64 ts;
gfloat fps;
dvdec = GST_DVDEC (element);
......@@ -704,6 +719,7 @@ gst_dvdec_loop (GstElement *element)
dvdec->PAL = dv_system_50_fields (dvdec->decoder);
dvdec->framerate = (dvdec->PAL ? 2500 : 2997);
fps = (dvdec->PAL ? 25. : 30/1.001);
dvdec->height = height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT);
length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
......@@ -728,12 +744,18 @@ gst_dvdec_loop (GstElement *element)
allowed = gst_pad_get_allowed_caps (dvdec->videosrcpad);
/* try to fix our height */
trylist = gst_caps_intersect (allowed,
GST_CAPS_NEW (
trylist = gst_caps_intersect (allowed, gst_caps_append (
GST_CAPS_NEW (
"dvdec_negotiate",
"video/raw",
"height", GST_PROPS_INT (height)
));
"video/x-raw-yuv",
"height", GST_PROPS_INT (height),
"framerate", GST_PROPS_FLOAT (fps)
), GST_CAPS_NEW (
"dvdec_negotiate",
"video/x-raw-rgb",
"height", GST_PROPS_INT (height),
"framerate", GST_PROPS_FLOAT (fps)
)));
/* prepare for looping */
trylist = gst_caps_normalize (trylist);
......@@ -792,10 +814,8 @@ gst_dvdec_loop (GstElement *element)
gst_pad_try_set_caps (dvdec->audiosrcpad,
GST_CAPS_NEW (
"dvdec_audio_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"audio/x-raw-int",
"rate", GST_PROPS_INT (dvdec->decoder->audio->frequency),
"law", GST_PROPS_INT (0),
"depth", GST_PROPS_INT (16),
"width", GST_PROPS_INT (16),
"signed", GST_PROPS_BOOLEAN (TRUE),
......@@ -1012,4 +1032,3 @@ GstPluginDesc plugin_desc = {
"dvdec",
plugin_init
};
......@@ -103,30 +103,27 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
GST_PAD_SRC, /* type of the pad */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_CAPS_NEW (
"esdmon_src8", /* the name of the caps */
"audio/raw", /* the mime type of the caps */
"esdmon_src", /* the name of the caps */
"audio/x-raw-int", /* the mime type of the caps */
/* Properties follow: */
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
GST_PROPS_BOOLEAN (FALSE)
),
"width", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"depth", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"rate", GST_PROPS_INT_RANGE (8000, 96000),
"channels", GST_PROPS_LIST (GST_PROPS_INT (1), GST_PROPS_INT (2))
),
GST_CAPS_NEW (
"esdmon_src16", /* the name of the caps */
"audio/raw", /* the mime type of the caps */
/* Properties follow: */
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (8000, 96000),
"channels", GST_PROPS_LIST (GST_PROPS_INT (1), GST_PROPS_INT (2))
"channels", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
);
......@@ -298,15 +295,14 @@ gst_esdmon_get (GstPad *pad)
return NULL;
}
if (!GST_PAD_CAPS (pad)) {
gint sign = (esdmon->depth == 8 ? FALSE : TRUE);
/* set caps on src pad */
if (gst_pad_try_set_caps (esdmon->srcpad,
GST_CAPS_NEW (
"oss_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0), /*FIXME */
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
"signed", GST_PROPS_BOOLEAN (TRUE), /*FIXME */
"signed", GST_PROPS_BOOLEAN (sign), /*FIXME */
"width", GST_PROPS_INT (esdmon->depth),
"depth", GST_PROPS_INT (esdmon->depth),
"rate", GST_PROPS_INT (esdmon->frequency),
......
......@@ -55,29 +55,27 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_SINK, /* type of the pad */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_CAPS_NEW (
"esdsink_sink8", /* the name of the caps */
"audio/raw", /* the mime type of the caps */
"esdsink_sink", /* the name of the caps */
"audio/x-raw-int", /* the mime type of the caps */
/* Properties follow: */
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
GST_PROPS_BOOLEAN (FALSE)
),
"width", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"depth", GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"rate", GST_PROPS_INT_RANGE (8000, 96000),
"channels", GST_PROPS_LIST (GST_PROPS_INT (1), GST_PROPS_INT (2))
),
GST_CAPS_NEW (
"esdsink_sink16", /* the name of the caps */
"audio/raw", /* the mime type of the caps */
/* Properties follow: */
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (8000, 96000),
"channels", GST_PROPS_LIST (GST_PROPS_INT (1), GST_PROPS_INT (2))
"channels", GST_PROPS_LIST (
GST_PROPS_INT (1),
GST_PROPS_INT (2)
)
)
);
......@@ -173,6 +171,7 @@ static GstPadLinkReturn
gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstEsdsink *esdsink;
gboolean sign;
esdsink = GST_ESDSINK (gst_pad_get_parent (pad));
......@@ -180,9 +179,16 @@ gst_esdsink_sinkconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_DELAYED;
gst_caps_get_int (caps, "depth", &esdsink->depth);
gst_caps_get_int (caps, "signed", &sign);
gst_caps_get_int (caps, "channels", &esdsink->channels);
gst_caps_get_int (caps, "rate", &esdsink->frequency);
/* only u8/s16 */
if ((sign == FALSE && esdsink->depth != 8) ||
(sign == TRUE && esdsink->depth != 16)) {
return GST_PAD_LINK_REFUSED;
}
gst_esdsink_close_audio (esdsink);
if (gst_esdsink_open_audio (esdsink)) {
esdsink->negotiated = TRUE;
......
......@@ -37,8 +37,11 @@ flac_caps_factory (void)
return
gst_caps_new (
"flac_flac",
"application/x-flac",
NULL);
"audio/x-flac",
/*gst_props_new (
"rate", GST_PROPS_INT_RANGE (11025, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)*/ NULL);
}
static GstCaps*
......@@ -47,10 +50,8 @@ raw_caps_factory (void)
return
gst_caps_new (
"flac_raw",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
......@@ -61,8 +62,8 @@ raw_caps_factory (void)
}
static GstTypeDefinition flacdefinition = {
"flac_application/x-flac",
"application/x-flac",
"flac_audio/x-flac",
"audio/x-flac",
".flac",
flac_type_find,
};
......@@ -75,7 +76,7 @@ flac_type_find (GstBuffer *buf, gpointer private)
if (head != 0x664C6143)
return NULL;
return gst_caps_new ("flac_type_find", "application/x-flac", NULL);
return gst_caps_new ("flac_type_find", "audio/x-flac", NULL);
}
......
......@@ -460,9 +460,7 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder *decoder,
gst_pad_try_set_caps (flacdec->srcpad,
GST_CAPS_NEW (
"flac_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (depth),
......
......@@ -325,6 +325,7 @@ gst_flacenc_dispose (GObject *object)
static GstPadLinkReturn
gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstPadLinkReturn ret;
FlacEnc *flacenc;
flacenc = GST_FLACENC (gst_pad_get_parent (pad));
......@@ -336,6 +337,15 @@ gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "depth", &flacenc->depth);
gst_caps_get_int (caps, "rate", &flacenc->sample_rate);
caps = GST_CAPS_NEW ("flacenc_srccaps",
"audio/x-flac",
"channels", GST_PROPS_INT (flacenc->channels),
"rate", GST_PROPS_INT (flacenc->sample_rate));
ret = gst_pad_try_set_caps (flacenc->srcpad, caps);
if (ret <= 0) {
return ret;
}
FLAC__seekable_stream_encoder_set_bits_per_sample (flacenc->encoder,
flacenc->depth);
FLAC__seekable_stream_encoder_set_sample_rate (flacenc->encoder,
......@@ -345,7 +355,7 @@ gst_flacenc_sinkconnect (GstPad *pad, GstCaps *caps)
flacenc->negotiated = TRUE;
return GST_PAD_LINK_OK;
return ret;
}
static gboolean
......
......@@ -81,10 +81,12 @@ GST_PAD_TEMPLATE_FACTORY (gst_gdk_pixbuf_src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW(
"gdk_pixbuf_src",
"video/raw",
"format", GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
"video/x-raw-rgb",
"width", GST_PROPS_INT_RANGE(1,INT_MAX),
"height", GST_PROPS_INT_RANGE(1,INT_MAX),
/* well, it's needed for connectivity but this
* doesn't really make sense... */
"framerate", GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT),
"bpp", GST_PROPS_INT(32),
"depth", GST_PROPS_INT(24),
"endianness", GST_PROPS_INT(G_BIG_ENDIAN),
......@@ -268,6 +270,7 @@ gst_gdk_pixbuf_chain (GstPad *pad, GstBuffer *buf)
caps = gst_pad_get_caps(filter->srcpad);
gst_caps_set(caps, "width", GST_PROPS_INT(filter->width));
gst_caps_set(caps, "height", GST_PROPS_INT(filter->height));
gst_caps_set(caps, "framerate", GST_PROPS_FLOAT(0.));
gst_pad_try_set_caps(filter->srcpad, caps);
}
......
/*
* gstplugin.h: sample header file for plug-in
/*
* gstgdkpixbuf.h
* GStreamer
* Copyright (C) 1999-2001 Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2003 David A. Schleef <ds@schleef.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_GDK_PIXBUF_H__
......
......@@ -20,6 +20,7 @@
#include "gstjpegdec.h"
#include "gstjpegenc.h"
#include <gst/video/video.h>
/* elementfactory information */
extern GstElementDetails gst_jpegdec_details;
......@@ -34,8 +35,12 @@ jpeg_caps_factory (void)
return
gst_caps_new (
"jpeg_jpeg",
"video/jpeg",
NULL);
"video/x-jpeg",
gst_props_new (
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
NULL));
}
static GstCaps*
......@@ -44,14 +49,9 @@ raw_caps_factory (void)
return
gst_caps_new (
"jpeg_raw",
"video/raw",
gst_props_new (
"format", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
NULL));
"video/x-raw-yuv",
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0'))));
}
static gboolean
......
......@@ -54,6 +54,8 @@ static void gst_jpegdec_class_init (GstJpegDec *klass);
static void gst_jpegdec_init (GstJpegDec *jpegdec);
static void gst_jpegdec_chain (GstPad *pad, GstBuffer *buf);
static GstPadLinkReturn
gst_jpegdec_link (GstPad *pad, GstCaps *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_jpegdec_signals[LAST_SIGNAL] = { 0 }; */
......@@ -127,6 +129,7 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
jpegdec->sinkpad = gst_pad_new_from_template (jpegdec_sink_template, "sink");
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->sinkpad);
gst_pad_set_chain_function(jpegdec->sinkpad,gst_jpegdec_chain);
gst_pad_set_link_function(jpegdec->sinkpad, gst_jpegdec_link);
jpegdec->srcpad = gst_pad_new_from_template (jpegdec_src_template, "src");
gst_element_add_pad(GST_ELEMENT(jpegdec),jpegdec->srcpad);
......@@ -157,6 +160,31 @@ gst_jpegdec_init (GstJpegDec *jpegdec)
}
static GstPadLinkReturn
gst_jpegdec_link (GstPad *pad, GstCaps *caps)
{
GstJpegDec *jpegdec = GST_JPEGDEC (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_LINK_DELAYED;
gst_caps_get (caps,
"framerate", &jpegdec->fps,
"width", &jpegdec->width,
"height", &jpegdec->height,
NULL);
caps = GST_CAPS_NEW ("jpegdec_srccaps",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (
GST_MAKE_FOURCC ('I','4','2','0')),
"width", GST_PROPS_INT (jpegdec->width),
"height", GST_PROPS_INT (jpegdec->height),
"framerate", GST_PROPS_FLOAT (jpegdec->fps));
return gst_pad_try_set_caps (jpegdec->srcpad, caps);
}
/* shamelessly ripped from jpegutils.c in mjpegtools */
static void add_huff_table (j_decompress_ptr dinfo,
JHUFF_TBL **htblptr,
......@@ -345,10 +373,12 @@ gst_jpegdec_chain (GstPad *pad, GstBuffer *buf)
gst_pad_try_set_caps (jpegdec->srcpad,
GST_CAPS_NEW (
"jpegdec_caps",
"video/raw",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
"width", GST_PROPS_INT (width),
"height", GST_PROPS_INT (height)
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (
GST_MAKE_FOURCC ('I','4','2','0')),
"width", GST_PROPS_INT (width),
"height", GST_PROPS_INT (height),
"framerate", GST_PROPS_FLOAT (jpegdec->fps)
));
}