[FFmpeg-devel] [PATCH] MMS wrapper

Geek.Song ffmpeg at gmail.com
Sat Jul 14 13:49:08 CEST 2012


Dear:

I think you over-design the implementation, I just modify the
avio_open2() to probe mmsh or mmst.

int avio_open2(AVIOContext **s, const char *filename, int flags,
               const AVIOInterruptCB *int_cb, AVDictionary **options)
{
    URLContext *h;
    int err;
    int mms = !av_strncasecmp(filename, "mms://", 6);

    if (mms) {
        char mms_replace[1024] = {'\0'};
        const char *mms_surfix[] = {"mmsh://", "mmst://"};
        int i = 0, try_count = sizeof(mms_surfix)/sizeof(mms_surfix[0]);

        av_log(NULL, AV_LOG_WARNING, "Found ambiguous \"%s\"
stream\n", filename);
        while (i < try_count) {
            int size = strlen(mms_surfix[i]) + 1;

            av_strlcpy(mms_replace, mms_surfix[i], size);
            av_strlcat(mms_replace, filename + 6,  1024 - size);
            av_log(NULL, AV_LOG_INFO, "Try to use \"%s\" as
replacement\n", mms_replace);
            err = ffurl_open(&h, mms_replace, flags, int_cb, options);
            if (err < 0)
                av_log(NULL, AV_LOG_INFO, "Failed to open: \"%s\"\n",
mms_replace);
            else {
                err = ffio_fdopen(s, h);
                if (err < 0) {
                    ffurl_close(h);
                    return err;
                } else
                    return 0;
            }
            i++;
        }
        return err;
    }
    err = ffurl_open(&h, filename, flags, int_cb, options);
    if (err < 0)
        return err;
    err = ffio_fdopen(s, h);
    if (err < 0) {
        ffurl_close(h);
        return err;
    }
    return 0;
}


On Sat, Jul 14, 2012 at 4:41 AM, Stefan Gehrer <stefan.gehrer at gmx.de> wrote:
> attached patch implements a simple wrapper for handling mms:// URLs.
> It first tries to open using mmst protocol and on failure tries
> using mmsh protocol.
> I found some streams on tunein.com which either support only
> mmst or only mssh, with this patch applied both kinds can be
> played back with just specifying mms:// as protocol.
> This should fix ticket #998, the mms URL given there also works.
> mms://live1.wm.skynews.servecast.net/skynews_wmlz_live300k
>
> Stefan
>


-- 
-----------------------------------------------------------------------------------------
My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2


More information about the ffmpeg-devel mailing list