523 |
533 |
524 /** |
534 /** |
525 * gst_rtcp_packet_remove: |
535 * gst_rtcp_packet_remove: |
526 * @packet: a #GstRTCPPacket |
536 * @packet: a #GstRTCPPacket |
527 * |
537 * |
528 * Removes the packet pointed to by @packet. |
538 * Removes the packet pointed to by @packet and moves pointer to the next one |
529 * |
539 * |
530 * Note: Not implemented. |
540 * Returns: TRUE if @packet is pointing to a valid packet after calling this |
531 */ |
541 * function. |
532 #ifdef __SYMBIAN32__ |
542 */ |
533 EXPORT_C |
543 #ifdef __SYMBIAN32__ |
534 #endif |
544 EXPORT_C |
535 |
545 #endif |
536 void |
546 |
|
547 gboolean |
537 gst_rtcp_packet_remove (GstRTCPPacket * packet) |
548 gst_rtcp_packet_remove (GstRTCPPacket * packet) |
538 { |
549 { |
539 g_return_if_fail (packet != NULL); |
550 gboolean ret = FALSE; |
540 g_return_if_fail (packet->type != GST_RTCP_TYPE_INVALID); |
551 guint offset = 0; |
541 |
552 |
542 g_warning ("not implemented"); |
553 g_return_val_if_fail (packet != NULL, FALSE); |
|
554 g_return_val_if_fail (packet->type != GST_RTCP_TYPE_INVALID, FALSE); |
|
555 |
|
556 /* The next packet starts at offset + length + 4 (the header) */ |
|
557 offset = packet->offset + (packet->length << 2) + 4; |
|
558 |
|
559 /* Overwrite this packet with the rest of the data */ |
|
560 memmove (GST_BUFFER_DATA (packet->buffer) + packet->offset, |
|
561 GST_BUFFER_DATA (packet->buffer) + offset, |
|
562 GST_BUFFER_SIZE (packet->buffer) - offset); |
|
563 |
|
564 /* try to read next header */ |
|
565 ret = read_packet_header (packet); |
|
566 if (!ret) |
|
567 packet->type = GST_RTCP_TYPE_INVALID; |
|
568 |
|
569 return ret; |
543 } |
570 } |
544 |
571 |
545 /** |
572 /** |
546 * gst_rtcp_packet_get_padding: |
573 * gst_rtcp_packet_get_padding: |
547 * @packet: a valid #GstRTCPPacket |
574 * @packet: a valid #GstRTCPPacket |
1777 return FALSE; |
1803 return FALSE; |
1778 } |
1804 } |
1779 } |
1805 } |
1780 |
1806 |
1781 /** |
1807 /** |
|
1808 * gst_rtcp_packet_fb_get_sender_ssrc: |
|
1809 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1810 * |
|
1811 * Get the sender SSRC field of the RTPFB or PSFB @packet. |
|
1812 * |
|
1813 * Returns: the sender SSRC. |
|
1814 * |
|
1815 * Since: 0.10.23 |
|
1816 */ |
|
1817 #ifdef __SYMBIAN32__ |
|
1818 EXPORT_C |
|
1819 #endif |
|
1820 |
|
1821 guint32 |
|
1822 gst_rtcp_packet_fb_get_sender_ssrc (GstRTCPPacket * packet) |
|
1823 { |
|
1824 guint8 *data; |
|
1825 guint32 ssrc; |
|
1826 |
|
1827 g_return_val_if_fail (packet != NULL, 0); |
|
1828 g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB || |
|
1829 packet->type == GST_RTCP_TYPE_PSFB), 0); |
|
1830 g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0); |
|
1831 |
|
1832 data = GST_BUFFER_DATA (packet->buffer); |
|
1833 |
|
1834 /* skip header */ |
|
1835 data += packet->offset + 4; |
|
1836 ssrc = GST_READ_UINT32_BE (data); |
|
1837 |
|
1838 return ssrc; |
|
1839 } |
|
1840 |
|
1841 /** |
|
1842 * gst_rtcp_packet_fb_set_sender_ssrc: |
|
1843 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1844 * @ssrc: a sender SSRC |
|
1845 * |
|
1846 * Set the sender SSRC field of the RTPFB or PSFB @packet. |
|
1847 * |
|
1848 * Since: 0.10.23 |
|
1849 */ |
|
1850 #ifdef __SYMBIAN32__ |
|
1851 EXPORT_C |
|
1852 #endif |
|
1853 |
|
1854 void |
|
1855 gst_rtcp_packet_fb_set_sender_ssrc (GstRTCPPacket * packet, guint32 ssrc) |
|
1856 { |
|
1857 guint8 *data; |
|
1858 |
|
1859 g_return_if_fail (packet != NULL); |
|
1860 g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB || |
|
1861 packet->type == GST_RTCP_TYPE_PSFB); |
|
1862 g_return_if_fail (GST_IS_BUFFER (packet->buffer)); |
|
1863 |
|
1864 data = GST_BUFFER_DATA (packet->buffer); |
|
1865 |
|
1866 /* skip header */ |
|
1867 data += packet->offset + 4; |
|
1868 GST_WRITE_UINT32_BE (data, ssrc); |
|
1869 } |
|
1870 |
|
1871 /** |
|
1872 * gst_rtcp_packet_fb_get_media_ssrc: |
|
1873 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1874 * |
|
1875 * Get the media SSRC field of the RTPFB or PSFB @packet. |
|
1876 * |
|
1877 * Returns: the media SSRC. |
|
1878 * |
|
1879 * Since: 0.10.23 |
|
1880 */ |
|
1881 #ifdef __SYMBIAN32__ |
|
1882 EXPORT_C |
|
1883 #endif |
|
1884 |
|
1885 guint32 |
|
1886 gst_rtcp_packet_fb_get_media_ssrc (GstRTCPPacket * packet) |
|
1887 { |
|
1888 guint8 *data; |
|
1889 guint32 ssrc; |
|
1890 |
|
1891 g_return_val_if_fail (packet != NULL, 0); |
|
1892 g_return_val_if_fail ((packet->type == GST_RTCP_TYPE_RTPFB || |
|
1893 packet->type == GST_RTCP_TYPE_PSFB), 0); |
|
1894 g_return_val_if_fail (GST_IS_BUFFER (packet->buffer), 0); |
|
1895 |
|
1896 data = GST_BUFFER_DATA (packet->buffer); |
|
1897 |
|
1898 /* skip header and sender ssrc */ |
|
1899 data += packet->offset + 8; |
|
1900 ssrc = GST_READ_UINT32_BE (data); |
|
1901 |
|
1902 return ssrc; |
|
1903 } |
|
1904 |
|
1905 /** |
|
1906 * gst_rtcp_packet_fb_set_media_ssrc: |
|
1907 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1908 * @ssrc: a media SSRC |
|
1909 * |
|
1910 * Set the media SSRC field of the RTPFB or PSFB @packet. |
|
1911 * |
|
1912 * Since: 0.10.23 |
|
1913 */ |
|
1914 #ifdef __SYMBIAN32__ |
|
1915 EXPORT_C |
|
1916 #endif |
|
1917 |
|
1918 void |
|
1919 gst_rtcp_packet_fb_set_media_ssrc (GstRTCPPacket * packet, guint32 ssrc) |
|
1920 { |
|
1921 guint8 *data; |
|
1922 |
|
1923 g_return_if_fail (packet != NULL); |
|
1924 g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB || |
|
1925 packet->type == GST_RTCP_TYPE_PSFB); |
|
1926 g_return_if_fail (GST_IS_BUFFER (packet->buffer)); |
|
1927 |
|
1928 data = GST_BUFFER_DATA (packet->buffer); |
|
1929 |
|
1930 /* skip header and sender ssrc */ |
|
1931 data += packet->offset + 8; |
|
1932 GST_WRITE_UINT32_BE (data, ssrc); |
|
1933 } |
|
1934 |
|
1935 /** |
|
1936 * gst_rtcp_packet_fb_get_type: |
|
1937 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1938 * |
|
1939 * Get the feedback message type of the FB @packet. |
|
1940 * |
|
1941 * Returns: The feedback message type. |
|
1942 * |
|
1943 * Since: 0.10.23 |
|
1944 */ |
|
1945 #ifdef __SYMBIAN32__ |
|
1946 EXPORT_C |
|
1947 #endif |
|
1948 |
|
1949 GstRTCPFBType |
|
1950 gst_rtcp_packet_fb_get_type (GstRTCPPacket * packet) |
|
1951 { |
|
1952 g_return_val_if_fail (packet != NULL, GST_RTCP_FB_TYPE_INVALID); |
|
1953 g_return_val_if_fail (packet->type == GST_RTCP_TYPE_RTPFB || |
|
1954 packet->type == GST_RTCP_TYPE_PSFB, GST_RTCP_FB_TYPE_INVALID); |
|
1955 |
|
1956 return packet->count; |
|
1957 } |
|
1958 |
|
1959 /** |
|
1960 * gst_rtcp_packet_fb_set_type: |
|
1961 * @packet: a valid RTPFB or PSFB #GstRTCPPacket |
|
1962 * @type: the #GstRTCPFBType to set |
|
1963 * |
|
1964 * Set the feedback message type of the FB @packet. |
|
1965 * |
|
1966 * Since: 0.10.23 |
|
1967 */ |
|
1968 #ifdef __SYMBIAN32__ |
|
1969 EXPORT_C |
|
1970 #endif |
|
1971 |
|
1972 void |
|
1973 gst_rtcp_packet_fb_set_type (GstRTCPPacket * packet, GstRTCPFBType type) |
|
1974 { |
|
1975 guint8 *data; |
|
1976 |
|
1977 g_return_if_fail (packet != NULL); |
|
1978 g_return_if_fail (packet->type == GST_RTCP_TYPE_RTPFB || |
|
1979 packet->type == GST_RTCP_TYPE_PSFB); |
|
1980 g_return_if_fail (GST_IS_BUFFER (packet->buffer)); |
|
1981 |
|
1982 data = GST_BUFFER_DATA (packet->buffer); |
|
1983 |
|
1984 data[packet->offset] = (data[packet->offset] & 0xe0) | type; |
|
1985 packet->count = type; |
|
1986 } |
|
1987 |
|
1988 /** |
1782 * gst_rtcp_ntp_to_unix: |
1989 * gst_rtcp_ntp_to_unix: |
1783 * @ntptime: an NTP timestamp |
1990 * @ntptime: an NTP timestamp |
1784 * |
1991 * |
1785 * Converts an NTP time to UNIX nanoseconds. @ntptime can typically be |
1992 * Converts an NTP time to UNIX nanoseconds. @ntptime can typically be |
1786 * the NTP time of an SR RTCP message and contains, in the upper 32 bits, the |
1993 * the NTP time of an SR RTCP message and contains, in the upper 32 bits, the |