/usr/include/d/gtkd-3/gstreamer/Pad.d is in libgstreamerd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gstreamer.Pad;
private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gstreamer.Buffer;
private import gstreamer.BufferList;
private import gstreamer.Caps;
private import gstreamer.Element;
private import gstreamer.Event;
private import gstreamer.Iterator;
private import gstreamer.ObjectGst;
private import gstreamer.PadTemplate;
private import gstreamer.Query;
private import gstreamer.StaticPadTemplate;
private import gstreamer.Stream;
private import gstreamer.c.functions;
public import gstreamer.c.types;
public import gstreamerc.gstreamertypes;
private import std.algorithm;
/**
* A #GstElement is linked to other elements via "pads", which are extremely
* light-weight generic link points.
*
* Pads have a #GstPadDirection, source pads produce data, sink pads consume
* data.
*
* Pads are typically created from a #GstPadTemplate with
* gst_pad_new_from_template() and are then added to a #GstElement. This usually
* happens when the element is created but it can also happen dynamically based
* on the data that the element is processing or based on the pads that the
* application requests.
*
* Pads without pad templates can be created with gst_pad_new(),
* which takes a direction and a name as an argument. If the name is %NULL,
* then a guaranteed unique name will be assigned to it.
*
* A #GstElement creating a pad will typically use the various
* gst_pad_set_*_function() calls to register callbacks for events, queries or
* dataflow on the pads.
*
* gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
*
* After two pads are retrieved from an element by gst_element_get_static_pad(),
* the pads can be linked with gst_pad_link(). (For quick links,
* you can also use gst_element_link(), which will make the obvious
* link for you if it's straightforward.). Pads can be unlinked again with
* gst_pad_unlink(). gst_pad_get_peer() can be used to check what the pad is
* linked to.
*
* Before dataflow is possible on the pads, they need to be activated with
* gst_pad_set_active().
*
* gst_pad_query() and gst_pad_peer_query() can be used to query various
* properties of the pad and the stream.
*
* To send a #GstEvent on a pad, use gst_pad_send_event() and
* gst_pad_push_event(). Some events will be sticky on the pad, meaning that
* after they pass on the pad they can be queried later with
* gst_pad_get_sticky_event() and gst_pad_sticky_events_foreach().
* gst_pad_get_current_caps() and gst_pad_has_current_caps() are convenience
* functions to query the current sticky CAPS event on a pad.
*
* GstElements will use gst_pad_push() and gst_pad_pull_range() to push out
* or pull in a buffer.
*
* The dataflow, events and queries that happen on a pad can be monitored with
* probes that can be installed with gst_pad_add_probe(). gst_pad_is_blocked()
* can be used to check if a block probe is installed on the pad.
* gst_pad_is_blocking() checks if the blocking probe is currently blocking the
* pad. gst_pad_remove_probe() is used to remove a previously installed probe
* and unblock blocking probes if any.
*
* Pad have an offset that can be retrieved with gst_pad_get_offset(). This
* offset will be applied to the running_time of all data passing over the pad.
* gst_pad_set_offset() can be used to change the offset.
*
* Convenience functions exist to start, pause and stop the task on a pad with
* gst_pad_start_task(), gst_pad_pause_task() and gst_pad_stop_task()
* respectively.
*/
public class Pad : ObjectGst
{
/** the main Gtk struct */
protected GstPad* gstPad;
/** Get the main Gtk struct */
public GstPad* getPadStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gstPad;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gstPad;
}
protected override void setStruct(GObject* obj)
{
gstPad = cast(GstPad*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GstPad* gstPad, bool ownedRef = false)
{
this.gstPad = gstPad;
super(cast(GstObject*)gstPad, ownedRef);
}
/**
* Queries a pad for the stream position.
* This is a convenience function for gstreamerD.
* Returns:
* The current position in nanoseconds - GstFormat.TIME.
*/
public long queryPosition()
{
long cur_pos;
queryPosition( GstFormat.TIME, cur_pos );
return cur_pos;
}
/**
* Queries a pad for the stream duration.
* This is a convenience function for gstreamerD.
* Returns:
* The duration in nanoseconds - GstFormat.TIME.
*/
public long queryDuration()
{
long cur_dur;
queryDuration( GstFormat.TIME, cur_dur );
return cur_dur;
}
/**
*/
/** */
public static GType getType()
{
return gst_pad_get_type();
}
/**
* Creates a new pad with the given name in the given direction.
* If name is %NULL, a guaranteed unique name (across all pads)
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
* Params:
* name = the name of the new pad.
* direction = the #GstPadDirection of the pad.
*
* Returns: a new #GstPad, or %NULL in
* case of an error.
*
* MT safe.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(string name, GstPadDirection direction)
{
auto p = gst_pad_new(Str.toStringz(name), direction);
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GstPad*) p);
}
/**
* Creates a new pad with the given name from the given static template.
* If name is %NULL, a guaranteed unique name (across all pads)
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
* Params:
* templ = the #GstStaticPadTemplate to use
* name = the name of the pad
*
* Returns: a new #GstPad, or %NULL in
* case of an error.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(StaticPadTemplate templ, string name)
{
auto p = gst_pad_new_from_static_template((templ is null) ? null : templ.getStaticPadTemplateStruct(), Str.toStringz(name));
if(p is null)
{
throw new ConstructionException("null returned by new_from_static_template");
}
this(cast(GstPad*) p);
}
/**
* Creates a new pad with the given name from the given template.
* If name is %NULL, a guaranteed unique name (across all pads)
* will be assigned.
* This function makes a copy of the name so you can safely free the name.
*
* Params:
* templ = the pad template to use
* name = the name of the pad
*
* Returns: a new #GstPad, or %NULL in
* case of an error.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(PadTemplate templ, string name)
{
auto p = gst_pad_new_from_template((templ is null) ? null : templ.getPadTemplateStruct(), Str.toStringz(name));
if(p is null)
{
throw new ConstructionException("null returned by new_from_template");
}
this(cast(GstPad*) p);
}
/**
* Gets a string representing the given pad-link return.
*
* Params:
* ret = a #GstPadLinkReturn to get the name of.
*
* Returns: a static string with the name of the pad-link return.
*
* Since: 1.4
*/
public static string linkGetName(GstPadLinkReturn ret)
{
return Str.toString(gst_pad_link_get_name(ret));
}
/**
* Activates or deactivates the given pad in @mode via dispatching to the
* pad's activatemodefunc. For use from within pad activation functions only.
*
* If you don't know what this is, you probably don't want to call it.
*
* Params:
* mode = the requested activation mode
* active = whether or not the pad should be active.
*
* Returns: %TRUE if the operation was successful.
*
* MT safe.
*/
public bool activateMode(GstPadMode mode, bool active)
{
return gst_pad_activate_mode(gstPad, mode, active) != 0;
}
/**
* Be notified of different states of pads. The provided callback is called for
* every state that matches @mask.
*
* Probes are called in groups: First GST_PAD_PROBE_TYPE_BLOCK probes are
* called, then others, then finally GST_PAD_PROBE_TYPE_IDLE. The only
* exception here are GST_PAD_PROBE_TYPE_IDLE probes that are called
* immediately if the pad is already idle while calling gst_pad_add_probe().
* In each of the groups, probes are called in the order in which they were
* added.
*
* Params:
* mask = the probe mask
* callback = #GstPadProbeCallback that will be called with notifications of
* the pad state
* userData = user data passed to the callback
* destroyData = #GDestroyNotify for user_data
*
* Returns: an id or 0 if no probe is pending. The id can be used to remove the
* probe with gst_pad_remove_probe(). When using GST_PAD_PROBE_TYPE_IDLE it can
* happen that the probe can be run immediately and if the probe returns
* GST_PAD_PROBE_REMOVE this functions returns 0.
*
* MT safe.
*/
public gulong addProbe(GstPadProbeType mask, GstPadProbeCallback callback, void* userData, GDestroyNotify destroyData)
{
return gst_pad_add_probe(gstPad, mask, callback, userData, destroyData);
}
/**
* Checks if the source pad and the sink pad are compatible so they can be
* linked.
*
* Params:
* sinkpad = the sink #GstPad.
*
* Returns: %TRUE if the pads can be linked.
*/
public bool canLink(Pad sinkpad)
{
return gst_pad_can_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct()) != 0;
}
/**
* Chain a buffer to @pad.
*
* The function returns #GST_FLOW_FLUSHING if the pad was flushing.
*
* If the buffer type is not acceptable for @pad (as negotiated with a
* preceding GST_EVENT_CAPS event), this function returns
* #GST_FLOW_NOT_NEGOTIATED.
*
* The function proceeds calling the chain function installed on @pad (see
* gst_pad_set_chain_function()) and the return value of that function is
* returned to the caller. #GST_FLOW_NOT_SUPPORTED is returned if @pad has no
* chain function.
*
* In all cases, success or failure, the caller loses its reference to @buffer
* after calling this function.
*
* Params:
* buffer = the #GstBuffer to send, return GST_FLOW_ERROR
* if not.
*
* Returns: a #GstFlowReturn from the pad.
*
* MT safe.
*/
public GstFlowReturn chain(Buffer buffer)
{
return gst_pad_chain(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
}
/**
* Chain a bufferlist to @pad.
*
* The function returns #GST_FLOW_FLUSHING if the pad was flushing.
*
* If @pad was not negotiated properly with a CAPS event, this function
* returns #GST_FLOW_NOT_NEGOTIATED.
*
* The function proceeds calling the chainlist function installed on @pad (see
* gst_pad_set_chain_list_function()) and the return value of that function is
* returned to the caller. #GST_FLOW_NOT_SUPPORTED is returned if @pad has no
* chainlist function.
*
* In all cases, success or failure, the caller loses its reference to @list
* after calling this function.
*
* MT safe.
*
* Params:
* list = the #GstBufferList to send, return GST_FLOW_ERROR
* if not.
*
* Returns: a #GstFlowReturn from the pad.
*/
public GstFlowReturn chainList(BufferList list)
{
return gst_pad_chain_list(gstPad, (list is null) ? null : list.getBufferListStruct());
}
/**
* Check and clear the #GST_PAD_FLAG_NEED_RECONFIGURE flag on @pad and return %TRUE
* if the flag was set.
*
* Returns: %TRUE is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on @pad.
*/
public bool checkReconfigure()
{
return gst_pad_check_reconfigure(gstPad) != 0;
}
/**
* Creates a stream-id for the source #GstPad @pad by combining the
* upstream information with the optional @stream_id of the stream
* of @pad. @pad must have a parent #GstElement and which must have zero
* or one sinkpad. @stream_id can only be %NULL if the parent element
* of @pad has only a single source pad.
*
* This function generates an unique stream-id by getting the upstream
* stream-start event stream ID and appending @stream_id to it. If the
* element has no sinkpad it will generate an upstream stream-id by
* doing an URI query on the element and in the worst case just uses
* a random number. Source elements that don't implement the URI
* handler interface should ideally generate a unique, deterministic
* stream-id manually instead.
*
* Since stream IDs are sorted alphabetically, any numbers in the
* stream ID should be printed with a fixed number of characters,
* preceded by 0's, such as by using the format \%03u instead of \%u.
*
* Params:
* parent = Parent #GstElement of @pad
* streamId = The stream-id
*
* Returns: A stream-id for @pad. g_free() after usage.
*/
public string createStreamId(Element parent, string streamId)
{
auto retStr = gst_pad_create_stream_id(gstPad, (parent is null) ? null : parent.getElementStruct(), Str.toStringz(streamId));
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Creates a stream-id for the source #GstPad @pad by combining the
* upstream information with the optional @stream_id of the stream
* of @pad. @pad must have a parent #GstElement and which must have zero
* or one sinkpad. @stream_id can only be %NULL if the parent element
* of @pad has only a single source pad.
*
* This function generates an unique stream-id by getting the upstream
* stream-start event stream ID and appending @stream_id to it. If the
* element has no sinkpad it will generate an upstream stream-id by
* doing an URI query on the element and in the worst case just uses
* a random number. Source elements that don't implement the URI
* handler interface should ideally generate a unique, deterministic
* stream-id manually instead.
*
* Params:
* parent = Parent #GstElement of @pad
* streamId = The stream-id
* varArgs = parameters for the @stream_id format string
*
* Returns: A stream-id for @pad. g_free() after usage.
*/
public string createStreamIdPrintfValist(Element parent, string streamId, void* varArgs)
{
auto retStr = gst_pad_create_stream_id_printf_valist(gstPad, (parent is null) ? null : parent.getElementStruct(), Str.toStringz(streamId), varArgs);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Invokes the default event handler for the given pad.
*
* The EOS event will pause the task associated with @pad before it is forwarded
* to all internally linked pads,
*
* The event is sent to all pads internally linked to @pad. This function
* takes ownership of @event.
*
* Params:
* parent = the parent of @pad or %NULL
* event = the #GstEvent to handle.
*
* Returns: %TRUE if the event was sent successfully.
*/
public bool eventDefault(ObjectGst parent, Event event)
{
return gst_pad_event_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct(), (event is null) ? null : event.getEventStruct()) != 0;
}
/**
* Calls @forward for all internally linked pads of @pad. This function deals with
* dynamically changing internal pads and will make sure that the @forward
* function is only called once for each pad.
*
* When @forward returns %TRUE, no further pads will be processed.
*
* Params:
* forward = a #GstPadForwardFunction
* userData = user data passed to @forward
*
* Returns: %TRUE if one of the dispatcher functions returned %TRUE.
*/
public bool forward(GstPadForwardFunction forward, void* userData)
{
return gst_pad_forward(gstPad, forward, userData) != 0;
}
/**
* Gets the capabilities of the allowed media types that can flow through
* @pad and its peer.
*
* The allowed capabilities is calculated as the intersection of the results of
* calling gst_pad_query_caps() on @pad and its peer. The caller owns a reference
* on the resulting caps.
*
* Returns: the allowed #GstCaps of the
* pad link. Unref the caps when you no longer need it. This
* function returns %NULL when @pad has no peer.
*
* MT safe.
*/
public Caps getAllowedCaps()
{
auto p = gst_pad_get_allowed_caps(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
}
/**
* Gets the capabilities currently configured on @pad with the last
* #GST_EVENT_CAPS event.
*
* Returns: the current caps of the pad with
* incremented ref-count or %NULL when pad has no caps. Unref after usage.
*/
public Caps getCurrentCaps()
{
auto p = gst_pad_get_current_caps(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
}
/**
* Gets the direction of the pad. The direction of the pad is
* decided at construction time so this function does not take
* the LOCK.
*
* Returns: the #GstPadDirection of the pad.
*
* MT safe.
*/
public GstPadDirection getDirection()
{
return gst_pad_get_direction(gstPad);
}
/**
* Gets the private data of a pad.
* No locking is performed in this function.
*
* Returns: a #gpointer to the private data.
*/
public void* getElementPrivate()
{
return gst_pad_get_element_private(gstPad);
}
/**
* Gets the #GstFlowReturn return from the last data passed by this pad.
*
* Since: 1.4
*/
public GstFlowReturn getLastFlowReturn()
{
return gst_pad_get_last_flow_return(gstPad);
}
/**
* Get the offset applied to the running time of @pad. @pad has to be a source
* pad.
*
* Returns: the offset.
*/
public long getOffset()
{
return gst_pad_get_offset(gstPad);
}
/**
* Gets the template for @pad.
*
* Returns: the #GstPadTemplate from which
* this pad was instantiated, or %NULL if this pad has no
* template. Unref after usage.
*/
public PadTemplate getPadTemplate()
{
auto p = gst_pad_get_pad_template(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(PadTemplate)(cast(GstPadTemplate*) p, true);
}
/**
* Gets the capabilities for @pad's template.
*
* Returns: the #GstCaps of this pad template.
* Unref after usage.
*/
public Caps getPadTemplateCaps()
{
auto p = gst_pad_get_pad_template_caps(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
}
/**
* Gets the parent of @pad, cast to a #GstElement. If a @pad has no parent or
* its parent is not an element, return %NULL.
*
* Returns: the parent of the pad. The
* caller has a reference on the parent, so unref when you're finished
* with it.
*
* MT safe.
*/
public Element getParentElement()
{
auto p = gst_pad_get_parent_element(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Element)(cast(GstElement*) p, true);
}
/**
* Gets the peer of @pad. This function refs the peer pad so
* you need to unref it after use.
*
* Returns: the peer #GstPad. Unref after usage.
*
* MT safe.
*/
public Pad getPeer()
{
auto p = gst_pad_get_peer(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Pad)(cast(GstPad*) p, true);
}
/**
* When @pad is flushing this function returns #GST_FLOW_FLUSHING
* immediately and @buffer is %NULL.
*
* Calls the getrange function of @pad, see #GstPadGetRangeFunction for a
* description of a getrange function. If @pad has no getrange function
* installed (see gst_pad_set_getrange_function()) this function returns
* #GST_FLOW_NOT_SUPPORTED.
*
* If @buffer points to a variable holding %NULL, a valid new #GstBuffer will be
* placed in @buffer when this function returns #GST_FLOW_OK. The new buffer
* must be freed with gst_buffer_unref() after usage.
*
* When @buffer points to a variable that points to a valid #GstBuffer, the
* buffer will be filled with the result data when this function returns
* #GST_FLOW_OK. If the provided buffer is larger than @size, only
* @size bytes will be filled in the result buffer and its size will be updated
* accordingly.
*
* Note that less than @size bytes can be returned in @buffer when, for example,
* an EOS condition is near or when @buffer is not large enough to hold @size
* bytes. The caller should check the result buffer size to get the result size.
*
* When this function returns any other result value than #GST_FLOW_OK, @buffer
* will be unchanged.
*
* This is a lowlevel function. Usually gst_pad_pull_range() is used.
*
* Params:
* offset = The start offset of the buffer
* size = The length of the buffer
* buffer = a pointer to hold the #GstBuffer,
* returns #GST_FLOW_ERROR if %NULL.
*
* Returns: a #GstFlowReturn from the pad.
*
* MT safe.
*/
public GstFlowReturn getRange(ulong offset, uint size, out Buffer buffer)
{
GstBuffer* outbuffer = null;
auto p = gst_pad_get_range(gstPad, offset, size, &outbuffer);
buffer = ObjectG.getDObject!(Buffer)(outbuffer);
return p;
}
/**
* Returns a new reference of the sticky event of type @event_type
* from the event.
*
* Params:
* eventType = the #GstEventType that should be retrieved.
* idx = the index of the event
*
* Returns: a #GstEvent of type
* @event_type or %NULL when no event of @event_type was on
* @pad. Unref after usage.
*/
public Event getStickyEvent(GstEventType eventType, uint idx)
{
auto p = gst_pad_get_sticky_event(gstPad, eventType, idx);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Event)(cast(GstEvent*) p, true);
}
/**
* Returns the current #GstStream for the @pad, or %NULL if none has been
* set yet, i.e. the pad has not received a stream-start event yet.
*
* This is a convenience wrapper around gst_pad_get_sticky_event() and
* gst_event_parse_stream().
*
* Returns: the current #GstStream for @pad, or %NULL.
* unref the returned stream when no longer needed.
*
* Since: 1.10
*/
public Stream getStream()
{
auto p = gst_pad_get_stream(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Stream)(cast(GstStream*) p, true);
}
/**
* Returns the current stream-id for the @pad, or %NULL if none has been
* set yet, i.e. the pad has not received a stream-start event yet.
*
* This is a convenience wrapper around gst_pad_get_sticky_event() and
* gst_event_parse_stream_start().
*
* The returned stream-id string should be treated as an opaque string, its
* contents should not be interpreted.
*
* Returns: a newly-allocated copy of the stream-id for
* @pad, or %NULL. g_free() the returned string when no longer
* needed.
*
* Since: 1.2
*/
public string getStreamId()
{
auto retStr = gst_pad_get_stream_id(gstPad);
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Get @pad task state. If no task is currently
* set, #GST_TASK_STOPPED is returned.
*
* Returns: The current state of @pad's task.
*
* Since: 1.12
*/
public GstTaskState getTaskState()
{
return gst_pad_get_task_state(gstPad);
}
/**
* Check if @pad has caps set on it with a #GST_EVENT_CAPS event.
*
* Returns: %TRUE when @pad has caps associated with it.
*/
public bool hasCurrentCaps()
{
return gst_pad_has_current_caps(gstPad) != 0;
}
/**
* Query if a pad is active
*
* Returns: %TRUE if the pad is active.
*
* MT safe.
*/
public bool isActive()
{
return gst_pad_is_active(gstPad) != 0;
}
/**
* Checks if the pad is blocked or not. This function returns the
* last requested state of the pad. It is not certain that the pad
* is actually blocking at this point (see gst_pad_is_blocking()).
*
* Returns: %TRUE if the pad is blocked.
*
* MT safe.
*/
public bool isBlocked()
{
return gst_pad_is_blocked(gstPad) != 0;
}
/**
* Checks if the pad is blocking or not. This is a guaranteed state
* of whether the pad is actually blocking on a #GstBuffer or a #GstEvent.
*
* Returns: %TRUE if the pad is blocking.
*
* MT safe.
*/
public bool isBlocking()
{
return gst_pad_is_blocking(gstPad) != 0;
}
/**
* Checks if a @pad is linked to another pad or not.
*
* Returns: %TRUE if the pad is linked, %FALSE otherwise.
*
* MT safe.
*/
public bool isLinked()
{
return gst_pad_is_linked(gstPad) != 0;
}
/**
* Gets an iterator for the pads to which the given pad is linked to inside
* of the parent element.
*
* Each #GstPad element yielded by the iterator will have its refcount increased,
* so unref after use.
*
* Free-function: gst_iterator_free
*
* Returns: a new #GstIterator of #GstPad
* or %NULL when the pad does not have an iterator function
* configured. Use gst_iterator_free() after usage.
*/
public Iterator iterateInternalLinks()
{
auto p = gst_pad_iterate_internal_links(gstPad);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
}
/**
* Iterate the list of pads to which the given pad is linked to inside of
* the parent element.
* This is the default handler, and thus returns an iterator of all of the
* pads inside the parent element with opposite direction.
*
* The caller must free this iterator after use with gst_iterator_free().
*
* Params:
* parent = the parent of @pad or %NULL
*
* Returns: a #GstIterator of #GstPad, or %NULL if @pad
* has no parent. Unref each returned pad with gst_object_unref().
*/
public Iterator iterateInternalLinksDefault(ObjectGst parent)
{
auto p = gst_pad_iterate_internal_links_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p, true);
}
/**
* Links the source pad and the sink pad.
*
* Params:
* sinkpad = the sink #GstPad to link.
*
* Returns: A result code indicating if the connection worked or
* what went wrong.
*
* MT Safe.
*/
public GstPadLinkReturn link(Pad sinkpad)
{
return gst_pad_link(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct());
}
/**
* Links the source pad and the sink pad.
*
* This variant of #gst_pad_link provides a more granular control on the
* checks being done when linking. While providing some considerable speedups
* the caller of this method must be aware that wrong usage of those flags
* can cause severe issues. Refer to the documentation of #GstPadLinkCheck
* for more information.
*
* MT Safe.
*
* Params:
* sinkpad = the sink #GstPad to link.
* flags = the checks to validate when linking
*
* Returns: A result code indicating if the connection worked or
* what went wrong.
*/
public GstPadLinkReturn linkFull(Pad sinkpad, GstPadLinkCheck flags)
{
return gst_pad_link_full(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct(), flags);
}
/**
* Links @src to @sink, creating any #GstGhostPad's in between as necessary.
*
* This is a convenience function to save having to create and add intermediate
* #GstGhostPad's as required for linking across #GstBin boundaries.
*
* If @src or @sink pads don't have parent elements or do not share a common
* ancestor, the link will fail.
*
* Params:
* sink = a #GstPad
*
* Returns: whether the link succeeded.
*
* Since: 1.10
*/
public bool linkMaybeGhosting(Pad sink)
{
return gst_pad_link_maybe_ghosting(gstPad, (sink is null) ? null : sink.getPadStruct()) != 0;
}
/**
* Links @src to @sink, creating any #GstGhostPad's in between as necessary.
*
* This is a convenience function to save having to create and add intermediate
* #GstGhostPad's as required for linking across #GstBin boundaries.
*
* If @src or @sink pads don't have parent elements or do not share a common
* ancestor, the link will fail.
*
* Calling gst_pad_link_maybe_ghosting_full() with
* @flags == %GST_PAD_LINK_CHECK_DEFAULT is the recommended way of linking
* pads with safety checks applied.
*
* Params:
* sink = a #GstPad
* flags = some #GstPadLinkCheck flags
*
* Returns: whether the link succeeded.
*
* Since: 1.10
*/
public bool linkMaybeGhostingFull(Pad sink, GstPadLinkCheck flags)
{
return gst_pad_link_maybe_ghosting_full(gstPad, (sink is null) ? null : sink.getPadStruct(), flags) != 0;
}
/**
* Mark a pad for needing reconfiguration. The next call to
* gst_pad_check_reconfigure() will return %TRUE after this call.
*/
public void markReconfigure()
{
gst_pad_mark_reconfigure(gstPad);
}
/**
* Check the #GST_PAD_FLAG_NEED_RECONFIGURE flag on @pad and return %TRUE
* if the flag was set.
*
* Returns: %TRUE is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on @pad.
*/
public bool needsReconfigure()
{
return gst_pad_needs_reconfigure(gstPad) != 0;
}
/**
* Pause the task of @pad. This function will also wait until the
* function executed by the task is finished if this function is not
* called from the task function.
*
* Returns: a %TRUE if the task could be paused or %FALSE when the pad
* has no task.
*/
public bool pauseTask()
{
return gst_pad_pause_task(gstPad) != 0;
}
/**
* Performs gst_pad_query() on the peer of @pad.
*
* The caller is responsible for both the allocation and deallocation of
* the query structure.
*
* Params:
* query = the #GstQuery to perform.
*
* Returns: %TRUE if the query could be performed. This function returns %FALSE
* if @pad has no peer.
*/
public bool peerQuery(Query query)
{
return gst_pad_peer_query(gstPad, (query is null) ? null : query.getQueryStruct()) != 0;
}
/**
* Check if the peer of @pad accepts @caps. If @pad has no peer, this function
* returns %TRUE.
*
* Params:
* caps = a #GstCaps to check on the pad
*
* Returns: %TRUE if the peer of @pad can accept the caps or @pad has no peer.
*/
public bool peerQueryAcceptCaps(Caps caps)
{
return gst_pad_peer_query_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct()) != 0;
}
/**
* Gets the capabilities of the peer connected to this pad. Similar to
* gst_pad_query_caps().
*
* When called on srcpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on sinkpads @filter contains the caps accepted by
* downstream in the preferred order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Params:
* filter = a #GstCaps filter, or %NULL.
*
* Returns: the caps of the peer pad with incremented
* ref-count. When there is no peer pad, this function returns @filter or,
* when @filter is %NULL, ANY caps.
*/
public Caps peerQueryCaps(Caps filter)
{
auto p = gst_pad_peer_query_caps(gstPad, (filter is null) ? null : filter.getCapsStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
}
/**
* Queries the peer pad of a given sink pad to convert @src_val in @src_format
* to @dest_format.
*
* Params:
* srcFormat = a #GstFormat to convert from.
* srcVal = a value to convert.
* destFormat = the #GstFormat to convert to.
* destVal = a pointer to the result.
*
* Returns: %TRUE if the query could be performed.
*/
public bool peerQueryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal)
{
return gst_pad_peer_query_convert(gstPad, srcFormat, srcVal, destFormat, &destVal) != 0;
}
/**
* Queries the peer pad of a given sink pad for the total stream duration.
*
* Params:
* format = the #GstFormat requested
* duration = a location in which to store the total
* duration, or %NULL.
*
* Returns: %TRUE if the query could be performed.
*/
public bool peerQueryDuration(GstFormat format, out long duration)
{
return gst_pad_peer_query_duration(gstPad, format, &duration) != 0;
}
/**
* Queries the peer of a given sink pad for the stream position.
*
* Params:
* format = the #GstFormat requested
* cur = a location in which to store the current
* position, or %NULL.
*
* Returns: %TRUE if the query could be performed.
*/
public bool peerQueryPosition(GstFormat format, out long cur)
{
return gst_pad_peer_query_position(gstPad, format, &cur) != 0;
}
/**
* Checks if all internally linked pads of @pad accepts the caps in @query and
* returns the intersection of the results.
*
* This function is useful as a default accept caps query function for an element
* that can handle any stream format, but requires caps that are acceptable for
* all opposite pads.
*
* Params:
* query = an ACCEPT_CAPS #GstQuery.
*
* Returns: %TRUE if @query could be executed
*/
public bool proxyQueryAcceptCaps(Query query)
{
return gst_pad_proxy_query_accept_caps(gstPad, (query is null) ? null : query.getQueryStruct()) != 0;
}
/**
* Calls gst_pad_query_caps() for all internally linked pads of @pad and returns
* the intersection of the results.
*
* This function is useful as a default caps query function for an element
* that can handle any stream format, but requires all its pads to have
* the same caps. Two such elements are tee and adder.
*
* Params:
* query = a CAPS #GstQuery.
*
* Returns: %TRUE if @query could be executed
*/
public bool proxyQueryCaps(Query query)
{
return gst_pad_proxy_query_caps(gstPad, (query is null) ? null : query.getQueryStruct()) != 0;
}
/**
* Pulls a @buffer from the peer pad or fills up a provided buffer.
*
* This function will first trigger the pad block signal if it was
* installed.
*
* When @pad is not linked #GST_FLOW_NOT_LINKED is returned else this
* function returns the result of gst_pad_get_range() on the peer pad.
* See gst_pad_get_range() for a list of return values and for the
* semantics of the arguments of this function.
*
* If @buffer points to a variable holding %NULL, a valid new #GstBuffer will be
* placed in @buffer when this function returns #GST_FLOW_OK. The new buffer
* must be freed with gst_buffer_unref() after usage. When this function
* returns any other result value, @buffer will still point to %NULL.
*
* When @buffer points to a variable that points to a valid #GstBuffer, the
* buffer will be filled with the result data when this function returns
* #GST_FLOW_OK. When this function returns any other result value,
* @buffer will be unchanged. If the provided buffer is larger than @size, only
* @size bytes will be filled in the result buffer and its size will be updated
* accordingly.
*
* Note that less than @size bytes can be returned in @buffer when, for example,
* an EOS condition is near or when @buffer is not large enough to hold @size
* bytes. The caller should check the result buffer size to get the result size.
*
* Params:
* offset = The start offset of the buffer
* size = The length of the buffer
* buffer = a pointer to hold the #GstBuffer, returns
* GST_FLOW_ERROR if %NULL.
*
* Returns: a #GstFlowReturn from the peer pad.
*
* MT safe.
*/
public GstFlowReturn pullRange(ulong offset, uint size, out Buffer buffer)
{
GstBuffer* outbuffer = null;
auto p = gst_pad_pull_range(gstPad, offset, size, &outbuffer);
buffer = ObjectG.getDObject!(Buffer)(outbuffer);
return p;
}
/**
* Pushes a buffer to the peer of @pad.
*
* This function will call installed block probes before triggering any
* installed data probes.
*
* The function proceeds calling gst_pad_chain() on the peer pad and returns
* the value from that function. If @pad has no peer, #GST_FLOW_NOT_LINKED will
* be returned.
*
* In all cases, success or failure, the caller loses its reference to @buffer
* after calling this function.
*
* Params:
* buffer = the #GstBuffer to push returns GST_FLOW_ERROR
* if not.
*
* Returns: a #GstFlowReturn from the peer pad.
*
* MT safe.
*/
public GstFlowReturn push(Buffer buffer)
{
return gst_pad_push(gstPad, (buffer is null) ? null : buffer.getBufferStruct());
}
/**
* Sends the event to the peer of the given pad. This function is
* mainly used by elements to send events to their peer
* elements.
*
* This function takes ownership of the provided event so you should
* gst_event_ref() it if you want to reuse the event after this call.
*
* Params:
* event = the #GstEvent to send to the pad.
*
* Returns: %TRUE if the event was handled.
*
* MT safe.
*/
public bool pushEvent(Event event)
{
return gst_pad_push_event(gstPad, (event is null) ? null : event.getEventStruct()) != 0;
}
/**
* Pushes a buffer list to the peer of @pad.
*
* This function will call installed block probes before triggering any
* installed data probes.
*
* The function proceeds calling the chain function on the peer pad and returns
* the value from that function. If @pad has no peer, #GST_FLOW_NOT_LINKED will
* be returned. If the peer pad does not have any installed chainlist function
* every group buffer of the list will be merged into a normal #GstBuffer and
* chained via gst_pad_chain().
*
* In all cases, success or failure, the caller loses its reference to @list
* after calling this function.
*
* Params:
* list = the #GstBufferList to push returns GST_FLOW_ERROR
* if not.
*
* Returns: a #GstFlowReturn from the peer pad.
*
* MT safe.
*/
public GstFlowReturn pushList(BufferList list)
{
return gst_pad_push_list(gstPad, (list is null) ? null : list.getBufferListStruct());
}
/**
* Dispatches a query to a pad. The query should have been allocated by the
* caller via one of the type-specific allocation functions. The element that
* the pad belongs to is responsible for filling the query with an appropriate
* response, which should then be parsed with a type-specific query parsing
* function.
*
* Again, the caller is responsible for both the allocation and deallocation of
* the query structure.
*
* Please also note that some queries might need a running pipeline to work.
*
* Params:
* query = the #GstQuery to perform.
*
* Returns: %TRUE if the query could be performed.
*/
public bool query(Query query)
{
return gst_pad_query(gstPad, (query is null) ? null : query.getQueryStruct()) != 0;
}
/**
* Check if the given pad accepts the caps.
*
* Params:
* caps = a #GstCaps to check on the pad
*
* Returns: %TRUE if the pad can accept the caps.
*/
public bool queryAcceptCaps(Caps caps)
{
return gst_pad_query_accept_caps(gstPad, (caps is null) ? null : caps.getCapsStruct()) != 0;
}
/**
* Gets the capabilities this pad can produce or consume.
* Note that this method doesn't necessarily return the caps set by sending a
* gst_event_new_caps() - use gst_pad_get_current_caps() for that instead.
* gst_pad_query_caps returns all possible caps a pad can operate with, using
* the pad's CAPS query function, If the query fails, this function will return
* @filter, if not %NULL, otherwise ANY.
*
* When called on sinkpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
* called on srcpads @filter contains the caps accepted by
* downstream in the preferred order. @filter might be %NULL but
* if it is not %NULL the returned caps will be a subset of @filter.
*
* Note that this function does not return writable #GstCaps, use
* gst_caps_make_writable() before modifying the caps.
*
* Params:
* filter = suggested #GstCaps, or %NULL
*
* Returns: the caps of the pad with incremented ref-count.
*/
public Caps queryCaps(Caps filter)
{
auto p = gst_pad_query_caps(gstPad, (filter is null) ? null : filter.getCapsStruct());
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
}
/**
* Queries a pad to convert @src_val in @src_format to @dest_format.
*
* Params:
* srcFormat = a #GstFormat to convert from.
* srcVal = a value to convert.
* destFormat = the #GstFormat to convert to.
* destVal = a pointer to the result.
*
* Returns: %TRUE if the query could be performed.
*/
public bool queryConvert(GstFormat srcFormat, long srcVal, GstFormat destFormat, out long destVal)
{
return gst_pad_query_convert(gstPad, srcFormat, srcVal, destFormat, &destVal) != 0;
}
/**
* Invokes the default query handler for the given pad.
* The query is sent to all pads internally linked to @pad. Note that
* if there are many possible sink pads that are internally linked to
* @pad, only one will be sent the query.
* Multi-sinkpad elements should implement custom query handlers.
*
* Params:
* parent = the parent of @pad or %NULL
* query = the #GstQuery to handle.
*
* Returns: %TRUE if the query was performed successfully.
*/
public bool queryDefault(ObjectGst parent, Query query)
{
return gst_pad_query_default(gstPad, (parent is null) ? null : parent.getObjectGstStruct(), (query is null) ? null : query.getQueryStruct()) != 0;
}
/**
* Queries a pad for the total stream duration.
*
* Params:
* format = the #GstFormat requested
* duration = a location in which to store the total
* duration, or %NULL.
*
* Returns: %TRUE if the query could be performed.
*/
public bool queryDuration(GstFormat format, out long duration)
{
return gst_pad_query_duration(gstPad, format, &duration) != 0;
}
/**
* Queries a pad for the stream position.
*
* Params:
* format = the #GstFormat requested
* cur = A location in which to store the current position, or %NULL.
*
* Returns: %TRUE if the query could be performed.
*/
public bool queryPosition(GstFormat format, out long cur)
{
return gst_pad_query_position(gstPad, format, &cur) != 0;
}
/**
* Remove the probe with @id from @pad.
*
* MT safe.
*
* Params:
* id = the probe id to remove
*/
public void removeProbe(gulong id)
{
gst_pad_remove_probe(gstPad, id);
}
/**
* Sends the event to the pad. This function can be used
* by applications to send events in the pipeline.
*
* If @pad is a source pad, @event should be an upstream event. If @pad is a
* sink pad, @event should be a downstream event. For example, you would not
* send a #GST_EVENT_EOS on a src pad; EOS events only propagate downstream.
* Furthermore, some downstream events have to be serialized with data flow,
* like EOS, while some can travel out-of-band, like #GST_EVENT_FLUSH_START. If
* the event needs to be serialized with data flow, this function will take the
* pad's stream lock while calling its event function.
*
* To find out whether an event type is upstream, downstream, or downstream and
* serialized, see #GstEventTypeFlags, gst_event_type_get_flags(),
* #GST_EVENT_IS_UPSTREAM, #GST_EVENT_IS_DOWNSTREAM, and
* #GST_EVENT_IS_SERIALIZED. Note that in practice that an application or
* plugin doesn't need to bother itself with this information; the core handles
* all necessary locks and checks.
*
* This function takes ownership of the provided event so you should
* gst_event_ref() it if you want to reuse the event after this call.
*
* Params:
* event = the #GstEvent to send to the pad.
*
* Returns: %TRUE if the event was handled.
*/
public bool sendEvent(Event event)
{
return gst_pad_send_event(gstPad, (event is null) ? null : event.getEventStruct()) != 0;
}
/**
* Sets the given activate function for @pad. The activate function will
* dispatch to gst_pad_activate_mode() to perform the actual activation.
* Only makes sense to set on sink pads.
*
* Call this function if your sink pad can start a pull-based task.
*
* Params:
* activate = the #GstPadActivateFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @activate will not be used anymore.
*/
public void setActivateFunctionFull(GstPadActivateFunction activate, void* userData, GDestroyNotify notify)
{
gst_pad_set_activate_function_full(gstPad, activate, userData, notify);
}
/**
* Sets the given activate_mode function for the pad. An activate_mode function
* prepares the element for data passing.
*
* Params:
* activatemode = the #GstPadActivateModeFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @activatemode will not be used anymore.
*/
public void setActivatemodeFunctionFull(GstPadActivateModeFunction activatemode, void* userData, GDestroyNotify notify)
{
gst_pad_set_activatemode_function_full(gstPad, activatemode, userData, notify);
}
/**
* Activates or deactivates the given pad.
* Normally called from within core state change functions.
*
* If @active, makes sure the pad is active. If it is already active, either in
* push or pull mode, just return. Otherwise dispatches to the pad's activate
* function to perform the actual activation.
*
* If not @active, calls gst_pad_activate_mode() with the pad's current mode
* and a %FALSE argument.
*
* Params:
* active = whether or not the pad should be active.
*
* Returns: %TRUE if the operation was successful.
*
* MT safe.
*/
public bool setActive(bool active)
{
return gst_pad_set_active(gstPad, active) != 0;
}
/**
* Sets the given chain function for the pad. The chain function is called to
* process a #GstBuffer input buffer. see #GstPadChainFunction for more details.
*
* Params:
* chain = the #GstPadChainFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @chain will not be used anymore.
*/
public void setChainFunctionFull(GstPadChainFunction chain, void* userData, GDestroyNotify notify)
{
gst_pad_set_chain_function_full(gstPad, chain, userData, notify);
}
/**
* Sets the given chain list function for the pad. The chainlist function is
* called to process a #GstBufferList input buffer list. See
* #GstPadChainListFunction for more details.
*
* Params:
* chainlist = the #GstPadChainListFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @chainlist will not be used anymore.
*/
public void setChainListFunctionFull(GstPadChainListFunction chainlist, void* userData, GDestroyNotify notify)
{
gst_pad_set_chain_list_function_full(gstPad, chainlist, userData, notify);
}
/**
* Set the given private data gpointer on the pad.
* This function can only be used by the element that owns the pad.
* No locking is performed in this function.
*
* Params:
* priv = The private data to attach to the pad.
*/
public void setElementPrivate(void* priv)
{
gst_pad_set_element_private(gstPad, priv);
}
/**
* Sets the given event handler for the pad.
*
* Params:
* event = the #GstPadEventFullFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @event will not be used anymore.
*
* Since: 1.8
*/
public void setEventFullFunctionFull(GstPadEventFullFunction event, void* userData, GDestroyNotify notify)
{
gst_pad_set_event_full_function_full(gstPad, event, userData, notify);
}
/**
* Sets the given event handler for the pad.
*
* Params:
* event = the #GstPadEventFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @event will not be used anymore.
*/
public void setEventFunctionFull(GstPadEventFunction event, void* userData, GDestroyNotify notify)
{
gst_pad_set_event_function_full(gstPad, event, userData, notify);
}
/**
* Sets the given getrange function for the pad. The getrange function is
* called to produce a new #GstBuffer to start the processing pipeline. see
* #GstPadGetRangeFunction for a description of the getrange function.
*
* Params:
* get = the #GstPadGetRangeFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @get will not be used anymore.
*/
public void setGetrangeFunctionFull(GstPadGetRangeFunction get, void* userData, GDestroyNotify notify)
{
gst_pad_set_getrange_function_full(gstPad, get, userData, notify);
}
/**
* Sets the given internal link iterator function for the pad.
*
* Params:
* iterintlink = the #GstPadIterIntLinkFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @iterintlink will not be used anymore.
*/
public void setIterateInternalLinksFunctionFull(GstPadIterIntLinkFunction iterintlink, void* userData, GDestroyNotify notify)
{
gst_pad_set_iterate_internal_links_function_full(gstPad, iterintlink, userData, notify);
}
/**
* Sets the given link function for the pad. It will be called when
* the pad is linked with another pad.
*
* The return value #GST_PAD_LINK_OK should be used when the connection can be
* made.
*
* The return value #GST_PAD_LINK_REFUSED should be used when the connection
* cannot be made for some reason.
*
* If @link is installed on a source pad, it should call the #GstPadLinkFunction
* of the peer sink pad, if present.
*
* Params:
* link = the #GstPadLinkFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @link will not be used anymore.
*/
public void setLinkFunctionFull(GstPadLinkFunction link, void* userData, GDestroyNotify notify)
{
gst_pad_set_link_function_full(gstPad, link, userData, notify);
}
/**
* Set the offset that will be applied to the running time of @pad.
*
* Params:
* offset = the offset
*/
public void setOffset(long offset)
{
gst_pad_set_offset(gstPad, offset);
}
/**
* Set the given query function for the pad.
*
* Params:
* query = the #GstPadQueryFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @query will not be used anymore.
*/
public void setQueryFunctionFull(GstPadQueryFunction query, void* userData, GDestroyNotify notify)
{
gst_pad_set_query_function_full(gstPad, query, userData, notify);
}
/**
* Sets the given unlink function for the pad. It will be called
* when the pad is unlinked.
*
* Params:
* unlink = the #GstPadUnlinkFunction to set.
* userData = user_data passed to @notify
* notify = notify called when @unlink will not be used anymore.
*/
public void setUnlinkFunctionFull(GstPadUnlinkFunction unlink, void* userData, GDestroyNotify notify)
{
gst_pad_set_unlink_function_full(gstPad, unlink, userData, notify);
}
/**
* Starts a task that repeatedly calls @func with @user_data. This function
* is mostly used in pad activation functions to start the dataflow.
* The #GST_PAD_STREAM_LOCK of @pad will automatically be acquired
* before @func is called.
*
* Params:
* func = the task function to call
* userData = user data passed to the task function
* notify = called when @user_data is no longer referenced
*
* Returns: a %TRUE if the task could be started.
*/
public bool startTask(GstTaskFunction func, void* userData, GDestroyNotify notify)
{
return gst_pad_start_task(gstPad, func, userData, notify) != 0;
}
/**
* Iterates all sticky events on @pad and calls @foreach_func for every
* event. If @foreach_func returns %FALSE the iteration is immediately stopped.
*
* Params:
* foreachFunc = the #GstPadStickyEventsForeachFunction that
* should be called for every event.
* userData = the optional user data.
*/
public void stickyEventsForeach(GstPadStickyEventsForeachFunction foreachFunc, void* userData)
{
gst_pad_sticky_events_foreach(gstPad, foreachFunc, userData);
}
/**
* Stop the task of @pad. This function will also make sure that the
* function executed by the task will effectively stop if not called
* from the GstTaskFunction.
*
* This function will deadlock if called from the GstTaskFunction of
* the task. Use gst_task_pause() instead.
*
* Regardless of whether the pad has a task, the stream lock is acquired and
* released so as to ensure that streaming through this pad has finished.
*
* Returns: a %TRUE if the task could be stopped or %FALSE on error.
*/
public bool stopTask()
{
return gst_pad_stop_task(gstPad) != 0;
}
/**
* Store the sticky @event on @pad
*
* Params:
* event = a #GstEvent
*
* Returns: #GST_FLOW_OK on success, #GST_FLOW_FLUSHING when the pad
* was flushing or #GST_FLOW_EOS when the pad was EOS.
*
* Since: 1.2
*/
public GstFlowReturn storeStickyEvent(Event event)
{
return gst_pad_store_sticky_event(gstPad, (event is null) ? null : event.getEventStruct());
}
/**
* Unlinks the source pad from the sink pad. Will emit the #GstPad::unlinked
* signal on both pads.
*
* Params:
* sinkpad = the sink #GstPad to unlink.
*
* Returns: %TRUE if the pads were unlinked. This function returns %FALSE if
* the pads were not linked together.
*
* MT safe.
*/
public bool unlink(Pad sinkpad)
{
return gst_pad_unlink(gstPad, (sinkpad is null) ? null : sinkpad.getPadStruct()) != 0;
}
/**
* A helper function you can use that sets the FIXED_CAPS flag
* This way the default CAPS query will always return the negotiated caps
* or in case the pad is not negotiated, the padtemplate caps.
*
* The negotiated caps are the caps of the last CAPS event that passed on the
* pad. Use this function on a pad that, once it negotiated to a CAPS, cannot
* be renegotiated to something else.
*/
public void useFixedCaps()
{
gst_pad_use_fixed_caps(gstPad);
}
protected class OnLinkedDelegateWrapper
{
void delegate(Pad, Pad) dlg;
gulong handlerId;
this(void delegate(Pad, Pad) dlg)
{
this.dlg = dlg;
onLinkedListeners ~= this;
}
void remove(OnLinkedDelegateWrapper source)
{
foreach(index, wrapper; onLinkedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onLinkedListeners[index] = null;
onLinkedListeners = std.algorithm.remove(onLinkedListeners, index);
break;
}
}
}
}
OnLinkedDelegateWrapper[] onLinkedListeners;
/**
* Signals that a pad has been linked to the peer pad.
*
* Params:
* peer = the peer pad that has been connected
*/
gulong addOnLinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnLinkedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"linked",
cast(GCallback)&callBackLinked,
cast(void*)wrapper,
cast(GClosureNotify)&callBackLinkedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackLinked(GstPad* padStruct, GstPad* peer, OnLinkedDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Pad)(peer), wrapper.outer);
}
extern(C) static void callBackLinkedDestroy(OnLinkedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnUnlinkedDelegateWrapper
{
void delegate(Pad, Pad) dlg;
gulong handlerId;
this(void delegate(Pad, Pad) dlg)
{
this.dlg = dlg;
onUnlinkedListeners ~= this;
}
void remove(OnUnlinkedDelegateWrapper source)
{
foreach(index, wrapper; onUnlinkedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onUnlinkedListeners[index] = null;
onUnlinkedListeners = std.algorithm.remove(onUnlinkedListeners, index);
break;
}
}
}
}
OnUnlinkedDelegateWrapper[] onUnlinkedListeners;
/**
* Signals that a pad has been unlinked from the peer pad.
*
* Params:
* peer = the peer pad that has been disconnected
*/
gulong addOnUnlinked(void delegate(Pad, Pad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnUnlinkedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"unlinked",
cast(GCallback)&callBackUnlinked,
cast(void*)wrapper,
cast(GClosureNotify)&callBackUnlinkedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackUnlinked(GstPad* padStruct, GstPad* peer, OnUnlinkedDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(Pad)(peer), wrapper.outer);
}
extern(C) static void callBackUnlinkedDestroy(OnUnlinkedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
/**
* Gets a string representing the given flow return.
*
* Params:
* ret = a #GstFlowReturn to get the name of.
*
* Returns: a static string with the name of the flow return.
*/
public static string flowGetName(GstFlowReturn ret)
{
return Str.toString(gst_flow_get_name(ret));
}
/**
* Get the unique quark for the given GstFlowReturn.
*
* Params:
* ret = a #GstFlowReturn to get the quark of.
*
* Returns: the quark associated with the flow return or 0 if an
* invalid return was specified.
*/
public static GQuark flowToQuark(GstFlowReturn ret)
{
return gst_flow_to_quark(ret);
}
/**
* Return the name of a pad mode, for use in debug messages mostly.
*
* Params:
* mode = the pad mode
*
* Returns: short mnemonic for pad mode @mode
*/
public static string modeGetName(GstPadMode mode)
{
return Str.toString(gst_pad_mode_get_name(mode));
}
}
|