]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49'
authorMark Thompson <sw@jkqxz.net>
Sun, 12 Mar 2017 15:19:05 +0000 (15:19 +0000)
committerMark Thompson <sw@jkqxz.net>
Sun, 12 Mar 2017 15:19:05 +0000 (15:19 +0000)
* commit '95414eb2dc63a6f934275b4ed33dedd4369f2c49':
  qsv: print more complete error messages

Merged-by: Mark Thompson <sw@jkqxz.net>
1  2 
libavcodec/qsv.c
libavcodec/qsv_internal.h
libavcodec/qsvdec.c
libavcodec/qsvenc.c

index 028a496eadcf3e52df1397ad4639c4b40b1ac424,14f16bc66d834a6834775d4ef3cd950bfa4bc92b..76c7826536baf607f309c72360c42c471282682b
@@@ -54,55 -54,67 +54,83 @@@ int ff_qsv_codec_id_to_mfx(enum AVCodec
      return AVERROR(ENOSYS);
  }
  
- int ff_qsv_error(int mfx_err)
 +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile)
 +{
 +    if (profile == FF_PROFILE_UNKNOWN)
 +        return MFX_PROFILE_UNKNOWN;
 +    switch (codec_id) {
 +    case AV_CODEC_ID_H264:
 +    case AV_CODEC_ID_HEVC:
 +        return profile;
 +    case AV_CODEC_ID_VC1:
 +        return 4 * profile + 1;
 +    case AV_CODEC_ID_MPEG2VIDEO:
 +        return 0x10 * profile;
 +    }
 +    return MFX_PROFILE_UNKNOWN;
 +}
 +
