gst-indent c++ files
Original commit message from CVS: gst-indent c++ files
This commit is contained in:
parent
7a778ee4b7
commit
87960e43ea
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
using namespace Arts;
|
using namespace Arts;
|
||||||
|
|
||||||
namespace Gst {
|
namespace Gst
|
||||||
|
{
|
||||||
|
|
||||||
class ArtsStereoSink_impl:virtual public ArtsStereoSink_skel,
|
class ArtsStereoSink_impl:virtual public ArtsStereoSink_skel,
|
||||||
virtual public StdSynthModule
|
virtual public StdSynthModule
|
||||||
@ -41,16 +42,17 @@ public:
|
|||||||
//gint16 *s;
|
//gint16 *s;
|
||||||
//fprintf(stderr,"StereoSink: getting %d samples\n",samples);
|
//fprintf(stderr,"StereoSink: getting %d samples\n",samples);
|
||||||
|
|
||||||
while (fulfilled < samples) {
|
while (fulfilled < samples)
|
||||||
|
{
|
||||||
if (remainingsamples == 0) {
|
if (remainingsamples == 0) {
|
||||||
//fprintf(stderr,"need to get a buffer\n");
|
//fprintf(stderr,"need to get a buffer\n");
|
||||||
if (inbuf) {
|
if (inbuf) {
|
||||||
gst_data_unref (inbuf);
|
gst_data_unref (inbuf);
|
||||||
inbuf = NULL;
|
inbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// start by pulling a buffer from GStreamer
|
// start by pulling a buffer from GStreamer
|
||||||
inbuf = gst_pad_pull (sinkpad);
|
inbuf = gst_pad_pull (sinkpad);
|
||||||
|
|
||||||
while (GST_IS_EVENT (inbuf)) {
|
while (GST_IS_EVENT (inbuf)) {
|
||||||
switch (GST_EVENT_TYPE (inbuf)) {
|
switch (GST_EVENT_TYPE (inbuf)) {
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
@ -68,6 +70,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned long count = MIN (remainingsamples, samples - fulfilled);
|
unsigned long count = MIN (remainingsamples, samples - fulfilled);
|
||||||
|
|
||||||
//fprintf(stderr,"have %d samples left, can fill %d\n",remainingsamples,count);
|
//fprintf(stderr,"have %d samples left, can fill %d\n",remainingsamples,count);
|
||||||
convert_stereo_i16le_2float (count, dataptr, outleft, outright);
|
convert_stereo_i16le_2float (count, dataptr, outleft, outright);
|
||||||
//s = (gint16 *)dataptr;
|
//s = (gint16 *)dataptr;
|
||||||
@ -108,7 +111,8 @@ public:
|
|||||||
GST_BUFFER_DATA (outbuf) = (guchar *) g_malloc (samples * 4);
|
GST_BUFFER_DATA (outbuf) = (guchar *) g_malloc (samples * 4);
|
||||||
GST_BUFFER_SIZE (outbuf) = samples * 4;
|
GST_BUFFER_SIZE (outbuf) = samples * 4;
|
||||||
memset (GST_BUFFER_DATA (outbuf), 0, samples * 4);
|
memset (GST_BUFFER_DATA (outbuf), 0, samples * 4);
|
||||||
convert_stereo_2float_i16le(samples,inleft,inright,GST_BUFFER_DATA(outbuf));
|
convert_stereo_2float_i16le (samples, inleft, inright,
|
||||||
|
GST_BUFFER_DATA (outbuf));
|
||||||
//s = (gint16 *)GST_BUFFER_DATA(outbuf);
|
//s = (gint16 *)GST_BUFFER_DATA(outbuf);
|
||||||
//fprintf(stderr,"samples in are %f and %f, out are %d and %d\n",inleft[0],inright[0],s[0],s[1]);
|
//fprintf(stderr,"samples in are %f and %f, out are %d and %d\n",inleft[0],inright[0],s[0],s[1]);
|
||||||
gst_pad_push (srcpad, GST_DATA (outbuf));
|
gst_pad_push (srcpad, GST_DATA (outbuf));
|
||||||
@ -122,14 +126,16 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class GstArtsWrapper {
|
class GstArtsWrapper
|
||||||
|
{
|
||||||
Dispatcher *dispatcher;
|
Dispatcher *dispatcher;
|
||||||
ArtsStereoSink sink;
|
ArtsStereoSink sink;
|
||||||
ArtsStereoSrc source;
|
ArtsStereoSrc source;
|
||||||
StereoVolumeControl effect;
|
StereoVolumeControl effect;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GstArtsWrapper(GstPad *sinkpad, GstPad *sourcepad) {
|
GstArtsWrapper (GstPad * sinkpad, GstPad * sourcepad)
|
||||||
|
{
|
||||||
dispatcher = new Arts::Dispatcher ();
|
dispatcher = new Arts::Dispatcher ();
|
||||||
ArtsStereoSink_impl *sink_impl = new ArtsStereoSink_impl ();
|
ArtsStereoSink_impl *sink_impl = new ArtsStereoSink_impl ();
|
||||||
ArtsStereoSrc_impl *source_impl = new ArtsStereoSrc_impl ();
|
ArtsStereoSrc_impl *source_impl = new ArtsStereoSrc_impl ();
|
||||||
@ -156,7 +162,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
|
|
||||||
void *gst_arts_wrapper_new (GstPad * sinkpad, GstPad * sourcepad)
|
void *gst_arts_wrapper_new (GstPad * sinkpad, GstPad * sourcepad)
|
||||||
{
|
{
|
||||||
|
@ -33,10 +33,12 @@ static void
|
|||||||
add_fps (GstCaps * caps)
|
add_fps (GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||||
GValue list = { 0 }, fps = { 0 };
|
GValue list = { 0 }, fps = {
|
||||||
|
0};
|
||||||
gdouble fpss[] = { 24.0 / 1.001, 24.0, 25.0,
|
gdouble fpss[] = { 24.0 / 1.001, 24.0, 25.0,
|
||||||
30.0 / 1.001, 30.0, 50.0,
|
30.0 / 1.001, 30.0, 50.0,
|
||||||
60.0/1.001, 60.0, 0 };
|
60.0 / 1.001, 60.0, 0
|
||||||
|
};
|
||||||
guint n;
|
guint n;
|
||||||
|
|
||||||
g_value_init (&list, GST_TYPE_LIST);
|
g_value_init (&list, GST_TYPE_LIST);
|
||||||
@ -62,12 +64,10 @@ sink_templ (void)
|
|||||||
"format", GST_TYPE_FOURCC,
|
"format", GST_TYPE_FOURCC,
|
||||||
GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
GST_MAKE_FOURCC ('I', '4', '2', '0'),
|
||||||
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
||||||
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
|
||||||
NULL);
|
|
||||||
add_fps (caps);
|
add_fps (caps);
|
||||||
|
|
||||||
templ = gst_pad_template_new ("sink", GST_PAD_SINK,
|
templ = gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, caps);
|
||||||
GST_PAD_ALWAYS, caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return templ;
|
return templ;
|
||||||
@ -85,12 +85,10 @@ src_templ (void)
|
|||||||
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
||||||
"mpegversion", GST_TYPE_INT_RANGE, 1, 2,
|
"mpegversion", GST_TYPE_INT_RANGE, 1, 2,
|
||||||
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
||||||
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
"height", GST_TYPE_INT_RANGE, 16, 4096, NULL);
|
||||||
NULL);
|
|
||||||
add_fps (caps);
|
add_fps (caps);
|
||||||
|
|
||||||
templ = gst_pad_template_new ("src", GST_PAD_SRC,
|
templ = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, caps);
|
||||||
GST_PAD_ALWAYS, caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return templ;
|
return templ;
|
||||||
@ -104,20 +102,14 @@ static void gst_mpeg2enc_dispose (GObject *object);
|
|||||||
static void gst_mpeg2enc_loop (GstElement * element);
|
static void gst_mpeg2enc_loop (GstElement * element);
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
gst_mpeg2enc_sink_link (GstPad *pad,
|
gst_mpeg2enc_sink_link (GstPad * pad, const GstCaps * caps);
|
||||||
const GstCaps *caps);
|
|
||||||
|
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn gst_mpeg2enc_change_state (GstElement * element);
|
||||||
gst_mpeg2enc_change_state (GstElement *element);
|
|
||||||
|
|
||||||
static void gst_mpeg2enc_get_property (GObject * object,
|
static void gst_mpeg2enc_get_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
static void gst_mpeg2enc_set_property (GObject * object,
|
static void gst_mpeg2enc_set_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
@ -141,9 +133,7 @@ gst_mpeg2enc_get_type (void)
|
|||||||
|
|
||||||
gst_mpeg2enc_type =
|
gst_mpeg2enc_type =
|
||||||
g_type_register_static (GST_TYPE_ELEMENT,
|
g_type_register_static (GST_TYPE_ELEMENT,
|
||||||
"GstMpeg2enc",
|
"GstMpeg2enc", &gst_mpeg2enc_info, (GTypeFlags) 0);
|
||||||
&gst_mpeg2enc_info,
|
|
||||||
(GTypeFlags) 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gst_mpeg2enc_type;
|
return gst_mpeg2enc_type;
|
||||||
@ -163,8 +153,7 @@ gst_mpeg2enc_base_init (GstMpeg2encClass *klass)
|
|||||||
|
|
||||||
gst_element_class_add_pad_template (element_class, src_templ ());
|
gst_element_class_add_pad_template (element_class, src_templ ());
|
||||||
gst_element_class_add_pad_template (element_class, sink_templ ());
|
gst_element_class_add_pad_template (element_class, sink_templ ());
|
||||||
gst_element_class_set_details (element_class,
|
gst_element_class_set_details (element_class, &gst_mpeg2enc_details);
|
||||||
&gst_mpeg2enc_details);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -194,6 +183,7 @@ gst_mpeg2enc_dispose (GObject *object)
|
|||||||
|
|
||||||
if (enc->encoder) {
|
if (enc->encoder) {
|
||||||
delete enc->encoder;
|
delete enc->encoder;
|
||||||
|
|
||||||
enc->encoder = NULL;
|
enc->encoder = NULL;
|
||||||
}
|
}
|
||||||
delete enc->options;
|
delete enc->options;
|
||||||
@ -207,13 +197,15 @@ gst_mpeg2enc_init (GstMpeg2enc *enc)
|
|||||||
|
|
||||||
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
|
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
enc->sinkpad = gst_pad_new_from_template (
|
enc->sinkpad =
|
||||||
gst_element_class_get_pad_template (klass, "sink"), "sink");
|
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
|
||||||
|
"sink"), "sink");
|
||||||
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
|
gst_pad_set_link_function (enc->sinkpad, gst_mpeg2enc_sink_link);
|
||||||
gst_element_add_pad (element, enc->sinkpad);
|
gst_element_add_pad (element, enc->sinkpad);
|
||||||
|
|
||||||
enc->srcpad = gst_pad_new_from_template (
|
enc->srcpad =
|
||||||
gst_element_class_get_pad_template (klass, "src"), "src");
|
gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
|
||||||
|
"src"), "src");
|
||||||
gst_pad_use_explicit_caps (enc->srcpad);
|
gst_pad_use_explicit_caps (enc->srcpad);
|
||||||
gst_element_add_pad (element, enc->srcpad);
|
gst_element_add_pad (element, enc->srcpad);
|
||||||
|
|
||||||
@ -253,6 +245,7 @@ gst_mpeg2enc_loop (GstElement *element)
|
|||||||
if (gst_pad_set_explicit_caps (enc->srcpad, othercaps) <= 0) {
|
if (gst_pad_set_explicit_caps (enc->srcpad, othercaps) <= 0) {
|
||||||
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), (NULL));
|
GST_ELEMENT_ERROR (element, CORE, NEGOTIATION, (NULL), (NULL));
|
||||||
delete enc->encoder;
|
delete enc->encoder;
|
||||||
|
|
||||||
enc->encoder = NULL;
|
enc->encoder = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -263,8 +256,7 @@ gst_mpeg2enc_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
gst_mpeg2enc_sink_link (GstPad *pad,
|
gst_mpeg2enc_sink_link (GstPad * pad, const GstCaps * caps)
|
||||||
const GstCaps *caps)
|
|
||||||
{
|
{
|
||||||
GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad));
|
GstMpeg2enc *enc = GST_MPEG2ENC (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
@ -273,6 +265,7 @@ gst_mpeg2enc_sink_link (GstPad *pad,
|
|||||||
|
|
||||||
if (enc->encoder) {
|
if (enc->encoder) {
|
||||||
delete enc->encoder;
|
delete enc->encoder;
|
||||||
|
|
||||||
enc->encoder = NULL;
|
enc->encoder = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,18 +274,14 @@ gst_mpeg2enc_sink_link (GstPad *pad,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mpeg2enc_get_property (GObject * object,
|
gst_mpeg2enc_get_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
{
|
||||||
GST_MPEG2ENC (object)->options->getProperty (prop_id, value);
|
GST_MPEG2ENC (object)->options->getProperty (prop_id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mpeg2enc_set_property (GObject * object,
|
gst_mpeg2enc_set_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
{
|
||||||
GST_MPEG2ENC (object)->options->setProperty (prop_id, value);
|
GST_MPEG2ENC (object)->options->setProperty (prop_id, value);
|
||||||
}
|
}
|
||||||
@ -321,18 +310,11 @@ static gboolean
|
|||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
return gst_element_register (plugin, "mpeg2enc",
|
return gst_element_register (plugin, "mpeg2enc",
|
||||||
GST_RANK_NONE,
|
GST_RANK_NONE, GST_TYPE_MPEG2ENC);
|
||||||
GST_TYPE_MPEG2ENC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"mpeg2enc",
|
"mpeg2enc",
|
||||||
"High-quality MPEG-1/2 video encoder",
|
"High-quality MPEG-1/2 video encoder",
|
||||||
plugin_init,
|
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||||
VERSION,
|
|
||||||
"GPL",
|
|
||||||
GST_PACKAGE,
|
|
||||||
GST_ORIGIN
|
|
||||||
)
|
|
||||||
|
@ -36,9 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions * options,
|
GstMpeg2Encoder::GstMpeg2Encoder (GstMpeg2EncOptions * options,
|
||||||
GstPad *sinkpad,
|
GstPad * sinkpad, const GstCaps * caps, GstPad * srcpad):
|
||||||
const GstCaps *caps,
|
|
||||||
GstPad *srcpad) :
|
|
||||||
MPEG2Encoder (*options)
|
MPEG2Encoder (*options)
|
||||||
{
|
{
|
||||||
MPEG2EncInVidParams strm;
|
MPEG2EncInVidParams strm;
|
||||||
@ -90,6 +88,5 @@ GstMpeg2Encoder::getFormat ()
|
|||||||
"mpegversion", G_TYPE_INT, options.mpeg,
|
"mpegversion", G_TYPE_INT, options.mpeg,
|
||||||
"width", G_TYPE_INT, options.in_img_width,
|
"width", G_TYPE_INT, options.in_img_width,
|
||||||
"height", G_TYPE_INT, options.in_img_height,
|
"height", G_TYPE_INT, options.in_img_height,
|
||||||
"framerate", G_TYPE_DOUBLE, fps,
|
"framerate", G_TYPE_DOUBLE, fps, NULL);
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
* Property enumeration.
|
* Property enumeration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_FORMAT,
|
ARG_FORMAT,
|
||||||
ARG_FRAMERATE,
|
ARG_FRAMERATE,
|
||||||
@ -95,8 +96,7 @@ gst_mpeg2enc_format_get_type (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mpeg2enc_format_type =
|
mpeg2enc_format_type =
|
||||||
g_enum_register_static ("GstMpeg2encFormat",
|
g_enum_register_static ("GstMpeg2encFormat", mpeg2enc_formats);
|
||||||
mpeg2enc_formats);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpeg2enc_format_type;
|
return mpeg2enc_format_type;
|
||||||
@ -125,8 +125,7 @@ gst_mpeg2enc_framerate_get_type (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mpeg2enc_framerate_type =
|
mpeg2enc_framerate_type =
|
||||||
g_enum_register_static ("GstMpeg2encFramerate",
|
g_enum_register_static ("GstMpeg2encFramerate", mpeg2enc_framerates);
|
||||||
mpeg2enc_framerates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpeg2enc_framerate_type;
|
return mpeg2enc_framerate_type;
|
||||||
@ -151,8 +150,7 @@ gst_mpeg2enc_aspect_get_type (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mpeg2enc_aspect_type =
|
mpeg2enc_aspect_type =
|
||||||
g_enum_register_static ("GstMpeg2encAspect",
|
g_enum_register_static ("GstMpeg2encAspect", mpeg2enc_aspects);
|
||||||
mpeg2enc_aspects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpeg2enc_aspect_type;
|
return mpeg2enc_aspect_type;
|
||||||
@ -235,8 +233,7 @@ gst_mpeg2enc_video_norm_get_type (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mpeg2enc_video_norm_type =
|
mpeg2enc_video_norm_type =
|
||||||
g_enum_register_static ("GstMpeg2encVideoNorm",
|
g_enum_register_static ("GstMpeg2encVideoNorm", mpeg2enc_video_norms);
|
||||||
mpeg2enc_video_norms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mpeg2enc_video_norm_type;
|
return mpeg2enc_video_norm_type;
|
||||||
@ -291,18 +288,15 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
|
|||||||
/* encoding profile */
|
/* encoding profile */
|
||||||
g_object_class_install_property (klass, ARG_FORMAT,
|
g_object_class_install_property (klass, ARG_FORMAT,
|
||||||
g_param_spec_enum ("format", "Format", "Encoding profile format",
|
g_param_spec_enum ("format", "Format", "Encoding profile format",
|
||||||
GST_TYPE_MPEG2ENC_FORMAT, 0,
|
GST_TYPE_MPEG2ENC_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
(GParamFlags) G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
/* input/output stream overrides */
|
/* input/output stream overrides */
|
||||||
g_object_class_install_property (klass, ARG_FRAMERATE,
|
g_object_class_install_property (klass, ARG_FRAMERATE,
|
||||||
g_param_spec_enum ("framerate", "Framerate", "Output framerate",
|
g_param_spec_enum ("framerate", "Framerate", "Output framerate",
|
||||||
GST_TYPE_MPEG2ENC_FRAMERATE, 0,
|
GST_TYPE_MPEG2ENC_FRAMERATE, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
(GParamFlags) G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (klass, ARG_ASPECT,
|
g_object_class_install_property (klass, ARG_ASPECT,
|
||||||
g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio",
|
g_param_spec_enum ("aspect", "Aspect", "Display aspect ratio",
|
||||||
GST_TYPE_MPEG2ENC_ASPECT, 0,
|
GST_TYPE_MPEG2ENC_ASPECT, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
(GParamFlags) G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (klass, ARG_INTERLACE_MODE,
|
g_object_class_install_property (klass, ARG_INTERLACE_MODE,
|
||||||
g_param_spec_enum ("interlace-mode", "Interlace mode",
|
g_param_spec_enum ("interlace-mode", "Interlace mode",
|
||||||
"MPEG-2 motion estimation and encoding modes",
|
"MPEG-2 motion estimation and encoding modes",
|
||||||
@ -376,13 +370,14 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
|
|||||||
"Max. quantisation reduction for highly active blocks",
|
"Max. quantisation reduction for highly active blocks",
|
||||||
-4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
|
-4., 10., 0., (GParamFlags) G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (klass, ARG_QUANT_REDUCTION_MAX_VAR,
|
g_object_class_install_property (klass, ARG_QUANT_REDUCTION_MAX_VAR,
|
||||||
g_param_spec_float ("quant-reduction-max-var", "Max. quant. reduction variance",
|
g_param_spec_float ("quant-reduction-max-var",
|
||||||
"Maximal luma variance below which quantisation boost is used",
|
"Max. quant. reduction variance",
|
||||||
0., 2500., 0., (GParamFlags) G_PARAM_READWRITE));
|
"Maximal luma variance below which quantisation boost is used", 0.,
|
||||||
|
2500., 0., (GParamFlags) G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (klass, ARG_INTRA_DC_PRECISION,
|
g_object_class_install_property (klass, ARG_INTRA_DC_PRECISION,
|
||||||
g_param_spec_int ("intra-dc-prec", "Intra. DC precision",
|
g_param_spec_int ("intra-dc-prec", "Intra. DC precision",
|
||||||
"Number of bits precision for DC (base colour) in MPEG-2 blocks",
|
"Number of bits precision for DC (base colour) in MPEG-2 blocks", 8,
|
||||||
8, 11, 9, (GParamFlags) G_PARAM_READWRITE));
|
11, 9, (GParamFlags) G_PARAM_READWRITE));
|
||||||
g_object_class_install_property (klass, ARG_REDUCE_HF,
|
g_object_class_install_property (klass, ARG_REDUCE_HF,
|
||||||
g_param_spec_float ("reduce-hf", "Reduce HF",
|
g_param_spec_float ("reduce-hf", "Reduce HF",
|
||||||
"How much to reduce high-frequency resolution (by increasing quantisation)",
|
"How much to reduce high-frequency resolution (by increasing quantisation)",
|
||||||
@ -407,8 +402,7 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
|
|||||||
g_object_class_install_property (klass, ARG_VIDEO_NORM,
|
g_object_class_install_property (klass, ARG_VIDEO_NORM,
|
||||||
g_param_spec_enum ("norm", "Norm",
|
g_param_spec_enum ("norm", "Norm",
|
||||||
"Tag output for specific video norm",
|
"Tag output for specific video norm",
|
||||||
GST_TYPE_MPEG2ENC_VIDEO_NORM, 0,
|
GST_TYPE_MPEG2ENC_VIDEO_NORM, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
(GParamFlags) G_PARAM_READWRITE));
|
|
||||||
g_object_class_install_property (klass, ARG_SEQUENCE_LENGTH,
|
g_object_class_install_property (klass, ARG_SEQUENCE_LENGTH,
|
||||||
g_param_spec_int ("sequence-length", "Sequence length",
|
g_param_spec_int ("sequence-length", "Sequence length",
|
||||||
"Place a sequence boundary after each <num> MB (0=disable)",
|
"Place a sequence boundary after each <num> MB (0=disable)",
|
||||||
@ -443,7 +437,6 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
|
|||||||
#if 0
|
#if 0
|
||||||
"--dxr2-hack"
|
"--dxr2-hack"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* dangerous/experimental stuff */
|
/* dangerous/experimental stuff */
|
||||||
g_object_class_install_property (klass, ARG_CONSTRAINTS,
|
g_object_class_install_property (klass, ARG_CONSTRAINTS,
|
||||||
g_param_spec_boolean ("constraints", "Constraints",
|
g_param_spec_boolean ("constraints", "Constraints",
|
||||||
@ -456,8 +449,7 @@ GstMpeg2EncOptions::initProperties (GObjectClass *klass)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMpeg2EncOptions::getProperty (guint prop_id,
|
GstMpeg2EncOptions::getProperty (guint prop_id, GValue * value)
|
||||||
GValue *value)
|
|
||||||
{
|
{
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FORMAT:
|
case ARG_FORMAT:
|
||||||
@ -578,8 +570,7 @@ GstMpeg2EncOptions::getProperty (guint prop_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMpeg2EncOptions::setProperty (guint prop_id,
|
GstMpeg2EncOptions::setProperty (guint prop_id, const GValue * value)
|
||||||
const GValue *value)
|
|
||||||
{
|
{
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FORMAT:
|
case ARG_FORMAT:
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad * in_pad,
|
GstMpeg2EncPictureReader::GstMpeg2EncPictureReader (GstPad * in_pad,
|
||||||
const GstCaps *in_caps,
|
const GstCaps * in_caps, EncoderParams * params):
|
||||||
EncoderParams *params) :
|
|
||||||
PictureReader (*params)
|
PictureReader (*params)
|
||||||
{
|
{
|
||||||
pad = in_pad;
|
pad = in_pad;
|
||||||
@ -65,8 +64,7 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
|
|||||||
strm.frame_rate_code = mpeg_framerate_code (mpeg_conform_framerate (fps));
|
strm.frame_rate_code = mpeg_framerate_code (mpeg_conform_framerate (fps));
|
||||||
strm.interlacing_code = Y4M_ILACE_NONE;
|
strm.interlacing_code = Y4M_ILACE_NONE;
|
||||||
strm.aspect_ratio_code = mpeg_guess_mpeg_aspect_code (2, y4m_sar_SQUARE,
|
strm.aspect_ratio_code = mpeg_guess_mpeg_aspect_code (2, y4m_sar_SQUARE,
|
||||||
strm.horizontal_size,
|
strm.horizontal_size, strm.vertical_size);
|
||||||
strm.vertical_size);
|
|
||||||
|
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
* strm.interlacing_code = y4m_si_get_interlace(&si);
|
* strm.interlacing_code = y4m_si_get_interlace(&si);
|
||||||
@ -82,15 +80,24 @@ GstMpeg2EncPictureReader::StreamPictureParams (MPEG2EncInVidParams &strm)
|
|||||||
* Read a frame. Return true means EOS or error.
|
* Read a frame. Return true means EOS or error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool GstMpeg2EncPictureReader::LoadFrame ()
|
||||||
GstMpeg2EncPictureReader::LoadFrame ()
|
|
||||||
{
|
{
|
||||||
GstData *data;
|
GstData *
|
||||||
GstBuffer *buf = NULL;
|
data;
|
||||||
gint i, x, y, n;
|
GstBuffer *
|
||||||
guint8 *frame;
|
buf = NULL;
|
||||||
GstFormat fmt = GST_FORMAT_DEFAULT;
|
gint
|
||||||
gint64 pos = 0, tot = 0;
|
i,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
n;
|
||||||
|
guint8 *
|
||||||
|
frame;
|
||||||
|
GstFormat
|
||||||
|
fmt = GST_FORMAT_DEFAULT;
|
||||||
|
gint64
|
||||||
|
pos = 0, tot = 0;
|
||||||
|
|
||||||
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos);
|
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_POSITION, &fmt, &pos);
|
||||||
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot);
|
gst_pad_query (GST_PAD_PEER (pad), GST_QUERY_TOTAL, &fmt, &tot);
|
||||||
|
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
* Class init stuff.
|
* Class init stuff.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad *in_pad,
|
GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad * in_pad, EncoderParams * params):
|
||||||
EncoderParams *params) :
|
|
||||||
ElemStrmWriter (*params)
|
ElemStrmWriter (*params)
|
||||||
{
|
{
|
||||||
pad = in_pad;
|
pad = in_pad;
|
||||||
@ -44,8 +43,7 @@ GstMpeg2EncStreamWriter::GstMpeg2EncStreamWriter (GstPad *in_pad,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMpeg2EncStreamWriter::PutBits (guint32 val,
|
GstMpeg2EncStreamWriter::PutBits (guint32 val, gint n)
|
||||||
gint n)
|
|
||||||
{
|
{
|
||||||
/* only relevant bits. Note that (according to Andrew),
|
/* only relevant bits. Note that (according to Andrew),
|
||||||
* some CPUs do bitshifts modulo wordsize (32), which
|
* some CPUs do bitshifts modulo wordsize (32), which
|
||||||
|
@ -28,36 +28,25 @@
|
|||||||
#include "gstmplexibitstream.hh"
|
#include "gstmplexibitstream.hh"
|
||||||
#include "gstmplexjob.hh"
|
#include "gstmplexjob.hh"
|
||||||
|
|
||||||
static GstStaticPadTemplate src_templ =
|
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_STATIC_PAD_TEMPLATE (
|
|
||||||
"src",
|
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (
|
GST_STATIC_CAPS ("video/mpeg, " "systemstream = (boolean) true")
|
||||||
"video/mpeg, "
|
|
||||||
"systemstream = (boolean) true"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstStaticPadTemplate video_sink_templ =
|
static GstStaticPadTemplate video_sink_templ =
|
||||||
GST_STATIC_PAD_TEMPLATE (
|
GST_STATIC_PAD_TEMPLATE ("video_%d",
|
||||||
"video_%d",
|
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_REQUEST,
|
GST_PAD_REQUEST,
|
||||||
GST_STATIC_CAPS (
|
GST_STATIC_CAPS ("video/mpeg, "
|
||||||
"video/mpeg, "
|
"mpegversion = (int) [ 1, 2 ], " "systemstream = (boolean) false")
|
||||||
"mpegversion = (int) [ 1, 2 ], "
|
|
||||||
"systemstream = (boolean) false"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstStaticPadTemplate audio_sink_templ =
|
static GstStaticPadTemplate audio_sink_templ =
|
||||||
GST_STATIC_PAD_TEMPLATE (
|
GST_STATIC_PAD_TEMPLATE ("audio_%d",
|
||||||
"audio_%d",
|
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_REQUEST,
|
GST_PAD_REQUEST,
|
||||||
GST_STATIC_CAPS (
|
GST_STATIC_CAPS ("audio/mpeg, "
|
||||||
"audio/mpeg, "
|
|
||||||
"mpegversion = (int) 1, "
|
"mpegversion = (int) 1, "
|
||||||
"layer = (int) [ 1, 2 ]; "
|
"layer = (int) [ 1, 2 ]; "
|
||||||
"audio/x-ac3; "
|
"audio/x-ac3; "
|
||||||
@ -67,9 +56,7 @@ GST_STATIC_PAD_TEMPLATE (
|
|||||||
"signed = (boolean) TRUE, "
|
"signed = (boolean) TRUE, "
|
||||||
"width = (int) { 16, 20, 24 }, "
|
"width = (int) { 16, 20, 24 }, "
|
||||||
"depth = (int) { 16, 20, 24 }, "
|
"depth = (int) { 16, 20, 24 }, "
|
||||||
"rate = (int) { 48000, 96000 }, "
|
"rate = (int) { 48000, 96000 }, " "channels = (int) [ 1, 6 ]")
|
||||||
"channels = (int) [ 1, 6 ]"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* FIXME: subtitles */
|
/* FIXME: subtitles */
|
||||||
@ -82,20 +69,14 @@ static void gst_mplex_dispose (GObject *object);
|
|||||||
static void gst_mplex_loop (GstElement * element);
|
static void gst_mplex_loop (GstElement * element);
|
||||||
|
|
||||||
static GstPad *gst_mplex_request_new_pad (GstElement * element,
|
static GstPad *gst_mplex_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate *templ,
|
GstPadTemplate * templ, const gchar * name);
|
||||||
const gchar *name);
|
|
||||||
|
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn gst_mplex_change_state (GstElement * element);
|
||||||
gst_mplex_change_state (GstElement *element);
|
|
||||||
|
|
||||||
static void gst_mplex_get_property (GObject * object,
|
static void gst_mplex_get_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
static void gst_mplex_set_property (GObject * object,
|
static void gst_mplex_set_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
@ -119,9 +100,7 @@ gst_mplex_get_type (void)
|
|||||||
|
|
||||||
gst_mplex_type =
|
gst_mplex_type =
|
||||||
g_type_register_static (GST_TYPE_ELEMENT,
|
g_type_register_static (GST_TYPE_ELEMENT,
|
||||||
"GstMplex",
|
"GstMplex", &gst_mplex_info, (GTypeFlags) 0);
|
||||||
&gst_mplex_info,
|
|
||||||
(GTypeFlags) 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gst_mplex_type;
|
return gst_mplex_type;
|
||||||
@ -145,8 +124,7 @@ gst_mplex_base_init (GstMplexClass *klass)
|
|||||||
gst_static_pad_template_get (&video_sink_templ));
|
gst_static_pad_template_get (&video_sink_templ));
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&audio_sink_templ));
|
gst_static_pad_template_get (&audio_sink_templ));
|
||||||
gst_element_class_set_details (element_class,
|
gst_element_class_set_details (element_class, &gst_mplex_details);
|
||||||
&gst_mplex_details);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -177,6 +155,7 @@ gst_mplex_dispose (GObject *object)
|
|||||||
|
|
||||||
if (mplex->mux) {
|
if (mplex->mux) {
|
||||||
delete mplex->mux;
|
delete mplex->mux;
|
||||||
|
|
||||||
mplex->mux = NULL;
|
mplex->mux = NULL;
|
||||||
}
|
}
|
||||||
delete mplex->job;
|
delete mplex->job;
|
||||||
@ -189,8 +168,9 @@ gst_mplex_init (GstMplex *mplex)
|
|||||||
|
|
||||||
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
|
GST_FLAG_SET (element, GST_ELEMENT_EVENT_AWARE);
|
||||||
|
|
||||||
mplex->srcpad = gst_pad_new_from_template (
|
mplex->srcpad =
|
||||||
gst_element_get_pad_template (element, "src"), "src");
|
gst_pad_new_from_template (gst_element_get_pad_template (element, "src"),
|
||||||
|
"src");
|
||||||
gst_element_add_pad (element, mplex->srcpad);
|
gst_element_add_pad (element, mplex->srcpad);
|
||||||
|
|
||||||
mplex->job = new GstMplexJob ();
|
mplex->job = new GstMplexJob ();
|
||||||
@ -230,6 +210,7 @@ gst_mplex_loop (GstElement *element)
|
|||||||
/* skip unnegotiated pads */
|
/* skip unnegotiated pads */
|
||||||
if (!(caps = GST_PAD_CAPS (pad))) {
|
if (!(caps = GST_PAD_CAPS (pad))) {
|
||||||
delete inputstream;
|
delete inputstream;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,6 +252,7 @@ gst_mplex_loop (GstElement *element)
|
|||||||
mplex->job->lpcm_tracks++;
|
mplex->job->lpcm_tracks++;
|
||||||
} else {
|
} else {
|
||||||
delete inputstream;
|
delete inputstream;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,8 +275,7 @@ gst_mplex_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
gst_mplex_sink_link (GstPad *pad,
|
gst_mplex_sink_link (GstPad * pad, const GstCaps * caps)
|
||||||
const GstCaps *caps)
|
|
||||||
{
|
{
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||||
const gchar *mime = gst_structure_get_name (structure);
|
const gchar *mime = gst_structure_get_name (structure);
|
||||||
@ -319,8 +300,7 @@ gst_mplex_sink_link (GstPad *pad,
|
|||||||
|
|
||||||
static GstPad *
|
static GstPad *
|
||||||
gst_mplex_request_new_pad (GstElement * element,
|
gst_mplex_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate *templ,
|
GstPadTemplate * templ, const gchar * name)
|
||||||
const gchar *name)
|
|
||||||
{
|
{
|
||||||
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
||||||
GstMplex *mplex = GST_MPLEX (element);
|
GstMplex *mplex = GST_MPLEX (element);
|
||||||
@ -346,18 +326,14 @@ gst_mplex_request_new_pad (GstElement *element,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mplex_get_property (GObject * object,
|
gst_mplex_get_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
{
|
||||||
GST_MPLEX (object)->job->getProperty (prop_id, value);
|
GST_MPLEX (object)->job->getProperty (prop_id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_mplex_set_property (GObject * object,
|
gst_mplex_set_property (GObject * object,
|
||||||
guint prop_id,
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
{
|
||||||
GST_MPLEX (object)->job->setProperty (prop_id, value);
|
GST_MPLEX (object)->job->setProperty (prop_id, value);
|
||||||
}
|
}
|
||||||
@ -390,19 +366,11 @@ plugin_init (GstPlugin *plugin)
|
|||||||
if (!gst_library_load ("gstbytestream"))
|
if (!gst_library_load ("gstbytestream"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return gst_element_register (plugin, "mplex",
|
return gst_element_register (plugin, "mplex", GST_RANK_NONE, GST_TYPE_MPLEX);
|
||||||
GST_RANK_NONE,
|
|
||||||
GST_TYPE_MPLEX);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"mplex",
|
"mplex",
|
||||||
"High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer",
|
"High-quality MPEG/DVD/SVCD/VCD video/audio multiplexer",
|
||||||
plugin_init,
|
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|
||||||
VERSION,
|
|
||||||
"GPL",
|
|
||||||
GST_PACKAGE,
|
|
||||||
GST_ORIGIN
|
|
||||||
)
|
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
* Class init/exit functions.
|
* Class init/exit functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstMplexIBitStream::GstMplexIBitStream (GstPad *_pad,
|
GstMplexIBitStream::GstMplexIBitStream (GstPad * _pad, guint buf_size):
|
||||||
guint buf_size) :
|
|
||||||
IBitStream ()
|
IBitStream ()
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
@ -54,8 +53,7 @@ GstMplexIBitStream::GstMplexIBitStream (GstPad *_pad,
|
|||||||
|
|
||||||
if (!ReadIntoBuffer () && buffered == 0) {
|
if (!ReadIntoBuffer () && buffered == 0) {
|
||||||
GST_ELEMENT_ERROR (gst_pad_get_parent (_pad), RESOURCE, READ, (NULL),
|
GST_ELEMENT_ERROR (gst_pad_get_parent (_pad), RESOURCE, READ, (NULL),
|
||||||
("Failed to read from input pad %s",
|
("Failed to read from input pad %s", gst_pad_get_name (pad)));
|
||||||
gst_pad_get_name (pad)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,19 +66,21 @@ GstMplexIBitStream::~GstMplexIBitStream (void)
|
|||||||
* Read data.
|
* Read data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size_t
|
size_t GstMplexIBitStream::ReadStreamBytes (uint8_t * buf, size_t size)
|
||||||
GstMplexIBitStream::ReadStreamBytes (uint8_t *buf,
|
|
||||||
size_t size)
|
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *
|
||||||
guint read;
|
data;
|
||||||
|
guint
|
||||||
|
read;
|
||||||
|
|
||||||
if (eos)
|
if (eos)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((read = gst_bytestream_peek_bytes (bs, &data, size)) != size) {
|
if ((read = gst_bytestream_peek_bytes (bs, &data, size)) != size) {
|
||||||
GstEvent *event;
|
GstEvent *
|
||||||
guint pending;
|
event;
|
||||||
|
guint
|
||||||
|
pending;
|
||||||
|
|
||||||
gst_bytestream_get_status (bs, &pending, &event);
|
gst_bytestream_get_status (bs, &pending, &event);
|
||||||
if (event) {
|
if (event) {
|
||||||
@ -105,8 +105,7 @@ GstMplexIBitStream::ReadStreamBytes (uint8_t *buf,
|
|||||||
* Are we at EOS?
|
* Are we at EOS?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
bool GstMplexIBitStream::EndOfStream (void)
|
||||||
GstMplexIBitStream::EndOfStream (void)
|
|
||||||
{
|
{
|
||||||
return eos;
|
return eos;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include "gstmplexjob.hh"
|
#include "gstmplexjob.hh"
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_FORMAT,
|
ARG_FORMAT,
|
||||||
ARG_MUX_BITRATE,
|
ARG_MUX_BITRATE,
|
||||||
@ -67,8 +68,7 @@ gst_mplex_format_get_type (void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mplex_format_type =
|
mplex_format_type =
|
||||||
g_enum_register_static ("GstMplexFormat",
|
g_enum_register_static ("GstMplexFormat", mplex_formats);
|
||||||
mplex_formats);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mplex_format_type;
|
return mplex_format_type;
|
||||||
@ -94,8 +94,7 @@ GstMplexJob::initProperties (GObjectClass *klass)
|
|||||||
/* encoding profile */
|
/* encoding profile */
|
||||||
g_object_class_install_property (klass, ARG_FORMAT,
|
g_object_class_install_property (klass, ARG_FORMAT,
|
||||||
g_param_spec_enum ("format", "Format", "Encoding profile format",
|
g_param_spec_enum ("format", "Format", "Encoding profile format",
|
||||||
GST_TYPE_MPLEX_FORMAT, 0,
|
GST_TYPE_MPLEX_FORMAT, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
(GParamFlags) G_PARAM_READWRITE));
|
|
||||||
|
|
||||||
/* total stream datarate. Normally, this shouldn't be needed, but
|
/* total stream datarate. Normally, this shouldn't be needed, but
|
||||||
* some DVD/VCD/SVCD players really need strict values to handle
|
* some DVD/VCD/SVCD players really need strict values to handle
|
||||||
@ -106,9 +105,9 @@ GstMplexJob::initProperties (GObjectClass *klass)
|
|||||||
0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
|
0, 15 * 1024, 0, (GParamFlags) G_PARAM_READWRITE));
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{ "video-buffer", 1, 0, 'b' },
|
{
|
||||||
|
"video-buffer", 1, 0, 'b'},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* some boolean stuff for headers */
|
/* some boolean stuff for headers */
|
||||||
g_object_class_install_property (klass, ARG_VBR,
|
g_object_class_install_property (klass, ARG_VBR,
|
||||||
g_param_spec_boolean ("vbr", "VBR",
|
g_param_spec_boolean ("vbr", "VBR",
|
||||||
@ -148,8 +147,7 @@ GstMplexJob::initProperties (GObjectClass *klass)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMplexJob::getProperty (guint prop_id,
|
GstMplexJob::getProperty (guint prop_id, GValue * value)
|
||||||
GValue *value)
|
|
||||||
{
|
{
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FORMAT:
|
case ARG_FORMAT:
|
||||||
@ -182,8 +180,7 @@ GstMplexJob::getProperty (guint prop_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMplexJob::setProperty (guint prop_id,
|
GstMplexJob::setProperty (guint prop_id, const GValue * value)
|
||||||
const GValue *value)
|
|
||||||
{
|
{
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_FORMAT:
|
case ARG_FORMAT:
|
||||||
|
@ -31,8 +31,7 @@
|
|||||||
* Class init functions.
|
* Class init functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GstMplexOutputStream::GstMplexOutputStream (GstElement *_element,
|
GstMplexOutputStream::GstMplexOutputStream (GstElement * _element, GstPad * _pad):
|
||||||
GstPad *_pad) :
|
|
||||||
OutputStream ()
|
OutputStream ()
|
||||||
{
|
{
|
||||||
element = _element;
|
element = _element;
|
||||||
@ -63,8 +62,7 @@ GstMplexOutputStream::Close (void)
|
|||||||
* Get size of current segment.
|
* Get size of current segment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
off_t
|
off_t GstMplexOutputStream::SegmentSize (void)
|
||||||
GstMplexOutputStream::SegmentSize (void)
|
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@ -88,8 +86,7 @@ GstMplexOutputStream::NextSegment (void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
GstMplexOutputStream::Write (guint8 *data,
|
GstMplexOutputStream::Write (guint8 * data, guint len)
|
||||||
guint len)
|
|
||||||
{
|
{
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
|
@ -48,12 +48,14 @@ GstElementDetails modplug_details = {
|
|||||||
|
|
||||||
|
|
||||||
/* Filter signals and args */
|
/* Filter signals and args */
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
/* FILL ME */
|
/* FILL ME */
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_SONGNAME,
|
ARG_SONGNAME,
|
||||||
ARG_REVERB,
|
ARG_REVERB,
|
||||||
@ -70,36 +72,23 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static GstStaticPadTemplate modplug_src_template_factory =
|
static GstStaticPadTemplate modplug_src_template_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE (
|
GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
"src",
|
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS (
|
GST_STATIC_CAPS ("audio/x-raw-int, " "endianness = (int) BYTE_ORDER, " "signed = (boolean) TRUE, " "width = (int) 16, " "depth = (int) 16, " "rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */
|
||||||
"audio/x-raw-int, "
|
"channels = (int) [ 1, 2 ]; " "audio/x-raw-int, " "signed = (boolean) FALSE, " "width = (int) 8, " "depth = (int) 8, " "rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */
|
||||||
"endianness = (int) BYTE_ORDER, "
|
"channels = (int) [ 1, 2 ]")
|
||||||
"signed = (boolean) TRUE, "
|
|
||||||
"width = (int) 16, "
|
|
||||||
"depth = (int) 16, "
|
|
||||||
"rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */
|
|
||||||
"channels = (int) [ 1, 2 ]; "
|
|
||||||
"audio/x-raw-int, "
|
|
||||||
"signed = (boolean) FALSE, "
|
|
||||||
"width = (int) 8, "
|
|
||||||
"depth = (int) 8, "
|
|
||||||
"rate = (int) { 8000, 11025, 22050, 44100 }, " /* FIXME? */
|
|
||||||
"channels = (int) [ 1, 2 ]"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstStaticPadTemplate modplug_sink_template_factory =
|
static GstStaticPadTemplate modplug_sink_template_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE (
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
"sink",
|
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-mod")
|
GST_STATIC_CAPS ("audio/x-mod")
|
||||||
);
|
);
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
MODPLUG_STATE_NEED_TUNE = 1,
|
MODPLUG_STATE_NEED_TUNE = 1,
|
||||||
MODPLUG_STATE_LOAD_TUNE = 2,
|
MODPLUG_STATE_LOAD_TUNE = 2,
|
||||||
MODPLUG_STATE_PLAY_TUNE = 3,
|
MODPLUG_STATE_PLAY_TUNE = 3,
|
||||||
@ -109,34 +98,26 @@ static void gst_modplug_base_init (GstModPlugClass *klass);
|
|||||||
static void gst_modplug_class_init (GstModPlugClass * klass);
|
static void gst_modplug_class_init (GstModPlugClass * klass);
|
||||||
static void gst_modplug_init (GstModPlug * filter);
|
static void gst_modplug_init (GstModPlug * filter);
|
||||||
static void gst_modplug_set_property (GObject * object,
|
static void gst_modplug_set_property (GObject * object,
|
||||||
guint id,
|
guint id, const GValue * value, GParamSpec * pspec);
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec );
|
|
||||||
static void gst_modplug_get_property (GObject * object,
|
static void gst_modplug_get_property (GObject * object,
|
||||||
guint id,
|
guint id, GValue * value, GParamSpec * pspec);
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec );
|
|
||||||
static GstPadLinkReturn
|
static GstPadLinkReturn
|
||||||
gst_modplug_srclink (GstPad * pad, const GstCaps * caps);
|
gst_modplug_srclink (GstPad * pad, const GstCaps * caps);
|
||||||
static GstCaps *gst_modplug_fixate (GstPad * pad, const GstCaps * caps);
|
static GstCaps *gst_modplug_fixate (GstPad * pad, const GstCaps * caps);
|
||||||
static void gst_modplug_loop (GstElement * element);
|
static void gst_modplug_loop (GstElement * element);
|
||||||
static void gst_modplug_setup (GstModPlug * modplug);
|
static void gst_modplug_setup (GstModPlug * modplug);
|
||||||
static const GstFormat *
|
static const GstFormat *gst_modplug_get_formats (GstPad * pad);
|
||||||
gst_modplug_get_formats (GstPad *pad);
|
static const GstQueryType *gst_modplug_get_query_types (GstPad * pad);
|
||||||
static const GstQueryType *
|
|
||||||
gst_modplug_get_query_types (GstPad *pad);
|
|
||||||
static gboolean gst_modplug_src_event (GstPad * pad, GstEvent * event);
|
static gboolean gst_modplug_src_event (GstPad * pad, GstEvent * event);
|
||||||
static gboolean gst_modplug_src_query (GstPad * pad,
|
static gboolean gst_modplug_src_query (GstPad * pad,
|
||||||
GstQueryType type,
|
GstQueryType type, GstFormat * format, gint64 * value);
|
||||||
GstFormat *format,
|
static GstElementStateReturn gst_modplug_change_state (GstElement * element);
|
||||||
gint64 *value);
|
|
||||||
static GstElementStateReturn
|
|
||||||
gst_modplug_change_state (GstElement *element);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gst_modplug_get_type(void) {
|
gst_modplug_get_type (void)
|
||||||
|
{
|
||||||
static GType modplug_type = 0;
|
static GType modplug_type = 0;
|
||||||
|
|
||||||
if (!modplug_type) {
|
if (!modplug_type) {
|
||||||
@ -152,7 +133,9 @@ gst_modplug_get_type(void) {
|
|||||||
(GInstanceInitFunc) gst_modplug_init,
|
(GInstanceInitFunc) gst_modplug_init,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
modplug_type = g_type_register_static(GST_TYPE_ELEMENT, "GstModPlug", &modplug_info, (GTypeFlags)0);
|
modplug_type =
|
||||||
|
g_type_register_static (GST_TYPE_ELEMENT, "GstModPlug", &modplug_info,
|
||||||
|
(GTypeFlags) 0);
|
||||||
}
|
}
|
||||||
return modplug_type;
|
return modplug_type;
|
||||||
}
|
}
|
||||||
@ -225,8 +208,8 @@ gst_modplug_class_init (GstModPlugClass *klass)
|
|||||||
TRUE, (GParamFlags) G_PARAM_READWRITE));
|
TRUE, (GParamFlags) G_PARAM_READWRITE));
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NOISE_REDUCTION,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NOISE_REDUCTION,
|
||||||
g_param_spec_boolean("noise_reduction", "noise_reduction", "noise_reduction",
|
g_param_spec_boolean ("noise_reduction", "noise_reduction",
|
||||||
TRUE, (GParamFlags)G_PARAM_READWRITE ));
|
"noise_reduction", TRUE, (GParamFlags) G_PARAM_READWRITE));
|
||||||
|
|
||||||
gobject_class->set_property = gst_modplug_set_property;
|
gobject_class->set_property = gst_modplug_set_property;
|
||||||
gobject_class->get_property = gst_modplug_get_property;
|
gobject_class->get_property = gst_modplug_get_property;
|
||||||
@ -237,16 +220,24 @@ gst_modplug_class_init (GstModPlugClass *klass)
|
|||||||
static void
|
static void
|
||||||
gst_modplug_init (GstModPlug * modplug)
|
gst_modplug_init (GstModPlug * modplug)
|
||||||
{
|
{
|
||||||
modplug->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&modplug_sink_template_factory), "sink");
|
modplug->sinkpad =
|
||||||
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
|
(&modplug_sink_template_factory), "sink");
|
||||||
gst_element_add_pad (GST_ELEMENT (modplug), modplug->sinkpad);
|
gst_element_add_pad (GST_ELEMENT (modplug), modplug->sinkpad);
|
||||||
|
|
||||||
modplug->srcpad = gst_pad_new_from_template (gst_static_pad_template_get (&modplug_src_template_factory), "src");
|
modplug->srcpad =
|
||||||
|
gst_pad_new_from_template (gst_static_pad_template_get
|
||||||
|
(&modplug_src_template_factory), "src");
|
||||||
gst_pad_set_link_function (modplug->srcpad, gst_modplug_srclink);
|
gst_pad_set_link_function (modplug->srcpad, gst_modplug_srclink);
|
||||||
gst_pad_set_fixate_function (modplug->srcpad, gst_modplug_fixate);
|
gst_pad_set_fixate_function (modplug->srcpad, gst_modplug_fixate);
|
||||||
gst_pad_set_event_function (modplug->srcpad, (GstPadEventFunction)GST_DEBUG_FUNCPTR(gst_modplug_src_event));
|
gst_pad_set_event_function (modplug->srcpad,
|
||||||
|
(GstPadEventFunction) GST_DEBUG_FUNCPTR (gst_modplug_src_event));
|
||||||
gst_pad_set_query_function (modplug->srcpad, gst_modplug_src_query);
|
gst_pad_set_query_function (modplug->srcpad, gst_modplug_src_query);
|
||||||
gst_pad_set_query_type_function (modplug->srcpad, (GstPadQueryTypeFunction) GST_DEBUG_FUNCPTR (gst_modplug_get_query_types));
|
gst_pad_set_query_type_function (modplug->srcpad,
|
||||||
gst_pad_set_formats_function (modplug->srcpad, (GstPadFormatsFunction)GST_DEBUG_FUNCPTR (gst_modplug_get_formats));
|
(GstPadQueryTypeFunction)
|
||||||
|
GST_DEBUG_FUNCPTR (gst_modplug_get_query_types));
|
||||||
|
gst_pad_set_formats_function (modplug->srcpad,
|
||||||
|
(GstPadFormatsFunction) GST_DEBUG_FUNCPTR (gst_modplug_get_formats));
|
||||||
gst_element_add_pad (GST_ELEMENT (modplug), modplug->srcpad);
|
gst_element_add_pad (GST_ELEMENT (modplug), modplug->srcpad);
|
||||||
|
|
||||||
gst_element_set_loop_function (GST_ELEMENT (modplug), gst_modplug_loop);
|
gst_element_set_loop_function (GST_ELEMENT (modplug), gst_modplug_loop);
|
||||||
@ -277,21 +268,27 @@ static void
|
|||||||
gst_modplug_setup (GstModPlug * modplug)
|
gst_modplug_setup (GstModPlug * modplug)
|
||||||
{
|
{
|
||||||
if (modplug->_16bit)
|
if (modplug->_16bit)
|
||||||
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 16, modplug->channel);
|
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 16,
|
||||||
|
modplug->channel);
|
||||||
else
|
else
|
||||||
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 8, modplug->channel);
|
modplug->mSoundFile->SetWaveConfig (modplug->frequency, 8,
|
||||||
|
modplug->channel);
|
||||||
|
|
||||||
modplug->mSoundFile->SetWaveConfigEx (modplug->surround, !modplug->oversamp, modplug->reverb, true, modplug->megabass, modplug->noise_reduction, true);
|
modplug->mSoundFile->SetWaveConfigEx (modplug->surround, !modplug->oversamp,
|
||||||
|
modplug->reverb, true, modplug->megabass, modplug->noise_reduction, true);
|
||||||
modplug->mSoundFile->SetResamplingMode (SRCMODE_POLYPHASE);
|
modplug->mSoundFile->SetResamplingMode (SRCMODE_POLYPHASE);
|
||||||
|
|
||||||
if (modplug->surround)
|
if (modplug->surround)
|
||||||
modplug->mSoundFile->SetSurroundParameters (modplug->surround_depth, modplug->surround_delay);
|
modplug->mSoundFile->SetSurroundParameters (modplug->surround_depth,
|
||||||
|
modplug->surround_delay);
|
||||||
|
|
||||||
if (modplug->megabass)
|
if (modplug->megabass)
|
||||||
modplug->mSoundFile->SetXBassParameters (modplug->megabass_amount, modplug->megabass_range);
|
modplug->mSoundFile->SetXBassParameters (modplug->megabass_amount,
|
||||||
|
modplug->megabass_range);
|
||||||
|
|
||||||
if (modplug->reverb)
|
if (modplug->reverb)
|
||||||
modplug->mSoundFile->SetReverbParameters (modplug->reverb_depth, modplug->reverb_delay);
|
modplug->mSoundFile->SetReverbParameters (modplug->reverb_depth,
|
||||||
|
modplug->reverb_delay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,7 +347,10 @@ gst_modplug_src_query (GstPad *pad, GstQueryType type,
|
|||||||
case GST_QUERY_POSITION:
|
case GST_QUERY_POSITION:
|
||||||
switch (*format) {
|
switch (*format) {
|
||||||
default:
|
default:
|
||||||
tmp = ((float)( modplug->mSoundFile->GetSongTime() * modplug->mSoundFile->GetCurrentPos() ) / (float)modplug->mSoundFile->GetMaxPosition() );
|
tmp =
|
||||||
|
((float) (modplug->mSoundFile->GetSongTime () *
|
||||||
|
modplug->mSoundFile->GetCurrentPos ()) /
|
||||||
|
(float) modplug->mSoundFile->GetMaxPosition ());
|
||||||
*value = (gint64) (tmp * GST_SECOND);
|
*value = (gint64) (tmp * GST_SECOND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -403,7 +403,9 @@ gst_modplug_get_streaminfo (GstModPlug *modplug)
|
|||||||
|
|
||||||
props = gst_props_empty_new ();
|
props = gst_props_empty_new ();
|
||||||
|
|
||||||
entry = gst_props_entry_new ("Patterns", G_TYPE_INT ((gint)modplug->mSoundFile->GetNumPatterns()));
|
entry =
|
||||||
|
gst_props_entry_new ("Patterns",
|
||||||
|
G_TYPE_INT ((gint) modplug->mSoundFile->GetNumPatterns ()));
|
||||||
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
gst_props_add_entry (props, (GstPropsEntry *) entry);
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("application/x-gst-streaminfo", NULL);
|
caps = gst_caps_new_simple ("application/x-gst-streaminfo", NULL);
|
||||||
@ -435,8 +437,7 @@ gst_modplug_update_metadata (GstModPlug *modplug)
|
|||||||
entry = gst_props_entry_new ("Title", G_TYPE_STRING (title));
|
entry = gst_props_entry_new ("Title", G_TYPE_STRING (title));
|
||||||
gst_props_add_entry (props, entry);
|
gst_props_add_entry (props, entry);
|
||||||
|
|
||||||
modplug->metadata = gst_caps_new_simple ("application/x-gst-metadata",
|
modplug->metadata = gst_caps_new_simple ("application/x-gst-metadata", NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (modplug), "metadata");
|
g_object_notify (G_OBJECT (modplug), "metadata");
|
||||||
}
|
}
|
||||||
@ -525,8 +526,7 @@ gst_modplug_loop (GstElement *element)
|
|||||||
|
|
||||||
modplug = GST_MODPLUG (element);
|
modplug = GST_MODPLUG (element);
|
||||||
|
|
||||||
if (modplug->state == MODPLUG_STATE_NEED_TUNE)
|
if (modplug->state == MODPLUG_STATE_NEED_TUNE) {
|
||||||
{
|
|
||||||
/* GstBuffer *buf;*/
|
/* GstBuffer *buf;*/
|
||||||
|
|
||||||
modplug->seek_at = -1;
|
modplug->seek_at = -1;
|
||||||
@ -562,16 +562,16 @@ gst_modplug_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (modplug->bs)
|
if (modplug->bs) {
|
||||||
{
|
|
||||||
guint64 got;
|
guint64 got;
|
||||||
|
|
||||||
modplug->song_size = gst_bytestream_length (modplug->bs);
|
modplug->song_size = gst_bytestream_length (modplug->bs);
|
||||||
|
|
||||||
got = gst_bytestream_peek_bytes (modplug->bs, &modplug->buffer_in, modplug->song_size);
|
got =
|
||||||
|
gst_bytestream_peek_bytes (modplug->bs, &modplug->buffer_in,
|
||||||
|
modplug->song_size);
|
||||||
|
|
||||||
if ( got < modplug->song_size )
|
if (got < modplug->song_size) {
|
||||||
{
|
|
||||||
gst_modplug_handle_event (modplug);
|
gst_modplug_handle_event (modplug);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -579,8 +579,7 @@ gst_modplug_loop (GstElement *element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modplug->state == MODPLUG_STATE_LOAD_TUNE)
|
if (modplug->state == MODPLUG_STATE_LOAD_TUNE) {
|
||||||
{
|
|
||||||
modplug->mSoundFile = new CSoundFile;
|
modplug->mSoundFile = new CSoundFile;
|
||||||
|
|
||||||
if (!GST_PAD_CAPS (modplug->srcpad) &&
|
if (!GST_PAD_CAPS (modplug->srcpad) &&
|
||||||
@ -603,10 +602,8 @@ gst_modplug_loop (GstElement *element)
|
|||||||
modplug->state = MODPLUG_STATE_PLAY_TUNE;
|
modplug->state = MODPLUG_STATE_PLAY_TUNE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modplug->state == MODPLUG_STATE_PLAY_TUNE && !modplug->eos)
|
if (modplug->state == MODPLUG_STATE_PLAY_TUNE && !modplug->eos) {
|
||||||
{
|
if (modplug->seek_at != -1) {
|
||||||
if (modplug->seek_at != -1)
|
|
||||||
{
|
|
||||||
gint seek_to_pos;
|
gint seek_to_pos;
|
||||||
gint64 total;
|
gint64 total;
|
||||||
gfloat temp;
|
gfloat temp;
|
||||||
@ -621,14 +618,16 @@ gst_modplug_loop (GstElement *element)
|
|||||||
modplug->seek_at = -1;
|
modplug->seek_at = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modplug->need_discont && GST_PAD_IS_USABLE (modplug->srcpad))
|
if (modplug->need_discont && GST_PAD_IS_USABLE (modplug->srcpad)) {
|
||||||
{
|
|
||||||
GstEvent *discont;
|
GstEvent *discont;
|
||||||
gint64 value;
|
gint64 value;
|
||||||
GstFormat format = GST_FORMAT_TIME;
|
GstFormat format = GST_FORMAT_TIME;
|
||||||
|
|
||||||
if (gst_modplug_src_query (modplug->srcpad, GST_QUERY_POSITION, &format, &value)) {
|
if (gst_modplug_src_query (modplug->srcpad, GST_QUERY_POSITION, &format,
|
||||||
discont = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, value, GST_FORMAT_UNDEFINED);
|
&value)) {
|
||||||
|
discont =
|
||||||
|
gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, value,
|
||||||
|
GST_FORMAT_UNDEFINED);
|
||||||
modplug->timestamp = value;
|
modplug->timestamp = value;
|
||||||
} else {
|
} else {
|
||||||
modplug->timestamp = GST_CLOCK_TIME_NONE;
|
modplug->timestamp = GST_CLOCK_TIME_NONE;
|
||||||
@ -638,26 +637,25 @@ gst_modplug_loop (GstElement *element)
|
|||||||
modplug->need_discont = FALSE;
|
modplug->need_discont = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modplug->mSoundFile->Read (modplug->audiobuffer, modplug->length) != 0)
|
if (modplug->mSoundFile->Read (modplug->audiobuffer, modplug->length) != 0) {
|
||||||
{
|
|
||||||
GstBuffer *buffer_out;
|
GstBuffer *buffer_out;
|
||||||
|
|
||||||
buffer_out = gst_buffer_new ();
|
buffer_out = gst_buffer_new ();
|
||||||
GST_BUFFER_DATA (buffer_out) = (guchar *) g_memdup (modplug->audiobuffer, modplug->length);
|
GST_BUFFER_DATA (buffer_out) =
|
||||||
|
(guchar *) g_memdup (modplug->audiobuffer, modplug->length);
|
||||||
GST_BUFFER_SIZE (buffer_out) = modplug->length;
|
GST_BUFFER_SIZE (buffer_out) = modplug->length;
|
||||||
GST_BUFFER_TIMESTAMP (buffer_out) = modplug->timestamp;
|
GST_BUFFER_TIMESTAMP (buffer_out) = modplug->timestamp;
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (modplug->timestamp)) {
|
if (GST_CLOCK_TIME_IS_VALID (modplug->timestamp)) {
|
||||||
GST_BUFFER_DURATION (buffer_out) = modplug->length * GST_SECOND / modplug->frequency / modplug->channel / (modplug->_16bit ? 2 : 1) ;
|
GST_BUFFER_DURATION (buffer_out) =
|
||||||
|
modplug->length * GST_SECOND / modplug->frequency /
|
||||||
|
modplug->channel / (modplug->_16bit ? 2 : 1);
|
||||||
modplug->timestamp += GST_BUFFER_DURATION (buffer_out);
|
modplug->timestamp += GST_BUFFER_DURATION (buffer_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_PAD_IS_USABLE (modplug->srcpad))
|
if (GST_PAD_IS_USABLE (modplug->srcpad))
|
||||||
gst_pad_push (modplug->srcpad, GST_DATA (buffer_out));
|
gst_pad_push (modplug->srcpad, GST_DATA (buffer_out));
|
||||||
}
|
} else if (GST_PAD_IS_LINKED (modplug->srcpad)) {
|
||||||
else
|
|
||||||
if (GST_PAD_IS_LINKED (modplug->srcpad))
|
|
||||||
{
|
|
||||||
/* FIXME, hack, pull final EOS from peer */
|
/* FIXME, hack, pull final EOS from peer */
|
||||||
gst_bytestream_flush (modplug->bs, 1);
|
gst_bytestream_flush (modplug->bs, 1);
|
||||||
|
|
||||||
@ -692,12 +690,12 @@ gst_modplug_change_state (GstElement *element)
|
|||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
gst_bytestream_destroy (modplug->bs);
|
gst_bytestream_destroy (modplug->bs);
|
||||||
modplug->bs = NULL;
|
modplug->bs = NULL;
|
||||||
if (modplug->opened)
|
if (modplug->opened) {
|
||||||
{
|
|
||||||
modplug->mSoundFile->Destroy ();
|
modplug->mSoundFile->Destroy ();
|
||||||
modplug->opened = FALSE;
|
modplug->opened = FALSE;
|
||||||
}
|
}
|
||||||
if (modplug->audiobuffer) g_free (modplug->audiobuffer);
|
if (modplug->audiobuffer)
|
||||||
|
g_free (modplug->audiobuffer);
|
||||||
modplug->buffer_in = NULL;
|
modplug->buffer_in = NULL;
|
||||||
modplug->audiobuffer = NULL;
|
modplug->audiobuffer = NULL;
|
||||||
modplug->state = MODPLUG_STATE_NEED_TUNE;
|
modplug->state = MODPLUG_STATE_NEED_TUNE;
|
||||||
@ -716,7 +714,8 @@ gst_modplug_change_state (GstElement *element)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_modplug_set_property (GObject *object, guint id, const GValue *value, GParamSpec *pspec )
|
gst_modplug_set_property (GObject * object, guint id, const GValue * value,
|
||||||
|
GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstModPlug *modplug;
|
GstModPlug *modplug;
|
||||||
|
|
||||||
@ -761,7 +760,8 @@ gst_modplug_set_property (GObject *object, guint id, const GValue *value, GParam
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_modplug_get_property (GObject *object, guint id, GValue *value, GParamSpec *pspec )
|
gst_modplug_get_property (GObject * object, guint id, GValue * value,
|
||||||
|
GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstModPlug *modplug;
|
GstModPlug *modplug;
|
||||||
|
|
||||||
@ -816,14 +816,8 @@ plugin_init (GstPlugin *plugin)
|
|||||||
GST_RANK_PRIMARY, GST_TYPE_MODPLUG);
|
GST_RANK_PRIMARY, GST_TYPE_MODPLUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
GST_VERSION_MINOR,
|
||||||
"modplug",
|
"modplug",
|
||||||
".MOD audio decoding",
|
".MOD audio decoding",
|
||||||
plugin_init,
|
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN)
|
||||||
VERSION,
|
|
||||||
"LGPL",
|
|
||||||
GST_PACKAGE,
|
|
||||||
GST_ORIGIN
|
|
||||||
)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user