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
This commit is contained in:
Ronald S. Bultje 2003-07-06 20:49:52 +00:00
parent a8183e9a3f
commit 292fec2a0b
66 changed files with 1718 additions and 1430 deletions

View file

@ -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

View file

@ -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")))
)
)

View file

@ -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
};

View file

@ -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),

View file

@ -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;

View file

@ -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);
}

View file

@ -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),

View file

@ -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

View file

@ -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);
}

View file

@ -1,5 +1,23 @@
/*
* 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__

View file

@ -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

View file

@ -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)
));
}

View file

@ -64,6 +64,7 @@ struct _GstJpegDec {
gint format;
gint width;
gint height;
gfloat fps;
/* the size of the output buffer */
gint outsize;
/* the jpeg line buffer */

View file

@ -52,6 +52,8 @@ static void gst_jpegenc_class_init (GstJpegEnc *klass);
static void gst_jpegenc_init (GstJpegEnc *jpegenc);
static void gst_jpegenc_chain (GstPad *pad,GstBuffer *buf);
static GstPadLinkReturn gst_jpegenc_link (GstPad *pad, GstCaps *caps);
static GstBuffer *gst_jpegenc_get (GstPad *pad);
static void gst_jpegenc_resync (GstJpegEnc *jpegenc);
@ -123,6 +125,7 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
jpegenc->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->sinkpad);
gst_pad_set_chain_function(jpegenc->sinkpad,gst_jpegenc_chain);
gst_pad_set_link_function(jpegenc->sinkpad, gst_jpegenc_link);
gst_pad_set_get_function(jpegenc->sinkpad,gst_jpegenc_get);
jpegenc->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_element_add_pad(GST_ELEMENT(jpegenc),jpegenc->srcpad);
@ -151,6 +154,29 @@ gst_jpegenc_init (GstJpegEnc *jpegenc)
}
static GstPadLinkReturn
gst_jpegenc_link (GstPad *pad, GstCaps *caps)
{
GstJpegEnc *jpegenc = GST_JPEGENC (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_LINK_DELAYED;
gst_caps_get (caps,
"framerate", &jpegenc->fps,
"width", &jpegenc->width,
"height", &jpegenc->height,
NULL);
caps = GST_CAPS_NEW ("jpegdec_srccaps",
"video/x-jpeg",
"width", GST_PROPS_INT (jpegenc->width),
"height", GST_PROPS_INT (jpegenc->height),
"framerate", GST_PROPS_FLOAT (jpegenc->fps));
return gst_pad_try_set_caps (jpegenc->srcpad, caps);
}
static void
gst_jpegenc_resync (GstJpegEnc *jpegenc)
{

View file

@ -58,6 +58,7 @@ struct _GstJpegEnc {
gint format;
gint width;
gint height;
gfloat fps;
/* the video buffer */
gint bufsize;
GstBuffer *buffer;

View file

@ -33,10 +33,10 @@ GST_PAD_TEMPLATE_FACTORY (ladspa_sink_factory,
GST_PAD_REQUEST,
GST_CAPS_NEW (
"ladspa_sink",
"audio/raw",
"audio/x-raw-float",
"width", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT_RANGE (4000, 96000),
"format", GST_PROPS_STRING ("float"),
"layout", GST_PROPS_STRING ("gfloat"),
"intercept", GST_PROPS_FLOAT(0.0),
"slope", GST_PROPS_FLOAT(1.0),
"channels", GST_PROPS_INT (1)
@ -49,10 +49,10 @@ GST_PAD_TEMPLATE_FACTORY (ladspa_src_factory,
GST_PAD_REQUEST,
GST_CAPS_NEW (
"ladspa_src",
"audio/raw",
"audio/x-raw-float",
"width", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT_RANGE (4000, 96000),
"format", GST_PROPS_STRING ("float"),
"layout", GST_PROPS_STRING ("gfloat"),
"intercept", GST_PROPS_FLOAT (0.0),
"slope", GST_PROPS_FLOAT (1.0),
"channels", GST_PROPS_INT (1)
@ -542,10 +542,10 @@ gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
GST_DEBUG ("forcing caps with rate %d", ladspa->samplerate);
gst_pad_try_set_caps (pad, gst_caps_new (
"ladspa_src_caps",
"audio/raw",
"audio/x-raw-float",
gst_props_new (
"format", GST_PROPS_STRING ("float"),
"layout", GST_PROPS_STRING ("gfloat"),
"width", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"intercept", GST_PROPS_FLOAT(0.0),
"slope", GST_PROPS_FLOAT(1.0),
"rate", GST_PROPS_INT (ladspa->samplerate),

View file

@ -18,6 +18,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include "gstpngenc.h"
@ -26,7 +27,13 @@ extern GstElementDetails gst_pngenc_details;
static GstCaps*
png_caps_factory (void)
{
return gst_caps_new ( "png_png", "video/png", NULL);
return gst_caps_new ( "png_png",
"video/x-png",
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));
}
@ -34,17 +41,9 @@ static GstCaps*
raw_caps_factory (void)
{
return gst_caps_new ( "png_raw",
"video/raw",
gst_props_new (
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"bpp", GST_PROPS_INT (24),
"red_mask", GST_PROPS_INT (0xff),
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff0000),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
NULL )
);
"video/x-raw-rgb",
GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24
);
}
static gboolean

View file

@ -107,6 +107,7 @@ static GstPadLinkReturn
gst_pngenc_sinklink (GstPad *pad, GstCaps *caps)
{
GstPngEnc *pngenc;
gfloat fps;
pngenc = GST_PNGENC (gst_pad_get_parent (pad));
@ -115,8 +116,15 @@ gst_pngenc_sinklink (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "width", &pngenc->width);
gst_caps_get_int (caps, "height", &pngenc->height);
gst_caps_get_float (caps, "framerate", &fps);
gst_caps_get_int (caps, "bpp", &pngenc->bpp);
caps = GST_CAPS_NEW ("png_src",
"video/x-png",
"framerate", GST_PROPS_FLOAT (fps),
"width", GST_PROPS_INT (pngenc->width),
"height", GST_PROPS_INT (pngenc->height));
return gst_pad_try_set_caps (pngenc->srcpad, caps);
}

View file

@ -52,15 +52,12 @@ enum {
ARG_REVERB,
ARG_SNDFXVOLUME,
ARG_VOLUME,
ARG_MIXFREQ,
ARG_INTERP,
ARG_REVERSE,
ARG_SURROUND,
ARG_16BIT,
ARG_HQMIXER,
ARG_SOFT_MUSIC,
ARG_SOFT_SNDFX,
ARG_STEREO
ARG_SOFT_SNDFX
};
@ -74,33 +71,11 @@ mikmod_src_factory (void)
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new ( /* use16bit = TRUE */
gst_caps_new (
"mikmod_src",
"audio/raw",
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),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
gst_caps_new ( /* use16bit = FALSE */
"mikmod_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (FALSE),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
"audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
), NULL);
}
return template;
}
@ -118,7 +93,7 @@ mikmod_sink_factory (void)
GST_PAD_ALWAYS,
gst_caps_new (
"mikmod_sink",
"audio/mod",
"audio/x-mod",
NULL),NULL
);
}
@ -130,6 +105,7 @@ static void gst_mikmod_class_init (GstMikModClass *klass);
static void gst_mikmod_init (GstMikMod *filter);
static void gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamSpec *pspec );
static void gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *pspec );
static GstPadLinkReturn gst_mikmod_srclink (GstPad *pad, GstCaps *caps);
static void gst_mikmod_loop (GstElement *element);
static gboolean gst_mikmod_setup (GstMikMod *mikmod);
static GstElementStateReturn gst_mikmod_change_state (GstElement *element);
@ -138,25 +114,6 @@ static GstElementStateReturn gst_mikmod_change_state (GstElement *element);
static GstElementClass *parent_class = NULL;
#define GST_TYPE_MIKMOD_MIXFREQ (gst_mikmod_mixfreq_get_type())
static GType
gst_mikmod_mixfreq_get_type (void)
{
static GType mikmod_mixfreq_type = 0;
static GEnumValue mikmod_mixfreq[] = {
{ 0, "8000", "8000 Hz" },
{ 1, "11025", "11025 Hz" },
{ 2, "22100", "22100 Hz" },
{ 3, "44100", "44100 Hz" },
{ 0, NULL, NULL },
};
if (! mikmod_mixfreq_type ) {
mikmod_mixfreq_type = g_enum_register_static ("GstMikmodmixfreq", mikmod_mixfreq);
}
return mikmod_mixfreq_type;
}
GType
gst_mikmod_get_type(void) {
static GType mikmod_type = 0;
@ -211,9 +168,7 @@ gst_mikmod_class_init (GstMikModClass *klass)
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_VOLUME,
g_param_spec_int("volume", "volume", "volume",
0, 128, 96, G_PARAM_READWRITE ));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_MIXFREQ,
g_param_spec_enum("mixfreq", "mixfreq", "mixfreq",
GST_TYPE_MIKMOD_MIXFREQ, 3,G_PARAM_READWRITE ));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_INTERP,
g_param_spec_boolean("interp", "interp", "interp",
FALSE, G_PARAM_READWRITE ));
@ -223,9 +178,6 @@ gst_mikmod_class_init (GstMikModClass *klass)
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SURROUND,
g_param_spec_boolean("surround", "surround", "surround",
TRUE, G_PARAM_READWRITE ));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_16BIT,
g_param_spec_boolean("use16bit", "use16bit", "use16bit",
TRUE, G_PARAM_READWRITE ));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_HQMIXER,
g_param_spec_boolean("hqmixer", "hqmixer", "hqmixer",
FALSE, G_PARAM_READWRITE ));
@ -235,9 +187,6 @@ gst_mikmod_class_init (GstMikModClass *klass)
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SOFT_SNDFX,
g_param_spec_boolean("soft_sndfx", "soft_sndfx", "soft_sndfx",
TRUE, G_PARAM_READWRITE ));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_STEREO,
g_param_spec_boolean("stereo", "stereo", "stereo",
TRUE, G_PARAM_READWRITE ));
gobject_class->set_property = gst_mikmod_set_property;
@ -255,6 +204,7 @@ gst_mikmod_init (GstMikMod *filter)
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
gst_pad_set_link_function (filter->srcpad, gst_mikmod_srclink);
gst_element_set_loop_function (GST_ELEMENT (filter), gst_mikmod_loop);
@ -276,12 +226,62 @@ gst_mikmod_init (GstMikMod *filter)
}
static GstPadLinkReturn
gst_mikmod_negotiate (GstMikMod *mikmod)
{
gint width, sign;
if ( mikmod->_16bit ) {
width = 16;
sign = TRUE;
} else {
width = 8;
sign = FALSE;
}
return gst_pad_try_set_caps (mikmod->srcpad,
GST_CAPS_NEW (
"mikmod_src",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (sign),
"width", GST_PROPS_INT (width),
"depth", GST_PROPS_INT (width),
"rate", GST_PROPS_INT (mikmod->mixfreq),
"channels", GST_PROPS_INT (mikmod->stereo ? 2 : 1)));
}
static GstPadLinkReturn
gst_mikmod_srclink (GstPad *pad, GstCaps *caps)
{
GstMikMod *filter;
filter = GST_MIKMOD (gst_pad_get_parent (pad));
if (gst_caps_has_property_typed (caps, "depth", GST_PROPS_INT_TYPE)) {
gint depth;
gst_caps_get_int (caps, "depth", &depth);
filter->_16bit = (depth == 16);
}
if (gst_caps_has_property_typed (caps, "channels", GST_PROPS_INT_TYPE)) {
gint channels;
gst_caps_get_int (caps, "channels", &channels);
filter->stereo = (channels == 2);
}
if (gst_caps_has_property_typed (caps, "rate", GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "rate", &filter->mixfreq);
}
return gst_mikmod_negotiate(filter);
}
static void
gst_mikmod_loop (GstElement *element)
{
GstMikMod *mikmod;
GstBuffer *buffer_in;
gint width, sign;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_MIKMOD (element));
@ -308,14 +308,13 @@ gst_mikmod_loop (GstElement *element)
}
}
if ( mikmod->_16bit ) {
width = 16;
sign = TRUE;
} else {
width = 8;
sign = FALSE;
if (!GST_PAD_CAPS (mikmod->srcpad)) {
if (gst_mikmod_negotiate (mikmod) <= 0) {
gst_element_error (GST_ELEMENT (mikmod),
"Failed to negotiate with next element in mikmod");
return;
}
}
gst_mikmod_setup( mikmod );
MikMod_RegisterDriver(&drv_gst);
@ -330,19 +329,6 @@ gst_mikmod_loop (GstElement *element)
if ( ! Player_Active() )
Player_Start(module);
gst_pad_try_set_caps (mikmod->srcpad,
GST_CAPS_NEW (
"mikmod_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (sign),
"width", GST_PROPS_INT (width),
"depth", GST_PROPS_INT (width),
"rate", GST_PROPS_INT (mikmod->mixfreq),
"channels", GST_PROPS_INT (2)));
do {
if ( Player_Active() ) {
@ -482,9 +468,6 @@ gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamS
case ARG_VOLUME:
filter->volume = g_value_get_int (value);
break;
case ARG_MIXFREQ:
filter->mixfreq = g_value_get_enum (value);
break;
case ARG_INTERP:
filter->interp = g_value_get_boolean (value);
break;
@ -494,9 +477,6 @@ gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamS
case ARG_SURROUND:
filter->surround = g_value_get_boolean (value);
break;
case ARG_16BIT:
filter->_16bit = g_value_get_boolean (value);
break;
case ARG_HQMIXER:
filter->hqmixer = g_value_get_boolean (value);
break;
@ -506,9 +486,6 @@ gst_mikmod_set_property (GObject *object, guint id, const GValue *value, GParamS
case ARG_SOFT_SNDFX:
filter->soft_sndfx = g_value_get_boolean (value);
break;
case ARG_STEREO:
filter->stereo = g_value_get_boolean (value);
break;
default:
break;
}
@ -539,9 +516,6 @@ gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *p
case ARG_VOLUME:
g_value_set_int (value, filter->volume);
break;
case ARG_MIXFREQ:
g_value_set_enum (value, filter->mixfreq);
break;
case ARG_INTERP:
g_value_set_boolean (value, filter->interp);
break;
@ -551,9 +525,6 @@ gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *p
case ARG_SURROUND:
g_value_set_boolean (value, filter->surround);
break;
case ARG_16BIT:
g_value_set_boolean (value, filter->_16bit);
break;
case ARG_HQMIXER:
g_value_set_boolean (value, filter->hqmixer);
break;
@ -563,9 +534,6 @@ gst_mikmod_get_property (GObject *object, guint id, GValue *value, GParamSpec *p
case ARG_SOFT_SNDFX:
g_value_set_boolean (value, filter->soft_sndfx);
break;
case ARG_STEREO:
g_value_set_boolean (value, filter->stereo);
break;
default:
break;
}

View file

@ -71,12 +71,15 @@ sink_template_factory (void)
GST_PAD_ALWAYS,
gst_caps_new (
"shout2send_sink",
"application/x-ogg",
"application/ogg",
NULL),
gst_caps_new (
"shout2send_sink",
"audio/x-mp3",
NULL),
"audio/mpeg",
gst_props_new (
"layer", GST_PROPS_INT_RANGE (1, 3),
NULL
)),
NULL);
}
@ -362,13 +365,13 @@ gst_shout2send_connect (GstPad *pad, GstCaps *caps)
{
if (!strcmp(gst_caps_get_mime (caps), "audio/x-mp3"))
if (!strcmp(gst_caps_get_mime (caps), "audio/mpeg"))
{
audio_format = SHOUT_FORMAT_MP3;
return GST_PAD_LINK_OK;
}
if (!strcmp(gst_caps_get_mime (caps), "application/x-ogg"))
if (!strcmp(gst_caps_get_mime (caps), "application/ogg"))
{
audio_format = SHOUT_FORMAT_VORBIS;
return GST_PAD_LINK_OK;

View file

@ -32,16 +32,15 @@ GST_CAPS_FACTORY (speex_caps_factory,
GST_CAPS_NEW (
"speex_speex",
"audio/x-speex",
"rate", GST_PROPS_INT_RANGE (1000, 48000)
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"channels", GST_PROPS_INT (1)
)
)
GST_CAPS_FACTORY (raw_caps_factory,
GST_CAPS_NEW (
"speex_raw",
"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 (16),

View file

@ -119,9 +119,7 @@ gst_speexdec_sinkconnect (GstPad *pad, GstCaps *caps)
if (gst_pad_try_set_caps (speexdec->srcpad,
GST_CAPS_NEW (
"speex_raw",
"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 (16),

View file

@ -131,7 +131,8 @@ gst_speexenc_sinkconnect (GstPad *pad, GstCaps *caps)
if (gst_pad_try_set_caps (speexenc->srcpad, GST_CAPS_NEW (
"speex_speex",
"audio/x-speex",
"rate", GST_PROPS_INT (speexenc->rate)
"rate", GST_PROPS_INT (speexenc->rate),
"channels", GST_PROPS_INT (1)
)))
{
speex_init_header(&speexenc->header, speexenc->rate, 1, speexenc->mode);
@ -170,7 +171,8 @@ gst_speexenc_chain (GstPad *pad, GstBuffer *buf)
GST_CAPS_NEW (
"speex_enc",
"audio/x-speex",
"rate", GST_PROPS_INT (speexenc->rate)
"rate", GST_PROPS_INT (speexenc->rate),
"channels", GST_PROPS_INT (1)
)))
{
gst_element_error (GST_ELEMENT (speexenc), "could not negotiate");

View file

@ -194,7 +194,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_LINK_DELAYED;
set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
set_retval = gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
if (set_retval > 0)
{

View file

@ -183,7 +183,7 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_LINK_DELAYED;
set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
set_retval = gst_pad_try_set_caps(filter->srcpad, gst_caps_ref (caps));
if (set_retval > 0)
{

View file

@ -56,7 +56,7 @@ au_type_find (GstBuffer *buf, gpointer private)
/* typefactory for 'au' */
static GstTypeDefinition audefinition = {
"auparse_audio/au",
"audio/au",
"audio/x-au",
".au",
au_type_find,
};
@ -67,7 +67,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"auparse_sink",
"audio/au",
"audio/x-au",
NULL
)
)
@ -79,10 +79,8 @@ GST_PAD_TEMPLATE_FACTORY (src_factory_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"auparse_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT_RANGE (0, 1),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"signed", GST_PROPS_LIST(
GST_PROPS_BOOLEAN (FALSE),
GST_PROPS_BOOLEAN (TRUE)
@ -97,6 +95,12 @@ GST_PAD_TEMPLATE_FACTORY (src_factory_templ,
),
"rate", GST_PROPS_INT_RANGE (8000,48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"auparse_src_alaw",
"audio/x-alaw",
"rate", GST_PROPS_INT_RANGE (8000,48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
)
@ -250,7 +254,7 @@ gst_auparse_chain (GstPad *pad, GstBuffer *buf)
case 2:
law = 0;
depth = 8;
sign = TRUE;
sign = FALSE;
break;
case 3:
law = 0;
@ -262,16 +266,21 @@ gst_auparse_chain (GstPad *pad, GstBuffer *buf)
return;
}
tempcaps = GST_CAPS_NEW ("auparse_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"rate", GST_PROPS_INT (auparse->frequency),
"channels", GST_PROPS_INT (auparse->channels),
"law", GST_PROPS_INT (law),
"depth", GST_PROPS_INT (depth),
"width", GST_PROPS_INT (depth),
"signed", GST_PROPS_BOOLEAN (sign));
if (law) {
tempcaps = GST_CAPS_NEW ("auparse_src",
"audio/x-alaw",
"rate", GST_PROPS_INT (auparse->frequency),
"channels", GST_PROPS_INT (auparse->channels));
} else {
tempcaps = GST_CAPS_NEW ("auparse_src",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"rate", GST_PROPS_INT (auparse->frequency),
"channels", GST_PROPS_INT (auparse->channels),
"depth", GST_PROPS_INT (depth),
"width", GST_PROPS_INT (depth),
"signed", GST_PROPS_BOOLEAN (sign));
}
if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
gst_buffer_unref (buf);

View file

@ -68,138 +68,46 @@ GST_PAD_TEMPLATE_FACTORY (sink_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"avidemux_sink",
"video/avi",
"format", GST_PROPS_STRING ("AVI")
)
)
GST_PAD_TEMPLATE_FACTORY (src_video_templ,
"video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"avidemux_src_video_avi",
"video/avi",
"format", GST_PROPS_LIST (
GST_PROPS_STRING ("strf_vids"),
GST_PROPS_STRING ("strf_iavs")
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avidemux_src_video_raw",
"video/raw",
"format", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','U','Y','2')),
GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0'))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avidemux_src_video_jpeg",
"video/jpeg",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avidemux_src_video_dv",
"video/dv",
"format", GST_PROPS_LIST (
GST_PROPS_STRING ("NTSC"),
GST_PROPS_STRING ("PAL")
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avidemux_src_video_divx",
"video/divx",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avidemux_src_video_xvid",
"video/xvid",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
)
GST_PAD_TEMPLATE_FACTORY (src_audio_templ,
"audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS_NEW (
"avidemux_src_audio_avi",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds")
),
GST_CAPS_NEW (
"avidemux_src_audio_raw",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"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 (11025, 44100),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"avidemux_src_audio_mp3",
"audio/x-mp3",
NULL
),
GST_CAPS_NEW (
"avidemux_src_audio_ac3",
"audio/a52",
NULL
),
GST_CAPS_NEW (
"avidemux_src_audio_vorbis",
"application/x-ogg",
NULL
)
)
);
static void gst_avi_demux_class_init (GstAviDemuxClass *klass);
static void gst_avi_demux_init (GstAviDemux *avi_demux);
static void gst_avi_demux_class_init (GstAviDemuxClass *klass);
static void gst_avi_demux_init (GstAviDemux *avi_demux);
static void gst_avi_demux_loop (GstElement *element);
static void gst_avi_demux_loop (GstElement *element);
static gboolean gst_avi_demux_send_event (GstElement *element, GstEvent *event);
static gboolean gst_avi_demux_send_event (GstElement *element,
GstEvent *event);
static const GstEventMask*
gst_avi_demux_get_event_mask (GstPad *pad);
static gboolean gst_avi_demux_handle_src_event (GstPad *pad, GstEvent *event);
static const GstFormat* gst_avi_demux_get_src_formats (GstPad *pad);
static const GstQueryType*
gst_avi_demux_get_src_query_types (GstPad *pad);
static gboolean gst_avi_demux_handle_src_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value);
static gboolean gst_avi_demux_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
GstFormat *dest_format, gint64 *dest_value);
static const GstEventMask *
gst_avi_demux_get_event_mask (GstPad *pad);
static gboolean gst_avi_demux_handle_src_event (GstPad *pad,
GstEvent *event);
static const GstFormat *
gst_avi_demux_get_src_formats (GstPad *pad);
static const GstQueryType *
gst_avi_demux_get_src_query_types (GstPad *pad);
static gboolean gst_avi_demux_handle_src_query (GstPad *pad,
GstQueryType type,
GstFormat *format,
gint64 *value);
static gboolean gst_avi_demux_src_convert (GstPad *pad,
GstFormat src_format,
gint64 src_value,
GstFormat *dest_format,
gint64 *dest_value);
static GstElementStateReturn
gst_avi_demux_change_state (GstElement *element);
static void gst_avi_demux_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
gst_avi_demux_change_state (GstElement *element);
static void gst_avi_demux_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
/*static guint gst_avi_demux_signals[LAST_SIGNAL] = { 0 }; */
@ -280,7 +188,7 @@ avi_type_find (GstBuffer *buf,
new = GST_CAPS_NEW ("avi_type_find",
"video/avi",
"format", GST_PROPS_STRING ("AVI"));
NULL);
return new;
}
@ -524,7 +432,7 @@ gst_avi_demux_metadata (GstAviDemux *avi_demux, gint len)
type = "Subject";
break;
case GST_RIFF_INFO_ISFT:
type = "Encoder"; /* "Sotware" */
type = "Encoder"; /* "Software" */
break;
case GST_RIFF_INFO_ISHP:
type = "Sharpness";
@ -577,102 +485,91 @@ gst_avi_demux_streaminfo (GstAviDemux *avi_demux)
/*g_object_notify(G_OBJECT(avi_demux), "streaminfo");*/
}
static void
gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
/* video/audio pad/caps stuff */
#define GST_AVI_VID_CAPS_NEW(name, mimetype, props...) \
(strf != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT (width), \
"height", GST_PROPS_INT (height), \
"framerate", GST_PROPS_FLOAT (framerate), \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
"width", GST_PROPS_INT_RANGE (16, 4096), \
"height", GST_PROPS_INT_RANGE (16, 4096), \
"framerate", GST_PROPS_FLOAT_RANGE (0., G_MAXFLOAT), \
##props)
static GstCaps *
gst_avi_demux_video_caps (guint32 codec_fcc,
gst_riff_strh *strh,
gst_riff_strf_vids *strf,
GstAviDemux *avi_demux)
{
gst_riff_strf_vids *strf;
guint8 *strfdata;
GstPad *srcpad;
GstCaps *newcaps = NULL, *capslist = NULL;
avi_stream_context *stream;
GstByteStream *bs = avi_demux->bs;
guint32 got_bytes;
gchar *codecname;
GstPropsEntry *entry;
GstCaps *caps = NULL;
gchar *codecname = NULL;
gint width = -1, height = -1;
gdouble framerate = 0.;
got_bytes = gst_bytestream_peek_bytes (bs, &strfdata, sizeof (gst_riff_strf_vids));
strf = (gst_riff_strf_vids *) strfdata;
if (got_bytes != sizeof (gst_riff_strf_vids))
return;
if (strf != NULL) {
width = GUINT32_FROM_LE (strf->width);
height = GUINT32_FROM_LE (strf->height);
}
if (strh != NULL) {
framerate = 1. * GUINT32_FROM_LE (strh->rate) /
GUINT32_FROM_LE (strh->scale); /* fps */
}
GST_INFO ( "gst_avi_demux: strf tag found in context vids");
GST_INFO ( "gst_avi_demux: size %d", GUINT32_FROM_LE (strf->size));
GST_INFO ( "gst_avi_demux: width %d", GUINT32_FROM_LE (strf->width));
GST_INFO ( "gst_avi_demux: height %d", GUINT32_FROM_LE (strf->height));
GST_INFO ( "gst_avi_demux: planes %d", GUINT16_FROM_LE (strf->planes));
GST_INFO ( "gst_avi_demux: bit_cnt %d", GUINT16_FROM_LE (strf->bit_cnt));
GST_INFO ( "gst_avi_demux: compression 0x%08x (%s)",
GUINT32_FROM_LE (strf->compression), gst_riff_id_to_fourcc (strf->compression));
GST_INFO ( "gst_avi_demux: image_size %d", GUINT32_FROM_LE (strf->image_size));
GST_INFO ( "gst_avi_demux: xpels_meter %d", GUINT32_FROM_LE (strf->xpels_meter));
GST_INFO ( "gst_avi_demux: ypels_meter %d", GUINT32_FROM_LE (strf->ypels_meter));
GST_INFO ( "gst_avi_demux: num_colors %d", GUINT32_FROM_LE (strf->num_colors));
GST_INFO ( "gst_avi_demux: imp_colors %d", GUINT32_FROM_LE (strf->imp_colors));
srcpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d",
avi_demux->num_v_streams));
capslist = gst_caps_append(NULL, GST_CAPS_NEW (
"avidemux_video_src",
"video/avi",
"format", GST_PROPS_STRING ("strf_vids"),
"size", GST_PROPS_INT (GUINT32_FROM_LE (strf->size)),
"width", GST_PROPS_INT (GUINT32_FROM_LE (strf->width)),
"height", GST_PROPS_INT (GUINT32_FROM_LE (strf->height)),
"planes", GST_PROPS_INT (GUINT16_FROM_LE (strf->planes)),
"bit_cnt", GST_PROPS_INT (GUINT16_FROM_LE (strf->bit_cnt)),
"compression", GST_PROPS_FOURCC (GUINT32_FROM_LE (strf->compression)),
"image_size", GST_PROPS_INT (GUINT32_FROM_LE (strf->image_size)),
"xpels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->xpels_meter)),
"ypels_meter", GST_PROPS_INT (GUINT32_FROM_LE (strf->ypels_meter)),
"num_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->num_colors)),
"imp_colors", GST_PROPS_INT (GUINT32_FROM_LE (strf->imp_colors))
));
/* let's try some gstreamer-like mime-type caps */
switch (GUINT32_FROM_LE(strf->compression))
{
switch (codec_fcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','U','Y','2'):
newcaps = GST_CAPS_NEW (
"avidemux_video_src",
"video/raw",
"format", GST_PROPS_FOURCC(GUINT32_FROM_LE(strf->compression)),
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_raw",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC (codec_fcc)
);
codecname = g_strdup_printf("Raw Video (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("Raw Video (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('M','J','P','G'): /* YUY2 MJPEG */
case GST_MAKE_FOURCC('J','P','E','G'): /* generic (mostly RGB) MJPEG */
case GST_MAKE_FOURCC('P','I','X','L'): /* Miro/Pinnacle fourccs */
case GST_MAKE_FOURCC('V','I','X','L'): /* Miro/Pinnacle fourccs */
newcaps = GST_CAPS_NEW (
"avidemux_video_src",
"video/jpeg",
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_jpeg",
"video/x-jpeg",
NULL
);
codecname = g_strdup_printf("Motion-JPEG (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("Motion-JPEG (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('H','F','Y','U'):
codecname = g_strdup_printf("HuffYUV (%4.4s)",
(char *) &strf->compression);
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_hfyu",
"video/x-huffyuv",
NULL
);
codecname = g_strdup_printf("HuffYUV (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('M','P','E','G'):
case GST_MAKE_FOURCC('M','P','G','I'):
newcaps = GST_CAPS_NEW (
"avidemux_video_src",
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_mpeg",
"video/mpeg",
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
"systemstream", GST_PROPS_BOOLEAN (FALSE),
"mpegversion", GST_PROPS_BOOLEAN (1)
);
codecname = g_strdup_printf("MPEG-1 (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("MPEG-1 (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('H','2','6','3'):
case GST_MAKE_FOURCC('i','2','6','3'):
case GST_MAKE_FOURCC('L','2','6','3'):
@ -680,67 +577,174 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
case GST_MAKE_FOURCC('V','D','O','W'):
case GST_MAKE_FOURCC('V','I','V','O'):
case GST_MAKE_FOURCC('x','2','6','3'):
codecname = g_strdup_printf("H263-compatible (%4.4s)",
(char *) &strf->compression);
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_263",
"video/x-h263",
NULL
);
codecname = g_strdup_printf("H263-compatible (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('d','i','v','x'):
case GST_MAKE_FOURCC('D','I','V','3'):
case GST_MAKE_FOURCC('D','I','V','4'):
case GST_MAKE_FOURCC('D','I','V','5'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_divx3",
"video/x-divx",
"divxversion", GST_PROPS_INT(3)
);
codecname = g_strdup_printf("DivX-3.x (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('d','i','v','x'):
case GST_MAKE_FOURCC('D','I','V','X'):
case GST_MAKE_FOURCC('D','X','5','0'):
newcaps = GST_CAPS_NEW (
"avidemux_video_src",
"video/divx",
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_divx5",
"video/x-divx",
"divxversion", GST_PROPS_INT(5)
);
codecname = g_strdup_printf("DivX/MPEG-4 (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("DivX 4.x/5.x (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('X','V','I','D'):
case GST_MAKE_FOURCC('x','v','i','d'):
newcaps = GST_CAPS_NEW (
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src",
"video/xvid",
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
"video/x-xvid",
NULL
);
codecname = g_strdup_printf("XviD/MPEG-4 (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("XviD (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('M','P','G','4'):
case GST_MAKE_FOURCC('M','P','4','2'):
case GST_MAKE_FOURCC('M','P','4','3'):
codecname = g_strdup_printf("MS MPEG-4 (%4.4s)",
(char *) &strf->compression);
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (41)
);
codecname = g_strdup_printf("MS MPEG-4.1 (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('M','P','4','2'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (42)
);
codecname = g_strdup_printf("MS MPEG-4.2 (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('M','P','4','3'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src",
"video/x-msmpeg",
"msmpegversion", GST_PROPS_INT (43)
);
codecname = g_strdup_printf("MS MPEG-4.3 (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('3','I','V','1'):
case GST_MAKE_FOURCC('3','I','V','2'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_3ivx",
"video/x-3ivx",
NULL
);
codecname = g_strdup_printf("3ivX (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('D','V','S','D'):
case GST_MAKE_FOURCC('d','v','s','d'):
newcaps = GST_CAPS_NEW (
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src",
"video/dv",
"format", GST_PROPS_STRING("NTSC"), /* FIXME??? */
"width", GST_PROPS_INT(strf->width),
"height", GST_PROPS_INT(strf->height)
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (FALSE)
);
codecname = g_strdup_printf("Digital Video (%4.4s)",
(char *) &strf->compression);
codecname = g_strdup_printf("Digital Video (" GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('W','M','V','1'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_wmv1",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (1)
);
codecname = g_strdup_printf("Windows Media Format 1 ("
GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
case GST_MAKE_FOURCC('W','M','V','2'):
caps = GST_AVI_VID_CAPS_NEW (
"avidemux_video_src_wmv2",
"video/x-wmv",
"wmvversion", GST_PROPS_INT (2)
);
codecname = g_strdup_printf("Windows Media Format 2 ("
GST_FOURCC_FORMAT ")",
GST_FOURCC_ARGS(codec_fcc));
break;
default:
codecname = g_strdup_printf("Unknown (%4.4s)",
(char *) &strf->compression);
g_warning ("avidemux: unkown video format " GST_FOURCC_FORMAT,
GST_FOURCC_ARGS(codec_fcc));
break;
}
if (newcaps) capslist = gst_caps_append (capslist, newcaps);
/* set video codec info on streaminfo caps */
entry = gst_props_entry_new("videocodec", GST_PROPS_STRING(codecname));
gst_props_add_entry(avi_demux->streaminfo->properties, entry);
g_free(codecname);
if (strf != NULL && codecname != NULL) {
GstPropsEntry *entry;
entry = gst_props_entry_new("videocodec",
GST_PROPS_STRING(codecname));
gst_props_add_entry(avi_demux->streaminfo->properties, entry);
}
if (codecname != NULL) {
g_free(codecname);
}
gst_pad_try_set_caps (srcpad, capslist);
return caps;
}
static void
gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
{
gst_riff_strf_vids *strf;
gst_riff_strh *strh;
guint8 *strfdata;
GstPad *srcpad;
GstCaps *caps = NULL;
avi_stream_context *stream;
GstByteStream *bs = avi_demux->bs;
guint32 got_bytes;
gchar *padname;
got_bytes = gst_bytestream_peek_bytes (bs, &strfdata, sizeof (gst_riff_strf_vids));
strf = (gst_riff_strf_vids *) strfdata;
if (got_bytes != sizeof (gst_riff_strf_vids))
return;
padname = g_strdup_printf ("video_%02d", avi_demux->num_v_streams);
srcpad = gst_pad_new_from_template (videosrctempl, padname);
g_free (padname);
/* let's try some gstreamer-like mime-type caps */
strh = &avi_demux->stream[avi_demux->num_streams].strh;
caps = gst_avi_demux_video_caps (GUINT32_FROM_LE(strf->compression),
strh, strf, avi_demux);
if (caps != NULL) {
gst_pad_try_set_caps (srcpad, caps);
}
gst_pad_set_formats_function (srcpad, gst_avi_demux_get_src_formats);
gst_pad_set_event_mask_function (srcpad, gst_avi_demux_get_event_mask);
gst_pad_set_event_function (srcpad, gst_avi_demux_handle_src_event);
@ -757,18 +761,170 @@ gst_avi_demux_strf_vids (GstAviDemux *avi_demux)
gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad);
}
#define GST_AVI_AUD_CAPS_NEW(name, mimetype, props...) \
(strf != NULL) ? \
GST_CAPS_NEW (name, \
mimetype, \
"rate", GST_PROPS_INT (rate), \
"channels", GST_PROPS_INT (channels), \
##props) \
: \
GST_CAPS_NEW (name, \
mimetype, \
"rate", GST_PROPS_INT_RANGE (8000, 96000), \
"channels", GST_PROPS_INT_RANGE (1, 2), \
##props)
static GstCaps *
gst_avi_demux_audio_caps (guint16 codec_id,
gst_riff_strf_auds *strf,
GstAviDemux *avi_demux)
{
GstCaps *caps = NULL;
gchar *codecname = NULL;
gint rate = -1, channels = -1;
if (strf != NULL) {
rate = GUINT32_FROM_LE (strf->rate);
channels = GUINT16_FROM_LE (strf->channels);
}
switch (codec_id) {
case GST_RIFF_WAVE_FORMAT_MPEGL3: /* mp3 */
caps = GST_AVI_AUD_CAPS_NEW ("avi_demux_audio_src_mp3",
"audio/mpeg",
"layer", GST_PROPS_INT (3));
codecname = g_strdup_printf("MPEG-1 layer 3 audio (0x%04x)",
codec_id);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp1 or mp2 */
caps = GST_AVI_AUD_CAPS_NEW ("avi_demux_audio_src_mp12",
"audio/mpeg",
"layer", GST_PROPS_INT (2));
codecname = g_strdup_printf("MPEG-1 layer 1/2 audio (0x%04x)",
codec_id);
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */ {
GstPropsEntry *width = NULL, *depth = NULL, *signedness = NULL;
if (strf != NULL) {
gint ba = GUINT16_FROM_LE (strf->blockalign);
gint ch = GUINT16_FROM_LE (strf->channels);
gint ws = GUINT16_FROM_LE (strf->size);
width = gst_props_entry_new ("width",
GST_PROPS_INT (ba * 8 / ch));
depth = gst_props_entry_new ("depth",
GST_PROPS_INT (ws));
signedness = gst_props_entry_new ("signed",
GST_PROPS_BOOLEAN (ws != 8));
} else {
signedness = gst_props_entry_new ("signed",
GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
GST_PROPS_BOOLEAN (FALSE)));
width = gst_props_entry_new ("width",
GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)));
depth = gst_props_entry_new ("depth",
GST_PROPS_LIST (
GST_PROPS_INT (8),
GST_PROPS_INT (16)));
}
caps = GST_AVI_AUD_CAPS_NEW ("avi_demux_audio_src_pcm",
"audio/x-raw-int",
"endianness",
GST_PROPS_INT (G_LITTLE_ENDIAN));
gst_props_add_entry (caps->properties, width);
gst_props_add_entry (caps->properties, depth);
gst_props_add_entry (caps->properties, signedness);
codecname = g_strdup_printf("Raw PCM/WAV (0x%04x)",
codec_id);
}
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
if (strf != NULL && strf->size != 8) {
g_warning ("invalid depth (%d) of mulaw audio, overwriting.",
strf->size);
}
caps = GST_AVI_AUD_CAPS_NEW ("avidemux_audio_src",
"audio/x-mulaw",
NULL);
codecname = g_strdup_printf("A-law encoded (0x%04x)",
codec_id);
break;
case GST_RIFF_WAVE_FORMAT_ALAW:
if (strf != NULL && strf->size != 8) {
g_warning ("invalid depth (%d) of alaw audio, overwriting.",
strf->size);
}
caps = GST_AVI_AUD_CAPS_NEW ("avidemux_audio_src",
"audio/x-alaw",
NULL);
codecname = g_strdup_printf("A-law encoded (0x%04x)",
codec_id);
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
caps = GST_AVI_AUD_CAPS_NEW ("asf_demux_audio_src_vorbis",
"audio/x-vorbis",
NULL);
codecname = g_strdup_printf("Vorbis (0x%04x)",
codec_id);
break;
case GST_RIFF_WAVE_FORMAT_A52:
caps = GST_AVI_AUD_CAPS_NEW ("asf_demux_audio_src_ac3",
"audio/x-ac3",
NULL);
codecname = g_strdup_printf("AC-3 (0x%04x)",
codec_id);
break;
default:
g_warning ("avidemux: unkown audio format 0x%04x",
codec_id);
break;
}
if (strf != NULL && codecname != NULL) {
/* set audio codec in streaminfo */
GstPropsEntry *entry;
entry = gst_props_entry_new("audiocodec",
GST_PROPS_STRING(codecname));
gst_props_add_entry(avi_demux->streaminfo->properties, entry);
}
if (codecname != NULL) {
g_free (codecname);
}
return caps;
}
static void
gst_avi_demux_strf_auds (GstAviDemux *avi_demux)
{
gst_riff_strf_auds *strf;
guint8 *strfdata;
GstPad *srcpad;
GstCaps *newcaps = NULL, *capslist = NULL;
GstCaps *caps = NULL;
avi_stream_context *stream;
GstByteStream *bs = avi_demux->bs;
guint32 got_bytes;
gchar *codecname;
GstPropsEntry *entry;
gchar *padname;
got_bytes = gst_bytestream_peek_bytes (bs, &strfdata, sizeof (gst_riff_strf_auds));
strf = (gst_riff_strf_auds *) strfdata;
@ -783,104 +939,17 @@ gst_avi_demux_strf_auds (GstAviDemux *avi_demux)
GST_INFO ( "gst_avi_demux: blockalign %d", GUINT16_FROM_LE (strf->blockalign));
GST_INFO ( "gst_avi_demux: size %d", GUINT16_FROM_LE (strf->size));
srcpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_audio_templ), g_strdup_printf ("audio_%02d",
avi_demux->num_a_streams));
padname = g_strdup_printf ("audio_%02d",
avi_demux->num_a_streams);
srcpad = gst_pad_new_from_template (audiosrctempl, padname);
g_free (padname);
capslist = gst_caps_append(NULL, GST_CAPS_NEW (
"avidemux_audio_src",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds"),
"fmt", GST_PROPS_INT (GUINT16_FROM_LE (strf->format)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (strf->channels)),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (strf->rate)),
"av_bps", GST_PROPS_INT (GUINT32_FROM_LE (strf->av_bps)),
"blockalign", GST_PROPS_INT (GUINT16_FROM_LE (strf->blockalign)),
"size", GST_PROPS_INT (GUINT16_FROM_LE (strf->size))
));
caps = gst_avi_demux_audio_caps (GUINT16_FROM_LE (strf->format),
strf, avi_demux);
/* let's try some gstreamer-formatted mime types */
switch (GUINT16_FROM_LE(strf->format))
{
case GST_RIFF_WAVE_FORMAT_MPEGL3:
case GST_RIFF_WAVE_FORMAT_MPEGL12: /* mp3 */
newcaps = gst_caps_new ("avidemux_audio_src",
"audio/x-mp3",
NULL);
codecname = g_strdup_printf("MPEG/audio (0x%04x)",
strf->format);
break;
case GST_RIFF_WAVE_FORMAT_PCM: /* PCM/wav */
newcaps = gst_caps_new ("avidemux_audio_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_BOOLEAN ((GUINT16_FROM_LE (strf->size) != 8)),
"width", GST_PROPS_INT ((GUINT16_FROM_LE (strf->blockalign)*8) /
GUINT16_FROM_LE (strf->channels)),
"depth", GST_PROPS_INT (GUINT16_FROM_LE (strf->size)),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (strf->rate)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (strf->channels)),
NULL
));
codecname = g_strdup_printf("Raw PCM/WAV (0x%04x)",
strf->format);
break;
case GST_RIFF_WAVE_FORMAT_MULAW:
case GST_RIFF_WAVE_FORMAT_ALAW:
if (strf->size != 8)
g_warning ("invalid depth (%d) of mulaw/alaw audio, overwriting.", strf->size);
newcaps = gst_caps_new ("avidemux_audio_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (GUINT16_FROM_LE(strf->format) == GST_RIFF_WAVE_FORMAT_ALAW ? 2 : 1),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
"rate", GST_PROPS_INT (GUINT32_FROM_LE (strf->rate)),
"channels", GST_PROPS_INT (GUINT16_FROM_LE (strf->channels)),
NULL
));
codecname = g_strdup_printf("%s-law encoded (0x%04x)",
GUINT16_FROM_LE(strf->format) == GST_RIFF_WAVE_FORMAT_ALAW ? "A" : "Mu", strf->format);
break;
case GST_RIFF_WAVE_FORMAT_VORBIS1: /* ogg/vorbis mode 1 */
case GST_RIFF_WAVE_FORMAT_VORBIS2: /* ogg/vorbis mode 2 */
case GST_RIFF_WAVE_FORMAT_VORBIS3: /* ogg/vorbis mode 3 */
case GST_RIFF_WAVE_FORMAT_VORBIS1PLUS: /* ogg/vorbis mode 1+ */
case GST_RIFF_WAVE_FORMAT_VORBIS2PLUS: /* ogg/vorbis mode 2+ */
case GST_RIFF_WAVE_FORMAT_VORBIS3PLUS: /* ogg/vorbis mode 3+ */
newcaps = gst_caps_new ("avidemux_audio_src",
"application/x-ogg",
NULL);
codecname = g_strdup_printf("Ogg/Vorbis (0x%04x)",
strf->format);
break;
case GST_RIFF_WAVE_FORMAT_A52:
newcaps = gst_caps_new ("avidemux_audio_src",
"audio/a52",
NULL);
codecname = g_strdup_printf("AC3/AC52 (0x%04x)",
strf->format);
break;
default:
g_warning ("avidemux: unkown audio format %d", GUINT16_FROM_LE(strf->format));
codecname = g_strdup_printf("Unknown (0x%04x)",
strf->format);
break;
if (caps != NULL) {
gst_pad_try_set_caps(srcpad, caps);
}
if (newcaps) capslist = gst_caps_append(capslist, newcaps);
/* set audio codec in streaminfo */
entry = gst_props_entry_new("audiocodec", GST_PROPS_STRING(codecname));
gst_props_add_entry(avi_demux->streaminfo->properties, entry);
g_free(codecname);
gst_pad_try_set_caps(srcpad, capslist);
gst_pad_set_formats_function (srcpad, gst_avi_demux_get_src_formats);
gst_pad_set_event_mask_function (srcpad, gst_avi_demux_get_event_mask);
gst_pad_set_event_function (srcpad, gst_avi_demux_handle_src_event);
@ -897,16 +966,25 @@ gst_avi_demux_strf_auds (GstAviDemux *avi_demux)
gst_element_add_pad (GST_ELEMENT (avi_demux), srcpad);
}
static GstCaps *
gst_avi_demux_iavs_caps (void)
{
return GST_CAPS_NEW ("avi_type_dv",
"video/x-dv",
"systemstream", GST_PROPS_BOOLEAN (TRUE));
}
static void
gst_avi_demux_strf_iavs (GstAviDemux *avi_demux)
{
gst_riff_strf_iavs *strf;
guint8 *strfdata;
GstPad *srcpad;
GstCaps *newcaps = NULL, *capslist = NULL;
GstCaps *caps = NULL;
avi_stream_context *stream;
GstByteStream *bs = avi_demux->bs;
guint32 got_bytes;
gchar *padname;
got_bytes = gst_bytestream_peek_bytes (bs, &strfdata, sizeof (gst_riff_strf_iavs));
strf = (gst_riff_strf_iavs *) strfdata;
@ -923,33 +1001,16 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux)
GST_INFO ( "gst_avi_demux: DVReserved1 %08x", GUINT32_FROM_LE (strf->DVReserved1));
GST_INFO ( "gst_avi_demux: DVReserved2 %08x", GUINT32_FROM_LE (strf->DVReserved2));
srcpad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d",
avi_demux->num_v_streams));
padname = g_strdup_printf ("video_%02d",
avi_demux->num_v_streams);
srcpad = gst_pad_new_from_template (videosrctempl, padname);
g_free (padname);
capslist = gst_caps_append(NULL, GST_CAPS_NEW (
"avidemux_video_src",
"video/avi",
"format", GST_PROPS_STRING ("strf_iavs"),
"DVAAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxSrc)),
"DVAAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxCtl)),
"DVAAuxSrc1", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxSrc1)),
"DVAAuxCtl1", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVAAuxCtl1)),
"DVVAuxSrc", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxSrc)),
"DVVAuxCtl", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVVAuxCtl)),
"DVReserved1", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved1)),
"DVReserved2", GST_PROPS_INT (GUINT32_FROM_LE (strf->DVReserved2))
));
caps = gst_avi_demux_iavs_caps ();
newcaps = gst_caps_new ("avi_type_dv",
"video/dv",
gst_props_new (
"format", GST_PROPS_STRING ("NTSC"), /* FIXME??? */
NULL));
if (newcaps) capslist = gst_caps_append(capslist, newcaps);
gst_pad_try_set_caps(srcpad, capslist);
if (caps != NULL) {
gst_pad_try_set_caps(srcpad, caps);
}
gst_pad_set_formats_function (srcpad, gst_avi_demux_get_src_formats);
gst_pad_set_event_mask_function (srcpad, gst_avi_demux_get_event_mask);
gst_pad_set_event_function (srcpad, gst_avi_demux_handle_src_event);
@ -1821,6 +1882,37 @@ plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
GstTypeFactory *type;
gint i = 0;
GstCaps *audcaps = NULL, *vidcaps = NULL, *temp;
guint32 vid_list[] = {
GST_MAKE_FOURCC('I','4','2','0'),
GST_MAKE_FOURCC('Y','U','Y','2'),
GST_MAKE_FOURCC('M','J','P','G'),
GST_MAKE_FOURCC('D','V','S','D'),
GST_MAKE_FOURCC('W','M','V','1'),
GST_MAKE_FOURCC('W','M','V','2'),
GST_MAKE_FOURCC('M','P','G','4'),
GST_MAKE_FOURCC('M','P','4','2'),
GST_MAKE_FOURCC('M','P','4','3'),
GST_MAKE_FOURCC('H','F','Y','U'),
GST_MAKE_FOURCC('D','I','V','3'),
GST_MAKE_FOURCC('M','P','E','G'),
GST_MAKE_FOURCC('H','2','6','3'),
GST_MAKE_FOURCC('D','I','V','X'),
GST_MAKE_FOURCC('X','V','I','D'),
GST_MAKE_FOURCC('3','I','V','1'),
0 /* end */
};
gint aud_list[] = {
GST_RIFF_WAVE_FORMAT_MPEGL3,
GST_RIFF_WAVE_FORMAT_MPEGL12,
GST_RIFF_WAVE_FORMAT_PCM,
GST_RIFF_WAVE_FORMAT_VORBIS1,
GST_RIFF_WAVE_FORMAT_A52,
GST_RIFF_WAVE_FORMAT_ALAW,
GST_RIFF_WAVE_FORMAT_MULAW,
-1 /* end */
};
/* this filter needs the riff parser */
if (!gst_library_load ("gstbytestream"))
@ -1835,9 +1927,28 @@ plugin_init (GModule *module, GstPlugin *plugin)
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_audio_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_video_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
for (i = 0; aud_list[i] != -1; i++) {
temp = gst_avi_demux_audio_caps (aud_list[i], NULL, NULL);
audcaps = gst_caps_append (audcaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
audcaps, NULL);
for (i = 0; vid_list[i] != 0; i++) {
temp = gst_avi_demux_video_caps (vid_list[i], NULL, NULL, NULL);
vidcaps = gst_caps_append (vidcaps, temp);
}
vidcaps = gst_caps_append (vidcaps,
gst_avi_demux_iavs_caps ());
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
vidcaps, NULL);
gst_element_factory_add_pad_template (factory, audiosrctempl);
gst_element_factory_add_pad_template (factory, videosrctempl);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (sink_templ));
type = gst_type_factory_new (&avidefinition);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
@ -1853,4 +1964,3 @@ GstPluginDesc plugin_desc = {
"avidemux",
plugin_init
};

