LCOV - code coverage report
Current view: top level - gst/mpegdemux - flutspmtstreaminfo.c (source / functions) Hit Total Coverage
Test: GStreamer Bad Plug-ins 0.10.21.1 Lines: 0 60 0.0 %
Date: 2011-03-25 Functions: 0 11 0.0 %
Branches: 0 39 0.0 %

           Branch data     Line data    Source code
       1                 :            :  /*
       2                 :            :   * This library is licensed under 2 different licenses and you
       3                 :            :   * can choose to use it under the terms of either one of them. The
       4                 :            :   * two licenses are the MPL 1.1 and the LGPL.
       5                 :            :   *
       6                 :            :   * MPL:
       7                 :            :   *
       8                 :            :   * The contents of this file are subject to the Mozilla Public License
       9                 :            :   * Version 1.1 (the "License"); you may not use this file except in
      10                 :            :   * compliance with the License. You may obtain a copy of the License at
      11                 :            :   * http://www.mozilla.org/MPL/.
      12                 :            :   *
      13                 :            :   * Software distributed under the License is distributed on an "AS IS"
      14                 :            :   * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
      15                 :            :   * License for the specific language governing rights and limitations
      16                 :            :   * under the License.
      17                 :            :   *
      18                 :            :   * LGPL:
      19                 :            :   *
      20                 :            :   * This library is free software; you can redistribute it and/or
      21                 :            :   * modify it under the terms of the GNU Library General Public
      22                 :            :   * License as published by the Free Software Foundation; either
      23                 :            :   * version 2 of the License, or (at your option) any later version.
      24                 :            :   *
      25                 :            :   * This library is distributed in the hope that it will be useful,
      26                 :            :   * but WITHOUT ANY WARRANTY; without even the implied warranty of
      27                 :            :   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      28                 :            :   * Library General Public License for more details.
      29                 :            :   *
      30                 :            :   * You should have received a copy of the GNU Library General Public
      31                 :            :   * License along with this library; if not, write to the
      32                 :            :   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      33                 :            :   * Boston, MA 02111-1307, USA.
      34                 :            :   *
      35                 :            :   * The Original Code is Fluendo MPEG Demuxer plugin.
      36                 :            :   *
      37                 :            :   * The Initial Developer of the Original Code is Fluendo, S.L.
      38                 :            :   * Portions created by Fluendo, S.L. are Copyright (C) 2005
      39                 :            :   * Fluendo, S.L. All Rights Reserved.
      40                 :            :   *
      41                 :            :   * Contributor(s): Jan Schmidt <jan@fluendo.com>
      42                 :            :   */
      43                 :            : 
      44                 :            : #ifdef HAVE_CONFIG_H
      45                 :            : #include "config.h"
      46                 :            : #endif
      47                 :            : 
      48                 :            : #include <gst/gst.h>
      49                 :            : 
      50                 :            : #include "flutspmtstreaminfo.h"
      51                 :            : 
      52                 :            : enum
      53                 :            : {
      54                 :            :   PROP_0,
      55                 :            :   PROP_PID,
      56                 :            :   PROP_LANGUAGES,
      57                 :            :   PROP_STREAM_TYPE,
      58                 :            :   PROP_DESCRIPTORS,
      59                 :            : };
      60                 :            : 
      61         [ #  # ]:          0 : GST_BOILERPLATE (MpegTsPmtStreamInfo, mpegts_pmt_stream_info, GObject,
      62                 :          0 :     G_TYPE_OBJECT);
      63                 :            : 
      64                 :            : static void mpegts_pmt_stream_info_set_property (GObject * object,
      65                 :            :     guint prop_id, const GValue * value, GParamSpec * spec);
      66                 :            : static void mpegts_pmt_stream_info_get_property (GObject * object,
      67                 :            :     guint prop_id, GValue * value, GParamSpec * spec);
      68                 :            : static void mpegts_pmt_stream_info_finalize (GObject * object);
      69                 :            : 
      70                 :            : static void
      71                 :          0 : mpegts_pmt_stream_info_base_init (gpointer klass)
      72                 :            : {
      73                 :          0 : }
      74                 :            : 
      75                 :            : static void
      76                 :          0 : mpegts_pmt_stream_info_class_init (MpegTsPmtStreamInfoClass * klass)
      77                 :            : {
      78                 :          0 :   GObjectClass *gobject_klass = (GObjectClass *) klass;
      79                 :            : 
      80                 :          0 :   gobject_klass->set_property = mpegts_pmt_stream_info_set_property;
      81                 :          0 :   gobject_klass->get_property = mpegts_pmt_stream_info_get_property;
      82                 :          0 :   gobject_klass->finalize = mpegts_pmt_stream_info_finalize;
      83                 :            : 
      84                 :          0 :   g_object_class_install_property (gobject_klass, PROP_PID,
      85                 :            :       g_param_spec_uint ("pid", "PID carrying this stream",
      86                 :            :           "PID which carries this stream", 1, G_MAXUINT16, 1,
      87                 :            :           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
      88                 :          0 :   g_object_class_install_property (gobject_klass, PROP_LANGUAGES,
      89                 :            :       g_param_spec_value_array ("languages", "Languages of this stream",
      90                 :            :           "Value array of the languages of this stream",
      91                 :            :           g_param_spec_string ("language", "language", "language", "",
      92                 :            :               G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
      93                 :            :           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
      94                 :            : 
      95                 :          0 :   g_object_class_install_property (gobject_klass, PROP_STREAM_TYPE,
      96                 :            :       g_param_spec_uint ("stream-type",
      97                 :            :           "Stream type", "Stream type", 0, G_MAXUINT8, 0,
      98                 :            :           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
      99                 :            : 
     100                 :          0 :   g_object_class_install_property (gobject_klass, PROP_DESCRIPTORS,
     101                 :            :       g_param_spec_value_array ("descriptors",
     102                 :            :           "Descriptors",
     103                 :            :           "Value array of strings containing stream descriptors",
     104                 :            :           g_param_spec_boxed ("descriptor",
     105                 :            :               "descriptor",
     106                 :            :               "", G_TYPE_GSTRING, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS),
     107                 :            :           G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
     108                 :          0 : }
     109                 :            : 
     110                 :            : static void
     111                 :          0 : mpegts_pmt_stream_info_init (MpegTsPmtStreamInfo * pmt_stream_info,
     112                 :            :     MpegTsPmtStreamInfoClass * klass)
     113                 :            : {
     114                 :          0 :   pmt_stream_info->languages = g_value_array_new (0);
     115                 :          0 :   pmt_stream_info->descriptors = g_value_array_new (0);
     116                 :          0 : }
     117                 :            : 
     118                 :            : static void
     119                 :          0 : mpegts_pmt_stream_info_finalize (GObject * object)
     120                 :            : {
     121                 :          0 :   MpegTsPmtStreamInfo *info = MPEGTS_PMT_STREAM_INFO (object);
     122                 :            : 
     123                 :          0 :   g_value_array_free (info->languages);
     124                 :          0 :   g_value_array_free (info->descriptors);
     125                 :          0 : }
     126                 :            : 
     127                 :            : MpegTsPmtStreamInfo *
     128                 :          0 : mpegts_pmt_stream_info_new (guint16 pid, guint8 type)
     129                 :            : {
     130                 :            :   MpegTsPmtStreamInfo *info;
     131                 :          0 :   info = g_object_new (MPEGTS_TYPE_PMT_STREAM_INFO, NULL);
     132                 :            : 
     133                 :          0 :   info->pid = pid;
     134                 :          0 :   info->stream_type = type;
     135                 :          0 :   return info;
     136                 :            : }
     137                 :            : 
     138                 :            : void
     139                 :          0 : mpegts_pmt_stream_info_add_language (MpegTsPmtStreamInfo * pmt_info,
     140                 :            :     gchar * language)
     141                 :            : {
     142                 :          0 :   GValue v = { 0, };
     143                 :            : 
     144 [ #  # ][ #  # ]:          0 :   g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (pmt_info));
         [ #  # ][ #  # ]
     145                 :            : 
     146                 :          0 :   g_value_init (&v, G_TYPE_STRING);
     147                 :          0 :   g_value_take_string (&v, language);
     148                 :          0 :   g_value_array_append (pmt_info->languages, &v);
     149                 :          0 :   g_value_unset (&v);
     150                 :            : }
     151                 :            : 
     152                 :            : void
     153                 :          0 : mpegts_pmt_stream_info_add_descriptor (MpegTsPmtStreamInfo * pmt_info,
     154                 :            :     const gchar * descriptor, guint length)
     155                 :            : {
     156                 :          0 :   GValue value = { 0 };
     157                 :            :   GString *string;
     158                 :            : 
     159 [ #  # ][ #  # ]:          0 :   g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (pmt_info));
         [ #  # ][ #  # ]
     160                 :            : 
     161                 :          0 :   string = g_string_new_len (descriptor, length);
     162                 :            : 
     163                 :          0 :   g_value_init (&value, G_TYPE_GSTRING);
     164                 :          0 :   g_value_take_boxed (&value, string);
     165                 :          0 :   g_value_array_append (pmt_info->descriptors, &value);
     166                 :          0 :   g_value_unset (&value);
     167                 :            : }
     168                 :            : 
     169                 :            : static void
     170                 :          0 : mpegts_pmt_stream_info_set_property (GObject * object, guint prop_id,
     171                 :            :     const GValue * value, GParamSpec * spec)
     172                 :            : {
     173 [ #  # ][ #  # ]:          0 :   g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (object));
         [ #  # ][ #  # ]
     174                 :            : 
     175                 :            :   /* No settable properties */
     176                 :          0 :   G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
     177                 :            : }
     178                 :            : 
     179                 :            : static void
     180                 :          0 : mpegts_pmt_stream_info_get_property (GObject * object, guint prop_id,
     181                 :            :     GValue * value, GParamSpec * spec)
     182                 :            : {
     183                 :            :   MpegTsPmtStreamInfo *si;
     184                 :            : 
     185 [ #  # ][ #  # ]:          0 :   g_return_if_fail (MPEGTS_IS_PMT_STREAM_INFO (object));
         [ #  # ][ #  # ]
     186                 :            : 
     187                 :          0 :   si = MPEGTS_PMT_STREAM_INFO (object);
     188                 :            : 
     189   [ #  #  #  #  :          0 :   switch (prop_id) {
                      # ]
     190                 :            :     case PROP_STREAM_TYPE:
     191                 :          0 :       g_value_set_uint (value, si->stream_type);
     192                 :          0 :       break;
     193                 :            :     case PROP_PID:
     194                 :          0 :       g_value_set_uint (value, si->pid);
     195                 :          0 :       break;
     196                 :            :     case PROP_LANGUAGES:
     197                 :          0 :       g_value_set_boxed (value, si->languages);
     198                 :          0 :       break;
     199                 :            :     case PROP_DESCRIPTORS:
     200                 :          0 :       g_value_set_boxed (value, si->descriptors);
     201                 :          0 :       break;
     202                 :            :     default:
     203                 :          0 :       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
     204                 :          0 :       break;
     205                 :            :   }
     206                 :            : }

Generated by: LCOV version 1.9