# HG changeset patch # User bellard # Date 1042261157 0 # Node ID 81e87c8de3dcec21695c475379eabd6fefdbb958 # Parent 01e35bb2689ad93eb6759c0aca40ce54fc4f73a4 added url_get_filename() diff -r 01e35bb2689a -r 81e87c8de3dc avio.c --- a/avio.c Sat Jan 11 04:58:36 2003 +0000 +++ b/avio.c Sat Jan 11 04:59:17 2003 +0000 @@ -61,11 +61,12 @@ err = -ENOENT; goto fail; found: - uc = av_malloc(sizeof(URLContext)); + uc = av_malloc(sizeof(URLContext) + strlen(filename)); if (!uc) { err = -ENOMEM; goto fail; } + strcpy(uc->filename, filename); uc->prot = up; uc->flags = flags; uc->is_streamed = 0; /* default = not streamed */ @@ -154,3 +155,8 @@ { return h->max_packet_size; } + +void url_get_filename(URLContext *h, char *buf, int buf_size) +{ + pstrcpy(buf, buf_size, h->filename); +} diff -r 01e35bb2689a -r 81e87c8de3dc avio.h --- a/avio.h Sat Jan 11 04:58:36 2003 +0000 +++ b/avio.h Sat Jan 11 04:59:17 2003 +0000 @@ -13,6 +13,7 @@ int is_streamed; /* true if streamed (no seek possible), default = false */ int max_packet_size; /* if non zero, the stream is packetized with this max packet size */ void *priv_data; + char filename[1]; /* specified filename */ }; typedef struct URLContext URLContext; @@ -35,6 +36,8 @@ int url_exist(const char *filename); offset_t url_filesize(URLContext *h); int url_get_max_packet_size(URLContext *h); +void url_get_filename(URLContext *h, char *buf, int buf_size); + /* not implemented */ int url_poll(URLPollEntry *poll_table, int n, int timeout);