View file

@ -83,56 +83,75 @@ GST_PAD_TEMPLATE_FACTORY (video_sink_factory,
"video_%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS_NEW (
"avimux_sink_video_avi",
"video/avi",
"format", GST_PROPS_STRING ("strf_vids")
),
GST_CAPS_NEW (
"avimux_sink_video_yuv",
"video/raw",
"video/x-raw-yuv",
"format", GST_PROPS_LIST (
GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','U','Y','2')),
GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0')),
GST_PROPS_FOURCC (GST_MAKE_FOURCC('Y','4','1','P'))
GST_PROPS_FOURCC (GST_MAKE_FOURCC('I','4','2','0'))
),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avimux_sink_video_rgb",
"video/raw",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC('R','G','B',' ')),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"depth", GST_PROPS_LIST(
GST_PROPS_INT(16),
GST_PROPS_INT(16),
GST_PROPS_INT(24),
GST_PROPS_INT(32)
),
"bpp", GST_PROPS_LIST(
GST_PROPS_INT(15),
GST_PROPS_INT(16),
GST_PROPS_INT(24),
GST_PROPS_INT(32)
)
),
GST_CAPS_NEW (
"avimux_sink_video_jpeg",
"video/jpeg",
"video/x-jpeg",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avimux_sink_video_divx",
"video/divx",
"video/x-divx",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"divxversion", GST_PROPS_INT_RANGE (3, 5)
),
GST_CAPS_NEW (
"avimux_sink_video_xvid",
"video/x-xvid",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avimux_sink_video_xvid",
"video/xvid",
"avimux_sink_video_3ivx",
"video/x-3ivx",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avimux_sink_video_msmpeg",
"video/x-msmpeg",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"msmpegversion", GST_PROPS_INT_RANGE (41, 43)
),
GST_CAPS_NEW (
"avimux_sink_video_mpeg",
"video/mpeg",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"mpegversion", GST_PROPS_INT (1),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
),
GST_CAPS_NEW (
"avimux_sink_video_h263",
"video/x-h263",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
),
GST_CAPS_NEW (
"avimux_sink_video_dv",
"video/x-dv",
"width", GST_PROPS_INT (720),
"height", GST_PROPS_LIST (
GST_PROPS_INT (576),
GST_PROPS_INT (480)
),
"systemstream", GST_PROPS_BOOLEAN (FALSE)
),
GST_CAPS_NEW (
"avimux_sink_video_hfyu",
"video/x-huffyuv",
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
)
@ -143,15 +162,8 @@ GST_PAD_TEMPLATE_FACTORY (audio_sink_factory,
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS_NEW (
"avimux_sink_audio",
"video/avi",
"format", GST_PROPS_STRING ("strf_auds")
),
GST_CAPS_NEW (
"avimux_sink_audio",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"avimux_sink_audio_raw",
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (TRUE),
@ -165,18 +177,27 @@ GST_PAD_TEMPLATE_FACTORY (audio_sink_factory,
GST_PROPS_INT (8),
GST_PROPS_INT (16)
),
"rate", GST_PROPS_INT_RANGE (1000, 48000),
"rate", GST_PROPS_INT_RANGE (1000, 96000),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"avimux_sink_audio",
"audio/x-mp3",
NULL
"avimux_sink_audio_mpeg",
"audio/mpeg",
"layer", GST_PROPS_INT_RANGE (1, 3),
"rate", GST_PROPS_INT_RANGE (1000, 96000),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"avimux_sink_audio",
"application/x-ogg",
NULL
"avimux_sink_audio_vorbis",
"audio/x-vorbis",
"rate", GST_PROPS_INT_RANGE (1000, 96000),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"avimux_sink_audio_ac3",
"audio/x-ac3",
"rate", GST_PROPS_INT_RANGE (1000, 96000),
"channels", GST_PROPS_INT_RANGE (1, 6)
)
)
@ -237,7 +258,8 @@ gst_avimux_class_init (GstAviMuxClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_BIGFILE,
g_param_spec_boolean("bigfile","Bigfile Support","Whether to capture large or small AVI files",
g_param_spec_boolean("bigfile","Bigfile Support",
"Support for openDML-2.0 (big) AVI files",
0,G_PARAM_READWRITE));
gstelement_class->request_new_pad = gst_avimux_request_new_pad;
@ -300,7 +322,7 @@ gst_avimux_init (GstAviMux *avimux)
}
static GstPadLinkReturn
gst_avimux_sinkconnect (GstPad *pad, GstCaps *vscaps)
gst_avimux_vidsinkconnect (GstPad *pad, GstCaps *vscaps)
{
GstAviMux *avimux;
GstCaps *caps;
@ -311,170 +333,188 @@ gst_avimux_sinkconnect (GstPad *pad, GstCaps *vscaps)
if (!GST_CAPS_IS_FIXED (vscaps))
return GST_PAD_LINK_DELAYED;
GST_DEBUG ("avimux: sinkconnect triggered on %s", gst_pad_get_name (pad));
GST_DEBUG ("avimux: video sinkconnect triggered on %s",
gst_pad_get_name (pad));
for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
{
const gchar* mimetype = gst_caps_get_mime(caps);
gfloat fps = 0.;
if (!strcmp (mimetype, "video/avi"))
{
const gchar* format;
gst_caps_get_string (caps, "format", &format);
/* global */
avimux->vids.size = sizeof(gst_riff_strf_vids);
avimux->vids.planes = 1;
gst_caps_get (caps, "width", &avimux->vids.width,
"height", &avimux->vids.height,
"framerate", &fps,
NULL);
if (fps != 0.)
avimux->vids_hdr.scale = avimux->vids_hdr.rate / fps;
if (!strncmp (format, "strf_vids", 9)) {
avimux->vids.size = sizeof(gst_riff_strf_vids);
gst_caps_get (caps,
"width", &avimux->vids.width,
"height", &avimux->vids.height,
"planes", &avimux->vids.planes,
"bit_cnt", &avimux->vids.bit_cnt,
"compression", &avimux->vids.compression,
"image_size", &avimux->vids.image_size,
"xpels_meter", &avimux->vids.xpels_meter,
"ypels_meter", &avimux->vids.ypels_meter,
"num_colors", &avimux->vids.num_colors,
"imp_colors", &avimux->vids.imp_colors,
NULL);
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->avi_hdr.width = avimux->vids.width;
avimux->avi_hdr.height = avimux->vids.height;
goto done;
}
else if (!strncmp (format, "strf_auds", 9)) {
gst_caps_get (caps,
"format", &avimux->auds.format,
"channels", &avimux->auds.channels,
"rate", &avimux->auds.rate,
"av_bps", &avimux->auds.av_bps,
"blockalign", &avimux->auds.blockalign,
"size", &avimux->auds.size,
NULL);
avimux->auds_hdr.samplesize = avimux->auds_hdr.scale = avimux->auds.blockalign;
avimux->auds_hdr.rate = avimux->auds.av_bps;
goto done;
}
}
else if (!strcmp (mimetype, "video/raw"))
if (!strcmp (mimetype, "video/x-raw-yuv"))
{
guint32 format;
gint temp;
gst_caps_get_fourcc_int (caps, "format", &format);
avimux->vids.compression = format;
switch (format)
{
case GST_MAKE_FOURCC('Y','U','Y','2'):
avimux->vids.bit_cnt = 16;
break;
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('Y','4','1','P'):
case GST_MAKE_FOURCC('R','G','B',' '):
avimux->vids.size = sizeof(gst_riff_strf_vids);
gst_caps_get (caps, "width", &avimux->vids.width,
"height", &avimux->vids.height, NULL);
avimux->vids.planes = 1;
switch (format)
{
case GST_MAKE_FOURCC('Y','U','Y','2'):
avimux->vids.bit_cnt = 16; /* YUY2 */
break;
case GST_MAKE_FOURCC('R','G','B',' '):
gst_caps_get_int (caps, "bpp", &temp); /* RGB */
avimux->vids.bit_cnt = temp;
break;
case GST_MAKE_FOURCC('Y','4','1','P'):
case GST_MAKE_FOURCC('I','4','2','0'):
avimux->vids.bit_cnt = 12; /* Y41P or I420 */
break;
}
gst_caps_get_fourcc_int(caps, "format", &avimux->vids.compression);
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->vids.image_size = avimux->vids.height * avimux->vids.width;
avimux->avi_hdr.width = avimux->vids.width;
avimux->avi_hdr.height = avimux->vids.height;
goto done;
default:
avimux->vids.bit_cnt = 12;
break;
}
}
else if (!strcmp (mimetype, "video/jpeg") ||
!strcmp (mimetype, "video/xvid") ||
!strcmp (mimetype, "video/divx"))
{
avimux->vids.size = sizeof(gst_riff_strf_vids);
gst_caps_get (caps, "width", &avimux->vids.width,
"height", &avimux->vids.height, NULL);
avimux->vids.planes = 1;
avimux->vids.bit_cnt = 24;
if (!strcmp (mimetype, "video/jpeg"))
goto done;
}
else
{
avimux->vids.bit_cnt = 24;
avimux->vids.compression = 0;
/* find format */
if (!strcmp (mimetype, "video/x-huffyuv")) {
avimux->vids.compression = GST_MAKE_FOURCC('H','F','Y','U');
} else if (!strcmp (mimetype, "video/x-jpeg")) {
avimux->vids.compression = GST_MAKE_FOURCC('M','J','P','G');
else if (!strcmp (mimetype, "video/divx"))
avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
else if (!strcmp (mimetype, "video/xvid"))
} else if (!strcmp (mimetype, "video/x-divx")) {
gint divxversion;
gst_caps_get_int (caps, "divxversion", &divxversion);
switch (divxversion) {
case 3:
avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','3');
break;
case 4:
avimux->vids.compression = GST_MAKE_FOURCC('D','I','V','X');
break;
case 5:
avimux->vids.compression = GST_MAKE_FOURCC('D','X','5','0');
break;
}
} else if (!strcmp (mimetype, "video/x-xvid")) {
avimux->vids.compression = GST_MAKE_FOURCC('X','V','I','D');
} else if (!strcmp (mimetype, "video/x-3ivx")) {
avimux->vids.compression = GST_MAKE_FOURCC('3','I','V','2');
} else if (!strcmp (mimetype, "video/x-msmpeg")) {
gint msmpegversion;
gst_caps_get_int (caps, "msmpegversion", &msmpegversion);
switch (msmpegversion) {
case 41:
avimux->vids.compression = GST_MAKE_FOURCC('M','P','G','4');
break;
case 42:
avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','2');
break;
case 43:
avimux->vids.compression = GST_MAKE_FOURCC('M','P','4','3');
break;
}
} else if (!strcmp (mimetype, "video/x-dv")) {
avimux->vids.compression = GST_MAKE_FOURCC('D','V','S','D');
} else if (!strcmp (mimetype, "video/x-h263")) {
avimux->vids.compression = GST_MAKE_FOURCC('H','2','6','3');
} else if (!strcmp (mimetype, "video/mpeg")) {
avimux->vids.compression = GST_MAKE_FOURCC('M','P','E','G');
}
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->avi_hdr.width = avimux->vids.width;
avimux->avi_hdr.height = avimux->vids.height;
avimux->vids.image_size = avimux->vids.height * avimux->vids.width;
goto done;
}
else if (!strcmp (mimetype, "audio/raw"))
{
gint width;
if (!avimux->vids.compression) {
continue;
}
avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
gst_caps_get (caps, "channels", &avimux->auds.channels,
"rate", &avimux->auds.rate,
"width", &width,
"depth", &avimux->auds.size,
NULL);
avimux->auds_hdr.rate = avimux->auds.av_bps = width * avimux->auds.rate * avimux->auds.channels / 8;
avimux->auds_hdr.samplesize = avimux->auds_hdr.scale = avimux->auds.blockalign = width * avimux->auds.channels/8;
goto done;
}
else if (!strcmp (mimetype, "audio/x-mp3"))
{
gint layer = 3;
if (GST_CAPS_PROPERTIES(caps) != NULL &&
gst_caps_has_property(caps, "layer"))
gst_caps_get_int(caps, "layer", &layer);
else
GST_DEBUG (
"No layer specified, assuming layer 3");
/* we don't need to do anything here, compressed mp3 contains it all */
avimux->auds.format = (layer == 3?
GST_RIFF_WAVE_FORMAT_MPEGL3 :
GST_RIFF_WAVE_FORMAT_MPEGL12);
avimux->auds_hdr.scale = avimux->auds_hdr.samplesize =
avimux->auds.blockalign = 1;
avimux->auds_hdr.rate = avimux->auds.av_bps = 0;
avimux->auds.size = 16;
/* nobody cares about this valus, but is has to be set (regardless of
* whether the value is correct) */
avimux->auds.channels = 1;
/* we'll request this later on from the earlier pads */
avimux->auds.rate = 0;
goto done;
}
else if (!strcmp (mimetype, "application/x-ogg"))
{
avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS1;
avimux->auds_hdr.scale = avimux->auds_hdr.samplesize =
avimux->auds.blockalign = 1;
avimux->auds_hdr.rate = avimux->auds.av_bps = 0;
avimux->auds.size = 16;
/* see above */
avimux->auds.channels = 1;
avimux->auds.rate = 0;
goto done;
}
}
return GST_PAD_LINK_REFUSED;
done:
avimux->vids_hdr.fcc_handler = avimux->vids.compression;
avimux->vids.image_size = avimux->vids.height * avimux->vids.width;
avimux->avi_hdr.width = avimux->vids.width;
avimux->avi_hdr.height = avimux->vids.height;
avimux->avi_hdr.us_frame = avimux->vids_hdr.scale;
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
gst_avimux_audsinkconnect (GstPad *pad, GstCaps *vscaps)
{
GstAviMux *avimux;
GstCaps *caps;
avimux = GST_AVIMUX (gst_pad_get_parent (pad));
/* we are not going to act on variable caps */
if (!GST_CAPS_IS_FIXED (vscaps))
return GST_PAD_LINK_DELAYED;
GST_DEBUG ("avimux: audio sinkconnect triggered on %s",
gst_pad_get_name (pad));
for (caps = vscaps; caps != NULL; caps = vscaps = vscaps->next)
{
const gchar* mimetype = gst_caps_get_mime(caps);
/* we want these for all */
gst_caps_get (caps, "channels", &avimux->auds.channels,
"rate", &avimux->auds.rate,
NULL);
if (!strcmp (mimetype, "audio/x-raw-int"))
{
avimux->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
gst_caps_get (caps, "width", &avimux->auds.blockalign,
"depth", &avimux->auds.size,
NULL);
/* set some more info straight */
avimux->auds.blockalign /= 8;
avimux->auds.blockalign *= avimux->auds.channels;
avimux->auds.av_bps = avimux->auds.blockalign * avimux->auds.rate;
goto done;
}
else if (!strcmp (mimetype, "audio/mpeg") ||
!strcmp (mimetype, "audio/x-vorbis") ||
!strcmp (mimetype, "audio/x-ac3"))
{
avimux->auds.format = 0;
if (!strcmp (mimetype, "audio/mpeg")) {
gint layer = 3;
gst_caps_get_int(caps, "layer", &layer);
switch (layer) {
case 3:
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3;
break;
case 1: case 2:
avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12;
break;
}
} else if (!strcmp (mimetype, "audio/x-vorbis")) {
avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3;
} else if (!strcmp (mimetype, "audio/x-ac3")) {
avimux->auds.format = GST_RIFF_WAVE_FORMAT_A52;
}
avimux->auds.blockalign = 1;
avimux->auds.av_bps = 0;
avimux->auds.size = 16;
if (!avimux->auds.format) {
continue;
}
goto done;
}
}
return GST_PAD_LINK_REFUSED;
done:
avimux->auds_hdr.rate = avimux->auds.blockalign * avimux->auds.rate;
avimux->auds_hdr.samplesize = avimux->auds.blockalign;
avimux->auds_hdr.scale = avimux->auds.blockalign;
return GST_PAD_LINK_OK;
}
@ -552,11 +592,13 @@ gst_avimux_request_new_pad (GstElement *element,
if (templ == GST_PAD_TEMPLATE_GET (audio_sink_factory)) {
g_return_val_if_fail(avimux->audiosinkpad == NULL, NULL);
newpad = gst_pad_new_from_template (templ, "audio_00");
gst_pad_set_link_function (newpad, gst_avimux_audsinkconnect);
avimux->audiosinkpad = newpad;
}
else if (templ == GST_PAD_TEMPLATE_GET (video_sink_factory)) {
g_return_val_if_fail(avimux->videosinkpad == NULL, NULL);
newpad = gst_pad_new_from_template (templ, "video_00");
gst_pad_set_link_function (newpad, gst_avimux_vidsinkconnect);
avimux->videosinkpad = newpad;
}
else {
@ -568,7 +610,6 @@ gst_avimux_request_new_pad (GstElement *element,
G_CALLBACK(gst_avimux_pad_link), (gpointer)avimux);
g_signal_connect(newpad, "unlinked",
G_CALLBACK(gst_avimux_pad_unlink), (gpointer)avimux);
gst_pad_set_link_function (newpad, gst_avimux_sinkconnect);
gst_element_add_pad (element, newpad);
gst_pad_set_event_function(newpad, gst_avimux_handle_event);
gst_pad_set_event_mask_function(newpad, gst_avimux_get_event_masks);
@ -997,25 +1038,12 @@ gst_avimux_stop_file (GstAviMux *avimux)
avimux->avi_hdr.tot_frames = avimux->num_frames;
if (avimux->video_pad_connected) {
avimux->vids_hdr.length = avimux->num_frames;
/* get fps */
framerate = gst_video_frame_rate(GST_PAD_PEER(avimux->videosinkpad));
avimux->vids_hdr.scale = 1000000 / framerate;
}
if (avimux->audio_pad_connected)
{
if (avimux->auds_hdr.scale)
avimux->auds_hdr.length = avimux->audio_size/(avimux->auds.channels*avimux->auds.size/8);
else
avimux->auds_hdr.length = 0; /* urm...? FIXME! ;-) */
/* sampling rate, if known - yes this is a hack */
if (!avimux->auds.rate)
avimux->auds.rate = gst_video_frame_rate(GST_PAD_PEER(avimux->audiosinkpad));
if (avimux->audio_pad_connected) {
avimux->auds_hdr.length = avimux->audio_size/avimux->auds.blockalign;
}
/* set rate and everything having to do with that */
avimux->avi_hdr.us_frame = avimux->vids_hdr.scale;
avimux->avi_hdr.max_bps = 0;
if (avimux->audio_pad_connected) {
/* calculate bps if needed */

View file

@ -58,10 +58,15 @@ GST_PAD_TEMPLATE_FACTORY (cutter_src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"test_src",
"audio/raw",
"channels", GST_PROPS_INT_RANGE (1, 2)
gst_caps_new (
"cutter_src_int",
"audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
),
gst_caps_new (
"cutter_src_float",
"audio/x-raw-float",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
)
);
@ -69,10 +74,15 @@ GST_PAD_TEMPLATE_FACTORY (cutter_sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"test_src",
"audio/raw",
"channels", GST_PROPS_INT_RANGE (1, 2)
gst_caps_new (
"cutter_sink_int",
"audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
),
gst_caps_new (
"cutter_sink_float",
"audio/x-raw-float",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
)
);
@ -126,7 +136,7 @@ gst_cutter_link (GstPad *pad, GstCaps *caps)
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
if (GST_CAPS_IS_FIXED (caps))
return gst_pad_try_set_caps (otherpad, caps);
return gst_pad_try_set_caps (otherpad, gst_caps_ref (caps));
return GST_PAD_LINK_DELAYED;
}
@ -198,7 +208,7 @@ gst_cutter_init (GstCutter *filter)
gst_pad_set_link_function (filter->sinkpad, gst_cutter_link);
filter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
gst_pad_set_link_function (filter->srcpad, gst_cutter_link);
/*gst_pad_set_link_function (filter->srcpad, gst_cutter_link);*/
}
static void

View file

@ -169,7 +169,7 @@ gst_agingtv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->aging_mode = 0;
aging_mode_switch (filter);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -175,7 +175,7 @@ gst_dicetv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->dicemap = (gchar *) g_malloc (filter->height * filter->width * sizeof(char));
gst_dicetv_create_map (filter);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -153,7 +153,7 @@ gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->map = (guint32 *)g_malloc (filter->map_width * filter->map_height * sizeof(guint32) * 2);
bzero(filter->map, filter->map_width * filter->map_height * sizeof(guint32) * 2);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include "gsteffectv.h"
@ -55,18 +56,10 @@ gst_effectv_src_factory (void)
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"effectv_src",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (0xff0000),
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
"video/x-raw-rgb",
GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
)
);
}
@ -82,18 +75,10 @@ gst_effectv_sink_factory (void)
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"effectv_sink",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (0xff0000),
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
"video/x-raw-rgb",
GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
)
);
}

