From 6099543ad4c78df45c580f6660d19c33e483a594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Thu, 8 Dec 2011 15:19:58 +0200 Subject: [PATCH 1/4] rtsp: Check for dynamic payload handlers if no static payload mapping was found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some systems abuse the static payload types 35 or 36 (which according to IANA are unassigned) for H264. Signed-off-by: Martin Storsjö --- libavformat/rtsp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index f53aadf191..19fdaf1c4b 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -198,7 +198,14 @@ static int sdp_parse_rtpmap(AVFormatContext *s, * particular servers ("RealServer Version 6.1.3.970", see issue 1658) * have a trailing space. */ get_word_sep(buf, sizeof(buf), "/ ", &p); - if (payload_type >= RTP_PT_PRIVATE) { + if (payload_type < RTP_PT_PRIVATE) { + /* We are in a standard case + * (from http://www.iana.org/assignments/rtp-parameters). */ + /* search into AVRtpPayloadTypes[] */ + codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); + } + + if (codec->codec_id == CODEC_ID_NONE) { RTPDynamicProtocolHandler *handler = ff_rtp_handler_find_by_name(buf, codec->codec_type); init_rtp_handler(handler, rtsp_st, codec); @@ -208,11 +215,6 @@ static int sdp_parse_rtpmap(AVFormatContext *s, * the format name from the rtpmap line never is passed into rtpdec. */ if (!rtsp_st->dynamic_handler) codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); - } else { - /* We are in a standard case - * (from http://www.iana.org/assignments/rtp-parameters). */ - /* search into AVRtpPayloadTypes[] */ - codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type); } c = avcodec_find_decoder(codec->codec_id); From 780ff97feff7c777ce999836f8c696a1f7077148 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 May 2012 08:24:14 +0200 Subject: [PATCH 2/4] log: make colored output more colorful. Green for verbose, cyan for debug. --- libavutil/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/log.c b/libavutil/log.c index 2969355969..5e841296bb 100644 --- a/libavutil/log.c +++ b/libavutil/log.c @@ -35,13 +35,13 @@ static int flags; #if defined(_WIN32) && !defined(__MINGW32CE__) #include -static const uint8_t color[] = { 12, 12, 12, 14, 7, 7, 7 }; +static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 }; static int16_t background, attr_orig; static HANDLE con; #define set_color(x) SetConsoleTextAttribute(con, background | color[x]) #define reset_color() SetConsoleTextAttribute(con, attr_orig) #else -static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 9, 9 }; +static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 }; #define set_color(x) fprintf(stderr, "\033[%d;3%dm", color[x] >> 4, color[x]&15) #define reset_color() fprintf(stderr, "\033[0m") #endif From d30acfa94c995d8ebde9c8492747fec611db066d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 May 2012 08:52:19 +0200 Subject: [PATCH 3/4] avprobe: fix formatting. --- avprobe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/avprobe.c b/avprobe.c index ae2eb205e5..acf0ab9d49 100644 --- a/avprobe.c +++ b/avprobe.c @@ -775,8 +775,7 @@ static int opt_output_format(const char *opt, const char *arg) print_integer = json_print_integer; print_string = json_print_string; - } else - if (!strcmp(arg, "ini")) { + } else if (!strcmp(arg, "ini")) { print_header = ini_print_header; print_footer = ini_print_footer; print_array_header = ini_print_array_header; From 8271f55bd7d6f4e06786dc8dd7c9538d83ad026a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 26 May 2012 08:54:25 +0200 Subject: [PATCH 4/4] avprobe: restore pseudo-INI old style format for compatibility. --- Changelog | 3 ++- avprobe.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/avprobe.texi | 13 +++++++++++-- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index 822f062d83..358662bfed 100644 --- a/Changelog +++ b/Changelog @@ -21,7 +21,8 @@ version : - add fps filter - audio split filter - audio mix filter -- avprobe output is now standard INI or JSON. +- avprobe output is now standard INI or JSON. The old format can still + be used with -of old. version 0.8: diff --git a/avprobe.c b/avprobe.c index acf0ab9d49..867d10d1f7 100644 --- a/avprobe.c +++ b/avprobe.c @@ -280,6 +280,50 @@ static void json_print_string(const char *key, const char *value) avio_w8(probe_out, '\"'); } +/* + * old-style pseudo-INI + */ +static void old_print_object_header(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = toupper(*p); + p++; + } + + avio_printf(probe_out, "[%s]\n", str); + av_freep(&str); +} + +static void old_print_object_footer(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = toupper(*p); + p++; + } + + avio_printf(probe_out, "[/%s]\n", str); + av_freep(&str); +} + +static void old_print_string(const char *key, const char *value) +{ + if (!strcmp(octx.prefix[octx.level - 1].name, "tags")) + avio_printf(probe_out, "TAG:"); + ini_print_string(key, value); +} + /* * Simple Formatter for single entries. */ @@ -783,6 +827,12 @@ static int opt_output_format(const char *opt, const char *arg) print_integer = ini_print_integer; print_string = ini_print_string; + } else if (!strcmp(arg, "old")) { + print_header = NULL; + print_object_header = old_print_object_header; + print_object_footer = old_print_object_footer; + + print_string = old_print_string; } else { av_log(NULL, AV_LOG_ERROR, "Unsupported formatter %s\n", arg); return AVERROR(EINVAL); diff --git a/doc/avprobe.texi b/doc/avprobe.texi index 9c28125784..7e6fedf5c4 100644 --- a/doc/avprobe.texi +++ b/doc/avprobe.texi @@ -59,8 +59,17 @@ parsers. Force format to use. @item -of @var{formatter} -Use a specific formatter to output the document, either @var{ini} or -@var{json} available. +Use a specific formatter to output the document. The following +formatters are available +@table @option +@item ini + +@item json + +@item old +Pseudo-INI format that used to be the only one available in old +avprobe versions. +@end table @item -unit Show the unit of the displayed values.