rtsp: Use avcodec_descriptor_get instead of avcodec_find_decoder

Message ID 1464078092-39035-1-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö May 24, 2016, 8:21 a.m.
This is only used for logging a human readable codec name for
debugging.
---
 libavformat/rtsp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Diego Biurrun May 24, 2016, 8:58 a.m. | #1
On Tue, May 24, 2016 at 11:21:32AM +0300, Martin Storsjö wrote:
> This is only used for logging a human readable codec name for
> debugging.
> ---
>  libavformat/rtsp.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

OK

Diego
Anton Khirnov May 24, 2016, 10:35 a.m. | #2
Quoting Martin Storsjö (2016-05-24 10:21:32)
> This is only used for logging a human readable codec name for
> debugging.
> ---
>  libavformat/rtsp.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 9e8733a..2a40abc 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -242,7 +242,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
>      AVCodecParameters *par = st->codecpar;
>      char buf[256];
>      int i;
> -    AVCodec *c;
> +    AVCodecDescriptor *desc;

Should be const I think.
Martin Storsjö May 25, 2016, 9:23 a.m. | #3
On Tue, 24 May 2016, Anton Khirnov wrote:

> Quoting Martin Storsjö (2016-05-24 10:21:32)
>> This is only used for logging a human readable codec name for
>> debugging.
>> ---
>>  libavformat/rtsp.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>> 
>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>> index 9e8733a..2a40abc 100644
>> --- a/libavformat/rtsp.c
>> +++ b/libavformat/rtsp.c
>> @@ -242,7 +242,7 @@ static int sdp_parse_rtpmap(AVFormatContext *s,
>>      AVCodecParameters *par = st->codecpar;
>>      char buf[256];
>>      int i;
>> -    AVCodec *c;
>> +    AVCodecDescriptor *desc;
>
> Should be const I think.

Pushed with const added.

// Martin

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 9e8733a..2a40abc 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -242,7 +242,7 @@  static int sdp_parse_rtpmap(AVFormatContext *s,
     AVCodecParameters *par = st->codecpar;
     char buf[256];
     int i;
-    AVCodec *c;
+    AVCodecDescriptor *desc;
     const char *c_name;
 
     /* See if we can handle this kind of payload.
@@ -268,9 +268,9 @@  static int sdp_parse_rtpmap(AVFormatContext *s,
             par->codec_id = ff_rtp_codec_id(buf, par->codec_type);
     }
 
-    c = avcodec_find_decoder(par->codec_id);
-    if (c && c->name)
-        c_name = c->name;
+    desc = avcodec_descriptor_get(par->codec_id);
+    if (desc && desc->name)
+        c_name = desc->name;
     else
         c_name = "(null)";