1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643
|
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
* 2000 Wim Taymans <wim.taymans@chello.be>
* 2005 Wim Taymans <wim@fluendo.com>
*
* gstquery.c: GstQueryType registration and Query parsing/creation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/**
* SECTION:gstquery
* @short_description: Provide functions to create queries, and to set and parse
* values in them.
* @see_also: #GstPad, #GstElement
*
* Queries can be performed on pads (gst_pad_query()) and elements
* (gst_element_query()). Please note that some queries might need a running
* pipeline to work.
*
* Queries can be created using the gst_query_new_*() functions.
* Query values can be set using gst_query_set_*(), and parsed using
* gst_query_parse_*() helpers.
*
* The following example shows how to query the duration of a pipeline:
* |[
* GstQuery *query;
* gboolean res;
* query = gst_query_new_duration (GST_FORMAT_TIME);
* res = gst_element_query (pipeline, query);
* if (res) {
* gint64 duration;
* gst_query_parse_duration (query, NULL, &duration);
* g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
* } else {
* g_print ("duration query failed...");
* }
* gst_query_unref (query);
* ]|
*/
#include "gst_private.h"
#include "gstinfo.h"
#include "gstquery.h"
#include "gstvalue.h"
#include "gstenumtypes.h"
#include "gstquark.h"
#include "gsturi.h"
#include "gstbufferpool.h"
GST_DEBUG_CATEGORY_STATIC (gst_query_debug);
#define GST_CAT_DEFAULT gst_query_debug
GType _gst_query_type = 0;
typedef struct
{
GstQuery query;
GstStructure *structure;
} GstQueryImpl;
#define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
typedef struct
{
const gint type;
const gchar *name;
GQuark quark;
} GstQueryQuarks;
static GstQueryQuarks query_quarks[] = {
{GST_QUERY_UNKNOWN, "unknown", 0},
{GST_QUERY_POSITION, "position", 0},
{GST_QUERY_DURATION, "duration", 0},
{GST_QUERY_LATENCY, "latency", 0},
{GST_QUERY_JITTER, "jitter", 0},
{GST_QUERY_RATE, "rate", 0},
{GST_QUERY_SEEKING, "seeking", 0},
{GST_QUERY_SEGMENT, "segment", 0},
{GST_QUERY_CONVERT, "convert", 0},
{GST_QUERY_FORMATS, "formats", 0},
{GST_QUERY_BUFFERING, "buffering", 0},
{GST_QUERY_CUSTOM, "custom", 0},
{GST_QUERY_URI, "uri", 0},
{GST_QUERY_ALLOCATION, "allocation", 0},
{GST_QUERY_SCHEDULING, "scheduling", 0},
{GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
{GST_QUERY_CAPS, "caps", 0},
{GST_QUERY_DRAIN, "drain", 0},
{GST_QUERY_CONTEXT, "context", 0},
{0, NULL, 0}
};
GST_DEFINE_MINI_OBJECT_TYPE (GstQuery, gst_query);
void
_priv_gst_query_initialize (void)
{
gint i;
_gst_query_type = gst_query_get_type ();
GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
for (i = 0; query_quarks[i].name; i++) {
query_quarks[i].quark = g_quark_from_static_string (query_quarks[i].name);
}
}
/**
* gst_query_type_get_name:
* @type: the query type
*
* Get a printable name for the given query type. Do not modify or free.
*
* Returns: a reference to the static name of the query.
*/
const gchar *
gst_query_type_get_name (GstQueryType type)
{
gint i;
for (i = 0; query_quarks[i].name; i++) {
if (type == query_quarks[i].type)
return query_quarks[i].name;
}
return "unknown";
}
/**
* gst_query_type_to_quark:
* @type: the query type
*
* Get the unique quark for the given query type.
*
* Returns: the quark associated with the query type
*/
GQuark
gst_query_type_to_quark (GstQueryType type)
{
gint i;
for (i = 0; query_quarks[i].name; i++) {
if (type == query_quarks[i].type)
return query_quarks[i].quark;
}
return 0;
}
/**
* gst_query_type_get_flags:
* @type: a #GstQueryType
*
* Gets the #GstQueryTypeFlags associated with @type.
*
* Returns: a #GstQueryTypeFlags.
*/
GstQueryTypeFlags
gst_query_type_get_flags (GstQueryType type)
{
GstQueryTypeFlags ret;
ret = type & ((1 << GST_QUERY_NUM_SHIFT) - 1);
return ret;
}
static void
_gst_query_free (GstQuery * query)
{
GstStructure *s;
g_return_if_fail (query != NULL);
s = GST_QUERY_STRUCTURE (query);
if (s) {
gst_structure_set_parent_refcount (s, NULL);
gst_structure_free (s);
}
g_slice_free1 (sizeof (GstQueryImpl), query);
}
static GstQuery *
_gst_query_copy (GstQuery * query)
{
GstQuery *copy;
GstStructure *s;
s = GST_QUERY_STRUCTURE (query);
if (s) {
s = gst_structure_copy (s);
}
copy = gst_query_new_custom (query->type, s);
return copy;
}
/**
* gst_query_new_position:
* @format: the default #GstFormat for the new query
*
* Constructs a new query stream position query object. Use gst_query_unref()
* when done with it. A position query is used to query the current position
* of playback in the streams, in some format.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_position (GstFormat format)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_POSITION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (CURRENT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_POSITION, structure);
return query;
}
/**
* gst_query_set_position:
* @query: a #GstQuery with query type GST_QUERY_POSITION
* @format: the requested #GstFormat
* @cur: the position to set
*
* Answer a position query by setting the requested value in the given format.
*/
void
gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur)
{
GstStructure *s;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
s = GST_QUERY_STRUCTURE (query);
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
GST_QUARK (FORMAT))));
gst_structure_id_set (s,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL);
}
/**
* gst_query_parse_position:
* @query: a #GstQuery
* @format: (out) (allow-none): the storage for the #GstFormat of the
* position values (may be %NULL)
* @cur: (out) (allow-none): the storage for the current position (may be %NULL)
*
* Parse a position query, writing the format into @format, and the position
* into @cur, if the respective parameters are non-%NULL.
*/
void
gst_query_parse_position (GstQuery * query, GstFormat * format, gint64 * cur)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
structure = GST_QUERY_STRUCTURE (query);
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (cur)
*cur = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (CURRENT)));
}
/**
* gst_query_new_duration:
* @format: the #GstFormat for this duration query
*
* Constructs a new stream duration query object to query in the given format.
* Use gst_query_unref() when done with it. A duration query will give the
* total length of the stream.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_duration (GstFormat format)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_DURATION),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_DURATION, structure);
return query;
}
/**
* gst_query_set_duration:
* @query: a #GstQuery
* @format: the #GstFormat for the duration
* @duration: the duration of the stream
*
* Answer a duration query by setting the requested value in the given format.
*/
void
gst_query_set_duration (GstQuery * query, GstFormat format, gint64 duration)
{
GstStructure *s;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
s = GST_QUERY_STRUCTURE (query);
g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
GST_QUARK (FORMAT))));
gst_structure_id_set (s, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
}
/**
* gst_query_parse_duration:
* @query: a #GstQuery
* @format: (out) (allow-none): the storage for the #GstFormat of the duration
* value, or %NULL.
* @duration: (out) (allow-none): the storage for the total duration, or %NULL.
*
* Parse a duration query answer. Write the format of the duration into @format,
* and the value into @duration, if the respective variables are non-%NULL.
*/
void
gst_query_parse_duration (GstQuery * query, GstFormat * format,
gint64 * duration)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
structure = GST_QUERY_STRUCTURE (query);
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (duration)
*duration = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (DURATION)));
}
/**
* gst_query_new_latency:
*
* Constructs a new latency query object.
* Use gst_query_unref() when done with it. A latency query is usually performed
* by sinks to compensate for additional latency introduced by elements in the
* pipeline.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a #GstQuery
*/
GstQuery *
gst_query_new_latency (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_LATENCY),
GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_LATENCY, structure);
return query;
}
/**
* gst_query_set_latency:
* @query: a #GstQuery
* @live: if there is a live element upstream
* @min_latency: the minimal latency of the upstream elements
* @max_latency: the maximal latency of the upstream elements
*
* Answer a latency query by setting the requested values in the given format.
*/
void
gst_query_set_latency (GstQuery * query, gboolean live,
GstClockTime min_latency, GstClockTime max_latency)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency,
GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL);
}
/**
* gst_query_parse_latency:
* @query: a #GstQuery
* @live: (out) (allow-none): storage for live or %NULL
* @min_latency: (out) (allow-none): the storage for the min latency or %NULL
* @max_latency: (out) (allow-none): the storage for the max latency or %NULL
*
* Parse a latency query answer.
*/
void
gst_query_parse_latency (GstQuery * query, gboolean * live,
GstClockTime * min_latency, GstClockTime * max_latency)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
structure = GST_QUERY_STRUCTURE (query);
if (live)
*live =
g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (LIVE)));
if (min_latency)
*min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
GST_QUARK (MIN_LATENCY)));
if (max_latency)
*max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
GST_QUARK (MAX_LATENCY)));
}
/**
* gst_query_new_convert:
* @src_format: the source #GstFormat for the new query
* @value: the value to convert
* @dest_format: the target #GstFormat
*
* Constructs a new convert query object. Use gst_query_unref()
* when done with it. A convert query is used to ask for a conversion between
* one format and another.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a #GstQuery
*/
GstQuery *
gst_query_new_convert (GstFormat src_format, gint64 value,
GstFormat dest_format)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_CONVERT),
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
GST_QUARK (SRC_VALUE), G_TYPE_INT64, value,
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
GST_QUARK (DEST_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_CONVERT, structure);
return query;
}
/**
* gst_query_set_convert:
* @query: a #GstQuery
* @src_format: the source #GstFormat
* @src_value: the source value
* @dest_format: the destination #GstFormat
* @dest_value: the destination value
*
* Answer a convert query by setting the requested values.
*/
void
gst_query_set_convert (GstQuery * query, GstFormat src_format, gint64 src_value,
GstFormat dest_format, gint64 dest_value)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value,
GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL);
}
/**
* gst_query_parse_convert:
* @query: a #GstQuery
* @src_format: (out) (allow-none): the storage for the #GstFormat of the
* source value, or %NULL
* @src_value: (out) (allow-none): the storage for the source value, or %NULL
* @dest_format: (out) (allow-none): the storage for the #GstFormat of the
* destination value, or %NULL
* @dest_value: (out) (allow-none): the storage for the destination value,
* or %NULL
*
* Parse a convert query answer. Any of @src_format, @src_value, @dest_format,
* and @dest_value may be %NULL, in which case that value is omitted.
*/
void
gst_query_parse_convert (GstQuery * query, GstFormat * src_format,
gint64 * src_value, GstFormat * dest_format, gint64 * dest_value)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
structure = GST_QUERY_STRUCTURE (query);
if (src_format)
*src_format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (SRC_FORMAT)));
if (src_value)
*src_value = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (SRC_VALUE)));
if (dest_format)
*dest_format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (DEST_FORMAT)));
if (dest_value)
*dest_value = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (DEST_VALUE)));
}
/**
* gst_query_new_segment:
* @format: the #GstFormat for the new query
*
* Constructs a new segment query object. Use gst_query_unref()
* when done with it. A segment query is used to discover information about the
* currently configured segment for playback.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_segment (GstFormat format)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_SEGMENT),
GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_SEGMENT, structure);
return query;
}
/**
* gst_query_set_segment:
* @query: a #GstQuery
* @rate: the rate of the segment
* @format: the #GstFormat of the segment values (@start_value and @stop_value)
* @start_value: the start value
* @stop_value: the stop value
*
* Answer a segment query by setting the requested values. The normal
* playback segment of a pipeline is 0 to duration at the default rate of
* 1.0. If a seek was performed on the pipeline to play a different
* segment, this query will return the range specified in the last seek.
*
* @start_value and @stop_value will respectively contain the configured
* playback range start and stop values expressed in @format.
* The values are always between 0 and the duration of the media and
* @start_value <= @stop_value. @rate will contain the playback rate. For
* negative rates, playback will actually happen from @stop_value to
* @start_value.
*/
void
gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format,
gint64 start_value, gint64 stop_value)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start_value,
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL);
}
/**
* gst_query_parse_segment:
* @query: a #GstQuery
* @rate: (out) (allow-none): the storage for the rate of the segment, or %NULL
* @format: (out) (allow-none): the storage for the #GstFormat of the values,
* or %NULL
* @start_value: (out) (allow-none): the storage for the start value, or %NULL
* @stop_value: (out) (allow-none): the storage for the stop value, or %NULL
*
* Parse a segment query answer. Any of @rate, @format, @start_value, and
* @stop_value may be %NULL, which will cause this value to be omitted.
*
* See gst_query_set_segment() for an explanation of the function arguments.
*/
void
gst_query_parse_segment (GstQuery * query, gdouble * rate, GstFormat * format,
gint64 * start_value, gint64 * stop_value)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
structure = GST_QUERY_STRUCTURE (query);
if (rate)
*rate = g_value_get_double (gst_structure_id_get_value (structure,
GST_QUARK (RATE)));
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (start_value)
*start_value = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (START_VALUE)));
if (stop_value)
*stop_value = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (STOP_VALUE)));
}
/**
* gst_query_new_custom:
* @type: the query type
* @structure: (allow-none) (transfer full): a structure for the query
*
* Constructs a new custom query object. Use gst_query_unref()
* when done with it.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_custom (GstQueryType type, GstStructure * structure)
{
GstQueryImpl *query;
query = g_slice_new0 (GstQueryImpl);
GST_DEBUG ("creating new query %p %s", query, gst_query_type_get_name (type));
if (structure) {
/* structure must not have a parent */
if (!gst_structure_set_parent_refcount (structure,
&query->query.mini_object.refcount))
goto had_parent;
}
gst_mini_object_init (GST_MINI_OBJECT_CAST (query), 0, _gst_query_type,
(GstMiniObjectCopyFunction) _gst_query_copy, NULL,
(GstMiniObjectFreeFunction) _gst_query_free);
GST_QUERY_TYPE (query) = type;
GST_QUERY_STRUCTURE (query) = structure;
return GST_QUERY_CAST (query);
/* ERRORS */
had_parent:
{
g_slice_free1 (sizeof (GstQueryImpl), query);
g_warning ("structure is already owned by another object");
return NULL;
}
}
/**
* gst_query_get_structure:
* @query: a #GstQuery
*
* Get the structure of a query.
*
* Returns: (transfer none): the #GstStructure of the query. The structure is
* still owned by the query and will therefore be freed when the query
* is unreffed.
*/
const GstStructure *
gst_query_get_structure (GstQuery * query)
{
g_return_val_if_fail (GST_IS_QUERY (query), NULL);
return GST_QUERY_STRUCTURE (query);
}
/**
* gst_query_writable_structure:
* @query: a #GstQuery
*
* Get the structure of a query. This method should be called with a writable
* @query so that the returned structure is guaranteed to be writable.
*
* Returns: (transfer none): the #GstStructure of the query. The structure is
* still owned by the query and will therefore be freed when the query
* is unreffed.
*/
GstStructure *
gst_query_writable_structure (GstQuery * query)
{
g_return_val_if_fail (GST_IS_QUERY (query), NULL);
g_return_val_if_fail (gst_query_is_writable (query), NULL);
return GST_QUERY_STRUCTURE (query);
}
/**
* gst_query_new_seeking:
* @format: the default #GstFormat for the new query
*
* Constructs a new query object for querying seeking properties of
* the stream.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_seeking (GstFormat format)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_SEEKING),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
GST_QUARK (SEGMENT_END), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_SEEKING, structure);
return query;
}
/**
* gst_query_set_seeking:
* @query: a #GstQuery
* @format: the format to set for the @segment_start and @segment_end values
* @seekable: the seekable flag to set
* @segment_start: the segment_start to set
* @segment_end: the segment_end to set
*
* Set the seeking query result fields in @query.
*/
void
gst_query_set_seeking (GstQuery * query, GstFormat format,
gboolean seekable, gint64 segment_start, gint64 segment_end)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable,
GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start,
GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL);
}
/**
* gst_query_parse_seeking:
* @query: a GST_QUERY_SEEKING type query #GstQuery
* @format: (out) (allow-none): the format to set for the @segment_start
* and @segment_end values, or %NULL
* @seekable: (out) (allow-none): the seekable flag to set, or %NULL
* @segment_start: (out) (allow-none): the segment_start to set, or %NULL
* @segment_end: (out) (allow-none): the segment_end to set, or %NULL
*
* Parse a seeking query, writing the format into @format, and
* other results into the passed parameters, if the respective parameters
* are non-%NULL
*/
void
gst_query_parse_seeking (GstQuery * query, GstFormat * format,
gboolean * seekable, gint64 * segment_start, gint64 * segment_end)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
structure = GST_QUERY_STRUCTURE (query);
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (seekable)
*seekable = g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (SEEKABLE)));
if (segment_start)
*segment_start = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (SEGMENT_START)));
if (segment_end)
*segment_end = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (SEGMENT_END)));
}
static GArray *
ensure_array (GstStructure * s, GQuark quark, gsize element_size,
GDestroyNotify clear_func)
{
GArray *array;
const GValue *value;
value = gst_structure_id_get_value (s, quark);
if (value) {
array = (GArray *) g_value_get_boxed (value);
} else {
GValue new_array_val = { 0, };
array = g_array_new (FALSE, TRUE, element_size);
if (clear_func)
g_array_set_clear_func (array, clear_func);
g_value_init (&new_array_val, G_TYPE_ARRAY);
g_value_take_boxed (&new_array_val, array);
gst_structure_id_take_value (s, quark, &new_array_val);
}
return array;
}
/**
* gst_query_new_formats:
*
* Constructs a new query object for querying formats of
* the stream.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_formats (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id_empty (GST_QUARK (QUERY_FORMATS));
query = gst_query_new_custom (GST_QUERY_FORMATS, structure);
return query;
}
static void
gst_query_list_add_format (GValue * list, GstFormat format)
{
GValue item = { 0, };
g_value_init (&item, GST_TYPE_FORMAT);
g_value_set_enum (&item, format);
gst_value_list_append_value (list, &item);
g_value_unset (&item);
}
/**
* gst_query_set_formats:
* @query: a #GstQuery
* @n_formats: the number of formats to set.
* @...: A number of @GstFormats equal to @n_formats.
*
* Set the formats query result fields in @query. The number of formats passed
* must be equal to @n_formats.
*/
void
gst_query_set_formats (GstQuery * query, gint n_formats, ...)
{
va_list ap;
GValue list = { 0, };
gint i;
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
g_return_if_fail (gst_query_is_writable (query));
g_value_init (&list, GST_TYPE_LIST);
va_start (ap, n_formats);
for (i = 0; i < n_formats; i++) {
gst_query_list_add_format (&list, va_arg (ap, GstFormat));
}
va_end (ap);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_set_value (structure, "formats", &list);
g_value_unset (&list);
}
/**
* gst_query_set_formatsv:
* @query: a #GstQuery
* @n_formats: the number of formats to set.
* @formats: (in) (array length=n_formats): an array containing @n_formats
* @GstFormat values.
*
* Set the formats query result fields in @query. The number of formats passed
* in the @formats array must be equal to @n_formats.
*/
void
gst_query_set_formatsv (GstQuery * query, gint n_formats,
const GstFormat * formats)
{
GValue list = { 0, };
gint i;
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
g_return_if_fail (gst_query_is_writable (query));
g_value_init (&list, GST_TYPE_LIST);
for (i = 0; i < n_formats; i++) {
gst_query_list_add_format (&list, formats[i]);
}
structure = GST_QUERY_STRUCTURE (query);
gst_structure_set_value (structure, "formats", &list);
g_value_unset (&list);
}
/**
* gst_query_parse_n_formats:
* @query: a #GstQuery
* @n_formats: (out) (allow-none): the number of formats in this query.
*
* Parse the number of formats in the formats @query.
*/
void
gst_query_parse_n_formats (GstQuery * query, guint * n_formats)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
if (n_formats) {
const GValue *list;
structure = GST_QUERY_STRUCTURE (query);
list = gst_structure_get_value (structure, "formats");
if (list == NULL)
*n_formats = 0;
else
*n_formats = gst_value_list_get_size (list);
}
}
/**
* gst_query_parse_nth_format:
* @query: a #GstQuery
* @nth: (out): the nth format to retrieve.
* @format: (out) (allow-none): a pointer to store the nth format
*
* Parse the format query and retrieve the @nth format from it into
* @format. If the list contains less elements than @nth, @format will be
* set to GST_FORMAT_UNDEFINED.
*/
void
gst_query_parse_nth_format (GstQuery * query, guint nth, GstFormat * format)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
if (format) {
const GValue *list;
structure = GST_QUERY_STRUCTURE (query);
list = gst_structure_get_value (structure, "formats");
if (list == NULL) {
*format = GST_FORMAT_UNDEFINED;
} else {
if (nth < gst_value_list_get_size (list)) {
*format =
(GstFormat) g_value_get_enum (gst_value_list_get_value (list, nth));
} else
*format = GST_FORMAT_UNDEFINED;
}
}
}
/**
* gst_query_new_buffering:
* @format: the default #GstFormat for the new query
*
* Constructs a new query object for querying the buffering status of
* a stream.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_buffering (GstFormat format)
{
GstQuery *query;
GstStructure *structure;
/* by default, we configure the answer as no buffering with a 100% buffering
* progress */
structure = gst_structure_new_id (GST_QUARK (QUERY_BUFFERING),
GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (0),
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
query = gst_query_new_custom (GST_QUERY_BUFFERING, structure);
return query;
}
/**
* gst_query_set_buffering_percent:
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @busy: if buffering is busy
* @percent: a buffering percent
*
* Set the percentage of buffered data. This is a value between 0 and 100.
* The @busy indicator is %TRUE when the buffering is in progress.
*/
void
gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
g_return_if_fail (gst_query_is_writable (query));
g_return_if_fail (percent >= 0 && percent <= 100);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy,
GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL);
}
/**
* gst_query_parse_buffering_percent:
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @busy: (out) (allow-none): if buffering is busy, or %NULL
* @percent: (out) (allow-none): a buffering percent, or %NULL
*
* Get the percentage of buffered data. This is a value between 0 and 100.
* The @busy indicator is %TRUE when the buffering is in progress.
*/
void
gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy,
gint * percent)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
structure = GST_QUERY_STRUCTURE (query);
if (busy)
*busy = g_value_get_boolean (gst_structure_id_get_value (structure,
GST_QUARK (BUSY)));
if (percent)
*percent = g_value_get_int (gst_structure_id_get_value (structure,
GST_QUARK (BUFFER_PERCENT)));
}
/**
* gst_query_set_buffering_stats:
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @mode: a buffering mode
* @avg_in: the average input rate
* @avg_out: the average output rate
* @buffering_left: amount of buffering time left in milliseconds
*
* Configures the buffering stats values in @query.
*/
void
gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
gint avg_in, gint avg_out, gint64 buffering_left)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL);
}
/**
* gst_query_parse_buffering_stats:
* @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
* @mode: (out) (allow-none): a buffering mode, or %NULL
* @avg_in: (out) (allow-none): the average input rate, or %NULL
* @avg_out: (out) (allow-none): the average output rat, or %NULL
* @buffering_left: (out) (allow-none): amount of buffering time left in
* milliseconds, or %NULL
*
* Extracts the buffering stats values from @query.
*/
void
gst_query_parse_buffering_stats (GstQuery * query,
GstBufferingMode * mode, gint * avg_in, gint * avg_out,
gint64 * buffering_left)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
structure = GST_QUERY_STRUCTURE (query);
if (mode)
*mode = (GstBufferingMode)
g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (BUFFERING_MODE)));
if (avg_in)
*avg_in = g_value_get_int (gst_structure_id_get_value (structure,
GST_QUARK (AVG_IN_RATE)));
if (avg_out)
*avg_out = g_value_get_int (gst_structure_id_get_value (structure,
GST_QUARK (AVG_OUT_RATE)));
if (buffering_left)
*buffering_left =
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (BUFFERING_LEFT)));
}
/**
* gst_query_set_buffering_range:
* @query: a #GstQuery
* @format: the format to set for the @start and @stop values
* @start: the start to set
* @stop: the stop to set
* @estimated_total: estimated total amount of download time remaining in
* milliseconds
*
* Set the available query result fields in @query.
*/
void
gst_query_set_buffering_range (GstQuery * query, GstFormat format,
gint64 start, gint64 stop, gint64 estimated_total)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
GST_QUARK (START_VALUE), G_TYPE_INT64, start,
GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop,
GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL);
}
/**
* gst_query_parse_buffering_range:
* @query: a GST_QUERY_BUFFERING type query #GstQuery
* @format: (out) (allow-none): the format to set for the @segment_start
* and @segment_end values, or %NULL
* @start: (out) (allow-none): the start to set, or %NULL
* @stop: (out) (allow-none): the stop to set, or %NULL
* @estimated_total: (out) (allow-none): estimated total amount of download
* time remaining in milliseconds, or %NULL
*
* Parse an available query, writing the format into @format, and
* other results into the passed parameters, if the respective parameters
* are non-%NULL
*/
void
gst_query_parse_buffering_range (GstQuery * query, GstFormat * format,
gint64 * start, gint64 * stop, gint64 * estimated_total)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
structure = GST_QUERY_STRUCTURE (query);
if (format)
*format =
(GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
GST_QUARK (FORMAT)));
if (start)
*start = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (START_VALUE)));
if (stop)
*stop = g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (STOP_VALUE)));
if (estimated_total)
*estimated_total =
g_value_get_int64 (gst_structure_id_get_value (structure,
GST_QUARK (ESTIMATED_TOTAL)));
}
/* GstQueryBufferingRange: internal struct for GArray */
typedef struct
{
gint64 start;
gint64 stop;
} GstQueryBufferingRange;
/**
* gst_query_add_buffering_range:
* @query: a GST_QUERY_BUFFERING type query #GstQuery
* @start: start position of the range
* @stop: stop position of the range
*
* Set the buffering-ranges array field in @query. The current last
* start position of the array should be inferior to @start.
*
* Returns: a #gboolean indicating if the range was added or not.
*/
gboolean
gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
{
GstQueryBufferingRange range;
GstStructure *structure;
GArray *array;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
g_return_val_if_fail (gst_query_is_writable (query), FALSE);
if (G_UNLIKELY (start >= stop))
return FALSE;
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
sizeof (GstQueryBufferingRange), NULL);
if (array->len > 1) {
GstQueryBufferingRange *last;
last = &g_array_index (array, GstQueryBufferingRange, array->len - 1);
if (G_UNLIKELY (start <= last->start))
return FALSE;
}
range.start = start;
range.stop = stop;
g_array_append_val (array, range);
return TRUE;
}
/**
* gst_query_get_n_buffering_ranges:
* @query: a GST_QUERY_BUFFERING type query #GstQuery
*
* Retrieve the number of values currently stored in the
* buffered-ranges array of the query's structure.
*
* Returns: the range array size as a #guint.
*/
guint
gst_query_get_n_buffering_ranges (GstQuery * query)
{
GstStructure *structure;
GArray *array;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
sizeof (GstQueryBufferingRange), NULL);
return array->len;
}
/**
* gst_query_parse_nth_buffering_range:
* @query: a GST_QUERY_BUFFERING type query #GstQuery
* @index: position in the buffered-ranges array to read
* @start: (out) (allow-none): the start position to set, or %NULL
* @stop: (out) (allow-none): the stop position to set, or %NULL
*
* Parse an available query and get the start and stop values stored
* at the @index of the buffered ranges array.
*
* Returns: a #gboolean indicating if the parsing succeeded.
*/
gboolean
gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
gint64 * start, gint64 * stop)
{
GstQueryBufferingRange *range;
GstStructure *structure;
GArray *array;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
sizeof (GstQueryBufferingRange), NULL);
g_return_val_if_fail (index < array->len, FALSE);
range = &g_array_index (array, GstQueryBufferingRange, index);
if (start)
*start = range->start;
if (stop)
*stop = range->stop;
return TRUE;
}
/**
* gst_query_new_uri:
*
* Constructs a new query URI query object. Use gst_query_unref()
* when done with it. An URI query is used to query the current URI
* that is used by the source or sink.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_uri (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_URI),
GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
query = gst_query_new_custom (GST_QUERY_URI, structure);
return query;
}
/**
* gst_query_set_uri:
* @query: a #GstQuery with query type GST_QUERY_URI
* @uri: the URI to set
*
* Answer a URI query by setting the requested URI.
*/
void
gst_query_set_uri (GstQuery * query, const gchar * uri)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
g_return_if_fail (gst_query_is_writable (query));
g_return_if_fail (gst_uri_is_valid (uri));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL);
}
/**
* gst_query_parse_uri:
* @query: a #GstQuery
* @uri: (out) (transfer full) (allow-none): the storage for the current URI
* (may be %NULL)
*
* Parse an URI query, writing the URI into @uri as a newly
* allocated string, if the respective parameters are non-%NULL.
* Free the string with g_free() after usage.
*/
void
gst_query_parse_uri (GstQuery * query, gchar ** uri)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
structure = GST_QUERY_STRUCTURE (query);
if (uri)
*uri = g_value_dup_string (gst_structure_id_get_value (structure,
GST_QUARK (URI)));
}
/**
* gst_query_set_uri_redirection:
* @query: a #GstQuery with query type GST_QUERY_URI
* @uri: the URI to set
*
* Answer a URI query by setting the requested URI redirection.
*
* Since: 1.2
*/
void
gst_query_set_uri_redirection (GstQuery * query, const gchar * uri)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
g_return_if_fail (gst_query_is_writable (query));
g_return_if_fail (gst_uri_is_valid (uri));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION),
G_TYPE_STRING, uri, NULL);
}
/**
* gst_query_parse_uri_redirection:
* @query: a #GstQuery
* @uri: (out) (transfer full) (allow-none): the storage for the redirect URI
* (may be %NULL)
*
* Parse an URI query, writing the URI into @uri as a newly
* allocated string, if the respective parameters are non-%NULL.
* Free the string with g_free() after usage.
*
* Since: 1.2
*/
void
gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
structure = GST_QUERY_STRUCTURE (query);
if (uri) {
if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION),
G_TYPE_STRING, uri, NULL))
*uri = NULL;
}
}
/**
* gst_query_set_uri_redirection_permanent:
* @query: a #GstQuery with query type %GST_QUERY_URI
* @permanent: whether the redirect is permanent or not
*
* Answer a URI query by setting the requested URI redirection
* to permanent or not.
*
* Since: 1.4
*/
void
gst_query_set_uri_redirection_permanent (GstQuery * query, gboolean permanent)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION_PERMANENT),
G_TYPE_BOOLEAN, permanent, NULL);
}
/**
* gst_query_parse_uri_redirection_permanent:
* @query: a #GstQuery
* @permanent: (out) (allow-none): if the URI redirection is permanent
* (may be %NULL)
*
* Parse an URI query, and set @permanent to %TRUE if there is a redirection
* and it should be considered permanent. If a redirection is permanent,
* applications should update their internal storage of the URI, otherwise
* they should make all future requests to the original URI.
*
* Since: 1.4
*/
void
gst_query_parse_uri_redirection_permanent (GstQuery * query,
gboolean * permanent)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
structure = GST_QUERY_STRUCTURE (query);
if (permanent) {
if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION_PERMANENT),
G_TYPE_BOOLEAN, permanent, NULL))
*permanent = FALSE;
}
}
/**
* gst_query_new_allocation:
* @caps: the negotiated caps
* @need_pool: return a pool
*
* Constructs a new query object for querying the allocation properties.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_allocation (GstCaps * caps, gboolean need_pool)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_ALLOCATION),
GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
query = gst_query_new_custom (GST_QUERY_ALLOCATION, structure);
return query;
}
/**
* gst_query_parse_allocation:
* @query: a #GstQuery
* @caps: (out) (transfer none) (allow-none): The #GstCaps
* @need_pool: (out) (allow-none): Whether a #GstBufferPool is needed
*
* Parse an allocation query, writing the requested caps in @caps and
* whether a pool is needed in @need_pool, if the respective parameters
* are non-%NULL.
*/
void
gst_query_parse_allocation (GstQuery * query, GstCaps ** caps,
gboolean * need_pool)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query);
if (caps) {
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
GST_QUARK (CAPS)));
}
gst_structure_id_get (structure,
GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
}
typedef struct
{
GstBufferPool *pool;
guint size;
guint min_buffers;
guint max_buffers;
} AllocationPool;
static void
allocation_pool_free (AllocationPool * ap)
{
if (ap->pool)
gst_object_unref (ap->pool);
}
/**
* gst_query_add_allocation_pool:
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
* @pool: (transfer none) (allow-none): the #GstBufferPool
* @size: the size
* @min_buffers: the min buffers
* @max_buffers: the max buffers
*
* Set the pool parameters in @query.
*/
void
gst_query_add_allocation_pool (GstQuery * query, GstBufferPool * pool,
guint size, guint min_buffers, guint max_buffers)
{
GArray *array;
GstStructure *structure;
AllocationPool ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (gst_query_is_writable (query));
g_return_if_fail (size != 0);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL),
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
if ((ap.pool = pool))
gst_object_ref (pool);
ap.size = size;
ap.min_buffers = min_buffers;
ap.max_buffers = max_buffers;
g_array_append_val (array, ap);
}
/**
* gst_query_get_n_allocation_pools:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
*
* Retrieve the number of values currently stored in the
* pool array of the query's structure.
*
* Returns: the pool array size as a #guint.
*/
guint
gst_query_get_n_allocation_pools (GstQuery * query)
{
GArray *array;
GstStructure *structure;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL),
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
return array->len;
}
/**
* gst_query_parse_nth_allocation_pool:
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
* @index: index to parse
* @pool: (out) (allow-none) (transfer full): the #GstBufferPool
* @size: (out) (allow-none): the size
* @min_buffers: (out) (allow-none): the min buffers
* @max_buffers: (out) (allow-none): the max buffers
*
* Get the pool parameters in @query.
*
* Unref @pool with gst_object_unref() when it's not needed any more.
*/
void
gst_query_parse_nth_allocation_pool (GstQuery * query, guint index,
GstBufferPool ** pool, guint * size, guint * min_buffers,
guint * max_buffers)
{
GArray *array;
GstStructure *structure;
AllocationPool *ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL),
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len);
ap = &g_array_index (array, AllocationPool, index);
if (pool)
if ((*pool = ap->pool))
gst_object_ref (*pool);
if (size)
*size = ap->size;
if (min_buffers)
*min_buffers = ap->min_buffers;
if (max_buffers)
*max_buffers = ap->max_buffers;
}
/**
* gst_query_set_nth_allocation_pool:
* @index: index to modify
* @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
* @pool: (transfer none) (allow-none): the #GstBufferPool
* @size: the size
* @min_buffers: the min buffers
* @max_buffers: the max buffers
*
* Set the pool parameters in @query.
*/
void
gst_query_set_nth_allocation_pool (GstQuery * query, guint index,
GstBufferPool * pool, guint size, guint min_buffers, guint max_buffers)
{
GArray *array;
GstStructure *structure;
AllocationPool *oldap, ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (POOL),
sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len);
oldap = &g_array_index (array, AllocationPool, index);
allocation_pool_free (oldap);
if ((ap.pool = pool))
gst_object_ref (pool);
ap.size = size;
ap.min_buffers = min_buffers;
ap.max_buffers = max_buffers;
g_array_index (array, AllocationPool, index) = ap;
}
/**
* gst_query_remove_nth_allocation_pool:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocation pool array to remove
*
* Remove the allocation pool at @index of the allocation pool array.
*
* Since: 1.2
*/
void
gst_query_remove_nth_allocation_pool (GstQuery * query, guint index)
{
GArray *array;
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (POOL), sizeof (AllocationPool),
(GDestroyNotify) allocation_pool_free);
g_return_if_fail (index < array->len);
g_array_remove_index (array, index);
}
typedef struct
{
GType api;
GstStructure *params;
} AllocationMeta;
static void
allocation_meta_free (AllocationMeta * am)
{
if (am->params)
gst_structure_free (am->params);
}
/**
* gst_query_add_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @api: the metadata API
* @params: (transfer none) (allow-none): API specific parameters
*
* Add @api with @params as one of the supported metadata API to @query.
*/
void
gst_query_add_allocation_meta (GstQuery * query, GType api,
const GstStructure * params)
{
GArray *array;
GstStructure *structure;
AllocationMeta am;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (api != 0);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free);
am.api = api;
am.params = (params ? gst_structure_copy (params) : NULL);
g_array_append_val (array, am);
}
/**
* gst_query_get_n_allocation_metas:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
*
* Retrieve the number of values currently stored in the
* meta API array of the query's structure.
*
* Returns: the metadata API array size as a #guint.
*/
guint
gst_query_get_n_allocation_metas (GstQuery * query)
{
GArray *array;
GstStructure *structure;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free);
return array->len;
}
/**
* gst_query_parse_nth_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the metadata API array to read
* @params: (out) (transfer none) (allow-none): API specific flags
*
* Parse an available query and get the metadata API
* at @index of the metadata API array.
*
* Returns: a #GType of the metadata API at @index.
*/
GType
gst_query_parse_nth_allocation_meta (GstQuery * query, guint index,
const GstStructure ** params)
{
GArray *array;
GstStructure *structure;
AllocationMeta *am;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free);
g_return_val_if_fail (index < array->len, 0);
am = &g_array_index (array, AllocationMeta, index);
if (params)
*params = am->params;
return am->api;
}
/**
* gst_query_remove_nth_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the metadata API array to remove
*
* Remove the metadata API at @index of the metadata API array.
*/
void
gst_query_remove_nth_allocation_meta (GstQuery * query, guint index)
{
GArray *array;
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free);
g_return_if_fail (index < array->len);
g_array_remove_index (array, index);
}
/**
* gst_query_find_allocation_meta:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @api: the metadata API
* @index: (out) (transfer none) (allow-none): the index
*
* Check if @query has metadata @api set. When this function returns %TRUE,
* @index will contain the index where the requested API and the flags can be
* found.
*
* Returns: %TRUE when @api is in the list of metadata.
*/
gboolean
gst_query_find_allocation_meta (GstQuery * query, GType api, guint * index)
{
GArray *array;
GstStructure *structure;
guint i, len;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, FALSE);
g_return_val_if_fail (api != 0, FALSE);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (META), sizeof (AllocationMeta),
(GDestroyNotify) allocation_meta_free);
len = array->len;
for (i = 0; i < len; i++) {
AllocationMeta *am = &g_array_index (array, AllocationMeta, i);
if (am->api == api) {
if (index)
*index = i;
return TRUE;
}
}
return FALSE;
}
typedef struct
{
GstAllocator *allocator;
GstAllocationParams params;
} AllocationParam;
static void
allocation_param_free (AllocationParam * ap)
{
if (ap->allocator)
gst_object_unref (ap->allocator);
}
/**
* gst_query_add_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @allocator: (transfer none) (allow-none): the memory allocator
* @params: (transfer none) (allow-none): a #GstAllocationParams
*
* Add @allocator and its @params as a supported memory allocator.
*/
void
gst_query_add_allocation_param (GstQuery * query, GstAllocator * allocator,
const GstAllocationParams * params)
{
GArray *array;
GstStructure *structure;
AllocationParam ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (gst_query_is_writable (query));
g_return_if_fail (allocator != NULL || params != NULL);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
if ((ap.allocator = allocator))
gst_object_ref (allocator);
if (params)
ap.params = *params;
else
gst_allocation_params_init (&ap.params);
g_array_append_val (array, ap);
}
/**
* gst_query_get_n_allocation_params:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
*
* Retrieve the number of values currently stored in the
* allocator params array of the query's structure.
*
* If no memory allocator is specified, the downstream element can handle
* the default memory allocator. The first memory allocator in the query
* should be generic and allow mapping to system memory, all following
* allocators should be ordered by preference with the preferred one first.
*
* Returns: the allocator array size as a #guint.
*/
guint
gst_query_get_n_allocation_params (GstQuery * query)
{
GArray *array;
GstStructure *structure;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
return array->len;
}
/**
* gst_query_parse_nth_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocator array to read
* @allocator: (out) (transfer full) (allow-none): variable to hold the result
* @params: (out) (allow-none): parameters for the allocator
*
* Parse an available query and get the allocator and its params
* at @index of the allocator array.
*/
void
gst_query_parse_nth_allocation_param (GstQuery * query, guint index,
GstAllocator ** allocator, GstAllocationParams * params)
{
GArray *array;
GstStructure *structure;
AllocationParam *ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len);
ap = &g_array_index (array, AllocationParam, index);
if (allocator)
if ((*allocator = ap->allocator))
gst_object_ref (*allocator);
if (params)
*params = ap->params;
}
/**
* gst_query_set_nth_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocator array to set
* @allocator: (transfer none) (allow-none): new allocator to set
* @params: (transfer none) (allow-none): parameters for the allocator
*
* Parse an available query and get the allocator and its params
* at @index of the allocator array.
*/
void
gst_query_set_nth_allocation_param (GstQuery * query, guint index,
GstAllocator * allocator, const GstAllocationParams * params)
{
GArray *array;
GstStructure *structure;
AllocationParam *old, ap;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
structure = GST_QUERY_STRUCTURE (query);
array = ensure_array (structure, GST_QUARK (ALLOCATOR),
sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len);
old = &g_array_index (array, AllocationParam, index);
allocation_param_free (old);
if ((ap.allocator = allocator))
gst_object_ref (allocator);
if (params)
ap.params = *params;
else
gst_allocation_params_init (&ap.params);
g_array_index (array, AllocationParam, index) = ap;
}
/**
* gst_query_remove_nth_allocation_param:
* @query: a GST_QUERY_ALLOCATION type query #GstQuery
* @index: position in the allocation param array to remove
*
* Remove the allocation param at @index of the allocation param array.
*
* Since: 1.2
*/
void
gst_query_remove_nth_allocation_param (GstQuery * query, guint index)
{
GArray *array;
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (ALLOCATOR), sizeof (AllocationParam),
(GDestroyNotify) allocation_param_free);
g_return_if_fail (index < array->len);
g_array_remove_index (array, index);
}
/**
* gst_query_new_scheduling:
*
* Constructs a new query object for querying the scheduling properties.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_scheduling (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_SCHEDULING),
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, 0,
GST_QUARK (MINSIZE), G_TYPE_INT, 1,
GST_QUARK (MAXSIZE), G_TYPE_INT, -1,
GST_QUARK (ALIGN), G_TYPE_INT, 0, NULL);
query = gst_query_new_custom (GST_QUERY_SCHEDULING, structure);
return query;
}
/**
* gst_query_set_scheduling:
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
* @flags: #GstSchedulingFlags
* @minsize: the suggested minimum size of pull requests
* @maxsize: the suggested maximum size of pull requests
* @align: the suggested alignment of pull requests
*
* Set the scheduling properties.
*/
void
gst_query_set_scheduling (GstQuery * query, GstSchedulingFlags flags,
gint minsize, gint maxsize, gint align)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
}
/**
* gst_query_parse_scheduling:
* @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
* @flags: (out) (allow-none): #GstSchedulingFlags
* @minsize: (out) (allow-none): the suggested minimum size of pull requests
* @maxsize: (out) (allow-none): the suggested maximum size of pull requests:
* @align: (out) (allow-none): the suggested alignment of pull requests
*
* Set the scheduling properties.
*/
void
gst_query_parse_scheduling (GstQuery * query, GstSchedulingFlags * flags,
gint * minsize, gint * maxsize, gint * align)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_get (structure,
GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
}
/**
* gst_query_add_scheduling_mode:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
* @mode: a #GstPadMode
*
* Add @mode as one of the supported scheduling modes to @query.
*/
void
gst_query_add_scheduling_mode (GstQuery * query, GstPadMode mode)
{
GstStructure *structure;
GArray *array;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
g_array_append_val (array, mode);
}
/**
* gst_query_get_n_scheduling_modes:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
*
* Retrieve the number of values currently stored in the
* scheduling mode array of the query's structure.
*
* Returns: the scheduling mode array size as a #guint.
*/
guint
gst_query_get_n_scheduling_modes (GstQuery * query)
{
GArray *array;
GstStructure *structure;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, 0);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
return array->len;
}
/**
* gst_query_parse_nth_scheduling_mode:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
* @index: position in the scheduling modes array to read
*
* Parse an available query and get the scheduling mode
* at @index of the scheduling modes array.
*
* Returns: a #GstPadMode of the scheduling mode at @index.
*/
GstPadMode
gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index)
{
GstStructure *structure;
GArray *array;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING,
GST_PAD_MODE_NONE);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE);
return g_array_index (array, GstPadMode, index);
}
/**
* gst_query_has_scheduling_mode:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
* @mode: the scheduling mode
*
* Check if @query has scheduling mode set.
*
* <note>
* <para>
* When checking if upstream supports pull mode, it is usually not
* enough to just check for GST_PAD_MODE_PULL with this function, you
* also want to check whether the scheduling flags returned by
* gst_query_parse_scheduling() have the seeking flag set (meaning
* random access is supported, not only sequential pulls).
* </para>
* </note>
*
* Returns: %TRUE when @mode is in the list of scheduling modes.
*/
gboolean
gst_query_has_scheduling_mode (GstQuery * query, GstPadMode mode)
{
GstStructure *structure;
GArray *array;
guint i, len;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
structure = GST_QUERY_STRUCTURE (query);
array =
ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
len = array->len;
for (i = 0; i < len; i++) {
if (mode == g_array_index (array, GstPadMode, i))
return TRUE;
}
return FALSE;
}
/**
* gst_query_has_scheduling_mode_with_flags:
* @query: a GST_QUERY_SCHEDULING type query #GstQuery
* @mode: the scheduling mode
* @flags: #GstSchedulingFlags
*
* Check if @query has scheduling mode set and @flags is set in
* query scheduling flags.
*
* Returns: %TRUE when @mode is in the list of scheduling modes
* and @flags are compatible with query flags.
*/
gboolean
gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
GstSchedulingFlags flags)
{
GstSchedulingFlags sched_flags;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
gst_query_parse_scheduling (query, &sched_flags, NULL, NULL, NULL);
return ((flags & sched_flags) == flags) &&
gst_query_has_scheduling_mode (query, mode);
}
/**
* gst_query_new_accept_caps:
* @caps: a fixed #GstCaps
*
* Constructs a new query object for querying if @caps are accepted.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_accept_caps (GstCaps * caps)
{
GstQuery *query;
GstStructure *structure;
g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
structure = gst_structure_new_id (GST_QUARK (QUERY_ACCEPT_CAPS),
GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
GST_QUARK (RESULT), G_TYPE_BOOLEAN, FALSE, NULL);
query = gst_query_new_custom (GST_QUERY_ACCEPT_CAPS, structure);
return query;
}
/**
* gst_query_parse_accept_caps:
* @query: The query to parse
* @caps: (out) (transfer none): A pointer to the caps
*
* Get the caps from @query. The caps remains valid as long as @query remains
* valid.
*/
void
gst_query_parse_accept_caps (GstQuery * query, GstCaps ** caps)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
g_return_if_fail (caps != NULL);
structure = GST_QUERY_STRUCTURE (query);
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
GST_QUARK (CAPS)));
}
/**
* gst_query_set_accept_caps_result:
* @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
* @result: the result to set
*
* Set @result as the result for the @query.
*/
void
gst_query_set_accept_caps_result (GstQuery * query, gboolean result)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure,
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
}
/**
* gst_query_parse_accept_caps_result:
* @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
* @result: location for the result
*
* Parse the result from @query and store in @result.
*/
void
gst_query_parse_accept_caps_result (GstQuery * query, gboolean * result)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_get (structure,
GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
}
/**
* gst_query_new_caps:
* @filter: a filter
*
* Constructs a new query object for querying the caps.
*
* The CAPS query should return the allowable caps for a pad in the context
* of the element's state, its link to other elements, and the devices or files
* it has opened. These caps must be a subset of the pad template caps. In the
* NULL state with no links, the CAPS query should ideally return the same caps
* as the pad template. In rare circumstances, an object property can affect
* the caps returned by the CAPS query, but this is discouraged.
*
* For most filters, the caps returned by CAPS query is directly affected by the
* allowed caps on other pads. For demuxers and decoders, the caps returned by
* the srcpad's getcaps function is directly related to the stream data. Again,
* the CAPS query should return the most specific caps it reasonably can, since this
* helps with autoplugging.
*
* The @filter is used to restrict the result caps, only the caps matching
* @filter should be returned from the CAPS query. Specifying a filter might
* greatly reduce the amount of processing an element needs to do.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_caps (GstCaps * filter)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id (GST_QUARK (QUERY_CAPS),
GST_QUARK (FILTER), GST_TYPE_CAPS, filter,
GST_QUARK (CAPS), GST_TYPE_CAPS, NULL, NULL);
query = gst_query_new_custom (GST_QUERY_CAPS, structure);
return query;
}
/**
* gst_query_parse_caps:
* @query: The query to parse
* @filter: (out) (transfer none): A pointer to the caps filter
*
* Get the filter from the caps @query. The caps remains valid as long as
* @query remains valid.
*/
void
gst_query_parse_caps (GstQuery * query, GstCaps ** filter)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
g_return_if_fail (filter != NULL);
structure = GST_QUERY_STRUCTURE (query);
*filter = g_value_get_boxed (gst_structure_id_get_value (structure,
GST_QUARK (FILTER)));
}
/**
* gst_query_set_caps_result:
* @query: The query to use
* @caps: (in): A pointer to the caps
*
* Set the @caps result in @query.
*/
void
gst_query_set_caps_result (GstQuery * query, GstCaps * caps)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
g_return_if_fail (gst_query_is_writable (query));
structure = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (structure, GST_QUARK (CAPS), GST_TYPE_CAPS, caps, NULL);
}
/**
* gst_query_parse_caps_result:
* @query: The query to parse
* @caps: (out) (transfer none): A pointer to the caps
*
* Get the caps result from @query. The caps remains valid as long as
* @query remains valid.
*/
void
gst_query_parse_caps_result (GstQuery * query, GstCaps ** caps)
{
GstStructure *structure;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
g_return_if_fail (caps != NULL);
structure = GST_QUERY_STRUCTURE (query);
*caps = g_value_get_boxed (gst_structure_id_get_value (structure,
GST_QUARK (CAPS)));
}
#if 0
void
gst_query_intersect_caps_result (GstQuery * query, GstCaps * filter,
GstCapsIntersectMode mode)
{
GstCaps *res, *caps = NULL;
gst_query_parse_caps_result (query, &caps);
res = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
gst_query_set_caps_result (query, res);
gst_caps_unref (res);
}
#endif
/**
* gst_query_new_drain:
*
* Constructs a new query object for querying the drain state.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*/
GstQuery *
gst_query_new_drain (void)
{
GstQuery *query;
GstStructure *structure;
structure = gst_structure_new_id_empty (GST_QUARK (QUERY_DRAIN));
query = gst_query_new_custom (GST_QUERY_DRAIN, structure);
return query;
}
/**
* gst_query_new_context:
* @context_type: Context type to query
*
* Constructs a new query object for querying the pipeline-local context.
*
* Free-function: gst_query_unref
*
* Returns: (transfer full): a new #GstQuery
*
* Since: 1.2
*/
GstQuery *
gst_query_new_context (const gchar * context_type)
{
GstQuery *query;
GstStructure *structure;
g_return_val_if_fail (context_type != NULL, NULL);
structure = gst_structure_new_id (GST_QUARK (QUERY_CONTEXT),
GST_QUARK (CONTEXT_TYPE), G_TYPE_STRING, context_type, NULL);
query = gst_query_new_custom (GST_QUERY_CONTEXT, structure);
return query;
}
/**
* gst_query_set_context:
* @query: a #GstQuery with query type GST_QUERY_CONTEXT
* @context: the requested #GstContext
*
* Answer a context query by setting the requested context.
*
* Since: 1.2
*/
void
gst_query_set_context (GstQuery * query, GstContext * context)
{
GstStructure *s;
const gchar *context_type;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT);
gst_query_parse_context_type (query, &context_type);
g_return_if_fail (strcmp (gst_context_get_context_type (context),
context_type) == 0);
s = GST_QUERY_STRUCTURE (query);
gst_structure_id_set (s,
GST_QUARK (CONTEXT), GST_TYPE_CONTEXT, context, NULL);
}
/**
* gst_query_parse_context:
* @query: The query to parse
* @context: (out) (transfer none): A pointer to store the #GstContext
*
* Get the context from the context @query. The context remains valid as long as
* @query remains valid.
*
* Since: 1.2
*/
void
gst_query_parse_context (GstQuery * query, GstContext ** context)
{
GstStructure *structure;
const GValue *v;
g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT);
g_return_if_fail (context != NULL);
structure = GST_QUERY_STRUCTURE (query);
v = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT));
if (v)
*context = g_value_get_boxed (v);
else
*context = NULL;
}
/**
* gst_query_parse_context_type:
* @query: a GST_QUERY_CONTEXT type query
* @context_type: (out) (transfer none) (allow-none): the context type, or %NULL
*
* Parse a context type from an existing GST_QUERY_CONTEXT query.
*
* Returns: a #gboolean indicating if the parsing succeeded.
*
* Since: 1.2
*/
gboolean
gst_query_parse_context_type (GstQuery * query, const gchar ** context_type)
{
GstStructure *structure;
const GValue *value;
g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE);
structure = GST_QUERY_STRUCTURE (query);
if (context_type) {
value = gst_structure_id_get_value (structure, GST_QUARK (CONTEXT_TYPE));
*context_type = g_value_get_string (value);
}
return TRUE;
}
|