]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blob - src/gstducati.c
ducati: rework debug bit logging for extensibility
[glsdk/gst-plugin-ducati.git] / src / gstducati.c
1 /*
2  * GStreamer
3  * Copyright (c) 2010, Texas Instruments Incorporated
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation
8  * version 2.1 of the License.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18  */
20 #ifdef HAVE_CONFIG_H
21 #  include <config.h>
22 #endif
24 #include "gstducati.h"
25 #include "gstducatih264dec.h"
26 #include "gstducatimpeg4dec.h"
27 #include "gstducatimpeg2dec.h"
28 #include "gstducativc1dec.h"
29 #include "gstducativp6dec.h"
30 #include "gstducativp7dec.h"
31 #include "gstducatirvdec.h"
32 #include "gstducatih264enc.h"
33 #include "gstducatimpeg4enc.h"
35 GST_DEBUG_CATEGORY (gst_ducati_debug);
37 void
38 gst_ducati_set_generic_error_strings (const char *strings[])
39 {
40 #ifndef GST_DISABLE_GST_DEBUG
41   strings[XDM_PARAMSCHANGE] = "sequence parameters change";
42   strings[XDM_APPLIEDCONCEALMENT] = "applied concealment";
43   strings[XDM_INSUFFICIENTDATA] = "insufficient data";
44   strings[XDM_CORRUPTEDDATA] = "corrupted data";
45   strings[XDM_CORRUPTEDHEADER] = "corrupted header";
46   strings[XDM_UNSUPPORTEDINPUT] = "unsupported input";
47   strings[XDM_UNSUPPORTEDPARAM] = "unsupported param";
48   strings[XDM_FATALERROR] = "fatal";
49 #endif
50 }
52 #ifndef GST_DISABLE_GST_DEBUG
53 void
54 gst_ducati_log_extended_error_info (uint32_t error, const char *strings[])
55 {
56   int bit = 0;
57   while (error) {
58     if (error & 1) {
59       GST_ERROR ("Bit %d (%08x): %s", bit, 1 << bit,
60           strings[bit] ? strings[bit] : "unknown");
61     }
62     error >>= 1;
63     ++bit;
64   }
65 }
66 #endif
68 static gboolean
69 plugin_init (GstPlugin * plugin)
70 {
71   GST_DEBUG_CATEGORY_INIT (gst_ducati_debug, "ducati", 0, "ducati");
73   /* TODO .. find some way to reasonably detect if the corresponding
74    * codecs are actually available..
75    */
76   return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY,
77       GST_TYPE_DUCATIH264DEC) &&
78       gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY,
79       GST_TYPE_DUCATIMPEG4DEC) &&
80       gst_element_register (plugin, "ducatimpeg2dec", GST_RANK_PRIMARY,
81       GST_TYPE_DUCATIMPEG2DEC) &&
82       gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY,
83       GST_TYPE_DUCATIVC1DEC) &&
84       gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY,
85       GST_TYPE_DUCATIVP6DEC) &&
86       gst_element_register (plugin, "ducativp7dec", GST_RANK_PRIMARY,
87       GST_TYPE_DUCATIVP7DEC) &&
88       gst_element_register (plugin, "ducatirvdec", GST_RANK_PRIMARY,
89       GST_TYPE_DUCATIRVDEC) &&
90       gst_element_register (plugin, "ducatih264enc", GST_RANK_PRIMARY + 1,
91       GST_TYPE_DUCATIH264ENC) &&
92       gst_element_register (plugin, "ducatimpeg4enc", GST_RANK_PRIMARY + 1,
93       GST_TYPE_DUCATIMPEG4ENC);
94 }
96 /* PACKAGE: this is usually set by autotools depending on some _INIT macro
97  * in configure.ac and then written into and defined in config.h, but we can
98  * just set it ourselves here in case someone doesn't use autotools to
99  * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
100  */
101 #ifndef PACKAGE
102 #  define PACKAGE "ducati"
103 #endif
105 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, "ducati",
106     "Hardware accelerated codecs for OMAP4",
107     plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")