~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/gopher.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
        ffurl_close(s->hd);
73
73
        s->hd = NULL;
74
74
    }
75
 
    av_freep(&h->priv_data);
76
75
    return 0;
77
76
}
78
77
 
79
78
static int gopher_open(URLContext *h, const char *uri, int flags)
80
79
{
81
 
    GopherContext *s;
 
80
    GopherContext *s = h->priv_data;
82
81
    char hostname[1024], auth[1024], path[1024], buf[1024];
83
82
    int port, err;
84
83
 
85
84
    h->is_streamed = 1;
86
85
 
87
 
    s = av_malloc(sizeof(GopherContext));
88
 
    if (!s) {
89
 
        return AVERROR(ENOMEM);
90
 
    }
91
 
    h->priv_data = s;
92
 
 
93
86
    /* needed in any case to build the host string */
94
87
    av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
95
88
                 path, sizeof(path), uri);
100
93
    ff_url_join(buf, sizeof(buf), "tcp", NULL, hostname, port, NULL);
101
94
 
102
95
    s->hd = NULL;
103
 
    err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE);
 
96
    err = ffurl_open(&s->hd, buf, AVIO_FLAG_READ_WRITE,
 
97
                     &h->interrupt_callback, NULL);
104
98
    if (err < 0)
105
99
        goto fail;
106
100
 
121
115
 
122
116
 
123
117
URLProtocol ff_gopher_protocol = {
124
 
    .name      = "gopher",
125
 
    .url_open  = gopher_open,
126
 
    .url_read  = gopher_read,
127
 
    .url_write = gopher_write,
128
 
    .url_close = gopher_close,
 
118
    .name           = "gopher",
 
119
    .url_open       = gopher_open,
 
120
    .url_read       = gopher_read,
 
121
    .url_write      = gopher_write,
 
122
    .url_close      = gopher_close,
 
123
    .priv_data_size = sizeof(GopherContext),
 
124
    .flags          = URL_PROTOCOL_FLAG_NETWORK,
129
125
};