OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 } | 1918 } |
1919 | 1919 |
1920 bool IsVideoContent(const ContentInfo* content) { | 1920 bool IsVideoContent(const ContentInfo* content) { |
1921 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); | 1921 return IsMediaContentOfType(content, MEDIA_TYPE_VIDEO); |
1922 } | 1922 } |
1923 | 1923 |
1924 bool IsDataContent(const ContentInfo* content) { | 1924 bool IsDataContent(const ContentInfo* content) { |
1925 return IsMediaContentOfType(content, MEDIA_TYPE_DATA); | 1925 return IsMediaContentOfType(content, MEDIA_TYPE_DATA); |
1926 } | 1926 } |
1927 | 1927 |
1928 static const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, | 1928 const ContentInfo* GetFirstMediaContent(const ContentInfos& contents, |
1929 MediaType media_type) { | 1929 MediaType media_type) { |
1930 for (ContentInfos::const_iterator content = contents.begin(); | 1930 for (ContentInfos::const_iterator content = contents.begin(); |
1931 content != contents.end(); content++) { | 1931 content != contents.end(); content++) { |
1932 if (IsMediaContentOfType(&*content, media_type)) { | 1932 if (IsMediaContentOfType(&*content, media_type)) { |
1933 return &*content; | 1933 return &*content; |
1934 } | 1934 } |
1935 } | 1935 } |
1936 return NULL; | 1936 return nullptr; |
1937 } | 1937 } |
1938 | 1938 |
1939 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { | 1939 const ContentInfo* GetFirstAudioContent(const ContentInfos& contents) { |
1940 return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO); | 1940 return GetFirstMediaContent(contents, MEDIA_TYPE_AUDIO); |
1941 } | 1941 } |
1942 | 1942 |
1943 const ContentInfo* GetFirstVideoContent(const ContentInfos& contents) { | 1943 const ContentInfo* GetFirstVideoContent(const ContentInfos& contents) { |
1944 return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO); | 1944 return GetFirstMediaContent(contents, MEDIA_TYPE_VIDEO); |
1945 } | 1945 } |
1946 | 1946 |
1947 const ContentInfo* GetFirstDataContent(const ContentInfos& contents) { | 1947 const ContentInfo* GetFirstDataContent(const ContentInfos& contents) { |
1948 return GetFirstMediaContent(contents, MEDIA_TYPE_DATA); | 1948 return GetFirstMediaContent(contents, MEDIA_TYPE_DATA); |
1949 } | 1949 } |
1950 | 1950 |
1951 static const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc, | 1951 static const ContentInfo* GetFirstMediaContent(const SessionDescription* sdesc, |
1952 MediaType media_type) { | 1952 MediaType media_type) { |
1953 if (sdesc == NULL) | 1953 if (sdesc == nullptr) { |
1954 return NULL; | 1954 return nullptr; |
| 1955 } |
1955 | 1956 |
1956 return GetFirstMediaContent(sdesc->contents(), media_type); | 1957 return GetFirstMediaContent(sdesc->contents(), media_type); |
1957 } | 1958 } |
1958 | 1959 |
1959 const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc) { | 1960 const ContentInfo* GetFirstAudioContent(const SessionDescription* sdesc) { |
1960 return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO); | 1961 return GetFirstMediaContent(sdesc, MEDIA_TYPE_AUDIO); |
1961 } | 1962 } |
1962 | 1963 |
1963 const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc) { | 1964 const ContentInfo* GetFirstVideoContent(const SessionDescription* sdesc) { |
1964 return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO); | 1965 return GetFirstMediaContent(sdesc, MEDIA_TYPE_VIDEO); |
(...skipping 22 matching lines...) Expand all Loading... |
1987 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 1988 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
1988 } | 1989 } |
1989 | 1990 |
1990 const DataContentDescription* GetFirstDataContentDescription( | 1991 const DataContentDescription* GetFirstDataContentDescription( |
1991 const SessionDescription* sdesc) { | 1992 const SessionDescription* sdesc) { |
1992 return static_cast<const DataContentDescription*>( | 1993 return static_cast<const DataContentDescription*>( |
1993 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 1994 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
1994 } | 1995 } |
1995 | 1996 |
1996 } // namespace cricket | 1997 } // namespace cricket |
OLD | NEW |