View file

@ -180,7 +180,7 @@ gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->planetable[i] = NULL;
}
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -184,7 +184,7 @@ gst_revtv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_caps_get_int (caps, "width", &filter->width);
gst_caps_get_int (caps, "height", &filter->height);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -165,7 +165,7 @@ gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_shagadelic_initialize (filter);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -199,7 +199,7 @@ gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->alt_buffer = filter->buffer + area;
filter->phase = 0;
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -163,7 +163,7 @@ gst_warptv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_warptv_initialize (filter);
return gst_pad_try_set_caps (filter->srcpad, caps);
return gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps));
}
static void

View file

@ -24,6 +24,7 @@
#include "flx_fmt.h"
#include "gstflxdec.h"
#include <gst/video/video.h>
#define JIFFIE (GST_SECOND/70)
@ -64,7 +65,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"flxdec_sink",
"video/fli",
"video/x-fli",
NULL
)
)
@ -76,16 +77,16 @@ GST_PAD_TEMPLATE_FACTORY (src_video_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"src_video",
"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),
"green_mask", GST_PROPS_INT (0x0000ff00),
"blue_mask", GST_PROPS_INT (0x000000ff),
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"red_mask", GST_PROPS_INT (R_MASK_32),
"green_mask", GST_PROPS_INT (G_MASK_32),
"blue_mask", GST_PROPS_INT (B_MASK_32),
"width", GST_PROPS_INT_RANGE(320, 1280),
"height", GST_PROPS_INT_RANGE(200, 1024)
"height", GST_PROPS_INT_RANGE(200, 1024),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
)
)
@ -520,20 +521,18 @@ gst_flxdec_loop (GstElement *element)
}
gst_pad_try_set_caps (flxdec->srcpad,
gst_caps_new (
GST_CAPS_NEW (
"src_video",
"video/raw",
gst_props_new (
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' ')),
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"red_mask", GST_PROPS_INT (0x00ff0000),
"green_mask", GST_PROPS_INT (0x0000ff00),
"blue_mask", GST_PROPS_INT (0x000000ff),
"width", GST_PROPS_INT (flxh->width),
"height", GST_PROPS_INT (flxh->height),
NULL)));
"video/x-raw-rgb",
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BIG_ENDIAN),
"red_mask", GST_PROPS_INT (R_MASK_32),
"green_mask", GST_PROPS_INT (G_MASK_32),
"blue_mask", GST_PROPS_INT (B_MASK_32),
"width", GST_PROPS_INT (flxh->width),
"height", GST_PROPS_INT (flxh->height),
"framerate", GST_PROPS_FLOAT (GST_SECOND/flxdec->frame_time)));
if (flxh->depth <= 8)
flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);

