mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
resindvd: First part of the re-plugging audio decoder
This commit is contained in:
parent
093f844640
commit
7d33cf22a9
3 changed files with 198 additions and 0 deletions
|
@ -6,6 +6,7 @@ libresindvd_la_SOURCES = \
|
||||||
plugin.c \
|
plugin.c \
|
||||||
resindvdbin.c \
|
resindvdbin.c \
|
||||||
rsnaudiomunge.c \
|
rsnaudiomunge.c \
|
||||||
|
rsnaudiodec.c \
|
||||||
rsnbasesrc.c \
|
rsnbasesrc.c \
|
||||||
rsnpushsrc.c \
|
rsnpushsrc.c \
|
||||||
rsnstreamselector.c \
|
rsnstreamselector.c \
|
||||||
|
@ -23,6 +24,7 @@ libresindvd_la_LIBTOOLFLAGS = --tag=disable-static
|
||||||
|
|
||||||
noinst_HEADERS = resindvdbin.h \
|
noinst_HEADERS = resindvdbin.h \
|
||||||
rsnaudiomunge.h \
|
rsnaudiomunge.h \
|
||||||
|
rsnaudiodec.h \
|
||||||
rsnbasesrc.h \
|
rsnbasesrc.h \
|
||||||
rsnpushsrc.h \
|
rsnpushsrc.h \
|
||||||
rsnstreamselector.h \
|
rsnstreamselector.h \
|
||||||
|
|
143
ext/resindvd/rsnaudiodec.c
Normal file
143
ext/resindvd/rsnaudiodec.c
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2009> Jan Schmidt <thaytan@noraisin.net>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "rsnaudiodec.h"
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (rsn_audiodec_debug);
|
||||||
|
#define GST_CAT_DEFAULT rsn_audiodec_debug
|
||||||
|
|
||||||
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
GST_PAD_SINK,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS ("audio/mpeg,mpegversion=(int)1;"
|
||||||
|
"audio/x-private1-lpcm;"
|
||||||
|
"audio/x-private1-ac3;" "audio/x-private1-dts;" "audio/ac3")
|
||||||
|
);
|
||||||
|
|
||||||
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
GST_PAD_SRC,
|
||||||
|
GST_PAD_ALWAYS,
|
||||||
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
||||||
|
"rate = (int) [ 1, MAX ], "
|
||||||
|
"channels = (int) [ 1, MAX ], "
|
||||||
|
"endianness = (int) BYTE_ORDER, "
|
||||||
|
"width = (int) { 32, 64 }; "
|
||||||
|
"audio/x-raw-int, "
|
||||||
|
"rate = (int) [ 1, MAX ], "
|
||||||
|
"channels = (int) [ 1, MAX ], "
|
||||||
|
"endianness = (int) BYTE_ORDER, "
|
||||||
|
"width = (int) 32, "
|
||||||
|
"depth = (int) 32, "
|
||||||
|
"signed = (boolean) true; "
|
||||||
|
"audio/x-raw-int, "
|
||||||
|
"rate = (int) [ 1, MAX ], "
|
||||||
|
"channels = (int) [ 1, MAX ], "
|
||||||
|
"endianness = (int) BYTE_ORDER, "
|
||||||
|
"width = (int) 24, "
|
||||||
|
"depth = (int) 24, "
|
||||||
|
"signed = (boolean) true; "
|
||||||
|
"audio/x-raw-int, "
|
||||||
|
"rate = (int) [ 1, MAX ], "
|
||||||
|
"channels = (int) [ 1, MAX ], "
|
||||||
|
"endianness = (int) BYTE_ORDER, "
|
||||||
|
"width = (int) 16, "
|
||||||
|
"depth = (int) 16, "
|
||||||
|
"signed = (boolean) true; "
|
||||||
|
"audio/x-raw-int, "
|
||||||
|
"rate = (int) [ 1, MAX ], "
|
||||||
|
"channels = (int) [ 1, MAX ], "
|
||||||
|
"endianness = (int) BYTE_ORDER, "
|
||||||
|
"width = (int) 8, " "depth = (int) 8, " "signed = (boolean) true")
|
||||||
|
);
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (RsnAudioDec, rsn_audiodec, GST_TYPE_BIN);
|
||||||
|
|
||||||
|
static gboolean rsn_audiodec_set_sink_caps (GstPad * sinkpad, GstCaps * caps);
|
||||||
|
static GstCaps *rsn_audiodec_get_sink_caps (GstPad * sinkpad);
|
||||||
|
static GstFlowReturn rsn_audiodec_chain (GstPad * pad, GstBuffer * buf);
|
||||||
|
static gboolean rsn_audiodec_sink_event (GstPad * pad, GstEvent * event);
|
||||||
|
|
||||||
|
static void
|
||||||
|
rsn_audiodec_class_init (RsnAudioDecClass * klass)
|
||||||
|
{
|
||||||
|
static GstElementDetails element_details = {
|
||||||
|
"RsnAudioDec",
|
||||||
|
"Audio/Decoder",
|
||||||
|
"Resin DVD audio stream decoder",
|
||||||
|
"Jan Schmidt <thaytan@noraisin.net>"
|
||||||
|
};
|
||||||
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (rsn_audiodec_debug, "rsn_audiodec",
|
||||||
|
0, "Resin DVD audio stream decoder");
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (element_class,
|
||||||
|
gst_static_pad_template_get (&src_template));
|
||||||
|
gst_element_class_add_pad_template (element_class,
|
||||||
|
gst_static_pad_template_get (&sink_template));
|
||||||
|
|
||||||
|
gst_element_class_set_details (element_class, &element_details);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rsn_audiodec_init (RsnAudioDec * self)
|
||||||
|
{
|
||||||
|
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
||||||
|
gst_pad_set_setcaps_function (self->sinkpad,
|
||||||
|
GST_DEBUG_FUNCPTR (rsn_audiodec_set_sink_caps));
|
||||||
|
gst_pad_set_getcaps_function (self->sinkpad,
|
||||||
|
GST_DEBUG_FUNCPTR (rsn_audiodec_get_sink_caps));
|
||||||
|
gst_pad_set_chain_function (self->sinkpad,
|
||||||
|
GST_DEBUG_FUNCPTR (rsn_audiodec_chain));
|
||||||
|
gst_pad_set_event_function (self->sinkpad,
|
||||||
|
GST_DEBUG_FUNCPTR (rsn_audiodec_sink_event));
|
||||||
|
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
||||||
|
|
||||||
|
self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
||||||
|
|
||||||
|
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
rsn_audiodec_set_sink_caps (GstPad * sinkpad, GstCaps * caps)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstCaps *
|
||||||
|
rsn_audiodec_get_sink_caps (GstPad * sinkpad)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
rsn_audiodec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
|
{
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
rsn_audiodec_sink_event (GstPad * pad, GstEvent * event)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
53
ext/resindvd/rsnaudiodec.h
Normal file
53
ext/resindvd/rsnaudiodec.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2009> Jan Schmidt <thaytan@noraisin.net>
|
||||||
|
*
|
||||||
|
* 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 __RSNAUDIODEC_H__
|
||||||
|
#define __RSNAUDIODEC_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
#define RSN_TYPE_AUDIODEC (rsn_audiodec_get_type())
|
||||||
|
#define RSN_AUDIODEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),RSN_TYPE_AUDIODEC,RsnAudioMunge))
|
||||||
|
#define RSN_AUDIODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),RSN_TYPE_AUDIODEC,RsnAudioMungeClass))
|
||||||
|
#define RSN_IS_AUDIODEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),RSN_TYPE_AUDIODEC))
|
||||||
|
#define RSN_IS_AUDIODEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),RSN_TYPE_AUDIODEC))
|
||||||
|
|
||||||
|
GType rsn_audiodec_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
typedef struct _RsnAudioDec RsnAudioDec;
|
||||||
|
typedef struct _RsnAudioDecClass RsnAudioDecClass;
|
||||||
|
|
||||||
|
struct _RsnAudioDec {
|
||||||
|
GstBin element;
|
||||||
|
|
||||||
|
GstPad *sinkpad;
|
||||||
|
GstPad *srcpad;
|
||||||
|
|
||||||
|
GstElement *cur_dec;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _RsnAudioDecClass {
|
||||||
|
GstBinClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __RSNAUDIODEC_H__ */
|
Loading…
Reference in a new issue