Statistics
| Branch: | Revision:

ffmpeg / libavformat / applehttp.c @ 5f85d49b

History | View | Annotate | Download (20.6 KB)

1
/*
2
 * Apple HTTP Live Streaming demuxer
3
 * Copyright (c) 2010 Martin Storsjo
4
 *
5
 * This file is part of Libav.
6
 *
7
 * Libav is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * Libav is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with Libav; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

    
22
/**
23
 * @file
24
 * Apple HTTP Live Streaming demuxer
25
 * http://tools.ietf.org/html/draft-pantos-http-live-streaming
26
 */
27

    
28
#define _XOPEN_SOURCE 600
29
#include "libavutil/avstring.h"
30
#include "libavutil/intreadwrite.h"
31
#include "libavutil/opt.h"
32
#include "avformat.h"
33
#include "internal.h"
34
#include <unistd.h>
35
#include "avio_internal.h"
36
#include "url.h"
37

    
38
#define INITIAL_BUFFER_SIZE 32768
39

    
40
/*
41
 * An apple http stream consists of a playlist with media segment files,
42
 * played sequentially. There may be several playlists with the same
43
 * video content, in different bandwidth variants, that are played in
44
 * parallel (preferrably only one bandwidth variant at a time). In this case,
45
 * the user supplied the url to a main playlist that only lists the variant
46
 * playlists.
47
 *
48
 * If the main playlist doesn't point at any variants, we still create
49
 * one anonymous toplevel variant for this, to maintain the structure.
50
 */
51

    
52
enum KeyType {
53
    KEY_NONE,
54
    KEY_AES_128,
55
};
56

    
57
struct segment {
58
    int duration;
59
    char url[MAX_URL_SIZE];
60
    char key[MAX_URL_SIZE];
61
    enum KeyType key_type;
62
    uint8_t iv[16];
63
};
64

    
65
/*
66
 * Each variant has its own demuxer. If it currently is active,
67
 * it has an open AVIOContext too, and potentially an AVPacket
68
 * containing the next packet from this stream.
69
 */
70
struct variant {
71
    int bandwidth;
72
    char url[MAX_URL_SIZE];
73
    AVIOContext pb;
74
    uint8_t* read_buffer;
75
    URLContext *input;
76
    AVFormatContext *parent;
77
    int index;
78
    AVFormatContext *ctx;
79
    AVPacket pkt;
80
    int stream_offset;
81

    
82
    int finished;
83
    int target_duration;
84
    int start_seq_no;
85
    int n_segments;
86
    struct segment **segments;
87
    int needed, cur_needed;
88
    int cur_seq_no;
89
    int64_t last_load_time;
90

    
91
    char key_url[MAX_URL_SIZE];
92
    uint8_t key[16];
93
};
94

    
95
typedef struct AppleHTTPContext {
96
    int n_variants;
97
    struct variant **variants;
98
    int cur_seq_no;
99
    int end_of_segment;
100
    int first_packet;
101
} AppleHTTPContext;
102

    
103
static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
104
{
105
    int len = ff_get_line(s, buf, maxlen);
106
    while (len > 0 && isspace(buf[len - 1]))
107
        buf[--len] = '\0';
108
    return len;
109
}
110

    
111
static void free_segment_list(struct variant *var)
112
{
113
    int i;
114
    for (i = 0; i < var->n_segments; i++)
115
        av_free(var->segments[i]);
116
    av_freep(&var->segments);
117
    var->n_segments = 0;
118
}
119

    
120
static void free_variant_list(AppleHTTPContext *c)
121
{
122
    int i;
123
    for (i = 0; i < c->n_variants; i++) {
124
        struct variant *var = c->variants[i];
125
        free_segment_list(var);
126
        av_free_packet(&var->pkt);
127
        av_free(var->pb.buffer);
128
        if (var->input)
129
            ffurl_close(var->input);
130
        if (var->ctx) {
131
            var->ctx->pb = NULL;
132
            av_close_input_file(var->ctx);
133
        }
134
        av_free(var);
135
    }
136
    av_freep(&c->variants);
137
    c->n_variants = 0;
138
}
139

    
140
/*
141
 * Used to reset a statically allocated AVPacket to a clean slate,
142
 * containing no data.
143
 */
