diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index cd4cbde3742665d9b4821483e89c891eb228a772..b6412a5313d3382a4b8fa9cda150f93e3f7d9e2d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1140,3 +1140,15 @@ AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel)
 {
     return hwaccel ? hwaccel->next : first_hwaccel;
 }
+
+AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt)
+{
+    AVHWAccel *hwaccel=NULL;
+
+    while((hwaccel= av_hwaccel_next(hwaccel))){
+        if (   hwaccel->id      == codec_id
+            && hwaccel->pix_fmt == pix_fmt)
+            return hwaccel;
+    }
+    return NULL;
+}