2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:26:48 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:09 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-07-27 21:51:28 +00:00
|
|
|
#include "gstmpegaudioparse.h"
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (mp3parse_debug);
|
|
|
|
#define GST_CAT_DEFAULT mp3parse_debug
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/* elementfactory information */
|
|
|
|
static GstElementDetails mp3parse_details = {
|
2002-04-20 21:42:51 +00:00
|
|
|
"MPEG1 Audio Parser",
|
2003-11-16 22:02:04 +00:00
|
|
|
"Codec/Parser/Audio",
|
2002-04-20 21:42:51 +00:00
|
|
|
"Parses and frames mpeg1 audio streams (levels 1-3), provides seek",
|
2003-11-02 21:10:18 +00:00
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>"
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstStaticPadTemplate mp3_src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
2003-12-22 01:47:08 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/mpeg, "
|
2004-03-15 19:32:25 +00:00
|
|
|
"mpegversion = (int) 1, "
|
|
|
|
"layer = (int) [ 1, 3 ], "
|
|
|
|
"rate = (int) [ 8000, 48000], " "channels = (int) [ 1, 2 ]")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate mp3_sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
2003-12-22 01:47:08 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_STATIC_CAPS ("audio/mpeg, " "mpegversion = (int) 1")
|
|
|
|
);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
/* GstMPEGAudioParse signals and args */
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:48 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2001-12-22 23:26:48 +00:00
|
|
|
ARG_0,
|
|
|
|
ARG_SKIP,
|
2004-05-21 22:39:29 +00:00
|
|
|
ARG_BIT_RATE
|
|
|
|
/* FILL ME */
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mp3parse_class_init (GstMPEGAudioParseClass * klass);
|
|
|
|
static void gst_mp3parse_base_init (GstMPEGAudioParseClass * klass);
|
|
|
|
static void gst_mp3parse_init (GstMPEGAudioParse * mp3parse);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2005-09-26 14:31:53 +00:00
|
|
|
static gboolean gst_mp3parse_sink_event (GstPad * pad, GstEvent * event);
|
2005-08-17 19:05:51 +00:00
|
|
|
static GstFlowReturn gst_mp3parse_chain (GstPad * pad, GstBuffer * buffer);
|
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
static int head_check (GstMPEGAudioParse * mp3parse, unsigned long head);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
static void gst_mp3parse_dispose (GObject * object);
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_mp3parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_mp3parse_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn gst_mp3parse_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
static GstElementClass *parent_class = NULL;
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/*static guint gst_mp3parse_signals[LAST_SIGNAL] = { 0 }; */
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
GType
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_get_type (void)
|
|
|
|
{
|
2001-12-22 23:26:48 +00:00
|
|
|
static GType mp3parse_type = 0;
|
|
|
|
|
|
|
|
if (!mp3parse_type) {
|
|
|
|
static const GTypeInfo mp3parse_info = {
|
2004-03-14 22:34:30 +00:00
|
|
|
sizeof (GstMPEGAudioParseClass),
|
|
|
|
(GBaseInitFunc) gst_mp3parse_base_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:30 +00:00
|
|
|
(GClassInitFunc) gst_mp3parse_class_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:30 +00:00
|
|
|
sizeof (GstMPEGAudioParse),
|
2001-12-22 23:26:48 +00:00
|
|
|
0,
|
2004-03-14 22:34:30 +00:00
|
|
|
(GInstanceInitFunc) gst_mp3parse_init,
|
2001-12-22 23:26:48 +00:00
|
|
|
};
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2003-10-01 13:14:51 +00:00
|
|
|
mp3parse_type = g_type_register_static (GST_TYPE_ELEMENT,
|
2004-03-15 19:32:25 +00:00
|
|
|
"GstMPEGAudioParse", &mp3parse_info, 0);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
return mp3parse_type;
|
|
|
|
}
|
|
|
|
|
2006-11-13 17:01:15 +00:00
|
|
|
static guint mp3types_bitrates[2][3][16] = {
|
|
|
|
{
|
|
|
|
{0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448,},
|
|
|
|
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384,},
|
|
|
|
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256,},
|
|
|
|
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,},
|
|
|
|
{0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160,}
|
|
|
|
},
|
2003-10-01 13:14:51 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static guint mp3types_freqs[3][3] = { {44100, 48000, 32000},
|
|
|
|
{22050, 24000, 16000},
|
|
|
|
{11025, 12000, 8000}
|
|
|
|
};
|
2003-10-01 13:14:51 +00:00
|
|
|
|
|
|
|
static inline guint
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header,
|
|
|
|
guint * put_layer, guint * put_channels, guint * put_bitrate,
|
|
|
|
guint * put_samplerate)
|
2003-10-01 13:14:51 +00:00
|
|
|
{
|
|
|
|
guint length;
|
2004-01-30 14:23:18 +00:00
|
|
|
gulong mode, samplerate, bitrate, layer, channels, padding;
|
|
|
|
gint lsf, mpg25;
|
2003-10-01 13:14:51 +00:00
|
|
|
|
2004-01-30 14:23:18 +00:00
|
|
|
if (header & (1 << 20)) {
|
|
|
|
lsf = (header & (1 << 19)) ? 0 : 1;
|
|
|
|
mpg25 = 0;
|
|
|
|
} else {
|
|
|
|
lsf = 1;
|
|
|
|
mpg25 = 1;
|
|
|
|
}
|
2003-10-01 13:14:51 +00:00
|
|
|
|
2004-01-30 14:23:18 +00:00
|
|
|
mode = (header >> 6) & 0x3;
|
2003-10-01 13:14:51 +00:00
|
|
|
channels = (mode == 3) ? 1 : 2;
|
2004-01-30 14:23:18 +00:00
|
|
|
samplerate = (header >> 10) & 0x3;
|
|
|
|
samplerate = mp3types_freqs[lsf + mpg25][samplerate];
|
|
|
|
layer = 4 - ((header >> 17) & 0x3);
|
|
|
|
bitrate = (header >> 12) & 0xF;
|
|
|
|
bitrate = mp3types_bitrates[lsf][layer - 1][bitrate] * 1000;
|
|
|
|
if (bitrate == 0)
|
|
|
|
return 0;
|
|
|
|
padding = (header >> 9) & 0x1;
|
|
|
|
switch (layer) {
|
|
|
|
case 1:
|
|
|
|
length = (bitrate * 12) / samplerate + 4 * padding;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
length = (bitrate * 144) / samplerate + padding;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case 3:
|
|
|
|
length = (bitrate * 144) / (samplerate << lsf) + padding;
|
|
|
|
break;
|
2003-10-01 13:14:51 +00:00
|
|
|
}
|
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "Calculated mp3 frame length of %u bytes",
|
|
|
|
length);
|
|
|
|
GST_DEBUG_OBJECT (mp3parse, "samplerate = %lu, bitrate = %lu, layer = %lu, "
|
|
|
|
"channels = %lu", samplerate, bitrate, layer, channels);
|
2003-10-01 13:14:51 +00:00
|
|
|
|
|
|
|
if (put_layer)
|
|
|
|
*put_layer = layer;
|
|
|
|
if (put_channels)
|
|
|
|
*put_channels = channels;
|
|
|
|
if (put_bitrate)
|
|
|
|
*put_bitrate = bitrate;
|
|
|
|
if (put_samplerate)
|
|
|
|
*put_samplerate = samplerate;
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2004-03-14 22:34:30 +00:00
|
|
|
mp3_caps_create (guint layer, guint channels, guint bitrate, guint samplerate)
|
2003-10-01 13:14:51 +00:00
|
|
|
{
|
|
|
|
GstCaps *new;
|
|
|
|
|
|
|
|
g_assert (layer);
|
|
|
|
g_assert (samplerate);
|
|
|
|
g_assert (bitrate);
|
|
|
|
g_assert (channels);
|
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
new = gst_caps_new_simple ("audio/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, 1,
|
2004-03-14 22:34:30 +00:00
|
|
|
"layer", G_TYPE_INT, layer,
|
|
|
|
"rate", G_TYPE_INT, samplerate, "channels", G_TYPE_INT, channels, NULL);
|
2003-10-01 13:14:51 +00:00
|
|
|
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
2003-11-02 21:10:18 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_base_init (GstMPEGAudioParseClass * klass)
|
2003-11-02 21:10:18 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2003-12-22 01:47:08 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&mp3_sink_template));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&mp3_src_template));
|
2003-11-02 21:10:18 +00:00
|
|
|
gst_element_class_set_details (element_class, &mp3parse_details);
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_class_init (GstMPEGAudioParseClass * klass)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2006-04-08 21:42:19 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_mp3parse_set_property;
|
|
|
|
gobject_class->get_property = gst_mp3parse_get_property;
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
gobject_class->dispose = gst_mp3parse_dispose;
|
2003-07-06 20:49:50 +00:00
|
|
|
|
2005-08-17 19:05:51 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP,
|
|
|
|
g_param_spec_int ("skip", "skip", "skip",
|
|
|
|
G_MININT, G_MAXINT, 0, G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIT_RATE,
|
|
|
|
g_param_spec_int ("bitrate", "Bitrate", "Bit Rate",
|
|
|
|
G_MININT, G_MAXINT, 0, G_PARAM_READABLE));
|
|
|
|
|
2003-07-06 20:49:50 +00:00
|
|
|
gstelement_class->change_state = gst_mp3parse_change_state;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
static void
|
|
|
|
gst_mp3parse_reset (GstMPEGAudioParse * mp3parse)
|
|
|
|
{
|
|
|
|
mp3parse->skip = 0;
|
|
|
|
mp3parse->resyncing = TRUE;
|
2006-11-13 17:01:15 +00:00
|
|
|
mp3parse->next_ts = -1;
|
|
|
|
mp3parse->last_ts = -1;
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
|
|
|
|
gst_adapter_clear (mp3parse->adapter);
|
|
|
|
|
|
|
|
mp3parse->rate = mp3parse->channels = mp3parse->layer = -1;
|
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_init (GstMPEGAudioParse * mp3parse)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
2004-03-14 22:34:30 +00:00
|
|
|
mp3parse->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&mp3_sink_template), "sink");
|
2005-09-26 14:31:53 +00:00
|
|
|
gst_pad_set_event_function (mp3parse->sinkpad, gst_mp3parse_sink_event);
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_pad_set_chain_function (mp3parse->sinkpad, gst_mp3parse_chain);
|
2005-08-17 19:05:51 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mp3parse), mp3parse->sinkpad);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
|
|
|
mp3parse->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&mp3_src_template), "src");
|
2005-08-17 19:05:51 +00:00
|
|
|
gst_pad_use_fixed_caps (mp3parse->srcpad);
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mp3parse), mp3parse->srcpad);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3parse->adapter = gst_adapter_new ();
|
2003-07-06 20:49:50 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
gst_mp3parse_reset (mp3parse);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_mp3parse_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstMPEGAudioParse *mp3parse = GST_MP3PARSE (object);
|
|
|
|
|
|
|
|
if (mp3parse->adapter) {
|
|
|
|
g_object_unref (mp3parse->adapter);
|
|
|
|
mp3parse->adapter = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2005-09-26 14:31:53 +00:00
|
|
|
static gboolean
|
|
|
|
gst_mp3parse_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean res;
|
|
|
|
GstMPEGAudioParse *mp3parse;
|
|
|
|
|
|
|
|
mp3parse = GST_MP3PARSE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
2005-11-22 11:55:32 +00:00
|
|
|
gst_event_parse_new_segment (event, NULL, NULL, &format, NULL, NULL,
|
|
|
|
NULL);
|
2005-09-26 14:31:53 +00:00
|
|
|
|
2006-11-13 17:01:15 +00:00
|
|
|
mp3parse->next_ts = -1;
|
|
|
|
mp3parse->last_ts = -1;
|
2005-09-26 14:31:53 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
res = gst_pad_push_event (mp3parse->srcpad, event);
|
|
|
|
|
|
|
|
gst_object_unref (mp3parse);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-08-17 19:05:51 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_mp3parse_chain (GstPad * pad, GstBuffer * buf)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
2007-02-09 16:24:45 +00:00
|
|
|
GstFlowReturn flow = GST_FLOW_OK;
|
2001-12-22 23:26:48 +00:00
|
|
|
GstMPEGAudioParse *mp3parse;
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
const guchar *data;
|
2003-04-07 18:43:25 +00:00
|
|
|
guint32 header;
|
2001-12-22 23:26:48 +00:00
|
|
|
int bpf;
|
|
|
|
GstBuffer *outbuf;
|
2005-09-26 14:31:53 +00:00
|
|
|
GstClockTime timestamp;
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
guint available;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2007-02-09 16:24:45 +00:00
|
|
|
mp3parse = GST_MP3PARSE (GST_PAD_PARENT (pad));
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2007-02-09 16:24:45 +00:00
|
|
|
GST_LOG_OBJECT (mp3parse, "buffer of %d bytes", GST_BUFFER_SIZE (buf));
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2005-09-26 14:31:53 +00:00
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2006-11-13 17:01:15 +00:00
|
|
|
/* If we don't yet have a next timestamp, and this is valid, use it */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (mp3parse->next_ts) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (timestamp))
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3parse->next_ts = timestamp;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
gst_adapter_push (mp3parse->adapter, buf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
/* while we still have at least 4 bytes (for the header) available */
|
|
|
|
while (gst_adapter_available (mp3parse->adapter) >= 4) {
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/* search for a possible start byte */
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
data = gst_adapter_peek (mp3parse->adapter, 4);
|
|
|
|
if (*data != 0xff) {
|
|
|
|
/* It'd be nice to make this efficient, but it's ok for now; this is only
|
|
|
|
* when resyncing
|
|
|
|
*/
|
|
|
|
mp3parse->resyncing = TRUE;
|
|
|
|
gst_adapter_flush (mp3parse->adapter, 1);
|
|
|
|
continue;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
|
|
|
|
available = gst_adapter_available (mp3parse->adapter);
|
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/* construct the header word */
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
header = GST_READ_UINT32_BE (data);
|
2002-03-19 04:10:05 +00:00
|
|
|
/* if it's a valid header, go ahead and send off the frame */
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
if (head_check (mp3parse, header)) {
|
2005-08-17 19:05:51 +00:00
|
|
|
guint bitrate = 0, layer = 0, rate = 0, channels = 0;
|
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
if (!(bpf = mp3_type_frame_length_from_header (mp3parse, header, &layer,
|
2005-08-17 19:05:51 +00:00
|
|
|
&channels, &bitrate, &rate))) {
|
|
|
|
g_error ("Header failed internal error");
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
/*************************************************************************
|
2001-12-22 23:26:48 +00:00
|
|
|
* robust seek support
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
* - This performs additional frame validation if the resyncing flag is set
|
2001-12-22 23:26:48 +00:00
|
|
|
* (indicating a discontinuous stream).
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
* - The current frame header is not accepted as valid unless the NEXT
|
|
|
|
* frame header has the same values for most fields. This significantly
|
|
|
|
* increases the probability that we aren't processing random data.
|
2001-12-22 23:26:48 +00:00
|
|
|
* - It is not clear if this is sufficient for robust seeking of Layer III
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
* streams which utilize the concept of a "bit reservoir" by borrowing
|
|
|
|
* bitrate from previous frames. In this case, seeking may be more
|
|
|
|
* complicated because the frames are not independently coded.
|
|
|
|
*************************************************************************/
|
|
|
|
if (mp3parse->resyncing) {
|
2004-03-15 19:32:25 +00:00
|
|
|
guint32 header2;
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
const guint8 *data2;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
/* wait until we have the the entire current frame as well as the next
|
|
|
|
* frame header */
|
|
|
|
if (available < bpf + 4)
|
|
|
|
break;
|
|
|
|
|
|
|
|
data2 = gst_adapter_peek (mp3parse->adapter, bpf + 4);
|
|
|
|
header2 = GST_READ_UINT32_BE (data2 + bpf);
|
|
|
|
GST_DEBUG_OBJECT (mp3parse, "header=%08X, header2=%08X, bpf=%d",
|
2004-03-15 19:32:25 +00:00
|
|
|
(unsigned int) header, (unsigned int) header2, bpf);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2003-10-01 13:14:51 +00:00
|
|
|
/* mask the bits which are allowed to differ between frames */
|
|
|
|
#define HDRMASK ~((0xF << 12) /* bitrate */ | \
|
2005-12-06 19:48:07 +00:00
|
|
|
(0x1 << 9) /* padding */ | \
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
(0x3 << 4)) /* mode extension */
|
2004-03-14 22:34:30 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
/* require 2 matching headers in a row */
|
|
|
|
if ((header2 & HDRMASK) != (header & HDRMASK)) {
|
|
|
|
GST_DEBUG_OBJECT (mp3parse, "next header doesn't match "
|
|
|
|
"(header=%08X, header2=%08X, bpf=%d)",
|
2004-03-15 19:32:25 +00:00
|
|
|
(unsigned int) header, (unsigned int) header2, bpf);
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
/* This frame is invalid. Start looking for a valid frame at the
|
|
|
|
* next position in the stream */
|
|
|
|
mp3parse->resyncing = TRUE;
|
|
|
|
gst_adapter_flush (mp3parse->adapter, 1);
|
2004-03-15 19:32:25 +00:00
|
|
|
continue;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2002-03-19 04:10:05 +00:00
|
|
|
/* if we don't have the whole frame... */
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
if (available < bpf) {
|
|
|
|
GST_DEBUG_OBJECT (mp3parse, "insufficient data available, need "
|
|
|
|
"%d bytes, have %d", bpf, available);
|
2004-03-15 19:32:25 +00:00
|
|
|
break;
|
2001-12-22 23:26:48 +00:00
|
|
|
} else {
|
2004-03-15 19:32:25 +00:00
|
|
|
if (channels != mp3parse->channels ||
|
|
|
|
rate != mp3parse->rate ||
|
|
|
|
layer != mp3parse->layer || bitrate != mp3parse->bit_rate) {
|
2005-09-26 14:31:53 +00:00
|
|
|
GstCaps *caps;
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2005-09-26 14:31:53 +00:00
|
|
|
caps = mp3_caps_create (layer, channels, bitrate, rate);
|
2005-08-17 19:05:51 +00:00
|
|
|
gst_pad_set_caps (mp3parse->srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
2004-03-15 19:32:25 +00:00
|
|
|
|
|
|
|
mp3parse->channels = channels;
|
|
|
|
mp3parse->layer = layer;
|
|
|
|
mp3parse->rate = rate;
|
|
|
|
mp3parse->bit_rate = bitrate;
|
|
|
|
}
|
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
outbuf = gst_adapter_take_buffer (mp3parse->adapter, bpf);
|
|
|
|
|
|
|
|
if (!mp3parse->skip) {
|
|
|
|
gint spf; /* samples per frame */
|
2004-03-15 19:32:25 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3parse->resyncing = FALSE;
|
2005-09-26 14:31:53 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "pushing buffer of %d bytes",
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_BUFFER_SIZE (outbuf));
|
2005-08-17 19:05:51 +00:00
|
|
|
|
2005-09-26 14:31:53 +00:00
|
|
|
/* see http://www.codeproject.com/audio/MPEGAudioInfo.asp */
|
|
|
|
if (mp3parse->layer == 1)
|
|
|
|
spf = 384;
|
|
|
|
else if (mp3parse->layer == 2)
|
|
|
|
spf = 1152;
|
|
|
|
else {
|
2006-12-29 14:51:19 +00:00
|
|
|
/* Any sample_rate < 32000 indicates MPEG-2 or MPEG-2.5 */
|
|
|
|
if (mp3parse->rate < 32000)
|
2005-09-26 14:31:53 +00:00
|
|
|
spf = 576;
|
|
|
|
else
|
|
|
|
spf = 1152;
|
2004-12-06 19:32:33 +00:00
|
|
|
}
|
2006-12-29 14:51:19 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
|
|
|
gst_util_uint64_scale (GST_SECOND, spf, mp3parse->rate);
|
2005-09-26 14:31:53 +00:00
|
|
|
|
2006-11-13 17:01:15 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (mp3parse->next_ts)) {
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = mp3parse->next_ts;
|
|
|
|
mp3parse->next_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
} else if (GST_CLOCK_TIME_IS_VALID (mp3parse->last_ts)) {
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = mp3parse->last_ts +
|
|
|
|
GST_BUFFER_DURATION (outbuf);
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
mp3parse->last_ts = GST_BUFFER_TIMESTAMP (outbuf);
|
2004-03-15 19:32:25 +00:00
|
|
|
|
2005-09-26 14:41:23 +00:00
|
|
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mp3parse->srcpad));
|
2005-08-17 19:05:51 +00:00
|
|
|
|
2007-02-09 16:24:45 +00:00
|
|
|
flow = gst_pad_push (mp3parse->srcpad, outbuf);
|
2005-08-17 19:05:51 +00:00
|
|
|
|
2004-03-15 19:32:25 +00:00
|
|
|
} else {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "skipping buffer of %d bytes",
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_BUFFER_SIZE (outbuf));
|
|
|
|
gst_buffer_unref (outbuf);
|
|
|
|
mp3parse->skip--;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
} else {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3parse->resyncing = TRUE;
|
|
|
|
gst_adapter_flush (mp3parse->adapter, 1);
|
|
|
|
GST_DEBUG_OBJECT (mp3parse, "wrong header, skipping byte");
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2007-02-09 16:24:45 +00:00
|
|
|
if (GST_FLOW_IS_FATAL (flow))
|
|
|
|
break;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2007-02-09 16:24:45 +00:00
|
|
|
return flow;
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
head_check (GstMPEGAudioParse * mp3parse, unsigned long head)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "checking mp3 header 0x%08lx", head);
|
2001-12-22 23:26:48 +00:00
|
|
|
/* if it's not a valid sync */
|
|
|
|
if ((head & 0xffe00000) != 0xffe00000) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid sync");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
/* if it's an invalid MPEG version */
|
|
|
|
if (((head >> 19) & 3) == 0x1) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid MPEG version");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
/* if it's an invalid layer */
|
|
|
|
if (!((head >> 17) & 3)) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid layer");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
/* if it's an invalid bitrate */
|
|
|
|
if (((head >> 12) & 0xf) == 0x0) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid bitrate");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
if (((head >> 12) & 0xf) == 0xf) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid bitrate");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
/* if it's an invalid samplerate */
|
|
|
|
if (((head >> 10) & 0x3) == 0x3) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid samplerate");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if ((head & 0xffff0000) == 0xfffe0000) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid sync");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
if (head & 0x00000002) {
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_OBJECT (mp3parse, "invalid emphasis");
|
2004-03-14 22:34:30 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGAudioParse *src;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
g_return_if_fail (GST_IS_MP3PARSE (object));
|
|
|
|
src = GST_MP3PARSE (object);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_SKIP:
|
|
|
|
src->skip = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_mp3parse_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
|
|
|
GstMPEGAudioParse *src;
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
g_return_if_fail (GST_IS_MP3PARSE (object));
|
|
|
|
src = GST_MP3PARSE (object);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_SKIP:
|
|
|
|
g_value_set_int (value, src->skip);
|
|
|
|
break;
|
|
|
|
case ARG_BIT_RATE:
|
|
|
|
g_value_set_int (value, src->bit_rate * 1000);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_mp3parse_change_state (GstElement * element, GstStateChange transition)
|
2003-07-06 20:49:50 +00:00
|
|
|
{
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GstMPEGAudioParse *mp3parse;
|
2005-09-02 15:43:54 +00:00
|
|
|
GstStateChangeReturn result;
|
2003-07-06 20:49:50 +00:00
|
|
|
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
mp3parse = GST_MP3PARSE (element);
|
|
|
|
|
|
|
|
result = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2003-07-06 20:49:50 +00:00
|
|
|
|
2005-09-02 15:43:54 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
gst_mp3parse_reset (mp3parse);
|
2003-07-06 20:49:50 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-17 19:05:51 +00:00
|
|
|
return result;
|
2003-07-06 20:49:50 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:26:48 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:30 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:26:48 +00:00
|
|
|
{
|
gst/mpegaudioparse/: Bring mp3parse into the 21st century.
Original commit message from CVS:
* gst/mpegaudioparse/Makefile.am:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_class_init),
(gst_mp3parse_reset), (gst_mp3parse_init), (gst_mp3parse_dispose),
(gst_mp3parse_sink_event), (gst_mp3parse_chain), (head_check),
(gst_mp3parse_change_state), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Bring mp3parse into the 21st century.
Use its own debug category, use gstadapter, format nicely to 80
columns, and fix incorrect handling of 32 kHz and less files.
2006-11-13 16:23:22 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (mp3parse_debug, "mp3parse", 0, "MP3 Parser");
|
|
|
|
|
2003-11-02 21:10:18 +00:00
|
|
|
return gst_element_register (plugin, "mp3parse",
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_RANK_NONE, GST_TYPE_MP3PARSE);
|
2001-12-22 23:26:48 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"mpegaudioparse",
|
|
|
|
"MPEG-1 layer 1/2/3 audio parser",
|
2006-04-01 09:54:39 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|