mpegaudioparse: initial version

... adequately equivalent to mp3parse, so lets boldly set it
to higher rank.
This commit is contained in:
Mark Nauwelaerts 2010-09-25 13:59:18 +02:00 committed by Tim-Philipp Müller
parent 2d482deabe
commit dd140c7b4d
4 changed files with 1304 additions and 2 deletions

View file

@ -1,7 +1,7 @@
plugin_LTLIBRARIES = libgstaudioparsersbad.la
libgstaudioparsersbad_la_SOURCES = \
gstaacparse.c gstamrparse.c gstac3parse.c gstflacparse.c \
gstaacparse.c gstamrparse.c gstac3parse.c gstflacparse.c gstmpegaudioparse.c \
gstbaseparse.c plugin.c
libgstaudioparsersbad_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
@ -12,5 +12,5 @@ libgstaudioparsersbad_la_LIBADD = \
libgstaudioparsersbad_la_LDFLAGS = $(PACKAGE_LIBS) $(GST_PLUGIN_LDFLAGS)
libgstaudioparsersbad_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstaacparse.h gstamrparse.h gstac3parse.h gstflacparse.h \
noinst_HEADERS = gstaacparse.h gstamrparse.h gstac3parse.h gstflacparse.h gstmpegaudioparse.h \
gstbaseparse.h

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,104 @@
/* GStreamer MPEG audio parser
* Copyright (C) 2006-2007 Jan Schmidt <thaytan@mad.scientist.com>
* Copyright (C) 2010 Mark Nauwelaerts <mnauw users sf net>
* Copyright (C) 2010 Nokia Corporation. All rights reserved.
* Contact: Stefan Kost <stefan.kost@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MPEG_AUDIO_PARSE_H__
#define __GST_MPEG_AUDIO_PARSE_H__
#include <gst/gst.h>
#include "gstbaseparse.h"
G_BEGIN_DECLS
#define GST_TYPE_MPEG_AUDIO_PARSE \
(gst_mpeg_audio_parse_get_type())
#define GST_MPEG_AUDIO_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_MPEG_AUDIO_PARSE, GstMpegAudioParse))
#define GST_MPEG_AUDIO_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_MPEG_AUDIO_PARSE, GstMpegAudioParseClass))
#define GST_IS_MPEG_AUDIO_PARSE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_MPEG_AUDIO_PARSE))
#define GST_IS_MPEG_AUDIO_PARSE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_MPEG_AUDIO_PARSE))
typedef struct _GstMpegAudioParse GstMpegAudioParse;
typedef struct _GstMpegAudioParseClass GstMpegAudioParseClass;
/**
* GstMpegAudioParse:
*
* The opaque GstMpegAudioParse object
*/
struct _GstMpegAudioParse {
GstBaseParse baseparse;
/*< private >*/
gint rate;
gint channels;
gint layer;
gint version;
GstClockTime max_bitreservoir;
/* samples per frame */
gint spf;
gboolean sent_codec_tag;
guint last_posted_bitrate;
gint last_posted_crc, last_crc;
guint last_posted_channel_mode, last_mode;
/* Xing info */
guint32 xing_flags;
guint32 xing_frames;
GstClockTime xing_total_time;
guint32 xing_bytes;
/* percent -> filepos mapping */
guchar xing_seek_table[100];
/* filepos -> percent mapping */
guint16 xing_seek_table_inverse[256];
guint32 xing_vbr_scale;
guint xing_bitrate;
/* VBRI info */
guint32 vbri_frames;
GstClockTime vbri_total_time;
guint32 vbri_bytes;
guint vbri_bitrate;
guint vbri_seek_points;
guint32 *vbri_seek_table;
gboolean vbri_valid;
};
/**
* GstMpegAudioParseClass:
* @parent_class: Element parent class.
*
* The opaque GstMpegAudioParseClass data structure.
*/
struct _GstMpegAudioParseClass {
GstBaseParseClass baseparse_class;
};
GType gst_mpeg_audio_parse_get_type (void);
G_END_DECLS
#endif /* __GST_MPEG_AUDIO_PARSE_H__ */

View file

@ -25,6 +25,7 @@
#include "gstamrparse.h"
#include "gstac3parse.h"
#include "gstflacparse.h"
#include "gstmpegaudioparse.h"
static gboolean
plugin_init (GstPlugin * plugin)
@ -39,6 +40,8 @@ plugin_init (GstPlugin * plugin)
GST_RANK_PRIMARY + 1, GST_TYPE_AC3_PARSE);
ret &= gst_element_register (plugin, "flacparse",
GST_RANK_PRIMARY + 1, GST_TYPE_FLAC_PARSE);
ret &= gst_element_register (plugin, "mpegaudioparse",
GST_RANK_PRIMARY + 2, GST_TYPE_MPEG_AUDIO_PARSE);
return ret;
}