| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Multiple format streaming server | 2 * Multiple format streaming server |
| 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 3 * Copyright (c) 2000, 2001, 2002 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 c->stream->feed->feed_write_index, | 2299 c->stream->feed->feed_write_index, |
| 2300 c->stream->feed->feed_size); | 2300 c->stream->feed->feed_size); |
| 2301 | 2301 |
| 2302 if (c->stream->max_time && | 2302 if (c->stream->max_time && |
| 2303 c->stream->max_time + c->start_time - cur_time < 0) | 2303 c->stream->max_time + c->start_time - cur_time < 0) |
| 2304 /* We have timed out */ | 2304 /* We have timed out */ |
| 2305 c->state = HTTPSTATE_SEND_DATA_TRAILER; | 2305 c->state = HTTPSTATE_SEND_DATA_TRAILER; |
| 2306 else { | 2306 else { |
| 2307 AVPacket pkt; | 2307 AVPacket pkt; |
| 2308 redo: | 2308 redo: |
| 2309 if (av_read_frame(c->fmt_in, &pkt) < 0) { | 2309 ret = av_read_frame(c->fmt_in, &pkt); |
| 2310 if (c->stream->feed && c->stream->feed->feed_opened) { | 2310 if (ret < 0) { |
| 2311 if (c->stream->feed) { |
| 2311 /* if coming from feed, it means we reached the end of the | 2312 /* if coming from feed, it means we reached the end of the |
| 2312 ffm file, so must wait for more data */ | 2313 ffm file, so must wait for more data */ |
| 2313 c->state = HTTPSTATE_WAIT_FEED; | 2314 c->state = HTTPSTATE_WAIT_FEED; |
| 2314 return 1; /* state changed */ | 2315 return 1; /* state changed */ |
| 2316 } else if (ret == AVERROR(EAGAIN)) { |
| 2317 /* input not ready, come back later */ |
| 2318 return 0; |
| 2315 } else { | 2319 } else { |
| 2316 if (c->stream->loop) { | 2320 if (c->stream->loop) { |
| 2317 av_close_input_file(c->fmt_in); | 2321 av_close_input_file(c->fmt_in); |
| 2318 c->fmt_in = NULL; | 2322 c->fmt_in = NULL; |
| 2319 if (open_input_stream(c, "") < 0) | 2323 if (open_input_stream(c, "") < 0) |
| 2320 goto no_loop; | 2324 goto no_loop; |
| 2321 goto redo; | 2325 goto redo; |
| 2322 } else { | 2326 } else { |
| 2323 no_loop: | 2327 no_loop: |
| 2324 /* must send trailer now because eof or error */ | 2328 /* must send trailer now because eof or error */ |
| (...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4762 if (ffserver_daemon) | 4766 if (ffserver_daemon) |
| 4763 chdir("/"); | 4767 chdir("/"); |
| 4764 | 4768 |
| 4765 if (http_server() < 0) { | 4769 if (http_server() < 0) { |
| 4766 http_log("Could not start server\n"); | 4770 http_log("Could not start server\n"); |
| 4767 exit(1); | 4771 exit(1); |
| 4768 } | 4772 } |
| 4769 | 4773 |
| 4770 return 0; | 4774 return 0; |
| 4771 } | 4775 } |
| OLD | NEW |