Ticket #618: no-url-proto-error.patch

File no-url-proto-error.patch, 1.8 KB (added by Eric P. Mangold, 15 years ago)
  • libavformat/avio.c

    diff --git a/libavformat/avio.c b/libavformat/avio.c
    index 2bdad73..fd13ace 100644
    a b int ffurl_alloc(URLContext **puc, const char *filename, int flags)  
    223223    char proto_str[128], proto_nested[128], *ptr;
    224224    size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
    225225
     226    if (first_protocol == NULL) {
     227        *puc = NULL;
     228        return AVERROR_NO_URL_PROTO_REG;
     229    }
     230
    226231    if (filename[proto_len] != ':' || is_dos_path(filename))
    227232        strcpy(proto_str, "file");
    228233    else
  • libavutil/error.c

    diff --git a/libavutil/error.c b/libavutil/error.c
    index d296395..10ae458 100644
    a b int av_strerror(int errnum, char *errbuf, size_t errbuf_size)  
    3939    case AVERROR_PATCHWELCOME:      errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
    4040    case AVERROR_PROTOCOL_NOT_FOUND:errstr = "Protocol not found"                           ; break;
    4141    case AVERROR_STREAM_NOT_FOUND:  errstr = "Stream not found"                             ; break;
     42    case AVERROR_NO_URL_PROTO_REG:  errstr = "No URL Protocols are registered. "
     43                                             "Missing call to av_register_all()?"           ; break;
     44
    4245    }
    4346
    4447    if (errstr) {
  • libavutil/error.h

    diff --git a/libavutil/error.h b/libavutil/error.h
    index 47d366e..bf253fa 100644
    a b  
    5050#define AVERROR_PATCHWELCOME       (-MKTAG( 'P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome
    5151#define AVERROR_PROTOCOL_NOT_FOUND (-MKTAG(0xF8,'P','R','O')) ///< Protocol not found
    5252#define AVERROR_STREAM_NOT_FOUND   (-MKTAG(0xF8,'S','T','R')) ///< Stream not found
     53#define AVERROR_NO_URL_PROTO_REG   (-MKTAG(0xF8,'N','U','P')) ///< No URL Protocols are registered.
    5354
    5455/**
    5556 * Put a description of the AVERROR code errnum in errbuf.