144
static void reset_packet(AVPacket *pkt)
145
{
146
    av_init_packet(pkt);
147
    pkt->data = NULL;
148
}
149

    
150
static struct variant *new_variant(AppleHTTPContext *c, int bandwidth,
151
                                   const char *url, const char *base)
152
{
153
    struct variant *var = av_mallocz(sizeof(struct variant));
154
    if (!var)
155
        return NULL;
156
    reset_packet(&var->pkt);
157
    var->bandwidth = bandwidth;
158
    ff_make_absolute_url(var->url, sizeof(var->url), base, url);
159
    dynarray_add(&c->variants, &c->n_variants, var);
160
    return var;
161
}
162

    
163
struct variant_info {
164
    char bandwidth[20];
165
};
166

    
167
static void handle_variant_args(struct variant_info *info, const char *key,
168
                                int key_len, char **dest, int *dest_len)
169
{
170
    if (!strncmp(key, "BANDWIDTH=", key_len)) {
171
        *dest     =        info->bandwidth;
172
        *dest_len = sizeof(info->bandwidth);
173
    }
174
}
175

    
176
struct key_info {
177
     char uri[MAX_URL_SIZE];
178
     char method[10];
179
     char iv[35];
180
};
181

    
182
static void handle_key_args(struct key_info *info, const char *key,
183
                            int key_len, char **dest, int *dest_len)
184
{
185
    if (!strncmp(key, "METHOD=", key_len)) {
186
        *dest     =        info->method;
187
        *dest_len = sizeof(info->method);
188
    } else if (!strncmp(key, "URI=", key_len)) {
189
        *dest     =        info->uri;
190
        *dest_len = sizeof(info->uri);
191
    } else if (!strncmp(key, "IV=", key_len)) {
192
        *dest     =        info->iv;
193
        *dest_len = sizeof(info->iv);
194
    }
195
}
196

    
197
static int parse_playlist(AppleHTTPContext *c, const char *url,
198
                          struct variant *var, AVIOContext *in)
199
{
200
    int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0;
201
    enum KeyType key_type = KEY_NONE;
202
    uint8_t iv[16] = "";
203
    int has_iv = 0;
204
    char key[MAX_URL_SIZE];
205
    char line[1024];
206
    const char *ptr;
207
    int close_in = 0;
208

    
209
    if (!in) {
210
        close_in = 1;
211
        if ((ret = avio_open(&in, url, AVIO_FLAG_READ)) < 0)
212
            return ret;
213
    }
214

    
215
    read_chomp_line(in, line, sizeof(line));
216
    if (strcmp(line, "#EXTM3U")) {
217
        ret = AVERROR_INVALIDDATA;
218
        goto fail;
219
    }
220

    
221
    if (var) {
222
        free_segment_list(var);
223
        var->finished = 0;
224
    }
225
    while (!in->eof_reached) {
226
        read_chomp_line(in, line, sizeof(line));
227
        if (av_strstart(line, "#EXT-X-STREAM-INF:", &ptr)) {
228
            struct variant_info info = {{0}};
229
            is_variant = 1;
230
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_variant_args,
231
                               &info);
232
            bandwidth = atoi(info.bandwidth);
233
        } else if (av_strstart(line, "#EXT-X-KEY:", &ptr)) {
234
            struct key_info info = {{0}};
235
            ff_parse_key_value(ptr, (ff_parse_key_val_cb) handle_key_args,
236
                               &info);
237
            key_type = KEY_NONE;
238
            has_iv = 0;
239
            if (!strcmp(info.method, "AES-128"))
240
                key_type = KEY_AES_128;
241
            if (!strncmp(info.iv, "0x", 2) || !strncmp(info.iv, "0X", 2)) {
242
                ff_hex_to_data(iv, info.iv + 2);
243
                has_iv = 1;
244
            }
245
            av_strlcpy(key, info.uri, sizeof(key));
246
        } else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
247
            if (!var) {
248
                var = new_variant(c, 0, url, NULL);
249
                if (!var) {
250
                    ret = AVERROR(ENOMEM);
251
                    goto fail;
252
                }
253
            }
254
            var->target_duration = atoi(ptr);
255
        } else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
