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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __MP3PARSE_H__
|
|
|
|
#define __MP3PARSE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
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
|
|
|
#include <gst/base/gstadapter.h>
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2005-08-17 19:05:51 +00:00
|
|
|
G_BEGIN_DECLS
|
2001-12-22 23:26:48 +00:00
|
|
|
|
|
|
|
#define GST_TYPE_MP3PARSE \
|
|
|
|
(gst_mp3parse_get_type())
|
|
|
|
#define GST_MP3PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MP3PARSE,GstMPEGAudioParse))
|
|
|
|
#define GST_MP3PARSE_CLASS(klass) \
|
2006-06-01 21:11:41 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MP3PARSE,GstMPEGAudioParseClass))
|
2001-12-22 23:26:48 +00:00
|
|
|
#define GST_IS_MP3PARSE(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MP3PARSE))
|
2006-06-01 21:11:41 +00:00
|
|
|
#define GST_IS_MP3PARSE_CLASS(klass) \
|
2001-12-22 23:26:48 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MP3PARSE))
|
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
typedef struct _GstMPEGAudioParse GstMPEGAudioParse;
|
|
|
|
typedef struct _GstMPEGAudioParseClass GstMPEGAudioParseClass;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
struct _GstMPEGAudioParse {
|
|
|
|
GstElement element;
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/gstmpegaudioparse.*: Implement seeking via average bitrate, and position+duration querying in mp3p...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_reset),
(gst_mp3parse_init), (gst_mp3parse_sink_event),
(gst_mp3parse_emit_frame), (gst_mp3parse_chain),
(gst_mp3parse_change_state), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time), (mp3parse_total_bytes),
(mp3parse_total_time), (mp3parse_handle_seek),
(mp3parse_src_event), (mp3parse_src_query),
(mp3parse_get_query_types), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Implement seeking via average bitrate, and position+duration
querying in mp3parse. Later, it will support frame-accurate seeking by
building a seek table as it parses.
Add 'parsed=false' to the sink pad caps, and 'parsed=true' to the src
pad caps. Bump the priority to PRIMARY+1 so that it is autoplugged
before any extant MP3 decoder plugin. This allows us to remove framing
support from the decoders, if we want, and will provide them with
accurate seeking automatically once it is finished.
Fix the handling of MPEG-1 Layer 1 files.
Partially fix timestamping of packets arriving from a demuxer by
queueing the incoming timestamp until the next packet starts, rather
than applying it immediately to the next pushed buffer.
2007-03-12 10:47:01 +00:00
|
|
|
GstPad *sinkpad, *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
|
|
|
GstClockTime next_ts;
|
gst/mpegaudioparse/gstmpegaudioparse.*: Implement seeking via average bitrate, and position+duration querying in mp3p...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_reset),
(gst_mp3parse_init), (gst_mp3parse_sink_event),
(gst_mp3parse_emit_frame), (gst_mp3parse_chain),
(gst_mp3parse_change_state), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time), (mp3parse_total_bytes),
(mp3parse_total_time), (mp3parse_handle_seek),
(mp3parse_src_event), (mp3parse_src_query),
(mp3parse_get_query_types), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Implement seeking via average bitrate, and position+duration
querying in mp3parse. Later, it will support frame-accurate seeking by
building a seek table as it parses.
Add 'parsed=false' to the sink pad caps, and 'parsed=true' to the src
pad caps. Bump the priority to PRIMARY+1 so that it is autoplugged
before any extant MP3 decoder plugin. This allows us to remove framing
support from the decoders, if we want, and will provide them with
accurate seeking automatically once it is finished.
Fix the handling of MPEG-1 Layer 1 files.
Partially fix timestamping of packets arriving from a demuxer by
queueing the incoming timestamp until the next packet starts, rather
than applying it immediately to the next pushed buffer.
2007-03-12 10:47:01 +00:00
|
|
|
/* Offset as supplied by incoming buffers */
|
|
|
|
gint64 cur_offset;
|
|
|
|
|
|
|
|
/* Upcoming timestamp given on an incoming buffer and
|
|
|
|
* the offset at which it becomes active */
|
|
|
|
GstClockTime pending_ts;
|
|
|
|
gint64 pending_offset;
|
|
|
|
/* Offset since the last newseg */
|
|
|
|
gint64 tracked_offset;
|
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
|
|
|
|
|
|
|
GstAdapter *adapter;
|
2005-09-26 14:31:53 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
guint skip; /* number of frames to skip */
|
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 bit_rate; /* in kbps */
|
2007-05-18 08:42:25 +00:00
|
|
|
gint channels, rate, layer, version;
|
|
|
|
gint spf; /* Samples per 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
|
|
|
|
|
|
|
gboolean resyncing; /* True when attempting to resync (stricter checks are
|
|
|
|
performed) */
|
2007-05-18 08:42:25 +00:00
|
|
|
gboolean sent_codec_tag;
|
gst/mpegaudioparse/gstmpegaudioparse.*: Implement seeking via average bitrate, and position+duration querying in mp3p...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_reset),
(gst_mp3parse_init), (gst_mp3parse_sink_event),
(gst_mp3parse_emit_frame), (gst_mp3parse_chain),
(gst_mp3parse_change_state), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time), (mp3parse_total_bytes),
(mp3parse_total_time), (mp3parse_handle_seek),
(mp3parse_src_event), (mp3parse_src_query),
(mp3parse_get_query_types), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Implement seeking via average bitrate, and position+duration
querying in mp3parse. Later, it will support frame-accurate seeking by
building a seek table as it parses.
Add 'parsed=false' to the sink pad caps, and 'parsed=true' to the src
pad caps. Bump the priority to PRIMARY+1 so that it is autoplugged
before any extant MP3 decoder plugin. This allows us to remove framing
support from the decoders, if we want, and will provide them with
accurate seeking automatically once it is finished.
Fix the handling of MPEG-1 Layer 1 files.
Partially fix timestamping of packets arriving from a demuxer by
queueing the incoming timestamp until the next packet starts, rather
than applying it immediately to the next pushed buffer.
2007-03-12 10:47:01 +00:00
|
|
|
|
|
|
|
/* VBR tracking */
|
|
|
|
guint avg_bitrate;
|
|
|
|
guint64 bitrate_sum;
|
|
|
|
guint frame_count;
|
|
|
|
guint last_posted_bitrate;
|
2007-05-18 08:42:25 +00:00
|
|
|
|
|
|
|
/* Xing info */
|
|
|
|
guint32 xing_flags;
|
|
|
|
guint32 xing_frames;
|
|
|
|
GstClockTime xing_total_time;
|
|
|
|
guint32 xing_bytes;
|
|
|
|
guchar xing_seek_table[100];
|
|
|
|
guint32 xing_vbr_scale;
|
2004-03-15 16:32:53 +00:00
|
|
|
};
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
struct _GstMPEGAudioParseClass {
|
|
|
|
GstElementClass parent_class;
|
|
|
|
};
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
GType gst_mp3parse_get_type(void);
|
2001-12-22 23:26:48 +00:00
|
|
|
|
gst/mpegaudioparse/gstmpegaudioparse.*: Implement seeking via average bitrate, and position+duration querying in mp3p...
Original commit message from CVS:
* gst/mpegaudioparse/gstmpegaudioparse.c:
(mp3_type_frame_length_from_header), (gst_mp3parse_reset),
(gst_mp3parse_init), (gst_mp3parse_sink_event),
(gst_mp3parse_emit_frame), (gst_mp3parse_chain),
(gst_mp3parse_change_state), (mp3parse_time_to_bytepos),
(mp3parse_bytepos_to_time), (mp3parse_total_bytes),
(mp3parse_total_time), (mp3parse_handle_seek),
(mp3parse_src_event), (mp3parse_src_query),
(mp3parse_get_query_types), (plugin_init):
* gst/mpegaudioparse/gstmpegaudioparse.h:
Implement seeking via average bitrate, and position+duration
querying in mp3parse. Later, it will support frame-accurate seeking by
building a seek table as it parses.
Add 'parsed=false' to the sink pad caps, and 'parsed=true' to the src
pad caps. Bump the priority to PRIMARY+1 so that it is autoplugged
before any extant MP3 decoder plugin. This allows us to remove framing
support from the decoders, if we want, and will provide them with
accurate seeking automatically once it is finished.
Fix the handling of MPEG-1 Layer 1 files.
Partially fix timestamping of packets arriving from a demuxer by
queueing the incoming timestamp until the next packet starts, rather
than applying it immediately to the next pushed buffer.
2007-03-12 10:47:01 +00:00
|
|
|
#ifdef __GCC__
|
|
|
|
#define ATTR_UNUSED __attribute__ ((unused)
|
|
|
|
#else
|
|
|
|
#define ATTR_UNUSED
|
|
|
|
#endif
|
|
|
|
|
2005-08-17 19:05:51 +00:00
|
|
|
G_END_DECLS
|
2001-12-22 23:26:48 +00:00
|
|
|
|
2004-03-15 16:32:53 +00:00
|
|
|
#endif /* __MP3PARSE_H__ */
|