Opened 4 years ago

Closed 4 years ago

#1396 closed defect (invalid)

Commit 32d545e0 breaks binary backward compatibility

Reported by: jyavenard Owned by:
Priority: important Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

commit [32d545e0] inserted a new member to the structure URLProtocol that breaks binary compatibility.

New members should only ever be added at the end, not in the middle of things !

Using C99 designated initialisers isn't always possible.
(like when using ffmpeg from a C++ code)

Definition of URLProtocol should be as follow:

typedef struct URLProtocol {
    const char *name;
    int     (*url_open)( URLContext *h, const char *url, int flags);
    /**
     * This callback is to be used by protocols which open further nested
     * protocols. options are then to be passed to ffurl_open()/ffurl_connect()
     * for those nested protocols.
     */
    int     (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options);

    /**
     * Read data from the protocol.
     * If data is immediately available (even less than size), EOF is
     * reached or an error occurs (including EINTR), return immediately.
     * Otherwise:
     * In non-blocking mode, return AVERROR(EAGAIN) immediately.
     * In blocking mode, wait for data/EOF/error with a short timeout (0.1s),
     * and return AVERROR(EAGAIN) on timeout.
     * Checking interrupt_callback, looping on EINTR and EAGAIN and until
     * enough data has been read is left to the calling function; see
     * retry_transfer_wrapper in avio.c.
     */
    int     (*url_read)( URLContext *h, unsigned char *buf, int size);
    int     (*url_write)(URLContext *h, const unsigned char *buf, int size);
    int64_t (*url_seek)( URLContext *h, int64_t pos, int whence);
    int     (*url_close)(URLContext *h);
    struct URLProtocol *next;
    int (*url_read_pause)(URLContext *h, int pause);
    int64_t (*url_read_seek)(URLContext *h, int stream_index,
                             int64_t timestamp, int flags);
    int (*url_get_file_handle)(URLContext *h);
    int priv_data_size;
    const AVClass *priv_data_class;
    int flags;
    int (*url_check)(URLContext *h, int mask);
    int (*url_shutdown)(URLContext *h, int flags);
} URLProtocol;

note that url_shutdown is add at the bottom instead

Change History (3)

comment:1 Changed 4 years ago by jyavenard

will also report it to the libav project

comment:2 Changed 4 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Version changed from unspecified to git-master

I believe url.h is not a public header that can break binary compatibility. Am I wrong?

If you want url.h to be a public header, please send a patch explaining the reason.

comment:3 Changed 4 years ago by saste

  • Analyzed by developer set
  • Resolution set to invalid
  • Status changed from new to closed

Closing the ticket as invalid, since libavformat/url.h is not a public header and the structures defined in it should not be directly accessed.

Note: See TracTickets for help on using tickets.