2008-11-13 12:59:34 +00:00
|
|
|
/* GStreamer AAC parser
|
|
|
|
* Copyright (C) 2008 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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2008-11-13 12:59:34 +00:00
|
|
|
*/
|
|
|
|
|
2011-04-07 14:07:15 +00:00
|
|
|
#ifndef __GST_AAC_PARSE_H__
|
|
|
|
#define __GST_AAC_PARSE_H__
|
2008-11-13 12:59:34 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2011-04-07 12:26:41 +00:00
|
|
|
#include <gst/base/gstbaseparse.h>
|
2008-11-13 12:59:34 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-04-07 14:07:15 +00:00
|
|
|
#define GST_TYPE_AAC_PARSE \
|
|
|
|
(gst_aac_parse_get_type())
|
|
|
|
#define GST_AAC_PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AAC_PARSE, GstAacParse))
|
|
|
|
#define GST_AAC_PARSE_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AAC_PARSE, GstAacParseClass))
|
|
|
|
#define GST_IS_AAC_PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AAC_PARSE))
|
|
|
|
#define GST_IS_AAC_PARSE_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AAC_PARSE))
|
2008-11-13 12:59:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstAacHeaderType:
|
|
|
|
* @DSPAAC_HEADER_NOT_PARSED: Header not parsed yet.
|
|
|
|
* @DSPAAC_HEADER_UNKNOWN: Unknown (not recognized) header.
|
|
|
|
* @DSPAAC_HEADER_ADIF: ADIF header found.
|
|
|
|
* @DSPAAC_HEADER_ADTS: ADTS header found.
|
aacparse: parse LOAS variant
The LOAS variant seems to have three different subvariants itself,
only one of them is implemented as my two samples happen to be
using that one.
The sample rate is not always reported correctly, as the "main"
sample rate is apparently sometimes half what it should be (both
of my samples report 24000 Hz there), and there are two other
parts of the subvariant with different sampling rates. One of them
is parsed, but not the other, as it's located after some other
large amount of variable data that needs parsing first, and there
seems to be a LOT of it, which is useless for our needs here.
This ends up being rather inconsequential, as ffdec_aac_latm,
which is the only decoder that can decode such streams, does not
need the sample rate on the caps anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=665394
2011-12-07 13:24:55 +00:00
|
|
|
* @DSPAAC_HEADER_LOAS: LOAS header found.
|
2008-11-13 12:59:34 +00:00
|
|
|
* @DSPAAC_HEADER_NONE: Raw stream, no header.
|
|
|
|
*
|
|
|
|
* Type header enumeration set in #header_type.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
DSPAAC_HEADER_NOT_PARSED,
|
|
|
|
DSPAAC_HEADER_UNKNOWN,
|
|
|
|
DSPAAC_HEADER_ADIF,
|
|
|
|
DSPAAC_HEADER_ADTS,
|
aacparse: parse LOAS variant
The LOAS variant seems to have three different subvariants itself,
only one of them is implemented as my two samples happen to be
using that one.
The sample rate is not always reported correctly, as the "main"
sample rate is apparently sometimes half what it should be (both
of my samples report 24000 Hz there), and there are two other
parts of the subvariant with different sampling rates. One of them
is parsed, but not the other, as it's located after some other
large amount of variable data that needs parsing first, and there
seems to be a LOT of it, which is useless for our needs here.
This ends up being rather inconsequential, as ffdec_aac_latm,
which is the only decoder that can decode such streams, does not
need the sample rate on the caps anyway.
https://bugzilla.gnome.org/show_bug.cgi?id=665394
2011-12-07 13:24:55 +00:00
|
|
|
DSPAAC_HEADER_LOAS,
|
2008-11-13 12:59:34 +00:00
|
|
|
DSPAAC_HEADER_NONE
|
|
|
|
} GstAacHeaderType;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GstAacParse GstAacParse;
|
|
|
|
typedef struct _GstAacParseClass GstAacParseClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstAacParse:
|
|
|
|
*
|
|
|
|
* The opaque GstAacParse data structure.
|
|
|
|
*/
|
|
|
|
struct _GstAacParse {
|
|
|
|
GstBaseParse element;
|
|
|
|
|
|
|
|
/* Stream type -related info */
|
|
|
|
gint object_type;
|
|
|
|
gint bitrate;
|
|
|
|
gint sample_rate;
|
|
|
|
gint channels;
|
|
|
|
gint mpegversion;
|
2011-09-06 13:59:49 +00:00
|
|
|
gint frame_samples;
|
2008-11-13 12:59:34 +00:00
|
|
|
|
|
|
|
GstAacHeaderType header_type;
|
2013-07-15 16:11:45 +00:00
|
|
|
GstAacHeaderType output_header_type;
|
2013-12-16 08:46:16 +00:00
|
|
|
|
|
|
|
gboolean sent_codec_tag;
|
2016-09-05 08:37:02 +00:00
|
|
|
|
|
|
|
gint last_parsed_sample_rate;
|
|
|
|
gint last_parsed_channels;
|
2008-11-13 12:59:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstAacParseClass:
|
|
|
|
* @parent_class: Element parent class.
|
|
|
|
*
|
|
|
|
* The opaque GstAacParseClass data structure.
|
|
|
|
*/
|
|
|
|
struct _GstAacParseClass {
|
|
|
|
GstBaseParseClass parent_class;
|
|
|
|
};
|
|
|
|
|
2011-04-07 14:07:15 +00:00
|
|
|
GType gst_aac_parse_get_type (void);
|
2008-11-13 12:59:34 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2011-04-07 14:07:15 +00:00
|
|
|
#endif /* __GST_AAC_PARSE_H__ */
|