Created
January 21, 2015 09:59
-
-
Save lu-zero/98573deec032d15a79d2 to your computer and use it in GitHub Desktop.
How to open mms:// url in Libav
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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