X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Fhls.c;h=14f1bf8d449683825d5db601bc35ba90e342a7b0;hb=5d0652916f2f514f077de6592407cd2c4bf3655c;hp=4e38d25678ced70de033d624d6eb517709852d73;hpb=4d8875ec23cf299277a0f028ea2ac99eb6f603c9;p=ffmpeg diff --git a/libavformat/hls.c b/libavformat/hls.c index 4e38d25678c..14f1bf8d449 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -203,7 +203,6 @@ typedef struct HLSContext { int64_t cur_timestamp; AVIOInterruptCB *interrupt_callback; AVDictionary *avio_opts; - int strict_std_compliance; char *allowed_extensions; int max_reload; int http_persistent; @@ -292,7 +291,7 @@ static void free_rendition_list(HLSContext *c) } /* - * Used to reset a statically allocated AVPacket to a clean slate, + * Used to reset a statically allocated AVPacket to a clean state, * containing no data. */ static void reset_packet(AVPacket *pkt) @@ -477,17 +476,23 @@ static struct rendition *new_rendition(HLSContext *c, struct rendition_info *inf * AVC SEI RBSP anyway */ return NULL; - if (type == AVMEDIA_TYPE_UNKNOWN) + if (type == AVMEDIA_TYPE_UNKNOWN) { + av_log(c, AV_LOG_WARNING, "Can't support the type: %s\n", info->type); return NULL; + } /* URI is mandatory for subtitles as per spec */ - if (type == AVMEDIA_TYPE_SUBTITLE && !info->uri[0]) + if (type == AVMEDIA_TYPE_SUBTITLE && !info->uri[0]) { + av_log(c, AV_LOG_ERROR, "The URI tag is REQUIRED for subtitle.\n"); return NULL; + } /* TODO: handle subtitles (each segment has to parsed separately) */ - if (c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) - if (type == AVMEDIA_TYPE_SUBTITLE) + if (c->ctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) + if (type == AVMEDIA_TYPE_SUBTITLE) { + av_log(c, AV_LOG_WARNING, "Can't support the subtitle(uri: %s)\n", info->uri); return NULL; + } rend = av_mallocz(sizeof(struct rendition)); if (!rend) @@ -658,7 +663,7 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, } else if (ret < 0) { if (ret != AVERROR_EOF) av_log(s, AV_LOG_WARNING, - "keepalive request failed for '%s', retrying with new connection: %s\n", + "keepalive request failed for '%s' when opening url, retrying with new connection: %s\n", url, av_err2str(ret)); ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); } @@ -715,7 +720,7 @@ static int parse_playlist(HLSContext *c, const char *url, } else if (ret < 0) { if (ret != AVERROR_EOF) av_log(c->ctx, AV_LOG_WARNING, - "keepalive request failed for '%s', retrying with new connection: %s\n", + "keepalive request failed for '%s' when parsing playlist, retrying with new connection: %s\n", url, av_err2str(ret)); in = NULL; } @@ -1203,12 +1208,12 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg, if (open_url(pls->parent, &pb, seg->key, c->avio_opts, opts, NULL) == 0) { ret = avio_read(pb, pls->key, sizeof(pls->key)); if (ret != sizeof(pls->key)) { - av_log(NULL, AV_LOG_ERROR, "Unable to read key file %s\n", + av_log(pls->parent, AV_LOG_ERROR, "Unable to read key file %s\n", seg->key); } ff_format_io_close(pls->parent, &pb); } else { - av_log(NULL, AV_LOG_ERROR, "Unable to open key file %s\n", + av_log(pls->parent, AV_LOG_ERROR, "Unable to open key file %s\n", seg->key); } av_strlcpy(pls->key_url, seg->key, sizeof(pls->key_url)); @@ -1420,7 +1425,7 @@ reload: reload_interval = v->target_duration / 2; } if (v->cur_seq_no < v->start_seq_no) { - av_log(NULL, AV_LOG_WARNING, + av_log(v->parent, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", v->start_seq_no - v->cur_seq_no); v->cur_seq_no = v->start_seq_no; @@ -1786,7 +1791,6 @@ static int hls_read_header(AVFormatContext *s) c->ctx = s; c->interrupt_callback = &s->interrupt_callback; - c->strict_std_compliance = s->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; @@ -1802,7 +1806,7 @@ static int hls_read_header(AVFormatContext *s) goto fail; if (c->n_variants == 0) { - av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + av_log(s, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } @@ -1817,7 +1821,7 @@ static int hls_read_header(AVFormatContext *s) } if (c->variants[0]->playlists[0]->n_segments == 0) { - av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); + av_log(s, AV_LOG_WARNING, "Empty segment\n"); ret = AVERROR_EOF; goto fail; } @@ -1944,7 +1948,7 @@ static int hls_read_header(AVFormatContext *s) * but for other streams we can rely on our user calling avformat_find_stream_info() * on us if they want to. */ - if (pls->is_id3_timestamped) { + if (pls->is_id3_timestamped || (pls->n_renditions > 0 && pls->renditions[0]->type == AVMEDIA_TYPE_AUDIO)) { ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; @@ -2318,14 +2322,14 @@ static const AVOption hls_options[] = { }; static const AVClass hls_class = { - .class_name = "hls,applehttp", + .class_name = "hls demuxer", .item_name = av_default_item_name, .option = hls_options, .version = LIBAVUTIL_VERSION_INT, }; AVInputFormat ff_hls_demuxer = { - .name = "hls,applehttp", + .name = "hls", .long_name = NULL_IF_CONFIG_SMALL("Apple HTTP Live Streaming"), .priv_class = &hls_class, .priv_data_size = sizeof(HLSContext),