View file

@ -22,7 +22,7 @@
#endif
#include <config.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include "goom_core.h"
#define GST_TYPE_GOOM (gst_goom_get_type())
@ -45,7 +45,7 @@ struct _GstGOOM {
gint16 datain[2][512];
/* video state */
gint fps;
gfloat fps;
gint width;
gint height;
gint channels;
@ -78,9 +78,6 @@ enum {
enum {
ARG_0,
ARG_WIDTH,
ARG_HEIGHT,
ARG_FPS,
/* FILL ME */
};
@ -88,31 +85,21 @@ GST_PAD_TEMPLATE_FACTORY (src_template,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"goomsrc",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (0xff0000),
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
"video/x-raw-rgb",
GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32
)
)
GST_PAD_TEMPLATE_FACTORY (sink_template,
"sink", /* the name of the pads */
"sink", /* the name of the pads */
GST_PAD_SINK, /* type of the pad */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_CAPS_NEW (
"goomsink", /* the name of the caps */
"audio/raw", /* the mime type 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 (16),
@ -130,11 +117,6 @@ static void gst_goom_dispose (GObject *object);
static GstElementStateReturn
gst_goom_change_state (GstElement *element);
static void gst_goom_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_goom_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static void gst_goom_chain (GstPad *pad, GstBuffer *buf);
static GstPadLinkReturn gst_goom_sinkconnect (GstPad *pad, GstCaps *caps);
@ -175,19 +157,7 @@ gst_goom_class_init(GstGOOMClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH,
g_param_spec_int ("width","Width","The Width",
0, 2048, 320, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT,
g_param_spec_int ("height","Height","The height",
0, 2048, 320, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
g_param_spec_int ("fps","FPS","Frames per second",
1, 100, 25, G_PARAM_READWRITE));
gobject_class->dispose = gst_goom_dispose;
gobject_class->set_property = gst_goom_set_property;
gobject_class->get_property = gst_goom_get_property;
gstelement_class->change_state = gst_goom_change_state;
}
@ -212,7 +182,7 @@ gst_goom_init (GstGOOM *goom)
goom->width = 320;
goom->height = 200;
goom->fps = 25; /* desired frame rate */
goom->fps = 25.; /* desired frame rate */
goom->channels = 0;
/* set to something */
goom_init (50, 50);
@ -251,8 +221,15 @@ gst_goom_srcconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_DELAYED;
}
gst_caps_get_int (caps, "width", &goom->width);
gst_caps_get_int (caps, "height", &goom->height);
if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "width", &goom->width);
}
if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "height", &goom->height);
}
if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
gst_caps_get_float (caps, "framerate", &goom->fps);
}
goom_set_resolution (goom->width, goom->height);
goom->srcnegotiated = TRUE;
@ -276,7 +253,8 @@ gst_goom_negotiate_default (GstGOOM *goom)
"green_mask", GST_PROPS_INT (0x00ff00),
"blue_mask", GST_PROPS_INT (0x0000ff),
"width", GST_PROPS_INT (goom->width),
"height", GST_PROPS_INT (goom->height)
"height", GST_PROPS_INT (goom->height),
"framerate", GST_PROPS_FLOAT (goom->fps)
);
if (gst_pad_try_set_caps (goom->srcpad, caps) <= 0) {
@ -401,54 +379,6 @@ gst_goom_change_state (GstElement *element)
return GST_STATE_SUCCESS;
}
static void
gst_goom_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GstGOOM *goom;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_GOOM (object));
goom = GST_GOOM (object);
switch (prop_id) {
case ARG_WIDTH:
goom->width = g_value_get_int (value);
break;
case ARG_HEIGHT:
goom->height = g_value_get_int (value);
break;
case ARG_FPS:
goom->fps = g_value_get_int (value);
break;
default:
break;
}
}
static void
gst_goom_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstGOOM *goom;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_GOOM (object));
goom = GST_GOOM (object);
switch (prop_id) {
case ARG_WIDTH:
g_value_set_int (value, goom->width);
break;
case ARG_HEIGHT:
g_value_set_int (value, goom->height);
break;
case ARG_FPS:
g_value_set_int (value, goom->fps);
break;
default:
break;
}
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{

View file

@ -86,9 +86,7 @@ alawdec_link (GstPad *pad, GstCaps *caps)
tempcaps = GST_CAPS_NEW (
"alawdec_src_caps",
"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),

View file

@ -126,9 +126,7 @@ alawenc_link (GstPad *pad, GstCaps *caps)
tempcaps = GST_CAPS_NEW (
"alawenc_src_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (2),
"audio/x-alaw",
"depth", GST_PROPS_INT (8),
"width", GST_PROPS_INT (8),
"signed", GST_PROPS_BOOLEAN (FALSE),

View file

@ -32,14 +32,11 @@ alaw_factory (void)
return
gst_caps_new (
"test_src",
"audio/raw",
"audio/x-alaw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (2),
"width", GST_PROPS_INT(8),
"depth", GST_PROPS_INT(8),
"signed", GST_PROPS_BOOLEAN(FALSE),
NULL));
"rate", GST_PROPS_INT_RANGE (8000, 192000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}
static GstCaps*
@ -48,14 +45,14 @@ linear_factory (void)
return
gst_caps_new (
"test_sink",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT(0),
"width", GST_PROPS_INT(16),
"depth", GST_PROPS_INT(16),
"endianness", GST_PROPS_INT(G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN(TRUE),
"width", GST_PROPS_INT(16),
"depth", GST_PROPS_INT(16),
"endianness", GST_PROPS_INT(G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN(TRUE),
"rate", GST_PROPS_INT_RANGE (8000, 192000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}

View file

@ -65,9 +65,7 @@ mulawdec_link (GstPad *pad, GstCaps *caps)
tempcaps = GST_CAPS_NEW (
"sinesrc_src_caps",
"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),

View file

@ -64,9 +64,7 @@ mulawenc_link (GstPad *pad, GstCaps *caps)
tempcaps = GST_CAPS_NEW (
"sinesrc_src_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (1),
"audio/x-mulaw",
"depth", GST_PROPS_INT (8),
"width", GST_PROPS_INT (8),
"signed", GST_PROPS_BOOLEAN (FALSE),

View file

@ -32,13 +32,13 @@ mulaw_factory (void)
return
gst_caps_new (
"test_src",
"audio/raw",
"audio/x-mulaw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (1),
"width", GST_PROPS_INT(8),
"depth", GST_PROPS_INT(8),
"signed", GST_PROPS_BOOLEAN(FALSE),
"width", GST_PROPS_INT(8),
"depth", GST_PROPS_INT(8),
"signed", GST_PROPS_BOOLEAN(FALSE),
"rate", GST_PROPS_INT_RANGE (8000, 192000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}
@ -48,14 +48,14 @@ linear_factory (void)
return
gst_caps_new (
"test_sink",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT(0),
"width", GST_PROPS_INT(16),
"depth", GST_PROPS_INT(16),
"signed", GST_PROPS_BOOLEAN(TRUE),
"endianness", GST_PROPS_INT(G_BYTE_ORDER),
"width", GST_PROPS_INT(16),
"depth", GST_PROPS_INT(16),
"signed", GST_PROPS_BOOLEAN(TRUE),
"endianness", GST_PROPS_INT(G_BYTE_ORDER),
"rate", GST_PROPS_INT_RANGE (8000, 192000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL));
}

View file

@ -23,6 +23,7 @@
#include <gst/gst.h>
#include "gstlevel.h"
#include "math.h"
#include <gst/audio/audio.h>
/* elementfactory information */
static GstElementDetails level_details = {
@ -58,11 +59,11 @@ level_src_factory (void)
GST_PAD_ALWAYS,
gst_caps_new (
"test_src",
"audio/raw",
gst_props_new (
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
"audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
),
NULL
);
}
return template;
}
@ -79,11 +80,11 @@ level_sink_factory (void)
GST_PAD_ALWAYS,
gst_caps_new (
"test_src",
"audio/raw",
gst_props_new (
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
"audio/x-raw-int",
GST_AUDIO_INT_PAD_TEMPLATE_PROPS
),
NULL
);
}
return template;
}
@ -137,7 +138,7 @@ gst_level_connect (GstPad *pad, GstCaps *caps)
if (GST_CAPS_IS_FIXED (caps))
{
/*if ( !volume_parse_caps (filter, caps) || */
return gst_pad_try_set_caps (otherpad, caps);
return gst_pad_try_set_caps (otherpad, gst_caps_ref (caps));
}
return GST_PAD_LINK_DELAYED;
}

View file

@ -22,6 +22,7 @@
#endif
#include <string.h>
#include <gstmedian.h>
#include <gst/video/video.h>
/* elementfactory information */
static GstElementDetails median_details = {
@ -38,10 +39,12 @@ GST_PAD_TEMPLATE_FACTORY (median_src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"median_src",
"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"))
)
)
)
@ -49,10 +52,12 @@ GST_PAD_TEMPLATE_FACTORY (median_sink_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"median_src",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
gst_caps_new (
"median_src",
"video/x-raw-yuv",
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS (
GST_PROPS_FOURCC (GST_STR_FOURCC ("I420"))
)
)
)

