Commit 91e59fea authored by Anton Khirnov's avatar Anton Khirnov

lavc: add avcodec_descriptor_get_by_name().

parent 0a0f19b5
......@@ -4548,6 +4548,12 @@ const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
*/
const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
/**
* @return codec descriptor with the given name or NULL if no such descriptor
* exists.
*/
const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
/**
* @}
*/
......
......@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include "avcodec.h"
#include "libavutil/common.h"
......@@ -1939,3 +1941,14 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev)
return prev + 1;
return NULL;
}
const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name)
{
const AVCodecDescriptor *desc = NULL;
while ((desc = avcodec_descriptor_next(desc))) {
if (!strcmp(desc->name, name))
return desc;
}
return NULL;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment