branch | RCL_3 |
changeset 29 | 567bb019e3e3 |
parent 0 | 0e761a78d257 |
child 30 | 7e817e7e631c |
6:9b2c3c7a1a9c | 29:567bb019e3e3 |
---|---|
63 #include "gstinfo.h" |
63 #include "gstinfo.h" |
64 #include "gstquery.h" |
64 #include "gstquery.h" |
65 #include "gstvalue.h" |
65 #include "gstvalue.h" |
66 #include "gstenumtypes.h" |
66 #include "gstenumtypes.h" |
67 #include "gstquark.h" |
67 #include "gstquark.h" |
68 |
68 #include "gsturi.h" |
69 #ifdef __SYMBIAN32__ |
69 #ifdef __SYMBIAN32__ |
70 #include <glib_global.h> |
70 #include <glib_global.h> |
71 #endif |
71 #endif |
72 |
72 |
73 GST_DEBUG_CATEGORY_STATIC (gst_query_debug); |
73 GST_DEBUG_CATEGORY_STATIC (gst_query_debug); |
74 #define GST_CAT_DEFAULT gst_query_debug |
74 #define GST_CAT_DEFAULT gst_query_debug |
75 |
75 |
76 static void gst_query_class_init (gpointer g_class, gpointer class_data); |
|
77 static void gst_query_finalize (GstQuery * query); |
76 static void gst_query_finalize (GstQuery * query); |
78 static GstQuery *_gst_query_copy (GstQuery * query); |
77 static GstQuery *_gst_query_copy (GstQuery * query); |
79 |
78 |
80 static GStaticMutex mutex = G_STATIC_MUTEX_INIT; |
79 static GStaticMutex mutex = G_STATIC_MUTEX_INIT; |
81 static GList *_gst_queries = NULL; |
80 static GList *_gst_queries = NULL; |
93 {GST_QUERY_RATE, "rate", "Configured rate 1000000 = 1", 0}, |
92 {GST_QUERY_RATE, "rate", "Configured rate 1000000 = 1", 0}, |
94 {GST_QUERY_SEEKING, "seeking", "Seeking capabilities and parameters", 0}, |
93 {GST_QUERY_SEEKING, "seeking", "Seeking capabilities and parameters", 0}, |
95 {GST_QUERY_SEGMENT, "segment", "currently configured segment", 0}, |
94 {GST_QUERY_SEGMENT, "segment", "currently configured segment", 0}, |
96 {GST_QUERY_CONVERT, "convert", "Converting between formats", 0}, |
95 {GST_QUERY_CONVERT, "convert", "Converting between formats", 0}, |
97 {GST_QUERY_FORMATS, "formats", "Supported formats for conversion", 0}, |
96 {GST_QUERY_FORMATS, "formats", "Supported formats for conversion", 0}, |
97 {GST_QUERY_BUFFERING, "buffering", "Buffering status", 0}, |
|
98 {GST_QUERY_CUSTOM, "custom", "Custom query", 0}, |
|
99 {GST_QUERY_URI, "uri", "URI of the source or sink", 0}, |
|
98 {0, NULL, NULL, 0} |
100 {0, NULL, NULL, 0} |
99 }; |
101 }; |
100 #ifdef __SYMBIAN32__ |
102 #ifdef __SYMBIAN32__ |
101 EXPORT_C |
103 EXPORT_C |
102 #endif |
104 #endif |
173 |
175 |
174 def = gst_query_type_get_details (query); |
176 def = gst_query_type_get_details (query); |
175 |
177 |
176 return def->quark; |
178 return def->quark; |
177 } |
179 } |
178 #ifdef __SYMBIAN32__ |
180 |
179 EXPORT_C |
181 G_DEFINE_TYPE (GstQuery, gst_query, GST_TYPE_MINI_OBJECT); |
180 #endif |
|
181 |
|
182 |
|
183 GType |
|
184 gst_query_get_type (void) |
|
185 { |
|
186 static GType _gst_query_type; |
|
187 |
|
188 if (G_UNLIKELY (_gst_query_type == 0)) { |
|
189 static const GTypeInfo query_info = { |
|
190 sizeof (GstQueryClass), |
|
191 NULL, |
|
192 NULL, |
|
193 gst_query_class_init, |
|
194 NULL, |
|
195 NULL, |
|
196 sizeof (GstQuery), |
|
197 0, |
|
198 NULL, |
|
199 NULL |
|
200 }; |
|
201 |
|
202 _gst_query_type = g_type_register_static (GST_TYPE_MINI_OBJECT, |
|
203 "GstQuery", &query_info, 0); |
|
204 } |
|
205 return _gst_query_type; |
|
206 } |
|
207 |
182 |
208 static void |
183 static void |
209 gst_query_class_init (gpointer g_class, gpointer class_data) |
184 gst_query_class_init (GstQueryClass * klass) |
210 { |
185 { |
211 GstQueryClass *query_class = GST_QUERY_CLASS (g_class); |
186 parent_class = g_type_class_peek_parent (klass); |
212 |
187 |
213 parent_class = g_type_class_peek_parent (g_class); |
188 klass->mini_object_class.copy = (GstMiniObjectCopyFunction) _gst_query_copy; |
214 |
189 klass->mini_object_class.finalize = |
215 query_class->mini_object_class.copy = |
|
216 (GstMiniObjectCopyFunction) _gst_query_copy; |
|
217 query_class->mini_object_class.finalize = |
|
218 (GstMiniObjectFinalizeFunction) gst_query_finalize; |
190 (GstMiniObjectFinalizeFunction) gst_query_finalize; |
219 |
191 |
192 } |
|
193 |
|
194 static void |
|
195 gst_query_init (GstQuery * query) |
|
196 { |
|
220 } |
197 } |
221 |
198 |
222 static void |
199 static void |
223 gst_query_finalize (GstQuery * query) |
200 gst_query_finalize (GstQuery * query) |
224 { |
201 { |
227 if (query->structure) { |
204 if (query->structure) { |
228 gst_structure_set_parent_refcount (query->structure, NULL); |
205 gst_structure_set_parent_refcount (query->structure, NULL); |
229 gst_structure_free (query->structure); |
206 gst_structure_free (query->structure); |
230 } |
207 } |
231 |
208 |
232 GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (query)); |
209 /* GST_MINI_OBJECT_CLASS (parent_class)->finalize (GST_MINI_OBJECT (query)); */ |
233 } |
210 } |
234 |
211 |
235 static GstQuery * |
212 static GstQuery * |
236 _gst_query_copy (GstQuery * query) |
213 _gst_query_copy (GstQuery * query) |
237 { |
214 { |
447 gst_query_new_position (GstFormat format) |
424 gst_query_new_position (GstFormat format) |
448 { |
425 { |
449 GstQuery *query; |
426 GstQuery *query; |
450 GstStructure *structure; |
427 GstStructure *structure; |
451 |
428 |
452 structure = gst_structure_empty_new ("GstQueryPosition"); |
429 structure = gst_structure_id_new (GST_QUARK (QUERY_POSITION), |
453 gst_structure_id_set (structure, |
|
454 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
430 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
455 GST_QUARK (CURRENT), G_TYPE_INT64, (gint64) - 1, NULL); |
431 GST_QUARK (CURRENT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
456 |
432 |
457 query = gst_query_new (GST_QUERY_POSITION, structure); |
433 query = gst_query_new (GST_QUERY_POSITION, structure); |
458 |
434 |
459 return query; |
435 return query; |
460 } |
436 } |
532 gst_query_new_duration (GstFormat format) |
508 gst_query_new_duration (GstFormat format) |
533 { |
509 { |
534 GstQuery *query; |
510 GstQuery *query; |
535 GstStructure *structure; |
511 GstStructure *structure; |
536 |
512 |
537 structure = gst_structure_empty_new ("GstQueryDuration"); |
513 structure = gst_structure_id_new (GST_QUARK (QUERY_DURATION), |
538 gst_structure_id_set (structure, |
|
539 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
514 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
540 GST_QUARK (DURATION), G_TYPE_INT64, (gint64) - 1, NULL); |
515 GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
541 |
516 |
542 query = gst_query_new (GST_QUERY_DURATION, structure); |
517 query = gst_query_new (GST_QUERY_DURATION, structure); |
543 |
518 |
544 return query; |
519 return query; |
545 } |
520 } |
619 gst_query_new_latency (void) |
594 gst_query_new_latency (void) |
620 { |
595 { |
621 GstQuery *query; |
596 GstQuery *query; |
622 GstStructure *structure; |
597 GstStructure *structure; |
623 |
598 |
624 structure = gst_structure_empty_new ("GstQueryLatency"); |
599 structure = gst_structure_id_new (GST_QUARK (QUERY_LATENCY), |
625 gst_structure_set (structure, |
600 GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE, |
626 "live", G_TYPE_BOOLEAN, FALSE, |
601 GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0), |
627 "min-latency", G_TYPE_UINT64, (gint64) 0, |
602 GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL); |
628 "max-latency", G_TYPE_UINT64, (gint64) - 1, NULL); |
|
629 |
603 |
630 query = gst_query_new (GST_QUERY_LATENCY, structure); |
604 query = gst_query_new (GST_QUERY_LATENCY, structure); |
631 |
605 |
632 return query; |
606 return query; |
633 } |
607 } |
654 GstStructure *structure; |
628 GstStructure *structure; |
655 |
629 |
656 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY); |
630 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY); |
657 |
631 |
658 structure = gst_query_get_structure (query); |
632 structure = gst_query_get_structure (query); |
659 gst_structure_set (structure, |
633 gst_structure_id_set (structure, |
660 "live", G_TYPE_BOOLEAN, live, |
634 GST_QUARK (LIVE), G_TYPE_BOOLEAN, live, |
661 "min-latency", G_TYPE_UINT64, min_latency, |
635 GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency, |
662 "max-latency", G_TYPE_UINT64, max_latency, NULL); |
636 GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL); |
663 } |
637 } |
664 |
638 |
665 /** |
639 /** |
666 * gst_query_parse_latency: |
640 * gst_query_parse_latency: |
667 * @query: a #GstQuery |
641 * @query: a #GstQuery |
685 |
659 |
686 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY); |
660 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY); |
687 |
661 |
688 structure = gst_query_get_structure (query); |
662 structure = gst_query_get_structure (query); |
689 if (live) |
663 if (live) |
690 *live = g_value_get_boolean (gst_structure_get_value (structure, "live")); |
664 *live = |
665 g_value_get_boolean (gst_structure_id_get_value (structure, |
|
666 GST_QUARK (LIVE))); |
|
691 if (min_latency) |
667 if (min_latency) |
692 *min_latency = g_value_get_uint64 (gst_structure_get_value (structure, |
668 *min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, |
693 "min-latency")); |
669 GST_QUARK (MIN_LATENCY))); |
694 if (max_latency) |
670 if (max_latency) |
695 *max_latency = g_value_get_uint64 (gst_structure_get_value (structure, |
671 *max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure, |
696 "max-latency")); |
672 GST_QUARK (MAX_LATENCY))); |
697 } |
673 } |
698 |
674 |
699 /** |
675 /** |
700 * gst_query_new_convert: |
676 * gst_query_new_convert: |
701 * @src_format: the source #GstFormat for the new query |
677 * @src_format: the source #GstFormat for the new query |
717 GstFormat dest_format) |
693 GstFormat dest_format) |
718 { |
694 { |
719 GstQuery *query; |
695 GstQuery *query; |
720 GstStructure *structure; |
696 GstStructure *structure; |
721 |
697 |
722 g_return_val_if_fail (value >= 0, NULL); |
698 structure = gst_structure_id_new (GST_QUARK (QUERY_CONVERT), |
723 |
|
724 structure = gst_structure_empty_new ("GstQueryConvert"); |
|
725 gst_structure_id_set (structure, |
|
726 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, |
699 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, |
727 GST_QUARK (SRC_VALUE), G_TYPE_INT64, value, |
700 GST_QUARK (SRC_VALUE), G_TYPE_INT64, value, |
728 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, |
701 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, |
729 GST_QUARK (DEST_VALUE), G_TYPE_INT64, (gint64) - 1, NULL); |
702 GST_QUARK (DEST_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
730 |
703 |
731 query = gst_query_new (GST_QUERY_CONVERT, structure); |
704 query = gst_query_new (GST_QUERY_CONVERT, structure); |
732 |
705 |
733 return query; |
706 return query; |
734 } |
707 } |
758 structure = gst_query_get_structure (query); |
731 structure = gst_query_get_structure (query); |
759 gst_structure_id_set (structure, |
732 gst_structure_id_set (structure, |
760 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, |
733 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format, |
761 GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value, |
734 GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value, |
762 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, |
735 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format, |
763 GST_QUARK (DEST_VALUE), G_TYPE_INT64, (gint64) dest_value, NULL); |
736 GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL); |
764 } |
737 } |
765 |
738 |
766 /** |
739 /** |
767 * gst_query_parse_convert: |
740 * gst_query_parse_convert: |
768 * @query: a #GstQuery |
741 * @query: a #GstQuery |
819 gst_query_new_segment (GstFormat format) |
792 gst_query_new_segment (GstFormat format) |
820 { |
793 { |
821 GstQuery *query; |
794 GstQuery *query; |
822 GstStructure *structure; |
795 GstStructure *structure; |
823 |
796 |
824 structure = gst_structure_empty_new ("GstQuerySegment"); |
797 structure = gst_structure_id_new (GST_QUARK (QUERY_SEGMENT), |
825 gst_structure_id_set (structure, |
|
826 GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0, |
798 GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0, |
827 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
799 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
828 GST_QUARK (START_VALUE), G_TYPE_INT64, (gint64) - 1, |
800 GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), |
829 GST_QUARK (STOP_VALUE), G_TYPE_INT64, (gint64) - 1, NULL); |
801 GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
830 |
802 |
831 query = gst_query_new (GST_QUERY_SEGMENT, structure); |
803 query = gst_query_new (GST_QUERY_SEGMENT, structure); |
832 |
804 |
833 return query; |
805 return query; |
834 } |
806 } |
956 |
928 |
957 return query->structure; |
929 return query->structure; |
958 } |
930 } |
959 |
931 |
960 /** |
932 /** |
961 * gst_query_new_seeking (GstFormat *format) |
933 * gst_query_new_seeking: |
962 * @format: the default #GstFormat for the new query |
934 * @format: the default #GstFormat for the new query |
963 * |
935 * |
964 * Constructs a new query object for querying seeking properties of |
936 * Constructs a new query object for querying seeking properties of |
965 * the stream. |
937 * the stream. |
966 * |
938 * |
967 * Returns: A #GstQuery |
939 * Returns: A #GstQuery |
968 */ |
940 */ |
969 #ifdef __SYMBIAN32__ |
941 #ifdef __SYMBIAN32__ |
970 EXPORT_C |
942 EXPORT_C |
971 #endif |
943 #endif |
944 |
|
972 GstQuery * |
945 GstQuery * |
973 gst_query_new_seeking (GstFormat format) |
946 gst_query_new_seeking (GstFormat format) |
974 { |
947 { |
975 GstQuery *query; |
948 GstQuery *query; |
976 GstStructure *structure; |
949 GstStructure *structure; |
977 |
950 |
978 structure = gst_structure_empty_new ("GstQuerySeeking"); |
951 structure = gst_structure_id_new (GST_QUARK (QUERY_SEEKING), |
979 gst_structure_id_set (structure, |
|
980 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
952 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
981 GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE, |
953 GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE, |
982 GST_QUARK (SEGMENT_START), G_TYPE_INT64, (gint64) - 1, |
954 GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1), |
983 GST_QUARK (SEGMENT_END), G_TYPE_INT64, (gint64) - 1, NULL); |
955 GST_QUARK (SEGMENT_END), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
984 |
956 |
985 query = gst_query_new (GST_QUERY_SEEKING, structure); |
957 query = gst_query_new (GST_QUERY_SEEKING, structure); |
986 |
958 |
987 return query; |
959 return query; |
988 } |
960 } |
1074 gst_query_new_formats (void) |
1046 gst_query_new_formats (void) |
1075 { |
1047 { |
1076 GstQuery *query; |
1048 GstQuery *query; |
1077 GstStructure *structure; |
1049 GstStructure *structure; |
1078 |
1050 |
1079 structure = gst_structure_new ("GstQueryFormats", NULL); |
1051 structure = gst_structure_id_empty_new (GST_QUARK (QUERY_FORMATS)); |
1080 query = gst_query_new (GST_QUERY_FORMATS, structure); |
1052 query = gst_query_new (GST_QUERY_FORMATS, structure); |
1081 |
1053 |
1082 return query; |
1054 return query; |
1083 } |
1055 } |
1084 |
1056 |
1233 } else |
1205 } else |
1234 *format = GST_FORMAT_UNDEFINED; |
1206 *format = GST_FORMAT_UNDEFINED; |
1235 } |
1207 } |
1236 } |
1208 } |
1237 } |
1209 } |
1210 |
|
1211 /** |
|
1212 * gst_query_new_buffering |
|
1213 * @format: the default #GstFormat for the new query |
|
1214 * |
|
1215 * Constructs a new query object for querying the buffering status of |
|
1216 * a stream. |
|
1217 * |
|
1218 * Returns: A #GstQuery |
|
1219 * |
|
1220 * Since: 0.10.20 |
|
1221 */ |
|
1222 #ifdef __SYMBIAN32__ |
|
1223 EXPORT_C |
|
1224 #endif |
|
1225 |
|
1226 GstQuery * |
|
1227 gst_query_new_buffering (GstFormat format) |
|
1228 { |
|
1229 GstQuery *query; |
|
1230 GstStructure *structure; |
|
1231 |
|
1232 /* by default, we configure the answer as no buffering with a 100% buffering |
|
1233 * progress */ |
|
1234 structure = gst_structure_id_new (GST_QUARK (QUERY_BUFFERING), |
|
1235 GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE, |
|
1236 GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100, |
|
1237 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM, |
|
1238 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1, |
|
1239 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1, |
|
1240 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (0), |
|
1241 GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1), |
|
1242 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1243 GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), |
|
1244 GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL); |
|
1245 |
|
1246 query = gst_query_new (GST_QUERY_BUFFERING, structure); |
|
1247 |
|
1248 return query; |
|
1249 } |
|
1250 |
|
1251 /** |
|
1252 * gst_query_set_buffering_percent |
|
1253 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. |
|
1254 * @busy: if buffering is busy |
|
1255 * @percent: a buffering percent |
|
1256 * |
|
1257 * Set the percentage of buffered data. This is a value between 0 and 100. |
|
1258 * The @busy indicator is %TRUE when the buffering is in progress. |
|
1259 * |
|
1260 * Since: 0.10.20 |
|
1261 */ |
|
1262 #ifdef __SYMBIAN32__ |
|
1263 EXPORT_C |
|
1264 #endif |
|
1265 |
|
1266 void |
|
1267 gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent) |
|
1268 { |
|
1269 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1270 g_return_if_fail (percent >= 0 && percent <= 100); |
|
1271 |
|
1272 gst_structure_id_set (query->structure, |
|
1273 GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy, |
|
1274 GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL); |
|
1275 } |
|
1276 |
|
1277 /** |
|
1278 * gst_query_parse_buffering_percent |
|
1279 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. |
|
1280 * @busy: if buffering is busy |
|
1281 * @percent: a buffering percent |
|
1282 * |
|
1283 * Get the percentage of buffered data. This is a value between 0 and 100. |
|
1284 * The @busy indicator is %TRUE when the buffering is in progress. |
|
1285 * |
|
1286 * Since: 0.10.20 |
|
1287 */ |
|
1288 #ifdef __SYMBIAN32__ |
|
1289 EXPORT_C |
|
1290 #endif |
|
1291 |
|
1292 void |
|
1293 gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy, |
|
1294 gint * percent) |
|
1295 { |
|
1296 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1297 |
|
1298 if (busy) |
|
1299 *busy = g_value_get_boolean (gst_structure_id_get_value (query->structure, |
|
1300 GST_QUARK (BUSY))); |
|
1301 if (percent) |
|
1302 *percent = g_value_get_int (gst_structure_id_get_value (query->structure, |
|
1303 GST_QUARK (BUFFER_PERCENT))); |
|
1304 } |
|
1305 |
|
1306 /** |
|
1307 * gst_query_set_buffering_stats: |
|
1308 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. |
|
1309 * @mode: a buffering mode |
|
1310 * @avg_in: the average input rate |
|
1311 * @avg_out: the average output rate |
|
1312 * @buffering_left: amount of buffering time left |
|
1313 * |
|
1314 * Configures the buffering stats values in @query. |
|
1315 * |
|
1316 * Since: 0.10.20 |
|
1317 */ |
|
1318 #ifdef __SYMBIAN32__ |
|
1319 EXPORT_C |
|
1320 #endif |
|
1321 |
|
1322 void |
|
1323 gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode, |
|
1324 gint avg_in, gint avg_out, gint64 buffering_left) |
|
1325 { |
|
1326 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1327 |
|
1328 gst_structure_id_set (query->structure, |
|
1329 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode, |
|
1330 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in, |
|
1331 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out, |
|
1332 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL); |
|
1333 } |
|
1334 |
|
1335 /** |
|
1336 * gst_query_parse_buffering_stats: |
|
1337 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING. |
|
1338 * @mode: a buffering mode |
|
1339 * @avg_in: the average input rate |
|
1340 * @avg_out: the average output rate |
|
1341 * @buffering_left: amount of buffering time left |
|
1342 * |
|
1343 * Extracts the buffering stats values from @query. |
|
1344 * |
|
1345 * Since: 0.10.20 |
|
1346 */ |
|
1347 #ifdef __SYMBIAN32__ |
|
1348 EXPORT_C |
|
1349 #endif |
|
1350 |
|
1351 void |
|
1352 gst_query_parse_buffering_stats (GstQuery * query, |
|
1353 GstBufferingMode * mode, gint * avg_in, gint * avg_out, |
|
1354 gint64 * buffering_left) |
|
1355 { |
|
1356 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1357 |
|
1358 if (mode) |
|
1359 *mode = g_value_get_enum (gst_structure_id_get_value (query->structure, |
|
1360 GST_QUARK (BUFFERING_MODE))); |
|
1361 if (avg_in) |
|
1362 *avg_in = g_value_get_int (gst_structure_id_get_value (query->structure, |
|
1363 GST_QUARK (AVG_IN_RATE))); |
|
1364 if (avg_out) |
|
1365 *avg_out = g_value_get_int (gst_structure_id_get_value (query->structure, |
|
1366 GST_QUARK (AVG_OUT_RATE))); |
|
1367 if (buffering_left) |
|
1368 *buffering_left = |
|
1369 g_value_get_int64 (gst_structure_id_get_value (query->structure, |
|
1370 GST_QUARK (BUFFERING_LEFT))); |
|
1371 } |
|
1372 |
|
1373 |
|
1374 /** |
|
1375 * gst_query_set_buffering_range: |
|
1376 * @query: a #GstQuery |
|
1377 * @format: the format to set for the @start and @stop values |
|
1378 * @start: the start to set |
|
1379 * @stop: the stop to set |
|
1380 * @estimated_total: estimated total amount of download time |
|
1381 * |
|
1382 * Set the available query result fields in @query. |
|
1383 * |
|
1384 * Since: 0.10.20 |
|
1385 */ |
|
1386 #ifdef __SYMBIAN32__ |
|
1387 EXPORT_C |
|
1388 #endif |
|
1389 |
|
1390 void |
|
1391 gst_query_set_buffering_range (GstQuery * query, GstFormat format, |
|
1392 gint64 start, gint64 stop, gint64 estimated_total) |
|
1393 { |
|
1394 GstStructure *structure; |
|
1395 |
|
1396 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1397 |
|
1398 structure = gst_query_get_structure (query); |
|
1399 gst_structure_id_set (structure, |
|
1400 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format, |
|
1401 GST_QUARK (START_VALUE), G_TYPE_INT64, start, |
|
1402 GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop, |
|
1403 GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL); |
|
1404 } |
|
1405 |
|
1406 /** |
|
1407 * gst_query_parse_buffering_range: |
|
1408 * @query: a GST_QUERY_SEEKING type query #GstQuery |
|
1409 * @format: the format to set for the @segment_start and @segment_end values |
|
1410 * @start: the start to set |
|
1411 * @stop: the stop to set |
|
1412 * @estimated_total: estimated total amount of download time |
|
1413 * |
|
1414 * Parse an available query, writing the format into @format, and |
|
1415 * other results into the passed parameters, if the respective parameters |
|
1416 * are non-NULL |
|
1417 * |
|
1418 * Since: 0.10.20 |
|
1419 */ |
|
1420 #ifdef __SYMBIAN32__ |
|
1421 EXPORT_C |
|
1422 #endif |
|
1423 |
|
1424 void |
|
1425 gst_query_parse_buffering_range (GstQuery * query, GstFormat * format, |
|
1426 gint64 * start, gint64 * stop, gint64 * estimated_total) |
|
1427 { |
|
1428 GstStructure *structure; |
|
1429 |
|
1430 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING); |
|
1431 |
|
1432 structure = gst_query_get_structure (query); |
|
1433 if (format) |
|
1434 *format = g_value_get_enum (gst_structure_id_get_value (structure, |
|
1435 GST_QUARK (FORMAT))); |
|
1436 if (start) |
|
1437 *start = g_value_get_int64 (gst_structure_id_get_value (structure, |
|
1438 GST_QUARK (START_VALUE))); |
|
1439 if (stop) |
|
1440 *stop = g_value_get_int64 (gst_structure_id_get_value (structure, |
|
1441 GST_QUARK (STOP_VALUE))); |
|
1442 if (estimated_total) |
|
1443 *estimated_total = |
|
1444 g_value_get_int64 (gst_structure_id_get_value (structure, |
|
1445 GST_QUARK (ESTIMATED_TOTAL))); |
|
1446 } |
|
1447 |
|
1448 /** |
|
1449 * gst_query_new_uri: |
|
1450 * |
|
1451 * Constructs a new query URI query object. Use gst_query_unref() |
|
1452 * when done with it. An URI query is used to query the current URI |
|
1453 * that is used by the source or sink. |
|
1454 * |
|
1455 * Returns: A #GstQuery |
|
1456 * |
|
1457 * Since: 0.10.22 |
|
1458 */ |
|
1459 #ifdef __SYMBIAN32__ |
|
1460 EXPORT_C |
|
1461 #endif |
|
1462 |
|
1463 GstQuery * |
|
1464 gst_query_new_uri (void) |
|
1465 { |
|
1466 GstQuery *query; |
|
1467 GstStructure *structure; |
|
1468 |
|
1469 structure = gst_structure_id_new (GST_QUARK (QUERY_URI), |
|
1470 GST_QUARK (URI), G_TYPE_STRING, NULL, NULL); |
|
1471 |
|
1472 query = gst_query_new (GST_QUERY_URI, structure); |
|
1473 |
|
1474 return query; |
|
1475 } |
|
1476 |
|
1477 /** |
|
1478 * gst_query_set_uri: |
|
1479 * @query: a #GstQuery with query type GST_QUERY_URI |
|
1480 * @uri: the URI to set |
|
1481 * |
|
1482 * Answer a URI query by setting the requested URI. |
|
1483 * |
|
1484 * Since: 0.10.22 |
|
1485 */ |
|
1486 #ifdef __SYMBIAN32__ |
|
1487 EXPORT_C |
|
1488 #endif |
|
1489 |
|
1490 void |
|
1491 gst_query_set_uri (GstQuery * query, const gchar * uri) |
|
1492 { |
|
1493 GstStructure *structure; |
|
1494 |
|
1495 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI); |
|
1496 g_return_if_fail (gst_uri_is_valid (uri)); |
|
1497 |
|
1498 structure = gst_query_get_structure (query); |
|
1499 gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL); |
|
1500 } |
|
1501 |
|
1502 /** |
|
1503 * gst_query_parse_uri: |
|
1504 * @query: a #GstQuery |
|
1505 * @uri: the storage for the current URI (may be NULL) |
|
1506 * |
|
1507 * Parse an URI query, writing the URI into @uri as a newly |
|
1508 * allocated string, if the respective parameters are non-NULL. |
|
1509 * Free the string with g_free() after usage. |
|
1510 * |
|
1511 * Since: 0.10.22 |
|
1512 */ |
|
1513 #ifdef __SYMBIAN32__ |
|
1514 EXPORT_C |
|
1515 #endif |
|
1516 |
|
1517 void |
|
1518 gst_query_parse_uri (GstQuery * query, gchar ** uri) |
|
1519 { |
|
1520 GstStructure *structure; |
|
1521 |
|
1522 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI); |
|
1523 |
|
1524 structure = gst_query_get_structure (query); |
|
1525 if (uri) |
|
1526 *uri = g_value_dup_string (gst_structure_id_get_value (structure, |
|
1527 GST_QUARK (URI))); |
|
1528 } |