256
            if (!var) {
257
                var = new_variant(c, 0, url, NULL);
258
                if (!var) {
259
                    ret = AVERROR(ENOMEM);
260
                    goto fail;
261
                }
262
            }
263
            var->start_seq_no = atoi(ptr);
264
        } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) {
265
            if (var)
266
                var->finished = 1;
267
        } else if (av_strstart(line, "#EXTINF:", &ptr)) {
268
            is_segment = 1;
269
            duration   = atoi(ptr);
270
        } else if (av_strstart(line, "#", NULL)) {
271
            continue;
272
        } else if (line[0]) {
273
            if (is_variant) {
274
                if (!new_variant(c, bandwidth, line, url)) {
275
                    ret = AVERROR(ENOMEM);
276
                    goto fail;
277
                }
278
                is_variant = 0;
279
                bandwidth  = 0;
280
            }
281
            if (is_segment) {
282
                struct segment *seg;
283
                if (!var) {
284
                    var = new_variant(c, 0, url, NULL);
285
                    if (!var) {
286
                        ret = AVERROR(ENOMEM);
287
                        goto fail;
288
                    }
289
                }
290
                seg = av_malloc(sizeof(struct segment));
291
                if (!seg) {
292
                    ret = AVERROR(ENOMEM);
293
                    goto fail;
294
                }
295
                seg->duration = duration;
296
                seg->key_type = key_type;
297
                if (has_iv) {
298
                    memcpy(seg->iv, iv, sizeof(iv));
299
                } else {
300
                    int seq = var->start_seq_no + var->n_segments;
301
                    memset(seg->iv, 0, sizeof(seg->iv));
302
                    AV_WB32(seg->iv + 12, seq);
303
                }
304
                ff_make_absolute_url(seg->key, sizeof(seg->key), url, key);
305
                ff_make_absolute_url(seg->url, sizeof(seg->url), url, line);
306
                dynarray_add(&var->segments, &var->n_segments, seg);
307
                is_segment = 0;
308
            }
309
        }
310
    }
311
    if (var)
312
        var->last_load_time = av_gettime();
313

    
314
fail:
315
    if (close_in)
316
        avio_close(in);
317
    return ret;
318
}
319

    
320
static int open_input(struct variant *var)
321
{
322
    struct segment *seg = var->segments[var->cur_seq_no - var->start_seq_no];
323
    if (seg->key_type == KEY_NONE) {
324
        return ffurl_open(&var->input, seg->url, AVIO_FLAG_READ);
325
    } else if (seg->key_type == KEY_AES_128) {
326
        char iv[33], key[33], url[MAX_URL_SIZE];
327
        int ret;
328
        if (strcmp(seg->key, var->key_url)) {
329
            URLContext *uc;
330
            if (ffurl_open(&uc, seg->key, AVIO_FLAG_READ) == 0) {
331
                if (ffurl_read_complete(uc, var->key, sizeof(var->key))
332
                    != sizeof(var->key)) {
333
                    av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n",
334
                           seg->key);
335
                }
336
                ffurl_close(uc);
337
            } else {
338
                av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n",
339
                       seg->key);
340
            }
341
            av_strlcpy(var->key_url, seg->key, sizeof(var->key_url));
342
        }
343
        ff_data_to_hex(iv, seg->iv, sizeof(seg->iv), 0);
344
        ff_data_to_hex(key, var->key, sizeof(var->key), 0);
345
        iv[32] = key[32] = '\0';
346
        if (strstr(seg->url, "://"))
347
            snprintf(url, sizeof(url), "crypto+%s", seg->url);
348
        else
349
            snprintf(url, sizeof(url), "crypto:%s", seg->url);
350
        if ((ret = ffurl_alloc(&var->input, url, AVIO_FLAG_READ)) < 0)
351
            return ret;
352
        av_set_string3(var->input->priv_data, "key", key, 0, NULL);
