...
 
Commits (216)
common @ 2585de99
Subproject commit 17fa4abf49d31cf5dcc2994bdbaa86e45a3fb69f
Subproject commit 2585de990f508fc7fbe13a4b7c9fb08c68a10aed
AC_PREREQ(2.60)
AC_PREREQ([2.60])
dnl please read gstreamer/docs/random/autotools before changing this file
dnl initialize autoconf
dnl releases only do -Wall, git and prerelease does -Werror too
dnl use a three digit version number for releases, and four for git/pre
AC_INIT(GStreamer Good Plug-ins, 0.10.31.1,
http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer,
gst-plugins-good)
AC_INIT([GStreamer Good Plug-ins],[0.10.31.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer],[gst-plugins-good])
AG_GST_INIT
......@@ -24,7 +22,7 @@ dnl can autoconf find the source ?
AC_CONFIG_SRCDIR([gst/law/alaw.c])
dnl define the output header for config
AM_CONFIG_HEADER([config.h])
AC_CONFIG_HEADERS([config.h])
dnl AM_MAINTAINER_MODE only provides the option to configure to enable it
AM_MAINTAINER_MODE
......@@ -118,7 +116,7 @@ dnl determine c++ preprocessor
dnl FIXME: do we need this ?
AC_PROG_CXXCPP
AS_PROG_OBJC
AC_PROG_OBJC
dnl check if the compiler supports '-c' and '-o' options
AM_PROG_CC_C_O
......@@ -299,22 +297,11 @@ AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO],
dnl define an ERROR_CFLAGS Makefile variable
dnl -Wundef: too many broken headers
if test "x$HAVE_OSX_VIDEO" != "xyes"; then
AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
-Wwrite-strings -Wold-style-definition -Waggregate-return
-Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
-Wnested-externs ])
else
dnl work-around for us passing GST_CFLAGS to the ObjC-compiler, which
dnl doesn't understand all warning flags that the C compiler knows about
dnl (e.g. -Waddress) or causes problems with some flags (-Waggregate-return)
AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
-Wwrite-strings -Wold-style-definition
-Winit-self -Wmissing-include-dirs -Wno-multichar
-Wnested-externs ])
fi
AG_GST_SET_ERROR_CFLAGS($FATAL_WARNINGS, [
-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
-Wwrite-strings -Wold-style-definition -Waggregate-return
-Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar
-Wnested-externs])
dnl define an ERROR_CXXFLAGS Makefile variable
AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
......@@ -322,6 +309,13 @@ AG_GST_SET_ERROR_CXXFLAGS($FATAL_WARNINGS, [
-Wwrite-strings
-Winit-self -Wmissing-include-dirs -Waddress -Wno-multichar ])
dnl define an ERROR_OBJCFLAGS Makefile variable
AG_GST_SET_ERROR_OBJCFLAGS($FATAL_WARNINGS, [
-Wmissing-declarations -Wmissing-prototypes -Wredundant-decls
-Wwrite-strings -Wold-style-definition
-Winit-self -Wmissing-include-dirs -Wno-multichar
-Wnested-externs])
dnl define correct level for debugging messages
AG_GST_SET_LEVEL_DEFAULT($GST_GIT)
......@@ -488,9 +482,19 @@ AG_GST_CHECK_FEATURE(SUNAUDIO, [Sun Audio], sunaudio, [
dnl *** OSX Audio ***
translit(dnm, m, l) AM_CONDITIONAL(USE_OSX_AUDIO, true)
have_ios="no"
AG_GST_CHECK_FEATURE(OSX_AUDIO, [OSX audio], osxaudio, [
AC_CHECK_HEADER(CoreAudio/CoreAudio.h, HAVE_OSX_AUDIO="yes", HAVE_OSX_AUDIO="no")
AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
HAVE_OSX_AUDIO="yes",
dnl *** Check for the iOS headers ***
[AC_CHECK_HEADER(CoreAudio/CoreAudioTypes.h,
[HAVE_OSX_AUDIO="YES";have_ios="yes"], HAVE_OSX_AUDIO="no"
)])
])
if test "x$have_ios" = "xyes"; then
AC_DEFINE(HAVE_IOS, 1, [building for iOS platofrm])
fi
AM_CONDITIONAL(HAVE_IOS, test "x$have_ios" = "xyes")
dnl *** OS X video ***
translit(dnm, m, l) AM_CONDITIONAL(USE_OSX_VIDEO, true)
......@@ -515,7 +519,7 @@ dnl renamed to GST_V4L2 because of some conflict with kernel headers
translit(dnm, m, l) AM_CONDITIONAL(USE_GST_V4L2, true)
AG_GST_CHECK_FEATURE(GST_V4L2, [Video 4 Linux 2], v4l2src, [
AC_MSG_CHECKING([Checking for up to date v4l2 installation])
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef __sun /* Solaris */
#include <sys/types.h>
......@@ -529,12 +533,12 @@ AG_GST_CHECK_FEATURE(GST_V4L2, [Video 4 Linux 2], v4l2src, [
#if defined(V4L2_MAJOR_VERSION) || defined(V4L2_MINOR_VERSION)
#error too early v4l2 version or no v4l2 at all
#endif
], [
]], [[
return 0;
], [
]])],[
HAVE_GST_V4L2="yes"
AC_MSG_RESULT(yes)
], [
],[
HAVE_GST_V4L2="no"
AC_MSG_RESULT(no)
......@@ -556,7 +560,7 @@ return 0;
dnl check for missing v4l2_buffer declaration (see #135919)
MISSING_DECL=0
AC_MSG_CHECKING(struct v4l2_buffer declaration)
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#ifdef __sun /* Solaris */
#include <sys/types.h>
......@@ -567,11 +571,11 @@ return 0;
#define __user
#include <linux/videodev2.h>
#endif
],[
]], [[
struct v4l2_buffer buf;
buf.index = 0;
return 0;
], [ AC_MSG_RESULT(yes) ], [ MISSING_DECL=1 && AC_MSG_RESULT(no) ])
]])],[ AC_MSG_RESULT(yes) ],[ MISSING_DECL=1 && AC_MSG_RESULT(no) ])
if [ test x$MISSING_DECL = x1 ]; then
AC_DEFINE(GST_V4L2_MISSING_BUFDECL, 1, [struct v4l2_buffer missing])
fi
......@@ -583,8 +587,7 @@ return 0;
# Optional gudev for device probing
AC_ARG_WITH([gudev],
AC_HELP_STRING([--with-gudev],
[device detection with gudev]),
AS_HELP_STRING([--with-gudev],[device detection with gudev]),
[],
[with_gudev=check])
if test x$HAVE_GST_V4L2 = xyes; then
......@@ -606,8 +609,7 @@ AC_SUBST(GUDEV_LIBS)
# Make libv4l2 non-automagic
AC_ARG_WITH([libv4l2],
AC_HELP_STRING([--with-libv4l2],
[support video buffer conversion using libv4l2]),
AS_HELP_STRING([--with-libv4l2],[support video buffer conversion using libv4l2]),
[],
[with_libv4l2=check])
if test x$HAVE_GST_V4L2 = xyes; then
......@@ -914,7 +916,7 @@ AG_GST_CHECK_FEATURE(SOUP, [soup http client plugin (2.4)], souphttpsrc, [
HAVE_SOUP="yes"
AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [soup gnome integration])
],[
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.26, HAVE_SOUP="yes", [
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.26.1, HAVE_SOUP="yes", [
HAVE_SOUP="no"
])
])
......@@ -1083,12 +1085,14 @@ else
fi
AC_SUBST(DEPRECATED_CFLAGS)
dnl every flag in GST_OPTION_CFLAGS and GST_OPTION_CXXFLAGS can be overridden
dnl every flag in GST_OPTION_CFLAGS, GST_OPTION_CXXFLAGS and GST_OPTION_OBJCFLAGS can be overridden
dnl at make time with e.g. make ERROR_CFLAGS=""
GST_OPTION_CFLAGS="\$(WARNING_CFLAGS) \$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
GST_OPTION_CXXFLAGS="\$(WARNING_CXXFLAGS) \$(ERROR_CXXFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
GST_OPTION_OBJCFLAGS="\$(WARNING_OBJCFLAGS) \$(ERROR_OBJCFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)"
AC_SUBST(GST_OPTION_CFLAGS)
AC_SUBST(GST_OPTION_CXXFLAGS)
AC_SUBST(GST_OPTION_OBJCFLAGS)
dnl our libraries need to be versioned correctly
AC_SUBST(GST_LT_LDFLAGS)
......@@ -1098,9 +1102,11 @@ dnl prefer internal headers to already installed ones
dnl also add builddir include for enumtypes and marshal
dnl add ERROR_CFLAGS, but overridable
GST_CXXFLAGS="-I\$(top_srcdir)/gst-libs $GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CXXFLAGS)"
GST_OBJCFLAGS="-I\$(top_srcdir)/gst-libs $GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_OBJCFLAGS)"
GST_CFLAGS="-I\$(top_srcdir)/gst-libs $GST_CFLAGS $GLIB_EXTRA_CFLAGS \$(GST_OPTION_CFLAGS)"
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_CXXFLAGS)
AC_SUBST(GST_OBJCFLAGS)
AC_SUBST(GST_LIBS)
dnl LDFLAGS really should only contain flags, not libs - they get added before
......
......@@ -70,12 +70,6 @@ else
LIBDV_DIR =
endif
# if USE_LIBMNG
# LIBMNG_DIR = libmng
# else
LIBMNG_DIR =
# endif
if USE_LIBPNG
LIBPNG_DIR = libpng
else
......
......@@ -445,6 +445,38 @@ gst_flac_dec_scan_got_frame (GstFlacDec * flacdec, guint8 * data, guint size,
else if (sr == 0x0D || sr == 0x0E)
sr_from_end = 16;
val = data[4];
/* This is slightly faster than a loop */
if (!(val & 0x80)) {
val = 0;
} else if ((val & 0xc0) && !(val & 0x20)) {
val = 1;
} else if ((val & 0xe0) && !(val & 0x10)) {
val = 2;
} else if ((val & 0xf0) && !(val & 0x08)) {
val = 3;
} else if ((val & 0xf8) && !(val & 0x04)) {
val = 4;
} else if ((val & 0xfc) && !(val & 0x02)) {
val = 5;
} else if ((val & 0xfe) && !(val & 0x01)) {
val = 6;
} else {
GST_LOG_OBJECT (flacdec, "failed to read sample/frame");
return FALSE;
}
val++;
headerlen = 4 + val + (bs_from_end / 8) + (sr_from_end / 8);
if (gst_flac_calculate_crc8 (data, headerlen) != data[headerlen]) {
GST_LOG_OBJECT (flacdec, "invalid checksum");
return FALSE;
}
if (!last_sample_num)
return TRUE;
/* FIXME: This is can be 36 bit if variable block size is used,
* fortunately not encoder supports this yet and we check for that
* above.
......@@ -456,14 +488,6 @@ gst_flac_dec_scan_got_frame (GstFlacDec * flacdec, guint8 * data, guint size,
return FALSE;
}
headerlen = 4 + g_unichar_to_utf8 ((gunichar) val, NULL) +
(bs_from_end / 8) + (sr_from_end / 8);
if (gst_flac_calculate_crc8 (data, headerlen) != data[headerlen]) {
GST_LOG_OBJECT (flacdec, "invalid checksum");
return FALSE;
}
if (flacdec->min_blocksize == flacdec->max_blocksize) {
*last_sample_num = (val + 1) * flacdec->min_blocksize;
} else {
......@@ -1441,11 +1465,9 @@ gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
}
if (dec->framed) {
gint64 unused;
/* check if this is a flac audio frame (rather than a header or junk) */
got_audio_frame = gst_flac_dec_scan_got_frame (dec, GST_BUFFER_DATA (buf),
GST_BUFFER_SIZE (buf), &unused);
GST_BUFFER_SIZE (buf), NULL);
/* oggdemux will set granulepos in OFFSET_END instead of timestamp */
if (G_LIKELY (got_audio_frame)) {
......
......@@ -17,7 +17,7 @@ libgstgdkpixbuf_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstgdkpixbuf.h \
gstgdkpixbufoverlay.c \
gstgdkpixbufoverlay.h \
gstgdkpixbufsink.h \
pixbufscale.h \
gstgdkanimation.h
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -25,6 +27,7 @@
#include <setjmp.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideodecoder.h>
#include <gst/base/gstadapter.h>
/* this is a hack hack hack to get around jpeglib header bugs... */
......@@ -64,50 +67,20 @@ struct GstJpegDecSourceMgr {
* doesn't handle the N buffers in, 1 buffer out case,
* but only the 1-in 1-out case */
struct _GstJpegDec {
GstElement element;
/* pads */
GstPad *sinkpad;
GstPad *srcpad;
GstAdapter *adapter;
GstVideoDecoder decoder;
guint8 *cur_buf;
/* TRUE if each input buffer contains a whole jpeg image */
gboolean packetized;
/* the (expected) timestamp of the next frame */
guint64 next_ts;
GstSegment segment;
/* TRUE if the next output buffer should have the DISCONT flag set */
gboolean discont;
/* QoS stuff *//* with LOCK */
gdouble proportion;
GstClockTime earliest_time;
GstClockTime qos_duration;
/* video state */
gint framerate_numerator;
gint framerate_denominator;
/* negotiated state */
gint caps_framerate_numerator;
gint caps_framerate_denominator;
gint caps_width;
gint caps_height;
gint outsize;
gint clrspc;
GstVideoCodecState *input_state;
GstVideoCodecFrame *current_frame;
gint offset[3];
gint stride;
gint inc;
/* parse state */
gint parse_offset;
gboolean saw_header;
gint parse_entropy_len;
gint parse_resync;
......@@ -123,9 +96,6 @@ struct _GstJpegDec {
/* number of errors since start or last successfully decoded image */
guint error_count;
/* number of successfully decoded images since start */
guint good_count;
struct jpeg_decompress_struct cinfo;
struct GstJpegDecErrorMgr jerr;
struct GstJpegDecSourceMgr jsrc;
......@@ -138,7 +108,7 @@ struct _GstJpegDec {
};
struct _GstJpegDecClass {
GstElementClass parent_class;
GstVideoDecoderClass decoder_class;
};
GType gst_jpeg_dec_get_type(void);
......
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -24,6 +26,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideoencoder.h>
/* this is a hack hack hack to get around jpeglib header bugs... */
#ifdef HAVE_STDLIB_H
# undef HAVE_STDLIB_H
......@@ -50,19 +53,13 @@ typedef struct _GstJpegEncClass GstJpegEncClass;
struct _GstJpegEnc
{
GstElement element;
/* pads */
GstPad *sinkpad, *srcpad;
/* stream/image properties */
GstVideoFormat format;
gint width;
gint height;
gint channels;
gint fps_num, fps_den;
gint par_num, par_den;
/* standard video_format indexed */
GstVideoEncoder encoder;
GstVideoCodecState *input_state;
GstVideoCodecFrame *current_frame;
guint channels;
gint stride[GST_JPEG_ENC_MAX_COMPONENT];
gint offset[GST_JPEG_ENC_MAX_COMPONENT];
gint inc[GST_JPEG_ENC_MAX_COMPONENT];
......@@ -89,15 +86,12 @@ struct _GstJpegEnc
gint smoothing;
gint idct_method;
/* cached return state for any problems that may occur in callbacks */
GstFlowReturn last_ret;
GstBuffer *output_buffer;
};
struct _GstJpegEncClass
{
GstElementClass parent_class;
GstVideoEncoderClass parent_class;
/* signals */
void (*frame_encoded) (GstElement * element);
......
plugin_LTLIBRARIES = libgstmng.la
libgstmng_la_SOURCES = gstmng.c gstmngdec.c gstmngenc.c
libgstmng_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstmng_la_LIBADD = $(GST_LIBS) $(LIBMNG_LIBS)
libgstmng_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstmng_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstmngdec.h gstmngenc.h
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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.
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <gst/gst.h>
#include "gstmngdec.h"
#include "gstmngenc.h"
static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "mngdec", GST_RANK_PRIMARY,
GST_TYPE_MNG_DEC))
return FALSE;
if (!gst_element_register (plugin, "mngenc", GST_RANK_NONE, GST_TYPE_MNG_ENC))
return FALSE;
return TRUE;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"mng",
"MNG plugin library", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
GST_PACKAGE_ORIGIN)
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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.
*
*/
#include <gst/gst.h>
GType gst_mngenc_get_type (void);
extern GstPadTemplate *gst_mng_sink_factory ();
extern GstPadTemplate *gst_mng_src_factory ();
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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_MNG_DEC_H__
#define __GST_MNG_DEC_H__
#include <gst/gst.h>
#include <libmng.h>
G_BEGIN_DECLS
#define GST_TYPE_MNG_DEC (gst_mng_dec_get_type())
#define GST_MNG_DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MNG_DEC,GstMngDec))
#define GST_MNG_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MNG_DEC,GstMngDecClass))
#define GST_IS_MNG_DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MNG_DEC))
#define GST_IS_MNG_DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MNG_DEC))
#define GST_MNG_DEC_CAST(obj) ((GstMngDec *) (obj))
typedef struct _GstMngDec GstMngDec;
typedef struct _GstMngDecClass GstMngDecClass;
struct _GstMngDec
{
GstElement element;
GstPad *sinkpad, *srcpad;
GstBuffer *buffer_out;
mng_handle mng;
gboolean first;
gint width;
gint stride;
gint height;
gint bpp;
gint color_type;
gdouble fps;
};
struct _GstMngDecClass
{
GstElementClass parent_class;
};
GType gst_mng_dec_get_type(void);
G_END_DECLS
#endif /* __GST_MNG_DEC_H__ */
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* Filter:
* Copyright (C) 2000 Donald A. Graft
*
* 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.
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <gst/gst.h>
#include "gstmngenc.h"
#include <gst/video/video.h>
#define MAX_HEIGHT 4096
/* Filter signals and args */
enum
{
/* FILL ME */
LAST_SIGNAL
};
#define DEFAULT_SNAPSHOT TRUE
enum
{
ARG_0
};
static void gst_mng_enc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_mng_enc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstFlowReturn gst_mng_enc_chain (GstPad * pad, GstBuffer * buf);
GstPadTemplate *mngenc_src_template, *mngenc_sink_template;
GST_BOILERPLATE (GstMngEnc, gst_mng_enc, GstElement, GST_TYPE_ELEMENT);
static GstCaps *
mng_caps_factory (void)
{
return gst_caps_new_simple ("video/x-mng",
"width", GST_TYPE_INT_RANGE, 16, 4096,
"height", GST_TYPE_INT_RANGE, 16, 4096,
"framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
}
static GstCaps *
raw_caps_factory (void)
{
return gst_caps_from_string (GST_VIDEO_CAPS_RGB);
}
static void
gst_mng_enc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstCaps *raw_caps, *mng_caps;
raw_caps = raw_caps_factory ();
mng_caps = mng_caps_factory ();
mngenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
GST_PAD_ALWAYS, raw_caps);
mngenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
GST_PAD_ALWAYS, mng_caps);
gst_element_class_add_pad_template (element_class, mngenc_sink_template);
gst_element_class_add_pad_template (element_class, mngenc_src_template);
gst_element_class_set_details_simple (element_class, "MNG video encoder",
"Codec/Encoder/Video",
"Encode a video frame to an .mng video", "Wim Taymans <wim@fluendo.com>");
gst_object_unref (mngenc_src_template);
gst_object_unref (mngenc_sink_template);
}
static void
gst_mng_enc_class_init (GstMngEncClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gobject_class->get_property = gst_mng_enc_get_property;
gobject_class->set_property = gst_mng_enc_set_property;
}
static gboolean
gst_mng_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
{
GstMngEnc *mngenc;
gdouble fps;
GstStructure *structure;
mngenc = GST_MNG_ENC (gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "width", &mngenc->width);
gst_structure_get_int (structure, "height", &mngenc->height);
gst_structure_get_double (structure, "framerate", &fps);
gst_structure_get_int (structure, "bpp", &mngenc->bpp);
caps = gst_caps_new_simple ("video/x-mng",
"framerate", G_TYPE_DOUBLE, fps,
"width", G_TYPE_INT, mngenc->width,
"height", G_TYPE_INT, mngenc->height, NULL);
gst_pad_set_caps (mngenc->srcpad, caps);
gst_caps_unref (caps);
gst_object_unref (mngenc);
return TRUE;
}
static void
gst_mng_enc_init (GstMngEnc * mngenc, GstMngEncClass * gclass)
{
mngenc->sinkpad = gst_pad_new_from_template (mngenc_sink_template, "sink");
gst_element_add_pad (GST_ELEMENT (mngenc), mngenc->sinkpad);
mngenc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (mngenc), mngenc->srcpad);
gst_pad_set_chain_function (mngenc->sinkpad, gst_mng_enc_chain);
gst_pad_set_setcaps_function (mngenc->sinkpad, gst_mng_enc_sink_setcaps);
}
static GstFlowReturn
gst_mng_enc_chain (GstPad * pad, GstBuffer * buf)
{
GstMngEnc *mngenc;
mngenc = GST_MNG_ENC (gst_pad_get_parent (pad));
/* FIXME, do something here */
gst_buffer_unref (buf);
gst_object_unref (mngenc);
return GST_FLOW_NOT_SUPPORTED;
}
static void
gst_mng_enc_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec)
{
GstMngEnc *mngenc;
mngenc = GST_MNG_ENC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_mng_enc_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec)
{
GstMngEnc *mngenc;
mngenc = GST_MNG_ENC (object);
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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_MNG_ENC_H__
#define __GST_MNG_ENC_H__
#include <gst/gst.h>
#include <libmng.h>
G_BEGIN_DECLS
#define GST_TYPE_MNG_ENC (gst_mng_enc_get_type())
#define GST_MNG_ENC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MNG_ENC,GstMngEnc))
#define GST_MNG_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MNG_ENC,GstMngEncClass))
#define GST_IS_MNG_ENC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MNG_ENC))
#define GST_IS_MNG_ENC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MNG_ENC))
#define GST_MNG_ENC_CAST(obj) (GstMngEnc *)(obj)
typedef struct _GstMngEnc GstMngEnc;
typedef struct _GstMngEncClass GstMngEncClass;
extern GstPadTemplate *mngenc_src_template, *mngenc_sink_template;
struct _GstMngEnc
{
GstElement element;
GstPad *sinkpad, *srcpad;
GstBuffer *buffer_out;
mng_handle mng;
gint width;
gint height;
gint bpp;
};
struct _GstMngEncClass
{
GstElementClass parent_class;
};
GType gst_mng_enc_get_type(void);
G_END_DECLS
#endif /* __GST_MNG_ENC_H__ */
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -22,6 +24,7 @@
#define __GST_PNGDEC_H__
#include <gst/gst.h>
#include <gst/video/gstvideodecoder.h>
#include <png.h>
G_BEGIN_DECLS
......@@ -37,44 +40,30 @@ typedef struct _GstPngDecClass GstPngDecClass;
struct _GstPngDec
{
GstElement element;
GstVideoDecoder parent;
GstPad *sinkpad, *srcpad;
GstVideoCodecState *input_state;
GstVideoCodecState *output_state;
GstVideoCodecFrame *current_frame;
gboolean need_newsegment;
GstFlowReturn ret;
/* Progressive */
GstBuffer *buffer_out;
GstFlowReturn ret;
png_uint_32 rowbytes;
/* Pull range */
gint offset;
png_structp png;
png_infop info;
png_infop endinfo;
gboolean setup;
gint width;
gint height;
gint bpp;
gint color_type;
gint fps_n;
gint fps_d;
/* Chain */
gboolean framed;
GstClockTime in_timestamp;
GstClockTime in_duration;
GstSegment segment;
gboolean image_ready;
};
struct _GstPngDecClass
{
GstElementClass parent_class;
GstVideoDecoderClass parent_class;
};
GType gst_pngdec_get_type(void);
......
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* Copyright (C) 2012 Collabora Ltd.
* Author : Edward Hervey <edward@collabora.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -22,6 +24,7 @@
#define __GST_PNGENC_H__
#include <gst/gst.h>
#include <gst/video/gstvideoencoder.h>
#include <png.h>
#ifdef __cplusplus
......@@ -40,9 +43,9 @@ typedef struct _GstPngEncClass GstPngEncClass;
struct _GstPngEnc
{
GstElement element;
GstVideoEncoder parent;
GstPad *sinkpad, *srcpad;
GstVideoCodecState *input_state;
GstBuffer *buffer_out;
guint written;
......@@ -51,9 +54,6 @@ struct _GstPngEnc
gint png_color_type;
gint depth;
gint width;
gint height;
gint stride;
guint compression_level;
gboolean snapshot;
......@@ -62,7 +62,7 @@ struct _GstPngEnc
struct _GstPngEncClass
{
GstElementClass parent_class;
GstVideoEncoderClass parent_class;
};
GType gst_pngenc_get_type(void);
......
......@@ -644,7 +644,7 @@ static void
proxypad_blocked_cb (GstPad * pad, gboolean blocked, gpointer data)
{
GstPulseAudioSink *pbin = GST_PULSE_AUDIO_SINK (data);
GstCaps *caps;
GstCaps *caps = NULL;
GstPad *sinkpad = NULL;
if (!blocked) {
......@@ -676,8 +676,6 @@ proxypad_blocked_cb (GstPad * pad, gboolean blocked, gpointer data)
} else
GST_DEBUG_OBJECT (pbin, "Doing nothing");
gst_caps_unref (caps);
gst_object_unref (sinkpad);
goto done;
}
/* pulsesink doesn't accept the incoming caps, so add a decodebin
......@@ -703,6 +701,11 @@ done:
gst_pad_set_blocked_async_full (pad, FALSE, proxypad_blocked_cb,
gst_object_ref (pbin), (GDestroyNotify) gst_object_unref);
if (sinkpad)
gst_object_unref (sinkpad);
if (caps)
gst_caps_unref (caps);
GST_PULSE_AUDIO_SINK_UNLOCK (pbin);
}
......
......@@ -417,7 +417,7 @@ gst_pulsering_context_subscribe_cb (pa_context * c,
GstPulseRingBuffer *pbuf = (GstPulseRingBuffer *) walk->data;
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
GST_LOG_OBJECT (psink, "type %d, idx %u", t, idx);
GST_LOG_OBJECT (psink, "type %04x, idx %u", t, idx);
if (!pbuf->stream)
continue;
......@@ -929,8 +929,12 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE |
PA_STREAM_ADJUST_LATENCY | PA_STREAM_START_CORKED;
if (psink->mute_set && psink->mute)
flags |= PA_STREAM_START_MUTED;
if (psink->mute_set) {
if (psink->mute)
flags |= PA_STREAM_START_MUTED;
else
flags |= PA_STREAM_START_UNMUTED;
}
/* we always start corked (see flags above) */
pbuf->corked = TRUE;
......@@ -2074,7 +2078,7 @@ gst_pulsesink_pad_acceptcaps (GstPad * pad, GstCaps * caps)
}
/* Either template caps didn't match, or we're still in NULL state */
if (!ret || !pbuf->context)
if (!ret || !pbuf || !pbuf->context)
goto done;
/* If we've not got fixed caps, creating a stream might fail, so let's just
......@@ -2167,6 +2171,8 @@ out:
pa_stream_unref (stream);
}
gst_caps_replace (&spec.caps, NULL);
pa_threaded_mainloop_unlock (mainloop);
done:
......
......@@ -111,6 +111,8 @@ static GstStateChangeReturn gst_pulsesrc_change_state (GstElement *
static void gst_pulsesrc_init_interfaces (GType type);
static GstClockTime gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src);
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
# define ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN"
#else
......@@ -398,6 +400,14 @@ gst_pulsesrc_init (GstPulseSrc * pulsesrc, GstPulseSrcClass * klass)
/* this should be the default but it isn't yet */
gst_base_audio_src_set_slave_method (GST_BASE_AUDIO_SRC (pulsesrc),
GST_BASE_AUDIO_SRC_SLAVE_SKEW);
/* override with a custom clock */
if (GST_BASE_AUDIO_SRC (pulsesrc)->clock)
gst_object_unref (GST_BASE_AUDIO_SRC (pulsesrc)->clock);
GST_BASE_AUDIO_SRC (pulsesrc)->clock =
gst_audio_clock_new ("GstPulseSrcClock",
(GstAudioClockGetTimeFunc) gst_pulsesrc_get_time, pulsesrc);
}
static void
......@@ -1108,9 +1118,6 @@ gst_pulsesrc_read (GstAudioSrc * asrc, gpointer data, guint length)
GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (asrc);
size_t sum = 0;
pa_threaded_mainloop_lock (pulsesrc->mainloop);
pulsesrc->in_read = TRUE;
#ifdef HAVE_PULSE_1_0
if (g_atomic_int_compare_and_exchange (&pulsesrc->notify, 1, 0)) {
g_object_notify (G_OBJECT (pulsesrc), "volume");
......@@ -1118,6 +1125,9 @@ gst_pulsesrc_read (GstAudioSrc * asrc, gpointer data, guint length)
}
#endif
pa_threaded_mainloop_lock (pulsesrc->mainloop);
pulsesrc->in_read = TRUE;
if (pulsesrc->paused)
goto was_paused;
......@@ -1421,6 +1431,7 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
#ifdef HAVE_PULSE_1_0
pa_operation *o;
#endif
GstAudioClock *clock;
pa_threaded_mainloop_lock (pulsesrc->mainloop);
......@@ -1428,7 +1439,7 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
/* enable event notifications */
GST_LOG_OBJECT (pulsesrc, "subscribing to context events");
if (!(o = pa_context_subscribe (pulsesrc->context,
PA_SUBSCRIPTION_MASK_SINK_INPUT, NULL, NULL))) {
PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, NULL, NULL))) {
GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED,
("pa_context_subscribe() failed: %s",
pa_strerror (pa_context_errno (pulsesrc->context))), (NULL));
......@@ -1467,6 +1478,10 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
goto unlock_and_fail;
}
/* our clock will now start from 0 again */
clock = GST_AUDIO_CLOCK (GST_BASE_AUDIO_SRC (pulsesrc)->clock);
gst_audio_clock_reset (clock, 0);
pulsesrc->corked = TRUE;
for (;;) {
......@@ -1690,6 +1705,11 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition)
gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server,
this->device, GST_PULSEMIXER_SOURCE);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_element_post_message (element,
gst_message_new_clock_provide (GST_OBJECT_CAST (element),
GST_BASE_AUDIO_SRC (this)->clock, TRUE));
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
/* uncork and start recording */
gst_pulsesrc_play (this);
......@@ -1728,6 +1748,12 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition)
this->mainloop = NULL;
}
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
/* format_lost is reset in release() in baseaudiosink */
gst_element_post_message (element,
gst_message_new_clock_lost (GST_OBJECT_CAST (element),
GST_BASE_AUDIO_SRC (this)->clock));
break;
default:
break;
}
......@@ -1748,3 +1774,28 @@ mainloop_start_failed:
return GST_STATE_CHANGE_FAILURE;
}
}
static GstClockTime
gst_pulsesrc_get_time (GstClock * clock, GstPulseSrc * src)
{
pa_usec_t time = 0;
pa_threaded_mainloop_lock (src->mainloop);
if (gst_pulsesrc_is_dead (src, TRUE)) {
goto unlock_and_out;
}
if (pa_stream_get_time (src->stream, &time) < 0) {
GST_DEBUG_OBJECT (src, "could not get time");
time = GST_CLOCK_TIME_NONE;
} else {
time *= 1000;
}
unlock_and_out:
pa_threaded_mainloop_unlock (src->mainloop);
return time;
}
......@@ -17,6 +17,8 @@
* Boston, MA 02111-1307, USA.
*/
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <libavc1394/avc1394.h>
#include <libavc1394/avc1394_vcr.h>
#include <libavc1394/rom1394.h>
......
......@@ -67,6 +67,8 @@
* </refsect2>
*/
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -738,7 +740,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
if (src->automatic_redirect && SOUP_STATUS_IS_REDIRECTION (msg->status_code)) {
GST_DEBUG_OBJECT (src, "%u redirect to \"%s\"", msg->status_code,
soup_message_headers_get (msg->response_headers, "Location"));
soup_message_headers_get_one (msg->response_headers, "Location"));
return;
}
......@@ -771,7 +773,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
tag_list = gst_tag_list_new ();
if ((value =
soup_message_headers_get (msg->response_headers,
soup_message_headers_get_one (msg->response_headers,
"icy-metaint")) != NULL) {
gint icy_metaint = atoi (value);
......@@ -823,7 +825,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
g_hash_table_destroy (params);
if ((value =
soup_message_headers_get (msg->response_headers,
soup_message_headers_get_one (msg->response_headers,
"icy-name")) != NULL) {
g_free (src->iradio_name);
src->iradio_name = gst_soup_http_src_unicodify (value);
......@@ -834,7 +836,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
}
}
if ((value =
soup_message_headers_get (msg->response_headers,
soup_message_headers_get_one (msg->response_headers,
"icy-genre")) != NULL) {
g_free (src->iradio_genre);
src->iradio_genre = gst_soup_http_src_unicodify (value);
......@@ -844,7 +846,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
src->iradio_genre, NULL);
}
}
if ((value = soup_message_headers_get (msg->response_headers, "icy-url"))
if ((value = soup_message_headers_get_one (msg->response_headers, "icy-url"))
!= NULL) {
g_free (src->iradio_url);
src->iradio_url = gst_soup_http_src_unicodify (value);
......@@ -1145,8 +1147,6 @@ gst_soup_http_src_build_message (GstSoupHTTPSrc * src)
*cookie);
}
}
soup_message_headers_append (src->msg->request_headers,
"transferMode.dlna.org", "Streaming");
src->retry = FALSE;
g_signal_connect (src->msg, "got_headers",
......@@ -1374,8 +1374,9 @@ gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment)
GST_DEBUG_OBJECT (src, "do_seek(%" G_GUINT64_FORMAT ")", segment->start);
if (src->read_position == segment->start) {
GST_DEBUG_OBJECT (src, "Seeking to current read position");
if (src->read_position == segment->start &&
src->request_position == src->read_position) {
GST_DEBUG_OBJECT (src, "Seek to current read position and no seek pending");
return TRUE;
}
......@@ -1423,10 +1424,25 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
static gboolean
gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri)
{
const char *alt_schemes[] = { "icy://", "icyx://" };
guint i;
if (src->location) {
g_free (src->location);
src->location = NULL;
}
if (uri == NULL)
return FALSE;
for (i = 0; i < G_N_ELEMENTS (alt_schemes); i++) {
if (g_str_has_prefix (uri, alt_schemes[i])) {
src->location =
g_strdup_printf ("http://%s", uri + strlen (alt_schemes[i]));
return TRUE;
}
}
src->location = g_strdup (uri);
return TRUE;
......@@ -1460,7 +1476,8 @@ gst_soup_http_src_uri_get_type (void)
static gchar **
gst_soup_http_src_uri_get_protocols (void)
{
static const gchar *protocols[] = { "http", "https", NULL };
static const gchar *protocols[] = { "http", "https", "icy", "icyx", NULL };
return (gchar **) protocols;
}
......
......@@ -2356,6 +2356,12 @@ gst_alpha_init_params (GstAlpha * alpha)
gfloat y;
const gint *matrix;
if (alpha->in_format == GST_VIDEO_FORMAT_UNKNOWN
|| alpha->out_format == GST_VIDEO_FORMAT_UNKNOWN) {
GST_DEBUG_OBJECT (alpha, "video formats not set yet");
return;
}
/* RGB->RGB: convert to SDTV YUV, chroma keying, convert back
* YUV->RGB: chroma keying, convert to RGB
* RGB->YUV: convert to YUV, chroma keying
......
......@@ -167,7 +167,7 @@ process_##channels##_##width (GstAudioFXBaseFIRFilter * self, const g##ctype * s
if (self->buffer_fill > kernel_length) \
self->buffer_fill = kernel_length; \
\
return input_samples / channels; \
return input_samples; \
} G_STMT_END
DEFINE_PROCESS_FUNC (32, float);
......
......@@ -731,7 +731,7 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
if (((data[i] == 0xff) && ((data[i + 1] & 0xf6) == 0xf0)) ||
((data[0] == 0x56) && ((data[1] & 0xe0) == 0xe0)) ||
strncmp ((char *) data + i, "ADIF", 4) == 0) {
GST_DEBUG_OBJECT (aacparse, "Found ADIF signature at offset %u", i);
GST_DEBUG_OBJECT (aacparse, "Found signature at offset %u", i);
found = TRUE;
if (i) {
......@@ -756,10 +756,15 @@ gst_aac_parse_detect_stream (GstAacParse * aacparse,
GST_INFO ("ADTS ID: %d, framesize: %d", (data[1] & 0x08) >> 3, *framesize);
aacparse->header_type = DSPAAC_HEADER_ADTS;
gst_aac_parse_parse_adts_header (aacparse, data, &rate, &channels,
&aacparse->object_type, &aacparse->mpegversion);
if (!channels || !framesize) {
GST_DEBUG_OBJECT (aacparse, "impossible ADTS configuration");
return FALSE;
}
aacparse->header_type = DSPAAC_HEADER_ADTS;
gst_base_parse_set_frame_rate (GST_BASE_PARSE (aacparse), rate,
aacparse->frame_samples, 2, 2);
......
......@@ -184,6 +184,9 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS ("audio/x-flac")
);
static GstBuffer *gst_flac_parse_generate_vorbiscomment (GstFlacParse *
flacparse);
static void gst_flac_parse_finalize (GObject * object);
static void gst_flac_parse_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
......@@ -552,6 +555,16 @@ gst_flac_parse_frame_header_is_valid (GstFlacParse * flacparse,
}
}
/* documentation says:
* The "blocking strategy" bit must be the same throughout the entire stream. */
if (flacparse->blocking_strategy != blocking_strategy) {
if (flacparse->block_size != 0) {
GST_WARNING_OBJECT (flacparse, "blocking strategy is not constant");
if (suspect)
*suspect = TRUE;
}
}
/*
The FLAC format documentation says:
The "blocking strategy" bit determines how to calculate the sample number
......@@ -1058,6 +1071,16 @@ gst_flac_parse_handle_headers (GstFlacParse * flacparse)
}
}
/* at least this one we can generate easily
* to provide full headers downstream */
if (vorbiscomment == NULL && streaminfo != NULL) {
GST_DEBUG_OBJECT (flacparse,
"missing vorbiscomment header; generating dummy");
vorbiscomment = gst_flac_parse_generate_vorbiscomment (flacparse);
flacparse->headers = g_list_insert (flacparse->headers, vorbiscomment,
g_list_index (flacparse->headers, streaminfo) + 1);
}
if (marker == NULL || streaminfo == NULL || vorbiscomment == NULL) {
GST_WARNING_OBJECT (flacparse,
"missing header %p %p %p, muxing into container "
......@@ -1140,10 +1163,54 @@ push_headers:
return res;
}
/* empty vorbiscomment */
static GstBuffer *
gst_flac_parse_generate_vorbiscomment (GstFlacParse * flacparse)
{
GstTagList *taglist = gst_tag_list_new ();
guchar header[4];
guint size;
GstBuffer *vorbiscomment;
guint8 *data;
header[0] = 0x84; /* is_last = 1; type = 4; */
vorbiscomment =
gst_tag_list_to_vorbiscomment_buffer (taglist, header,
sizeof (header), NULL);
gst_tag_list_free (taglist);
data = GST_BUFFER_DATA (vorbiscomment);
size = GST_BUFFER_SIZE (vorbiscomment);
/* Get rid of framing bit */
if (data[size - 1] == 1) {
GstBuffer *sub;
sub = gst_buffer_create_sub (vorbiscomment, 0, size - 1);
gst_buffer_unref (vorbiscomment);
vorbiscomment = sub;
data = GST_BUFFER_DATA (vorbiscomment);
}
size = GST_BUFFER_SIZE (vorbiscomment) - 4;
data[1] = ((size & 0xFF0000) >> 16);
data[2] = ((size & 0x00FF00) >> 8);
data[3] = (size & 0x0000FF);
GST_BUFFER_TIMESTAMP (vorbiscomment) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (vorbiscomment) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (vorbiscomment) = 0;
GST_BUFFER_OFFSET_END (vorbiscomment) = 0;
return vorbiscomment;
}
static gboolean
gst_flac_parse_generate_headers (GstFlacParse * flacparse)
{
GstBuffer *marker, *streaminfo, *vorbiscomment;
GstBuffer *marker, *streaminfo;
guint8 *data;
marker = gst_buffer_new_and_alloc (4);
......@@ -1210,42 +1277,8 @@ gst_flac_parse_generate_headers (GstFlacParse * flacparse)
GST_BUFFER_OFFSET_END (streaminfo) = 0;
flacparse->headers = g_list_append (flacparse->headers, streaminfo);
/* empty vorbiscomment */
{
GstTagList *taglist = gst_tag_list_new ();
guchar header[4];
guint size;
header[0] = 0x84; /* is_last = 1; type = 4; */
vorbiscomment =
gst_tag_list_to_vorbiscomment_buffer (taglist, header,
sizeof (header), NULL);
gst_tag_list_free (taglist);
/* Get rid of framing bit */
if (GST_BUFFER_DATA (vorbiscomment)[GST_BUFFER_SIZE (vorbiscomment) -
1] == 1) {
GstBuffer *sub;
sub =
gst_buffer_create_sub (vorbiscomment, 0,