summaryrefslogtreecommitdiffstats
path: root/gst/mpegtsmux/tsmux/tsmuxstream.h
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-09-01 16:38:40 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-09-01 16:38:40 +0000
commit845094c32edb03987f54977837db00e66cb40542 (patch)
tree621dacc29a53c2bf32088cdcf1a54bac57c74ef5 /gst/mpegtsmux/tsmux/tsmuxstream.h
parent122498e169b1225ac74be914e60b7ac614bb83e9 (diff)
downloadgst-plugins-bad-845094c32edb03987f54977837db00e66cb40542.tar.gz
gst-plugins-bad-845094c32edb03987f54977837db00e66cb40542.tar.bz2
gst-plugins-bad-845094c32edb03987f54977837db00e66cb40542.zip
Add Fluendo MPEG-TS muxer and libtsmux to gst-plugins-bad. This is renamed to mpegtsmux to prevent conflicts. Also al...
Original commit message from CVS: * configure.ac: * gst/mpegtsmux/Makefile.am: * gst/mpegtsmux/mpegtsmux.c: (mpegtsmux_base_init), (mpegtsmux_class_init), (mpegtsmux_init), (mpegtsmux_dispose), (gst_mpegtsmux_set_property), (gst_mpegtsmux_get_property), (release_buffer_cb), (mpegtsmux_create_stream), (mpegtsmux_create_streams), (mpegtsmux_choose_best_stream), (mpegtsmux_collected), (mpegtsmux_request_new_pad), (mpegtsmux_release_pad), (new_packet_cb), (mpegtsdemux_prepare_srcpad), (mpegtsmux_change_state), (plugin_init): * gst/mpegtsmux/mpegtsmux.h: * gst/mpegtsmux/mpegtsmux_aac.c: (mpegtsmux_prepare_aac): * gst/mpegtsmux/mpegtsmux_aac.h: * gst/mpegtsmux/mpegtsmux_h264.c: (mpegtsmux_prepare_h264): * gst/mpegtsmux/mpegtsmux_h264.h: * gst/mpegtsmux/tsmux/Makefile.am: * gst/mpegtsmux/tsmux/crc.h: * gst/mpegtsmux/tsmux/tsmux.c: (tsmux_new), (tsmux_set_write_func), (tsmux_set_pat_frequency), (tsmux_get_pat_frequency), (tsmux_free), (tsmux_program_new), (tsmux_set_pmt_frequency), (tsmux_get_pmt_frequency), (tsmux_program_add_stream), (tsmux_program_set_pcr_stream), (tsmux_get_new_pid), (tsmux_create_stream), (tsmux_find_stream), (tsmux_packet_out), (tsmux_write_adaptation_field), (tsmux_write_ts_header), (tsmux_write_stream_packet), (tsmux_program_free), (tsmux_write_section), (tsmux_write_section_hdr), (tsmux_write_pat), (tsmux_write_pmt): * gst/mpegtsmux/tsmux/tsmux.h: * gst/mpegtsmux/tsmux/tsmuxcommon.h: * gst/mpegtsmux/tsmux/tsmuxstream.c: (tsmux_stream_new), (tsmux_stream_get_pid), (tsmux_stream_free), (tsmux_stream_set_buffer_release_func), (tsmux_stream_consume), (tsmux_stream_at_pes_start), (tsmux_stream_bytes_avail), (tsmux_stream_bytes_in_buffer), (tsmux_stream_get_data), (tsmux_stream_pes_header_length), (tsmux_stream_find_pts_dts_within), (tsmux_stream_write_pes_header), (tsmux_stream_add_data), (tsmux_stream_get_es_descrs), (tsmux_stream_pcr_ref), (tsmux_stream_pcr_unref), (tsmux_stream_is_pcr), (tsmux_stream_get_pts): * gst/mpegtsmux/tsmux/tsmuxstream.h: Add Fluendo MPEG-TS muxer and libtsmux to gst-plugins-bad. This is renamed to mpegtsmux to prevent conflicts. Also all relevant informations about copyright and license are added to the top of every file but apart from that no changes compared to the latest SVN versions happened.
Diffstat (limited to 'gst/mpegtsmux/tsmux/tsmuxstream.h')
-rw-r--r--gst/mpegtsmux/tsmux/tsmuxstream.h217
1 files changed, 217 insertions, 0 deletions
diff --git a/gst/mpegtsmux/tsmux/tsmuxstream.h b/gst/mpegtsmux/tsmux/tsmuxstream.h
new file mode 100644
index 00000000..9cc049ad
--- /dev/null
+++ b/gst/mpegtsmux/tsmux/tsmuxstream.h
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2006 BBC and Fluendo S.A.
+ *
+ * This library is licensed under 4 different licenses and you
+ * can choose to use it under the terms of any one of them. The
+ * four licenses are the MPL 1.1, the LGPL, the GPL and the MIT
+ * license.
+ *
+ * MPL:
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/.
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * LGPL:
+ *
+ * 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.
+ *
+ * GPL:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * MIT:
+ *
+ * Unless otherwise indicated, Source Code is licensed under MIT license.
+ * See further explanation attached in License Statement (distributed in the file
+ * LICENSE).
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef __TSMUXSTREAM_H__
+#define __TSMUXSTREAM_H__
+
+#include <glib.h>
+
+#include <tsmux/tsmuxcommon.h>
+
+G_BEGIN_DECLS
+
+typedef enum TsMuxStreamType TsMuxStreamType;
+typedef enum TsMuxStreamState TsMuxStreamState;
+typedef struct TsMuxStreamBuffer TsMuxStreamBuffer;
+
+typedef void (*TsMuxStreamBufferReleaseFunc) (guint8 *data, void *user_data);
+
+/* Stream type assignments
+ *
+ * 0x00 ITU-T | ISO/IEC Reserved
+ * 0x01 ISO/IEC 11172 Video
+ * 0x02 ITU-T Rec. H.262 | ISO/IEC 13818-2 Video or
+ * ISO/IEC 11172-2 constrained parameter video
+ * stream
+ * 0x03 ISO/IEC 11172 Audio
+ * 0x04 ISO/IEC 13818-3 Audio
+ * 0x05 ITU-T Rec. H.222.0 | ISO/IEC 13818-1
+ * private_sections
+ * 0x06 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 PES
+ * packets containing private data
+ * 0x07 ISO/IEC 13522 MHEG
+ * 0x08 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A
+ * DSM CC
+ * 0x09 ITU-T Rec. H.222.1
+ * 0x0A ISO/IEC 13818-6 type A
+ * 0x0B ISO/IEC 13818-6 type B
+ * 0x0C ISO/IEC 13818-6 type C
+ * 0x0D ISO/IEC 13818-6 type D
+ * 0x0E ISO/IEC 13818-1 auxiliary
+ * 0x0F-0x7F ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
+ * 0x80-0xFF User Private
+ */
+enum TsMuxStreamType {
+ TSMUX_ST_RESERVED = 0x00,
+ TSMUX_ST_VIDEO_MPEG1 = 0x01,
+ TSMUX_ST_VIDEO_MPEG2 = 0x02,
+ TSMUX_ST_AUDIO_MPEG1 = 0x03,
+ TSMUX_ST_AUDIO_MPEG2 = 0x04,
+ TSMUX_ST_PRIVATE_SECTIONS = 0x05,
+ TSMUX_ST_PRIVATE_DATA = 0x06,
+ TSMUX_ST_MHEG = 0x07,
+ TSMUX_ST_DSMCC = 0x08,
+ TSMUX_ST_H222_1 = 0x09,
+
+ /* later extensions */
+ TSMUX_ST_AUDIO_AAC = 0x0f,
+ TSMUX_ST_VIDEO_MPEG4 = 0x10,
+ TSMUX_ST_VIDEO_H264 = 0x1b,
+
+ /* private stream types */
+ TSMUX_ST_PS_AUDIO_AC3 = 0x81,
+ TSMUX_ST_PS_AUDIO_DTS = 0x8a,
+ TSMUX_ST_PS_AUDIO_LPCM = 0x8b,
+ TSMUX_ST_PS_DVD_SUBPICTURE = 0xff,
+
+ /* Non-standard definitions */
+ TSMUX_ST_VIDEO_DIRAC = 0xD1
+};
+
+enum TsMuxStreamState {
+ TSMUX_STREAM_STATE_HEADER,
+ TSMUX_STREAM_STATE_PACKET
+};
+
+/* TsMuxStream receives elementary streams for parsing.
+ * Via the write_bytes() method, it can output a PES stream piecemeal */
+struct TsMuxStream {
+ TsMuxStreamState state;
+ TsMuxPacketInfo pi;
+ TsMuxStreamType stream_type;
+ guint8 id; /* stream id */
+ guint8 id_extended; /* extended stream id (13818-1 Amdt 2) */
+
+ gboolean is_video_stream;
+
+ /* List of data buffers available for writing out */
+ GList *buffers;
+ guint32 bytes_avail;
+
+ /* Current data buffer being consumed */
+ TsMuxStreamBuffer *cur_buffer;
+ guint32 cur_buffer_consumed;
+
+ TsMuxStreamBufferReleaseFunc buffer_release;
+
+ guint16 pes_payload_size;
+ guint16 cur_pes_payload_size;
+ guint16 pes_bytes_written;
+
+ /* PTS/DTS to write if the flags in the packet info are set */
+ gint64 pts;
+ gint64 dts;
+
+ gint64 last_pts;
+ gint64 last_dts;
+
+ gint pcr_ref;
+ gint64 last_pcr;
+};
+
+/* stream management */
+TsMuxStream * tsmux_stream_new (guint16 pid, TsMuxStreamType stream_type);
+void tsmux_stream_free (TsMuxStream *stream);
+
+guint16 tsmux_stream_get_pid (TsMuxStream *stream);
+
+void tsmux_stream_set_buffer_release_func (TsMuxStream *stream,
+ TsMuxStreamBufferReleaseFunc func);
+
+/* Add a new buffer to the pool of available bytes. If pts or dts are not -1, they
+ * indicate the PTS or DTS of the first access unit within this packet */
+void tsmux_stream_add_data (TsMuxStream *stream, guint8 *data, guint len,
+ void *user_data, gint64 pts, gint64 dts);
+
+void tsmux_stream_pcr_ref (TsMuxStream *stream);
+void tsmux_stream_pcr_unref (TsMuxStream *stream);
+gboolean tsmux_stream_is_pcr (TsMuxStream *stream);
+
+gboolean tsmux_stream_at_pes_start (TsMuxStream *stream);
+void tsmux_stream_get_es_descrs (TsMuxStream *stream, guint8 *buf, guint16 *len);
+
+gint tsmux_stream_bytes_in_buffer (TsMuxStream *stream);
+gint tsmux_stream_bytes_avail (TsMuxStream *stream);
+gboolean tsmux_stream_get_data (TsMuxStream *stream, guint8 *buf, guint len);
+
+guint64 tsmux_stream_get_pts (TsMuxStream *stream);
+
+G_END_DECLS
+
+#endif