Skip to content

Instantly share code, notes, and snippets.

@lu-zero
Created January 21, 2015 09:59
Show Gist options
  • Save lu-zero/98573deec032d15a79d2 to your computer and use it in GitHub Desktop.
Save lu-zero/98573deec032d15a79d2 to your computer and use it in GitHub Desktop.
How to open mms:// url in Libav
/*
* How to open mms:// url in Libav
*
* Libav 12 will sport a chained protocol that aliases to the following
*
*/
int example_open(AVFormatContext **ic, const char *url)
{
const char *protos[2] = {"mmsh://", "mmst://"};
char *path = NULL;
char buf[1024] = {0};
int i, ret;
if (av_strstart(url, "mms://", &path)) {
for (i = 0; i < 2; i++) {
av_strlcatf(buf, 1024, "%s%s", protos[i], path);
ret = avformat_open_input(ic, buf, NULL, NULL);
if (ret >= 0)
break;
}
} else {
ret = avformat_open_input(ic, buf, NULL, NULL);
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment