Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: source/patched-ffmpeg-mt/libavformat/http.c

Issue 2850032: ffmpeg update to june 23 version which fixes mp4 crash on still frames with 3... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * HTTP protocol for ffmpeg client 2 * HTTP protocol for ffmpeg client
3 * Copyright (c) 2000, 2001 Fabrice Bellard 3 * Copyright (c) 2000, 2001 Fabrice Bellard
4 * 4 *
5 * This file is part of FFmpeg. 5 * This file is part of FFmpeg.
6 * 6 *
7 * FFmpeg is free software; you can redistribute it and/or 7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public 8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version. 10 * version 2.1 of the License, or (at your option) any later version.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 int64_t off, filesize; 46 int64_t off, filesize;
47 char location[URL_SIZE]; 47 char location[URL_SIZE];
48 HTTPAuthState auth_state; 48 HTTPAuthState auth_state;
49 int init; 49 int init;
50 unsigned char headers[BUFFER_SIZE]; 50 unsigned char headers[BUFFER_SIZE];
51 int is_chunked; 51 int is_chunked;
52 } HTTPContext; 52 } HTTPContext;
53 53
54 static int http_connect(URLContext *h, const char *path, const char *hoststr, 54 static int http_connect(URLContext *h, const char *path, const char *hoststr,
55 const char *auth, int *new_location); 55 const char *auth, int *new_location);
56 static int http_write(URLContext *h, const uint8_t *buf, int size);
57 56
58 void ff_http_set_headers(URLContext *h, const char *headers) 57 void ff_http_set_headers(URLContext *h, const char *headers)
59 { 58 {
60 HTTPContext *s = h->priv_data; 59 HTTPContext *s = h->priv_data;
61 int len = strlen(headers); 60 int len = strlen(headers);
62 61
63 if (len && strcmp("\r\n", headers + len - 2)) 62 if (len && strcmp("\r\n", headers + len - 2))
64 av_log(NULL, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n"); 63 av_log(NULL, AV_LOG_ERROR, "No trailing CRLF found in HTTP header.\n");
65 64
66 av_strlcpy(s->headers, headers, sizeof(s->headers)); 65 av_strlcpy(s->headers, headers, sizeof(s->headers));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 HTTPContext *s; 145 HTTPContext *s;
147 146
148 h->is_streamed = 1; 147 h->is_streamed = 1;
149 148
150 s = av_malloc(sizeof(HTTPContext)); 149 s = av_malloc(sizeof(HTTPContext));
151 if (!s) { 150 if (!s) {
152 return AVERROR(ENOMEM); 151 return AVERROR(ENOMEM);
153 } 152 }
154 h->priv_data = s; 153 h->priv_data = s;
155 s->filesize = -1; 154 s->filesize = -1;
156 s->chunksize = -1;
157 s->is_chunked = 1; 155 s->is_chunked = 1;
158 s->off = 0; 156 s->off = 0;
159 s->init = 0; 157 s->init = 0;
160 s->hd = NULL; 158 s->hd = NULL;
161 *s->headers = '\0'; 159 *s->headers = '\0';
162 memset(&s->auth_state, 0, sizeof(s->auth_state)); 160 memset(&s->auth_state, 0, sizeof(s->auth_state));
163 av_strlcpy(s->location, uri, URL_SIZE); 161 av_strlcpy(s->location, uri, URL_SIZE);
164 162
165 return 0; 163 return 0;
166 } 164 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 "%s" 314 "%s"
317 "%s" 315 "%s"
318 "\r\n", 316 "\r\n",
319 post ? "POST" : "GET", 317 post ? "POST" : "GET",
320 path, 318 path,
321 post && s->is_chunked ? "Transfer-Encoding: chunked\r\n" : "", 319 post && s->is_chunked ? "Transfer-Encoding: chunked\r\n" : "",
322 headers, 320 headers,
323 authstr ? authstr : ""); 321 authstr ? authstr : "");
324 322
325 av_freep(&authstr); 323 av_freep(&authstr);
326 if (http_write(h, s->buffer, strlen(s->buffer)) < 0) 324 if (url_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
327 return AVERROR(EIO); 325 return AVERROR(EIO);
328 326
329 /* init input buffer */ 327 /* init input buffer */
330 s->buf_ptr = s->buffer; 328 s->buf_ptr = s->buffer;
331 s->buf_end = s->buffer; 329 s->buf_end = s->buffer;
332 s->line_count = 0; 330 s->line_count = 0;
333 s->off = 0; 331 s->off = 0;
334 s->filesize = -1; 332 s->filesize = -1;
333 s->chunksize = -1;
335 if (post) { 334 if (post) {
336 /* always use chunked encoding for upload data */ 335 /* always use chunked encoding for upload data */
337 s->chunksize = 0; 336 s->chunksize = 0;
338 /* Pretend that it did work. We didn't read any header yet, since 337 /* Pretend that it did work. We didn't read any header yet, since
339 * we've still to send the POST data, but the code calling this 338 * we've still to send the POST data, but the code calling this
340 * function will check http_code after we return. */ 339 * function will check http_code after we return. */
341 s->http_code = 200; 340 s->http_code = 200;
342 return 0; 341 return 0;
343 } 342 }
344 343
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 528
530 URLProtocol http_protocol = { 529 URLProtocol http_protocol = {
531 "http", 530 "http",
532 http_open, 531 http_open,
533 http_read, 532 http_read,
534 http_write, 533 http_write,
535 http_seek, 534 http_seek,
536 http_close, 535 http_close,
537 .url_get_file_handle = http_get_file_handle, 536 .url_get_file_handle = http_get_file_handle,
538 }; 537 };
OLDNEW
« no previous file with comments | « source/patched-ffmpeg-mt/libavformat/http.h ('k') | source/patched-ffmpeg-mt/libavformat/internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698