[FFmpeg-cvslog] wavenc: use codec descriptors to get the codec name

Anton Khirnov git at videolan.org
Sun May 18 21:11:30 CEST 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Apr 29 17:01:17 2014 +0200| [d246231e4714119faac6c7acd881d3b687bb8b11] | committer: Anton Khirnov

wavenc: use codec descriptors to get the codec name

Also, return a proper error code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d246231e4714119faac6c7acd881d3b687bb8b11
---

 libavformat/wavenc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 86ed557..25f6ffc 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -110,9 +110,10 @@ static int wav_write_header(AVFormatContext *s)
     /* format header */
     fmt = ff_start_tag(pb, "fmt ");
     if (ff_put_wav_header(pb, s->streams[0]->codec) < 0) {
+        const AVCodecDescriptor *desc = avcodec_descriptor_get(s->streams[0]->codec->codec_id);
         av_log(s, AV_LOG_ERROR, "%s codec not supported in WAVE format\n",
-               s->streams[0]->codec->codec ? s->streams[0]->codec->codec->name : "NONE");
-        return -1;
+               desc ? desc->name : "unknown");
+        return AVERROR(ENOSYS);
     }
     ff_end_tag(pb, fmt);
 



More information about the ffmpeg-cvslog mailing list