QtGStreamer 0.10.1
|
00001 /* 00002 Copyright (C) 2010 George Kiagiadakis <kiagiadakis.george@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as published 00006 by the Free Software Foundation; either version 2.1 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #include "propertyprobe.h" 00018 #include <gst/interfaces/propertyprobe.h> 00019 00020 namespace QGst { 00021 00022 QList<QGlib::ParamSpecPtr> PropertyProbe::properties() const 00023 { 00024 QList<QGlib::ParamSpecPtr> result; 00025 const GList *list = gst_property_probe_get_properties(object<GstPropertyProbe>()); 00026 while(list) { 00027 result.append(QGlib::ParamSpecPtr::wrap(G_PARAM_SPEC(list->data))); 00028 list = list->next; 00029 } 00030 return result; 00031 } 00032 00033 bool PropertyProbe::propertySupportsProbe(const QGlib::ParamSpecPtr & property) const 00034 { 00035 const GList *list = gst_property_probe_get_properties(object<GstPropertyProbe>()); 00036 while(list) { 00037 GParamSpec *param = G_PARAM_SPEC(list->data); 00038 if (param == property) { 00039 return true; 00040 } 00041 list = list->next; 00042 } 00043 return false; 00044 } 00045 00046 bool PropertyProbe::propertySupportsProbe(const char *property) const 00047 { 00048 const GParamSpec *param = gst_property_probe_get_property(object<GstPropertyProbe>(), property); 00049 return param != NULL; 00050 } 00051 00052 bool PropertyProbe::needsProbe(const QGlib::ParamSpecPtr & property) const 00053 { 00054 return gst_property_probe_needs_probe(object<GstPropertyProbe>(), property); 00055 } 00056 00057 bool PropertyProbe::needsProbe(const char *property) const 00058 { 00059 return gst_property_probe_needs_probe_name(object<GstPropertyProbe>(), property); 00060 } 00061 00062 void PropertyProbe::probe(const QGlib::ParamSpecPtr & property) 00063 { 00064 gst_property_probe_probe_property(object<GstPropertyProbe>(), property); 00065 } 00066 00067 void PropertyProbe::probe(const char *property) 00068 { 00069 gst_property_probe_probe_property_name(object<GstPropertyProbe>(), property); 00070 } 00071 00072 static QList<QGlib::Value> valueArrayToList(GValueArray *array) 00073 { 00074 QList<QGlib::Value> result; 00075 if (array) { 00076 for(uint i = 0; i < array->n_values; ++i) { 00077 const GValue *v = g_value_array_get_nth(array, i); 00078 result.append(QGlib::Value(v)); 00079 } 00080 g_value_array_free(array); 00081 } 00082 return result; 00083 } 00084 00085 QList<QGlib::Value> PropertyProbe::values(const QGlib::ParamSpecPtr & property) const 00086 { 00087 GValueArray *array = gst_property_probe_get_values(object<GstPropertyProbe>(), property); 00088 return valueArrayToList(array); 00089 } 00090 00091 QList<QGlib::Value> PropertyProbe::values(const char *property) const 00092 { 00093 GValueArray *array = gst_property_probe_get_values_name(object<GstPropertyProbe>(), property); 00094 return valueArrayToList(array); 00095 } 00096 00097 QList<QGlib::Value> PropertyProbe::probeAndGetValues(const QGlib::ParamSpecPtr & property) 00098 { 00099 GValueArray *array = gst_property_probe_probe_and_get_values(object<GstPropertyProbe>(), property); 00100 return valueArrayToList(array); 00101 } 00102 00103 QList<QGlib::Value> PropertyProbe::probeAndGetValues(const char *property) 00104 { 00105 GValueArray *array = gst_property_probe_probe_and_get_values_name(object<GstPropertyProbe>(), property); 00106 return valueArrayToList(array); 00107 } 00108 00109 }