mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
mpegdemux: remove unused TS demuxer bits that have moved to tsdemux
This commit is contained in:
parent
20507bc0cf
commit
61bad24f81
18 changed files with 4 additions and 9768 deletions
|
@ -4,14 +4,6 @@ libgstmpegdemux_la_SOURCES = \
|
|||
flumpegdemux.c \
|
||||
gstmpegdemux.c \
|
||||
gstpesfilter.c
|
||||
# flutspatinfo.c
|
||||
# flutspmtinfo.c
|
||||
# flutspmtstreaminfo.c
|
||||
# gstmpegdesc.c \
|
||||
# gstmpegtsdemux.c \
|
||||
# gstsectionfilter.c \
|
||||
# mpegtsparse.c \
|
||||
# mpegtspacketizer.c
|
||||
|
||||
libgstmpegdemux_la_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
||||
|
@ -24,16 +16,8 @@ libgstmpegdemux_la_LIBTOOLFLAGS = --tag=disable-static
|
|||
|
||||
noinst_HEADERS = \
|
||||
gstmpegdefs.h \
|
||||
gstmpegdesc.h \
|
||||
gstmpegdemux.h \
|
||||
gstpesfilter.h \
|
||||
gstmpegtsdemux.h \
|
||||
flutspatinfo.h \
|
||||
flutspmtinfo.h \
|
||||
flutspmtstreaminfo.h \
|
||||
gstsectionfilter.h \
|
||||
mpegtspacketizer.h \
|
||||
mpegtsparse.h
|
||||
gstpesfilter.h
|
||||
|
||||
Android.mk: Makefile.am $(BUILT_SOURCES)
|
||||
androgenizer \
|
||||
|
|
|
@ -46,31 +46,18 @@
|
|||
#endif
|
||||
|
||||
#include "gstmpegdemux.h"
|
||||
#include "gstmpegtsdemux.h"
|
||||
#include "mpegtsparse.h"
|
||||
#include "mpegtspacketizer.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gstflupesfilter_debug);
|
||||
#if 0
|
||||
GST_DEBUG_CATEGORY_EXTERN (gstflusectionfilter_debug);
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT (gstflupesfilter_debug, "mpegpesfilter", 0,
|
||||
"MPEG-TS/PS PES filter output");
|
||||
#if 0
|
||||
GST_DEBUG_CATEGORY_INIT (gstflusectionfilter_debug, "mpegsectionfilter", 0,
|
||||
"MPEG-TS Section filter output");
|
||||
#endif
|
||||
|
||||
if (!gst_flups_demux_plugin_init (plugin))
|
||||
return FALSE;
|
||||
#if 0
|
||||
if (!gst_mpegts_demux_plugin_init (plugin))
|
||||
return FALSE;
|
||||
if (!gst_mpegtsparse_plugin_init (plugin))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "flutspatinfo.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PROGRAM_NO,
|
||||
PROP_PID
|
||||
};
|
||||
|
||||
static void mpegts_pat_info_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
static void mpegts_pat_info_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec);
|
||||
|
||||
GST_BOILERPLATE (MpegTsPatInfo, mpegts_pat_info, GObject, G_TYPE_OBJECT);
|
||||
|
||||
MpegTsPatInfo *
|
||||
mpegts_pat_info_new (guint16 program_no, guint16 pid)
|
||||
{
|
||||
MpegTsPatInfo *info;
|
||||
|
||||
info = g_object_new (MPEGTS_TYPE_PAT_INFO, NULL);
|
||||
|
||||
info->program_no = program_no;
|
||||
info->pid = pid;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pat_info_base_init (gpointer klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pat_info_class_init (MpegTsPatInfoClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_klass = (GObjectClass *) klass;
|
||||
|
||||
gobject_klass->set_property = mpegts_pat_info_set_property;
|
||||
gobject_klass->get_property = mpegts_pat_info_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_PROGRAM_NO,
|
||||
g_param_spec_uint ("program-number", "Program Number",
|
||||
"Program Number for this program", 0, G_MAXUINT16, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_PID,
|
||||
g_param_spec_uint ("pid", "PID carrying PMT",
|
||||
"PID which carries the PMT for this program", 1, G_MAXUINT16, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pat_info_init (MpegTsPatInfo * pat_info, MpegTsPatInfoClass * klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pat_info_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec)
|
||||
{
|
||||
g_return_if_fail (MPEGTS_IS_PAT_INFO (object));
|
||||
|
||||
/* No settable properties */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pat_info_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec)
|
||||
{
|
||||
MpegTsPatInfo *pat_info;
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PAT_INFO (object));
|
||||
|
||||
pat_info = MPEGTS_PAT_INFO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PROGRAM_NO:
|
||||
g_value_set_uint (value, pat_info->program_no);
|
||||
break;
|
||||
case PROP_PID:
|
||||
g_value_set_uint (value, pat_info->pid);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef __FLUTS_PAT_INFO_H__
|
||||
#define __FLUTS_PAT_INFO_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct FluTsPatInfoClass {
|
||||
GObjectClass parent_class;
|
||||
} MpegTsPatInfoClass;
|
||||
|
||||
typedef struct FluTsPatInfo {
|
||||
GObject parent;
|
||||
|
||||
guint16 pid;
|
||||
guint16 program_no;
|
||||
} MpegTsPatInfo;
|
||||
|
||||
#define MPEGTS_TYPE_PAT_INFO (mpegts_pat_info_get_type ())
|
||||
#define MPEGTS_IS_PAT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MPEGTS_TYPE_PAT_INFO))
|
||||
#define MPEGTS_PAT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MPEGTS_TYPE_PAT_INFO, MpegTsPatInfo))
|
||||
|
||||
GType mpegts_pat_info_get_type (void);
|
||||
|
||||
MpegTsPatInfo *mpegts_pat_info_new (guint16 program_no, guint16 pid);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
|
@ -1,227 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
|
||||
* with newer GLib versions (>= 2.31.0) */
|
||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "flutspmtinfo.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PROGRAM_NO,
|
||||
PROP_VERSION_NO,
|
||||
PROP_PCR_PID,
|
||||
PROP_DESCRIPTORS,
|
||||
PROP_STREAMINFO
|
||||
};
|
||||
|
||||
GST_BOILERPLATE (MpegTsPmtInfo, mpegts_pmt_info, GObject, G_TYPE_OBJECT);
|
||||
|
||||
static void mpegts_pmt_info_finalize (GObject * object);
|
||||
static void mpegts_pmt_info_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
static void mpegts_pmt_info_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec);
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_base_init (gpointer klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_class_init (MpegTsPmtInfoClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_klass = (GObjectClass *) klass;
|
||||
|
||||
gobject_klass->finalize = mpegts_pmt_info_finalize;
|
||||
gobject_klass->set_property = mpegts_pmt_info_set_property;
|
||||
gobject_klass->get_property = mpegts_pmt_info_get_property;
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_PROGRAM_NO,
|
||||
g_param_spec_uint ("program-number", "Program Number",
|
||||
"Program Number for this program", 0, G_MAXUINT16, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_PCR_PID,
|
||||
g_param_spec_uint ("pcr-pid", "PID carrying the PCR for this program",
|
||||
"PID which carries the PCR for this program", 1, G_MAXUINT16, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_STREAMINFO,
|
||||
g_param_spec_value_array ("stream-info",
|
||||
"GValueArray containing GObjects with properties",
|
||||
"Array of GObjects containing information about the program streams",
|
||||
g_param_spec_object ("flu-pmt-streaminfo", "FluPMTStreamInfo",
|
||||
"Fluendo TS Demuxer PMT Stream info object",
|
||||
MPEGTS_TYPE_PMT_STREAM_INFO,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_VERSION_NO,
|
||||
g_param_spec_uint ("version-number", "Version Number",
|
||||
"Version number of this program information", 0, G_MAXUINT8, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_DESCRIPTORS,
|
||||
g_param_spec_value_array ("descriptors",
|
||||
"Descriptors",
|
||||
"Value array of strings containing program descriptors",
|
||||
g_param_spec_boxed ("descriptor",
|
||||
"descriptor",
|
||||
"", G_TYPE_GSTRING, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_init (MpegTsPmtInfo * pmt_info, MpegTsPmtInfoClass * klass)
|
||||
{
|
||||
pmt_info->streams = g_value_array_new (0);
|
||||
pmt_info->descriptors = g_value_array_new (0);
|
||||
}
|
||||
|
||||
MpegTsPmtInfo *
|
||||
mpegts_pmt_info_new (guint16 program_no, guint16 pcr_pid, guint8 version_no)
|
||||
{
|
||||
MpegTsPmtInfo *info;
|
||||
|
||||
info = g_object_new (MPEGTS_TYPE_PMT_INFO, NULL);
|
||||
|
||||
info->program_no = program_no;
|
||||
info->pcr_pid = pcr_pid;
|
||||
info->version_no = version_no;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_finalize (GObject * object)
|
||||
{
|
||||
MpegTsPmtInfo *info = MPEGTS_PMT_INFO (object);
|
||||
|
||||
g_value_array_free (info->streams);
|
||||
g_value_array_free (info->descriptors);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec)
|
||||
{
|
||||
g_return_if_fail (MPEGTS_IS_PMT_INFO (object));
|
||||
|
||||
/* No settable properties */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_info_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec)
|
||||
{
|
||||
MpegTsPmtInfo *pmt_info;
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_INFO (object));
|
||||
|
||||
pmt_info = MPEGTS_PMT_INFO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PROGRAM_NO:
|
||||
g_value_set_uint (value, pmt_info->program_no);
|
||||
break;
|
||||
case PROP_PCR_PID:
|
||||
g_value_set_uint (value, pmt_info->pcr_pid);
|
||||
break;
|
||||
case PROP_STREAMINFO:
|
||||
g_value_set_boxed (value, pmt_info->streams);
|
||||
break;
|
||||
case PROP_VERSION_NO:
|
||||
g_value_set_uint (value, pmt_info->version_no);
|
||||
break;
|
||||
case PROP_DESCRIPTORS:
|
||||
g_value_set_boxed (value, pmt_info->descriptors);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_pmt_info_add_descriptor (MpegTsPmtInfo * pmt_info,
|
||||
const gchar * descriptor, guint length)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
GString *string;
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_INFO (pmt_info));
|
||||
|
||||
string = g_string_new_len (descriptor, length);
|
||||
|
||||
g_value_init (&value, G_TYPE_GSTRING);
|
||||
g_value_take_boxed (&value, string);
|
||||
g_value_array_append (pmt_info->descriptors, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_pmt_info_add_stream (MpegTsPmtInfo * pmt_info,
|
||||
MpegTsPmtStreamInfo * stream)
|
||||
{
|
||||
GValue v = { 0, };
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_INFO (pmt_info));
|
||||
g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (stream));
|
||||
|
||||
g_value_init (&v, G_TYPE_OBJECT);
|
||||
g_value_take_object (&v, stream);
|
||||
g_value_array_append (pmt_info->streams, &v);
|
||||
g_value_unset (&v);
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef __FLUTS_PMT_INFO_H__
|
||||
#define __FLUTS_PMT_INFO_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "flutspmtstreaminfo.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct MpegTsPmtInfoClass {
|
||||
GObjectClass parent_class;
|
||||
} MpegTsPmtInfoClass;
|
||||
|
||||
typedef struct MpegTsPmtInfo {
|
||||
GObject parent;
|
||||
|
||||
guint16 program_no;
|
||||
guint16 pcr_pid;
|
||||
|
||||
guint8 version_no;
|
||||
|
||||
GValueArray *descriptors;
|
||||
GValueArray *streams;
|
||||
} MpegTsPmtInfo;
|
||||
|
||||
MpegTsPmtInfo *mpegts_pmt_info_new (guint16 program_no, guint16 pcr_pid, guint8 version);
|
||||
void mpegts_pmt_info_add_stream (MpegTsPmtInfo *pmt_info, MpegTsPmtStreamInfo *stream);
|
||||
void mpegts_pmt_info_add_descriptor (MpegTsPmtInfo *pmt_info,
|
||||
const gchar *descriptor, guint length);
|
||||
|
||||
GType mpegts_pmt_info_get_type (void);
|
||||
|
||||
#define MPEGTS_TYPE_PMT_INFO (mpegts_pmt_info_get_type ())
|
||||
#define MPEGTS_IS_PMT_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MPEGTS_TYPE_PMT_INFO))
|
||||
#define MPEGTS_PMT_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MPEGTS_TYPE_PMT_INFO, MpegTsPmtInfo))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
|
@ -1,212 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
|
||||
* with newer GLib versions (>= 2.31.0) */
|
||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "flutspmtstreaminfo.h"
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_PID,
|
||||
PROP_LANGUAGES,
|
||||
PROP_STREAM_TYPE,
|
||||
PROP_DESCRIPTORS,
|
||||
};
|
||||
|
||||
GST_BOILERPLATE (MpegTsPmtStreamInfo, mpegts_pmt_stream_info, GObject,
|
||||
G_TYPE_OBJECT);
|
||||
|
||||
static void mpegts_pmt_stream_info_set_property (GObject * object,
|
||||
guint prop_id, const GValue * value, GParamSpec * spec);
|
||||
static void mpegts_pmt_stream_info_get_property (GObject * object,
|
||||
guint prop_id, GValue * value, GParamSpec * spec);
|
||||
static void mpegts_pmt_stream_info_finalize (GObject * object);
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_base_init (gpointer klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_class_init (MpegTsPmtStreamInfoClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_klass = (GObjectClass *) klass;
|
||||
|
||||
gobject_klass->set_property = mpegts_pmt_stream_info_set_property;
|
||||
gobject_klass->get_property = mpegts_pmt_stream_info_get_property;
|
||||
gobject_klass->finalize = mpegts_pmt_stream_info_finalize;
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_PID,
|
||||
g_param_spec_uint ("pid", "PID carrying this stream",
|
||||
"PID which carries this stream", 1, G_MAXUINT16, 1,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
g_object_class_install_property (gobject_klass, PROP_LANGUAGES,
|
||||
g_param_spec_value_array ("languages", "Languages of this stream",
|
||||
"Value array of the languages of this stream",
|
||||
g_param_spec_string ("language", "language", "language", "",
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_STREAM_TYPE,
|
||||
g_param_spec_uint ("stream-type",
|
||||
"Stream type", "Stream type", 0, G_MAXUINT8, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
g_object_class_install_property (gobject_klass, PROP_DESCRIPTORS,
|
||||
g_param_spec_value_array ("descriptors",
|
||||
"Descriptors",
|
||||
"Value array of strings containing stream descriptors",
|
||||
g_param_spec_boxed ("descriptor",
|
||||
"descriptor",
|
||||
"", G_TYPE_GSTRING, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_init (MpegTsPmtStreamInfo * pmt_stream_info,
|
||||
MpegTsPmtStreamInfoClass * klass)
|
||||
{
|
||||
pmt_stream_info->languages = g_value_array_new (0);
|
||||
pmt_stream_info->descriptors = g_value_array_new (0);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_finalize (GObject * object)
|
||||
{
|
||||
MpegTsPmtStreamInfo *info = MPEGTS_PMT_STREAM_INFO (object);
|
||||
|
||||
g_value_array_free (info->languages);
|
||||
g_value_array_free (info->descriptors);
|
||||
|
||||
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
||||
}
|
||||
|
||||
MpegTsPmtStreamInfo *
|
||||
mpegts_pmt_stream_info_new (guint16 pid, guint8 type)
|
||||
{
|
||||
MpegTsPmtStreamInfo *info;
|
||||
info = g_object_new (MPEGTS_TYPE_PMT_STREAM_INFO, NULL);
|
||||
|
||||
info->pid = pid;
|
||||
info->stream_type = type;
|
||||
return info;
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_pmt_stream_info_add_language (MpegTsPmtStreamInfo * pmt_info,
|
||||
gchar * language)
|
||||
{
|
||||
GValue v = { 0, };
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (pmt_info));
|
||||
|
||||
g_value_init (&v, G_TYPE_STRING);
|
||||
g_value_take_string (&v, language);
|
||||
g_value_array_append (pmt_info->languages, &v);
|
||||
g_value_unset (&v);
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_pmt_stream_info_add_descriptor (MpegTsPmtStreamInfo * pmt_info,
|
||||
const gchar * descriptor, guint length)
|
||||
{
|
||||
GValue value = { 0 };
|
||||
GString *string;
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (pmt_info));
|
||||
|
||||
string = g_string_new_len (descriptor, length);
|
||||
|
||||
g_value_init (&value, G_TYPE_GSTRING);
|
||||
g_value_take_boxed (&value, string);
|
||||
g_value_array_append (pmt_info->descriptors, &value);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec)
|
||||
{
|
||||
g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (object));
|
||||
|
||||
/* No settable properties */
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
}
|
||||
|
||||
static void
|
||||
mpegts_pmt_stream_info_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * spec)
|
||||
{
|
||||
MpegTsPmtStreamInfo *si;
|
||||
|
||||
g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (object));
|
||||
|
||||
si = MPEGTS_PMT_STREAM_INFO (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_STREAM_TYPE:
|
||||
g_value_set_uint (value, si->stream_type);
|
||||
break;
|
||||
case PROP_PID:
|
||||
g_value_set_uint (value, si->pid);
|
||||
break;
|
||||
case PROP_LANGUAGES:
|
||||
g_value_set_boxed (value, si->languages);
|
||||
break;
|
||||
case PROP_DESCRIPTORS:
|
||||
g_value_set_boxed (value, si->descriptors);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Jan Schmidt <jan@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef __FLUTS_PMT_STREAM_INFO_H__
|
||||
#define __FLUTS_PMT_STREAM_INFO_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
typedef struct MpegTsPmtStreamInfoClass {
|
||||
GObjectClass parent_class;
|
||||
} MpegTsPmtStreamInfoClass;
|
||||
|
||||
typedef struct MpegTsPmtStreamInfo {
|
||||
GObject parent;
|
||||
|
||||
guint16 pid;
|
||||
GValueArray *languages; /* null terminated 3 character ISO639 language code */
|
||||
guint8 stream_type;
|
||||
GValueArray *descriptors;
|
||||
} MpegTsPmtStreamInfo;
|
||||
|
||||
MpegTsPmtStreamInfo *mpegts_pmt_stream_info_new (guint16 pid, guint8 type);
|
||||
void mpegts_pmt_stream_info_add_language(MpegTsPmtStreamInfo* si,
|
||||
gchar* language);
|
||||
void mpegts_pmt_stream_info_add_descriptor (MpegTsPmtStreamInfo *pmt_info,
|
||||
const gchar *descriptor, guint length);
|
||||
|
||||
GType mpegts_pmt_stream_info_get_type (void);
|
||||
|
||||
#define MPEGTS_TYPE_PMT_STREAM_INFO (mpegts_pmt_stream_info_get_type ())
|
||||
|
||||
#define MPEGTS_IS_PMT_STREAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MPEGTS_TYPE_PMT_STREAM_INFO))
|
||||
#define MPEGTS_PMT_STREAM_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),MPEGTS_TYPE_PMT_STREAM_INFO, MpegTsPmtStreamInfo))
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
|
@ -1,209 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* the GNU Lesser General Public License Version 2 or later (the "LGPL"),
|
||||
* in which case the provisions of the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of the MPL or the LGPL.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "gstmpegdesc.h"
|
||||
|
||||
GST_DEBUG_CATEGORY (gstmpegtsdesc_debug);
|
||||
#define GST_CAT_DEFAULT (gstmpegtsdesc_debug)
|
||||
|
||||
void
|
||||
gst_mpeg_descriptor_free (GstMPEGDescriptor * desc)
|
||||
{
|
||||
g_return_if_fail (desc != NULL);
|
||||
|
||||
g_free (desc);
|
||||
}
|
||||
|
||||
static guint
|
||||
gst_mpeg_descriptor_parse_1 (guint8 * data, guint size)
|
||||
{
|
||||
guint8 tag;
|
||||
guint8 length;
|
||||
|
||||
/* need at least 2 bytes for tag and length */
|
||||
if (size < 2)
|
||||
return 0;
|
||||
|
||||
tag = *data++;
|
||||
length = *data++;
|
||||
size -= 2;
|
||||
|
||||
GST_DEBUG ("tag: 0x%02x, length: %d", tag, length);
|
||||
|
||||
if (length > size)
|
||||
return 0;
|
||||
|
||||
GST_MEMDUMP ("tag contents:", data, length);
|
||||
|
||||
return length + 2;
|
||||
}
|
||||
|
||||
GstMPEGDescriptor *
|
||||
gst_mpeg_descriptor_parse (guint8 * data, guint size)
|
||||
{
|
||||
guint8 *current;
|
||||
guint consumed, total, n_desc;
|
||||
GstMPEGDescriptor *result;
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
|
||||
current = data;
|
||||
total = 0;
|
||||
n_desc = 0;
|
||||
|
||||
do {
|
||||
consumed = gst_mpeg_descriptor_parse_1 (current, size);
|
||||
|
||||
if (consumed > 0) {
|
||||
current += consumed;
|
||||
total += consumed;
|
||||
size -= consumed;
|
||||
n_desc++;
|
||||
}
|
||||
}
|
||||
while (consumed > 0);
|
||||
|
||||
GST_DEBUG ("parsed %d descriptors", n_desc);
|
||||
|
||||
if (total == 0)
|
||||
return NULL;
|
||||
|
||||
result = g_malloc (sizeof (GstMPEGDescriptor) + total);
|
||||
result->n_desc = n_desc;
|
||||
result->data_length = total;
|
||||
result->data = ((guint8 *) result) + sizeof (GstMPEGDescriptor);
|
||||
|
||||
memcpy (result->data, data, total);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
guint
|
||||
gst_mpeg_descriptor_n_desc (GstMPEGDescriptor * desc)
|
||||
{
|
||||
g_return_val_if_fail (desc != NULL, 0);
|
||||
|
||||
return desc->n_desc;
|
||||
}
|
||||
|
||||
guint8 *
|
||||
gst_mpeg_descriptor_find (GstMPEGDescriptor * desc, gint tag)
|
||||
{
|
||||
guint8 length;
|
||||
guint8 *current;
|
||||
guint size;
|
||||
|
||||
g_return_val_if_fail (desc != NULL, NULL);
|
||||
|
||||
current = desc->data;
|
||||
length = desc->data_length;
|
||||
|
||||
while (length > 0) {
|
||||
if (DESC_TAG (current) == tag)
|
||||
return current;
|
||||
|
||||
size = DESC_LENGTH (current) + 2;
|
||||
|
||||
current += size;
|
||||
length -= size;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* array needs freeing afterwards */
|
||||
GArray *
|
||||
gst_mpeg_descriptor_find_all (GstMPEGDescriptor * desc, gint tag)
|
||||
{
|
||||
GArray *all;
|
||||
|
||||
guint8 length;
|
||||
guint8 *current;
|
||||
guint size;
|
||||
|
||||
g_return_val_if_fail (desc != NULL, NULL);
|
||||
all = g_array_new (TRUE, TRUE, sizeof (guint8 *));
|
||||
|
||||
current = desc->data;
|
||||
length = desc->data_length;
|
||||
|
||||
while (length > 0) {
|
||||
if (DESC_TAG (current) == tag)
|
||||
g_array_append_val (all, current);
|
||||
size = DESC_LENGTH (current) + 2;
|
||||
|
||||
current += size;
|
||||
length -= size;
|
||||
}
|
||||
|
||||
GST_DEBUG ("found tag 0x%02x %d times", tag, all->len);
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
guint8 *
|
||||
gst_mpeg_descriptor_nth (GstMPEGDescriptor * desc, guint i)
|
||||
{
|
||||
guint8 length;
|
||||
guint8 *current;
|
||||
guint size;
|
||||
|
||||
g_return_val_if_fail (desc != NULL, NULL);
|
||||
|
||||
if (i > desc->n_desc)
|
||||
return NULL;
|
||||
|
||||
current = desc->data;
|
||||
length = desc->data_length;
|
||||
|
||||
while (length > 0) {
|
||||
if (i == 0)
|
||||
return current;
|
||||
|
||||
size = DESC_LENGTH (current) + 2;
|
||||
|
||||
current += size;
|
||||
length -= size;
|
||||
i--;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gst_mpegtsdesc_init_debug (void)
|
||||
{
|
||||
GST_DEBUG_CATEGORY_INIT (gstmpegtsdesc_debug, "mpegtsdesc", 0,
|
||||
"MPEG transport stream parser (descriptor)");
|
||||
}
|
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* the GNU Lesser General Public License Version 2 or later (the "LGPL"),
|
||||
* in which case the provisions of the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of the MPL or the LGPL.
|
||||
*/
|
||||
|
||||
#ifndef __GST_MPEG_DESC_H__
|
||||
#define __GST_MPEG_DESC_H__
|
||||
|
||||
#include <glib.h>
|
||||
/*
|
||||
* descriptor_tag TS PS Identification
|
||||
* 0 n/a n/a Reserved
|
||||
* 1 n/a n/a Reserved
|
||||
* 2 X X video_stream_descriptor
|
||||
* 3 X X audio_stream_descriptor
|
||||
* 4 X X hierarchy_descriptor
|
||||
* 5 X X registration_descriptor
|
||||
* 6 X X data_stream_alignment_descriptor
|
||||
* 7 X X target_background_grid_descriptor
|
||||
* 8 X X video_window_descriptor
|
||||
* 9 X X CA_descriptor
|
||||
* 10 X X ISO_639_language_descriptor
|
||||
* 11 X X system_clock_descriptor
|
||||
* 12 X X multiplex_buffer_utilization_descriptor
|
||||
* 13 X X copyright_descriptor
|
||||
* 14 X maximum bitrate descriptor
|
||||
* 15 X X private data indicator descriptor
|
||||
* 16 X X smoothing buffer descriptor
|
||||
* 17 X STD_descriptor
|
||||
* 18 X X IBP descriptor
|
||||
* 19-63 n/a n/a ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved
|
||||
* 64-255 n/a n/a User Private
|
||||
*/
|
||||
#define DESC_VIDEO_STREAM 2
|
||||
#define DESC_AUDIO_STREAM 3
|
||||
#define DESC_HIERARCHY 4
|
||||
#define DESC_REGISTRATION 5
|
||||
#define DESC_DATA_STREAM_ALIGNMENT 6
|
||||
#define DESC_TARGET_BACKGROUND_GRID 7
|
||||
#define DESC_VIDEO_WINDOW 8
|
||||
#define DESC_CA 9
|
||||
#define DESC_ISO_639_LANGUAGE 10
|
||||
#define DESC_SYSTEM_CLOCK 11
|
||||
#define DESC_MULTIPLEX_BUFFER_UTILISATION 12
|
||||
#define DESC_COPYRIGHT 13
|
||||
#define DESC_MAXIMUM_BITRATE 14
|
||||
#define DESC_PRIVATE_DATA_INDICATOR 15
|
||||
#define DESC_SMOOTHING_BUFFER 16
|
||||
#define DESC_STD 17
|
||||
#define DESC_IBP 18
|
||||
|
||||
#define DESC_DIRAC_TC_PRIVATE 0xAC
|
||||
|
||||
/* DVB tags */
|
||||
#define DESC_DVB_CAROUSEL_IDENTIFIER 0x13
|
||||
#define DESC_DVB_NETWORK_NAME 0x40
|
||||
#define DESC_DVB_SERVICE_LIST 0x41
|
||||
#define DESC_DVB_STUFFING 0x42
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM 0x43
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM 0x44
|
||||
#define DESC_DVB_VBI_DATA 0x45
|
||||
#define DESC_DVB_VBI_TELETEXT 0x46
|
||||
#define DESC_DVB_BOUQUET_NAME 0x47
|
||||
#define DESC_DVB_SERVICE 0x48
|
||||
#define DESC_DVB_COUNTRY_AVAILABILITY 0x49
|
||||
#define DESC_DVB_LINKAGE 0x4A
|
||||
#define DESC_DVB_NVOD_REFERENCE 0x4B
|
||||
#define DESC_DVB_TIME_SHIFTED_SERVICE 0x4C
|
||||
#define DESC_DVB_SHORT_EVENT 0x4D
|
||||
#define DESC_DVB_EXTENDED_EVENT 0x4E
|
||||
#define DESC_DVB_TIME_SHIFTED_EVENT 0x4F
|
||||
#define DESC_DVB_COMPONENT 0x50
|
||||
#define DESC_DVB_MOSAIC 0x51
|
||||
#define DESC_DVB_STREAM_IDENTIFIER 0x52
|
||||
#define DESC_DVB_CA_IDENTIFIER 0x53
|
||||
#define DESC_DVB_CONTENT 0x54
|
||||
#define DESC_DVB_PARENTAL_RATING 0x55
|
||||
#define DESC_DVB_TELETEXT 0x56
|
||||
#define DESC_DVB_TELEPHONE 0x57
|
||||
#define DESC_DVB_LOCAL_TIME_OFFSET 0x58
|
||||
#define DESC_DVB_SUBTITLING 0x59
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM 0x5A
|
||||
#define DESC_DVB_MULTILINGUAL_NETWORK_NAME 0x5B
|
||||
#define DESC_DVB_MULTILINGUAL_BOUQUET_NAME 0x5C
|
||||
#define DESC_DVB_MULTILINGUAL_SERVICE_NAME 0x5D
|
||||
#define DESC_DVB_MULTILINGUAL_COMPONENT 0x5E
|
||||
#define DESC_DVB_PRIVATE_DATA 0x5F
|
||||
#define DESC_DVB_SERVICE_MOVE 0x60
|
||||
#define DESC_DVB_SHORT_SMOOTHING_BUFFER 0x61
|
||||
#define DESC_DVB_FREQUENCY_LIST 0x62
|
||||
#define DESC_DVB_PARTIAL_TRANSPORT_STREAM 0x63
|
||||
#define DESC_DVB_DATA_BROADCAST 0x64
|
||||
#define DESC_DVB_SCRAMBLING 0x65
|
||||
#define DESC_DVB_DATA_BROADCAST_ID 0x66
|
||||
#define DESC_DVB_TRANSPORT_STREAM 0x67
|
||||
#define DESC_DVB_DSNG 0x68
|
||||
#define DESC_DVB_PDC 0x69
|
||||
#define DESC_DVB_AC3 0x6A
|
||||
#define DESC_DVB_ANCILLARY_DATA 0x6B
|
||||
#define DESC_DVB_CELL_LIST 0x6C
|
||||
#define DESC_DVB_CELL_FREQUENCY_LINK 0x6D
|
||||
#define DESC_DVB_ANNOUNCEMENT_SUPPORT 0x6E
|
||||
#define DESC_DVB_APPLICATION_SIGNALLING 0x6F
|
||||
#define DESC_DVB_ADAPTATION_FIELD_DATA 0x70
|
||||
#define DESC_DVB_SERVICE_IDENTIFIER 0x71
|
||||
#define DESC_DVB_SERVICE_AVAILABILITY 0x72
|
||||
#define DESC_DVB_DEFAULT_AUTHORITY 0x73
|
||||
#define DESC_DVB_RELATED_CONTENT 0x74
|
||||
#define DESC_DVB_TVA_ID 0x75
|
||||
#define DESC_DVB_CONTENT_IDENTIFIER 0x76
|
||||
#define DESC_DVB_TIMESLICE_FEC_IDENTIFIER 0x77
|
||||
#define DESC_DVB_ECM_REPETITION_RATE 0x78
|
||||
#define DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM 0x79
|
||||
#define DESC_DVB_ENHANCED_AC3 0x7A
|
||||
#define DESC_DVB_DTS 0x7B
|
||||
#define DESC_DVB_AAC 0x7C
|
||||
/* 0x7D and 0x7E are reserved for future use */
|
||||
#define DESC_DVB_EXTENSION 0x7F
|
||||
/* 0x80 - 0xFE are user defined */
|
||||
#define DESC_DTG_LOGICAL_CHANNEL 0x83 /* from DTG D-Book */
|
||||
/* 0xFF is forbidden */
|
||||
|
||||
/* common for all descriptors */
|
||||
#define DESC_TAG(desc) (desc[0])
|
||||
#define DESC_LENGTH(desc) (desc[1])
|
||||
|
||||
/* video_stream_descriptor */
|
||||
#define DESC_VIDEO_STREAM_multiple_framerate_flag(desc) (((desc)[2] & 0x80) == 0x80)
|
||||
#define DESC_VIDEO_STREAM_frame_rate_code(desc) (((desc)[2] & 0x38) >> 3)
|
||||
#define DESC_VIDEO_STREAM_MPEG_1_only_flag(desc) (((desc)[2] & 0x04) == 0x04)
|
||||
#define DESC_VIDEO_STREAM_constrained_parameter_flag(desc) (((desc)[2] & 0x02) == 0x02)
|
||||
#define DESC_VIDEO_STREAM_still_picture_flag(desc) (((desc)[2] & 0x01) == 0x01)
|
||||
/* if (MPEG_1_only_flag == 1) */
|
||||
#define DESC_VIDEO_STREAM_profile_and_level_indication(desc) ((desc)[3])
|
||||
#define DESC_VIDEO_STREAM_chroma_format(desc) (((desc)[4] & 0xc0) >> 6)
|
||||
#define DESC_VIDEO_STREAM_frame_rate_extension_flag(desc) (((desc)[4] & 0x20) == 0x20)
|
||||
|
||||
/* audio_stream_descriptor */
|
||||
#define DESC_AUDIO_STREAM_free_format_flag(desc) (((desc)[2] & 0x80) == 0x80)
|
||||
#define DESC_AUDIO_STREAM_ID(desc) (((desc)[2] & 0x40) == 0x40)
|
||||
#define DESC_AUDIO_STREAM_layer(desc) (((desc)[2] & 0x30) >> 4)
|
||||
#define DESC_AUDIO_STREAM_variable_rate_audio_indicator(desc) (((desc)[2] & 0x08) == 0x08)
|
||||
|
||||
/* hierarchy_descriptor */
|
||||
#define DESC_HIERARCHY_hierarchy_type(desc) (((desc)[2] & 0x0f))
|
||||
#define DESC_HIERARCHY_hierarchy_layer_index(desc) (((desc)[3] & 0x3f))
|
||||
#define DESC_HIERARCHY_hierarchy_embedded_layer_index(desc) (((desc)[4] & 0x3f))
|
||||
#define DESC_HIERARCHY_hierarchy_channel(desc) (((desc)[5] & 0x3f))
|
||||
|
||||
/* registration_descriptor */
|
||||
#define DESC_REGISTRATION_format_identifier(desc) (GST_READ_UINT32_BE ((desc)+2))
|
||||
#define DESC_REGISTRATION_additional_ident_info_len(desc) ((desc)[1] - 4)
|
||||
#define DESC_REGISTRATION_additional_ident_info(desc) (&(desc)[6])
|
||||
|
||||
/* data_stream_alignment_descriptor */
|
||||
#define DESC_DATA_STREAM_ALIGNMENT_alignment_type(desc) ((desc)[2])
|
||||
|
||||
/* target_background_grid_descriptor */
|
||||
#define DESC_TARGET_BACKGROUND_GRID_horizontal_size(desc) (GST_READ_UINT16_BE ((desc)+2) >> 2)
|
||||
#define DESC_TARGET_BACKGROUND_GRID_vertical_size(desc) ((GST_READ_UINT32_BE ((desc)+2) & 0x0003fff0) >> 4)
|
||||
#define DESC_TARGET_BACKGROUND_GRID_aspect_ratio_information(desc) ((desc)[5] & 0x0f)
|
||||
|
||||
/* video_window_descriptor */
|
||||
#define DESC_VIDEO_WINDOW_horizontal_offset(desc) (GST_READ_UINT16_BE ((desc)+2) >> 2)
|
||||
#define DESC_VIDEO_WINDOW_vertical_offset(desc) ((GST_READ_UINT32_BE ((desc)+2) & 0x0003fff0) >> 4)
|
||||
#define DESC_VIDEO_WINDOW_window_priority(desc) ((desc)[5] & 0x0f)
|
||||
|
||||
/* CA_descriptor */
|
||||
#define DESC_CA_system_ID(desc) (GST_READ_UINT16_BE ((desc)+2))
|
||||
#define DESC_CA_PID(desc) (GST_READ_UINT16_BE ((desc)+2) & 0x1fff)
|
||||
|
||||
/* ISO_639_language_descriptor */
|
||||
#define DESC_ISO_639_LANGUAGE_codes_n(desc) ((desc[1]) >> 2)
|
||||
#define DESC_ISO_639_LANGUAGE_language_code_nth(desc,i) (&(desc[2 + (4*i)]))
|
||||
#define DESC_ISO_639_LANGUAGE_audio_type_nth(desc,i) ((desc)[5 + (4*i)])
|
||||
|
||||
/* system_clock_descriptor */
|
||||
#define DESC_SYSTEM_CLOCK_external_clock_reference_indicator(desc) (((desc)[2] & 0x80) == 0x80)
|
||||
#define DESC_SYSTEM_CLOCK_clock_accuracy_integer(desc) ((desc)[2] & 0x3f)
|
||||
#define DESC_SYSTEM_CLOCK_clock_accuracy_exponent(desc) (((desc)[3] & 0xe0) >> 5)
|
||||
|
||||
/* multiplex_buffer_utilization_descriptor */
|
||||
#define DESC_MULTIPLEX_BUFFER_UTILISATION_bound_valid_flag(desc) (((desc)[2] & 0x80) == 0x80)
|
||||
#define DESC_MULTIPLEX_BUFFER_UTILISATION_LTW_offset_lower_bound(desc) (GST_READ_UINT16_BE ((desc)+2) & 0x7fff)
|
||||
#define DESC_MULTIPLEX_BUFFER_UTILISATION_LTW_offset_upper_bound(desc) (GST_READ_UINT16_BE ((desc)+4) & 0x7fff)
|
||||
|
||||
/* copyright_descriptor */
|
||||
#define DESC_COPYRIGHT_copyright_identifier(desc) (GST_READ_UINT32_BE ((desc)+2))
|
||||
#define DESC_COPYRIGHT_additional_copyright_info_len(desc) ((desc)[1] - 4)
|
||||
#define DESC_COPYRIGHT_additional_copyright_info(desc) (&(desc)[6])
|
||||
|
||||
/* maximum_bitrate_descriptor */
|
||||
#define DESC_MAXIMUM_BITRAT_maximum_bitrate(desc) (((((guint32)desc[2]) & 0x3f) << 16) | \
|
||||
GST_READ_UINT16_BE ((desc)+3))
|
||||
|
||||
/* private_data_indicator_descriptor */
|
||||
#define DESC_PRIVATE_DATA_INDICATOR_indicator(desc) (GST_READ_UINT32_BE(&desc[2]))
|
||||
|
||||
/* smoothing_buffer_descriptor */
|
||||
#define DESC_SMOOTHING_BUFFER_sb_leak_rate(desc) (((((guint32)desc[2]) & 0x3f) << 16) | \
|
||||
GST_READ_UINT16_BE ((desc)+3))
|
||||
#define DESC_SMOOTHING_BUFFER_sb_size(desc) (((((guint32)desc[5]) & 0x3f) << 16) | \
|
||||
GST_READ_UINT16_BE ((desc)+6))
|
||||
/* STD_descriptor */
|
||||
#define DESC_STD_leak_valid_flag(desc) (((desc)[2] & 0x01) == 0x01)
|
||||
|
||||
/* ibp_descriptor */
|
||||
#define DESC_IBP_closed_gop_flag(desc) (((desc)[2] & 0x80) == 0x80)
|
||||
#define DESC_IBP_identical_gop_flag(desc) (((desc)[2] & 0x40) == 0x40)
|
||||
#define DESC_IBP_max_gop_length(desc) (GST_READ_UINT16_BE ((desc)+6) & 0x3fff)
|
||||
|
||||
/* time_code descriptor */
|
||||
#define DESC_TIMECODE_video_pid(desc) (GST_READ_UINT16_BE ((desc) + 2) & 0x1fff)
|
||||
|
||||
/* Stream identifier descriptor */
|
||||
#define DESC_DVB_STREAM_IDENTIFIER_component_tag(desc) (desc[2])
|
||||
|
||||
/* DVB Network Name descriptor */
|
||||
#define DESC_DVB_NETWORK_NAME_length(desc) (GST_READ_UINT8((desc)+1))
|
||||
#define DESC_DVB_NETWORK_NAME_text(desc) (desc+2)
|
||||
|
||||
/* DVB Service Descriptor */
|
||||
#define DESC_DVB_SERVICE_type(desc) (desc[2])
|
||||
#define DESC_DVB_SERVICE_provider_name_length(desc) (desc[3])
|
||||
#define DESC_DVB_SERVICE_provider_name_text(desc) (desc+4)
|
||||
#define DESC_DVB_SERVICE_name_length(desc) (desc[4 + DESC_DVB_SERVICE_provider_name_length(desc)])
|
||||
#define DESC_DVB_SERVICE_name_text(desc) (desc + 5 + DESC_DVB_SERVICE_provider_name_length(desc))
|
||||
|
||||
/* DVB Component Descriptor */
|
||||
#define DESC_DVB_COMPONENT_stream_content(desc) (desc[2] & 0x0F)
|
||||
#define DESC_DVB_COMPONENT_type(desc) (desc[3])
|
||||
#define DESC_DVB_COMPONENT_tag(desc) (desc[4])
|
||||
#define DESC_DVB_COMPONENT_language(desc) (desc + 5)
|
||||
|
||||
/* DVB Bouquet Name Descriptor */
|
||||
#define DESC_DVB_BOUQUET_NAME_text(desc) (desc + 2)
|
||||
|
||||
/* DVB Short Event Descriptor */
|
||||
#define DESC_DVB_SHORT_EVENT_name_text(desc) (desc + 6)
|
||||
#define DESC_DVB_SHORT_EVENT_name_length(desc) (desc[5])
|
||||
#define DESC_DVB_SHORT_EVENT_description_text(desc) (desc + 6 + DESC_DVB_SHORT_EVENT_name_length(desc) + 1)
|
||||
#define DESC_DVB_SHORT_EVENT_description_length(desc) (desc[6 + DESC_DVB_SHORT_EVENT_name_length(desc)])
|
||||
|
||||
/* DVB Extended Event Descriptor */
|
||||
#define DESC_DVB_EXTENDED_EVENT_descriptor_number(desc) ((desc[2] & 0xF0) >> 4)
|
||||
#define DESC_DVB_EXTENDED_EVENT_last_descriptor_number(desc) (desc[2] & 0x0F)
|
||||
#define DESC_DVB_EXTENDED_EVENT_iso639_language_code(desc) (desc + 3)
|
||||
#define DESC_DVB_EXTENDED_EVENT_items_length(desc) (desc[6])
|
||||
#define DESC_DVB_EXTENDED_EVENT_items(desc) (desc + 7)
|
||||
#define DESC_DVB_EXTENDED_EVENT_text_length(desc) (desc[7 + DESC_DVB_EXTENDED_EVENT_items_length(desc)])
|
||||
#define DESC_DVB_EXTENDED_EVENT_text(desc) (desc + 7 + DESC_DVB_EXTENDED_EVENT_items_length(desc) + 1)
|
||||
|
||||
/* DVB Satellite Delivery System Descriptor */
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_frequency(desc) (desc + 2)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_orbital_position(desc) (desc + 6)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_west_east_flag(desc) ((desc[8] & 0x80) == 0x80)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_polarization(desc) ((desc[8] >> 5) & 0x3)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_modulation(desc) (desc[8] & 0x1F)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_symbol_rate(desc) (desc + 9)
|
||||
#define DESC_DVB_SATELLITE_DELIVERY_SYSTEM_fec_inner(desc) (desc[12] & 0x0F)
|
||||
|
||||
/* DVB Terrestrial Delivery System Descriptor */
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_frequency(desc) (GST_READ_UINT32_BE((desc) + 2))
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_bandwidth(desc) ((desc[6] >> 5) & 0x7)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_constellation(desc) ((desc[7] >> 6) & 0x3)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_hierarchy(desc) ((desc[7] >> 3) & 0x7)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_code_rate_hp(desc) (desc[7] & 0x7)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_code_rate_lp(desc) ((desc[8] >> 5) & 0x7)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_guard_interval(desc) ((desc[8] >> 3) & 0x3)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_transmission_mode(desc) ((desc[8] >> 1) & 0x3)
|
||||
#define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_other_frequency(desc) ((desc[8] & 0x01) == 0x01)
|
||||
|
||||
/* DVB Cable Delivery System Descriptor */
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM_frequency(desc) (desc + 2)
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_outer(desc) (desc[7] & 0x0F)
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM_modulation(desc) (desc[8])
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM_symbol_rate(desc) (desc + 9)
|
||||
#define DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_inner(desc) (desc[12] & 0x0F)
|
||||
|
||||
/* DVB Data Broadcast Descriptor */
|
||||
#define DESC_DVB_DATA_BROADCAST_data_broadcast_id(desc) (GST_READ_UINT16_BE((desc) + 2))
|
||||
#define DESC_DVB_DATA_BROADCAST_component_tag(desc) (desc[4])
|
||||
#define DESC_DVB_DATA_BROADCAST_selector_length(desc) (desc[5])
|
||||
#define DESC_DVB_DATA_BROADCAST_selector(desc) (desc + 6)
|
||||
#define DESC_DVB_DATA_BROADCAST_iso639_language_code(desc) (desc + 6 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
|
||||
#define DESC_DVB_DATA_BROADCAST_text_length(desc) (desc + 9 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
|
||||
#define DESC_DVB_DATA_BROADCAST_text(desc) (desc + 10 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
|
||||
|
||||
/* DVB Data Broadcast Id Descriptor */
|
||||
#define DESC_DVB_DATA_BROADCAST_ID_data_broadcast_id(desc) (GST_READ_UINT16_BE((desc) + 2))
|
||||
#define DESC_DVB_DATA_BROADCAST_ID_id_selector_byte(desc) (desc + 4)
|
||||
|
||||
/* DVB Carousel Identifier Descriptor */
|
||||
#define DESC_DVB_CAROUSEL_IDENTIFIER_carousel_id(desc) (GST_READ_UINT32_BE((desc) + 2))
|
||||
|
||||
/* registration_descriptor format IDs */
|
||||
#define DRF_ID_HDMV 0x48444d56
|
||||
#define DRF_ID_VC1 0x56432D31 /* defined in RP227 */
|
||||
|
||||
typedef struct {
|
||||
guint n_desc;
|
||||
guint8 data_length;
|
||||
guint8 *data;
|
||||
} GstMPEGDescriptor;
|
||||
|
||||
void gst_mpegtsdesc_init_debug (void);
|
||||
GstMPEGDescriptor* gst_mpeg_descriptor_parse (guint8 *data, guint size);
|
||||
void gst_mpeg_descriptor_free (GstMPEGDescriptor *desc);
|
||||
|
||||
guint gst_mpeg_descriptor_n_desc (GstMPEGDescriptor *desc);
|
||||
guint8* gst_mpeg_descriptor_find (GstMPEGDescriptor *desc, gint tag);
|
||||
GArray* gst_mpeg_descriptor_find_all (GstMPEGDescriptor * desc, gint tag);
|
||||
|
||||
guint8* gst_mpeg_descriptor_nth (GstMPEGDescriptor *desc, guint i);
|
||||
|
||||
#endif /* __GST_MPEG_DESC_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,257 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.A.
|
||||
* Portions created by Fluendo, S.A. are Copyright (C) 2005,2006,2007,2008,2009
|
||||
* Fluendo, S.A. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef __GST_MPEGTS_DEMUX_H__
|
||||
#define __GST_MPEGTS_DEMUX_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
#include "gstmpegdesc.h"
|
||||
#include "gstpesfilter.h"
|
||||
#include "gstsectionfilter.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MPEGTS_MIN_PES_BUFFER_SIZE 4 * 1024
|
||||
#define MPEGTS_MAX_PES_BUFFER_SIZE 256 * 1024
|
||||
|
||||
#define MPEGTS_MAX_PID 0x1fff
|
||||
#define MPEGTS_NORMAL_TS_PACKETSIZE 188
|
||||
#define MPEGTS_M2TS_TS_PACKETSIZE 192
|
||||
#define MPEGTS_DVB_ASI_TS_PACKETSIZE 204
|
||||
#define MPEGTS_ATSC_TS_PACKETSIZE 208
|
||||
|
||||
#define IS_MPEGTS_SYNC(data) (((data)[0] == 0x47) && \
|
||||
(((data)[1] & 0x80) == 0x00) && \
|
||||
(((data)[3] & 0x10) == 0x10))
|
||||
|
||||
#define GST_TYPE_MPEGTS_DEMUX (gst_mpegts_demux_get_type())
|
||||
#define GST_MPEGTS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
|
||||
GST_TYPE_MPEGTS_DEMUX,GstMpegTSDemux))
|
||||
#define GST_MPEGTS_DEMUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),\
|
||||
GST_TYPE_MPEGTS_DEMUX,GstMpegTSDemuxClass))
|
||||
#define GST_MPEGTS_DEMUX_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),\
|
||||
GST_TYPE_MPEGTS_DEMUX,GstMpegTSDemuxClass))
|
||||
#define GST_IS_MPEGTS_DEMUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),\
|
||||
GST_TYPE_MPEGTS_DEMUX))
|
||||
#define GST_IS_MPEGTS_DEMUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),\
|
||||
GST_TYPE_MPEGTS_DEMUX))
|
||||
|
||||
typedef struct _GstMpegTSStream GstMpegTSStream;
|
||||
typedef struct _GstMpegTSPMTEntry GstMpegTSPMTEntry;
|
||||
typedef struct _GstMpegTSPMT GstMpegTSPMT;
|
||||
typedef struct _GstMpegTSPATEntry GstMpegTSPATEntry;
|
||||
typedef struct _GstMpegTSPAT GstMpegTSPAT;
|
||||
typedef struct _GstMpegTSDemux GstMpegTSDemux;
|
||||
typedef struct _GstMpegTSDemuxClass GstMpegTSDemuxClass;
|
||||
|
||||
struct _GstMpegTSPMTEntry {
|
||||
guint16 PID;
|
||||
};
|
||||
|
||||
struct _GstMpegTSPMT {
|
||||
guint16 program_number;
|
||||
guint8 version_number;
|
||||
gboolean current_next_indicator;
|
||||
guint8 section_number;
|
||||
guint8 last_section_number;
|
||||
guint16 PCR_PID;
|
||||
guint16 program_info_length;
|
||||
GstMPEGDescriptor * program_info;
|
||||
|
||||
GArray * entries;
|
||||
};
|
||||
|
||||
struct _GstMpegTSPATEntry {
|
||||
guint16 program_number;
|
||||
guint16 PID;
|
||||
};
|
||||
|
||||
struct _GstMpegTSPAT {
|
||||
guint16 transport_stream_id;
|
||||
guint8 version_number;
|
||||
gboolean current_next_indicator;
|
||||
guint8 section_number;
|
||||
guint8 last_section_number;
|
||||
|
||||
GArray * entries;
|
||||
};
|
||||
|
||||
typedef enum _MpegTsStreamFlags {
|
||||
MPEGTS_STREAM_FLAG_STREAM_TYPE_UNKNOWN = 0x01,
|
||||
MPEGTS_STREAM_FLAG_PMT_VALID = 0x02,
|
||||
MPEGTS_STREAM_FLAG_IS_VIDEO = 0x04,
|
||||
MPEGTS_STREAM_FLAG_IS_AUDIO = 0x08
|
||||
} MpegTsStreamFlags;
|
||||
|
||||
/* Information associated to a single MPEG stream. */
|
||||
struct _GstMpegTSStream {
|
||||
GstMpegTSDemux * demux;
|
||||
|
||||
MpegTsStreamFlags flags;
|
||||
|
||||
/* PID and type */
|
||||
guint16 PID;
|
||||
guint8 PID_type;
|
||||
|
||||
/* adaptation_field data */
|
||||
guint64 last_PCR;
|
||||
guint64 base_PCR;
|
||||
guint64 last_OPCR;
|
||||
guint64 last_PCR_difference;
|
||||
gboolean discont_PCR;
|
||||
GstClockTimeDiff discont_difference;
|
||||
|
||||
/* for PAT streams */
|
||||
GstMpegTSPAT PAT;
|
||||
|
||||
/* for PMT streams */
|
||||
GstMpegTSPMT PMT;
|
||||
|
||||
/* for CA streams */
|
||||
|
||||
/* for PAT, PMT, CA and private streams */
|
||||
GstSectionFilter section_filter;
|
||||
|
||||
/* for PES streams */
|
||||
guint8 id;
|
||||
guint8 stream_type;
|
||||
GstBuffer * pes_buffer;
|
||||
guint32 pes_buffer_size;
|
||||
guint32 pes_buffer_used;
|
||||
gboolean pes_buffer_overflow;
|
||||
gboolean pes_buffer_in_sync;
|
||||
GstPESFilter filter;
|
||||
GstPad * pad;
|
||||
GstFlowReturn last_ret;
|
||||
GstMPEGDescriptor *ES_info;
|
||||
/* needed because 33bit mpeg timestamps wrap around every (approx) 26.5 hrs */
|
||||
GstClockTimeDiff base_time;
|
||||
GstClockTime last_time;
|
||||
/* pid of PMT that this stream belongs to */
|
||||
guint16 PMT_pid;
|
||||
gboolean discont;
|
||||
};
|
||||
|
||||
struct _GstMpegTSDemux {
|
||||
GstElement parent;
|
||||
|
||||
/* properties */
|
||||
gboolean check_crc;
|
||||
|
||||
/* sink pad and adapter */
|
||||
GstPad * sinkpad;
|
||||
GstAdapter * adapter;
|
||||
guint8 ** sync_lut;
|
||||
guint sync_lut_len;
|
||||
|
||||
/* current PMT PID */
|
||||
guint16 current_PMT;
|
||||
|
||||
/* Array of MPEGTS_MAX_PID + 1 stream entries */
|
||||
GstMpegTSStream ** streams;
|
||||
/* Array to perform pmts checks at gst_mpegts_demux_parse_adaptation_field */
|
||||
gboolean pmts_checked[MPEGTS_MAX_PID + 1];
|
||||
|
||||
/* Array of Elementary Stream pids for ts with PMT */
|
||||
guint16 * elementary_pids;
|
||||
guint nb_elementary_pids;
|
||||
|
||||
/* Program number to use */
|
||||
gint program_number;
|
||||
|
||||
/* indicates that we need to close our pad group, because we've added
|
||||
* at least one pad */
|
||||
gboolean need_no_more_pads;
|
||||
gint packetsize;
|
||||
gboolean m2ts_mode;
|
||||
/* clocking */
|
||||
GstClock * clock;
|
||||
GstClockTime clock_base;
|
||||
|
||||
/* Additional information required for seeking.
|
||||
* num_packets: Number of packets outputted
|
||||
* bitrate: estimated bitrate (based on pcr and num_packets */
|
||||
guint64 num_packets;
|
||||
gint64 bitrate;
|
||||
|
||||
/* Two PCRs observations to calculate bitrate */
|
||||
guint64 pcr[2];
|
||||
|
||||
/* Cached duration estimation */
|
||||
GstClockTime cache_duration;
|
||||
|
||||
/* Cached base_PCR in GStreamer time. */
|
||||
GstClockTime base_pts;
|
||||
|
||||
/* base timings on first buffer timestamp */
|
||||
GstClockTime first_buf_ts;
|
||||
GstClockTime in_gap;
|
||||
|
||||
/* Detect when the source stops for a while, we will resync the interpolation gap */
|
||||
GstClockTime last_buf_ts;
|
||||
|
||||
/* Number of expected pads which have not been added yet */
|
||||
gint pending_pads;
|
||||
|
||||
gboolean tried_adding_pads;
|
||||
};
|
||||
|
||||
struct _GstMpegTSDemuxClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
GstPadTemplate * sink_template;
|
||||
GstPadTemplate * video_template;
|
||||
GstPadTemplate * audio_template;
|
||||
GstPadTemplate * subpicture_template;
|
||||
GstPadTemplate * private_template;
|
||||
};
|
||||
|
||||
GType gst_mpegts_demux_get_type (void);
|
||||
|
||||
gboolean gst_mpegts_demux_plugin_init (GstPlugin *plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_MPEGTS_DEMUX_H__ */
|
|
@ -1,164 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gstsectionfilter.h"
|
||||
|
||||
#ifndef __always_inline
|
||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||
#define __always_inline inline __attribute__((always_inline))
|
||||
#else
|
||||
#define __always_inline inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_INLINE
|
||||
#define FORCE_INLINE __always_inline
|
||||
#else
|
||||
#define FORCE_INLINE
|
||||
#endif
|
||||
|
||||
GST_DEBUG_CATEGORY (gstflusectionfilter_debug);
|
||||
#define GST_CAT_DEFAULT (gstflusectionfilter_debug)
|
||||
|
||||
void
|
||||
gst_section_filter_init (GstSectionFilter * filter)
|
||||
{
|
||||
g_return_if_fail (filter != NULL);
|
||||
filter->adapter = gst_adapter_new ();
|
||||
/* continuity counter can at max be 15
|
||||
* we make 255 as an indication that
|
||||
* there is no last continuity counter */
|
||||
filter->last_continuity_counter = 255;
|
||||
filter->section_length = G_MAXUINT16;
|
||||
}
|
||||
|
||||
void
|
||||
gst_section_filter_uninit (GstSectionFilter * filter)
|
||||
{
|
||||
g_return_if_fail (filter != NULL);
|
||||
if (filter->adapter)
|
||||
g_object_unref (filter->adapter);
|
||||
filter->adapter = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
gst_section_filter_clear (GstSectionFilter * filter)
|
||||
{
|
||||
g_return_if_fail (filter != NULL);
|
||||
if (filter->adapter) {
|
||||
gst_adapter_clear (filter->adapter);
|
||||
filter->last_continuity_counter = 255;
|
||||
filter->section_length = G_MAXUINT16;
|
||||
}
|
||||
}
|
||||
|
||||
static FORCE_INLINE gboolean
|
||||
gst_section_is_complete (GstSectionFilter * filter)
|
||||
{
|
||||
/* section length measures size of section from 3 bytes into section
|
||||
* (ie after section length field finished) until end of section)
|
||||
*/
|
||||
guint avail_bytes = gst_adapter_available (filter->adapter);
|
||||
if (filter->section_length == avail_bytes - 3) {
|
||||
return TRUE;
|
||||
} else if (filter->section_length < (int) (avail_bytes - 3)) {
|
||||
GST_DEBUG ("section length seems to be less than available bytes for "
|
||||
"rest of section.");
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* returns True when section finished and ready to parse */
|
||||
/* FIXME: especially for multi-section tables, we need to handle pusi correctly
|
||||
* and handle cases where a new section starts in the same transport packet.
|
||||
*/
|
||||
gboolean
|
||||
gst_section_filter_push (GstSectionFilter * filter, gboolean pusi, /* determines whether start or not */
|
||||
guint8 continuity_counter, GstBuffer * buf)
|
||||
{
|
||||
g_return_val_if_fail (filter != NULL, FALSE);
|
||||
|
||||
/* check if it's the first packet of a section or
|
||||
* if it continues the section */
|
||||
if (pusi) {
|
||||
const guint8 *data = GST_BUFFER_DATA (buf);
|
||||
if (filter->last_continuity_counter != 255) {
|
||||
GST_WARNING ("section lost, last continuity counter: %d, "
|
||||
"we now have a pusi at continuity counter: %d",
|
||||
filter->last_continuity_counter, continuity_counter);
|
||||
gst_section_filter_clear (filter);
|
||||
}
|
||||
filter->section_length = GST_READ_UINT16_BE (data + 1);
|
||||
filter->section_length &= 0x0fff;
|
||||
if (filter->section_length > 4093) {
|
||||
GST_DEBUG ("section length too big");
|
||||
goto failure;
|
||||
}
|
||||
gst_adapter_push (filter->adapter, buf);
|
||||
filter->last_continuity_counter = continuity_counter;
|
||||
return gst_section_is_complete (filter);
|
||||
} else if (filter->last_continuity_counter == continuity_counter - 1 ||
|
||||
(filter->last_continuity_counter == 15 && continuity_counter == 0)) {
|
||||
GST_DEBUG ("section still going, no pusi");
|
||||
gst_adapter_push (filter->adapter, buf);
|
||||
filter->last_continuity_counter = continuity_counter;
|
||||
return gst_section_is_complete (filter);
|
||||
}
|
||||
/* we have lost the section and we are not a start
|
||||
* section, so clear what was in it */
|
||||
else {
|
||||
GST_WARNING ("section lost, last continuity counter: %d, "
|
||||
"new continuity counter but not pusi: %d",
|
||||
filter->last_continuity_counter, continuity_counter);
|
||||
gst_section_filter_clear (filter);
|
||||
goto failure;
|
||||
}
|
||||
failure:
|
||||
gst_buffer_unref (buf);
|
||||
return FALSE;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* This library is licensed under 2 different licenses and you
|
||||
* can choose to use it under the terms of either one of them. The
|
||||
* two licenses are the MPL 1.1 and the LGPL.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is Fluendo MPEG Demuxer plugin.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Fluendo, S.L.
|
||||
* Portions created by Fluendo, S.L. are Copyright (C) 2005
|
||||
* Fluendo, S.L. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Wim Taymans <wim@fluendo.com>
|
||||
*/
|
||||
|
||||
#ifndef __GST_SECTION_FILTER_H__
|
||||
#define __GST_SECTION_FILTER_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GstSectionFilter GstSectionFilter;
|
||||
|
||||
struct _GstSectionFilter {
|
||||
GstAdapter *adapter;
|
||||
guint8 last_continuity_counter;
|
||||
guint16 section_length;
|
||||
};
|
||||
|
||||
void gst_section_filter_init (GstSectionFilter *filter);
|
||||
void gst_section_filter_uninit (GstSectionFilter *filter);
|
||||
gboolean gst_section_filter_push (GstSectionFilter *filter,
|
||||
gboolean pusi,
|
||||
guint8 continuity_counter,
|
||||
GstBuffer *buf);
|
||||
void gst_section_filter_clear (GstSectionFilter *filter);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_SECTION_FILTER_H__ */
|
File diff suppressed because it is too large
Load diff
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* mpegtspacketizer.h -
|
||||
* Copyright (C) 2007 Alessandro Decina
|
||||
*
|
||||
* Authors:
|
||||
* Alessandro Decina <alessandro@nnva.org>
|
||||
*
|
||||
* 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_MPEGTS_PACKETIZER_H
|
||||
#define GST_MPEGTS_PACKETIZER_H
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
#include <glib.h>
|
||||
|
||||
#define MPEGTS_NORMAL_PACKETSIZE 188
|
||||
#define MPEGTS_M2TS_PACKETSIZE 192
|
||||
#define MPEGTS_DVB_ASI_PACKETSIZE 204
|
||||
#define MPEGTS_ATSC_PACKETSIZE 208
|
||||
|
||||
#define MPEGTS_MIN_PACKETSIZE MPEGTS_NORMAL_PACKETSIZE
|
||||
#define MPEGTS_MAX_PACKETSIZE MPEGTS_ATSC_PACKETSIZE
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MPEGTS_PACKETIZER \
|
||||
(mpegts_packetizer_get_type())
|
||||
#define GST_MPEGTS_PACKETIZER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEGTS_PACKETIZER,MpegTSPacketizer))
|
||||
#define GST_MPEGTS_PACKETIZER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEGTS_PACKETIZER,MpegTSPacketizerClass))
|
||||
#define GST_IS_MPEGTS_PACKETIZER(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEGTS_PACKETIZER))
|
||||
#define GST_IS_MPEGTS_PACKETIZER_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEGTS_PACKETIZER))
|
||||
|
||||
|
||||
typedef struct _MpegTSPacketizer MpegTSPacketizer;
|
||||
typedef struct _MpegTSPacketizerClass MpegTSPacketizerClass;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint continuity_counter;
|
||||
GstAdapter *section_adapter;
|
||||
guint8 section_table_id;
|
||||
guint section_length;
|
||||
GSList *subtables;
|
||||
} MpegTSPacketizerStream;
|
||||
|
||||
struct _MpegTSPacketizer {
|
||||
GObject object;
|
||||
|
||||
GstAdapter *adapter;
|
||||
/* streams hashed by pid */
|
||||
MpegTSPacketizerStream **streams;
|
||||
gboolean disposed;
|
||||
gboolean know_packet_size;
|
||||
guint16 packet_size;
|
||||
GstCaps *caps;
|
||||
};
|
||||
|
||||
struct _MpegTSPacketizerClass {
|
||||
GObjectClass object_class;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GstBuffer *buffer;
|
||||
gint16 pid;
|
||||
guint8 payload_unit_start_indicator;
|
||||
guint8 adaptation_field_control;
|
||||
guint8 continuity_counter;
|
||||
guint8 *payload;
|
||||
|
||||
guint8 *data_start;
|
||||
guint8 *data_end;
|
||||
guint8 *data;
|
||||
|
||||
} MpegTSPacketizerPacket;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gboolean complete;
|
||||
GstBuffer *buffer;
|
||||
gint16 pid;
|
||||
guint8 table_id;
|
||||
guint16 subtable_extension;
|
||||
guint section_length;
|
||||
guint8 version_number;
|
||||
guint8 current_next_indicator;
|
||||
guint32 crc;
|
||||
} MpegTSPacketizerSection;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint8 table_id;
|
||||
/* the spec says sub_table_extension is the fourth and fifth byte of a
|
||||
* section when the section_syntax_indicator is set to a value of "1". If
|
||||
* section_syntax_indicator is 0, sub_table_extension will be set to 0 */
|
||||
guint16 subtable_extension;
|
||||
guint8 version_number;
|
||||
guint32 crc;
|
||||
} MpegTSPacketizerStreamSubtable;
|
||||
|
||||
typedef enum {
|
||||
PACKET_BAD = FALSE,
|
||||
PACKET_OK = TRUE,
|
||||
PACKET_NEED_MORE
|
||||
} MpegTSPacketizerPacketReturn;
|
||||
|
||||
GType mpegts_packetizer_get_type(void);
|
||||
|
||||
MpegTSPacketizer *mpegts_packetizer_new (void);
|
||||
void mpegts_packetizer_clear (MpegTSPacketizer *packetizer);
|
||||
void mpegts_packetizer_push (MpegTSPacketizer *packetizer, GstBuffer *buffer);
|
||||
gboolean mpegts_packetizer_has_packets (MpegTSPacketizer *packetizer);
|
||||
MpegTSPacketizerPacketReturn mpegts_packetizer_next_packet (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerPacket *packet);
|
||||
void mpegts_packetizer_clear_packet (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerPacket *packet);
|
||||
void mpegts_packetizer_remove_stream(MpegTSPacketizer *packetizer,
|
||||
gint16 pid);
|
||||
|
||||
gboolean mpegts_packetizer_push_section (MpegTSPacketizer *packetzer,
|
||||
MpegTSPacketizerPacket *packet, MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_pat (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_pmt (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_nit (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_sdt (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_eit (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
GstStructure *mpegts_packetizer_parse_tdt (MpegTSPacketizer *packetizer,
|
||||
MpegTSPacketizerSection *section);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_MPEGTS_PACKETIZER_H */
|
File diff suppressed because it is too large
Load diff
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* mpegts_parse.h - GStreamer MPEG transport stream parser
|
||||
* Copyright (C) 2007 Alessandro Decina
|
||||
*
|
||||
* Authors:
|
||||
* Alessandro Decina <alessandro@nnva.org>
|
||||
*
|
||||
* 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_TS_PARSE_H
|
||||
#define GST_MPEG_TS_PARSE_H
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include "mpegtspacketizer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_MPEGTS_PARSE \
|
||||
(mpegts_parse_get_type())
|
||||
#define GST_MPEGTS_PARSE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MPEGTS_PARSE,MpegTSParse))
|
||||
#define GST_MPEGTS_PARSE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MPEGTS_PARSE,MpegTSParseClass))
|
||||
#define GST_IS_MPEGTS_PARSE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MPEGTS_PARSE))
|
||||
#define GST_IS_MPEGTS_PARSE_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEGTS_PARSE))
|
||||
|
||||
typedef struct _MpegTSParse MpegTSParse;
|
||||
typedef struct _MpegTSParseClass MpegTSParseClass;
|
||||
|
||||
struct _MpegTSParse {
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
|
||||
/* the following vars must be protected with the OBJECT_LOCK as they can be
|
||||
* accessed from the application thread and the streaming thread */
|
||||
gchar *program_numbers;
|
||||
GList *pads_to_add;
|
||||
GList *pads_to_remove;
|
||||
GHashTable *programs;
|
||||
guint req_pads;
|
||||
|
||||
GstStructure *pat;
|
||||
MpegTSPacketizer *packetizer;
|
||||
GHashTable *psi_pids;
|
||||
GHashTable *pes_pids;
|
||||
gboolean disposed;
|
||||
gboolean need_sync_program_pads;
|
||||
};
|
||||
|
||||
struct _MpegTSParseClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*pat_info) (GstStructure *pat);
|
||||
void (*pmt_info) (GstStructure *pmt);
|
||||
void (*nit_info) (GstStructure *nit);
|
||||
void (*sdt_info) (GstStructure *sdt);
|
||||
void (*eit_info) (GstStructure *eit);
|
||||
};
|
||||
|
||||
GType mpegts_parse_get_type(void);
|
||||
|
||||
gboolean gst_mpegtsparse_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_MPEG_TS_PARSE_H */
|
Loading…
Reference in a new issue