[FFmpeg-cvslog] lavd/v4l2: extend error/debug feedback in case of invalid codec/pix_fmt

Stefano Sabatini git at videolan.org
Tue Jan 15 21:59:54 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Jan 15 09:57:50 2013 +0100| [1b325ce91ab78e2edd676cd8a099d04dd90a202c] | committer: Stefano Sabatini

lavd/v4l2: extend error/debug feedback in case of invalid codec/pix_fmt

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

 libavdevice/v4l2.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index c82a908..6055278 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -761,6 +761,10 @@ static uint32_t device_try_init(AVFormatContext *s1,
         for (i = 0; i<FF_ARRAY_ELEMS(fmt_conversion_table); i++) {
             if (s1->video_codec_id == AV_CODEC_ID_NONE ||
                 fmt_conversion_table[i].codec_id == s1->video_codec_id) {
+                av_log(s1, AV_LOG_DEBUG, "Trying to set codec:%s pix_fmt:%s\n",
+                       avcodec_get_name(fmt_conversion_table[i].codec_id),
+                       (char *)av_x_if_null(av_get_pix_fmt_name(fmt_conversion_table[i].ff_fmt), "none"));
+
                 desired_format = fmt_conversion_table[i].v4l2_fmt;
                 if (device_init(s1, width, height, desired_format) >= 0) {
                     break;
@@ -848,7 +852,9 @@ static int v4l2_read_header(AVFormatContext *s1)
 
     if (desired_format == 0) {
         av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for "
-               "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, pix_fmt);
+               "codec '%s' (id %d), pixel format '%s' (id %d)\n",
+               avcodec_get_name(s1->video_codec_id), s1->video_codec_id,
+               (char *)av_x_if_null(av_get_pix_fmt_name(pix_fmt), "none"), pix_fmt);
         v4l2_close(s->fd);
 
         return AVERROR(EIO);



More information about the ffmpeg-cvslog mailing list