[libav-devel] [PATCH 1/1] rtsp: add allowed_media_types option

Martin Storsjö martin at martin.st
Tue Nov 1 11:32:15 CET 2011


On Tue, 1 Nov 2011, Anton Khirnov wrote:

>
> On Mon, 31 Oct 2011 16:13:59 -0600, John Brooks <john.brooks at bluecherry.net> wrote:
>> Streams from the RTSP server that do not match an allowed type
>> will be skipped entirely, which allows video-only or audio-only
>> streaming from servers that provide both.
>> ---
>>  libavformat/rtsp.c |   10 +++++++++-
>>  libavformat/rtsp.h |    5 +++++
>>  2 files changed, 14 insertions(+), 1 deletions(-)
>>
>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>> index 5aadc44..94184b0 100644
>> --- a/libavformat/rtsp.c
>> +++ b/libavformat/rtsp.c
>> @@ -74,6 +74,12 @@ const AVOption ff_rtsp_options[] = {
>>      { "udp_multicast", "UDP multicast", 0, AV_OPT_TYPE_CONST, {1 << RTSP_LOWER_TRANSPORT_UDP_MULTICAST}, 0, 0, DEC, "rtsp_transport" },
>>      { "http", "HTTP tunneling", 0, AV_OPT_TYPE_CONST, {(1 << RTSP_LOWER_TRANSPORT_HTTP)}, 0, 0, DEC, "rtsp_transport" },
>>      RTSP_FLAG_OPTS("rtsp_flags", "RTSP flags"),
>> +
>> +    { "allowed_media_types", "Media types to accept from the server", OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
>
> You should be able to use the "all" named constant as default.

Hmm, av_opt_set_defaults2 only uses default_val.dbl for the default, it 
doesn't try to read any string value. Since he set INT_MAX/INT_MIN as 
boundaries, the user can still set that value if he wants, giving the same 
effect.

>> +    { "video", "Video", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_VIDEO}, 0, 0, DEC, "allowed_media_types" }, \
>> +    { "audio", "Audio", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_AUDIO}, 0, 0, DEC, "allowed_media_types" }, \
>> +    { "data", "Data", 0, AV_OPT_TYPE_CONST, {1 << AVMEDIA_TYPE_DATA}, 0, 0, DEC, "allowed_media_types" },
>
> No subtitles?

The rtsp code doesn't support such streams at the moment.

// Martin


More information about the libav-devel mailing list