+ static const struct {
+     mfxStatus   mfxerr;
+     int         averr;
+     const char *desc;
+ } qsv_errors[] = {
+     { MFX_ERR_NONE,                     0,               "success"                              },
+     { MFX_ERR_UNKNOWN,                  AVERROR_UNKNOWN, "unknown error"                        },
+     { MFX_ERR_NULL_PTR,                 AVERROR(EINVAL), "NULL pointer"                         },
+     { MFX_ERR_UNSUPPORTED,              AVERROR(ENOSYS), "unsupported"                          },
+     { MFX_ERR_MEMORY_ALLOC,             AVERROR(ENOMEM), "failed to allocate memory"            },
+     { MFX_ERR_NOT_ENOUGH_BUFFER,        AVERROR(ENOMEM), "insufficient input/output buffer"     },
+     { MFX_ERR_INVALID_HANDLE,           AVERROR(EINVAL), "invalid handle"                       },
+     { MFX_ERR_LOCK_MEMORY,              AVERROR(EIO),    "failed to lock the memory block"      },
+     { MFX_ERR_NOT_INITIALIZED,          AVERROR_BUG,     "not initialized"                      },
+     { MFX_ERR_NOT_FOUND,                AVERROR(ENOSYS), "specified object was not found"       },
+     { MFX_ERR_MORE_DATA,                AVERROR(EAGAIN), "expect more data at input"            },
+     { MFX_ERR_MORE_SURFACE,             AVERROR(EAGAIN), "expect more surface at output"        },
+     { MFX_ERR_ABORTED,                  AVERROR_UNKNOWN, "operation aborted"                    },
+     { MFX_ERR_DEVICE_LOST,              AVERROR(EIO),    "device lost"                          },
+     { MFX_ERR_INCOMPATIBLE_VIDEO_PARAM, AVERROR(EINVAL), "incompatible video parameters"        },
+     { MFX_ERR_INVALID_VIDEO_PARAM,      AVERROR(EINVAL), "invalid video parameters"             },
+     { MFX_ERR_UNDEFINED_BEHAVIOR,       AVERROR_BUG,     "undefined behavior"                   },
+     { MFX_ERR_DEVICE_FAILED,            AVERROR(EIO),    "device failed"                        },
+     { MFX_ERR_MORE_BITSTREAM,           AVERROR(EAGAIN), "expect more bitstream at output"      },
+     { MFX_ERR_INCOMPATIBLE_AUDIO_PARAM, AVERROR(EINVAL), "incompatible audio parameters"        },
+     { MFX_ERR_INVALID_AUDIO_PARAM,      AVERROR(EINVAL), "invalid audio parameters"             },
+     { MFX_WRN_IN_EXECUTION,             0,               "operation in execution"               },
+     { MFX_WRN_DEVICE_BUSY,              0,               "device busy"                          },
+     { MFX_WRN_VIDEO_PARAM_CHANGED,      0,               "video parameters changed"             },
+     { MFX_WRN_PARTIAL_ACCELERATION,     0,               "partial acceleration"                 },
+     { MFX_WRN_INCOMPATIBLE_VIDEO_PARAM, 0,               "incompatible video parameters"        },
+     { MFX_WRN_VALUE_NOT_CHANGED,        0,               "value is saturated"                   },
+     { MFX_WRN_OUT_OF_RANGE,             0,               "value out of range"                   },
+     { MFX_WRN_FILTER_SKIPPED,           0,               "filter skipped"                       },
+     { MFX_WRN_INCOMPATIBLE_AUDIO_PARAM, 0,               "incompatible audio parameters"        },
+ };
+ int ff_qsv_map_error(mfxStatus mfx_err, const char **desc)
  {
-     switch (mfx_err) {
-     case MFX_ERR_NONE:
-         return 0;
-     case MFX_ERR_MEMORY_ALLOC:
-     case MFX_ERR_NOT_ENOUGH_BUFFER:
-         return AVERROR(ENOMEM);
-     case MFX_ERR_INVALID_HANDLE:
-         return AVERROR(EINVAL);
-     case MFX_ERR_DEVICE_FAILED:
-     case MFX_ERR_DEVICE_LOST:
-     case MFX_ERR_LOCK_MEMORY:
-         return AVERROR(EIO);
-     case MFX_ERR_NULL_PTR:
-     case MFX_ERR_UNDEFINED_BEHAVIOR:
-     case MFX_ERR_NOT_INITIALIZED:
-         return AVERROR_BUG;
-     case MFX_ERR_UNSUPPORTED:
-     case MFX_ERR_NOT_FOUND:
-         return AVERROR(ENOSYS);
-     case MFX_ERR_MORE_DATA:
-     case MFX_ERR_MORE_SURFACE:
-     case MFX_ERR_MORE_BITSTREAM:
-         return AVERROR(EAGAIN);
-     case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM:
-     case MFX_ERR_INVALID_VIDEO_PARAM:
-         return AVERROR(EINVAL);
-     case MFX_ERR_ABORTED:
-     case MFX_ERR_UNKNOWN:
-     default:
-         return AVERROR_UNKNOWN;
+     int i;
+     for (i = 0; i < FF_ARRAY_ELEMS(qsv_errors); i++) {
+         if (qsv_errors[i].mfxerr == mfx_err) {
+             if (desc)
+                 *desc = qsv_errors[i].desc;
+             return qsv_errors[i].averr;
+         }
      }
+     if (desc)
+         *desc = "unknown error";
+     return AVERROR_UNKNOWN;
+ }
+ int ff_qsv_print_error(void *log_ctx, mfxStatus err,
+                        const char *error_string)
+ {
+     const char *desc;
+     int ret;
+     ret = ff_qsv_map_error(err, &desc);
+     av_log(log_ctx, AV_LOG_ERROR, "%s: %s (%d)\n", error_string, desc, err);
+     return ret;
  }
  
  int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
index 5d2a216ce6fc73787a5fd55e1296e9f7e68e93a1,03b2f651db72a4804084fa480e0803ec415b05a2..eb8e3a59864403b31817d7e0c532472a34d2e508
@@@ -58,12 -55,14 +58,15 @@@ typedef struct QSVFramesContext 
  } QSVFramesContext;
  
  /**
 - * Convert a libmfx error code into a libav error code.
 + * Convert a libmfx error code into an ffmpeg error code.
   */
- int ff_qsv_error(int mfx_err);
+ int ff_qsv_map_error(mfxStatus mfx_err, const char **desc);
+ int ff_qsv_print_error(void *log_ctx, mfxStatus err,
+                        const char *error_string);
  
  int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 +int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
  
  int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
  
Simple merge
Simple merge