353
        av_set_string3(var->input->priv_data, "iv", iv, 0, NULL);
354
        if ((ret = ffurl_connect(var->input)) < 0) {
355
            ffurl_close(var->input);
356
            var->input = NULL;
357
            return ret;
358
        }
359
        return 0;
360
    }
361
    return AVERROR(ENOSYS);
362
}
363

    
364
static int read_data(void *opaque, uint8_t *buf, int buf_size)
365
{
366
    struct variant *v = opaque;
367
    AppleHTTPContext *c = v->parent->priv_data;
368
    int ret, i;
369

    
370
restart:
371
    if (!v->input) {
372
reload:
373
        /* If this is a live stream and target_duration has elapsed since
374
         * the last playlist reload, reload the variant playlists now. */
375
        if (!v->finished &&
376
            av_gettime() - v->last_load_time >= v->target_duration*1000000 &&
377
            (ret = parse_playlist(c, v->url, v, NULL)) < 0)
378
                return ret;
379
        if (v->cur_seq_no < v->start_seq_no) {
380
            av_log(NULL, AV_LOG_WARNING,
381
                   "skipping %d segments ahead, expired from playlists\n",
382
                   v->start_seq_no - v->cur_seq_no);
383
            v->cur_seq_no = v->start_seq_no;
384
        }
385
        if (v->cur_seq_no >= v->start_seq_no + v->n_segments) {
386
            if (v->finished)
387
                return AVERROR_EOF;
388
            while (av_gettime() - v->last_load_time <
389
                   v->target_duration*1000000) {
390
                if (url_interrupt_cb())
391
                    return AVERROR_EXIT;
392
                usleep(100*1000);
393
            }
394
            /* Enough time has elapsed since the last reload */
395
            goto reload;
396
        }
397

    
398
        ret = open_input(v);
399
        if (ret < 0)
400
            return ret;
401
    }
402
    ret = ffurl_read(v->input, buf, buf_size);
403
    if (ret > 0)
404
        return ret;
405
    if (ret < 0 && ret != AVERROR_EOF)
406
        return ret;
407
    ffurl_close(v->input);
408
    v->input = NULL;
409
    v->cur_seq_no++;
410

    
411
    c->end_of_segment = 1;
412
    c->cur_seq_no = v->cur_seq_no;
413

    
414
    if (v->ctx) {
415
        v->needed = 0;
416
        for (i = v->stream_offset; i < v->stream_offset + v->ctx->nb_streams;
417
             i++) {
418
            if (v->parent->streams[i]->discard < AVDISCARD_ALL)
419
                v->needed = 1;
420
        }
421
    }
422
    if (!v->needed) {
423
        av_log(v->parent, AV_LOG_INFO, "No longer receiving variant %d\n",
424
               v->index);
425
        return AVERROR_EOF;
426
    }
427
    goto restart;
428
}
429

    
430
static int applehttp_read_header(AVFormatContext *s, AVFormatParameters *ap)
431
{
432
    AppleHTTPContext *c = s->priv_data;
433
    int ret = 0, i, j, stream_offset = 0;
434

    
435
    if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0)
436
        goto fail;
437

    
438
    if (c->n_variants == 0) {
439
        av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
440
        ret = AVERROR_EOF;
441
        goto fail;
442
    }
443
    /* If the playlist only contained variants, parse each individual
444
     * variant playlist. */
445
    if (c->n_variants > 1 || c->variants[0]->n_segments == 0) {
446
        for (i = 0; i < c->n_variants; i++) {
447
            struct variant *v = c->variants[i];
448
            if ((ret = parse_playlist(c, v->url, v, NULL)) < 0)
449
                goto fail;
450
        }
451
    }
452

    
453
    if (c->variants[0]->n_segments == 0) {
454
        av_log(NULL, AV_LOG_WARNING, "Empty playlist\n");
455
        ret = AVERROR_EOF;
456
        goto fail;
457
    }
458

    
459
    /* If this isn't a live stream, calculate the total duration of the
460
     * stream. */
