| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/query.h> |
| 7 | #include <gstreamermm/private/query_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008 The gstreamermm Development Team |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Lesser General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2.1 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Lesser General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Lesser General Public |
| 25 | * License along with this library; if not, write to the Free |
| 26 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | */ |
| 28 | |
| 29 | #include <gst/gst.h> |
| 30 | #include <gstreamermm/iterator.h> |
| 31 | #include <gstreamermm/pad.h> |
| 32 | |
| 33 | |
| 34 | #include <iostream> |
| 35 | |
| 36 | namespace Gst |
| 37 | { |
| 38 | |
| 39 | namespace Enums |
| 40 | { |
| 41 | |
| 42 | Glib::ustring get_name(QueryType t) |
| 43 | { |
| 44 | return gst_query_type_get_name(static_cast<GstQueryType>(t)); |
| 45 | } |
| 46 | |
| 47 | Gst::QueryTypeFlags get_flags(QueryType type) |
| 48 | { |
| 49 | return static_cast<Gst::QueryTypeFlags>(gst_query_type_get_flags(static_cast<GstQueryType>(type))); |
| 50 | } |
| 51 | |
| 52 | Glib::QueryQuark get_quark(QueryType t) |
| 53 | { |
| 54 | return Glib::QueryQuark(gst_query_type_to_quark(static_cast<GstQueryType>(t))); |
| 55 | } |
| 56 | |
| 57 | } //namespace Enums |
| 58 | |
| 59 | Glib::RefPtr<Query> Query::create_writable() |
| 60 | { |
| 61 | return Glib::RefPtr<Query>::cast_static(MiniObject::create_writable()); |
| 62 | } |
| 63 | |
| 64 | Glib::RefPtr<Gst::QueryApplication> |
| 65 | QueryApplication::create(QueryType type, const Gst::Structure& structure) |
| 66 | { |
| 67 | // Create copy because query takes ownership of structure: |
| 68 | GstStructure* copy_struct = gst_structure_copy(structure.gobj()); |
| 69 | GstQuery* query = gst_query_new_custom(GstQueryType(type), |
| 70 | copy_struct); |
| 71 | return Glib::wrap_query_derived<Gst::QueryApplication>(query); |
| 72 | } |
| 73 | |
| 74 | Glib::RefPtr<Gst::QueryConvert> |
| 75 | QueryConvert::create(Format src_format, gint64 value, Format dest_format) |
| 76 | { |
| 77 | GstQuery* query = gst_query_new_convert(GstFormat(src_format), value, |
| 78 | GstFormat(dest_format)); |
| 79 | return Glib::wrap_query_derived<Gst::QueryConvert>(query); |
| 80 | } |
| 81 | |
| 82 | void QueryConvert::set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value) |
| 83 | { |
| 84 | gst_query_set_convert(gobj(), GstFormat(src_format), src_value, GstFormat(dest_format), dest_value); |
| 85 | } |
| 86 | |
| 87 | void QueryConvert::parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value) const |
| 88 | { |
| 89 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), |
| 90 | reinterpret_cast<GstFormat*>(&src_format), &src_value, |
| 91 | reinterpret_cast<GstFormat*>(&dest_format), &dest_value); |
| 92 | } |
| 93 | |
| 94 | void QueryConvert::parse(Format& dest_format, gint64& dest_value) const |
| 95 | { |
| 96 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 97 | reinterpret_cast<GstFormat*>(&dest_format), &dest_value); |
| 98 | } |
| 99 | |
| 100 | Format QueryConvert::parse_src_format() const |
| 101 | { |
| 102 | Format src_format = Gst::FORMAT_UNDEFINED; |
| 103 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), |
| 104 | reinterpret_cast<GstFormat*>(&src_format), nullptr, nullptr, nullptr); |
| 105 | return src_format; |
| 106 | } |
| 107 | |
| 108 | gint64 QueryConvert::parse_src_value() const |
| 109 | { |
| 110 | gint64 src_value = 0; |
| 111 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, &src_value, |
| 112 | nullptr, nullptr); |
| 113 | return src_value; |
| 114 | } |
| 115 | |
| 116 | Format QueryConvert::parse_dest_format() const |
| 117 | { |
| 118 | Format dest_format = Gst::FORMAT_UNDEFINED; |
| 119 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 120 | reinterpret_cast<GstFormat*>(&dest_format), nullptr); |
| 121 | return dest_format; |
| 122 | } |
| 123 | |
| 124 | gint64 QueryConvert::parse_dest_value() const |
| 125 | { |
| 126 | gint64 dest_value = 0; |
| 127 | gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr, nullptr, |
| 128 | &dest_value); |
| 129 | return dest_value; |
| 130 | } |
| 131 | |
| 132 | Glib::RefPtr<Gst::QueryPosition> QueryPosition::create(Format format) |
| 133 | { |
| 134 | GstQuery* query = gst_query_new_position(GstFormat(format)); |
| 135 | return Glib::wrap_query_derived<Gst::QueryPosition>(query); |
| 136 | } |
| 137 | |
| 138 | void QueryPosition::set(Format format, gint64 position) |
| 139 | { |
| 140 | gst_query_set_position(gobj(), GstFormat(format), position); |
| 141 | } |
| 142 | |
| 143 | void QueryPosition::parse(Format& format, gint64& position) const |
| 144 | { |
| 145 | gst_query_parse_position(const_cast<GstQuery*>(gobj()), |
| 146 | reinterpret_cast<GstFormat*>(&format), &position); |
| 147 | } |
| 148 | |
| 149 | gint64 QueryPosition::parse() const |
| 150 | { |
| 151 | gint64 position = 0; |
| 152 | gst_query_parse_position(const_cast<GstQuery*>(gobj()), nullptr, &position); |
| 153 | return position; |
| 154 | } |
| 155 | |
| 156 | Format QueryPosition::parse_format() const |
| 157 | { |
| 158 | Format format = Gst::FORMAT_UNDEFINED; |
| 159 | gst_query_parse_position(const_cast<GstQuery*>(gobj()), |
| 160 | reinterpret_cast<GstFormat*>(&format), nullptr); |
| 161 | return format; |
| 162 | } |
| 163 | |
| 164 | Glib::RefPtr<Gst::QueryDuration> QueryDuration::create(Format format) |
| 165 | { |
| 166 | GstQuery* query = gst_query_new_duration(GstFormat(format)); |
| 167 | return Glib::wrap_query_derived<Gst::QueryDuration>(query); |
| 168 | } |
| 169 | |
| 170 | void QueryDuration::set(Format format, gint64 duration) |
| 171 | { |
| 172 | gst_query_set_duration(gobj(), GstFormat(format), duration); |
| 173 | } |
| 174 | |
| 175 | void QueryDuration::parse(Format& format, gint64& duration) const |
| 176 | { |
| 177 | gst_query_parse_duration(const_cast<GstQuery*>(gobj()), |
| 178 | reinterpret_cast<GstFormat*>(&format), &duration); |
| 179 | } |
| 180 | |
| 181 | gint64 QueryDuration::parse() const |
| 182 | { |
| 183 | gint64 duration = 0; |
| 184 | gst_query_parse_duration(const_cast<GstQuery*>(gobj()), nullptr, &duration); |
| 185 | return duration; |
| 186 | } |
| 187 | |
| 188 | Format QueryDuration::parse_format() const |
| 189 | { |
| 190 | Format format = Gst::FORMAT_UNDEFINED; |
| 191 | gst_query_parse_duration(const_cast<GstQuery*>(gobj()), |
| 192 | reinterpret_cast<GstFormat*>(&format), 0); |
| 193 | return format; |
| 194 | } |
| 195 | |
| 196 | Glib::RefPtr<Gst::QueryLatency> QueryLatency::create() |
| 197 | { |
| 198 | GstQuery* query = gst_query_new_latency(); |
| 199 | return Glib::wrap_query_derived<Gst::QueryLatency>(query); |
| 200 | } |
| 201 | |
| 202 | void QueryLatency::set(bool live, ClockTime min_latency, ClockTime max_latency) |
| 203 | { |
| 204 | gst_query_set_latency(gobj(), live, GstClockTime(min_latency), GstClockTime(max_latency)); |
| 205 | } |
| 206 | |
| 207 | void QueryLatency::parse(bool& live, ClockTime& min_latency, ClockTime& max_latency) const |
| 208 | { |
| 209 | gboolean glive = FALSE; |
| 210 | gst_query_parse_latency(const_cast<GstQuery*>(gobj()), &glive, |
| 211 | reinterpret_cast<ClockTime*>(&min_latency), |
| 212 | reinterpret_cast<ClockTime*>(&max_latency)); |
| 213 | live = glive; |
| 214 | } |
| 215 | |
| 216 | bool QueryLatency::parse_live() const |
| 217 | { |
| 218 | gboolean glive = FALSE; |
| 219 | gst_query_parse_latency(const_cast<GstQuery*>(gobj()), &glive, nullptr, nullptr); |
| 220 | return glive; |
| 221 | } |
| 222 | |
| 223 | ClockTime QueryLatency::parse_min() const |
| 224 | { |
| 225 | ClockTime min = 0; |
| 226 | gst_query_parse_latency(const_cast<GstQuery*>(gobj()), nullptr, |
| 227 | reinterpret_cast<ClockTime*>(&min), nullptr); |
| 228 | return min; |
| 229 | } |
| 230 | |
| 231 | ClockTime QueryLatency::parse_max() const |
| 232 | { |
| 233 | ClockTime max = 0; |
| 234 | gst_query_parse_latency(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 235 | reinterpret_cast<ClockTime*>(&max)); |
| 236 | return max; |
| 237 | } |
| 238 | |
| 239 | Glib::RefPtr<Gst::QuerySeeking> QuerySeeking::create(Format format) |
| 240 | { |
| 241 | GstQuery* query = gst_query_new_seeking(GstFormat(format)); |
| 242 | return Glib::wrap_query_derived<Gst::QuerySeeking>(query); |
| 243 | } |
| 244 | |
| 245 | void QuerySeeking::set(Format format, bool seekable, gint64 segment_start, gint64 segment_end) |
| 246 | { |
| 247 | gst_query_set_seeking(gobj(), GstFormat(format), seekable, segment_start, segment_end); |
| 248 | } |
| 249 | |
| 250 | void QuerySeeking::parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end) const |
| 251 | { |
| 252 | gboolean gseekable = FALSE; |
| 253 | gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), |
| 254 | reinterpret_cast<GstFormat*>(&format), &gseekable, &segment_start, |
| 255 | &segment_end); |
| 256 | seekable = gseekable; |
| 257 | } |
| 258 | |
| 259 | Format QuerySeeking::parse_format() const |
| 260 | { |
| 261 | Format format = Gst::FORMAT_UNDEFINED; |
| 262 | gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), |
| 263 | reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr); |
| 264 | return format; |
| 265 | } |
| 266 | |
| 267 | bool QuerySeeking::parse_seekable() const |
| 268 | { |
| 269 | gboolean gseekable = FALSE; |
| 270 | gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr, |
| 271 | &gseekable, nullptr, nullptr); |
| 272 | return gseekable; |
| 273 | } |
| 274 | |
| 275 | gint64 QuerySeeking::parse_start() const |
| 276 | { |
| 277 | gint64 start = 0; |
| 278 | gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 279 | &start, nullptr); |
| 280 | return start; |
| 281 | } |
| 282 | |
| 283 | gint64 QuerySeeking::parse_end() const |
| 284 | { |
| 285 | gint64 end = 0; |
| 286 | gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr, nullptr, nullptr, |
| 287 | &end); |
| 288 | return end; |
| 289 | } |
| 290 | |
| 291 | Glib::RefPtr<Gst::QueryFormats> QueryFormats::create() |
| 292 | { |
| 293 | GstQuery* query = gst_query_new_formats(); |
| 294 | return Glib::wrap_query_derived<Gst::QueryFormats>(query); |
| 295 | } |
| 296 | |
| 297 | void QueryFormats::set(const Glib::ArrayHandle<Format>& formats) |
| 298 | { |
| 299 | gst_query_set_formatsv(gobj(), formats.size(), |
| 300 | reinterpret_cast<GstFormat*>(const_cast<Gst::Format*>(formats.data()))); |
| 301 | } |
| 302 | |
| 303 | void QueryFormats::set(int n_formats, const Glib::ArrayHandle<Format>& formats) |
| 304 | { |
| 305 | gst_query_set_formatsv(gobj(), n_formats, |
| 306 | reinterpret_cast<GstFormat*>(const_cast<Gst::Format*>(formats.data()))); |
| 307 | } |
| 308 | |
| 309 | guint QueryFormats::parse_length() const |
| 310 | { |
| 311 | guint n_formats = 0; |
| 312 | gst_query_parse_n_formats(const_cast<GstQuery*>(gobj()), &n_formats); |
| 313 | return n_formats; |
| 314 | } |
| 315 | |
| 316 | Format QueryFormats::parse(guint nth) const |
| 317 | { |
| 318 | Format format = Gst::FORMAT_UNDEFINED; |
| 319 | gst_query_parse_nth_format(const_cast<GstQuery*>(gobj()), nth, |
| 320 | reinterpret_cast<GstFormat*>(&format)); |
| 321 | return format; |
| 322 | } |
| 323 | |
| 324 | Glib::RefPtr<Gst::QuerySegment> QuerySegment::create(Format format) |
| 325 | { |
| 326 | GstQuery* query = gst_query_new_segment(GstFormat(format)); |
| 327 | return Glib::wrap_query_derived<Gst::QuerySegment>(query); |
| 328 | } |
| 329 | |
| 330 | void QuerySegment::set(double rate, Format format, gint64 start_value, gint64 stop_value) |
| 331 | { |
| 332 | gst_query_set_segment(gobj(), rate, static_cast<GstFormat>(format), |
| 333 | start_value, stop_value); |
| 334 | } |
| 335 | |
| 336 | void QuerySegment::parse(double& rate, Format& format, gint64& start_value, gint64& stop_value) const |
| 337 | { |
| 338 | gst_query_parse_segment(const_cast<GstQuery*>(gobj()), &rate, |
| 339 | reinterpret_cast<GstFormat*>(&format), &start_value, &stop_value); |
| 340 | } |
| 341 | |
| 342 | double QuerySegment::parse_rate() const |
| 343 | { |
| 344 | double rate = 0; |
| 345 | gst_query_parse_segment(const_cast<GstQuery*>(gobj()), &rate, nullptr, |
| 346 | nullptr, nullptr); |
| 347 | return rate; |
| 348 | } |
| 349 | |
| 350 | Format QuerySegment::parse_format() const |
| 351 | { |
| 352 | Format format = Gst::FORMAT_UNDEFINED; |
| 353 | gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr, |
| 354 | reinterpret_cast<GstFormat*>(&format), nullptr, nullptr); |
| 355 | return format; |
| 356 | } |
| 357 | |
| 358 | gint64 QuerySegment::parse_start() const |
| 359 | { |
| 360 | gint64 start = 0; |
| 361 | gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 362 | &start, nullptr); |
| 363 | return start; |
| 364 | } |
| 365 | |
| 366 | gint64 QuerySegment::parse_stop() const |
| 367 | { |
| 368 | gint64 stop = 0; |
| 369 | gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 370 | nullptr, &stop); |
| 371 | return stop; |
| 372 | } |
| 373 | |
| 374 | Glib::RefPtr<Gst::QueryBuffering> QueryBuffering::create(Format format) |
| 375 | { |
| 376 | GstQuery* query = gst_query_new_buffering(GstFormat(format)); |
| 377 | return Glib::wrap_query_derived<Gst::QueryBuffering>(query); |
| 378 | } |
| 379 | |
| 380 | void QueryBuffering::set(bool busy, int percent) |
| 381 | { |
| 382 | gst_query_set_buffering_percent(gobj(), busy, percent); |
| 383 | } |
| 384 | |
| 385 | void QueryBuffering::parse(bool& busy, int& percent) const |
| 386 | { |
| 387 | gboolean gbusy = FALSE; |
| 388 | gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), &gbusy, |
| 389 | &percent); |
| 390 | busy = gbusy; |
| 391 | } |
| 392 | |
| 393 | bool QueryBuffering::parse_busy() const |
| 394 | { |
| 395 | gboolean gbusy = FALSE; |
| 396 | gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), &gbusy, |
| 397 | 0); |
| 398 | return gbusy; |
| 399 | } |
| 400 | |
| 401 | int QueryBuffering::parse_percent() const |
| 402 | { |
| 403 | int percent = 0; |
| 404 | gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), nullptr, |
| 405 | &percent); |
| 406 | return percent; |
| 407 | } |
| 408 | |
| 409 | void QueryBuffering::set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left) |
| 410 | { |
| 411 | gst_query_set_buffering_stats(gobj(), static_cast<GstBufferingMode>(mode), |
| 412 | avg_in, avg_out, buffering_left); |
| 413 | } |
| 414 | |
| 415 | void QueryBuffering::parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left) const |
| 416 | { |
| 417 | gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), |
| 418 | reinterpret_cast<GstBufferingMode*>(&mode), &avg_in, &avg_out, |
| 419 | &buffering_left); |
| 420 | } |
| 421 | |
| 422 | BufferingMode QueryBuffering::parse_mode() const |
| 423 | { |
| 424 | BufferingMode mode = Gst::BUFFERING_STREAM; |
| 425 | gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), |
| 426 | reinterpret_cast<GstBufferingMode*>(&mode), nullptr, nullptr, nullptr); |
| 427 | return mode; |
| 428 | } |
| 429 | |
| 430 | int QueryBuffering::parse_input_rate() const |
| 431 | { |
| 432 | int avg_in = 0; |
| 433 | gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr, |
| 434 | &avg_in, nullptr, nullptr); |
| 435 | return avg_in; |
| 436 | } |
| 437 | |
| 438 | int QueryBuffering::parse_output_rate() const |
| 439 | { |
| 440 | int avg_out = 0; |
| 441 | gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr, nullptr, |
| 442 | &avg_out, nullptr); |
| 443 | return avg_out; |
| 444 | } |
| 445 | |
| 446 | gint64 QueryBuffering::parse_time_left() const |
| 447 | { |
| 448 | gint64 buffering_left = Gst::BUFFERING_STREAM; |
| 449 | gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr, |
| 450 | nullptr, nullptr, &buffering_left); |
| 451 | return buffering_left; |
| 452 | } |
| 453 | |
| 454 | void QueryBuffering::set(Format format, gint64 start, gint64 stop, gint64 estimated_total) |
| 455 | { |
| 456 | gst_query_set_buffering_range(gobj(), static_cast<GstFormat>(format), |
| 457 | start, stop, estimated_total); |
| 458 | } |
| 459 | |
| 460 | void QueryBuffering::parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total) const |
| 461 | { |
| 462 | gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), |
| 463 | reinterpret_cast<GstFormat*>(&format), &start, &stop, &estimated_total); |
| 464 | } |
| 465 | |
| 466 | Format QueryBuffering::parse_format() const |
| 467 | { |
| 468 | Format format = Gst::FORMAT_UNDEFINED; |
| 469 | gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), |
| 470 | reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr); |
| 471 | return format; |
| 472 | } |
| 473 | |
| 474 | gint64 QueryBuffering::parse_start() const |
| 475 | { |
| 476 | gint64 start = 0; |
| 477 | gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr, |
| 478 | &start, nullptr, nullptr); |
| 479 | return start; |
| 480 | } |
| 481 | |
| 482 | gint64 QueryBuffering::parse_stop() const |
| 483 | { |
| 484 | gint64 stop = 0; |
| 485 | gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr, |
| 486 | nullptr, &stop, nullptr); |
| 487 | return stop; |
| 488 | } |
| 489 | |
| 490 | gint64 QueryBuffering::parse_total_time() const |
| 491 | { |
| 492 | gint64 estimated_total = 0; |
| 493 | gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr, |
| 494 | nullptr, nullptr, &estimated_total); |
| 495 | return estimated_total; |
| 496 | } |
| 497 | |
| 498 | Glib::RefPtr<Gst::QueryCaps> QueryCaps::create(const Glib::RefPtr<Gst::Caps>& filter) |
| 499 | { |
| 500 | GstQuery* query = gst_query_new_caps(filter->gobj()); |
| 501 | return Glib::wrap_query_derived<Gst::QueryCaps>(query); |
| 502 | } |
| 503 | |
| 504 | Glib::RefPtr<Gst::Caps> QueryCaps::parse() const |
| 505 | { |
| 506 | GstCaps* caps; |
| 507 | gst_query_parse_caps(const_cast<GstQuery*>(gobj()), &caps); |
| 508 | return Glib::wrap(caps, true); |
| 509 | } |
| 510 | |
| 511 | Glib::RefPtr<Gst::Caps> QueryCaps::parse_caps_result() const |
| 512 | { |
| 513 | GstCaps* caps; |
| 514 | gst_query_parse_caps_result(const_cast<GstQuery*>(gobj()), &caps); |
| 515 | return Glib::wrap(caps, false); |
| 516 | } |
| 517 | |
| 518 | void QueryCaps::set_caps_result(const Glib::RefPtr<Gst::Caps>& caps) |
| 519 | { |
| 520 | gst_query_set_caps_result(gobj(), caps->gobj()); |
| 521 | } |
| 522 | |
| 523 | Glib::RefPtr<QueryScheduling> QueryScheduling::create() |
| 524 | { |
| 525 | GstQuery* query = gst_query_new_scheduling(); |
| 526 | return Glib::wrap_query_derived<QueryScheduling>(query); |
| 527 | } |
| 528 | |
| 529 | void QueryScheduling::parse(SchedulingFlags& flags, gint& minsize, gint& maxsize, gint& align) const |
| 530 | { |
| 531 | GstSchedulingFlags gst_flags; |
| 532 | gst_query_parse_scheduling(const_cast<GstQuery*>(gobj()), &gst_flags, &minsize, &maxsize, &align); |
| 533 | flags = SchedulingFlags(gst_flags); |
| 534 | } |
| 535 | |
| 536 | void QueryScheduling::set(SchedulingFlags flags, gint minsize, gint maxsize, gint align) |
| 537 | { |
| 538 | gst_query_set_scheduling(gobj(), GstSchedulingFlags(flags), minsize, maxsize, align); |
| 539 | } |
| 540 | |
| 541 | void QueryScheduling::add_scheduling_mode(PadMode mode) |
| 542 | { |
| 543 | gst_query_add_scheduling_mode(gobj(), GstPadMode(mode)); |
| 544 | } |
| 545 | |
| 546 | guint QueryScheduling::get_n_scheduling_modes() const |
| 547 | { |
| 548 | return gst_query_get_n_scheduling_modes(const_cast<GstQuery*>(gobj())); |
| 549 | } |
| 550 | |
| 551 | PadMode QueryScheduling::parse_nth_scheduling_mode(guint index) const |
| 552 | { |
| 553 | return PadMode(gst_query_parse_nth_scheduling_mode(const_cast<GstQuery*>(gobj()), index)); |
| 554 | } |
| 555 | |
| 556 | bool QueryScheduling::has_scheduling_mode(PadMode mode) const |
| 557 | { |
| 558 | return PadMode(gst_query_has_scheduling_mode(const_cast<GstQuery*>(gobj()), GstPadMode(mode))); |
| 559 | } |
| 560 | |
| 561 | bool QueryScheduling::has_scheduling_mode_with_flags(PadMode mode, SchedulingFlags flags) const |
| 562 | { |
| 563 | return PadMode(gst_query_has_scheduling_mode_with_flags(const_cast<GstQuery*>(gobj()), GstPadMode(mode), GstSchedulingFlags(flags))); |
| 564 | } |
| 565 | |
| 566 | Glib::RefPtr<QueryAllocation> QueryAllocation::create(const Glib::RefPtr<Gst::Caps>& caps, bool need_pool) |
| 567 | { |
| 568 | GstQuery* query = gst_query_new_allocation(caps->gobj(), need_pool); |
| 569 | return Glib::wrap_query_derived<QueryAllocation>(query); |
| 570 | } |
| 571 | |
| 572 | void QueryAllocation::parse(Glib::RefPtr<Caps>& caps, bool& need_pool) const |
| 573 | { |
| 574 | GstCaps* n_caps; |
| 575 | gboolean gst_need_pool; |
| 576 | gst_query_parse_allocation(const_cast<GstQuery*>(gobj()), &n_caps, &gst_need_pool); |
| 577 | caps = Glib::wrap(n_caps, false); |
| 578 | need_pool = gst_need_pool; |
| 579 | } |
| 580 | |
| 581 | guint QueryAllocation::get_n_allocation_pools() const |
| 582 | { |
| 583 | return gst_query_get_n_allocation_pools(const_cast<GstQuery*>(gobj())); |
| 584 | } |
| 585 | |
| 586 | void QueryAllocation::remove_nth_allocation_pool(guint index) |
| 587 | { |
| 588 | gst_query_remove_nth_allocation_pool(gobj(), index); |
| 589 | } |
| 590 | |
| 591 | void QueryAllocation::add_allocation_param(const Glib::RefPtr<Allocator>& allocator, const AllocationParams& params) |
| 592 | { |
| 593 | gst_query_add_allocation_param(gobj(), allocator->gobj(), params.gobj()); |
| 594 | } |
| 595 | |
| 596 | guint QueryAllocation::get_n_allocation_params() const |
| 597 | { |
| 598 | return gst_query_get_n_allocation_params(const_cast<GstQuery*>(gobj())); |
| 599 | } |
| 600 | |
| 601 | void QueryAllocation::parse_nth_allocation_param(guint index, Glib::RefPtr<Allocator>& allocator, AllocationParams& params) const |
| 602 | { |
| 603 | GstAllocator* n_allocator; |
| 604 | gst_query_parse_nth_allocation_param(const_cast<GstQuery*>(gobj()), index, &n_allocator, params.gobj()); |
| 605 | allocator = Glib::wrap(n_allocator, false); |
| 606 | } |
| 607 | |
| 608 | void QueryAllocation::set_nth_allocation_param(guint index, const Glib::RefPtr<Allocator>& allocator, const AllocationParams& params) |
| 609 | { |
| 610 | gst_query_set_nth_allocation_param(gobj(), index, allocator->gobj(), params.gobj()); |
| 611 | } |
| 612 | |
| 613 | void QueryAllocation::remove_nth_allocation_param(guint index) |
| 614 | { |
| 615 | gst_query_remove_nth_allocation_param(gobj(), index); |
| 616 | } |
| 617 | |
| 618 | void QueryAllocation::add_allocation_meta(GType api, const Structure& params) |
| 619 | { |
| 620 | gst_query_add_allocation_meta(gobj(), api, params.gobj()); |
| 621 | } |
| 622 | |
| 623 | guint QueryAllocation::get_n_allocation_metas() const |
| 624 | { |
| 625 | return gst_query_get_n_allocation_metas(const_cast<GstQuery*>(gobj())); |
| 626 | } |
| 627 | |
| 628 | GType QueryAllocation::parse_nth_allocation_meta(guint index, Structure& params) const |
| 629 | { |
| 630 | GstStructure *gst_params; |
| 631 | GType ret = gst_query_parse_nth_allocation_meta(const_cast<GstQuery*>(gobj()), index, (const GstStructure**)&gst_params); |
| 632 | params = Glib::wrap(gst_params, true); |
| 633 | return ret; |
| 634 | } |
| 635 | |
| 636 | void QueryAllocation::remove_nth_allocation_meta(guint index) |
| 637 | { |
| 638 | gst_query_remove_nth_allocation_meta(gobj(), index); |
| 639 | } |
| 640 | |
| 641 | bool QueryAllocation::find_allocation_meta(GType api, guint& index) const |
| 642 | { |
| 643 | return gst_query_find_allocation_meta(const_cast<GstQuery*>(gobj()), api, &index); |
| 644 | } |
| 645 | |
| 646 | Glib::RefPtr<QueryUri> QueryUri::create() |
| 647 | { |
| 648 | GstQuery* query = gst_query_new_uri(); |
| 649 | return Glib::wrap_query_derived<QueryUri>(query); |
| 650 | } |
| 651 | |
| 652 | Glib::ustring QueryUri::parse() const |
| 653 | { |
| 654 | gchar* gst_uri; |
| 655 | Glib::ustring uri; |
| 656 | gst_query_parse_uri(const_cast<GstQuery*>(gobj()), &gst_uri); |
| 657 | if (gst_uri != nullptr) |
| 658 | { |
| 659 | uri = gst_uri; |
| 660 | g_free(gst_uri); |
| 661 | } |
| 662 | |
| 663 | return uri; |
| 664 | } |
| 665 | |
| 666 | void QueryUri::set(const Glib::ustring& uri) |
| 667 | { |
| 668 | gst_query_set_uri(gobj(), uri.c_str()); |
| 669 | } |
| 670 | |
| 671 | void QueryUri::set_uri_redirection(const Glib::ustring& uri) |
| 672 | { |
| 673 | gst_query_set_uri_redirection(gobj(), uri.c_str()); |
| 674 | } |
| 675 | |
| 676 | Glib::ustring QueryUri::parse_uri_redirection() const |
| 677 | { |
| 678 | gchar* c_uri; |
| 679 | Glib::ustring uri; |
| 680 | gst_query_parse_uri_redirection(const_cast<GstQuery*>(gobj()), &c_uri); |
| 681 | |
| 682 | if (c_uri != nullptr) |
| 683 | { |
| 684 | uri = c_uri; |
| 685 | g_free(c_uri); |
| 686 | } |
| 687 | |
| 688 | return uri; |
| 689 | } |
| 690 | |
| 691 | Glib::RefPtr<QueryAcceptCaps> QueryAcceptCaps::create(const Glib::RefPtr<Gst::Caps>& caps) |
| 692 | { |
| 693 | GstQuery* query = gst_query_new_accept_caps(caps->gobj()); |
| 694 | return Glib::wrap_query_derived<QueryAcceptCaps>(query); |
| 695 | } |
| 696 | |
| 697 | |
| 698 | Glib::RefPtr<Gst::Caps> QueryAcceptCaps::parse_accept_caps() const |
| 699 | { |
| 700 | GstCaps *c_caps; |
| 701 | gst_query_parse_accept_caps(const_cast<GstQuery*>(gobj()), &c_caps); |
| 702 | return Glib::wrap(c_caps, false); |
| 703 | } |
| 704 | |
| 705 | bool QueryAcceptCaps::parse_accept_caps_result() const |
| 706 | { |
| 707 | gboolean c_result; |
| 708 | gst_query_parse_accept_caps_result(const_cast<GstQuery*>(gobj()), &c_result); |
| 709 | return bool(c_result); |
| 710 | } |
| 711 | |
| 712 | void QueryAcceptCaps::set_accept_caps_result(bool result) |
| 713 | { |
| 714 | gst_query_set_accept_caps_result(gobj(), result); |
| 715 | } |
| 716 | } //namesapce Gst |
| 717 | |
| 718 | namespace |
| 719 | { |
| 720 | } // anonymous namespace |
| 721 | |
| 722 | // static |
| 723 | GType Glib::Value<Gst::BufferingMode>::value_type() |
| 724 | { |
| 725 | return gst_buffering_mode_get_type(); |
| 726 | } |
| 727 | |
| 728 | // static |
| 729 | GType Glib::Value<Gst::QueryType>::value_type() |
| 730 | { |
| 731 | return gst_query_type_get_type(); |
| 732 | } |
| 733 | |
| 734 | // static |
| 735 | GType Glib::Value<Gst::QueryTypeFlags>::value_type() |
| 736 | { |
| 737 | return gst_query_type_flags_get_type(); |
| 738 | } |
| 739 | |
| 740 | // static |
| 741 | GType Glib::Value<Gst::SchedulingFlags>::value_type() |
| 742 | { |
| 743 | return gst_scheduling_flags_get_type(); |
| 744 | } |
| 745 | |
| 746 | |
| 747 | /* Why reinterpret_cast<Query*>(gobject) is needed: |
| 748 | * |
| 749 | * A Query instance is in fact always a GstQuery instance. |
| 750 | * Unfortunately, GstQuery cannot be a member of Query, |
| 751 | * because it is an opaque struct. Also, the C interface does not provide |
| 752 | * any hooks to install a destroy notification handler, thus we cannot |
| 753 | * wrap it dynamically either. |
| 754 | * |
| 755 | * The cast works because Query does not have any member data, and |
| 756 | * it is impossible to derive from it. This is ensured by using final on the |
| 757 | * class and by using = delete on the default constructor. |
| 758 | */ |
| 759 | |
| 760 | namespace Glib |
| 761 | { |
| 762 | |
| 763 | Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy) |
| 764 | { |
| 765 | if(take_copy && object) |
| 766 | gst_query_ref(object); |
| 767 | |
| 768 | // See the comment at the top of this file, if you want to know why the cast works. |
| 769 | return Glib::RefPtr<Gst::Query>(reinterpret_cast<Gst::Query*>(object)); |
| 770 | } |
| 771 | |
| 772 | } // namespace Glib |
| 773 | |
| 774 | |
| 775 | namespace Gst |
| 776 | { |
| 777 | |
| 778 | |
| 779 | void Query::reference() const |
| 780 | { |
| 781 | // See the comment at the top of this file, if you want to know why the cast works. |
| 782 | gst_query_ref(reinterpret_cast<GstQuery*>(const_cast<Query*>(this))); |
| 783 | } |
| 784 | |
| 785 | void Query::unreference() const |
| 786 | { |
| 787 | // See the comment at the top of this file, if you want to know why the cast works. |
| 788 | gst_query_unref(reinterpret_cast<GstQuery*>(const_cast<Query*>(this))); |
| 789 | } |
| 790 | |
| 791 | GstQuery* Query::gobj() |
| 792 | { |
| 793 | // See the comment at the top of this file, if you want to know why the cast works. |
| 794 | return reinterpret_cast<GstQuery*>(this); |
| 795 | } |
| 796 | |
| 797 | const GstQuery* Query::gobj() const |
| 798 | { |
| 799 | // See the comment at the top of this file, if you want to know why the cast works. |
| 800 | return reinterpret_cast<const GstQuery*>(this); |
| 801 | } |
| 802 | |
| 803 | GstQuery* Query::gobj_copy() const |
| 804 | { |
| 805 | // See the comment at the top of this file, if you want to know why the cast works. |
| 806 | const auto gobject = reinterpret_cast<GstQuery*>(const_cast<Query*>(this)); |
| 807 | gst_query_ref(gobject); |
| 808 | return gobject; |
| 809 | } |
| 810 | |
| 811 | |
| 812 | Gst::Structure Query::get_structure() const |
| 813 | { |
| 814 | return Glib::wrap(const_cast<GstStructure*>(gst_query_get_structure(const_cast<GstQuery*>(gobj()))), true); |
| 815 | } |
| 816 | |
| 817 | Glib::RefPtr<Gst::Query> Query::create_buffering(Gst::Format format) |
| 818 | { |
| 819 | return Glib::wrap(gst_query_new_buffering(((GstFormat)(format)))); |
| 820 | } |
| 821 | |
| 822 | Glib::RefPtr<Gst::Query> Query::create_allocation(Glib::RefPtr<Gst::Caps> caps, bool need_pool) |
| 823 | { |
| 824 | return Glib::wrap(gst_query_new_allocation(Glib::unwrap(caps), static_cast<int>(need_pool))); |
| 825 | } |
| 826 | |
| 827 | Glib::RefPtr<Gst::Query> Query::create_uri() |
| 828 | { |
| 829 | return Glib::wrap(gst_query_new_uri()); |
| 830 | } |
| 831 | |
| 832 | Glib::RefPtr<Gst::Query> Query::create_scheduling() |
| 833 | { |
| 834 | return Glib::wrap(gst_query_new_scheduling()); |
| 835 | } |
| 836 | |
| 837 | Glib::RefPtr<Gst::Query> Query::create_drain() |
| 838 | { |
| 839 | return Glib::wrap(gst_query_new_drain()); |
| 840 | } |
| 841 | |
| 842 | Glib::RefPtr<Gst::Query> Query::create_custom(Gst::QueryType type, const Gst::Structure& structure) |
| 843 | { |
| 844 | return Glib::wrap(gst_query_new_custom(((GstQueryType)(type)), const_cast<GstStructure*>(structure.gobj()))); |
| 845 | } |
| 846 | |
| 847 | Glib::RefPtr<Gst::Query> Query::create_convert(Gst::Format format, gint64 value, Gst::Format dest_format) |
| 848 | { |
| 849 | return Glib::wrap(gst_query_new_convert(((GstFormat)(format)), value, ((GstFormat)(dest_format)))); |
| 850 | } |
| 851 | |
| 852 | Glib::RefPtr<Gst::Query> Query::create_position(Gst::Format format) |
| 853 | { |
| 854 | return Glib::wrap(gst_query_new_position(((GstFormat)(format)))); |
| 855 | } |
| 856 | |
| 857 | Glib::RefPtr<Gst::Query> Query::create_duration(Gst::Format format) |
| 858 | { |
| 859 | return Glib::wrap(gst_query_new_duration(((GstFormat)(format)))); |
| 860 | } |
| 861 | |
| 862 | Glib::RefPtr<Gst::Query> Query::create_latency() |
| 863 | { |
| 864 | return Glib::wrap(gst_query_new_latency()); |
| 865 | } |
| 866 | |
| 867 | Glib::RefPtr<Gst::Query> Query::create_seeking(Gst::Format format) |
| 868 | { |
| 869 | return Glib::wrap(gst_query_new_seeking(((GstFormat)(format)))); |
| 870 | } |
| 871 | |
| 872 | Glib::RefPtr<Gst::Query> Query::create_formats() |
| 873 | { |
| 874 | return Glib::wrap(gst_query_new_formats()); |
| 875 | } |
| 876 | |
| 877 | Glib::RefPtr<Gst::Query> Query::create_segment(Gst::Format format) |
| 878 | { |
| 879 | return Glib::wrap(gst_query_new_segment(((GstFormat)(format)))); |
| 880 | } |
| 881 | |
| 882 | Glib::RefPtr<Gst::Query> Query::create_caps(Glib::RefPtr<Gst::Caps> filter) |
| 883 | { |
| 884 | return Glib::wrap(gst_query_new_caps(Glib::unwrap(filter))); |
| 885 | } |
| 886 | |
| 887 | Glib::RefPtr<Gst::Query> Query::create_accept_caps(Glib::RefPtr<Gst::Caps> filter) |
| 888 | { |
| 889 | return Glib::wrap(gst_query_new_accept_caps(Glib::unwrap(filter))); |
| 890 | } |
| 891 | |
| 892 | QueryType Query::get_query_type() const |
| 893 | { |
| 894 | return ((QueryType)(gobj()->type)); |
| 895 | } |
| 896 | |
| 897 | Glib::RefPtr<Gst::Query> Query::copy() |
| 898 | { |
| 899 | return Glib::wrap(gst_query_copy(gobj())); |
| 900 | } |
| 901 | |
| 902 | |
| 903 | } // namespace Gst |
| 904 | |
| 905 |