View file

@ -22,7 +22,7 @@
#endif
#include <config.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include "monoscope.h"
#define GST_TYPE_MONOSCOPE (gst_monoscope_get_type())
@ -46,7 +46,7 @@ struct _GstMonoscope {
gint16 datain[512];
/* video state */
gint fps;
gfloat fps;
gint width;
gint height;
gboolean first_buffer;
@ -81,9 +81,6 @@ enum {
enum {
ARG_0,
ARG_WIDTH,
ARG_HEIGHT,
ARG_FPS,
/* FILL ME */
};
@ -93,16 +90,16 @@ GST_PAD_TEMPLATE_FACTORY (src_template,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"monoscopesrc",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"video/x-raw-rgb",
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (0xff0000),
"green_mask", GST_PROPS_INT (0xff00),
"blue_mask", GST_PROPS_INT (0xff),
"red_mask", GST_PROPS_INT (R_MASK_32),
"green_mask", GST_PROPS_INT (G_MASK_32),
"blue_mask", GST_PROPS_INT (B_MASK_32),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096)
"height", GST_PROPS_INT_RANGE (16, 4096),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
)
)
@ -112,10 +109,8 @@ GST_PAD_TEMPLATE_FACTORY (sink_template,
GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
GST_CAPS_NEW (
"monoscopesink", /* the name of the caps */
"audio/raw", /* the mime type 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 (16),
@ -126,18 +121,15 @@ GST_PAD_TEMPLATE_FACTORY (sink_template,
)
static void gst_monoscope_class_init (GstMonoscopeClass *klass);
static void gst_monoscope_init (GstMonoscope *monoscope);
static void gst_monoscope_class_init (GstMonoscopeClass *klass);
static void gst_monoscope_init (GstMonoscope *monoscope);
static void gst_monoscope_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void gst_monoscope_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static void gst_monoscope_chain (GstPad *pad, GstBuffer *buf);
static void gst_monoscope_chain (GstPad *pad, GstBuffer *buf);
static GstPadLinkReturn
gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps);
gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps);
static GstPadLinkReturn
gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps);
static GstElementClass *parent_class = NULL;
@ -173,19 +165,6 @@ gst_monoscope_class_init(GstMonoscopeClass *klass)
gstelement_class = (GstElementClass*) klass;
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH,
g_param_spec_int ("width","Width","The Width",
1, 2048, 256, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT,
g_param_spec_int ("height","Height","The height",
1, 2048, 128, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
g_param_spec_int ("fps","FPS","Frames per second",
1, 100, 25, G_PARAM_READWRITE));
gobject_class->set_property = gst_monoscope_set_property;
gobject_class->get_property = gst_monoscope_get_property;
}
static void
@ -201,6 +180,7 @@ gst_monoscope_init (GstMonoscope *monoscope)
gst_pad_set_chain_function (monoscope->sinkpad, gst_monoscope_chain);
gst_pad_set_link_function (monoscope->sinkpad, gst_monoscope_sinkconnect);
gst_pad_set_link_function (monoscope->srcpad, gst_monoscope_srcconnect);
monoscope->next_time = 0;
monoscope->peerpool = NULL;
@ -209,8 +189,7 @@ gst_monoscope_init (GstMonoscope *monoscope)
monoscope->first_buffer = TRUE;
monoscope->width = 256;
monoscope->height = 128;
monoscope->fps = 25; /* desired frame rate */
monoscope->fps = 25.; /* desired frame rate */
}
static GstPadLinkReturn
@ -226,6 +205,50 @@ gst_monoscope_sinkconnect (GstPad *pad, GstCaps *caps)
return GST_PAD_LINK_OK;
}
static GstPadLinkReturn
gst_monoscope_negotiate (GstMonoscope *monoscope)
{
GstCaps *caps;
caps = GST_CAPS_NEW (
"monoscopesrc",
"video/x-raw-rgb",
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (R_MASK_32),
"green_mask", GST_PROPS_INT (G_MASK_32),
"blue_mask", GST_PROPS_INT (B_MASK_32),
"width", GST_PROPS_INT (monoscope->width),
"height", GST_PROPS_INT (monoscope->height),
"framerate", GST_PROPS_FLOAT (monoscope->fps)
);
return gst_pad_try_set_caps (monoscope->srcpad, caps);
}
static GstPadLinkReturn
gst_monoscope_srcconnect (GstPad *pad, GstCaps *caps)
{
GstPadLinkReturn ret;
GstMonoscope *monoscope = GST_MONOSCOPE (gst_pad_get_parent (pad));
if (gst_caps_has_property_typed (caps, "width", GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "width", &monoscope->width);
}
if (gst_caps_has_property_typed (caps, "height", GST_PROPS_INT_TYPE)) {
gst_caps_get_int (caps, "height", &monoscope->height);
}
if (gst_caps_has_property_typed (caps, "framerate", GST_PROPS_FLOAT_TYPE)) {
gst_caps_get_float (caps, "framerate", &monoscope->fps);
}
if ((ret = gst_monoscope_negotiate (monoscope)) <= 0)
return ret;
return GST_PAD_LINK_DONE;
}
static void
gst_monoscope_chain (GstPad *pad, GstBuffer *bufin)
{
@ -257,29 +280,14 @@ gst_monoscope_chain (GstPad *pad, GstBuffer *bufin)
}
if (monoscope->first_buffer) {
GstCaps *caps;
monoscope->visstate = monoscope_init (monoscope->width, monoscope->height);
g_assert(monoscope->visstate != 0);
GST_DEBUG ("making new pad");
caps = GST_CAPS_NEW (
"monoscopesrc",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("RGB ")),
"bpp", GST_PROPS_INT (32),
"depth", GST_PROPS_INT (32),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"red_mask", GST_PROPS_INT (0xff0000),
"green_mask", GST_PROPS_INT (0x00ff00),
"blue_mask", GST_PROPS_INT (0x0000ff),
"width", GST_PROPS_INT (monoscope->width),
"height", GST_PROPS_INT (monoscope->height)
);
if (gst_pad_try_set_caps (monoscope->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (monoscope), "could not set caps");
return;
if (!GST_PAD_CAPS (monoscope->srcpad)) {
if (gst_monoscope_negotiate (monoscope) <= 0) {
gst_element_error (GST_ELEMENT (monoscope), "could not set caps");
return;
}
}
monoscope->first_buffer = FALSE;
}
@ -300,54 +308,6 @@ gst_monoscope_chain (GstPad *pad, GstBuffer *bufin)
}
static void
gst_monoscope_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GstMonoscope *monoscope;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_MONOSCOPE (object));
monoscope = GST_MONOSCOPE (object);
switch (prop_id) {
case ARG_WIDTH:
monoscope->width = g_value_get_int (value);
break;
case ARG_HEIGHT:
monoscope->height = g_value_get_int (value);
break;
case ARG_FPS:
monoscope->fps = g_value_get_int (value);
break;
default:
break;
}
}
static void
gst_monoscope_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GstMonoscope *monoscope;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail (GST_IS_MONOSCOPE (object));
monoscope = GST_MONOSCOPE (object);
switch (prop_id) {
case ARG_WIDTH:
g_value_set_int (value, monoscope->width);
break;
case ARG_HEIGHT:
g_value_set_int (value, monoscope->height);
break;
case ARG_FPS:
g_value_set_int (value, monoscope->fps);
break;
default:
break;
}
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{

View file

@ -59,6 +59,7 @@ struct _QtDemuxSample {
int size;
guint32 offset;
guint64 timestamp;
guint64 duration;
};
struct _QtDemuxStream {
@ -73,6 +74,7 @@ struct _QtDemuxStream {
int width;
int height;
float fps;
double rate;
int n_channels;
};
@ -125,25 +127,12 @@ GST_PAD_TEMPLATE_FACTORY (sink_templ,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"qtdemux_sink",
"video/quicktime",
NULL
"video/quicktime",
NULL
)
)
GST_PAD_TEMPLATE_FACTORY (src_video_templ,
"video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
NULL
)
GST_PAD_TEMPLATE_FACTORY (src_audio_templ,
"audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
NULL
)
static GstPadTemplate *videosrctempl, *audiosrctempl;
static GstElementClass *parent_class = NULL;
static void gst_qtdemux_class_init (GstQTDemuxClass *klass);
@ -223,6 +212,15 @@ plugin_init (GModule *module, GstPlugin *plugin)
{
GstElementFactory *factory;
GstTypeFactory *type;
GstCaps *audiocaps = NULL, *videocaps = NULL, *temp;
const guint32 audio_fcc[] = {
/* FILLME */
0,
}, video_fcc[] = {
/* FILLME */
0,
};
gint i;
if (!gst_library_load ("gstbytestream"))
return FALSE;
@ -232,9 +230,27 @@ plugin_init (GModule *module, GstPlugin *plugin)
g_return_val_if_fail(factory != NULL, FALSE);
gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY);
for (i = 0; audio_fcc[i] != 0; i++) {
temp = qtdemux_audio_caps (NULL, audio_fcc[i]);
audiocaps = gst_caps_append (audiocaps, temp);
}
audiosrctempl = gst_pad_template_new ("audio_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
audiocaps, NULL);
for (i = 0; video_fcc[i] != 0; i++) {
temp = qtdemux_video_caps (NULL, video_fcc[i]);
videocaps = gst_caps_append (videocaps, temp);
}
videosrctempl = gst_pad_template_new ("video_%02d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
videocaps, NULL);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_video_templ));
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_audio_templ));
gst_element_factory_add_pad_template (factory, videosrctempl);
gst_element_factory_add_pad_template (factory, audiosrctempl);
type = gst_type_factory_new (&quicktimedefinition);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));
@ -484,7 +500,20 @@ static void gst_qtdemux_loop_header (GstElement *element)
}while(TRUE);
if(buf){
/* hum... */
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
float fps = 1. * GST_SECOND / stream->samples[stream->sample_index].duration;
if (fps != stream->fps) {
gst_props_remove_entry_by_name(stream->caps->properties, "framerate");
gst_props_add_entry(stream->caps->properties,
gst_props_entry_new("framerate", GST_PROPS_FLOAT(fps)));
stream->fps = fps;
gst_pad_try_set_caps(stream->pad, stream->caps);
}
}
GST_BUFFER_TIMESTAMP(buf) = stream->samples[stream->sample_index].timestamp;
GST_BUFFER_DURATION(buf) = stream->samples[stream->sample_index].duration;
gst_pad_push(stream->pad, buf);
}
stream->sample_index++;
@ -554,27 +583,31 @@ gst_qtdemux_src_link(GstPad *pad, GstCaps *caps)
void gst_qtdemux_add_stream(GstQTDemux *qtdemux, QtDemuxStream *stream)
{
if(stream->subtype == GST_MAKE_FOURCC('v','i','d','e')){
stream->pad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_video_templ), g_strdup_printf ("video_%02d",
qtdemux->n_video_streams));
stream->pad = gst_pad_new_from_template (videosrctempl,
g_strdup_printf ("video_%02d", qtdemux->n_video_streams));
stream->fps = 1. * GST_SECOND / stream->samples[0].duration;
if(stream->caps){
stream->caps->properties = gst_props_intersect(
GstProps *properties = gst_props_intersect(
stream->caps->properties,
gst_props_new("width",GST_PROPS_INT(stream->width),
"height",GST_PROPS_INT(stream->height), NULL));
"height",GST_PROPS_INT(stream->height),
"framerate", GST_PROPS_FLOAT(stream->fps), NULL));
if (stream->caps->properties != NULL)
gst_props_unref (stream->caps->properties);
stream->caps->properties = properties;
}
qtdemux->n_video_streams++;
}else{
stream->pad = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (src_audio_templ), g_strdup_printf ("audio_%02d",
qtdemux->n_audio_streams));
stream->pad = gst_pad_new_from_template (audiosrctempl,
g_strdup_printf ("audio_%02d", qtdemux->n_audio_streams));
if(stream->caps){
g_print("props were %s\n",gst_props_to_string(stream->caps->properties));
stream->caps->properties = gst_props_intersect(
GstProps *properties = gst_props_intersect(
stream->caps->properties,
gst_props_new("rate",GST_PROPS_INT((int)stream->rate),
"channels",GST_PROPS_INT(stream->n_channels), NULL));
g_print("props now %s\n",gst_props_to_string(stream->caps->properties));
if (stream->caps->properties != NULL)
gst_props_unref (stream->caps->properties);
stream->caps->properties = properties;
}
qtdemux->n_audio_streams++;
}
@ -1302,6 +1335,7 @@ static void qtdemux_parse_trak(GstQTDemux *qtdemux, GNode *trak)
stream->width = QTDEMUX_GUINT16_GET(stsd->data+offset+32);
stream->height = QTDEMUX_GUINT16_GET(stsd->data+offset+34);
stream->fps = 0.; /* this is filled in later */
g_print("frame count: %u\n", QTDEMUX_GUINT16_GET(stsd->data+offset+48));
@ -1416,6 +1450,7 @@ done:
time = (GST_SECOND * duration)/stream->timescale;
for(j=0;j<n;j++){
samples[index].timestamp = timestamp;
samples[index].duration = time;
timestamp += time;
index++;
}
@ -1487,6 +1522,7 @@ done2:
size = samples[index+1].sample_index - samples[index].sample_index;
time = (GST_SECOND * duration * samples[index].size)/stream->timescale ;
timestamp += time;
samples[index].duration = time;
}
}
}
@ -1509,43 +1545,87 @@ static GstCaps *qtdemux_video_caps(GstQTDemux *qtdemux, guint32 fourcc)
switch(fourcc){
case GST_MAKE_FOURCC('j','p','e','g'):
/* JPEG */
return GST_CAPS_NEW("jpeg_caps","video/jpeg",NULL);
return GST_CAPS_NEW("jpeg_caps","video/x-jpeg",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('m','j','p','a'):
/* Motion-JPEG (format A) */
return GST_CAPS_NEW("mjpa_caps","video/jpeg",NULL);
return GST_CAPS_NEW("mjpa_caps","video/x-jpeg",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('m','j','p','b'):
/* Motion-JPEG (format B) */
return GST_CAPS_NEW("mjpa_caps","video/jpeg",NULL);
return GST_CAPS_NEW("mjpb_caps","video/x-jpeg",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('S','V','Q','3'):
return GST_CAPS_NEW("SVQ3_caps","video/x-svq",
"svqversion", GST_PROPS_INT(3),NULL);
"svqversion", GST_PROPS_INT(3),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('s','v','q','i'):
case GST_MAKE_FOURCC('S','V','Q','1'):
return GST_CAPS_NEW("SVQ1_caps","video/x-svq",
"svqversion", GST_PROPS_INT(1),NULL);
"svqversion", GST_PROPS_INT(1),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('r','a','w',' '):
/* uncompressed RGB */
return GST_CAPS_NEW("raw__caps","video/raw",
"format",GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')));
return GST_CAPS_NEW("raw__caps","video/x-raw-rgb",
"endianness",GST_PROPS_INT(G_BIG_ENDIAN),
/*"bpp", GST_PROPS_INT(x),
"depth", GST_PROPS_INT(x),
"red_mask", GST_PROPS_INT(x),
"green_mask", GST_PROPS_INT(x),
"blue_mask", GST_PROPS_INT(x), FIXME! */
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('Y','u','v','2'):
/* uncompressed YUV2 */
return GST_CAPS_NEW("Yuv2_caps","video/raw",
"format",GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','V','2')));
return GST_CAPS_NEW("Yuv2_caps","video/x-raw-yuv",
"format",GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','V','2')),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('m','p','e','g'):
/* MPEG */
return GST_CAPS_NEW("mpeg_caps","video/mpeg",NULL);
return GST_CAPS_NEW("mpeg_caps","video/mpeg",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096),
"systemstream", GST_PROPS_BOOLEAN(FALSE),
"mpegversion", GST_PROPS_INT(1));
case GST_MAKE_FOURCC('g','i','f',' '):
return GST_CAPS_NEW("gif__caps","image/gif",NULL);
return GST_CAPS_NEW("gif__caps","image/gif",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('h','2','6','3'):
/* H.263 */
/* ffmpeg uses the height/width props, don't know why */
return GST_CAPS_NEW("h263_caps","video/h263",NULL);
return GST_CAPS_NEW("h263_caps","video/x-h263",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('m','p','4','v'):
/* MPEG-4 */
return GST_CAPS_NEW("mp4v_caps", "video/mpeg",
"mpegversion",GST_PROPS_INT(4));
"mpegversion",GST_PROPS_INT(4),
"systemstream", GST_PROPS_BOOLEAN(FALSE),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('3','I','V','1'):
return GST_CAPS_NEW("3IV1_caps", "video/3ivx",NULL);
return GST_CAPS_NEW("3IV1_caps", "video/x-3ivx",
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT),
"width", GST_PROPS_INT_RANGE (16, 4096),
"height", GST_PROPS_INT_RANGE (16, 4096));
case GST_MAKE_FOURCC('r','p','z','a'):
case GST_MAKE_FOURCC('c','v','i','d'):
/* Cinepak */
@ -1564,12 +1644,10 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
{
switch(fourcc){
case GST_MAKE_FOURCC('N','O','N','E'):
return GST_CAPS_NEW("NONE_caps","audio/raw",NULL);
return NULL; /*GST_CAPS_NEW("NONE_caps","audio/raw",NULL);*/
case GST_MAKE_FOURCC('r','a','w',' '):
/* FIXME */
return GST_CAPS_NEW("raw__caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(0),
return GST_CAPS_NEW("raw__caps","audio/x-raw-int",
"width",GST_PROPS_INT(8),
"depth",GST_PROPS_INT(8),
"signed",GST_PROPS_BOOLEAN(FALSE),
@ -1577,9 +1655,7 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('t','w','o','s'):
/* FIXME */
return GST_CAPS_NEW("twos_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(0),
return GST_CAPS_NEW("twos_caps","audio/x-raw-int",
"width",GST_PROPS_INT(16),
"depth",GST_PROPS_INT(16),
"endianness",GST_PROPS_INT(G_BIG_ENDIAN),
@ -1588,9 +1664,7 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('s','o','w','t'):
/* FIXME */
return GST_CAPS_NEW("sowt_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(0),
return GST_CAPS_NEW("sowt_caps","audio/x-raw-int",
"width",GST_PROPS_INT(16),
"depth",GST_PROPS_INT(16),
"endianness",GST_PROPS_INT(G_LITTLE_ENDIAN),
@ -1598,22 +1672,24 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('f','l','6','4'):
return GST_CAPS_NEW("fl64_caps","audio/raw",
"format",GST_PROPS_STRING("float"),
"layout",GST_PROPS_STRING("gdouble"),
return GST_CAPS_NEW("fl64_caps","audio/x-raw-float",
"depth",GST_PROPS_INT (64),
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
"intercept",GST_PROPS_FLOAT (0.0),
"slope",GST_PROPS_FLOAT (1.0),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('f','l','3','2'):
return GST_CAPS_NEW("fl32_caps","audio/raw",
"format",GST_PROPS_STRING("float"),
"layout",GST_PROPS_STRING("gfloat"),
return GST_CAPS_NEW("fl32_caps","audio/x-raw-float",
"depth",GST_PROPS_INT (32),
"endianness",GST_PROPS_INT (G_BIG_ENDIAN),
"intercept",GST_PROPS_FLOAT (0.0),
"slope",GST_PROPS_FLOAT (1.0),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('i','n','2','4'):
/* FIXME */
return GST_CAPS_NEW("in24_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(0),
return GST_CAPS_NEW("in24_caps","audio/x-raw-int",
"width",GST_PROPS_INT(24),
"depth",GST_PROPS_INT(32),
"endianness",GST_PROPS_INT(G_BIG_ENDIAN),
@ -1622,9 +1698,7 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('i','n','3','2'):
/* FIXME */
return GST_CAPS_NEW("in32_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(0),
return GST_CAPS_NEW("in32_caps","audio/x-raw-int",
"width",GST_PROPS_INT(24),
"depth",GST_PROPS_INT(32),
"endianness",GST_PROPS_INT(G_BIG_ENDIAN),
@ -1632,42 +1706,70 @@ static GstCaps *qtdemux_audio_caps(GstQTDemux *qtdemux, guint32 fourcc)
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('u','l','a','w'):
/* FIXME */
return GST_CAPS_NEW("ulaw_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(2),
return GST_CAPS_NEW("ulaw_caps","audio/x-mulaw",
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case GST_MAKE_FOURCC('a','l','a','w'):
/* FIXME */
return GST_CAPS_NEW("alaw_caps","audio/raw",
"format",GST_PROPS_STRING("int"),
"law", GST_PROPS_INT(1),
return GST_CAPS_NEW("alaw_caps","audio/x-alaw",
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT));
case 0x6d730002:
/* Microsoft ADPCM-ACM code 2 */
return GST_CAPS_NEW("msxx_caps","audio/adpcm",NULL);
return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
"layout", GST_PROPS_STRING("microsoft"),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case 0x6d730011:
/* FIXME DVI/Intel IMA ADPCM/ACM code 17 */
return GST_CAPS_NEW("msxx_caps","audio/adpcm",NULL);
return GST_CAPS_NEW("msxx_caps","audio/x-adpcm",
"layout", GST_PROPS_STRING("quicktime"),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case 0x6d730055:
/* MPEG layer 3, CBR only (pre QT4.1) */
case GST_MAKE_FOURCC('.','m','p','3'):
/* MPEG layer 3, CBR & VBR (QT4.1 and later) */
return GST_CAPS_NEW("_mp3_caps","audio/x-mp3",NULL);
return GST_CAPS_NEW("_mp3_caps","audio/mpeg",
"layer", GST_PROPS_INT(3),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case GST_MAKE_FOURCC('M','A','C','3'):
/* MACE 3:1 */
return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
"maceversion",GST_PROPS_INT(3), NULL);
"maceversion",GST_PROPS_INT(3),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case GST_MAKE_FOURCC('M','A','C','6'):
/* MACE 6:1 */
return GST_CAPS_NEW("MAC3_caps","audio/x-mace",
"maceversion",GST_PROPS_INT(6));
"maceversion",GST_PROPS_INT(6),
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case GST_MAKE_FOURCC('O','g','g','V'):
/* Ogg Vorbis */
return GST_CAPS_NEW("OggV_caps","application/x-ogg", NULL);
return GST_CAPS_NEW("OggV_caps","application/ogg",
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case GST_MAKE_FOURCC('d','v','c','a'):
/* DV audio */
return GST_CAPS_NEW("dvca_caps","audio/x-dv",
"rate",GST_PROPS_INT_RANGE(1,G_MAXINT),
"channels",GST_PROPS_INT_RANGE(1,G_MAXINT),
NULL);
case GST_MAKE_FOURCC('m','p','4','a'):
/* MPEG-4 AAC */
return GST_CAPS_NEW("mp4a_caps", "audio/mpeg",
"mpegversion", GST_PROPS_INT(4),
"rate", GST_PROPS_INT_RANGE(1, G_MAXINT),
"channels", GST_PROPS_INT_RANGE(1, G_MAXINT),
"systemstream", GST_PROPS_BOOLEAN(FALSE), NULL);
case GST_MAKE_FOURCC('q','t','v','r'):
/* ? */
case GST_MAKE_FOURCC('Q','D','M','2'):

View file

@ -50,9 +50,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"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 (16),
@ -166,9 +164,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
caps = GST_CAPS_NEW (
"audio_raw",
"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 (16),

View file

@ -53,9 +53,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"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 (16),

View file

@ -50,9 +50,7 @@ GST_PAD_TEMPLATE_FACTORY (src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"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 (16),
@ -166,9 +164,7 @@ gst_rtpL16_caps_nego (GstRtpL16Parse *rtpL16parse)
caps = GST_CAPS_NEW (
"audio_raw",
"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 (16),

View file

@ -53,9 +53,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"audio_raw",
"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 (16),

View file

@ -22,6 +22,7 @@
#endif
#include <string.h>
#include <gstsmpte.h>
#include <gst/video/video.h>
#include "paint.h"
/* elementfactory information */
@ -39,10 +40,11 @@ GST_PAD_TEMPLATE_FACTORY (smpte_src_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"smpte_src",
"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")))
)
)
@ -50,12 +52,11 @@ GST_PAD_TEMPLATE_FACTORY (smpte_sink1_factory,
"sink1",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"smpte_sink1",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"width", GST_PROPS_INT_RANGE (0, 4096),
"height", GST_PROPS_INT_RANGE (0, 4096)
"video/x-raw-yuv",
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
)
)
@ -63,12 +64,11 @@ GST_PAD_TEMPLATE_FACTORY (smpte_sink2_factory,
"sink2",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"smpte_sink2",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"width", GST_PROPS_INT_RANGE (0, 4096),
"height", GST_PROPS_INT_RANGE (0, 4096)
"video/x-raw-yuv",
GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(
GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")))
)
)
@ -174,8 +174,8 @@ gst_smpte_class_init (GstSMPTEClass *klass)
g_param_spec_enum ("type", "Type", "The type of transition to use",
GST_TYPE_SMPTE_TRANSITION_TYPE, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FPS,
g_param_spec_int ("fps", "FPS", "Frames per second if no input files are given",
1, 255, 1, G_PARAM_READWRITE));
g_param_spec_float ("fps", "FPS", "Frames per second if no input files are given",
0., G_MAXFLOAT, 25., G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER,
g_param_spec_int ("border", "Border", "The border width of the transition",
0, G_MAXINT, 0, G_PARAM_READWRITE));
@ -235,6 +235,7 @@ gst_smpte_sinkconnect (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "width", &smpte->width);
gst_caps_get_int (caps, "height", &smpte->height);
gst_caps_get_float (caps, "framerate", &smpte->fps);
gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
@ -263,10 +264,10 @@ gst_smpte_init (GstSMPTE *smpte)
smpte->width = 320;
smpte->height = 200;
smpte->fps = 25.;
smpte->duration = 64;
smpte->position = 0;
smpte->type = 1;
smpte->fps = 1;
smpte->border = 0;
smpte->depth = 16;
gst_smpte_update_mask (smpte, smpte->type, smpte->depth, smpte->width, smpte->height);
@ -359,7 +360,8 @@ gst_smpte_loop (GstElement *element)
"video/raw",
"format", GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I','4','2','0')),
"width", GST_PROPS_INT (smpte->width),
"height", GST_PROPS_INT (smpte->height)
"height", GST_PROPS_INT (smpte->height),
"framerate", GST_PROPS_FLOAT (smpte->fps)
)))
{
gst_element_error (element, "cannot set caps");
@ -408,12 +410,12 @@ gst_smpte_set_property (GObject *object, guint prop_id,
smpte->width, smpte->height);
break;
}
case ARG_FPS:
smpte->fps = g_value_get_int (value);
break;
case ARG_BORDER:
smpte->border = g_value_get_int (value);
break;
case ARG_FPS:
smpte->fps = g_value_get_float (value);
break;
case ARG_DEPTH:
{
gint depth = g_value_get_int (value);
@ -443,7 +445,7 @@ gst_smpte_get_property (GObject *object, guint prop_id,
}
break;
case ARG_FPS:
g_value_set_int (value, smpte->fps);
g_value_set_float (value, smpte->fps);
break;
case ARG_BORDER:
g_value_set_int (value, smpte->border);

View file

@ -44,6 +44,7 @@ struct _GstSMPTE {
gint format;
gint width;
gint height;
gfloat fps;
gint duration;
gint position;
@ -53,7 +54,6 @@ struct _GstSMPTE {
*sinkpad2;
gint type;
gint fps;
gint border;
gint depth;
GstMask *mask;

View file

@ -21,6 +21,7 @@
#include "config.h"
#endif
#include <gst/gst.h>
#include <gst/video/video.h>
#include <string.h>
@ -47,8 +48,8 @@ struct _GstVideoCrop {
/* caps */
gint width, height;
gint crop_x, crop_y;
gint crop_width, crop_height;
gfloat fps;
gint crop_left, crop_right, crop_top, crop_bottom;
};
struct _GstVideoCropClass {
@ -75,10 +76,10 @@ enum {
enum {
ARG_0,
ARG_X,
ARG_Y,
ARG_WIDTH,
ARG_HEIGHT,
ARG_LEFT,
ARG_RIGHT,
ARG_TOP,
ARG_BOTTOM,
/* FILL ME */
};
@ -86,10 +87,11 @@ GST_PAD_TEMPLATE_FACTORY (video_crop_src_template_factory,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"video_crop_src",
"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")))
)
)
@ -97,10 +99,11 @@ GST_PAD_TEMPLATE_FACTORY (video_crop_sink_template_factory,
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
gst_caps_new (
"video_crop_sink",
"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")))
)
)
@ -157,17 +160,17 @@ gst_video_crop_class_init (GstVideoCropClass *klass)
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_X,
g_param_spec_int ("x", "X", "X offset of image",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
g_param_spec_int ("left", "Left", "Pixels to crop at left",
0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_Y,
g_param_spec_int ("y", "Y", "Y offset of image",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT,
g_param_spec_int ("right", "Right", "Pixels to crop at right",
0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_WIDTH,
g_param_spec_int ("width", "Width", "Width of image",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
g_param_spec_int ("top", "Top", "Pixels to crop at top",
0, G_MAXINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_HEIGHT,
g_param_spec_int ("height", "Height", "Height of image",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM,
g_param_spec_int ("bottom", "Bottom", "Pixels to crop at bottom",
0, G_MAXINT, 0, G_PARAM_READWRITE));
gobject_class->set_property = gst_video_crop_set_property;
@ -190,10 +193,10 @@ gst_video_crop_init (GstVideoCrop *video_crop)
GST_PAD_TEMPLATE_GET (video_crop_src_template_factory), "src");
gst_element_add_pad (GST_ELEMENT (video_crop), video_crop->srcpad);
video_crop->crop_x = 0;
video_crop->crop_y = 0;
video_crop->crop_width = 128;
video_crop->crop_height = 128;
video_crop->crop_right = 0;
video_crop->crop_left = 0;
video_crop->crop_top = 0;
video_crop->crop_bottom = 0;
GST_FLAG_SET (video_crop, GST_ELEMENT_EVENT_AWARE);
}
@ -210,17 +213,17 @@ gst_video_crop_set_property (GObject *object, guint prop_id, const GValue *value
video_crop = GST_VIDEO_CROP (object);
switch (prop_id) {
case ARG_X:
video_crop->crop_x = g_value_get_int (value);
case ARG_LEFT:
video_crop->crop_left = g_value_get_int (value);
break;
case ARG_Y:
video_crop->crop_y = g_value_get_int (value);
case ARG_RIGHT:
video_crop->crop_right = g_value_get_int (value);
break;
case ARG_WIDTH:
video_crop->crop_width = g_value_get_int (value);
case ARG_TOP:
video_crop->crop_top = g_value_get_int (value);
break;
case ARG_HEIGHT:
video_crop->crop_height = g_value_get_int (value);
case ARG_BOTTOM:
video_crop->crop_bottom = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -238,17 +241,17 @@ gst_video_crop_get_property (GObject *object, guint prop_id, GValue *value, GPar
video_crop = GST_VIDEO_CROP (object);
switch (prop_id) {
case ARG_X:
g_value_set_int (value, video_crop->crop_x);
case ARG_LEFT:
g_value_set_int (value, video_crop->crop_left);
break;
case ARG_Y:
g_value_set_int (value, video_crop->crop_y);
case ARG_RIGHT:
g_value_set_int (value, video_crop->crop_right);
break;
case ARG_WIDTH:
g_value_set_int (value, video_crop->crop_width);
case ARG_TOP:
g_value_set_int (value, video_crop->crop_top);
break;
case ARG_HEIGHT:
g_value_set_int (value, video_crop->crop_height);
case ARG_BOTTOM:
g_value_set_int (value, video_crop->crop_bottom);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -269,11 +272,7 @@ gst_video_crop_sink_connect (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "width", &video_crop->width);
gst_caps_get_int (caps, "height", &video_crop->height);
if (video_crop->crop_width + video_crop->crop_x > video_crop->width)
video_crop->crop_width = video_crop->width - video_crop->crop_x;
if (video_crop->crop_height + video_crop->crop_y > video_crop->height)
video_crop->crop_height = video_crop->height - video_crop->crop_y;
gst_caps_get_float (caps, "framerate", &video_crop->fps);
return GST_PAD_LINK_OK;
}
@ -283,44 +282,48 @@ gst_video_crop_i420 (GstVideoCrop *video_crop, GstBuffer *src_buffer, GstBuffer
{
guint8 *srcY, *srcU, *srcV;
guint8 *destY, *destU, *destV;
gint width = video_crop->crop_width;
gint crop_height = video_crop->crop_height;
gint out_width = video_crop->width -
(video_crop->crop_left + video_crop->crop_right);
gint out_height = video_crop->height -
(video_crop->crop_top + video_crop->crop_bottom);
gint src_stride = video_crop->width;
gint frame_size = video_crop->width * video_crop->height;
gint src_size = video_crop->width * video_crop->height;
gint j;
srcY = GST_BUFFER_DATA (src_buffer) + (src_stride * video_crop->crop_y + video_crop->crop_x);
srcY = GST_BUFFER_DATA (src_buffer) +
(src_stride * video_crop->crop_top + video_crop->crop_left);
destY = GST_BUFFER_DATA (dest_buffer);
/* copy Y plane first */
for (j = crop_height; j; j--) {
memcpy (destY, srcY, width);
for (j = 0; j < out_height; j++) {
memcpy (destY, srcY, out_width);
srcY += src_stride;
destY += width;
destY += out_width;
}
width >>= 1;
out_width >>= 1;
src_stride >>= 1;
crop_height >>= 1;
out_height >>= 1;
destU = destY;
destV = destU + ((video_crop->crop_width * crop_height) >> 1);
destV = destU + ((out_width * out_height) >> 1);
srcU = GST_BUFFER_DATA (src_buffer) + frame_size + ((src_stride * video_crop->crop_y + video_crop->crop_x) >> 1);
srcV = srcU + (frame_size >> 2);
srcU = GST_BUFFER_DATA (src_buffer) + src_size +
((src_stride * video_crop->crop_top + video_crop->crop_left) >> 1);
srcV = srcU + (src_size >> 2);
/* copy U plane */
for (j = crop_height; j; j--) {
memcpy (destU, srcU, width);
for (j = 0; j < out_height; j++) {
memcpy (destU, srcU, out_width);
srcU += src_stride;
destU += width;
destU += out_width;
}
/* copy U plane */
for (j = crop_height; j; j--) {
memcpy (destV, srcV, width);
for (j = 0; j < out_height; j++) {
memcpy (destV, srcV, out_width);
srcV += src_stride;
destV += width;
destV += out_width;
}
}
@ -329,6 +332,7 @@ gst_video_crop_chain (GstPad *pad, GstBuffer *buffer)
{
GstVideoCrop *video_crop;
GstBuffer *outbuf;
gint new_width, new_height;
video_crop = GST_VIDEO_CROP (gst_pad_get_parent (pad));
@ -343,14 +347,20 @@ gst_video_crop_chain (GstPad *pad, GstBuffer *buffer)
return;
}
new_width = video_crop->width -
(video_crop->crop_left + video_crop->crop_right);
new_height = video_crop->height -
(video_crop->crop_top + video_crop->crop_bottom);
if (GST_PAD_CAPS (video_crop->srcpad) == NULL) {
if (gst_pad_try_set_caps (video_crop->srcpad,
GST_CAPS_NEW (
"video_crop_caps",
"video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"width", GST_PROPS_INT (video_crop->crop_width),
"height", GST_PROPS_INT (video_crop->crop_height)
"width", GST_PROPS_INT (new_width),
"height", GST_PROPS_INT (new_height),
"framerate", GST_PROPS_FLOAT (video_crop->fps)
)) <= 0)
{
gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads");
@ -358,7 +368,7 @@ gst_video_crop_chain (GstPad *pad, GstBuffer *buffer)
}
}
outbuf = gst_buffer_new_and_alloc ((video_crop->crop_width * video_crop->crop_height * 3) / 2);
outbuf = gst_buffer_new_and_alloc ((new_width * new_height * 3) / 2);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buffer);
gst_video_crop_i420 (video_crop, buffer, outbuf);

View file

@ -133,9 +133,11 @@ gst_videoflip_src_template_factory(void)
static GstPadTemplate *templ = NULL;
if(!templ){
GstCaps *caps = GST_CAPS_NEW("src","video/raw",
/* well, actually RGB too, but since there's no RGB format anyway */
GstCaps *caps = GST_CAPS_NEW("src","video/x-raw-yuv",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
"height", GST_PROPS_INT_RANGE (0, G_MAXINT));
"height", GST_PROPS_INT_RANGE (0, G_MAXINT),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
@ -150,9 +152,10 @@ gst_videoflip_sink_template_factory(void)
static GstPadTemplate *templ = NULL;
if(!templ){
GstCaps *caps = GST_CAPS_NEW("sink","video/raw",
GstCaps *caps = GST_CAPS_NEW("sink","video/x-raw-yuv",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
"height", GST_PROPS_INT_RANGE (0, G_MAXINT));
"height", GST_PROPS_INT_RANGE (0, G_MAXINT),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
@ -214,9 +217,10 @@ gst_videoflip_sink_getcaps (GstPad *pad, GstCaps *caps)
}
gst_caps_unref (peercaps);
sizecaps = GST_CAPS_NEW("videoflip_size","video/raw",
sizecaps = GST_CAPS_NEW("videoflip_size","video/x-raw-yuv",
"width", GST_PROPS_INT_RANGE (0, G_MAXINT),
"height", GST_PROPS_INT_RANGE (0, G_MAXINT));
"height", GST_PROPS_INT_RANGE (0, G_MAXINT),
"framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT));
caps = gst_caps_intersect(caps, gst_videoflip_get_capslist ());
gst_caps_unref (sizecaps);

View file

@ -36,7 +36,6 @@ struct videoflip_format_struct videoflip_formats[] = {
/* planar */
{ "YV12", 12, gst_videoflip_planar411, },
{ "I420", 12, gst_videoflip_planar411, },
{ "IYUV", 12, gst_videoflip_planar411, },
};
int videoflip_n_formats = sizeof(videoflip_formats)/sizeof(videoflip_formats[0]);
@ -53,8 +52,7 @@ videoflip_get_caps(struct videoflip_format_struct *format)
fourcc = GST_MAKE_FOURCC(format->fourcc[0],format->fourcc[1],format->fourcc[2],format->fourcc[3]);
if(format->bpp){
caps = GST_CAPS_NEW ("videoflip", "video/raw",
"format", GST_PROPS_FOURCC (fourcc),
caps = GST_CAPS_NEW ("videoflip", "video/x-raw-rgb",
"depth", GST_PROPS_INT(format->bpp),
"bpp", GST_PROPS_INT(format->depth),
"endianness", GST_PROPS_INT(format->endianness),
@ -62,7 +60,7 @@ videoflip_get_caps(struct videoflip_format_struct *format)
"green_mask", GST_PROPS_INT(format->green_mask),
"blue_mask", GST_PROPS_INT(format->blue_mask));
}else{
caps = GST_CAPS_NEW ("videoflip", "video/raw",
caps = GST_CAPS_NEW ("videoflip", "video/x-raw-yuv",
"format", GST_PROPS_FOURCC (fourcc));
}

View file

@ -83,9 +83,7 @@ GST_PAD_TEMPLATE_FACTORY (sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"wavenc_raw",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_LIST (

View file

@ -79,9 +79,7 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"wavparse_raw",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (FALSE),
@ -99,18 +97,21 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory,
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"wavparse_mp3",
"audio/x-mp3",
NULL
"wavparse_mpeg",
"audio/mpeg",
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
"layer", GST_PROPS_INT_RANGE (1, 3)
),
GST_CAPS_NEW (
"parsewav_law",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT_RANGE (1, 2),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
"audio/x-alaw",
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
),
GST_CAPS_NEW (
"parsewav_law",
"audio/x-mulaw",
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2)
)
@ -371,29 +372,26 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf)
switch (wavparse->format)
{
case GST_RIFF_WAVE_FORMAT_ALAW:
case GST_RIFF_WAVE_FORMAT_MULAW:
case GST_RIFF_WAVE_FORMAT_MULAW: {
gchar *mime = (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW) ?
"audio/x-alaw" : "audio/x-mulaw";
if (!(wavparse->width == 8)) {
gst_element_error (GST_ELEMENT (wavparse), "wavparse: invalid wave file");
g_warning("Ignoring invalid width %d",
wavparse->width);
return;
}
caps = GST_CAPS_NEW (
"parsewav_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (wavparse->format == GST_RIFF_WAVE_FORMAT_ALAW ? 2 : 1),
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"width", GST_PROPS_INT (8),
"depth", GST_PROPS_INT (8),
mime,
"rate", GST_PROPS_INT (wavparse->rate),
"channels", GST_PROPS_INT (wavparse->channels)
);
}
break;
case GST_RIFF_WAVE_FORMAT_PCM:
caps = GST_CAPS_NEW (
"parsewav_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_LITTLE_ENDIAN),
"signed", GST_PROPS_BOOLEAN ((wavparse->width > 8) ? TRUE : FALSE),
"width", GST_PROPS_INT (wavparse->width),
@ -403,13 +401,18 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf)
);
break;
case GST_RIFF_WAVE_FORMAT_MPEGL12:
case GST_RIFF_WAVE_FORMAT_MPEGL3:
case GST_RIFF_WAVE_FORMAT_MPEGL3: {
gint layer = (wavparse->format == GST_RIFF_WAVE_FORMAT_MPEGL12) ? 2 : 3;
caps = GST_CAPS_NEW (
"parsewav_src",
"audio/x-mp3",
NULL
"audio/mpeg",
"layer", GST_PROPS_INT (layer),
"rate", GST_PROPS_INT (wavparse->rate),
"channels", GST_PROPS_INT (wavparse->channels)
);
}
break;
default:
gst_element_error (GST_ELEMENT (wavparse), "wavparse: format %d not handled", wavparse->format);
return;

View file

@ -34,7 +34,7 @@ else
VCD_DIR=
endif
if USE_XVIDEO
if USE_XFREE
XVIDEO_DIR=xvideo
else
XVIDEO_DIR=

View file

@ -79,10 +79,8 @@ ossgst_src_factory (void)
GST_PAD_ALWAYS,
gst_caps_new (
"ossgst_src",
"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_LIST (
GST_PROPS_BOOLEAN (FALSE),
@ -99,7 +97,21 @@ ossgst_src_factory (void)
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
gst_caps_new (
"ossgst_src",
"audio/x-mulaw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
gst_caps_new (
"ossgst_src",
"audio/x-alaw",
gst_props_new (
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT_RANGE (1, 2),
NULL)),
NULL);
}
@ -224,12 +236,12 @@ gst_ossgst_format_to_caps (gint format, gint stereo, gint rate)
}
if (supported) {
caps = gst_caps_new (
switch (law) {
case 0:
caps = gst_caps_new (
"ossgst_caps",
"audio/raw",
"audio/x-raw-int",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (law),
"endianness", GST_PROPS_INT (endianness),
"signed", GST_PROPS_BOOLEAN (is_signed),
"width", GST_PROPS_INT (width),
@ -237,6 +249,26 @@ gst_ossgst_format_to_caps (gint format, gint stereo, gint rate)
"rate", GST_PROPS_INT (rate),
"channels", GST_PROPS_INT (stereo?2:1),
NULL));
break;
case 1:
caps = gst_caps_new (
"ossgst_caps",
"audio/x-mulaw",
gst_props_new (
"rate", GST_PROPS_INT (rate),
"channels", GST_PROPS_INT (stereo?2:1),
NULL));
break;
case 2:
caps = gst_caps_new (
"ossgst_caps",
"audio/x-alaw",
gst_props_new (
"rate", GST_PROPS_INT (rate),
"channels", GST_PROPS_INT (stereo?2:1),
NULL));
break;
}
}
else {
g_warning ("gstossgst: program tried to use unsupported format %x\n", format);

View file

@ -93,9 +93,7 @@ GST_PAD_TEMPLATE_FACTORY (osssink_sink_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"osssink_sink",
"audio/raw",
"format", GST_PROPS_STRING ("int"), /* hack */
"law", GST_PROPS_INT (0),
"audio/x-raw-int",
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_LIST (
GST_PROPS_BOOLEAN (FALSE),

View file

@ -67,9 +67,7 @@ GST_PAD_TEMPLATE_FACTORY (osssrc_src_factory,
GST_PAD_ALWAYS,
GST_CAPS_NEW (
"osssrc_src",
"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_LIST (
GST_PROPS_BOOLEAN (TRUE),
@ -265,15 +263,13 @@ gst_osssrc_negotiate (GstPad *pad)
if (gst_pad_try_set_caps (src->srcpad,
GST_CAPS_NEW (
"oss_src",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (src->common.law),
"endianness", GST_PROPS_INT (src->common.endianness),
"signed", GST_PROPS_BOOLEAN (src->common.sign),
"width", GST_PROPS_INT (src->common.width),
"depth", GST_PROPS_INT (src->common.depth),
"rate", GST_PROPS_INT (src->common.rate),
"channels", GST_PROPS_INT (src->common.channels)
"audio/x-raw-int",
"endianness", GST_PROPS_INT (src->common.endianness),
"signed", GST_PROPS_BOOLEAN (src->common.sign),
"width", GST_PROPS_INT (src->common.width),
"depth", GST_PROPS_INT (src->common.depth),
"rate", GST_PROPS_INT (src->common.rate),
"channels", GST_PROPS_INT (src->common.channels)
)) <= 0)
{
return FALSE;

View file

@ -244,12 +244,12 @@ gst_v4l2src_close (GstElement *element,
}
static gdouble
static gfloat
gst_v4l2src_get_fps (GstV4l2Src *v4l2src)
{
gint norm;
struct v4l2_standard *std;
gdouble fps;
gfloat fps;
if (!v4l2src->use_fixed_fps &&
v4l2src->clock != NULL &&
@ -323,6 +323,7 @@ static GstCaps *
gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
GstPropsEntry *width,
GstPropsEntry *height,
GstPropsEntry *fps,
gboolean compressed)
{
GstCaps *caps = NULL;
@ -331,7 +332,7 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */
case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */
caps = GST_CAPS_NEW("v4l2src_caps",
"video/jpeg",
"video/x-jpeg",
NULL);
break;
case V4L2_PIX_FMT_RGB332:
@ -346,7 +347,6 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
guint depth=0, bpp=0;
gint endianness = 0;
guint32 r_mask = 0, b_mask = 0, g_mask = 0;
guint32 fcc = GST_MAKE_FOURCC('R','G','B',' ');
switch (fourcc) {
case V4L2_PIX_FMT_RGB332:
@ -357,30 +357,64 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
case V4L2_PIX_FMT_RGB555:
case V4L2_PIX_FMT_RGB555X:
bpp = 16; depth = 15;
endianness = (fourcc == V4L2_PIX_FMT_RGB332) ?
G_LITTLE_ENDIAN : G_BIG_ENDIAN;
r_mask = 0x7c00; g_mask = 0x03e0; b_mask = 0x001f;
endianness = G_BYTE_ORDER;
if ((fourcc == V4L2_PIX_FMT_RGB555 &&
G_BYTE_ORDER == G_LITTLE_ENDIAN) ||
(fourcc == V4L2_PIX_FMT_RGB555X &&
G_BYTE_ORDER == G_BIG_ENDIAN)) {
r_mask = 0x7c00;
g_mask = 0x03e0;
b_mask = 0x001f;
} else {
r_mask = 0x007c;
g_mask = 0xe003;
b_mask = 0x1f00;
}
break;
case V4L2_PIX_FMT_RGB565:
case V4L2_PIX_FMT_RGB565X:
bpp = depth = 16;
endianness = (fourcc == V4L2_PIX_FMT_RGB565) ?
G_LITTLE_ENDIAN : G_BIG_ENDIAN;
r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
endianness = G_BYTE_ORDER;
if ((fourcc == V4L2_PIX_FMT_RGB565 &&
G_BYTE_ORDER == G_LITTLE_ENDIAN) ||
(fourcc == V4L2_PIX_FMT_RGB565X &&
G_BYTE_ORDER == G_BIG_ENDIAN)) {
r_mask = 0xf800;
g_mask = 0x07e0;
b_mask = 0x001f;
} else {
r_mask = 0x00f8;
g_mask = 0xe007;
b_mask = 0x1f00;
}
break;
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
bpp = depth = 24;
endianness = (fourcc == V4L2_PIX_FMT_BGR24) ?
G_LITTLE_ENDIAN : G_BIG_ENDIAN;
r_mask = 0xff0000; g_mask = 0x00ff00; b_mask = 0x0000ff;
endianness = G_BIG_ENDIAN;
if (fourcc == V4L2_PIX_FMT_RGB24) {
r_mask = 0xff0000;
g_mask = 0x00ff00;
b_mask = 0x0000ff;
} else {
r_mask = 0x0000ff;
g_mask = 0x00ff00;
b_mask = 0xff0000;
}
break;
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_BGR32:
bpp = depth = 32;
endianness = (fourcc == V4L2_PIX_FMT_BGR32) ?
G_LITTLE_ENDIAN : G_BIG_ENDIAN;
r_mask = 0x00ff0000; g_mask = 0x0000ff00; b_mask = 0x000000ff;
endianness = G_BIG_ENDIAN;
if (fourcc == V4L2_PIX_FMT_RGB32) {
r_mask = 0xff000000;
g_mask = 0x00ff0000;
b_mask = 0x0000ff00;
} else {
r_mask = 0x000000ff;
g_mask = 0x0000ff00;
b_mask = 0x00ff0000;
}
break;
default:
g_assert_not_reached();
@ -388,8 +422,7 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
}
caps = GST_CAPS_NEW("v4l2src_caps",
"video/raw",
"format", GST_PROPS_FOURCC(fcc),
"video/x-raw-rgb",
"bpp", GST_PROPS_INT(bpp),
"depth", GST_PROPS_INT(depth),
"red_mask", GST_PROPS_INT(r_mask),
@ -428,7 +461,7 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
}
caps = GST_CAPS_NEW("v4l2src_caps",
"video/raw",
"video/x-raw-yuv",
"format", GST_PROPS_FOURCC(fcc),
NULL);
break;
@ -456,7 +489,7 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
g_free(string_format);
} else {
caps = GST_CAPS_NEW("v4l2src_caps",
"video/raw",
"video/x-raw-yuv",
"format",GST_PROPS_FOURCC(fourcc),
NULL);
}
@ -467,16 +500,19 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
caps->properties = gst_props_empty_new();
gst_props_add_entry(caps->properties, width);
gst_props_add_entry(caps->properties, height);
gst_props_add_entry(caps->properties, fps);
return caps;
}
#define gst_v4l2src_v4l2fourcc_to_caps_fixed(f, width, height,c) \
#define gst_v4l2src_v4l2fourcc_to_caps_fixed(f, width, height, fps, c) \
gst_v4l2src_v4l2fourcc_to_caps(f, \
gst_props_entry_new("width", \
GST_PROPS_INT(width)), \
gst_props_entry_new("height", \
GST_PROPS_INT(height)), \
gst_props_entry_new("framerate", \
GST_PROPS_FLOAT(fps)), \
c)
#define gst_v4l2src_v4l2fourcc_to_caps_range(f, min_w, max_w, min_h, max_h, c) \
@ -485,6 +521,8 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc,
GST_PROPS_INT_RANGE(min_w, max_w)), \
gst_props_entry_new("height", \
GST_PROPS_INT_RANGE(min_h, max_h)), \
gst_props_entry_new("framerate", \
GST_PROPS_FLOAT_RANGE(0, G_MAXFLOAT)), \
c)
static struct v4l2_fmtdesc *
@ -496,9 +534,12 @@ gst_v4l2_caps_to_v4l2fourcc (GstV4l2Src *v4l2src,
struct v4l2_fmtdesc *end_fmt = NULL;
const gchar *format = gst_caps_get_mime(caps);
if (!strcmp(format, "video/raw")) {
/* non-compressed */
gst_caps_get_fourcc_int(caps, "format", &fourcc);
if (!strcmp(format, "video/x-raw-yuv") ||
!strcmp(format, "video/x-raw-rgb")) {
if (!strcmp(format, "video/x-raw-rgb"))
fourcc = GST_MAKE_FOURCC('R','G','B',' ');
else
gst_caps_get_fourcc_int(caps, "format", &fourcc);
switch (fourcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
@ -666,6 +707,7 @@ gst_v4l2src_srcconnect (GstPad *pad,
lastcaps = gst_v4l2src_v4l2fourcc_to_caps_fixed(format->pixelformat,
v4l2src->format.fmt.pix.width,
v4l2src->format.fmt.pix.height,
gst_v4l2src_get_fps(v4l2src),
format->flags & V4L2_FMT_FLAG_COMPRESSED);
ret_val = gst_pad_try_set_caps(v4l2src->srcpad,