461
    if (c->variants[0]->finished) {
462
        int64_t duration = 0;
463
        for (i = 0; i < c->variants[0]->n_segments; i++)
464
            duration += c->variants[0]->segments[i]->duration;
465
        s->duration = duration * AV_TIME_BASE;
466
    }
467

    
468
    /* Open the demuxer for each variant */
469
    for (i = 0; i < c->n_variants; i++) {
470
        struct variant *v = c->variants[i];
471
        AVInputFormat *in_fmt = NULL;
472
        char bitrate_str[20];
473
        if (v->n_segments == 0)
474
            continue;
475

    
476
        v->index  = i;
477
        v->needed = 1;
478
        v->parent = s;
479

    
480
        /* If this is a live stream with more than 3 segments, start at the
481
         * third last segment. */
482
        v->cur_seq_no = v->start_seq_no;
483
        if (!v->finished && v->n_segments > 3)
484
            v->cur_seq_no = v->start_seq_no + v->n_segments - 3;
485

    
486
        v->read_buffer = av_malloc(INITIAL_BUFFER_SIZE);
487
        ffio_init_context(&v->pb, v->read_buffer, INITIAL_BUFFER_SIZE, 0, v,
488
                          read_data, NULL, NULL);
489
        v->pb.seekable = 0;
490
        ret = av_probe_input_buffer(&v->pb, &in_fmt, v->segments[0]->url,
491
                                    NULL, 0, 0);
492
        if (ret < 0)
493
            goto fail;
494
        ret = av_open_input_stream(&v->ctx, &v->pb, v->segments[0]->url,
495
                                   in_fmt, NULL);
496
        if (ret < 0)
497
            goto fail;
498
        v->stream_offset = stream_offset;
499
        snprintf(bitrate_str, sizeof(bitrate_str), "%d", v->bandwidth);
500
        /* Create new AVStreams for each stream in this variant */
501
        for (j = 0; j < v->ctx->nb_streams; j++) {
502
            AVStream *st = av_new_stream(s, i);
503
            if (!st) {
504
                ret = AVERROR(ENOMEM);
505
                goto fail;
506
            }
507
            avcodec_copy_context(st->codec, v->ctx->streams[j]->codec);
508
            if (v->bandwidth)
509
                av_metadata_set2(&st->metadata, "variant_bitrate", bitrate_str,
510
                                 0);
511
        }
512
        stream_offset += v->ctx->nb_streams;
513
    }
514

    
515
    c->first_packet = 1;
516

    
517
    return 0;
518
fail:
519
    free_variant_list(c);
520
    return ret;
