~ubuntu-branches/ubuntu/trusty/libav/trusty

« back to all changes in this revision

Viewing changes to ffserver.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler, Jonathan Nieder, Reinhard Tartler
  • Date: 2011-05-13 12:31:33 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (1.3.4 sid)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20110513123133-zqcsj91sf5489y4s
Tags: 4:0.7~beta2-1
[ Jonathan Nieder ]
* only install doc/APIChanges in *-dev and libav-doc packages
* move note on source package lineage to README.Debian
* install NEWS.Debian in libavcodec-dev
* use dpkg source format 3.0 (quilt)
* allow "debian/rules clean" as unprivileged user

[ Reinhard Tartler ]
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
22
 
#define _XOPEN_SOURCE 600
23
 
 
24
22
#include "config.h"
25
23
#if !HAVE_CLOSESOCKET
26
24
#define closesocket close
40
38
#include "libavutil/lfg.h"
41
39
#include "libavutil/random_seed.h"
42
40
#include "libavutil/parseutils.h"
43
 
#include "libavcodec/opt.h"
 
41
#include "libavutil/opt.h"
44
42
#include <stdarg.h>
45
43
#include <unistd.h>
46
44
#include <fcntl.h>
59
57
 
60
58
#include "cmdutils.h"
61
59
 
62
 
const char program_name[] = "FFserver";
 
60
const char program_name[] = "ffserver";
63
61
const int program_birth_year = 2000;
64
62
 
65
63
static const OptionDef options[];
95
93
    "RTSP_SEND_PACKET",
96
94
};
97
95
 
98
 
#if !FF_API_MAX_STREAMS
99
96
#define MAX_STREAMS 20
100
 
#endif
101
97
 
102
98
#define IOBUFFER_INIT_SIZE 8192
103
99
 
2187
2183
        }
2188
2184
    }
2189
2185
 
2190
 
#if 1
2191
2186
    if (c->fmt_in->iformat->read_seek)
2192
2187
        av_seek_frame(c->fmt_in, -1, stream_pos, 0);
2193
 
#endif
2194
2188
    /* set the start time (needed for maxtime and RTP packet timing) */
2195
2189
    c->start_time = cur_time;
2196
2190
    c->first_pts = AV_NOPTS_VALUE;
2267
2261
 
2268
2262
        /*
2269
2263
         * HACK to avoid mpeg ps muxer to spit many underflow errors
2270
 
         * Default value from FFmpeg
 
2264
         * Default value from Libav
2271
2265
         * Try to set it use configuration option
2272
2266
         */
2273
2267
        c->fmt_ctx.preload   = (int)(0.5*AV_TIME_BASE);
2944
2938
        snprintf(avc->filename, 1024, "rtp://0.0.0.0");
2945
2939
    }
2946
2940
 
2947
 
#if !FF_API_MAX_STREAMS
2948
2941
    if (avc->nb_streams >= INT_MAX/sizeof(*avc->streams) ||
2949
2942
        !(avc->streams = av_malloc(avc->nb_streams * sizeof(*avc->streams))))
2950
2943
        goto sdp_done;
2951
 
#endif
2952
2944
    if (avc->nb_streams >= INT_MAX/sizeof(*avs) ||
2953
2945
        !(avs = av_malloc(avc->nb_streams * sizeof(*avs))))
2954
2946
        goto sdp_done;
2961
2953
    av_sdp_create(&avc, 1, *pbuffer, 2048);
2962
2954
 
2963
2955
 sdp_done:
2964
 
#if !FF_API_MAX_STREAMS
2965
2956
    av_free(avc->streams);
2966
 
#endif
2967
2957
    av_metadata_free(&avc->metadata);
2968
2958
    av_free(avc);
2969
2959
    av_free(avs);
3428
3418
                     "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
3429
3419
        }
3430
3420
 
3431
 
        if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
 
3421
        if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
3432
3422
            goto fail;
3433
3423
        c->rtp_handles[stream_index] = h;
3434
3424
        max_packet_size = url_get_max_packet_size(h);
3685
3675
    for(feed = first_feed; feed != NULL; feed = feed->next_feed) {
3686
3676
        int fd;
3687
3677
 
3688
 
        if (url_exist(feed->feed_filename)) {
 
3678
        if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) {
3689
3679
            /* See if it matches */
3690
3680
            AVFormatContext *s;
3691
3681
            int matches = 0;
3758
3748
                unlink(feed->feed_filename);
3759
3749
            }
3760
3750
        }
3761
 
        if (!url_exist(feed->feed_filename)) {
 
3751
        if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) {
3762
3752
            AVFormatContext s1 = {0}, *s = &s1;
3763
3753
 
3764
3754
            if (feed->readonly) {
3768
3758
            }
3769
3759
 
3770
3760
            /* only write the header of the ffm file */
3771
 
            if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
 
3761
            if (avio_open(&s->pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) {
3772
3762
                http_log("Could not open output feed file '%s'\n",
3773
3763
                         feed->feed_filename);
3774
3764
                exit(1);