From 7dc6d49cbbba68fa8ba44d0b75759291650246f2 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 29 Dec 2004 14:57:44 +0000 Subject: [PATCH] give indication of why we segfault Original commit message from CVS: give indication of why we segfault --- ChangeLog | 5 +++++ gst/ffmpegcolorspace/imgconvert.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aaedb8ac70..d9a6a4e97f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-29 Thomas Vander Stichele + + * gst/ffmpegcolorspace/imgconvert.c: + give some indication of why we're segfaulting + 2004-12-29 Ronald S. Bultje * configure.ac: diff --git a/gst/ffmpegcolorspace/imgconvert.c b/gst/ffmpegcolorspace/imgconvert.c index 3cf3f99978..d9dd2f8e2b 100644 --- a/gst/ffmpegcolorspace/imgconvert.c +++ b/gst/ffmpegcolorspace/imgconvert.c @@ -290,6 +290,7 @@ static PixFmtInfo pix_fmt_info[PIX_FMT_NB] = { }, }; +/* returns NULL if not found */ static PixFmtInfo * get_pix_fmt_info (enum PixelFormat format) { @@ -300,6 +301,11 @@ get_pix_fmt_info (enum PixelFormat format) return pix_fmt_info + i; } } + + /* since this doesn't get checked *anywhere*, we might as well warn + here if we return NULL so you have *some* idea what's going on */ + g_warning ("Could not find info for pixel format %d, one segfault coming up", + format); return NULL; } @@ -405,7 +411,6 @@ avcodec_get_pix_fmt_loss (int dst_pix_fmt, int src_pix_fmt, int has_alpha) /* compute loss */ loss = 0; - pf = get_pix_fmt_info (dst_pix_fmt); if (pf->depth < ps->depth || (dst_pix_fmt == PIX_FMT_RGB555 && src_pix_fmt == PIX_FMT_RGB565)) loss |= FF_LOSS_DEPTH;