521
}
522

    
523
static int recheck_discard_flags(AVFormatContext *s, int first)
524
{
525
    AppleHTTPContext *c = s->priv_data;
526
    int i, changed = 0;
527

    
528
    /* Check if any new streams are needed */
529
    for (i = 0; i < c->n_variants; i++)
530
        c->variants[i]->cur_needed = 0;;
531

    
532
    for (i = 0; i < s->nb_streams; i++) {
533
        AVStream *st = s->streams[i];
534
        struct variant *var = c->variants[s->streams[i]->id];
535
        if (st->discard < AVDISCARD_ALL)
536
            var->cur_needed = 1;
537
    }
538
    for (i = 0; i < c->n_variants; i++) {
539
        struct variant *v = c->variants[i];
540
        if (v->cur_needed && !v->needed) {
541
            v->needed = 1;
542
            changed = 1;
543
            v->cur_seq_no = c->cur_seq_no;
544
            v->pb.eof_reached = 0;
545
            av_log(s, AV_LOG_INFO, "Now receiving variant %d\n", i);
546
        } else if (first && !v->cur_needed && v->needed) {
547
            if (v->input)
548
                ffurl_close(v->input);
549
            v->input = NULL;
550
            v->needed = 0;
551
            changed = 1;
552
            av_log(s, AV_LOG_INFO, "No longer receiving variant %d\n", i);
553
        }
554
    }
555
    return changed;
556
}
557

    
558
static int applehttp_read_packet(AVFormatContext *s, AVPacket *pkt)
559
{
560
    AppleHTTPContext *c = s->priv_data;
561
    int ret, i, minvariant = -1;
562

    
563
    if (c->first_packet) {
564
        recheck_discard_flags(s, 1);
565
        c->first_packet = 0;
566
    }
567

    
568
start:
569
    c->end_of_segment = 0;
570
    for (i = 0; i < c->n_variants; i++) {
571
        struct variant *var = c->variants[i];
572
        /* Make sure we've got one buffered packet from each open variant
573
         * stream */
574
        if (var->needed && !var->pkt.data) {
575
            ret = av_read_frame(var->ctx, &var->pkt);
576
            if (ret < 0) {
577
                if (!var->pb.eof_reached)
578
                    return ret;
579
                reset_packet(&var->pkt);
580
            }
581
        }
582
        /* Check if this stream has the packet with the lowest dts */
583
        if (var->pkt.data) {
584
            if (minvariant < 0 ||
585
                var->pkt.dts < c->variants[minvariant]->pkt.dts)
586
                minvariant = i;
587
        }
588
    }
589
    if (c->end_of_segment) {
590
        if (recheck_discard_flags(s, 0))
591
            goto start;
592
    }
593
    /* If we got a packet, return it */
594
    if (minvariant >= 0) {
595
        *pkt = c->variants[minvariant]->pkt;
596
        pkt->stream_index += c->variants[minvariant]->stream_offset;
597
        reset_packet(&c->variants[minvariant]->pkt);
598
        return 0;
599
    }
600
    return AVERROR_EOF;
601
}
602

    
603
static int applehttp_close(AVFormatContext *s)
604
{
605
    AppleHTTPContext *c = s->priv_data;
606

    
607
    free_variant_list(c);
608
    return 0;
609
}
610

    
611
static int applehttp_read_seek(AVFormatContext *s, int stream_index,
612
                               int64_t timestamp, int flags)
613
{
614
    AppleHTTPContext *c = s->priv_data;
615
    int i, j, ret;
616

    
617
    if ((flags & AVSEEK_FLAG_BYTE) || !c->variants[0]->finished)
618
        return AVERROR(ENOSYS);
619

    
620
    timestamp = av_rescale_rnd(timestamp, 1, stream_index >= 0 ?
621
                               s->streams[stream_index]->time_base.den :
622
                               AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ?
623
                               AV_ROUND_DOWN : AV_ROUND_UP);
624
    ret = AVERROR(EIO);
625
    for (i = 0; i < c->n_variants; i++) {
626
        /* Reset reading */
627
        struct variant *var = c->variants[i];
628
        int64_t pos = 0;
629
        if (var->input) {
630
            ffurl_close(var->input);
631
            var->input = NULL;
632
        }
633
        av_free_packet(&var->pkt);
634
        reset_packet(&var->pkt);
635
        var->pb.eof_reached = 0;
636

    
637
        /* Locate the segment that contains the target timestamp */
638
        for (j = 0; j < var->n_segments; j++) {
639
            if (timestamp >= pos &&
640
                timestamp < pos + var->segments[j]->duration) {
641
                var->cur_seq_no = var->start_seq_no + j;
642
                ret = 0;
643
                break;
644
            }
645
            pos += var->segments[j]->duration;
646
        }
647
    }
648
    return ret;
649
}
650

    
651
static int applehttp_probe(AVProbeData *p)
652
{
653
    /* Require #EXTM3U at the start, and either one of the ones below
654
     * somewhere for a proper match. */
655
    if (strncmp(p->buf, "#EXTM3U", 7))
656
        return 0;
657
    if (strstr(p->buf, "#EXT-X-STREAM-INF:")     ||
658
        strstr(p->buf, "#EXT-X-TARGETDURATION:") ||
659
        strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:"))
660
        return AVPROBE_SCORE_MAX;
661
    return 0;
662
}
663

    
664
AVInputFormat ff_applehttp_demuxer = {
665
    "applehttp",
666
    NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming format"),
667
    sizeof(AppleHTTPContext),
668
    applehttp_probe,
669
    applehttp_read_header,
670
    applehttp_read_packet,
671
    applehttp_close,
672
    applehttp_read_seek,
673
};