[FFmpeg-cvslog] Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:10:30 2017 -0300| [777d53c793a2f19b9f87d935fcb16f07ceae0dca] | committer: James Almer Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61' * commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61': dashenc: add support for assigning streams to AdaptationSets Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=777d53c793a2f19b9f87d935fcb16f07ceae0dca --- libavformat/dashenc.c | 223 -- 1 file changed, 180 insertions(+), 43 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 089a3e7b01..3719a1ea01 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -25,6 +25,7 @@ #endif #include "libavutil/avassert.h" +#include "libavutil/avutil.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" @@ -50,9 +51,14 @@ typedef struct Segment { int n; } Segment; +typedef struct AdaptationSet { +char id[10]; +enum AVMediaType media_type; +} AdaptationSet; + typedef struct OutputStream { AVFormatContext *ctx; -int ctx_inited; +int ctx_inited, as_idx; uint8_t iobuf[32768]; AVIOContext *out; int packets_written; @@ -71,6 +77,9 @@ typedef struct OutputStream { typedef struct DASHContext { const AVClass *class; /* Class for private options. */ +char *adaptation_sets; +AdaptationSet *as; +int nb_as; int window_size; int extra_window_size; int min_seg_duration; @@ -79,7 +88,7 @@ typedef struct DASHContext { int use_timeline; int single_file; OutputStream *streams; -int has_video, has_audio; +int has_video; int64_t last_duration; int64_t total_duration; char availability_start_time[100]; @@ -170,6 +179,12 @@ static void dash_free(AVFormatContext *s) { DASHContext *c = s->priv_data; int i, j; + +if (c->as) { +av_freep(&c->as); +c->nb_as = 0; +} + if (!c->streams) return; for (i = 0; i < s->nb_streams; i++) { @@ -317,12 +332,167 @@ static void format_date_now(char *buf, int size) } } +static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_index) +{ +DASHContext *c = s->priv_data; +AdaptationSet *as = &c->as[as_index]; +int i; + +avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); +if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && !c->ambiguous_frame_rate) +avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); +avio_printf(out, ">\n"); + +for (i = 0; i < s->nb_streams; i++) { +OutputStream *os = &c->streams[i]; + +if (os->as_idx - 1 != as_index) +continue; + +if (as->media_type == AVMEDIA_TYPE_VIDEO) { +AVStream *st = s->streams[i]; +avio_printf(out, "\t\t\tcodec_str, os->bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height); +if (st->avg_frame_rate.num) +avio_printf(out, " frameRate=\"%d/%d\"", st->avg_frame_rate.num, st->avg_frame_rate.den); +avio_printf(out, ">\n"); +} else { +avio_printf(out, "\t\t\t\n", +i, os->codec_str, os->bandwidth_str, s->streams[i]->codecpar->sample_rate); +avio_printf(out, "\t\t\t\t\n", +s->streams[i]->codecpar->channels); +} +output_segment_list(os, out, c); +avio_printf(out, "\t\t\t\n"); +} +avio_printf(out, "\t\t\n"); + +return 0; +} + +static int add_adaptation_set(AVFormatContext *s, AdaptationSet **as, enum AVMediaType type) +{ +DASHContext *c = s->priv_data; + +void *mem = av_realloc(c->as, sizeof(*c->as) * (c->nb_as + 1)); +if (!mem) +return AVERROR(ENOMEM); +c->as = mem; +++c->nb_as; + +*as = &c->as[c->nb_as - 1]; +memset(*as, 0, sizeof(**as)); +(*as)->media_type = type; + +return 0; +} + +static int parse_adaptation_sets(AVFormatContext *s) +{ +DASHContext *c = s->priv_data; +const char *p = c->adaptation_sets; +enum { new_set, parse_id, parsing_streams } state; +AdaptationSet *as; +int i, n, ret; +enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_UNKNOWN }; + +// default: one AdaptationSet for
[FFmpeg-cvslog] Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:02:44 2017 -0300| [3b9ef13588360b16c22ece7521ebd9b11f9ffb17] | committer: James Almer Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d' * commit '9df9309d233f59d9706444a1e24ac24139f2640d': dashenc: calculate stream bitrate from first segment if not available Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b9ef13588360b16c22ece7521ebd9b11f9ffb17 --- libavformat/dashenc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index ca24015115..089a3e7b01 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -754,6 +754,16 @@ static int dash_flush(AVFormatContext *s, int final, int stream) break; } } + +if (!os->bit_rate) { +// calculate average bitrate of first segment +int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / (os->max_pts - os->start_pts); +if (bitrate >= 0) { +os->bit_rate = bitrate; +snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), + " bandwidth=\"%d\"", os->bit_rate); +} +} add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, start_pos, range_length, index_length); av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path); } == diff --cc libavformat/dashenc.c index ca24015115,21acb9006c..089a3e7b01 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@@ -747,13 -830,20 +747,23 @@@ static int dash_flush(AVFormatContext * find_index_range(s, full_path, start_pos, &index_length); } else { ff_format_io_close(s, &os->out); -ret = ff_rename(temp_path, full_path); -if (ret < 0) -break; + +if (use_rename) { +ret = avpriv_io_move(temp_path, full_path); +if (ret < 0) +break; +} } + + if (!os->bit_rate) { + // calculate average bitrate of first segment + int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / (os->max_pts - os->start_pts); + if (bitrate >= 0) { + os->bit_rate = bitrate; + snprintf(os->bandwidth_str, sizeof(os->bandwidth_str), + " bandwidth=\"%d\"", os->bit_rate); + } + } add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, start_pos, range_length, index_length); av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:11:02 2017 -0300| [c0fae3ff902e772d1c98a192d982893b2e8f1105] | committer: James Almer Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99' * commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99': dashenc: allow assigning all streams of a media type to an AdaptationSet Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0fae3ff902e772d1c98a192d982893b2e8f1105 --- libavformat/dashenc.c | 61 +-- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 3719a1ea01..7b0f6714a8 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -388,6 +388,24 @@ static int add_adaptation_set(AVFormatContext *s, AdaptationSet **as, enum AVMed return 0; } +static int adaptation_set_add_stream(AVFormatContext *s, int as_idx, int i) +{ +DASHContext *c = s->priv_data; +AdaptationSet *as = &c->as[as_idx - 1]; +OutputStream *os = &c->streams[i]; + +if (as->media_type != s->streams[i]->codecpar->codec_type) { +av_log(s, AV_LOG_ERROR, "Codec type of stream %d doesn't match AdaptationSet's media type\n", i); +return AVERROR(EINVAL); +} else if (os->as_idx) { +av_log(s, AV_LOG_ERROR, "Stream %d is already assigned to an AdaptationSet\n", i); +return AVERROR(EINVAL); +} +os->as_idx = as_idx; + +return 0; +} + static int parse_adaptation_sets(AVFormatContext *s) { DASHContext *c = s->priv_data; @@ -441,30 +459,41 @@ static int parse_adaptation_sets(AVFormatContext *s) state = parsing_streams; } else if (state == parsing_streams) { AdaptationSet *as = &c->as[c->nb_as - 1]; -OutputStream *os; char idx_str[8], *end_str; n = strcspn(p, " ,"); snprintf(idx_str, sizeof(idx_str), "%.*s", n, p); p += n; -i = strtol(idx_str, &end_str, 10); -if (idx_str == end_str || i < 0 || i >= s->nb_streams) { -av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not found!\n", idx_str); -return AVERROR(EINVAL); -} +// if value is "a" or "v", map all streams of that type +if (as->media_type == AVMEDIA_TYPE_UNKNOWN && (idx_str[0] == 'v' || idx_str[0] == 'a')) { +enum AVMediaType type = (idx_str[0] == 'v') ? AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO; +av_log(s, AV_LOG_DEBUG, "Map all streams of type %s\n", idx_str); -os = &c->streams[i]; -if (as->media_type == AVMEDIA_TYPE_UNKNOWN) { -as->media_type = s->streams[i]->codecpar->codec_type; -} else if (as->media_type != s->streams[i]->codecpar->codec_type) { -av_log(s, AV_LOG_ERROR, "Mixing codec types within an AdaptationSet is not allowed\n"); -return AVERROR(EINVAL); -} else if (os->as_idx) { -av_log(s, AV_LOG_ERROR, "Assigning a stream to more than one AdaptationSet is not allowed\n"); -return AVERROR(EINVAL); +for (i = 0; i < s->nb_streams; i++) { +if (s->streams[i]->codecpar->codec_type != type) +continue; + +as->media_type = s->streams[i]->codecpar->codec_type; + +if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0) +return ret; +} +} else { // select single stream +i = strtol(idx_str, &end_str, 10); +if (idx_str == end_str || i < 0 || i >= s->nb_streams) { +av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not found!\n", idx_str); +return AVERROR(EINVAL); +} +av_log(s, AV_LOG_DEBUG, "Map stream %d\n", i); + +if (as->media_type == AVMEDIA_TYPE_UNKNOWN) { +as->media_type = s->streams[i]->codecpar->codec_type; +} + +if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0) +return ret; } -os->as_idx = c->nb_as; if (*p == ' ') state = new_set; == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:11:50 2017 -0300| [5c9373385d1a1d940b84f71fb583dc5519b17b8a] | committer: James Almer Merge commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e' * commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e': dashenc: copy language and role metadata from streams assigned to sets Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c9373385d1a1d940b84f71fb583dc5519b17b8a --- libavformat/dashenc.c | 24 1 file changed, 24 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 5a966fe3ad..ab6bf21dbd 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -54,6 +54,7 @@ typedef struct Segment { typedef struct AdaptationSet { char id[10]; enum AVMediaType media_type; +AVDictionary *metadata; } AdaptationSet; typedef struct OutputStream { @@ -181,6 +182,8 @@ static void dash_free(AVFormatContext *s) int i, j; if (c->as) { +for (i = 0; i < c->nb_as; i++) +av_dict_free(&c->as[i].metadata); av_freep(&c->as); c->nb_as = 0; } @@ -336,14 +339,22 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind { DASHContext *c = s->priv_data; AdaptationSet *as = &c->as[as_index]; +AVDictionaryEntry *lang, *role; int i; avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && !c->ambiguous_frame_rate) avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); +lang = av_dict_get(as->metadata, "language", NULL, 0); +if (lang) +avio_printf(out, " lang=\"%s\"", lang->value); avio_printf(out, ">\n"); +role = av_dict_get(as->metadata, "role", NULL, 0); +if (role) +avio_printf(out, "\t\t\t\n", role->value); + for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; @@ -596,6 +607,14 @@ static int write_manifest(AVFormatContext *s, int final) return 0; } +static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const char *key) +{ +AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0); +if (entry) +av_dict_set(dst, key, entry->value, AV_DICT_DONT_OVERWRITE); +return 0; +} + static int dash_init(AVFormatContext *s) { DASHContext *c = s->priv_data; @@ -637,6 +656,7 @@ static int dash_init(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; +AdaptationSet *as = &c->as[os->as_idx - 1]; AVFormatContext *ctx; AVStream *st; AVDictionary *opts = NULL; @@ -654,6 +674,10 @@ static int dash_init(AVFormatContext *s) return AVERROR(EINVAL); } +// copy AdaptationSet language and role from stream metadata +dict_copy_entry(&as->metadata, s->streams[i]->metadata, "language"); +dict_copy_entry(&as->metadata, s->streams[i]->metadata, "role"); + ctx = avformat_alloc_context(); if (!ctx) return AVERROR(ENOMEM); == diff --cc libavformat/dashenc.c index 5a966fe3ad,8b70278b39..ab6bf21dbd --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@@ -340,10 -462,15 +344,17 @@@ static int write_adaptation_set(AVForma avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); +if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && !c->ambiguous_frame_rate) +avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, c->max_frame_rate.den); + lang = av_dict_get(as->metadata, "language", NULL, 0); + if (lang) + avio_printf(out, " lang=\"%s\"", lang->value); avio_printf(out, ">\n"); + role = av_dict_get(as->metadata, "role", NULL, 0); + if (role) + avio_printf(out, "\t\t\t\n", role->value); + for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; @@@ -589,14 -706,18 +600,22 @@@ static int write_manifest(AVFormatConte avio_printf(out, "\n"); avio_flush(
[FFmpeg-cvslog] Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:11:25 2017 -0300| [3f7a8bb67b27bd3c32f3932096033a1787405601] | committer: James Almer Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115' * commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115': dashenc: default to one AdaptationSet per stream Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f7a8bb67b27bd3c32f3932096033a1787405601 --- libavformat/dashenc.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 7b0f6714a8..5a966fe3ad 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -413,26 +413,15 @@ static int parse_adaptation_sets(AVFormatContext *s) enum { new_set, parse_id, parsing_streams } state; AdaptationSet *as; int i, n, ret; -enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, AVMEDIA_TYPE_UNKNOWN }; -// default: one AdaptationSet for each media type +// default: one AdaptationSet for each stream if (!p) { -for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) { -int as_idx = 0; - -for (i = 0; i < s->nb_streams; i++) { -if (s->streams[i]->codecpar->codec_type != types[n]) -continue; - -if (!as_idx) { -if ((ret = add_adaptation_set(s, &as, types[n])) < 0) -return ret; -as_idx = c->nb_as; +for (i = 0; i < s->nb_streams; i++) { +if ((ret = add_adaptation_set(s, &as, s->streams[i]->codecpar->codec_type)) < 0) +return ret; +snprintf(as->id, sizeof(as->id), "%d", i); -snprintf(as->id, sizeof(as->id), "%d", i); -} -c->streams[i].as_idx = as_idx; -} +c->streams[i].as_idx = c->nb_as; } goto end; } == ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:12:19 2017 -0300| [a9f51d19d6b58f9e75451d891a85a3617ab1fa56] | committer: James Almer Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7' * commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7': dashenc: use avio_dynbuf instead of packet_write callback Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9f51d19d6b58f9e75451d891a85a3617ab1fa56 --- libavformat/dashenc.c | 61 +++ 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index ab6bf21dbd..bde938f587 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -60,11 +60,10 @@ typedef struct AdaptationSet { typedef struct OutputStream { AVFormatContext *ctx; int ctx_inited, as_idx; -uint8_t iobuf[32768]; AVIOContext *out; int packets_written; char initfile[1024]; -int64_t init_start_pos; +int64_t init_start_pos, pos; int init_range_length; int nb_segments, segments_size, segment_index; Segment **segments; @@ -102,14 +101,6 @@ typedef struct DASHContext { const char *utc_timing_url; } DASHContext; -static int dash_write(void *opaque, uint8_t *buf, int buf_size) -{ -OutputStream *os = opaque; -if (os->out) -avio_write(os->out, buf, buf_size); -return buf_size; -} - // RFC 6381 static void set_codec_str(AVFormatContext *s, AVCodecParameters *par, char *str, int size) @@ -176,6 +167,28 @@ static void set_codec_str(AVFormatContext *s, AVCodecParameters *par, } } +static int flush_dynbuf(OutputStream *os, int *range_length) +{ +uint8_t *buffer; + +if (!os->ctx->pb) { +return AVERROR(EINVAL); +} + +// flush +av_write_frame(os->ctx, NULL); +avio_flush(os->ctx->pb); + +// write out to file +*range_length = avio_close_dyn_buf(os->ctx->pb, &buffer); +os->ctx->pb = NULL; +avio_write(os->out, buffer, *range_length); +av_free(buffer); + +// re-open buffer +return avio_open_dyn_buf(&os->ctx->pb); +} + static void dash_free(AVFormatContext *s) { DASHContext *c = s->priv_data; @@ -195,7 +208,7 @@ static void dash_free(AVFormatContext *s) if (os->ctx && os->ctx_inited) av_write_trailer(os->ctx); if (os->ctx && os->ctx->pb) -av_free(os->ctx->pb); +ffio_free_dyn_buf(&os->ctx->pb); ff_format_io_close(s, &os->out); if (os->ctx) avformat_free_context(os->ctx); @@ -696,9 +709,8 @@ static int dash_init(AVFormatContext *s) ctx->avoid_negative_ts = s->avoid_negative_ts; ctx->flags = s->flags; -ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, dash_write, NULL); -if (!ctx->pb) -return AVERROR(ENOMEM); +if ((ret = avio_open_dyn_buf(&ctx->pb)) < 0) +return ret; if (c->single_file) { if (c->single_file_name) @@ -877,7 +889,6 @@ static int dash_flush(AVFormatContext *s, int final, int stream) for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; char filename[1024] = "", full_path[1024], temp_path[1024]; -int64_t start_pos; int range_length, index_length = 0; if (!os->packets_written) @@ -896,14 +907,14 @@ static int dash_flush(AVFormatContext *s, int final, int stream) } if (!os->init_range_length) { -av_write_frame(os->ctx, NULL); -os->init_range_length = avio_tell(os->ctx->pb); +ret = flush_dynbuf(os, &range_length); +if (ret < 0) +break; +os->pos = os->init_range_length = range_length; if (!c->single_file) ff_format_io_close(s, &os->out); } -start_pos = avio_tell(os->ctx->pb); - if (!c->single_file) { ff_dash_fill_tmpl_params(filename, sizeof(filename), c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts); snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, filename); @@ -916,13 +927,13 @@ static int dash_flush(AVFormatContext *s, int final, int stream) snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, os->initfile); } -av_write_frame(os->ctx, NULL); -avio_flush(os->ctx->pb); +ret = flush_dynbuf(os, &range_length); +if (ret < 0) +break; os->packets_written = 0; -range_length = avio_tell(os->ctx-&
[FFmpeg-cvslog] Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:13:09 2017 -0300| [1b8ef01f04ab2210a26b59d3a1a62daed52ce88a] | committer: James Almer Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad' * commit '7295b7373862ee54903b33d6ef3335531dfa93ad': dashenc: add webm support Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b8ef01f04ab2210a26b59d3a1a62daed52ce88a --- libavformat/dashenc.c | 101 -- libavformat/version.h | 2 +- 2 files changed, 82 insertions(+), 21 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index bde938f587..240ff41380 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -61,6 +61,7 @@ typedef struct OutputStream { AVFormatContext *ctx; int ctx_inited, as_idx; AVIOContext *out; +char format_name[8]; int packets_written; char initfile[1024]; int64_t init_start_pos, pos; @@ -101,12 +102,32 @@ typedef struct DASHContext { const char *utc_timing_url; } DASHContext; -// RFC 6381 +static struct codec_string { +int id; +const char *str; +} codecs[] = { +{ AV_CODEC_ID_VP8, "vp8" }, +{ AV_CODEC_ID_VP9, "vp9" }, +{ AV_CODEC_ID_VORBIS, "vorbis" }, +{ AV_CODEC_ID_OPUS, "opus" }, +{ 0, NULL } +}; + static void set_codec_str(AVFormatContext *s, AVCodecParameters *par, char *str, int size) { const AVCodecTag *tags[2] = { NULL, NULL }; uint32_t tag; +int i; + +// common Webm codecs are not part of RFC 6381 +for (i = 0; codecs[i].id; i++) +if (codecs[i].id == par->codec_id) { +av_strlcpy(str, codecs[i].str, size); +return; +} + +// for codecs part of RFC 6381 if (par->codec_type == AVMEDIA_TYPE_VIDEO) tags[0] = ff_codec_movvideo_tags; else if (par->codec_type == AVMEDIA_TYPE_AUDIO) @@ -189,6 +210,21 @@ static int flush_dynbuf(OutputStream *os, int *range_length) return avio_open_dyn_buf(&os->ctx->pb); } +static int flush_init_segment(AVFormatContext *s, OutputStream *os) +{ +DASHContext *c = s->priv_data; +int ret, range_length; + +ret = flush_dynbuf(os, &range_length); +if (ret < 0) +return ret; + +os->pos = os->init_range_length = range_length; +if (!c->single_file) +ff_format_io_close(s, &os->out); +return 0; +} + static void dash_free(AVFormatContext *s) { DASHContext *c = s->priv_data; @@ -376,14 +412,14 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind if (as->media_type == AVMEDIA_TYPE_VIDEO) { AVStream *st = s->streams[i]; -avio_printf(out, "\t\t\tcodec_str, os->bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height); +avio_printf(out, "\t\t\tformat_name, os->codec_str, os->bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height); if (st->avg_frame_rate.num) avio_printf(out, " frameRate=\"%d/%d\"", st->avg_frame_rate.num, st->avg_frame_rate.den); avio_printf(out, ">\n"); } else { -avio_printf(out, "\t\t\t\n", -i, os->codec_str, os->bandwidth_str, s->streams[i]->codecpar->sample_rate); +avio_printf(out, "\t\t\t\n", +i, os->format_name, os->codec_str, os->bandwidth_str, s->streams[i]->codecpar->sample_rate); avio_printf(out, "\t\t\t\t\n", s->streams[i]->codecpar->channels); } @@ -628,11 +664,18 @@ static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const ch return 0; } +static int dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags) +{ +char valuestr[22]; +snprintf(valuestr, sizeof(valuestr), "%"PRId64, value); +flags &= ~AV_DICT_DONT_STRDUP_VAL; +return av_dict_set(pm, key, valuestr, flags); +} + static int dash_init(AVFormatContext *s) { DASHContext *c = s->priv_data; int ret = 0, i; -AVOutputFormat *oformat; char *ptr; char basename[1024]; @@ -656,10 +699,6 @@ static int dash_init(AVFormatContext *s) if (ptr) *ptr = '\0'; -oformat = av_guess_format("mp4", NULL, NULL); -if (!oformat) -return AVERROR_MUXER_NOT_FOUND; - c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); if (!c->streams) return AVERROR(ENOMEM); @@ -694,8 +733,22 @@ static int dash_init(AVFormatContext *s) ctx = avformat_alloc_context(); if (!ctx) return AVE
[FFmpeg-cvslog] Merge commit 'c5c663541739cb813a2a5668ee8339b535b35d7d'
ffmpeg | branch: master | Rodger Combs | Tue Sep 26 14:13:54 2017 -0300| [3eb1d05ef719cbb0793f6bd82d7227f9093f6fc3] | committer: James Almer Merge commit 'c5c663541739cb813a2a5668ee8339b535b35d7d' * commit 'c5c663541739cb813a2a5668ee8339b535b35d7d': doc: add dash muxer Merged-by: Rodger Combs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3eb1d05ef719cbb0793f6bd82d7227f9093f6fc3 --- doc/muxers.texi | 62 + 1 file changed, 62 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 36769b8c1a..38d93919e7 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -194,6 +194,68 @@ Used to facilitate seeking; particularly for HTTP pseudo streaming. @end table @end table +@anchor{dash} +@section dash + +Dynamic Adaptive Streaming over HTTP (DASH) muxer that creates segments +and manifest files according to the MPEG-DASH standard ISO/IEC 23009-1:2014. + +For more information see: + +@itemize @bullet +@item +ISO DASH Specification: @url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip} +@item +WebM DASH Specification: @url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification} +@end itemize + +It creates a MPD manifest file and segment files for each stream. + +The segment filename might contain pre-defined identifiers used with SegmentTemplate +as defined in section 5.3.9.4.4 of the standard. Available identifiers are "$RepresentationID$", +"$Number$", "$Bandwidth$" and "$Time$". + +@example +ffmpeg -re -i -map 0 -map 0 -c:a libfdk_aac -c:v libx264 +-b:v:0 800k -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline +-profile:v:0 main -bf 1 -keyint_min 120 -g 120 -sc_threshold 0 +-b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 +-window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a" +-f dash /path/to/out.mpd +@end example + +@table @option +@item -min_seg_duration @var{microseconds} +Set the segment length in microseconds. +@item -window_size @var{size} +Set the maximum number of segments kept in the manifest. +@item -extra_window_size @var{size} +Set the maximum number of segments kept outside of the manifest before removing from disk. +@item -remove_at_exit @var{remove} +Enable (1) or disable (0) removal of all segments when finished. +@item -use_template @var{template} +Enable (1) or disable (0) use of SegmentTemplate instead of SegmentList. +@item -use_timeline @var{timeline} +Enable (1) or disable (0) use of SegmentTimeline in SegmentTemplate. +@item -single_file @var{single_file} +Enable (1) or disable (0) storing all segments in one file, accessed using byte ranges. +@item -single_file_name @var{file_name} +DASH-templated name to be used for baseURL. Implies @var{single_file} set to "1". +@item -init_seg_name @var{init_name} +DASH-templated name to used for the initialization segment. Default is "init-stream$RepresentationID$.m4s" +@item -media_seg_name @var{segment_name} +DASH-templated name to used for the media segments. Default is "chunk-stream$RepresentationID$-$Number%05d$.m4s" +@item -utc_timing_url @var{utc_url} +URL of the page that will return the UTC timestamp in ISO format. Example: "https://time.akamai.com/?iso"; +@item -adaptation_sets @var{adaptation_sets} +Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c id=y,streams=d,e" with x and y being the IDs +of the adaptation sets and a,b,c,d and e are the indices of the mapped streams. + +To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be used as stream identifier instead of IDs. + +When no assignment is defined, this defaults to an AdaptationSet for each stream. +@end table + @anchor{framecrc} @section framecrc == diff --cc doc/muxers.texi index 36769b8c1a,62cd8d025b..38d93919e7 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@@ -160,40 -48,73 +160,102 @@@ specifying the audio and video codec an compute the CRC of the input audio converted to PCM unsigned 8-bit and the input video converted to MPEG-2 video, use the command: @example -avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc - +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc - @end example -See also the @ref{framecrc} muxer. +@section flv + +Adobe Flash Video Format muxer. + +This muxer accepts the following options: + +@table @option + +@item flvflags @var{flags} +Possible values: + +@table @samp + +@item aac_seq_header_detect +Place AAC sequence header based on audio stream data. + +@item no_sequence_end +Disable sequence end tag. + +@item no_metadata +Disable metadata tag. + +@item no_duration_filesize +Disable duration and filesize in metadata when they are equal to zero +at the end of stre
[FFmpeg-cvslog] lavf/tls_securetransport: handle incomplete reads gracefully
ffmpeg | branch: master | Rodger Combs | Mon Nov 13 14:46:17 2017 -0600| [a36a3d7fecdfc50691f01eef984cad6cedb6fb3a] | committer: Rodger Combs lavf/tls_securetransport: handle incomplete reads gracefully Signed-off-by: Aman Gupta > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a36a3d7fecdfc50691f01eef984cad6cedb6fb3a --- libavformat/tls_securetransport.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c index b862e0003a..dc32eb1fa8 100644 --- a/libavformat/tls_securetransport.c +++ b/libavformat/tls_securetransport.c @@ -54,7 +54,7 @@ static int print_tls_error(URLContext *h, int ret) TLSContext *c = h->priv_data; switch (ret) { case errSSLWouldBlock: -break; +return AVERROR(EAGAIN); case errSSLXCertChainInvalid: av_log(h, AV_LOG_ERROR, "Invalid certificate chain\n"); return AVERROR(EIO); @@ -197,7 +197,8 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, void *data, size_t *dat { URLContext *h = (URLContext*)connection; TLSContext *c = h->priv_data; -int read = ffurl_read_complete(c->tls_shared.tcp, data, *dataLength); +size_t requested = *dataLength; +int read = ffurl_read(c->tls_shared.tcp, data, requested); if (read <= 0) { *dataLength = 0; switch(AVUNERROR(read)) { @@ -214,7 +215,10 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, void *data, size_t *dat } } else { *dataLength = read; -return noErr; +if (read < requested) +return errSSLWouldBlock; +else +return noErr; } } @@ -326,12 +330,13 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op if (peerTrust) CFRelease(peerTrust); } -if (status == noErr) +if (status == noErr) { break; - -av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session: %i\n", (int)status); -ret = AVERROR(EIO); -goto fail; +} else if (status != errSSLWouldBlock) { +av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session: %i\n", (int)status); +ret = AVERROR(EIO); +goto fail; +} } return 0; @@ -348,6 +353,9 @@ static int map_ssl_error(OSStatus status, size_t processed) case errSSLClosedGraceful: case errSSLClosedNoNotify: return 0; +case errSSLWouldBlock: +if (processed > 0) +return processed; default: return (int)status; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/hwcontext_opencl.h: fix build on macOS
ffmpeg | branch: master | Rodger Combs | Mon Nov 27 23:38:46 2017 -0600| [1204ce0b6371f5b51efdfe84d1b5aa5925809186] | committer: Rodger Combs lavu/hwcontext_opencl.h: fix build on macOS > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1204ce0b6371f5b51efdfe84d1b5aa5925809186 --- libavutil/hwcontext_opencl.h | 4 1 file changed, 4 insertions(+) diff --git a/libavutil/hwcontext_opencl.h b/libavutil/hwcontext_opencl.h index 8e34df44cd..ef54486c95 100644 --- a/libavutil/hwcontext_opencl.h +++ b/libavutil/hwcontext_opencl.h @@ -19,7 +19,11 @@ #ifndef AVUTIL_HWCONTEXT_OPENCL_H #define AVUTIL_HWCONTEXT_OPENCL_H +#ifdef __APPLE__ +#include +#else #include +#endif #include "frame.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mpegts: mark packets with TEI flag as corrupted
ffmpeg | branch: master | Rodger Combs | Thu Oct 19 01:58:10 2017 -0500| [2e391a576c1fc2e8816990924c6e4c21ccf75a82] | committer: Rodger Combs lavf/mpegts: mark packets with TEI flag as corrupted > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e391a576c1fc2e8816990924c6e4c21ccf75a82 --- libavformat/mpegts.c | 8 1 file changed, 8 insertions(+) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 53cbcfb543..0a3ad05726 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -2296,6 +2296,14 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet) } } +if (packet[1] & 0x80) { +av_log(ts->stream, AV_LOG_DEBUG, "Packet had TEI flag set; marking as corrupt\n"); +if (tss->type == MPEGTS_PES) { +PESContext *pc = tss->u.pes_filter.opaque; +pc->flags |= AV_PKT_FLAG_CORRUPT; +} +} + p = packet + 4; if (has_adaptation) { int64_t pcr_h; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/libx265: support all color parameters that x265 does
ffmpeg | branch: master | Rodger Combs | Mon Dec 18 06:18:57 2017 -0600| [1eb7c1d49d67fe0f21c71fb87d6c1fa8542f8cef] | committer: Rodger Combs lavc/libx265: support all color parameters that x265 does > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1eb7c1d49d67fe0f21c71fb87d6c1fa8542f8cef --- libavcodec/libx265.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 52ad2312a3..3c97800ccb 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -115,11 +115,11 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ctx->params->sourceHeight= avctx->height; ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); -if ((avctx->color_primaries <= AVCOL_PRI_BT2020 && +if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || -(avctx->color_trc <= AVCOL_TRC_BT2020_12 && +(avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && avctx->color_trc != AVCOL_TRC_UNSPECIFIED) || -(avctx->colorspace <= AVCOL_SPC_BT2020_CL && +(avctx->colorspace <= AVCOL_SPC_ICTCP && avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) { ctx->params->vui.bEnableVideoSignalTypePresentFlag = 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/vf_scale_vaapi: set output SAR
ffmpeg | branch: master | Rodger Combs | Fri Jan 12 19:08:27 2018 -0600| [381a4820c64ba2d1b3ddc3a50147961f1d8c5848] | committer: Rodger Combs lavfi/vf_scale_vaapi: set output SAR > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=381a4820c64ba2d1b3ddc3a50147961f1d8c5848 --- libavfilter/vf_scale_vaapi.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c index 22e928c098..4bead5aaf4 100644 --- a/libavfilter/vf_scale_vaapi.c +++ b/libavfilter/vf_scale_vaapi.c @@ -240,6 +240,11 @@ static int scale_vaapi_config_output(AVFilterLink *outlink) goto fail; } +if (inlink->sample_aspect_ratio.num) +outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio); +else +outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; + av_freep(&hwconfig); av_hwframe_constraints_free(&constraints); return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64/sbrdsp_neon: fix build on old binutils
ffmpeg | branch: master | Rodger Combs | Thu Jan 25 20:53:59 2018 -0600| [77237504757b97c068796a4e9ef81b9653618616] | committer: Rodger Combs lavc/aarch64/sbrdsp_neon: fix build on old binutils > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77237504757b97c068796a4e9ef81b9653618616 --- libavcodec/aarch64/sbrdsp_neon.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aarch64/sbrdsp_neon.S b/libavcodec/aarch64/sbrdsp_neon.S index d1d79b749c..d23717e760 100644 --- a/libavcodec/aarch64/sbrdsp_neon.S +++ b/libavcodec/aarch64/sbrdsp_neon.S @@ -287,7 +287,7 @@ endfunc zip1v4.4S, v4.4S, v4.4S fmlav6.4S, v1.4S, v3.4S fmlav2.4S, v5.4S, v4.4S -fcmeq v7.4S, v3.4S, #0.0 +fcmeq v7.4S, v3.4S, #0 bif v2.16B, v6.16B, v7.16B st1 {v2.4S}, [x0], #16 subsx5, x5, #2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/aarch64/sbrdsp_neon: fix build on old binutils
ffmpeg | branch: release/3.4 | Rodger Combs | Thu Jan 25 20:53:59 2018 -0600| [ad85d9af13dbca29e4377a53c957ed97b8442fdd] | committer: James Almer lavc/aarch64/sbrdsp_neon: fix build on old binutils (cherry picked from commit 77237504757b97c068796a4e9ef81b9653618616) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ad85d9af13dbca29e4377a53c957ed97b8442fdd --- libavcodec/aarch64/sbrdsp_neon.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aarch64/sbrdsp_neon.S b/libavcodec/aarch64/sbrdsp_neon.S index d1d79b749c..d23717e760 100644 --- a/libavcodec/aarch64/sbrdsp_neon.S +++ b/libavcodec/aarch64/sbrdsp_neon.S @@ -287,7 +287,7 @@ endfunc zip1v4.4S, v4.4S, v4.4S fmlav6.4S, v1.4S, v3.4S fmlav2.4S, v5.4S, v4.4S -fcmeq v7.4S, v3.4S, #0.0 +fcmeq v7.4S, v3.4S, #0 bif v2.16B, v6.16B, v7.16B st1 {v2.4S}, [x0], #16 subsx5, x5, #2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavfi/vf_transpose: fix regression with semiplanar formats
ffmpeg | branch: master | Rodger Combs | Wed Feb 21 22:01:51 2018 -0600| [0419623cdca948cdd1fa3f9269e14881385a6796] | committer: Rodger Combs lavfi/vf_transpose: fix regression with semiplanar formats (e.g. nv12) Regression since 7b19e76aeb0ace57b99aaef156bbfe592e43e65e > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0419623cdca948cdd1fa3f9269e14881385a6796 --- libavfilter/vf_transpose.c | 50 +++-- tests/ref/fate/filter-pixfmts-transpose | 8 +++--- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c index 3ff4cb4249..74a4bbcf58 100644 --- a/libavfilter/vf_transpose.c +++ b/libavfilter/vf_transpose.c @@ -52,6 +52,14 @@ enum TransposeDir { TRANSPOSE_CLOCK_FLIP, }; +typedef struct TransVtable { +void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, + uint8_t *dst, ptrdiff_t dst_linesize); +void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize, +uint8_t *dst, ptrdiff_t dst_linesize, +int w, int h); +} TransVtable; + typedef struct TransContext { const AVClass *class; int hsub, vsub; @@ -61,11 +69,7 @@ typedef struct TransContext { int passthrough;///< PassthroughType, landscape passthrough mode enabled int dir;///< TransposeDir -void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, - uint8_t *dst, ptrdiff_t dst_linesize); -void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize, -uint8_t *dst, ptrdiff_t dst_linesize, -int w, int h); +TransVtable vtables[4]; } TransContext; static int query_formats(AVFilterContext *ctx) @@ -233,19 +237,22 @@ static int config_props_output(AVFilterLink *outlink) else outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; -switch (s->pixsteps[0]) { -case 1: s->transpose_block = transpose_block_8_c; -s->transpose_8x8 = transpose_8x8_8_c; break; -case 2: s->transpose_block = transpose_block_16_c; -s->transpose_8x8 = transpose_8x8_16_c; break; -case 3: s->transpose_block = transpose_block_24_c; -s->transpose_8x8 = transpose_8x8_24_c; break; -case 4: s->transpose_block = transpose_block_32_c; -s->transpose_8x8 = transpose_8x8_32_c; break; -case 6: s->transpose_block = transpose_block_48_c; -s->transpose_8x8 = transpose_8x8_48_c; break; -case 8: s->transpose_block = transpose_block_64_c; -s->transpose_8x8 = transpose_8x8_64_c; break; +for (int i = 0; i < 4; i++) { +TransVtable *v = &s->vtables[i]; +switch (s->pixsteps[i]) { +case 1: v->transpose_block = transpose_block_8_c; +v->transpose_8x8 = transpose_8x8_8_c; break; +case 2: v->transpose_block = transpose_block_16_c; +v->transpose_8x8 = transpose_8x8_16_c; break; +case 3: v->transpose_block = transpose_block_24_c; +v->transpose_8x8 = transpose_8x8_24_c; break; +case 4: v->transpose_block = transpose_block_32_c; +v->transpose_8x8 = transpose_8x8_32_c; break; +case 6: v->transpose_block = transpose_block_48_c; +v->transpose_8x8 = transpose_8x8_48_c; break; +case 8: v->transpose_block = transpose_block_64_c; +v->transpose_8x8 = transpose_8x8_64_c; break; +} } av_log(ctx, AV_LOG_VERBOSE, @@ -290,6 +297,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, uint8_t *dst, *src; int dstlinesize, srclinesize; int x, y; +TransVtable *v = &s->vtables[plane]; dstlinesize = out->linesize[plane]; dst = out->data[plane] + start * dstlinesize; @@ -308,20 +316,20 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, for (y = start; y < end - 7; y += 8) { for (x = 0; x < outw - 7; x += 8) { -s->transpose_8x8(src + x * srclinesize + y * pixstep, +v->transpose_8x8(src + x * srclinesize + y * pixstep, srclinesize, dst + (y - start) * dstlinesize + x * pixstep, dstlinesize); } if (outw - x > 0 && end - y > 0) -s->transpose_block(src + x * srclinesize + y * pixstep, +v->transpose_block(src + x * srclinesize + y * pixstep, srclinesize, dst + (y - start) * dstlinesize + x * pixstep,
[FFmpeg-cvslog] lavc/videotoolbox: fix threaded decoding
ffmpeg | branch: master | Rodger Combs | Fri Feb 2 20:50:13 2018 -0600| [63d875772d265a885808532889f094f80afaac7a] | committer: Aman Gupta lavc/videotoolbox: fix threaded decoding AVHWAccel.end_frame can run on a worker thread. The assumption of the frame threading code is that the worker thread will change the AVFrame image data, not the AVFrame fields. So the AVFrame fields are not synced back to the main thread. But this breaks videotoolbox due to its special requirements (everything else is fine). It actually wants to update AVFrame fields. The actual videotoolbox frame is now stored in the dummy AVBufferRef, so it mimics what happens in non-videotoolbox cases. (Changing the AVBufferRef contents is a bit like changing the image data.) The post_process callback copies that reference to the proper AVFrame field. Based on a patch by wm4. Signed-off-by: Aman Gupta > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63d875772d265a885808532889f094f80afaac7a --- libavcodec/h264dec.c | 3 --- libavcodec/videotoolbox.c | 68 +++ libavcodec/vt_internal.h | 1 - 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index 8c9c6d9f3b..7494c7a8f2 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -838,9 +838,6 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp) AVFrame *src = srcp->f; int ret; -if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1) -return AVERROR_INVALIDDATA; - ret = av_frame_ref(dst, src); if (ret < 0) return ret; diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index afec1edf3f..f82c31c5df 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -45,8 +45,10 @@ enum { kCMVideoCodecType_HEVC = 'hvc1' }; static void videotoolbox_buffer_release(void *opaque, uint8_t *data) { -CVPixelBufferRef cv_buffer = (CVImageBufferRef)data; +CVPixelBufferRef cv_buffer = *(CVPixelBufferRef *)data; CVPixelBufferRelease(cv_buffer); + +av_free(data); } static int videotoolbox_buffer_copy(VTContext *vtctx, @@ -69,19 +71,47 @@ static int videotoolbox_buffer_copy(VTContext *vtctx, return 0; } +static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame) +{ +CVPixelBufferRef ref = *(CVPixelBufferRef *)frame->buf[0]->data; + +if (!ref) { +av_log(avctx, AV_LOG_ERROR, "No frame decoded?\n"); +av_frame_unref(frame); +return AVERROR_EXTERNAL; +} + +frame->data[3] = (uint8_t*)ref; + +return 0; +} + int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame) { +size_t size = sizeof(CVPixelBufferRef); +uint8_t*data = NULL; +AVBufferRef *buf = NULL; int ret = ff_attach_decode_data(frame); +FrameDecodeData *fdd; if (ret < 0) return ret; +data = av_mallocz(size); +if (!data) +return AVERROR(ENOMEM); +buf = av_buffer_create(data, size, videotoolbox_buffer_release, NULL, 0); +if (!buf) { +av_freep(&data); +return AVERROR(ENOMEM); +} +frame->buf[0] = buf; + +fdd = (FrameDecodeData*)frame->private_ref->data; +fdd->post_process = videotoolbox_postproc_frame; + frame->width = avctx->width; frame->height = avctx->height; frame->format = avctx->pix_fmt; -frame->buf[0] = av_buffer_alloc(1); - -if (!frame->buf[0]) -return AVERROR(ENOMEM); return 0; } @@ -285,20 +315,24 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) return data; } -int ff_videotoolbox_buffer_create(VTContext *vtctx, AVFrame *frame) +static int videotoolbox_set_frame(AVCodecContext *avctx, AVFrame *frame) { -av_buffer_unref(&frame->buf[0]); - -frame->buf[0] = av_buffer_create((uint8_t*)vtctx->frame, - sizeof(vtctx->frame), - videotoolbox_buffer_release, - NULL, - AV_BUFFER_FLAG_READONLY); -if (!frame->buf[0]) { -return AVERROR(ENOMEM); +VTContext *vtctx = avctx->internal->hwaccel_priv_data; +if (!frame->buf[0] || frame->data[3]) { +av_log(avctx, AV_LOG_ERROR, "videotoolbox: invalid state\n"); +av_frame_unref(frame); +return AVERROR_EXTERNAL; +} + +CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data; + +if (*ref) { +av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n"); +av_frame_unref(frame); +return AVERROR_EXTERNAL; } -frame->data[3] = (uint8_t*)vtctx->frame; +*ref = vtctx->frame; vtctx->frame = NULL; retu
[FFmpeg-cvslog] lavf/dashenc: remove unneeded call to dash_free
ffmpeg | branch: master | Rodger Combs | Wed Mar 14 01:24:39 2018 -0500| [08e0f45cc88903967da5a76e18be45d7406397f7] | committer: Karthick Jeyapal lavf/dashenc: remove unneeded call to dash_free > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=08e0f45cc88903967da5a76e18be45d7406397f7 --- libavformat/dashenc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 9feb4f1afb..bdf8c8d560 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1033,10 +1033,8 @@ static int dash_write_header(AVFormatContext *s) int i, ret; for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; -if ((ret = avformat_write_header(os->ctx, NULL)) < 0) { -dash_free(s); +if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; -} } ret = write_manifest(s, 0); if (!ret) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/videotoolbox: fix failure to decode PAFF
ffmpeg | branch: master | Rodger Combs | Wed Mar 28 23:19:28 2018 -0500| [4c0798578cab410b4ad9c27bc47b5e09c9a66aba] | committer: Aman Gupta lavc/videotoolbox: fix failure to decode PAFF Signed-off-by: Aman Gupta > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c0798578cab410b4ad9c27bc47b5e09c9a66aba --- libavcodec/videotoolbox.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index f82c31c5df..57b6698e1b 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -326,11 +326,8 @@ static int videotoolbox_set_frame(AVCodecContext *avctx, AVFrame *frame) CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data; -if (*ref) { -av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n"); -av_frame_unref(frame); -return AVERROR_EXTERNAL; -} +if (*ref) +CVPixelBufferRelease(*ref); *ref = vtctx->frame; vtctx->frame = NULL; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/flacenc: support writing attached pictures
ffmpeg | branch: master | Rodger Combs | Wed Apr 4 01:17:24 2018 -0300| [00d8598eba2e8dce31af250d6ecaec37254475aa] | committer: James Almer avformat/flacenc: support writing attached pictures Usage of packet queueing API and some cleaning done by the committer. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00d8598eba2e8dce31af250d6ecaec37254475aa --- libavformat/flacenc.c | 278 +++--- 1 file changed, 242 insertions(+), 36 deletions(-) diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index b894f9ef61..3179f259e5 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -21,10 +21,13 @@ #include "libavutil/channel_layout.h" #include "libavutil/opt.h" +#include "libavutil/pixdesc.h" #include "libavcodec/flac.h" #include "avformat.h" #include "avio_internal.h" #include "flacenc.h" +#include "id3v2.h" +#include "internal.h" #include "vorbiscomment.h" #include "libavcodec/bytestream.h" @@ -33,8 +36,15 @@ typedef struct FlacMuxerContext { const AVClass *class; int write_header; +int audio_stream_idx; +int waiting_pics; +/* audio packets are queued here until we get all the attached pictures */ +AVPacketList *queue, *queue_end; + /* updated streaminfo sent by the encoder at the end */ uint8_t *streaminfo; + +unsigned attached_types; } FlacMuxerContext; static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, @@ -74,31 +84,163 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, return 0; } -static int flac_write_header(struct AVFormatContext *s) +static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt) { -int ret; -int padding = s->metadata_header_padding; -AVCodecParameters *par = s->streams[0]->codecpar; -FlacMuxerContext *c = s->priv_data; - -if (!c->write_header) +FlacMuxerContext *c = s->priv_data; +AVIOContext *pb = s->pb; +const AVPixFmtDescriptor *pixdesc; +const CodecMime *mime = ff_id3v2_mime_tags; +AVDictionaryEntry *e; +const char *mimetype = NULL, *desc = ""; +const AVStream *st = s->streams[pkt->stream_index]; +int i, mimelen, desclen, type = 0; + +if (!pkt->data) return 0; -if (s->nb_streams > 1) { -av_log(s, AV_LOG_ERROR, "only one stream is supported\n"); +while (mime->id != AV_CODEC_ID_NONE) { +if (mime->id == st->codecpar->codec_id) { +mimetype = mime->str; +break; +} +mime++; +} +if (!mimetype) { +av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot " + "write an attached picture.\n", st->index); +return AVERROR(EINVAL); +} +mimelen = strlen(mimetype); + +/* get the picture type */ +e = av_dict_get(st->metadata, "comment", NULL, 0); +for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) { +if (!av_strcasecmp(e->value, ff_id3v2_picture_types[i])) { +type = i; +break; +} +} + +if ((c->attached_types & (1 << type)) & 0x6) { +av_log(s, AV_LOG_ERROR, "Duplicate attachment for type '%s'\n", ff_id3v2_picture_types[type]); return AVERROR(EINVAL); } -if (par->codec_id != AV_CODEC_ID_FLAC) { -av_log(s, AV_LOG_ERROR, "unsupported codec\n"); + +if (type == 1 && (st->codecpar->codec_id != AV_CODEC_ID_PNG || + st->codecpar->width != 32 || + st->codecpar->height != 32)) { +av_log(s, AV_LOG_ERROR, "File icon attachment must be a 32x32 PNG"); return AVERROR(EINVAL); } +c->attached_types |= (1 << type); + +/* get the description */ +if ((e = av_dict_get(st->metadata, "title", NULL, 0))) +desc = e->value; +desclen = strlen(desc); + +avio_w8(pb, 0x06); +avio_wb24(pb, 4 + 4 + mimelen + 4 + desclen + 4 + 4 + 4 + 4 + 4 + pkt->size); + +avio_wb32(pb, type); + +avio_wb32(pb, mimelen); +avio_write(pb, mimetype, mimelen); + +avio_wb32(pb, desclen); +avio_write(pb, desc, desclen); + +avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, st->codecpar->height); +if ((pixdesc = av_pix_fmt_desc_get(st->codecpar->format))) +avio_wb32(pb, av_get_bits_per_pixel(pixdesc)); +else +avio_wb32(pb, 0); +avio_wb32(pb, 0); + +avio_wb32(pb, pkt->size); +avio_write(pb, pkt->data, pkt->size); +return 0; +} + +static int flac_finish_header(struct AVFormatContext
[FFmpeg-cvslog] avformat/flacenc: support writing attached pictures
ffmpeg | branch: release/4.0 | Rodger Combs | Wed Apr 4 01:17:24 2018 -0300| [9ef90ff0a2bf1684752ac81e527981f4a2219c13] | committer: James Almer avformat/flacenc: support writing attached pictures Usage of packet queueing API and some cleaning done by the committer. Signed-off-by: James Almer (cherry picked from commit 00d8598eba2e8dce31af250d6ecaec37254475aa) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9ef90ff0a2bf1684752ac81e527981f4a2219c13 --- libavformat/flacenc.c | 278 +++--- 1 file changed, 242 insertions(+), 36 deletions(-) diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index b894f9ef61..3179f259e5 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -21,10 +21,13 @@ #include "libavutil/channel_layout.h" #include "libavutil/opt.h" +#include "libavutil/pixdesc.h" #include "libavcodec/flac.h" #include "avformat.h" #include "avio_internal.h" #include "flacenc.h" +#include "id3v2.h" +#include "internal.h" #include "vorbiscomment.h" #include "libavcodec/bytestream.h" @@ -33,8 +36,15 @@ typedef struct FlacMuxerContext { const AVClass *class; int write_header; +int audio_stream_idx; +int waiting_pics; +/* audio packets are queued here until we get all the attached pictures */ +AVPacketList *queue, *queue_end; + /* updated streaminfo sent by the encoder at the end */ uint8_t *streaminfo; + +unsigned attached_types; } FlacMuxerContext; static int flac_write_block_padding(AVIOContext *pb, unsigned int n_padding_bytes, @@ -74,31 +84,163 @@ static int flac_write_block_comment(AVIOContext *pb, AVDictionary **m, return 0; } -static int flac_write_header(struct AVFormatContext *s) +static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt) { -int ret; -int padding = s->metadata_header_padding; -AVCodecParameters *par = s->streams[0]->codecpar; -FlacMuxerContext *c = s->priv_data; - -if (!c->write_header) +FlacMuxerContext *c = s->priv_data; +AVIOContext *pb = s->pb; +const AVPixFmtDescriptor *pixdesc; +const CodecMime *mime = ff_id3v2_mime_tags; +AVDictionaryEntry *e; +const char *mimetype = NULL, *desc = ""; +const AVStream *st = s->streams[pkt->stream_index]; +int i, mimelen, desclen, type = 0; + +if (!pkt->data) return 0; -if (s->nb_streams > 1) { -av_log(s, AV_LOG_ERROR, "only one stream is supported\n"); +while (mime->id != AV_CODEC_ID_NONE) { +if (mime->id == st->codecpar->codec_id) { +mimetype = mime->str; +break; +} +mime++; +} +if (!mimetype) { +av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot " + "write an attached picture.\n", st->index); +return AVERROR(EINVAL); +} +mimelen = strlen(mimetype); + +/* get the picture type */ +e = av_dict_get(st->metadata, "comment", NULL, 0); +for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) { +if (!av_strcasecmp(e->value, ff_id3v2_picture_types[i])) { +type = i; +break; +} +} + +if ((c->attached_types & (1 << type)) & 0x6) { +av_log(s, AV_LOG_ERROR, "Duplicate attachment for type '%s'\n", ff_id3v2_picture_types[type]); return AVERROR(EINVAL); } -if (par->codec_id != AV_CODEC_ID_FLAC) { -av_log(s, AV_LOG_ERROR, "unsupported codec\n"); + +if (type == 1 && (st->codecpar->codec_id != AV_CODEC_ID_PNG || + st->codecpar->width != 32 || + st->codecpar->height != 32)) { +av_log(s, AV_LOG_ERROR, "File icon attachment must be a 32x32 PNG"); return AVERROR(EINVAL); } +c->attached_types |= (1 << type); + +/* get the description */ +if ((e = av_dict_get(st->metadata, "title", NULL, 0))) +desc = e->value; +desclen = strlen(desc); + +avio_w8(pb, 0x06); +avio_wb24(pb, 4 + 4 + mimelen + 4 + desclen + 4 + 4 + 4 + 4 + 4 + pkt->size); + +avio_wb32(pb, type); + +avio_wb32(pb, mimelen); +avio_write(pb, mimetype, mimelen); + +avio_wb32(pb, desclen); +avio_write(pb, desc, desclen); + +avio_wb32(pb, st->codecpar->width); +avio_wb32(pb, st->codecpar->height); +if ((pixdesc = av_pix_fmt_desc_get(st->codecpar->format))) +avio_wb32(pb, av_get_bits_per_pixel(pixdesc)); +else +avio_wb32(pb, 0); +avio_wb32(pb, 0); + +avio_wb32(pb, pkt->size); +avio_write(pb, pkt->data, pkt->size);
[FFmpeg-cvslog] lavf/dashenc: don't call flush_init_segment before avformat_write_header
ffmpeg | branch: master | Rodger Combs | Fri Apr 27 03:51:35 2018 +0300| [6f119dc32176e191c7fc796d4c4ca06c7be4ea71] | committer: Karthick Jeyapal lavf/dashenc: don't call flush_init_segment before avformat_write_header Fixes crash when muxing MKV-in-DASH > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f119dc32176e191c7fc796d4c4ca06c7be4ea71 --- libavformat/dashenc.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 211ef23cb0..4f8f61b704 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -1026,13 +1026,6 @@ static int dash_init(AVFormatContext *s) av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename); -// Flush init segment -// except for mp4, since delay_moov is set and the init segment -// is then flushed after the first packets -if (strcmp(os->format_name, "mp4")) { -flush_init_segment(s, os); -} - s->streams[i]->time_base = st->time_base; // If the muxer wants to shift timestamps, request to have them shifted // already before being handed to this muxer, so we don't have mismatches @@ -1074,6 +1067,13 @@ static int dash_write_header(AVFormatContext *s) OutputStream *os = &c->streams[i]; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; + +// Flush init segment +// Only for WebM segment, since for mp4 delay_moov is set and +// the init segment is thus flushed after the first packets. +if (strcmp(os->format_name, "mp4") && +(ret = flush_init_segment(s, os)) < 0) +return ret; } return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/dashenc: don't call flush_init_segment before avformat_write_header
ffmpeg | branch: release/4.0 | Rodger Combs | Fri Apr 27 03:51:35 2018 +0300| [b32f8659695303bc816a44ca9aefc3a839d69dca] | committer: Karthick Jeyapal lavf/dashenc: don't call flush_init_segment before avformat_write_header Fixes crash when muxing MKV-in-DASH > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b32f8659695303bc816a44ca9aefc3a839d69dca --- libavformat/dashenc.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index bdf8c8d560..7b43612f2b 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -988,13 +988,6 @@ static int dash_init(AVFormatContext *s) av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be written to: %s\n", i, filename); -// Flush init segment -// except for mp4, since delay_moov is set and the init segment -// is then flushed after the first packets -if (strcmp(os->format_name, "mp4")) { -flush_init_segment(s, os); -} - s->streams[i]->time_base = st->time_base; // If the muxer wants to shift timestamps, request to have them shifted // already before being handed to this muxer, so we don't have mismatches @@ -1035,6 +1028,12 @@ static int dash_write_header(AVFormatContext *s) OutputStream *os = &c->streams[i]; if ((ret = avformat_write_header(os->ctx, NULL)) < 0) return ret; +// Flush init segment +// Only for WebM segment, since for mp4 delay_moov is set and +// the init segment is thus flushed after the first packets. +if (strcmp(os->format_name, "mp4") && +(ret = flush_init_segment(s, os)) < 0) +return ret; } ret = write_manifest(s, 0); if (!ret) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/utils: ignore outlier subtitle and data stream end times as well
ffmpeg | branch: master | Rodger Combs | Wed Oct 5 06:37:57 2016 -0500| [4c9c4fe8b21b22e83cde22b5fbaa947ebe5e66d9] | committer: Rodger Combs lavf/utils: ignore outlier subtitle and data stream end times as well > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c9c4fe8b21b22e83cde22b5fbaa947ebe5e66d9 --- libavformat/utils.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 3acb260..d19cc5e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2524,7 +2524,7 @@ static int has_duration(AVFormatContext *ic) */ static void update_stream_timings(AVFormatContext *ic) { -int64_t start_time, start_time1, start_time_text, end_time, end_time1; +int64_t start_time, start_time1, start_time_text, end_time, end_time1, end_time_text; int64_t duration, duration1, filesize; int i; AVStream *st; @@ -2533,6 +2533,7 @@ static void update_stream_timings(AVFormatContext *ic) start_time = INT64_MAX; start_time_text = INT64_MAX; end_time = INT64_MIN; +end_time_text = INT64_MIN; duration = INT64_MIN; for (i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; @@ -2549,7 +2550,10 @@ static void update_stream_timings(AVFormatContext *ic) AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX); if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) { end_time1 += start_time1; -end_time = FFMAX(end_time, end_time1); +if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) +end_time_text = FFMAX(end_time_text, end_time1); +else +end_time = FFMAX(end_time, end_time1); } for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) { if (p->start_time == AV_NOPTS_VALUE || p->start_time > start_time1) @@ -2569,6 +2573,12 @@ static void update_stream_timings(AVFormatContext *ic) else if (start_time > start_time_text) av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream starttime %f\n", start_time_text / (float)AV_TIME_BASE); +if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text - end_time < AV_TIME_BASE)) { +end_time = end_time_text; +} else if (end_time < end_time_text) { +av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream endtime %f\n", end_time_text / (float)AV_TIME_BASE); +} + if (start_time != INT64_MAX) { ic->start_time = start_time; if (end_time != INT64_MIN) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/utils: avoid using programs for duration when there's only one
ffmpeg | branch: master | Rodger Combs | Wed Oct 5 06:38:24 2016 -0500| [a6bce3ca90de81eb48db3a70df0b1c309d7d5cf9] | committer: Rodger Combs lavf/utils: avoid using programs for duration when there's only one This allows us to be more selective about the streams we derive durations from (specifically, ignoring text streams with outlier end times) in the common case > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6bce3ca90de81eb48db3a70df0b1c309d7d5cf9 --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index d19cc5e..1aa3b50 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2582,7 +2582,7 @@ static void update_stream_timings(AVFormatContext *ic) if (start_time != INT64_MAX) { ic->start_time = start_time; if (end_time != INT64_MIN) { -if (ic->nb_programs) { +if (ic->nb_programs > 1) { for (i = 0; i < ic->nb_programs; i++) { p = ic->programs[i]; if (p->start_time != AV_NOPTS_VALUE && p->end_time > p->start_time) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmpeg: don't reconfigure terminal if we're not taking input from stdin
ffmpeg | branch: master | Rodger Combs | Wed Sep 7 19:16:27 2016 -0500| [1f7d5860525ad9b7540502ce01b2f239eada8e87] | committer: Rodger Combs ffmpeg: don't reconfigure terminal if we're not taking input from stdin > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f7d5860525ad9b7540502ce01b2f239eada8e87 --- ffmpeg.c | 4 +--- ffmpeg_opt.c | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index ee5a768..44371f0b 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -366,7 +366,7 @@ static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType) void term_init(void) { #if HAVE_TERMIOS_H -if(!run_as_daemon){ +if (!run_as_daemon && stdin_interaction) { struct termios tty; if (tcgetattr (0, &tty) == 0) { oldtty = tty; @@ -4493,8 +4493,6 @@ int main(int argc, char **argv) show_banner(argc, argv, options); -term_init(); - /* parse options and open all input/output files */ ret = ffmpeg_parse_options(argc, argv); if (ret < 0) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index d202f43..bea2829 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -3160,6 +3160,9 @@ int ffmpeg_parse_options(int argc, char **argv) goto fail; } +/* configure terminal and setup signal handlers */ +term_init(); + /* open input files */ ret = open_files(&octx.groups[GROUP_INFILE], "input", open_input_file); if (ret < 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests: add -nostdin flag when calling ffmpeg
ffmpeg | branch: master | Rodger Combs | Wed Sep 7 19:16:34 2016 -0500| [021286720248e9753d8cf4626a55e329e21708aa] | committer: Rodger Combs tests: add -nostdin flag when calling ffmpeg This fixes a long-standing issue where running FATE in parallel could result in the terminal being left misconfigured, particularly if a test failed or was canceled wtih ^C. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=021286720248e9753d8cf4626a55e329e21708aa --- tests/fate/vpx.mak| 10 +- tests/regression-funcs.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak index 3750561..46658ec 100644 --- a/tests/fate/vpx.mak +++ b/tests/fate/vpx.mak @@ -56,19 +56,19 @@ FATE_VP8-$(CONFIG_MATROSKA_DEMUXER) += fate-vp8-alpha fate-vp8-alpha: CMD = framecrc -i $(TARGET_SAMPLES)/vp8_alpha/vp8_video_with_alpha.webm -vcodec copy FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest -fate-webm-dash-manifest: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" - +fate-webm-dash-manifest: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" - FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-unaligned-video-streams -fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - +fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-unaligned-audio-streams -fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - +fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-representations -fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - +fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 -map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" - FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-live -fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 - +fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 - FATE_VP8-$(call DEMDEC, MATROSKA, VP8) += fate-vp8-2451 fate-vp8-2451: CMD = framecrc -f
[FFmpeg-cvslog] lavf/segment: decide whether to rename based on list URI
ffmpeg | branch: master | Rodger Combs | Thu Oct 6 02:00:25 2016 -0500| [ecb53e11014bf9d45a995390c6241c71d3e49ff9] | committer: Rodger Combs lavf/segment: decide whether to rename based on list URI This fixes the case of writing segments to local files, but the list over a network protocol. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ecb53e11014bf9d45a995390c6241c71d3e49ff9 --- libavformat/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 33a5cf0..55dcaf0 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -709,7 +709,7 @@ static int seg_init(AVFormatContext *s) if ((ret = segment_list_open(s)) < 0) goto fail; } else { -const char *proto = avio_find_protocol_name(s->filename); +const char *proto = avio_find_protocol_name(seg->list); seg->use_rename = proto && !strcmp(proto, "file"); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] MAINTAINERS: add myself for audiotoolbox
ffmpeg | branch: master | Rodger Combs | Mon Oct 24 01:47:52 2016 -0500| [8a24e03684cad4b8207a0317123ca2bd544d012e] | committer: Rodger Combs MAINTAINERS: add myself for audiotoolbox > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a24e03684cad4b8207a0317123ca2bd544d012e --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3570253..d0457a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -141,6 +141,7 @@ Codecs: ass* Aurelien Jacobs asv* Michael Niedermayer atrac3plus* Maxim Poliakovski + audiotoolbox* Rodger Combs bgmc.c, bgmc.hThilo Borgmann binkaudio.c Peter Ross cavs* Stefan Gehrer ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/h264_parser: export field order in more cases
ffmpeg | branch: master | Rodger Combs | Mon Oct 3 21:45:56 2016 -0500| [f271a9bd991be4ce8d230b7dc6a0e56ca64b195c] | committer: Rodger Combs lavc/h264_parser: export field order in more cases > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f271a9bd991be4ce8d230b7dc6a0e56ca64b195c --- libavcodec/h264_parser.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 3ed7d77..bca0071 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -61,6 +61,7 @@ typedef struct H264ParseContext { int parse_history_count; int parse_last_mb; int64_t reference_dts; +int last_frame_num, last_picture_structure; } H264ParseContext; @@ -528,7 +529,19 @@ static inline int parse_nal_units(AVCodecParserContext *s, s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; -s->field_order = AV_FIELD_UNKNOWN; +if (p->poc.frame_num == p->last_frame_num && +p->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN && +p->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME && +p->last_picture_structure != s->picture_structure) { +if (p->last_picture_structure == AV_PICTURE_STRUCTURE_TOP_FIELD) +s->field_order = AV_FIELD_TT; +else +s->field_order = AV_FIELD_BB; +} else { +s->field_order = AV_FIELD_UNKNOWN; +} +p->last_picture_structure = s->picture_structure; +p->last_frame_num = p->poc.frame_num; } av_freep(&nal.rbsp_buffer); @@ -677,6 +690,7 @@ static av_cold int init(AVCodecParserContext *s) H264ParseContext *p = s->priv_data; p->reference_dts = AV_NOPTS_VALUE; +p->last_frame_num = INT_MAX; ff_h264dsp_init(&p->h264dsp, 8, 1); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/utils: avcodec_string: dump field order when known
ffmpeg | branch: master | Rodger Combs | Mon Oct 3 21:46:53 2016 -0500| [ba53504e57b6dc92726086d0b8f50fc26069f327] | committer: Rodger Combs lavc/utils: avcodec_string: dump field order when known > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba53504e57b6dc92726086d0b8f50fc26069f327 --- libavcodec/utils.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7c26485..87de15f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3254,6 +3254,20 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) av_get_colorspace_name(enc->colorspace)); } +if (enc->field_order != AV_FIELD_UNKNOWN) { +const char *field_order = "progressive"; +if (enc->field_order == AV_FIELD_TT) +field_order = "top first"; +else if (enc->field_order == AV_FIELD_BB) +field_order = "bottom first"; +else if (enc->field_order == AV_FIELD_TB) +field_order = "top coded first (swapped)"; +else if (enc->field_order == AV_FIELD_BT) +field_order = "bottom coded first (swapped)"; + +av_strlcatf(detail, sizeof(detail), "%s, ", field_order); +} + if (av_log_get_level() >= AV_LOG_VERBOSE && enc->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) av_strlcatf(detail, sizeof(detail), "%s, ", ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffprobe: report field order for video streams
ffmpeg | branch: master | Rodger Combs | Mon Oct 3 23:49:09 2016 -0500| [54350f06e11727f255e3d1829cb1afde49931d8b] | committer: Rodger Combs ffprobe: report field order for video streams > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54350f06e11727f255e3d1829cb1afde49931d8b --- doc/ffprobe.xsd | 1 + ffprobe.c | 13 + tests/ref/fate/concat-demuxer-extended-lavf-mxf | 2 +- tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 | 2 +- tests/ref/fate/concat-demuxer-simple1-lavf-mxf | 2 +- tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 | 2 +- tests/ref/fate/concat-demuxer-simple2-lavf-ts | 2 +- tests/ref/fate/ffprobe_compact | 4 ++-- tests/ref/fate/ffprobe_csv | 4 ++-- tests/ref/fate/ffprobe_default | 2 ++ tests/ref/fate/ffprobe_flat | 2 ++ tests/ref/fate/ffprobe_ini | 2 ++ 12 files changed, 29 insertions(+), 9 deletions(-) diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd index 757de12..ac0347f 100644 --- a/doc/ffprobe.xsd +++ b/doc/ffprobe.xsd @@ -201,6 +201,7 @@ + diff --git a/ffprobe.c b/ffprobe.c index 662137c..7cd0034 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2268,6 +2268,19 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id else print_str_opt("chroma_location", av_chroma_location_name(par->chroma_location)); +if (par->field_order == AV_FIELD_PROGRESSIVE) +print_str("field_order", "progressive"); +else if (par->field_order == AV_FIELD_TT) +print_str("field_order", "tt"); +else if (par->field_order == AV_FIELD_BB) +print_str("field_order", "bb"); +else if (par->field_order == AV_FIELD_TB) +print_str("field_order", "tb"); +else if (par->field_order == AV_FIELD_BT) +print_str("field_order", "bt"); +else +print_str_opt("field_order", "unknown"); + #if FF_API_PRIVATE_OPT if (dec_ctx && dec_ctx->timecode_frame_start >= 0) { char tcbuf[AV_TIMECODE_STR_SIZE]; diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf b/tests/ref/fate/concat-demuxer-extended-lavf-mxf index f7905aa..8bb2fb0 100644 --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf +++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf @@ -1 +1 @@ -21eb3a629ff504b55c93a66879a31362 *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe +a277e04c23cf764abe692ca07e87b82e *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 index 0c49f1f..e294538 100644 --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 +++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 @@ -1 +1 @@ -67a03ad49f1bd17131f751313639b61e *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe +026045a43aa2dde1723d7331c2252b01 *tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf index 6bba76a..c899754 100644 --- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf +++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf @@ -120,5 +120,5 @@ audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|206848|K_|1 Strings Metadata|8 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|211456|K_|1 Strings Metadata|8 -0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301 +0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301 1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301 diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 index 75cac84..2ba3a2e 100644 --- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 +++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 @@ -78,5 +78,5 @@ video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1923072|K_|1 Strings Metadata|8 audio|1|65280
[FFmpeg-cvslog] lavc/parser: export field order if not already set
ffmpeg | branch: master | Rodger Combs | Tue Sep 20 05:57:39 2016 -0500| [d13740f3a207668f53ce167cf96f353379ac2c14] | committer: Rodger Combs lavc/parser: export field order if not already set Some codecs set this in the parser, but not the decoder > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d13740f3a207668f53ce167cf96f353379ac2c14 --- libavcodec/parser.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 2c8fc69..30cfc55 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -182,6 +182,11 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf, poutbuf_size, buf, buf_size); av_assert0(index > -0x2000); // The API does not allow returning AVERROR codes +#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name +if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { +FILL(field_order); +} + /* update the file pointer */ if (*poutbuf_size) { /* fill the data for the current frame */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/h264: make mp4toannexb test use auto-BSF
ffmpeg | branch: master | Rodger Combs | Fri Apr 15 03:01:46 2016 -0500| [a6da754ef9a74fe09368491053e0b66611890f7f] | committer: Rodger Combs fate/h264: make mp4toannexb test use auto-BSF > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6da754ef9a74fe09368491053e0b66611890f7f --- tests/fate/h264.mak | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak index 472895f..b4d7f7a 100644 --- a/tests/fate/h264.mak +++ b/tests/fate/h264.mak @@ -205,7 +205,7 @@ FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-invalid-ref-mod # this sample has invalid extradata that is not escaped FATE_H264-$(call DEMDEC, MOV, H264) += fate-h264-unescaped-extradata -FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += fate-h264-bsf-mp4toannexb +FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF H264_MUXER) += fate-h264-bsf-mp4toannexb FATE_H264-$(call DEMDEC, MATROSKA, H264) += fate-h264-direct-bff FATE_H264-$(call DEMDEC, FLV, H264) += fate-h264-brokensps-2580 FATE_H264-$(call DEMDEC, MXF, H264) += fate-h264-xavc-4389 @@ -405,7 +405,8 @@ fate-h264-conformance-sva_fm1_e: CMD = framecrc -vsync drop -i fate-h264-conformance-sva_nl1_b: CMD = framecrc -vsync drop -i $(TARGET_SAMPLES)/h264-conformance/SVA_NL1_B.264 fate-h264-conformance-sva_nl2_e: CMD = framecrc -vsync drop -i $(TARGET_SAMPLES)/h264-conformance/SVA_NL2_E.264 -fate-h264-bsf-mp4toannexb:CMD = md5 -i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb -f h264 +fate-h264-bsf-mp4toannexb:CMD = md5 -i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -f h264 + fate-h264-crop-to-container: CMD = framemd5 -i $(TARGET_SAMPLES)/h264/crop-to-container-dims-canon.mov fate-h264-extreme-plane-pred: CMD = framemd5 -i $(TARGET_SAMPLES)/h264/extreme-plane-pred.h264 fate-h264-interlace-crop: CMD = framecrc -i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vframes 3 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/movenc: add deinit function
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 19:24:04 2016 -0500| [e83d5d7e58fff5f059dfdbe80e07ae7e49cdc2e9] | committer: Rodger Combs lavf/movenc: add deinit function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e83d5d7e58fff5f059dfdbe80e07ae7e49cdc2e9 --- libavformat/movenc.c | 76 ++-- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 50be8ff..4b6aa76 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5612,21 +5612,18 @@ static int mov_write_header(AVFormatContext *s) if (mov->encryption_key_len != AES_CTR_KEY_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d expected %d\n", mov->encryption_key_len, AES_CTR_KEY_SIZE); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } if (mov->encryption_kid_len != CENC_KID_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d expected %d\n", mov->encryption_kid_len, CENC_KID_SIZE); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } } else { av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n", mov->encryption_scheme_str); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } } @@ -5646,8 +5643,7 @@ static int mov_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream #%d, " "codec not currently supported in container\n", avcodec_get_name(st->codecpar->codec_id), i); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } /* If hinting of this track is enabled by a later hint track, * this is updated. */ @@ -5661,8 +5657,7 @@ static int mov_write_header(AVFormatContext *s) track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) { if (st->codecpar->width != 720 || (st->codecpar->height != 608 && st->codecpar->height != 512)) { av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 720x512 video resolution\n"); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } track->height = track->tag >> 24 == 'n' ? 486 : 576; } @@ -5675,8 +5670,7 @@ static int mov_write_header(AVFormatContext *s) } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } if (track->mode == MODE_MOV && track->timescale > 10) av_log(s, AV_LOG_WARNING, @@ -5704,8 +5698,7 @@ static int mov_write_header(AVFormatContext *s) "VP9 in MP4 support is experimental, add " "'-strict %d' if you want to use it.\n", FF_COMPLIANCE_EXPERIMENTAL); -ret = AVERROR_EXPERIMENTAL; -goto error; +return AVERROR_EXPERIMENTAL; } } } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { @@ -5718,8 +5711,7 @@ static int mov_write_header(AVFormatContext *s) st->codecpar->codec_id == AV_CODEC_ID_ILBC){ if (!st->codecpar->block_align) { av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i); -ret = AVERROR(EINVAL); -goto error; +return AVERROR(EINVAL); } track->sample_size = st->codecpar->block_align; }else if (st->codecpar->frame_size > 1){ /* assume compressed audio */ @@ -5736,8 +5728,7 @@ static int mov_write_header(AVFormatContext *s) if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) { av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is not standard, to mux anyway set strict to -1\n", i, track->par->
[FFmpeg-cvslog] fate/hevc: add automatic bsf test
ffmpeg | branch: master | Rodger Combs | Thu Apr 28 17:00:43 2016 -0500| [3b3f979894a0aca01245fcaa2e4ff06f5f839e54] | committer: Rodger Combs fate/hevc: add automatic bsf test > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b3f979894a0aca01245fcaa2e4ff06f5f839e54 --- tests/fate/hevc.mak | 11 +++ 1 file changed, 11 insertions(+) diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak index 05266cd..bd09ab3 100644 --- a/tests/fate/hevc.mak +++ b/tests/fate/hevc.mak @@ -225,6 +225,17 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call FATE_HEVC_TEST_444_12BIT,$(N fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i $(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags area+accurate_rnd+bitexact FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10 +tests/data/hevc-mp4.mov: TAG = GEN +tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ + -i $(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit -c copy -flags +bitexact $(TARGET_PATH)/$@ -y 2>/dev/null + +FATE_HEVC-$(call ALLYES, HEVC_DEMUXER MOV_DEMUXER HEVC_MP4TOANNEXB_BSF MOV_MUXER HEVC_MUXER) += fate-hevc-bsf-mp4toannexb +fate-hevc-bsf-mp4toannexb: tests/data/hevc-mp4.mov +fate-hevc-bsf-mp4toannexb: CMD = md5 -i $(TARGET_PATH)/tests/data/hevc-mp4.mov -vcodec copy -fflags +bitexact -f hevc +fate-hevc-bsf-mp4toannexb: CMP = oneline +fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9 + FATE_HEVC-$(call DEMDEC, HEVC, HEVC) += $(FATE_HEVC) FATE_SAMPLES_AVCONV += $(FATE_HEVC-yes) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/movenc+dashenc: add automatic bitstream filtering
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 19:36:39 2016 -0500| [42cb050a05020e9da18136b8cd65944b378b74eb] | committer: Rodger Combs lavf/movenc+dashenc: add automatic bitstream filtering This is disabled by default when the empty_moov flag is enabled > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42cb050a05020e9da18136b8cd65944b378b74eb --- libavformat/dashenc.c | 43 +++- libavformat/movenc.c | 107 +++--- 2 files changed, 124 insertions(+), 26 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 0848052..534fa75 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -551,7 +551,7 @@ static int write_manifest(AVFormatContext *s, int final) return avpriv_io_move(temp_filename, s->filename); } -static int dash_write_header(AVFormatContext *s) +static int dash_init(AVFormatContext *s) { DASHContext *c = s->priv_data; int ret = 0, i; @@ -643,7 +643,7 @@ static int dash_write_header(AVFormatContext *s) os->init_start_pos = 0; av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); -if ((ret = avformat_write_header(ctx, &opts)) < 0) +if ((ret = avformat_init_output(ctx, &opts)) < 0) return ret; os->ctx_inited = 1; avio_flush(ctx->pb); @@ -682,6 +682,20 @@ static int dash_write_header(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration set\n"); return AVERROR(EINVAL); } +return 0; +} + +static int dash_write_header(AVFormatContext *s) +{ +DASHContext *c = s->priv_data; +int i, ret; +for (i = 0; i < s->nb_streams; i++) { +OutputStream *os = &c->streams[i]; +if ((ret = avformat_write_header(os->ctx, NULL)) < 0) { +dash_free(s); +return ret; +} +} ret = write_manifest(s, 0); if (!ret) av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename); @@ -978,6 +992,29 @@ static int dash_write_trailer(AVFormatContext *s) return 0; } +static int dash_check_bitstream(struct AVFormatContext *s, const AVPacket *avpkt) +{ +DASHContext *c = s->priv_data; +OutputStream *os = &c->streams[avpkt->stream_index]; +AVFormatContext *oc = os->ctx; +if (oc->oformat->check_bitstream) { +int ret; +AVPacket pkt = *avpkt; +pkt.stream_index = 0; +ret = oc->oformat->check_bitstream(oc, &pkt); +if (ret == 1) { +AVStream *st = s->streams[avpkt->stream_index]; +AVStream *ost = oc->streams[0]; +st->internal->bsfcs = ost->internal->bsfcs; +st->internal->nb_bsfcs = ost->internal->nb_bsfcs; +ost->internal->bsfcs = NULL; +ost->internal->nb_bsfcs = 0; +} +return ret; +} +return 1; +} + #define OFFSET(x) offsetof(DASHContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { @@ -1008,10 +1045,12 @@ AVOutputFormat ff_dash_muxer = { .audio_codec= AV_CODEC_ID_AAC, .video_codec= AV_CODEC_ID_H264, .flags = AVFMT_GLOBALHEADER | AVFMT_NOFILE | AVFMT_TS_NEGATIVE, +.init = dash_init, .write_header = dash_write_header, .write_packet = dash_write_packet, .write_trailer = dash_write_trailer, .deinit = dash_free, .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, +.check_bitstream = dash_check_bitstream, .priv_class = &dash_class, }; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4b6aa76..6228192 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5459,11 +5459,10 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track, return 0; } -static int mov_write_header(AVFormatContext *s) +static int mov_init(AVFormatContext *s) { -AVIOContext *pb = s->pb; MOVMuxContext *mov = s->priv_data; -AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); +AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 0); int i, ret, hint_track = 0, tmcd_track = 0; mov->fc = s; @@ -5500,6 +5499,11 @@ static int mov_write_header(AVFormatContext *s) mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_DEFAULT_BASE_MOOF; +if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) { +av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic bitstream filtering\n"); +s->flags &= ~AVFMT_FLAG_AUTO_BSF; +} + if (mov-&g
[FFmpeg-cvslog] fate/aac: add automatic bsf test
ffmpeg | branch: master | Rodger Combs | Fri Apr 15 03:18:01 2016 -0500| [ed4e081a362d24b878201c2a3a289f9a5ec40a15] | committer: Rodger Combs fate/aac: add automatic bsf test > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ed4e081a362d24b878201c2a3a289f9a5ec40a15 --- tests/fate/aac.mak | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak index 3d64031..9ce8efb 100644 --- a/tests/fate/aac.mak +++ b/tests/fate/aac.mak @@ -241,6 +241,10 @@ FATE_AAC_LATM += fate-aac-latm_stereo_to_51 fate-aac-latm_stereo_to_51: CMD = pcm -i $(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1 fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16 +fate-aac-autobsf-adtstoasc: CMD = md5 -i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec copy -fflags +bitexact -f matroska +fate-aac-autobsf-adtstoasc: CMP = oneline +fate-aac-autobsf-adtstoasc: REF = 8c6fbebb64ebbe9e01b345d77844d7cd + FATE_AAC-$(call DEMDEC, AAC,AAC) += $(FATE_AAC_CT_RAW) FATE_AAC-$(call DEMDEC, MOV,AAC) += $(FATE_AAC) FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM) @@ -253,7 +257,9 @@ $(FATE_AAC_ALL): FUZZ = 2 FATE_AAC_ENCODE-$(call ENCMUX, AAC, ADTS) += $(FATE_AAC_ENCODE) -FATE_SAMPLES_FFMPEG += $(FATE_AAC_ALL) $(FATE_AAC_ENCODE-yes) +FATE_AAC_BSF-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER) += fate-aac-autobsf-adtstoasc + +FATE_SAMPLES_FFMPEG += $(FATE_AAC_ALL) $(FATE_AAC_ENCODE-yes) $(FATE_AAC_BSF-yes) -fate-aac: $(FATE_AAC_ALL) $(FATE_AAC_ENCODE) +fate-aac: $(FATE_AAC_ALL) $(FATE_AAC_ENCODE) $(FATE_AAC_BSF-yes) fate-aac-latm: $(FATE_AAC_LATM-yes) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/rawenc: add automatic bitstream filtering for H264+HEVC
ffmpeg | branch: master | Rodger Combs | Fri Sep 9 23:27:54 2016 -0500| [d99d7cbdfc70023cd9692c19376772215d3a15b5] | committer: Rodger Combs lavf/rawenc: add automatic bitstream filtering for H264+HEVC > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d99d7cbdfc70023cd9692c19376772215d3a15b5 --- libavformat/rawenc.c | 23 +++ 1 file changed, 23 insertions(+) diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index c4d7a90..730e99a 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -20,8 +20,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/intreadwrite.h" + #include "avformat.h" #include "rawenc.h" +#include "internal.h" int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt) { @@ -236,6 +239,15 @@ AVOutputFormat ff_h263_muxer = { #endif #if CONFIG_H264_MUXER +static int h264_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +AVStream *st = s->streams[0]; +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 && + AV_RB24(pkt->data) != 0x01) +return ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL); +return 1; +} + AVOutputFormat ff_h264_muxer = { .name = "h264", .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"), @@ -244,11 +256,21 @@ AVOutputFormat ff_h264_muxer = { .video_codec = AV_CODEC_ID_H264, .write_header = force_one_stream, .write_packet = ff_raw_write_packet, +.check_bitstream = h264_check_bitstream, .flags = AVFMT_NOTIMESTAMPS, }; #endif #if CONFIG_HEVC_MUXER +static int hevc_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +AVStream *st = s->streams[0]; +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 && + AV_RB24(pkt->data) != 0x01) +return ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL); +return 1; +} + AVOutputFormat ff_hevc_muxer = { .name = "hevc", .long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"), @@ -257,6 +279,7 @@ AVOutputFormat ff_hevc_muxer = { .video_codec = AV_CODEC_ID_HEVC, .write_header = force_one_stream, .write_packet = ff_raw_write_packet, +.check_bitstream = hevc_check_bitstream, .flags = AVFMT_NOTIMESTAMPS, }; #endif ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/segment: fix writing separate header with auto BSF
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 19:18:45 2016 -0500| [45f5c5573203a48acb2dd6fbf18f4b0c25b7aff0] | committer: Rodger Combs lavf/segment: fix writing separate header with auto BSF > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45f5c5573203a48acb2dd6fbf18f4b0c25b7aff0 --- libavformat/segment.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index a0beda2..868f0a8 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -89,6 +89,7 @@ typedef struct SegmentContext { int64_t last_val; ///< remember last time for wrap around detection int64_t last_cut; ///< remember last cut int cut_pending; +int header_written;///< whether we've already called avformat_write_header char *entry_prefix;///< prefix to add to list entry filenames int list_type; ///< set the list type @@ -260,6 +261,7 @@ static int segment_start(AVFormatContext *s, int write_header) if (write_header) { AVDictionary *options = NULL; av_dict_copy(&options, seg->format_options, 0); +av_dict_set(&options, "fflags", "-autobsf", 0); err = avformat_write_header(oc, &options); av_dict_free(&options); if (err < 0) @@ -756,7 +758,8 @@ static int seg_init(AVFormatContext *s) } av_dict_copy(&options, seg->format_options, 0); -ret = avformat_write_header(oc, &options); +av_dict_set(&options, "fflags", "-autobsf", 0); +ret = avformat_init_output(oc, &options); if (av_dict_count(options)) { av_log(s, AV_LOG_ERROR, "Some of the provided format options in '%s' are not recognized\n", seg->format_options_str); @@ -772,6 +775,13 @@ static int seg_init(AVFormatContext *s) seg->segment_frame_count = 0; av_assert0(s->nb_streams == oc->nb_streams); +if (ret == AVSTREAM_INIT_IN_WRITE_HEADER) { +ret = avformat_write_header(oc, NULL); +if (ret < 0) +return ret; +seg->header_written = 1; +} + for (i = 0; i < s->nb_streams; i++) { AVStream *inner_st = oc->streams[i]; AVStream *outer_st = s->streams[i]; @@ -781,6 +791,21 @@ static int seg_init(AVFormatContext *s) if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0) s->avoid_negative_ts = 1; +return ret; +} + +static int seg_write_header(AVFormatContext *s) +{ +SegmentContext *seg = s->priv_data; +AVFormatContext *oc = seg->avf; +int ret; + +if (!seg->header_written) { +ret = avformat_write_header(oc, NULL); +if (ret < 0) +return ret; +} + if (!seg->write_header_trailer || seg->header_filename) { if (seg->header_filename) { av_write_frame(oc, NULL); @@ -1012,6 +1037,7 @@ AVOutputFormat ff_segment_muxer = { .priv_data_size = sizeof(SegmentContext), .flags = AVFMT_NOFILE|AVFMT_GLOBALHEADER, .init = seg_init, +.write_header = seg_write_header, .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, @@ -1031,6 +1057,7 @@ AVOutputFormat ff_stream_segment_muxer = { .priv_data_size = sizeof(SegmentContext), .flags = AVFMT_NOFILE, .init = seg_init, +.write_header = seg_write_header, .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/segment: add deinit function
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 19:18:19 2016 -0500| [c7cd6ad8509c7382664f5bfb7112df69b44f41e4] | committer: Rodger Combs lavf/segment: add deinit function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7cd6ad8509c7382664f5bfb7112df69b44f41e4 --- libavformat/segment.c | 47 --- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 55dcaf0..a0beda2 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -627,8 +627,9 @@ static int select_reference_stream(AVFormatContext *s) return 0; } -static void seg_free_context(SegmentContext *seg) +static void seg_free(AVFormatContext *s) { +SegmentContext *seg = s->priv_data; ff_format_io_close(seg->avf, &seg->list_pb); avformat_free_context(seg->avf); seg->avf = NULL; @@ -693,7 +694,7 @@ static int seg_init(AVFormatContext *s) if (ret < 0) { av_log(s, AV_LOG_ERROR, "Could not parse format options list '%s'\n", seg->format_options_str); -goto fail; +return ret; } } @@ -707,7 +708,7 @@ static int seg_init(AVFormatContext *s) } if (!seg->list_size && seg->list_type != LIST_TYPE_M3U8) { if ((ret = segment_list_open(s)) < 0) -goto fail; +return ret; } else { const char *proto = avio_find_protocol_name(seg->list); seg->use_rename = proto && !strcmp(proto, "file"); @@ -718,29 +719,26 @@ static int seg_init(AVFormatContext *s) av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in favor of 'csv'\n"); if ((ret = select_reference_stream(s)) < 0) -goto fail; +return ret; av_log(s, AV_LOG_VERBOSE, "Selected stream id:%d type:%s\n", seg->reference_stream_index, av_get_media_type_string(s->streams[seg->reference_stream_index]->codecpar->codec_type)); seg->oformat = av_guess_format(seg->format, s->filename, NULL); -if (!seg->oformat) { -ret = AVERROR_MUXER_NOT_FOUND; -goto fail; -} +if (!seg->oformat) +return AVERROR_MUXER_NOT_FOUND; if (seg->oformat->flags & AVFMT_NOFILE) { av_log(s, AV_LOG_ERROR, "format %s not supported.\n", seg->oformat->name); -ret = AVERROR(EINVAL); -goto fail; +return AVERROR(EINVAL); } if ((ret = segment_mux_init(s)) < 0) -goto fail; +return ret; if ((ret = set_segment_filename(s)) < 0) -goto fail; +return ret; oc = seg->avf; if (seg->write_header_trailer) { @@ -748,13 +746,13 @@ static int seg_init(AVFormatContext *s) seg->header_filename ? seg->header_filename : oc->filename, AVIO_FLAG_WRITE, NULL)) < 0) { av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", oc->filename); -goto fail; +return ret; } if (!seg->individual_header_trailer) oc->pb->seekable = 0; } else { if ((ret = open_null_ctx(&oc->pb)) < 0) -goto fail; +return ret; } av_dict_copy(&options, seg->format_options, 0); @@ -762,13 +760,14 @@ static int seg_init(AVFormatContext *s) if (av_dict_count(options)) { av_log(s, AV_LOG_ERROR, "Some of the provided format options in '%s' are not recognized\n", seg->format_options_str); -ret = AVERROR(EINVAL); -goto fail; +av_dict_free(&options); +return AVERROR(EINVAL); } +av_dict_free(&options); if (ret < 0) { ff_format_io_close(oc, &oc->pb); -goto fail; +return ret; } seg->segment_frame_count = 0; @@ -790,17 +789,12 @@ static int seg_init(AVFormatContext *s) close_null_ctxp(&oc->pb); } if ((ret = oc->io_open(oc, &oc->pb, oc->filename, AVIO_FLAG_WRITE, NULL)) < 0) -goto fail; +return ret; if (!seg->individual_header_trailer) oc->pb->seekable = 0; } -fail: -av_dict_free(&options); -if (ret < 0) -seg_free_context(seg); - -return ret; +return 0; } static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) @@ -913,9 +907,6 @@ fail: seg->segment_frame_count++; } -if (ret < 0) -seg_free_context(seg); - return ret; } @@ -1023,6 +1014,7 @@ AVOutputFormat ff_segment_muxer =
[FFmpeg-cvslog] lavf/dashenc: add deinit function
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 19:36:15 2016 -0500| [c972a28fc3defe7cacee281fe1a30b9a026737ed] | committer: Rodger Combs lavf/dashenc: add deinit function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c972a28fc3defe7cacee281fe1a30b9a026737ed --- libavformat/dashenc.c | 51 +-- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 519f9c4..0848052 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -580,16 +580,12 @@ static int dash_write_header(AVFormatContext *s) *ptr = '\0'; oformat = av_guess_format("mp4", NULL, NULL); -if (!oformat) { -ret = AVERROR_MUXER_NOT_FOUND; -goto fail; -} +if (!oformat) +return AVERROR_MUXER_NOT_FOUND; c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); -if (!c->streams) { -ret = AVERROR(ENOMEM); -goto fail; -} +if (!c->streams) +return AVERROR(ENOMEM); for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; @@ -606,17 +602,13 @@ static int dash_write_header(AVFormatContext *s) int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ? AV_LOG_ERROR : AV_LOG_WARNING; av_log(s, level, "No bit rate set for stream %d\n", i); -if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT) { -ret = AVERROR(EINVAL); -goto fail; -} +if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT) +return AVERROR(EINVAL); } ctx = avformat_alloc_context(); -if (!ctx) { -ret = AVERROR(ENOMEM); -goto fail; -} +if (!ctx) +return AVERROR(ENOMEM); os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; @@ -624,10 +616,8 @@ static int dash_write_header(AVFormatContext *s) ctx->io_close = s->io_close; ctx->io_open= s->io_open; -if (!(st = avformat_new_stream(ctx, NULL))) { -ret = AVERROR(ENOMEM); -goto fail; -} +if (!(st = avformat_new_stream(ctx, NULL))) +return AVERROR(ENOMEM); avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; st->time_base = s->streams[i]->time_base; @@ -635,10 +625,8 @@ static int dash_write_header(AVFormatContext *s) ctx->flags = s->flags; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, dash_write, NULL); -if (!ctx->pb) { -ret = AVERROR(ENOMEM); -goto fail; -} +if (!ctx->pb) +return AVERROR(ENOMEM); if (c->single_file) { if (c->single_file_name) @@ -651,13 +639,12 @@ static int dash_write_header(AVFormatContext *s) snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) -goto fail; +return ret; os->init_start_pos = 0; av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); -if ((ret = avformat_write_header(ctx, &opts)) < 0) { - goto fail; -} +if ((ret = avformat_write_header(ctx, &opts)) < 0) +return ret; os->ctx_inited = 1; avio_flush(ctx->pb); av_dict_free(&opts); @@ -693,15 +680,11 @@ static int dash_write_header(AVFormatContext *s) if (!c->has_video && c->min_seg_duration <= 0) { av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration set\n"); -ret = AVERROR(EINVAL); +return AVERROR(EINVAL); } ret = write_manifest(s, 0); if (!ret) av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename); - -fail: -if (ret) -dash_free(s); return ret; } @@ -992,7 +975,6 @@ static int dash_write_trailer(AVFormatContext *s) unlink(s->filename); } -dash_free(s); return 0; } @@ -1029,6 +1011,7 @@ AVOutputFormat ff_dash_muxer = { .write_header = dash_write_header, .write_packet = dash_write_packet, .write_trailer = dash_write_trailer, +.deinit = dash_free, .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 }, .priv_class = &dash_class, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mux: add avformat_init_output
ffmpeg | branch: master | Rodger Combs | Fri Jun 24 22:02:50 2016 -0500| [a246fef163387c0d79830a9bdf408443a9aba1c1] | committer: Rodger Combs lavf/mux: add avformat_init_output This allows a consumer to run the muxer's init function without actually writing the header, which is useful in chained muxers that support automatic bitstream filtering. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a246fef163387c0d79830a9bdf408443a9aba1c1 --- doc/APIchanges | 3 +++ libavformat/avformat.h | 34 +++-- libavformat/internal.h | 10 libavformat/mux.c | 68 +++--- libavformat/version.h | 2 +- 5 files changed, 100 insertions(+), 17 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 502ab3f..5017eb4 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-10-24 - xxx - lavf 57.54.100 - avformat.h + Add avformat_init_output() and AVSTREAM_INIT_IN_ macros + 2016-10-22 - xxx - lavu 55.33.100 - avassert.h Add av_assert0_fpu() / av_assert2_fpu() diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 057f8c5..82ca727 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -618,6 +618,8 @@ typedef struct AVOutputFormat { * AVStream parameters that need to be set before packets are sent. * This method must not write output. * + * Return 0 if streams were fully configured, 1 if not, negative AVERROR on failure + * * Any allocations made here must be freed in deinit(). */ int (*init)(struct AVFormatContext *); @@ -2374,6 +2376,10 @@ void avformat_close_input(AVFormatContext **s); * @addtogroup lavf_encoding * @{ */ + +#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in avformat_write_header +#define AVSTREAM_INIT_IN_INIT_OUTPUT 1 ///< stream parameters initialized in avformat_init_output + /** * Allocate the stream private data and write the stream header to * an output media file. @@ -2385,14 +2391,38 @@ void avformat_close_input(AVFormatContext **s); * On return this parameter will be destroyed and replaced with a dict containing * options that were not found. May be NULL. * - * @return 0 on success, negative AVERROR on failure. + * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not already been fully initialized in avformat_init, + * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec had already been fully initialized in avformat_init, + * negative AVERROR on failure. * - * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_init_output. */ av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options); /** + * Allocate the stream private data and initialize the codec, but do not write the header. + * May optionally be used before avformat_write_header to initialize stream parameters + * before actually writing the header. + * If using this function, do not pass the same options to avformat_write_header. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires avformat_write_header to fully initialize, + * AVSTREAM_INIT_IN_INIT_OUTPUT on success if the codec has been fully initialized, + * negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, avformat_write_header. + */ +av_warn_unused_result +int avformat_init_output(AVFormatContext *s, AVDictionary **options); + +/** * Write a packet to an output media file. * * This function passes the packet directly to the muxer, without any buffering diff --git a/libavformat/internal.h b/libavformat/internal.h index 95776a0..da64c64 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -130,6 +130,16 @@ struct AVFormatInternal { * Timestamp of the end of the shortest stream. */ int64_t shortest_end; + +/** + * Whether or not avformat_init_output has already been called + */ +int initialized; + +/** + * Whether or not avformat_init_output fully initialized streams + */ +int streams_initialized; }; struct AVStreamInternal { diff --git a/libavformat/mux.c b/libavformat/mux.c index bbfc0fc..06d87de 100644 --- a/libavform
[FFmpeg-cvslog] lavf/mov: improve `tref/chap` chapter handling
ffmpeg | branch: master | Rodger Combs | Thu Jan 7 17:14:08 2016 -0600| [697400eac07c0614f6b9f2e7615563982dbcbe4a] | committer: Rodger Combs lavf/mov: improve `tref/chap` chapter handling 3 parts: - Supports multiple chapter streams - Exports regular text chapter streams as opaque data. This prevents consumers from showing chapters as if they were regular subtitle streams. - Exports video chapter streams as thumbnails, and provides the first one as an attached_pic. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=697400eac07c0614f6b9f2e7615563982dbcbe4a --- libavformat/isom.h | 3 ++- libavformat/mov.c | 54 +++--- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index 2246fed..9038057 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -210,7 +210,8 @@ typedef struct MOVContext { unsigned trex_count; int itunes_metadata; ///< metadata are itunes style int handbrake_version; -int chapter_track; +int *chapter_tracks; +unsigned int nb_chapter_tracks; int use_absolute_path; int ignore_editlist; int ignore_chapters; diff --git a/libavformat/mov.c b/libavformat/mov.c index dada1e0..bf25db9 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3992,7 +3992,20 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom) { -c->chapter_track = avio_rb32(pb); +unsigned i, num; +void *new_tracks; + +num = atom.size / 4; +if (!(new_tracks = av_malloc_array(num, sizeof(int +return AVERROR(ENOMEM); + +av_free(c->chapter_tracks); +c->chapter_tracks = new_tracks; +c->nb_chapter_tracks = num; + +for (i = 0; i < num && !pb->eof_reached; i++) +c->chapter_tracks[i] = avio_rb32(pb); + return 0; } @@ -5055,25 +5068,50 @@ static int mov_probe(AVProbeData *p) static void mov_read_chapters(AVFormatContext *s) { MOVContext *mov = s->priv_data; -AVStream *st = NULL; +AVStream *st; MOVStreamContext *sc; int64_t cur_pos; -int i; +int i, j; +int chapter_track; +for (j = 0; j < mov->nb_chapter_tracks; j++) { +chapter_track = mov->chapter_tracks[j]; +st = NULL; for (i = 0; i < s->nb_streams; i++) -if (s->streams[i]->id == mov->chapter_track) { +if (s->streams[i]->id == chapter_track) { st = s->streams[i]; break; } if (!st) { av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); -return; +continue; } -st->discard = AVDISCARD_ALL; sc = st->priv_data; cur_pos = avio_tell(sc->pb); +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { +st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; +if (st->nb_index_entries) { +// Retrieve the first frame, if possible +AVPacket pkt; +AVIndexEntry *sample = &st->index_entries[0]; +if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { +av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n"); +goto finish; +} + +if (av_get_packet(sc->pb, &pkt, sample->size) < 0) +goto finish; + +st->attached_pic = pkt; +st->attached_pic.stream_index = st->index; +st->attached_pic.flags |= AV_PKT_FLAG_KEY; +} +} else { +st->codecpar->codec_type = AVMEDIA_TYPE_DATA; +st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; +st->discard = AVDISCARD_ALL; for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; @@ -5122,8 +5160,10 @@ static void mov_read_chapters(AVFormatContext *s) avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } +} finish: avio_seek(sc->pb, cur_pos, SEEK_SET); +} } static int parse_timecode_in_framenum_format(AVFormatContext *s, AVStream *st, @@ -5446,7 +5486,7 @@ static int mov_read_header(AVFormatContext *s) av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); if (pb->seekable) { -if (mov->chapter_track > 0 && !mov->ignore_chapters) +if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters) mov_read_chapters(s); for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->codecpar->codec_tag == AV_RL32("tmcd")) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: reindent
ffmpeg | branch: master | Rodger Combs | Thu Jan 7 19:04:00 2016 -0600| [490c6bda0e35498a24936fd1524317aeebed026b] | committer: Rodger Combs lavf/mov: reindent Reviewed-By: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=490c6bda0e35498a24936fd1524317aeebed026b --- libavformat/mov.c | 156 +++--- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index bf25db9..357d800 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5075,94 +5075,94 @@ static void mov_read_chapters(AVFormatContext *s) int chapter_track; for (j = 0; j < mov->nb_chapter_tracks; j++) { -chapter_track = mov->chapter_tracks[j]; -st = NULL; -for (i = 0; i < s->nb_streams; i++) -if (s->streams[i]->id == chapter_track) { -st = s->streams[i]; -break; +chapter_track = mov->chapter_tracks[j]; +st = NULL; +for (i = 0; i < s->nb_streams; i++) +if (s->streams[i]->id == chapter_track) { +st = s->streams[i]; +break; +} +if (!st) { +av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); +continue; } -if (!st) { -av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); -continue; -} -sc = st->priv_data; -cur_pos = avio_tell(sc->pb); +sc = st->priv_data; +cur_pos = avio_tell(sc->pb); + +if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { +st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; +if (st->nb_index_entries) { +// Retrieve the first frame, if possible +AVPacket pkt; +AVIndexEntry *sample = &st->index_entries[0]; +if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { +av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n"); +goto finish; +} -if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { -st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; -if (st->nb_index_entries) { -// Retrieve the first frame, if possible -AVPacket pkt; -AVIndexEntry *sample = &st->index_entries[0]; -if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { -av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n"); -goto finish; -} +if (av_get_packet(sc->pb, &pkt, sample->size) < 0) +goto finish; -if (av_get_packet(sc->pb, &pkt, sample->size) < 0) -goto finish; +st->attached_pic = pkt; +st->attached_pic.stream_index = st->index; +st->attached_pic.flags |= AV_PKT_FLAG_KEY; +} +} else { +st->codecpar->codec_type = AVMEDIA_TYPE_DATA; +st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; +st->discard = AVDISCARD_ALL; +for (i = 0; i < st->nb_index_entries; i++) { +AVIndexEntry *sample = &st->index_entries[i]; +int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; +uint8_t *title; +uint16_t ch; +int len, title_len; + +if (end < sample->timestamp) { +av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); +end = AV_NOPTS_VALUE; +} -st->attached_pic = pkt; -st->attached_pic.stream_index = st->index; -st->attached_pic.flags |= AV_PKT_FLAG_KEY; -} -} else { -st->codecpar->codec_type = AVMEDIA_TYPE_DATA; -st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; -st->discard = AVDISCARD_ALL; -for (i = 0; i < st->nb_index_entries; i++) { -AVIndexEntry *sample = &st->index_entries[i]; -int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; -uint8_t *title; -uint16_t ch; -int len, title_len; - -if (end < sample->timestamp) { -av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); -end = AV_NOPTS_VALUE; -} +if (avio_seek(sc->pb, sample->pos, SEEK_SET) != samp
[FFmpeg-cvslog] lavf: add AV_DISPOSITION_TIMED_THUMBNAILS
ffmpeg | branch: master | Rodger Combs | Mon Oct 24 05:47:05 2016 -0500| [73ead477ddd9dbfbe6f7e8d3fc90ebfd21b271b0] | committer: Rodger Combs lavf: add AV_DISPOSITION_TIMED_THUMBNAILS Reviewed-By: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73ead477ddd9dbfbe6f7e8d3fc90ebfd21b271b0 --- doc/APIchanges | 3 +++ doc/ffprobe.xsd | 1 + ffprobe.c | 1 + libavformat/avformat.h | 12 +--- libavformat/version.h | 2 +- tests/ref/fate/concat-demuxer-extended-lavf-mxf | 2 +- tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 | 2 +- tests/ref/fate/concat-demuxer-simple1-lavf-mxf | 4 ++-- tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 | 4 ++-- tests/ref/fate/concat-demuxer-simple2-lavf-ts | 4 ++-- tests/ref/fate/ffprobe_compact | 6 +++--- tests/ref/fate/ffprobe_csv | 6 +++--- tests/ref/fate/ffprobe_default | 3 +++ tests/ref/fate/ffprobe_flat | 3 +++ tests/ref/fate/ffprobe_ini | 3 +++ tests/ref/fate/ffprobe_json | 9 ++--- tests/ref/fate/ffprobe_xml | 6 +++--- 17 files changed, 47 insertions(+), 24 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 5017eb4..eaa6e56 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-10-24 - xxx - lavf 57.55.100 - avformat.h + Add AV_DISPOSITION_TIMED_THUMBNAILS + 2016-10-24 - xxx - lavf 57.54.100 - avformat.h Add avformat_init_output() and AVSTREAM_INIT_IN_ macros diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd index ac0347f..f64656a 100644 --- a/doc/ffprobe.xsd +++ b/doc/ffprobe.xsd @@ -166,6 +166,7 @@ + diff --git a/ffprobe.c b/ffprobe.c index 7cd0034..a2980b3 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -2383,6 +2383,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id PRINT_DISPOSITION(VISUAL_IMPAIRED, "visual_impaired"); PRINT_DISPOSITION(CLEAN_EFFECTS,"clean_effects"); PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic"); +PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails"); writer_print_section_footer(w); } diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 82ca727..f9f4d72 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -842,11 +842,17 @@ typedef struct AVIndexEntry { #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ /** * The stream is stored in the file as an attached picture/"cover art" (e.g. - * APIC frame in ID3v2). The single packet associated with it will be returned - * among the first few packets read from the file unless seeking takes place. - * It can also be accessed at any time in AVStream.attached_pic. + * APIC frame in ID3v2). The first (usually only) packet associated with it + * will be returned among the first few packets read from the file unless + * seeking takes place. It can also be accessed at any time in + * AVStream.attached_pic. */ #define AV_DISPOSITION_ATTACHED_PIC 0x0400 +/** + * The stream is sparse, and contains thumbnail images, often corresponding + * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC. + */ +#define AV_DISPOSITION_TIMED_THUMBNAILS 0x0800 typedef struct AVStreamInternal AVStreamInternal; diff --git a/libavformat/version.h b/libavformat/version.h index addff03..c4db5a5 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 57 -#define LIBAVFORMAT_VERSION_MINOR 54 +#define LIBAVFORMAT_VERSION_MINOR 55 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf b/tests/ref/fate/concat-demuxer-extended-lavf-mxf index 8bb2fb0..f6b1010 100644 --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf +++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf @@ -1 +1 @@ -a277e04c23cf764abe692ca07e87b82e *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe +32fe9ae5b89c7802c804ac51f62d89cb *tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 index e294538..6d84589 100644 --- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 +++ b/test
[FFmpeg-cvslog] lavfi/vf_overlay: support NV12 and NV21
ffmpeg | branch: master | Rodger Combs | Tue Oct 25 01:28:43 2016 -0500| [f53c26c694c94bb93fb49d72b6439b792b125fe8] | committer: Rodger Combs lavfi/vf_overlay: support NV12 and NV21 Tested-by: Michael on x86-32/64 linux, mingw, mips/arm qemu linux > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f53c26c694c94bb93fb49d72b6439b792b125fe8 --- libavfilter/vf_overlay.c| 22 +- tests/fate/filter-video.mak | 10 ++ tests/filtergraphs/overlay_nv12 | 5 + tests/filtergraphs/overlay_nv21 | 5 + 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index c592dca..b249ad7 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -125,6 +125,7 @@ typedef struct OverlayContext { int main_pix_step[4]; ///< steps per pixel for each plane of the main output int overlay_pix_step[4];///< steps per pixel for each plane of the overlay int hsub, vsub; ///< chroma subsampling values +const AVPixFmtDescriptor *main_desc; ///< format descriptor for main input double var_values[VAR_VARS_NB]; char *x_expr, *y_expr; @@ -215,7 +216,9 @@ static int query_formats(AVFilterContext *ctx) /* overlay formats contains alpha, for avoiding conversion with alpha information loss */ static const enum AVPixelFormat main_pix_fmts_yuv420[] = { -AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE +AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVA420P, +AV_PIX_FMT_NV12, AV_PIX_FMT_NV21, +AV_PIX_FMT_NONE }; static const enum AVPixelFormat overlay_pix_fmts_yuv420[] = { AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE @@ -470,6 +473,7 @@ static av_always_inline void blend_plane(AVFilterContext *ctx, int x, int y, int main_has_alpha) { +OverlayContext *ol = ctx->priv; int src_wp = AV_CEIL_RSHIFT(src_w, hsub); int src_hp = AV_CEIL_RSHIFT(src_h, vsub); int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub); @@ -479,14 +483,20 @@ static av_always_inline void blend_plane(AVFilterContext *ctx, uint8_t *s, *sp, *d, *dp, *a, *ap; int jmax, j, k, kmax; +int dst_plane = ol->main_desc->comp[i].plane; +int dst_offset = ol->main_desc->comp[i].offset; +int dst_step = ol->main_desc->comp[i].step; + j = FFMAX(-yp, 0); sp = src->data[i] + j * src->linesize[i]; -dp = dst->data[i] + (yp+j)* dst->linesize[i]; +dp = dst->data[dst_plane] + + (yp+j)* dst->linesize[dst_plane] + + dst_offset; ap = src->data[3] + (j<linesize[3]; for (jmax = FFMIN(-yp + dst_hp, src_hp); j < jmax; j++) { k = FFMAX(-xp, 0); -d = dp + xp+k; +d = dp + (xp+k) * dst_step; s = sp + k; a = ap + (k<linesize[i]; +dp += dst->linesize[dst_plane]; sp += src->linesize[i]; ap += (1 << vsub) * src->linesize[3]; } @@ -626,6 +636,8 @@ static int config_input_main(AVFilterLink *inlink) s->hsub = pix_desc->log2_chroma_w; s->vsub = pix_desc->log2_chroma_h; +s->main_desc = pix_desc; + s->main_is_packed_rgb = ff_fill_rgba_map(s->main_rgba_map, inlink->format) >= 0; s->main_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts); diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index e2513f5..ec22d25 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -172,6 +172,16 @@ FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_F fate-filter-overlay_yuv420: tests/data/filtergraphs/overlay_yuv420 fate-filter-overlay_yuv420: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv420 +FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_nv12 +fate-filter-overlay_nv12: tests/data/filtergraphs/overlay_nv12 +fate-filter-overlay_nv12: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_nv12 +fate-filter-overlay_nv12: REF = $(SRC_PATH)/tests/ref/fate/filter-overlay_yuv420 + +FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_nv21 +fate-filter-overlay_nv21: tests/data/filtergraphs/overlay_nv21 +fate-filter-overlay_nv21: CMD = framecrc -c:v pgmyuv -i $(SRC) -filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_nv21 +fate-filter-overlay_nv21: REF = $(SRC_PATH)/tests/ref/fate/filter-overlay_yuv420 + FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER OVERLAY_FILTER) += fate-filter-overlay_yuv4
[FFmpeg-cvslog] lavf/matroskaenc: fix uninitialized read
ffmpeg | branch: master | Rodger Combs | Thu Oct 27 01:09:23 2016 -0500| [be28ce210d5674603838e67509fc597f30c1bb1c] | committer: Rodger Combs lavf/matroskaenc: fix uninitialized read > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be28ce210d5674603838e67509fc597f30c1bb1c --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 5704119..56174ff 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1547,7 +1547,7 @@ static int mkv_write_attachments(AVFormatContext *s) mkv->attachments = av_mallocz(sizeof(*mkv->attachments)); if (!mkv->attachments) -return ret; +return AVERROR(ENOMEM); av_lfg_init(&c, av_get_random_seed()); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskaenc: don't try to modify the header when live-streaming
ffmpeg | branch: master | Rodger Combs | Thu Oct 27 01:10:47 2016 -0500| [1a958f4eb0984fada564a5648d211b408ebb8c3d] | committer: Rodger Combs lavf/matroskaenc: don't try to modify the header when live-streaming > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a958f4eb0984fada564a5648d211b408ebb8c3d --- libavformat/matroskaenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 56174ff..78540fb 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1783,7 +1783,7 @@ static int mkv_write_header(AVFormatContext *s) put_ebml_void(pb, 11); // assumes double-precision float to be written } } -if (s->pb->seekable) +if (s->pb->seekable && !mkv->is_live) put_ebml_void(s->pb, avio_tell(pb)); else end_ebml_master_crc32(s->pb, &mkv->info_bc, mkv, mkv->info); @@ -2274,7 +2274,7 @@ static int mkv_write_trailer(AVFormatContext *s) return ret; } -if (pb->seekable) { +if (pb->seekable && !mkv->is_live) { if (mkv->cues->num_entries) { if (mkv->reserve_cues_space) { int64_t cues_end; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/fate/avformat: add segment.c tests
ffmpeg | branch: master | Rodger Combs | Thu Oct 27 01:16:08 2016 -0500| [d401c37ef5036a12c03d4cbdbbde561d9a7ba4b3] | committer: Rodger Combs tests/fate/avformat: add segment.c tests > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d401c37ef5036a12c03d4cbdbbde561d9a7ba4b3 --- tests/fate/avformat.mak | 56 +++ tests/ref/fate/segment-adts-to-mkv-header-000 | 21 tests/ref/fate/segment-adts-to-mkv-header-001 | 22 + tests/ref/fate/segment-adts-to-mkv-header-002 | 9 ++ tests/ref/fate/segment-adts-to-mkv-header-all | 40 tests/ref/fate/segment-mp4-to-ts | 132 ++ 6 files changed, 280 insertions(+) diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak index bbb1f98..0a3800b 100644 --- a/tests/fate/avformat.mak +++ b/tests/fate/avformat.mak @@ -81,3 +81,59 @@ $(FATE_LAVF_FATE): CMD = lavffatetest FATE_SAMPLES_FFMPEG += $(FATE_LAVF_FATE) fate-lavf-fate:$(FATE_LAVF_FATE) + +tests/data/mp4-to-ts.m3u8: TAG = GEN +tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ +-i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 \ +-f ssegment -segment_time 1 -map 0 -flags +bitexact -codec copy \ +-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/mp4-to-ts-%03d.ts 2>/dev/null + +tests/data/adts-to-mkv.m3u8: TAG = GEN +tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ +-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ +-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ +-segment_list $(TARGET_PATH)/$@ -y $(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null + +tests/data/adts-to-mkv-header.mkv: TAG = GEN +tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data + $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \ +-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts \ +-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 \ +-segment_header_filename $(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \ +-y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null + +tests/data/adts-to-mkv-header-%.mkv: tests/data/adts-to-mkv-header.mkv ; + +FATE_SEGMENT_PARTS += 000 001 002 + +tests/data/adts-to-mkv-cated-all.mkv: TAG = GEN +tests/data/adts-to-mkv-cated-all.mkv: tests/data/adts-to-mkv-header.mkv $(FATE_SEGMENT_PARTS:%=tests/data/adts-to-mkv-header-%.mkv) | tests/data + $(M)cat $^ >$@ + +tests/data/adts-to-mkv-cated-%.mkv: TAG = GEN +tests/data/adts-to-mkv-cated-%.mkv: tests/data/adts-to-mkv-header.mkv tests/data/adts-to-mkv-header-%.mkv | tests/data + $(M)cat $^ >$@ + +FATE_SEGMENT += fate-segment-mp4-to-ts +fate-segment-mp4-to-ts: tests/data/mp4-to-ts.m3u8 +fate-segment-mp4-to-ts: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/mp4-to-ts.m3u8 -c copy +FATE_SEGMENT-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF MPEGTS_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-mp4-to-ts + +FATE_SEGMENT += fate-segment-adts-to-mkv +fate-segment-adts-to-mkv: tests/data/adts-to-mkv.m3u8 +fate-segment-adts-to-mkv: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/adts-to-mkv.m3u8 -c copy +fate-segment-adts-to-mkv: REF = $(SRC_PATH)/tests/ref/fate/segment-adts-to-mkv-header-all +FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-adts-to-mkv + +FATE_SEGMENT_ALLPARTS = $(FATE_SEGMENT_PARTS) +FATE_SEGMENT_ALLPARTS += all +FATE_SEGMENT_SPLIT += $(FATE_SEGMENT_ALLPARTS:%=fate-segment-adts-to-mkv-header-%) +$(foreach N,$(FATE_SEGMENT_ALLPARTS),$(eval $(N:%=fate-segment-adts-to-mkv-header-%): tests/data/adts-to-mkv-cated-$(N).mkv)) +fate-segment-adts-to-mkv-header-%: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/$(@:fate-segment-adts-to-mkv-header-%=adts-to-mkv-cated-%).mkv -c copy +FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += $(FATE_SEGMENT_SPLIT) + +FATE_SAMPLES_FFMPEG += $(FATE_SEGMENT-yes) + +fate-segment: $(FATE_SEGMENT-yes) diff --git a/tests/ref/fate/segment-adts-to-mkv-header-000 b/tests/ref/fate/segment-adts-to-mkv-header-000 new file mode 100644 index 000..d00e886 --- /dev/null +++ b/tests/ref/fate/segment-adts-to-mkv-header-000 @@ -0,0 +1,21 @@ +#extradata 0:2, 0x0030001c +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 16000 +#channel_layout 0: 4 +0, 0, 0, 64,4, 0x02f70117 +0, 64, 64, 64, 163, 0xd5f85007 +0,128,128, 64, 127, 0x66484065 +0,192,192,
[FFmpeg-cvslog] lavf/segment: fix autobsf
ffmpeg | branch: master | Rodger Combs | Wed Oct 26 22:03:02 2016 -0500| [8e6478b723affe4d44f94d34b98e0c47f6a0b411] | committer: Rodger Combs lavf/segment: fix autobsf > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e6478b723affe4d44f94d34b98e0c47f6a0b411 --- libavformat/segment.c | 40 +++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 868f0a8..9b3dc17 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -798,9 +798,26 @@ static int seg_write_header(AVFormatContext *s) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; -int ret; +int ret, i; if (!seg->header_written) { +for (i = 0; i < s->nb_streams; i++) { +AVStream *st = oc->streams[i]; +AVCodecParameters *ipar, *opar; + +ipar = s->streams[i]->codecpar; +opar = oc->streams[i]->codecpar; +avcodec_parameters_copy(opar, ipar); +if (!oc->oformat->codec_tag || +av_codec_get_id (oc->oformat->codec_tag, ipar->codec_tag) == opar->codec_id || +av_codec_get_tag(oc->oformat->codec_tag, ipar->codec_id) <= 0) { +opar->codec_tag = ipar->codec_tag; +} else { +opar->codec_tag = 0; +} +st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; +st->time_base = s->streams[i]->time_base; +} ret = avformat_write_header(oc, NULL); if (ret < 0) return ret; @@ -978,6 +995,25 @@ fail: return ret; } +static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +SegmentContext *seg = s->priv_data; +AVFormatContext *oc = seg->avf; +if (oc->oformat->check_bitstream) { +int ret = oc->oformat->check_bitstream(oc, pkt); +if (ret == 1) { +AVStream *st = s->streams[pkt->stream_index]; +AVStream *ost = oc->streams[pkt->stream_index]; +st->internal->bsfcs = ost->internal->bsfcs; +st->internal->nb_bsfcs = ost->internal->nb_bsfcs; +ost->internal->bsfcs = NULL; +ost->internal->nb_bsfcs = 0; +} +return ret; +} +return 1; +} + #define OFFSET(x) offsetof(SegmentContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { @@ -1041,6 +1077,7 @@ AVOutputFormat ff_segment_muxer = { .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, +.check_bitstream = seg_check_bitstream, .priv_class = &seg_class, }; @@ -1061,5 +1098,6 @@ AVOutputFormat ff_stream_segment_muxer = { .write_packet = seg_write_packet, .write_trailer = seg_write_trailer, .deinit = seg_free, +.check_bitstream = seg_check_bitstream, .priv_class = &sseg_class, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mux: don't warn about missing timestamps on attached pictures
ffmpeg | branch: master | Rodger Combs | Sat Nov 12 18:01:52 2016 -0600| [f8e3ebde56e8f6ad88fc747d6cf29819c4bb0026] | committer: Rodger Combs lavf/mux: don't warn about missing timestamps on attached pictures > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f8e3ebde56e8f6ad88fc747d6cf29819c4bb0026 --- libavformat/mux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/mux.c b/libavformat/mux.c index 4d47ddc..e500531 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -575,6 +575,7 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket * if (!s->internal->missing_ts_warning && !(s->oformat->flags & AVFMT_NOTIMESTAMPS) && +(!(st->disposition & AV_DISPOSITION_ATTACHED_PIC) || (st->disposition & AV_DISPOSITION_TIMED_THUMBNAILS)) && (pkt->pts == AV_NOPTS_VALUE || pkt->dts == AV_NOPTS_VALUE)) { av_log(s, AV_LOG_WARNING, "Timestamps are unset in a packet for stream %d. " ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/segment: fix crash when failing to open segment list
ffmpeg | branch: master | Rodger Combs | Fri Jan 20 20:15:03 2017 -0600| [2b202900618d82030384d46c8d9c3dbf3fe1d7ed] | committer: Rodger Combs lavf/segment: fix crash when failing to open segment list This happens because segment_end() returns an error, so seg_write_packet never proceeds to segment_start(), and seg->avf->pb is never re-set, so we crash with a null pb when av_write_trailer flushes the packet queue. This doesn't seem to be clearly recoverable, so I'm just failing more gracefully. Repro: ffmpeg -i input.ts -f segment -c copy -segment_list /noaxx.m3u8 test-%05d.ts (assuming you don't have write access to /) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2b202900618d82030384d46c8d9c3dbf3fe1d7ed --- libavformat/segment.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/segment.c b/libavformat/segment.c index 9b3dc17..9d47148 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -354,6 +354,9 @@ static int segment_end(AVFormatContext *s, int write_trailer, int is_last) int i; int err; +if (!oc || !oc->pb) +return AVERROR(EINVAL); + av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */ if (write_trailer) ret = av_write_trailer(oc); @@ -850,7 +853,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) int64_t usecs; int64_t wrapped_val; -if (!seg->avf) +if (!seg->avf || !seg->avf->pb) return AVERROR(EINVAL); calc_times: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/videotoolboxdec: fix crop handling when multithreaded
ffmpeg | branch: master | Rodger Combs | Fri Sep 6 22:31:06 2019 -0500| [77937a42e7127271bd50d7f8035c3ebd5a1047c5] | committer: Aman Gupta lavc/videotoolboxdec: fix crop handling when multithreaded This was partially fixed by 233cd89, but it made changes to AVFrame fields from within end_frame, which doesn't work consistently when multithreading is enabled. This is what the post_process function is for. Signed-off-by: Aman Gupta > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77937a42e7127271bd50d7f8035c3ebd5a1047c5 --- libavcodec/videotoolbox.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 67e5b54932..e9b3370169 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame) return AVERROR_EXTERNAL; } +frame->crop_right = 0; +frame->crop_left = 0; +frame->crop_top = 0; +frame->crop_bottom = 0; + frame->data[3] = (uint8_t*)ref->pixbuf; if (ref->hw_frames_ctx) { @@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame) AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx); VTContext *vtctx = avctx->internal->hwaccel_priv_data; -frame->crop_right = 0; -frame->crop_left = 0; -frame->crop_top = 0; -frame->crop_bottom = 0; - if (vtctx->reconfig_needed == true) { vtctx->reconfig_needed = false; av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, restarting..\n"); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] ADPCM: Bump THP channel limit to 14
ffmpeg | branch: master | Rodger Combs | Fri Sep 11 09:04:23 2015 -0500| [3f9fa2d0b58b142b165d4a8eaa61d7e837a76838] | committer: Michael Niedermayer ADPCM: Bump THP channel limit to 14 Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f9fa2d0b58b142b165d4a8eaa61d7e837a76838 --- libavcodec/adpcm.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 52d0d44..ba38041 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -84,7 +84,7 @@ static const int swf_index_tables[4][16] = { /* end of tables */ typedef struct ADPCMDecodeContext { -ADPCMChannelStatus status[10]; +ADPCMChannelStatus status[14]; int vqa_version;/**< VQA version. Used for ADPCM_IMA_WS */ int has_status; } ADPCMDecodeContext; @@ -109,7 +109,7 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) break; case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: -max_channels = 10; +max_channels = 14; break; } if (avctx->channels < min_channels || avctx->channels > max_channels) { @@ -1431,7 +1431,7 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, case AV_CODEC_ID_ADPCM_THP: case AV_CODEC_ID_ADPCM_THP_LE: { -int table[10][16]; +int table[14][16]; int ch; #define THP_GET16(g) \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/avstring: switch AV_ESCAPE_FLAGs to shift-based formatting
ffmpeg | branch: master | Rodger Combs | Thu Sep 10 11:12:15 2015 -0500| [8e924629ebdec78674e08cf905d378f70f518fa0] | committer: Michael Niedermayer lavu/avstring: switch AV_ESCAPE_FLAGs to shift-based formatting Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e924629ebdec78674e08cf905d378f70f518fa0 --- libavutil/avstring.h |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 466edaf..234c030 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -300,14 +300,14 @@ enum AVEscapeMode { * characters lists, except it is guaranteed to use the exact same list * of whitespace characters as the rest of libavutil. */ -#define AV_ESCAPE_FLAG_WHITESPACE 0x01 +#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) /** * Escape only specified special characters. * Without this flag, escape also any characters that may be considered * special by av_get_token(), such as the single quote. */ -#define AV_ESCAPE_FLAG_STRICT 0x02 +#define AV_ESCAPE_FLAG_STRICT (1 << 1) /** * Escape string in src, and put the escaped string in an allocated ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroska: ignore ChapCountry ID for now
ffmpeg | branch: master | Rodger Combs | Sun Sep 20 09:34:05 2015 -0500| [cf2719abeecb0a656d9bceebfca1a45e64f0cef7] | committer: Michael Niedermayer lavf/matroska: ignore ChapCountry ID for now Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf2719abeecb0a656d9bceebfca1a45e64f0cef7 --- libavformat/matroska.h|1 + libavformat/matroskadec.c |5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 344b2c3..a654e0c 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -218,6 +218,7 @@ #define MATROSKA_ID_CHAPTERDISPLAY 0x80 #define MATROSKA_ID_CHAPSTRING 0x85 #define MATROSKA_ID_CHAPLANG0x437C +#define MATROSKA_ID_CHAPCOUNTRY 0x437E #define MATROSKA_ID_EDITIONUID 0x45BC #define MATROSKA_ID_EDITIONFLAGHIDDEN 0x45BD #define MATROSKA_ID_EDITIONFLAGDEFAULT 0x45DB diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 43ad9af..7a094a6 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -474,8 +474,9 @@ static const EbmlSyntax matroska_attachments[] = { }; static const EbmlSyntax matroska_chapter_display[] = { -{ MATROSKA_ID_CHAPSTRING, EBML_UTF8, 0, offsetof(MatroskaChapter, title) }, -{ MATROSKA_ID_CHAPLANG, EBML_NONE }, +{ MATROSKA_ID_CHAPSTRING, EBML_UTF8, 0, offsetof(MatroskaChapter, title) }, +{ MATROSKA_ID_CHAPLANG,EBML_NONE }, +{ MATROSKA_ID_CHAPCOUNTRY, EBML_NONE }, { 0 } }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/checkasm: fix stack smash in check_loopfilter
ffmpeg | branch: master | Rodger Combs | Sun Sep 20 12:29:32 2015 -0500| [df2a2643fef47e807d347f880a4eb41b7faf1d14] | committer: Michael Niedermayer tests/checkasm: fix stack smash in check_loopfilter Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df2a2643fef47e807d347f880a4eb41b7faf1d14 --- tests/checkasm/vp9dsp.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c index 146a71f..6c335e9 100644 --- a/tests/checkasm/vp9dsp.c +++ b/tests/checkasm/vp9dsp.c @@ -197,6 +197,9 @@ static void check_loopfilter() midoff = (dir ? 16 * 8 : 8) * SIZEOF_PIXEL; midoff_aligned = (dir ? 16 * 8 : 16) * SIZEOF_PIXEL; +buf0 = base0 + midoff_aligned; +buf1 = base1 + midoff_aligned; + // 16wd_16px loopfilter if (check_func(dsp.loop_filter_16[dir], "vp9_loop_filter_%s_16_16_%dbpp", ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/checkasm: make randomize_buffers a function for easier debugging
ffmpeg | branch: master | Rodger Combs | Sun Sep 20 21:55:33 2015 -0500| [f559812a84374bd7f5c225be991e62cff83fd089] | committer: Michael Niedermayer tests/checkasm: make randomize_buffers a function for easier debugging Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f559812a84374bd7f5c225be991e62cff83fd089 --- tests/checkasm/vp9dsp.c | 108 +-- 1 file changed, 57 insertions(+), 51 deletions(-) diff --git a/tests/checkasm/vp9dsp.c b/tests/checkasm/vp9dsp.c index eb9228a..46af118 100644 --- a/tests/checkasm/vp9dsp.c +++ b/tests/checkasm/vp9dsp.c @@ -106,58 +106,64 @@ static void check_ipred(void) // c can be an assignment and must not be put under () #define setdx(a,b,c,d) setpx(a,b,c-(d)+(rnd()%((d)*2+1))) #define setsx(a,b,c,d) setdx(a,b,c,(d) << (bit_depth - 8)) +static void randomize_loopfilter_buffers(int bidx, int lineoff, int str, + int bit_depth, int dir, + int* E, int* F, int* H, int* I, + uint8_t *buf0, uint8_t *buf1) +{ +uint32_t mask = (1 << bit_depth) - 1; +int off = dir ? lineoff : lineoff * 16; +int istride = dir ? 1 : 16; +int jstride = dir ? str : 1; +int i, j; +for (i = 0; i < 2; i++) /* flat16 */ { +int idx = off + i * istride, p0, q0; +setpx(idx, 0, q0 = rnd() & mask); +setsx(idx, -1, p0 = q0, E[bidx] >> 2); +for (j = 1; j < 8; j++) { +setsx(idx, -1 - j, p0, F[bidx]); +setsx(idx, j, q0, F[bidx]); +} +} +for (i = 2; i < 4; i++) /* flat8 */ { +int idx = off + i * istride, p0, q0; +setpx(idx, 0, q0 = rnd() & mask); +setsx(idx, -1, p0 = q0, E[bidx] >> 2); +for (j = 1; j < 4; j++) { +setsx(idx, -1 - j, p0, F[bidx]); +setsx(idx, j, q0, F[bidx]); +} +for (j = 4; j < 8; j++) { +setpx(idx, -1 - j, rnd() & mask); +setpx(idx, j, rnd() & mask); +} +} +for (i = 4; i < 6; i++) /* regular */ { +int idx = off + i * istride, p2, p1, p0, q0, q1, q2; +setpx(idx, 0, q0 = rnd() & mask); +setsx(idx, 1, q1 = q0, I[bidx]); +setsx(idx, 2, q2 = q1, I[bidx]); +setsx(idx, 3, q2, I[bidx]); +setsx(idx, -1, p0 = q0, E[bidx] >> 2); +setsx(idx, -2, p1 = p0, I[bidx]); +setsx(idx, -3, p2 = p1, I[bidx]); +setsx(idx, -4, p2, I[bidx]); +for (j = 4; j < 8; j++) { +setpx(idx, -1 - j, rnd() & mask); +setpx(idx, j, rnd() & mask); +} +} +for (i = 6; i < 8; i++) /* off */ { +int idx = off + i * istride; +for (j = 0; j < 8; j++) { +setpx(idx, -1 - j, rnd() & mask); +setpx(idx, j, rnd() & mask); +} +} +} #define randomize_buffers(bidx, lineoff, str) \ -do { \ -uint32_t mask = (1 << bit_depth) - 1; \ -int off = dir ? lineoff : lineoff * 16; \ -int istride = dir ? 1 : 16; \ -int jstride = dir ? str : 1; \ -int i, j; \ -for (i = 0; i < 2; i++) /* flat16 */ { \ -int idx = off + i * istride, p0, q0; \ -setpx(idx, 0, q0 = rnd() & mask); \ -setsx(idx, -1, p0 = q0, E[bidx] >> 2); \ -for (j = 1; j < 8; j++) { \ -setsx(idx, -1 - j, p0, F[bidx]); \ -setsx(idx, j, q0, F[bidx]); \ -} \ -} \ -for (i = 2; i < 4; i++) /* flat8 */ { \ -int idx = off + i * istride, p0, q0; \ -setpx(idx, 0, q0 = rnd() & mask); \ -setsx(idx, -1, p0 = q0, E[bidx] >> 2); \ -for (j = 1; j < 4; j++) { \ -setsx(idx, -1 - j, p0, F[bidx]); \ -setsx(idx, j, q0, F[bidx]); \ -} \ -for (j = 4; j < 8; j++) { \ -setpx(idx, -1 - j, rnd() & mask); \ -setpx(idx, j, rnd() & mask); \ -} \ -} \ -for (i = 4; i < 6; i++) /* regular */ { \ -int idx = off + i * istride, p2, p1, p0, q0, q1, q2; \ -setpx(idx, 0, q0 = rnd() & mask); \ -setsx(idx, 1, q1 = q0, I[bidx]); \ -setsx(idx, 2, q2 = q1, I[bidx]); \ -setsx(idx, 3, q2, I[bidx]); \ -setsx(idx, -1, p0 = q0, E[bidx] >> 2); \ -setsx(idx, -2, p1 = p0, I[bidx]); \ -setsx(idx, -3, p2 = p1, I[bidx]); \ -setsx(idx, -4, p2, I[bidx]); \ -for (j = 4; j < 8; j++) { \ -setpx(idx, -1 - j, rnd() & mask); \ -setpx(idx, j, rnd() & mask); \ -} \ -} \ -fo
[FFmpeg-cvslog] lavf/utils: avoid giving up probing early with long subtitle events
ffmpeg | branch: master | Rodger Combs | Fri Oct 2 22:39:24 2015 -0500| [9825a24e5b1c34663d672961ebd2561a009b23e9] | committer: Michael Niedermayer lavf/utils: avoid giving up probing early with long subtitle events Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9825a24e5b1c34663d672961ebd2561a009b23e9 --- libavformat/utils.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index dc83608..689473e 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3347,7 +3347,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) break; } if (pkt->duration) { -st->info->codec_info_duration+= pkt->duration; +if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && pkt->pts != AV_NOPTS_VALUE && pkt->pts >= st->start_time) { +st->info->codec_info_duration = FFMIN(pkt->pts - st->start_time, st->info->codec_info_duration + pkt->duration); +} else +st->info->codec_info_duration += pkt->duration; st->info->codec_info_duration_fields += st->parser && st->need_parsing && st->codec->ticks_per_frame ==2 ? st->parser->repeat_pict + 1 : 2; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/hls: allow subtitles to be read despite incomplete handling
ffmpeg | branch: master | Rodger Combs | Mon Sep 21 05:31:24 2015 -0500| [14221b2dd9133ac339a7ed57331ee1a7a3b3a4c4] | committer: Michael Niedermayer lavf/hls: allow subtitles to be read despite incomplete handling This will give incorrect results in some cases due to not parsing segments separately, so it currently requires -strict experimental. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14221b2dd9133ac339a7ed57331ee1a7a3b3a4c4 --- libavformat/hls.c |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index deba61f..ebd3f95 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -183,6 +183,7 @@ typedef struct HLSContext { char *cookies; ///< holds HTTP cookie values set in either the initial response or as an AVOption to the HTTP protocol context char *headers; ///< holds HTTP headers set as an AVOption to the HTTP protocol context AVDictionary *avio_opts; +int strict_std_compliance; } HLSContext; static int read_chomp_line(AVIOContext *s, char *buf, int maxlen) @@ -392,8 +393,9 @@ static struct rendition *new_rendition(HLSContext *c, struct rendition_info *inf return NULL; /* TODO: handle subtitles (each segment has to parsed separately) */ -if (type == AVMEDIA_TYPE_SUBTITLE) -return NULL; +if (c->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) +if (type == AVMEDIA_TYPE_SUBTITLE) +return NULL; rend = av_mallocz(sizeof(struct rendition)); if (!rend) @@ -1317,6 +1319,7 @@ static int hls_read_header(AVFormatContext *s) int ret = 0, i, j, stream_offset = 0; c->interrupt_callback = &s->interrupt_callback; +c->strict_std_compliance = s->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: add chromaprint muxer
ffmpeg | branch: master | Rodger Combs | Sat Oct 3 17:24:06 2015 -0500| [a2b8b163004e643d27d85dcafd220c0ffcce8f59] | committer: Michael Niedermayer lavf: add chromaprint muxer Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2b8b163004e643d27d85dcafd220c0ffcce8f59 --- Changelog |1 + configure |4 + doc/muxers.texi | 35 + libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/chromaprint.c | 186 + libavformat/version.h |4 +- 7 files changed, 230 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index bbb9ed0..4b18d00 100644 --- a/Changelog +++ b/Changelog @@ -14,6 +14,7 @@ version : - chromakey filter - maskedmerge filter - Screenpresso SPV1 decoding +- chromaprint fingerprinting muxer version 2.8: diff --git a/configure b/configure index 305e756..35eabc6 100755 --- a/configure +++ b/configure @@ -196,6 +196,7 @@ Individual component options: External library support: --enable-avisynthenable reading of AviSynth script files [no] --disable-bzlib disable bzlib [autodetect] + --enable-chromaprint enable audio fingerprinting with chromaprint [no] --enable-fontconfig enable fontconfig, useful for drawtext filter [no] --enable-frei0r enable frei0r video filtering [no] --enable-gnutls enable gnutls, needed for https support @@ -1367,6 +1368,7 @@ EXAMPLE_LIST=" EXTERNAL_LIBRARY_LIST=" avisynth bzlib +chromaprint crystalhd decklink frei0r @@ -2507,6 +2509,7 @@ vc1_parser_select="mpegvideo startcode vc1_decoder" mjpeg2jpeg_bsf_select="jpegtables" # external libraries +chromaprint_muxer_deps="chromaprint" libaacplus_encoder_deps="libaacplus" libcelt_decoder_deps="libcelt" libdcadec_decoder_deps="libdcadec" @@ -5255,6 +5258,7 @@ enabled avfoundation_indev && { check_lib2 CoreGraphics/CoreGraphics.h CGGetActi enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } || { check_lib2 "dlfcn.h" dlopen -ldl; } || die "ERROR: LoadLibrary/dlopen not found for avisynth"; } +enabled chromaprint && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init diff --git a/doc/muxers.texi b/doc/muxers.texi index 86ca4ad..91d131f 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -37,6 +37,41 @@ ID3v2.3 and ID3v2.4) are supported. The default is version 4. @end table +@anchor{chromaprint} +@section chromaprint + +Chromaprint fingerprinter + +This muxer feeds audio data to the Chromaprint library, which generates +a fingerprint for the provided audio data. It takes a single signed +native-endian 16-bit raw audio stream. + +@subsection Options + +@table @option +@item silence_threshold +Threshold for detecting silence, ranges from 0 to 32767. -1 for default +(required for use with the AcoustID service). + +@item algorithm +Algorithm index to fingerprint with. + +@item fp_format +Format to output the fingerprint as. Accepts the following options: +@table @samp +@item raw +Binary raw fingerprint + +@item compressed +Binary compressed fingerprint + +@item base64 +Base64 compressed fingerprint + +@end table + +@end table + @anchor{crc} @section crc diff --git a/libavformat/Makefile b/libavformat/Makefile index 8126c0a..2971912 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -487,6 +487,7 @@ OBJS-$(CONFIG_YUV4MPEGPIPE_MUXER)+= yuv4mpegenc.o OBJS-$(CONFIG_YUV4MPEGPIPE_DEMUXER) += yuv4mpegdec.o # external libraries +OBJS-$(CONFIG_CHROMAPRINT_MUXER) += chromaprint.o OBJS-$(CONFIG_LIBGME_DEMUXER)+= libgme.o OBJS-$(CONFIG_LIBMODPLUG_DEMUXER)+= libmodplug.o OBJS-$(CONFIG_LIBNUT_DEMUXER)+= libnut.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 0a24ac7..0ccde9d 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -391,6 +391,7 @@ void av_register_all(void) REGISTER_PROTOCOL(UNIX, unix); /* external libraries */ +REGISTER_MUXER (CHROMAPRINT, chromaprint); REGISTER_DEMUXER (LIBGME, libgme); REGISTER_DEMUXER (LIBMODPLUG, libmodplug); REGISTER_MUXDEMUX(LIBNUT, libnut); diff --git a/libavformat/chromaprint.c b/libavformat/chromaprint.c new file mode 100644 index
[FFmpeg-cvslog] libavformat/tls_securetransport: fix argument evalulation order UB
ffmpeg | branch: master | Rodger Combs | Sun Oct 4 14:37:52 2015 -0500| [854972b53dc7bf3ab59354d430d3b0e7580315f0] | committer: Michael Niedermayer libavformat/tls_securetransport: fix argument evalulation order UB Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=854972b53dc7bf3ab59354d430d3b0e7580315f0 --- libavformat/tls_securetransport.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c index 73662d7..6ad266a 100644 --- a/libavformat/tls_securetransport.c +++ b/libavformat/tls_securetransport.c @@ -350,8 +350,9 @@ static int map_ssl_error(OSStatus status, size_t processed) static int tls_read(URLContext *h, uint8_t *buf, int size) { TLSContext *c = h->priv_data; -size_t processed; -int ret = map_ssl_error(SSLRead(c->ssl_context, buf, size, &processed), processed); +size_t processed = 0; +int ret = SSLRead(c->ssl_context, buf, size, &processed); +ret = map_ssl_error(ret, processed); if (ret > 0) return ret; if (ret == 0) @@ -362,8 +363,9 @@ static int tls_read(URLContext *h, uint8_t *buf, int size) static int tls_write(URLContext *h, const uint8_t *buf, int size) { TLSContext *c = h->priv_data; -size_t processed; -int ret = map_ssl_error(SSLWrite(c->ssl_context, buf, size, &processed), processed); +size_t processed = 0; +int ret = SSLWrite(c->ssl_context, buf, size, &processed); +ret = map_ssl_error(ret, processed); if (ret > 0) return ret; if (ret == 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskadec: drop indexes that appear broken
ffmpeg | branch: master | Rodger Combs | Thu Oct 8 15:34:59 2015 -0500| [4f7d9b77061207142f93bd8c5c417ba189c25bd1] | committer: Michael Niedermayer lavf/matroskadec: drop indexes that appear broken Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f7d9b77061207142f93bd8c5c417ba189c25bd1 --- libavformat/matroskadec.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 9db2b59..02cc6a5 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1521,10 +1521,11 @@ static void matroska_add_index_entries(MatroskaDemuxContext *matroska) index_list = &matroska->index; index = index_list->elem; -if (index_list->nb_elem && -index[0].time > 1E14 / matroska->time_scale) { -av_log(matroska->ctx, AV_LOG_WARNING, "Working around broken index.\n"); -index_scale = matroska->time_scale; +if (index_list->nb_elem < 2) +return; +if (index[1].time > 1E14 / matroska->time_scale) { +av_log(matroska->ctx, AV_LOG_WARNING, "Dropping apparently-broken index.\n"); +return; } for (i = 0; i < index_list->nb_elem; i++) { EbmlList *pos_list= &index[i].pos; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/opt: add flag to return NULL when applicable in av_opt_get
ffmpeg | branch: master | Rodger Combs | Mon Sep 21 04:16:58 2015 -0500| [0562f959021514a6697601e5b3e0690f41c06f4e] | committer: Rodger Combs lavu/opt: add flag to return NULL when applicable in av_opt_get Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0562f959021514a6697601e5b3e0690f41c06f4e --- libavutil/opt.c | 12 ++-- libavutil/opt.h | 10 ++ libavutil/version.h |2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index ce80de0..03160c7 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -666,12 +666,20 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val) case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; case AV_OPT_TYPE_CONST: ret = snprintf(buf, sizeof(buf), "%f" , o->default_val.dbl);break; case AV_OPT_TYPE_STRING: -if (*(uint8_t**)dst) +if (*(uint8_t**)dst) { *out_val = av_strdup(*(uint8_t**)dst); -else +} else if (search_flags & AV_OPT_ALLOW_NULL) { +*out_val = NULL; +return 0; +} else { *out_val = av_strdup(""); +} return *out_val ? 0 : AVERROR(ENOMEM); case AV_OPT_TYPE_BINARY: +if (!*(uint8_t**)dst && (search_flags & AV_OPT_ALLOW_NULL)) { +*out_val = NULL; +return 0; +} len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); if ((uint64_t)len*2 + 1 > INT_MAX) return AVERROR(EINVAL); diff --git a/libavutil/opt.h b/libavutil/opt.h index ef90e9c..753434d 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -564,6 +564,12 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational #define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) /** + * In av_opt_get, return NULL if the option has a pointer type and is set to NULL, + * rather than returning an empty string. + */ +#define AV_OPT_ALLOW_NULL (1 << 2) + +/** * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than * one component for certain option types. * @see AVOptionRanges for details. @@ -722,6 +728,10 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, in */ /** * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller + * + * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has + * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set + * to NULL instead of an allocated empty string. */ int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); diff --git a/libavutil/version.h b/libavutil/version.h index b100b94..e39034d 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 2 +#define LIBAVUTIL_VERSION_MINOR 3 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/opt: switch AV_OPT flags to shift-based formatting
ffmpeg | branch: master | Rodger Combs | Mon Sep 21 04:15:56 2015 -0500| [f36baeebc55d326b0a665b3e3e91792aa81102b7] | committer: Rodger Combs lavu/opt: switch AV_OPT flags to shift-based formatting > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f36baeebc55d326b0a665b3e3e91792aa81102b7 --- libavutil/opt.h |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavutil/opt.h b/libavutil/opt.h index d6d8df3..ef90e9c 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -553,22 +553,22 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational * @} */ -#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the - given object first. */ +#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the + given object first. */ /** * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass * instead of a required pointer to a struct containing AVClass. This is * useful for searching for options without needing to allocate the corresponding * object. */ -#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 +#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) /** * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than * one component for certain option types. * @see AVOptionRanges for details. */ -#define AV_OPT_MULTI_COMPONENT_RANGE 0x1000 +#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12) /** * Look for an option in an object. Consider only options which ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/hls: don't convert NULL options to empty strings; fixes HTTP CRLF warnings
ffmpeg | branch: master | Rodger Combs | Sun Sep 20 21:50:22 2015 -0500| [f00ec7eb1b94b31ffdb11a54adda339f08ace245] | committer: Rodger Combs lavf/hls: don't convert NULL options to empty strings; fixes HTTP CRLF warnings > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f00ec7eb1b94b31ffdb11a54adda339f08ace245 --- libavformat/hls.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index ebd3f95..ff95519 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1300,7 +1300,7 @@ static int save_avio_options(AVFormatContext *s) int ret = 0; while (*opt) { -if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { +if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN | AV_OPT_ALLOW_NULL, &buf) >= 0) { ret = av_dict_set(&c->avio_opts, *opt, buf, AV_DICT_DONT_STRDUP_VAL); if (ret < 0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskadec: Fully parse and repack MP3 packets
ffmpeg | branch: release/2.7 | Rodger Combs | Sun Aug 16 03:06:04 2015 -0500| [6197d35a93bf959527d52efe28f9dd692b0a035f] | committer: Carl Eugen Hoyos lavf/matroskadec: Fully parse and repack MP3 packets Fixes https://trac.ffmpeg.org/ticket/4776 Signed-off-by: Michael Niedermayer (cherry picked from commit b4b2717ffe89940999eeca7317190f729b27f472) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6197d35a93bf959527d52efe28f9dd692b0a035f --- libavformat/matroskadec.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index ca43c28..206d798 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2053,7 +2053,9 @@ static int matroska_parse_tracks(AVFormatContext *s) st->codec->channels= track->audio.channels; if (!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample = track->audio.bitdepth; -if (st->codec->codec_id != AV_CODEC_ID_AAC) +if (st->codec->codec_id == AV_CODEC_ID_MP3) +st->need_parsing = AVSTREAM_PARSE_FULL; +else if (st->codec->codec_id != AV_CODEC_ID_AAC) st->need_parsing = AVSTREAM_PARSE_HEADERS; if (track->codec_delay > 0) { st->codec->delay = av_rescale_q(track->codec_delay, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskadec: Fully parse and repack MP3 packets
ffmpeg | branch: release/2.6 | Rodger Combs | Sun Aug 16 03:06:04 2015 -0500| [e43e2825120f285c4360007098593c7eb8a720f4] | committer: Carl Eugen Hoyos lavf/matroskadec: Fully parse and repack MP3 packets Fixes https://trac.ffmpeg.org/ticket/4776 Signed-off-by: Michael Niedermayer (cherry picked from commit b4b2717ffe89940999eeca7317190f729b27f472) > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e43e2825120f285c4360007098593c7eb8a720f4 --- libavformat/matroskadec.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 114e422..204fac2 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2039,7 +2039,9 @@ static int matroska_parse_tracks(AVFormatContext *s) st->codec->channels= track->audio.channels; if (!st->codec->bits_per_coded_sample) st->codec->bits_per_coded_sample = track->audio.bitdepth; -if (st->codec->codec_id != AV_CODEC_ID_AAC) +if (st->codec->codec_id == AV_CODEC_ID_MP3) +st->need_parsing = AVSTREAM_PARSE_FULL; +else if (st->codec->codec_id != AV_CODEC_ID_AAC) st->need_parsing = AVSTREAM_PARSE_HEADERS; if (track->codec_delay > 0) { st->codec->delay = av_rescale_q(track->codec_delay, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: add support for sidx fragment indexes
ffmpeg | branch: master | Rodger Combs | Mon Jul 20 15:00:35 2015 -0500| [4ab56667594842283dc5ae07f0daba2a2cb4d3af] | committer: Rodger Combs lavf/mov: add support for sidx fragment indexes Fixes trac #3842 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ab56667594842283dc5ae07f0daba2a2cb4d3af --- libavformat/isom.h |2 + libavformat/mov.c | 245 +++- 2 files changed, 208 insertions(+), 39 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index aee9d6e..6e921c0 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -103,6 +103,7 @@ typedef struct MOVSbgp { typedef struct MOVFragmentIndexItem { int64_t moof_offset; int64_t time; +int headers_read; } MOVFragmentIndexItem; typedef struct MOVFragmentIndex { @@ -197,6 +198,7 @@ typedef struct MOVContext { int has_looked_for_mfra; MOVFragmentIndex** fragment_index_data; unsigned fragment_index_count; +int fragment_index_complete; int atom_depth; unsigned int aax_mode; ///< 'aax' file has been detected uint8_t file_key[20]; diff --git a/libavformat/mov.c b/libavformat/mov.c index 78596f5..4c073a3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3349,7 +3349,7 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVFragment *frag = &c->fragment; MOVTrackExt *trex = NULL; MOVFragmentIndex* index = NULL; -int flags, track_id, i; +int flags, track_id, i, found = 0; avio_r8(pb); /* version */ flags = avio_rb24(pb); @@ -3367,15 +3367,6 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n"); return AVERROR_INVALIDDATA; } -for (i = 0; i < c->fragment_index_count; i++) { -MOVFragmentIndex* candidate = c->fragment_index_data[i]; -if (candidate->track_id == frag->track_id) { -av_log(c->fc, AV_LOG_DEBUG, - "found fragment index for track %u\n", frag->track_id); -index = candidate; -break; -} -} frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ? avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ? @@ -3389,24 +3380,33 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) frag->flags= flags & MOV_TFHD_DEFAULT_FLAGS ? avio_rb32(pb) : trex->flags; frag->time = AV_NOPTS_VALUE; -if (index) { -int i, found = 0; -for (i = index->current_item; i < index->item_count; i++) { -if (frag->implicit_offset == index->items[i].moof_offset) { -av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry " -"for track %u and moof_offset %"PRId64"\n", -frag->track_id, index->items[i].moof_offset); -frag->time = index->items[i].time; -index->current_item = i + 1; -found = 1; +for (i = 0; i < c->fragment_index_count; i++) { +int j; +MOVFragmentIndex* candidate = c->fragment_index_data[i]; +if (candidate->track_id == frag->track_id) { +av_log(c->fc, AV_LOG_DEBUG, + "found fragment index for track %u\n", frag->track_id); +index = candidate; +for (j = index->current_item; j < index->item_count; j++) { +if (frag->implicit_offset == index->items[j].moof_offset) { +av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry " +"for track %u and moof_offset %"PRId64"\n", +frag->track_id, index->items[j].moof_offset); +frag->time = index->items[j].time; +index->current_item = j + 1; +found = 1; +break; +} } -} -if (!found) { -av_log(c->fc, AV_LOG_WARNING, "track %u has a fragment index " - "but it doesn't have an (in-order) entry for moof_offset " - "%"PRId64"\n", frag->track_id, frag->implicit_offset); +if (found) +break; } } +if (index && !found) { +av_log(c->fc, AV_LOG_DEBUG, "track %u has a fragment index but " + "it doesn't have an (in-order) entry for moof_offset " + "%"PRId64"\n", frag->track_id, frag->implicit_offset); +} av_log(c->fc, AV_LOG_TRACE, "
[FFmpeg-cvslog] lavc: move bitstream filter args to the bsf ctx
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:09:26 2015 -0500| [0d53a6f5b4f5ccebe3f7b4d8cfd440e07affa509] | committer: Rodger Combs lavc: move bitstream filter args to the bsf ctx > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d53a6f5b4f5ccebe3f7b4d8cfd440e07affa509 --- libavcodec/avcodec.h |5 + libavcodec/bitstream_filter.c |5 +++-- libavcodec/version.h |4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index ff70d25..22a68fb 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -5026,6 +5026,11 @@ typedef struct AVBitStreamFilterContext { struct AVBitStreamFilter *filter; AVCodecParserContext *parser; struct AVBitStreamFilterContext *next; +/** + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). + * Not for access by library users. + */ +char *args; } AVBitStreamFilterContext; diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c index a4e437d..fb690b6 100644 --- a/libavcodec/bitstream_filter.c +++ b/libavcodec/bitstream_filter.c @@ -73,6 +73,7 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc) if (bsfc->filter->close) bsfc->filter->close(bsfc); av_freep(&bsfc->priv_data); +av_freep(&bsfc->args); av_parser_close(bsfc->parser); av_free(bsfc); } @@ -84,6 +85,6 @@ int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, { *poutbuf = (uint8_t *)buf; *poutbuf_size = buf_size; -return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, -buf, buf_size, keyframe); +return bsfc->filter->filter(bsfc, avctx, args ? args : bsfc->args, +poutbuf, poutbuf_size, buf, buf_size, keyframe); } diff --git a/libavcodec/version.h b/libavcodec/version.h index a89ad91..c7fc1f1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 4 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MINOR 5 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu: add AESNI CPU flag
ffmpeg | branch: master | Rodger Combs | Mon Oct 26 02:08:58 2015 -0500| [1e477a970fd57f83b210b3cbc77698891d6bdf78] | committer: Rodger Combs lavu: add AESNI CPU flag > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e477a970fd57f83b210b3cbc77698891d6bdf78 --- configure |4 doc/APIchanges|3 +++ libavutil/cpu.c |4 libavutil/cpu.h |1 + libavutil/version.h |2 +- libavutil/x86/cpu.c |2 ++ libavutil/x86/cpu.h |3 +++ libavutil/x86/x86inc.asm | 13 +++-- tests/checkasm/checkasm.c |1 + 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 42f6e2c..0cb04f0 100755 --- a/configure +++ b/configure @@ -368,6 +368,7 @@ Optimization options (experts only): --disable-fma3 disable FMA3 optimizations --disable-fma4 disable FMA4 optimizations --disable-avx2 disable AVX2 optimizations + --disable-aesni disable AESNI optimizations --disable-armv5tedisable armv5te optimizations --disable-armv6 disable armv6 optimizations --disable-armv6t2disable armv6t2 optimizations @@ -1635,6 +1636,7 @@ ARCH_EXT_LIST_LOONGSON=" " ARCH_EXT_LIST_X86_SIMD=" +aesni amd3dnow amd3dnowext avx @@ -2128,6 +2130,7 @@ sse3_deps="sse2" ssse3_deps="sse3" sse4_deps="ssse3" sse42_deps="sse4" +aesni_deps="sse42" avx_deps="sse42" xop_deps="avx" fma3_deps="avx" @@ -6011,6 +6014,7 @@ if enabled x86; then echo "3DNow! extended enabled ${amd3dnowext-no}" echo "SSE enabled ${sse-no}" echo "SSSE3 enabled ${ssse3-no}" +echo "AESNI enabled ${aesni-no}" echo "AVX enabled ${avx-no}" echo "XOP enabled ${xop-no}" echo "FMA3 enabled ${fma3-no}" diff --git a/doc/APIchanges b/doc/APIchanges index 119d117..c55dfe8 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2015-10-27 - xxx - lavu 55.5.100 - cpu.h + Add AV_CPU_FLAG_AESNI. + 2015-10-27 - xxx - lavc 57.12.100 / 57.8.0 - avcodec.h Deprecate av_free_packet(). Use av_packet_unref() as replacement, it resets the packet in a more consistent way. diff --git a/libavutil/cpu.c b/libavutil/cpu.c index c64baf9..1acae01 100644 --- a/libavutil/cpu.c +++ b/libavutil/cpu.c @@ -118,6 +118,7 @@ int av_parse_cpu_flags(const char *s) #define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX) #define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX) #define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | AV_CPU_FLAG_BMI1) +#define CPUFLAG_AESNI(AV_CPU_FLAG_AESNI| CPUFLAG_SSE42) static const AVOption cpuflags_opts[] = { { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, #if ARCH_PPC @@ -145,6 +146,7 @@ int av_parse_cpu_flags(const char *s) { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW },.unit = "flags" }, { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT },.unit = "flags" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV },.unit = "flags" }, +{ "aesni" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AESNI },.unit = "flags" }, #elif ARCH_ARM { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE },.unit = "flags" }, { "armv6",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 },.unit = "flags" }, @@ -205,6 +207,7 @@ int av_parse_cpu_caps(unsigned *flags, const char *s) { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOW },.unit = "flags" }, { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOWEXT },.unit = "flags" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV },.unit = "flags" }, +{ "aesni",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AESNI },.unit = "flags" }, #define CPU_FLAG_P2 AV_CPU_FLAG_CMOV | AV_CPU_FLAG_MMX #define CPU_FLAG_P3 CPU_FLAG_P2 | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE @@ -340,6 +343,7 @@ static const struct { { AV_CPU_FLAG_AVX2, "avx2" }, { AV_CPU_FLAG_BMI1, "bmi1" }, { AV_CPU_FLAG_BMI2, "bmi2" }, +{ AV_CPU_FLAG_AESNI, "aesni" }, #endif
[FFmpeg-cvslog] lavu/aes: align AVAES struct members
ffmpeg | branch: master | Rodger Combs | Sun Oct 11 22:15:08 2015 -0500| [54cd1ab55513e0a12f90dba8036b0a54b16d8ff7] | committer: Rodger Combs lavu/aes: align AVAES struct members > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=54cd1ab55513e0a12f90dba8036b0a54b16d8ff7 --- libavutil/aes_internal.h |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavutil/aes_internal.h b/libavutil/aes_internal.h index e5bf4bd..4944258 100644 --- a/libavutil/aes_internal.h +++ b/libavutil/aes_internal.h @@ -21,6 +21,7 @@ #ifndef AVUTIL_AES_INTERNAL_H #define AVUTIL_AES_INTERNAL_H +#include "mem.h" #include typedef union { @@ -33,8 +34,8 @@ typedef union { typedef struct AVAES { // Note: round_key[16] is accessed in the init code, but this only // overwrites state, which does not matter (see also commit ba554c0). -av_aes_block round_key[15]; -av_aes_block state[2]; +DECLARE_ALIGNED(16, av_aes_block, round_key)[15]; +DECLARE_ALIGNED(16, av_aes_block, state)[2]; int rounds; void (*crypt)(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int rounds); } AVAES; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/aes: move AVAES to separate internal header
ffmpeg | branch: master | Rodger Combs | Sun Oct 11 22:12:16 2015 -0500| [ec588db56fdc21606a8c8b9b32f4a54aacbe7aca] | committer: Rodger Combs lavu/aes: move AVAES to separate internal header > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec588db56fdc21606a8c8b9b32f4a54aacbe7aca --- libavutil/aes.c | 16 +--- libavutil/aes_internal.h | 41 + 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/libavutil/aes.c b/libavutil/aes.c index b59e7de..61e9dd1 100644 --- a/libavutil/aes.c +++ b/libavutil/aes.c @@ -22,24 +22,10 @@ #include "common.h" #include "aes.h" +#include "aes_internal.h" #include "intreadwrite.h" #include "timer.h" -typedef union { -uint64_t u64[2]; -uint32_t u32[4]; -uint8_t u8x4[4][4]; -uint8_t u8[16]; -} av_aes_block; - -typedef struct AVAES { -// Note: round_key[16] is accessed in the init code, but this only -// overwrites state, which does not matter (see also commit ba554c0). -av_aes_block round_key[15]; -av_aes_block state[2]; -int rounds; -} AVAES; - const int av_aes_size= sizeof(AVAES); struct AVAES *av_aes_alloc(void) diff --git a/libavutil/aes_internal.h b/libavutil/aes_internal.h new file mode 100644 index 000..e2841ef --- /dev/null +++ b/libavutil/aes_internal.h @@ -0,0 +1,41 @@ +/* + * copyright (c) 2015 Rodger Combs + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_INTERNAL_H +#define AVUTIL_AES_INTERNAL_H + +#include + +typedef union { +uint64_t u64[2]; +uint32_t u32[4]; +uint8_t u8x4[4][4]; +uint8_t u8[16]; +} av_aes_block; + +typedef struct AVAES { +// Note: round_key[16] is accessed in the init code, but this only +// overwrites state, which does not matter (see also commit ba554c0). +av_aes_block round_key[15]; +av_aes_block state[2]; +int rounds; +} AVAES; + +#endif /* AVUTIL_AES_INTERNAL_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/aes: add runtime dispatch for crypt function
ffmpeg | branch: master | Rodger Combs | Sun Oct 11 22:14:20 2015 -0500| [15ff5c7215def8e6bc38f6b84526fb1266c09dc3] | committer: Rodger Combs lavu/aes: add runtime dispatch for crypt function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=15ff5c7215def8e6bc38f6b84526fb1266c09dc3 --- libavutil/aes.c | 49 ++ libavutil/aes_internal.h |1 + 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/libavutil/aes.c b/libavutil/aes.c index 61e9dd1..dde15be 100644 --- a/libavutil/aes.c +++ b/libavutil/aes.c @@ -126,31 +126,44 @@ static inline void aes_crypt(AVAES *a, int s, const uint8_t *sbox, subshift(&a->state[0], s, sbox); } -void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src, - int count, uint8_t *iv, int decrypt) +static void aes_encrypt(AVAES *a, uint8_t *dst, const uint8_t *src, +int count, uint8_t *iv, int rounds) { while (count--) { -addkey_s(&a->state[1], src, &a->round_key[a->rounds]); -if (decrypt) { -aes_crypt(a, 0, inv_sbox, dec_multbl); -if (iv) { -addkey_s(&a->state[0], iv, &a->state[0]); -memcpy(iv, src, 16); -} -addkey_d(dst, &a->state[0], &a->round_key[0]); -} else { -if (iv) -addkey_s(&a->state[1], iv, &a->state[1]); -aes_crypt(a, 2, sbox, enc_multbl); -addkey_d(dst, &a->state[0], &a->round_key[0]); -if (iv) -memcpy(iv, dst, 16); +addkey_s(&a->state[1], src, &a->round_key[rounds]); +if (iv) +addkey_s(&a->state[1], iv, &a->state[1]); +aes_crypt(a, 2, sbox, enc_multbl); +addkey_d(dst, &a->state[0], &a->round_key[0]); +if (iv) +memcpy(iv, dst, 16); +src += 16; +dst += 16; +} +} + +static void aes_decrypt(AVAES *a, uint8_t *dst, const uint8_t *src, +int count, uint8_t *iv, int rounds) +{ +while (count--) { +addkey_s(&a->state[1], src, &a->round_key[rounds]); +aes_crypt(a, 0, inv_sbox, dec_multbl); +if (iv) { +addkey_s(&a->state[0], iv, &a->state[0]); +memcpy(iv, src, 16); } +addkey_d(dst, &a->state[0], &a->round_key[0]); src += 16; dst += 16; } } +void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt) +{ +a->crypt(a, dst, src, count, iv, a->rounds); +} + static void init_multbl2(uint32_t tbl[][256], const int c[4], const uint8_t *log8, const uint8_t *alog8, const uint8_t *sbox) @@ -186,6 +199,8 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) uint8_t log8[256]; uint8_t alog8[512]; +a->crypt = decrypt ? aes_decrypt : aes_encrypt; + if (!enc_multbl[FF_ARRAY_ELEMS(enc_multbl)-1][FF_ARRAY_ELEMS(enc_multbl[0])-1]) { j = 1; for (i = 0; i < 255; i++) { diff --git a/libavutil/aes_internal.h b/libavutil/aes_internal.h index e2841ef..e5bf4bd 100644 --- a/libavutil/aes_internal.h +++ b/libavutil/aes_internal.h @@ -36,6 +36,7 @@ typedef struct AVAES { av_aes_block round_key[15]; av_aes_block state[2]; int rounds; +void (*crypt)(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int rounds); } AVAES; #endif /* AVUTIL_AES_INTERNAL_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavu/aes: test CBC functionality
ffmpeg | branch: master | Rodger Combs | Sun Oct 11 22:15:52 2015 -0500| [cceed8389d6122fba8e59b267081d16fdbadb25e] | committer: Rodger Combs lavu/aes: test CBC functionality > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cceed8389d6122fba8e59b267081d16fdbadb25e --- libavutil/aes.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libavutil/aes.c b/libavutil/aes.c index dde15be..9096f03 100644 --- a/libavutil/aes.c +++ b/libavutil/aes.c @@ -280,7 +280,7 @@ int main(int argc, char **argv) { 0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59 } }; -uint8_t pt[16], rpt[2][16]= { +uint8_t pt[32], rpt[2][16]= { { 0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad, 0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3 }, { 0 } @@ -291,7 +291,8 @@ int main(int argc, char **argv) { 0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65 } }; -uint8_t temp[16]; +uint8_t temp[32]; +uint8_t iv[2][16]; int err = 0; av_log_set_level(AV_LOG_DEBUG); @@ -317,16 +318,24 @@ int main(int argc, char **argv) av_lfg_init(&prng, 1); for (i = 0; i < 1; i++) { -for (j = 0; j < 16; j++) { +for (j = 0; j < 32; j++) { pt[j] = av_lfg_get(&prng); } +for (j = 0; j < 16; j++) { +iv[0][j] = iv[1][j] = av_lfg_get(&prng); +} { START_TIMER; -av_aes_crypt(&ae, temp, pt, 1, NULL, 0); +av_aes_crypt(&ae, temp, pt, 2, iv[0], 0); +if (!(i & (i - 1))) +av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", + temp[0], temp[5], temp[10], temp[15]); +av_aes_crypt(&ad, temp, temp, 2, iv[1], 1); +av_aes_crypt(&ae, temp, pt, 2, NULL, 0); if (!(i & (i - 1))) av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]); -av_aes_crypt(&ad, temp, temp, 1, NULL, 1); +av_aes_crypt(&ad, temp, temp, 2, NULL, 1); STOP_TIMER("aes"); } for (j = 0; j < 16; j++) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: add support for sidx fragment indexes
ffmpeg | branch: release/2.8 | Rodger Combs | Mon Jul 20 15:00:35 2015 -0500| [edf5e88eac83807f6f80b1d18c57810c31c4d6fa] | committer: Michael Niedermayer lavf/mov: add support for sidx fragment indexes Fixes trac #3842 (cherry picked from commit 4ab56667594842283dc5ae07f0daba2a2cb4d3af) Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=edf5e88eac83807f6f80b1d18c57810c31c4d6fa --- libavformat/isom.h |2 + libavformat/mov.c | 245 +++- 2 files changed, 208 insertions(+), 39 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index aee9d6e..6e921c0 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -103,6 +103,7 @@ typedef struct MOVSbgp { typedef struct MOVFragmentIndexItem { int64_t moof_offset; int64_t time; +int headers_read; } MOVFragmentIndexItem; typedef struct MOVFragmentIndex { @@ -197,6 +198,7 @@ typedef struct MOVContext { int has_looked_for_mfra; MOVFragmentIndex** fragment_index_data; unsigned fragment_index_count; +int fragment_index_complete; int atom_depth; unsigned int aax_mode; ///< 'aax' file has been detected uint8_t file_key[20]; diff --git a/libavformat/mov.c b/libavformat/mov.c index a8d72b4..735e956 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3294,7 +3294,7 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) MOVFragment *frag = &c->fragment; MOVTrackExt *trex = NULL; MOVFragmentIndex* index = NULL; -int flags, track_id, i; +int flags, track_id, i, found = 0; avio_r8(pb); /* version */ flags = avio_rb24(pb); @@ -3312,15 +3312,6 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n"); return AVERROR_INVALIDDATA; } -for (i = 0; i < c->fragment_index_count; i++) { -MOVFragmentIndex* candidate = c->fragment_index_data[i]; -if (candidate->track_id == frag->track_id) { -av_log(c->fc, AV_LOG_DEBUG, - "found fragment index for track %u\n", frag->track_id); -index = candidate; -break; -} -} frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ? avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ? @@ -3334,24 +3325,33 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) frag->flags= flags & MOV_TFHD_DEFAULT_FLAGS ? avio_rb32(pb) : trex->flags; frag->time = AV_NOPTS_VALUE; -if (index) { -int i, found = 0; -for (i = index->current_item; i < index->item_count; i++) { -if (frag->implicit_offset == index->items[i].moof_offset) { -av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry " -"for track %u and moof_offset %"PRId64"\n", -frag->track_id, index->items[i].moof_offset); -frag->time = index->items[i].time; -index->current_item = i + 1; -found = 1; +for (i = 0; i < c->fragment_index_count; i++) { +int j; +MOVFragmentIndex* candidate = c->fragment_index_data[i]; +if (candidate->track_id == frag->track_id) { +av_log(c->fc, AV_LOG_DEBUG, + "found fragment index for track %u\n", frag->track_id); +index = candidate; +for (j = index->current_item; j < index->item_count; j++) { +if (frag->implicit_offset == index->items[j].moof_offset) { +av_log(c->fc, AV_LOG_DEBUG, "found fragment index entry " +"for track %u and moof_offset %"PRId64"\n", +frag->track_id, index->items[j].moof_offset); +frag->time = index->items[j].time; +index->current_item = j + 1; +found = 1; +break; +} } -} -if (!found) { -av_log(c->fc, AV_LOG_WARNING, "track %u has a fragment index " - "but it doesn't have an (in-order) entry for moof_offset " - "%"PRId64"\n", frag->track_id, frag->implicit_offset); +if (found) +break; } } +if (index && !found) { +av_log(c->fc, AV_LOG_DEBUG, "track %u has a fragment index but " + "it doesn't have an (in-order) entry for moof_offset " + "%"
[FFmpeg-cvslog] ffmpeg: fix -copy_prior_start 0 with -copyts and input -ss
ffmpeg | branch: master | Rodger Combs | Sun Nov 1 20:04:25 2015 -0600| [bf2590aed3e64d44a5e2430fdbe89f91f5e55bfe] | committer: Michael Niedermayer ffmpeg: fix -copy_prior_start 0 with -copyts and input -ss Also rearranged the relevant check to reduce code duplication Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf2590aed3e64d44a5e2430fdbe89f91f5e55bfe --- ffmpeg.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index a976f61..bf5e983 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1804,7 +1804,6 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p InputFile *f = input_files [ist->file_index]; int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base); -int64_t ist_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ist->st->time_base); AVPicture pict; AVPacket opkt; @@ -1814,13 +1813,13 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p !ost->copy_initial_nonkeyframes) return; -if (pkt->pts == AV_NOPTS_VALUE) { -if (!ost->frame_number && ist->pts < start_time && -!ost->copy_prior_start) -return; -} else { -if (!ost->frame_number && pkt->pts < ist_tb_start_time && -!ost->copy_prior_start) +if (!ost->frame_number && !ost->copy_prior_start) { +int64_t comp_start = start_time; +if (copy_ts && f->start_time != AV_NOPTS_VALUE) +comp_start = FFMAX(start_time, f->start_time + f->ts_offset); +if (pkt->pts == AV_NOPTS_VALUE ? +ist->pts < comp_start : +pkt->pts < av_rescale_q(comp_start, AV_TIME_BASE_Q, ist->st->time_base)) return; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/http: fix incorrect warning in range requests
ffmpeg | branch: master | Rodger Combs | Sun Oct 18 17:50:21 2015 -0500| [362c17e6563808ef48655e5ddf59a35b6497b8b2] | committer: Rodger Combs lavf/http: fix incorrect warning in range requests > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=362c17e6563808ef48655e5ddf59a35b6497b8b2 --- libavformat/http.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 4b4a225..606286a 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1155,15 +1155,16 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; } else { +int64_t target_end = s->end_off ? s->end_off : s->filesize; if ((!s->willclose || s->chunksize < 0) && -s->filesize >= 0 && s->off >= s->filesize) +target_end >= 0 && s->off >= target_end) return AVERROR_EOF; len = ffurl_read(s->hd, buf, size); if (!len && (!s->willclose || s->chunksize < 0) && -s->filesize >= 0 && s->off < s->filesize) { +target_end >= 0 && s->off < target_end) { av_log(h, AV_LOG_ERROR, "Stream ends prematurely at %"PRId64", should be %"PRId64"\n", - s->off, s->filesize + s->off, target_end ); return AVERROR(EIO); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/tee: use lavf API for applying bitstream filters
ffmpeg | branch: master | Rodger Combs | Thu Oct 8 14:52:48 2015 -0500| [7a161b74ad13e8005f413770cce8af37bd051d32] | committer: Rodger Combs lavf/tee: use lavf API for applying bitstream filters > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7a161b74ad13e8005f413770cce8af37bd051d32 --- libavformat/tee.c | 46 +++--- 1 file changed, 3 insertions(+), 43 deletions(-) diff --git a/libavformat/tee.c b/libavformat/tee.c index 821d23d..8c54d32 100644 --- a/libavformat/tee.c +++ b/libavformat/tee.c @@ -405,47 +405,6 @@ fail: return ret; } -static int filter_packet(void *log_ctx, AVPacket *pkt, - AVFormatContext *fmt_ctx, AVBitStreamFilterContext *bsf_ctx) -{ -AVCodecContext *enc_ctx = fmt_ctx->streams[pkt->stream_index]->codec; -int ret = 0; - -while (bsf_ctx) { -AVPacket new_pkt = *pkt; -ret = av_bitstream_filter_filter(bsf_ctx, enc_ctx, NULL, - &new_pkt.data, &new_pkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY); -if (ret == 0 && new_pkt.data != pkt->data) { -if ((ret = av_copy_packet(&new_pkt, pkt)) < 0) -break; -ret = 1; -} - -if (ret > 0) { -pkt->side_data = NULL; -pkt->side_data_elems = 0; -av_packet_unref(pkt); -new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, - av_buffer_default_free, NULL, 0); -if (!new_pkt.buf) -break; -} -if (ret < 0) { -av_log(log_ctx, AV_LOG_ERROR, -"Failed to filter bitstream with filter %s for stream %d in file '%s' with codec %s\n", -bsf_ctx->filter->name, pkt->stream_index, fmt_ctx->filename, -avcodec_get_name(enc_ctx->codec_id)); -} -*pkt = new_pkt; - -bsf_ctx = bsf_ctx->next; -} - -return ret; -} - static int tee_write_trailer(AVFormatContext *avf) { TeeContext *tee = avf->priv_data; @@ -498,8 +457,9 @@ static int tee_write_packet(AVFormatContext *avf, AVPacket *pkt) pkt2.duration = av_rescale_q(pkt->duration, tb, tb2); pkt2.stream_index = s2; -filter_packet(avf2, &pkt2, avf2, tee->slaves[i].bsfs[s2]); -if ((ret = av_interleaved_write_frame(avf2, &pkt2)) < 0) +if ((ret = av_apply_bitstream_filters(avf2->streams[s2]->codec, &pkt2, + tee->slaves[i].bsfs[s2])) < 0 || +(ret = av_interleaved_write_frame(avf2, &pkt2)) < 0) if (!ret_all) ret_all = ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: add internal API to append a bsf to a stream's list
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:10:08 2015 -0500| [822e80fde39f8992daeab6d51312f27188021d9b] | committer: Rodger Combs lavf: add internal API to append a bsf to a stream's list > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=822e80fde39f8992daeab6d51312f27188021d9b --- libavformat/internal.h | 11 +++ libavformat/utils.c| 22 ++ 2 files changed, 33 insertions(+) diff --git a/libavformat/internal.h b/libavformat/internal.h index 0e59da0..2cb3481 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -465,6 +465,17 @@ enum AVChromaLocation ff_choose_chroma_location(AVFormatContext *s, AVStream *st int ff_generate_avci_extradata(AVStream *st); /** + * Add a bitstream filter to a stream. + * + * @param st output stream to add a filter to + * @param name the name of the filter to add + * @param args filter-specific argument string + * @return >0 on success; + * AVERROR code on failure + */ +int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args); + +/** * Wrap errno on rename() error. * * @param oldpath source path diff --git a/libavformat/utils.c b/libavformat/utils.c index 7e101a4..95acbf3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4651,6 +4651,28 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args) +{ +AVBitStreamFilterContext *bsfc = NULL; +AVBitStreamFilterContext **dest = &st->internal->bsfc; +while (*dest && (*dest)->next) +dest = &(*dest)->next; + +if (!(bsfc = av_bitstream_filter_init(name))) { +av_log(NULL, AV_LOG_ERROR, "Unknown bitstream filter '%s'\n", name); +return AVERROR(EINVAL); +} +if (args && !(bsfc->args = av_strdup(args))) { +av_bitstream_filter_close(bsfc); +return AVERROR(ENOMEM); +} +av_log(st->codec, AV_LOG_VERBOSE, + "Automatically inserted bitstream filter '%s'; args='%s'\n", + name, args ? args : ""); +*dest = bsfc; +return 1; +} + int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mpegtsenc: add automatic bitstream filtering
ffmpeg | branch: master | Rodger Combs | Mon Nov 30 03:00:41 2015 -0600| [1b5bd4051d1e394f0429cbf6cf6c137f55857478] | committer: Rodger Combs lavf/mpegtsenc: add automatic bitstream filtering > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b5bd4051d1e394f0429cbf6cf6c137f55857478 --- libavformat/mpegtsenc.c | 65 +-- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index cb11c31..2c12043 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -717,7 +717,7 @@ static void section_write_packet(MpegTSSection *s, const uint8_t *packet) avio_write(ctx->pb, packet, TS_PACKET_SIZE); } -static int mpegts_write_header(AVFormatContext *s) +static int mpegts_init(AVFormatContext *s) { MpegTSWrite *ts = s->priv_data; MpegTSWriteStream *ts_st; @@ -960,26 +960,6 @@ static int mpegts_write_header(AVFormatContext *s) fail: av_freep(&pids); -for (i = 0; i < s->nb_streams; i++) { -st= s->streams[i]; -ts_st = st->priv_data; -if (ts_st) { -av_freep(&ts_st->payload); -if (ts_st->amux) { -avformat_free_context(ts_st->amux); -ts_st->amux = NULL; -} -} -av_freep(&st->priv_data); -} - -for (i = 0; i < ts->nb_services; i++) { -service = ts->services[i]; -av_freep(&service->provider_name); -av_freep(&service->name); -av_freep(&service); -} -av_freep(&ts->services); return ret; } @@ -1714,20 +1694,27 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt) static int mpegts_write_end(AVFormatContext *s) { +if (s->pb) +mpegts_write_flush(s); + +return 0; +} + +static void mpegts_deinit(AVFormatContext *s) +{ MpegTSWrite *ts = s->priv_data; MpegTSService *service; int i; -if (s->pb) -mpegts_write_flush(s); - for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MpegTSWriteStream *ts_st = st->priv_data; -av_freep(&ts_st->payload); -if (ts_st->amux) { -avformat_free_context(ts_st->amux); -ts_st->amux = NULL; +if (ts_st) { +av_freep(&ts_st->payload); +if (ts_st->amux) { +avformat_free_context(ts_st->amux); +ts_st->amux = NULL; +} } } @@ -1738,8 +1725,24 @@ static int mpegts_write_end(AVFormatContext *s) av_freep(&service); } av_freep(&ts->services); +} -return 0; +static int mpegts_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +int ret = 1; +AVStream *st = s->streams[pkt->stream_index]; + +if (st->codec->codec_id == AV_CODEC_ID_H264) { +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 && + AV_RB24(pkt->data) != 0x01) +ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL); +} else if (st->codec->codec_id == AV_CODEC_ID_HEVC) { +if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 && + AV_RB24(pkt->data) != 0x01) +ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL); +} + +return ret; } static const AVOption options[] = { @@ -1846,9 +1849,11 @@ AVOutputFormat ff_mpegts_muxer = { .priv_data_size = sizeof(MpegTSWrite), .audio_codec= AV_CODEC_ID_MP2, .video_codec= AV_CODEC_ID_MPEG2VIDEO, -.write_header = mpegts_write_header, +.init = mpegts_init, .write_packet = mpegts_write_packet, .write_trailer = mpegts_write_end, +.deinit = mpegts_deinit, +.check_bitstream = mpegts_check_bitstream, .flags = AVFMT_ALLOW_FLUSH | AVFMT_VARIABLE_FPS, .priv_class = &mpegts_muxer_class, }; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskaenc: add automatic bitstream filtering
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:34:06 2015 -0500| [b287d7ea17f404a51eb3fdca80fa8a8b1fb7dd8b] | committer: Rodger Combs lavf/matroskaenc: add automatic bitstream filtering > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b287d7ea17f404a51eb3fdca80fa8a8b1fb7dd8b --- libavformat/matroskaenc.c | 43 +++ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 60f7c16..98ab6df 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -845,9 +845,6 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, int j, ret; AVDictionaryEntry *tag; -// ms precision is the de-facto standard timescale for mkv files -avpriv_set_pts_info(st, 64, 1, 1000); - if (codec->codec_type == AVMEDIA_TYPE_ATTACHMENT) { mkv->have_attachments = 1; return 0; @@ -1392,11 +1389,6 @@ static int mkv_write_header(AVFormatContext *s) else mkv->mode = MODE_MATROSKAv2; -if (s->avoid_negative_ts < 0) { -s->avoid_negative_ts = 1; -s->internal->avoid_negative_ts_use_pts = 1; -} - if (mkv->mode != MODE_WEBM || av_dict_get(s->metadata, "stereo_mode", NULL, 0) || av_dict_get(s->metadata, "alpha_mode", NULL, 0)) @@ -2102,6 +2094,35 @@ static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance) return 0; } +static int mkv_init(struct AVFormatContext *s) +{ +int i; + +if (s->avoid_negative_ts < 0) { +s->avoid_negative_ts = 1; +s->internal->avoid_negative_ts_use_pts = 1; +} + +for (i = 0; i < s->nb_streams; i++) { +// ms precision is the de-facto standard timescale for mkv files +avpriv_set_pts_info(s->streams[i], 64, 1, 1000); +} + +return 0; +} + +static int mkv_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) +{ +int ret = 1; +AVStream *st = s->streams[pkt->stream_index]; + +if (st->codec->codec_id == AV_CODEC_ID_AAC) +if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) +ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); + +return ret; +} + static const AVCodecTag additional_audio_tags[] = { { AV_CODEC_ID_ALAC, 0X }, { AV_CODEC_ID_EAC3, 0X }, @@ -2164,6 +2185,7 @@ AVOutputFormat ff_matroska_muxer = { AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3, .video_codec = CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, @@ -2175,6 +2197,7 @@ AVOutputFormat ff_matroska_muxer = { }, .subtitle_codec= AV_CODEC_ID_ASS, .query_codec = mkv_query_codec, +.check_bitstream = mkv_check_bitstream, .priv_class= &matroska_class, }; #endif @@ -2196,9 +2219,11 @@ AVOutputFormat ff_webm_muxer = { .audio_codec = CONFIG_LIBOPUS_ENCODER ? AV_CODEC_ID_OPUS : AV_CODEC_ID_VORBIS, .video_codec = CONFIG_LIBVPX_VP9_ENCODER? AV_CODEC_ID_VP9 : AV_CODEC_ID_VP8, .subtitle_codec= AV_CODEC_ID_WEBVTT, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, +.check_bitstream = mkv_check_bitstream, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH, .priv_class= &webm_class, @@ -2221,9 +2246,11 @@ AVOutputFormat ff_matroska_audio_muxer = { .audio_codec = CONFIG_LIBVORBIS_ENCODER ? AV_CODEC_ID_VORBIS : AV_CODEC_ID_AC3, .video_codec = AV_CODEC_ID_NONE, +.init = mkv_init, .write_header = mkv_write_header, .write_packet = mkv_write_flush_packet, .write_trailer = mkv_write_trailer, +.check_bitstream = mkv_check_bitstream, .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH, .codec_tag = (const AVCodecTag* const []){ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmpeg: use lavf API for applying bitstream filters
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:24:40 2015 -0500| [a5fd3a1a2bd2e8ac28434919e462cf61ce831eb2] | committer: Rodger Combs ffmpeg: use lavf API for applying bitstream filters > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5fd3a1a2bd2e8ac28434919e462cf61ce831eb2 --- ffmpeg.c | 46 -- ffmpeg.h |1 - ffmpeg_opt.c |6 +- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 10d0f25..c533785 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -683,47 +683,10 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) if (bsfc) av_packet_split_side_data(pkt); -while (bsfc) { -AVPacket new_pkt = *pkt; -AVDictionaryEntry *bsf_arg = av_dict_get(ost->bsf_args, - bsfc->filter->name, - NULL, 0); -int a = av_bitstream_filter_filter(bsfc, avctx, - bsf_arg ? bsf_arg->value : NULL, - &new_pkt.data, &new_pkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY); -if(a == 0 && new_pkt.data != pkt->data) { -uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow -if(t) { -memcpy(t, new_pkt.data, new_pkt.size); -memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); -new_pkt.data = t; -new_pkt.buf = NULL; -a = 1; -} else -a = AVERROR(ENOMEM); -} -if (a > 0) { -pkt->side_data = NULL; -pkt->side_data_elems = 0; -av_packet_unref(pkt); -new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, - av_buffer_default_free, NULL, 0); -if (!new_pkt.buf) -exit_program(1); -} else if (a < 0) { -new_pkt = *pkt; -av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", - bsfc->filter->name, pkt->stream_index, - avctx->codec ? avctx->codec->name : "copy"); -print_error("", a); -if (exit_on_error) -exit_program(1); -} -*pkt = new_pkt; - -bsfc = bsfc->next; +if ((ret = av_apply_bitstream_filters(avctx, pkt, bsfc)) < 0) { +print_error("", ret); +if (exit_on_error) +exit_program(1); } if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { @@ -4244,7 +4207,6 @@ static int transcode(void) av_dict_free(&ost->sws_dict); av_dict_free(&ost->swr_opts); av_dict_free(&ost->resample_opts); -av_dict_free(&ost->bsf_args); } } } diff --git a/ffmpeg.h b/ffmpeg.h index fa24910..20322b0 100644 --- a/ffmpeg.h +++ b/ffmpeg.h @@ -454,7 +454,6 @@ typedef struct OutputStream { AVDictionary *sws_dict; AVDictionary *swr_opts; AVDictionary *resample_opts; -AVDictionary *bsf_args; char *apad; OSTFinished finished;/* no more packets should be written for this stream */ int unavailable; /* true if the steram is unavailable (possibly temporarily) */ diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 3df46da..9b341cf 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1255,7 +1255,11 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; -av_dict_set(&ost->bsf_args, bsfc->filter->name, arg, 0); +if (arg) +if (!(bsfc->args = av_strdup(arg))) { +av_log(NULL, AV_LOG_FATAL, "Bitstream filter memory allocation failed\n"); +exit_program(1); +} bsfc_prev = bsfc; bsf = next; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: add API to apply a list of bsfs to a packet
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:23:11 2015 -0500| [4caa3e1c6cf452154e811fea3685b2dea50d3a7a] | committer: Rodger Combs lavf: add API to apply a list of bsfs to a packet > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4caa3e1c6cf452154e811fea3685b2dea50d3a7a --- libavformat/avformat.h | 11 +++ libavformat/utils.c| 49 2 files changed, 60 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 32bed01..39aedb5 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2764,6 +2764,17 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); +/** + * Apply a list of bitstream filters to a packet. + * + * @param codec AVCodecContext, usually from an AVStream + * @param pkt the packet to apply filters to + * @param bsfc a NULL-terminated list of filters to apply + * @return >=0 on success; + * AVERROR code on failure + */ +int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, + AVBitStreamFilterContext *bsfc); /** * @} diff --git a/libavformat/utils.c b/libavformat/utils.c index 2f864c6..7e101a4 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4650,3 +4650,52 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, sd->size = size; return data; } + +int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, + AVBitStreamFilterContext *bsfc) +{ +int ret = 0; +while (bsfc) { +AVPacket new_pkt = *pkt; +int a = av_bitstream_filter_filter(bsfc, codec, NULL, + &new_pkt.data, &new_pkt.size, + pkt->data, pkt->size, + pkt->flags & AV_PKT_FLAG_KEY); +if(a == 0 && new_pkt.data != pkt->data) { +uint8_t *t = av_malloc(new_pkt.size + AV_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow +if (t) { +memcpy(t, new_pkt.data, new_pkt.size); +memset(t + new_pkt.size, 0, AV_INPUT_BUFFER_PADDING_SIZE); +new_pkt.data = t; +new_pkt.buf = NULL; +a = 1; +} else { +a = AVERROR(ENOMEM); +} +} +if (a > 0) { +new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, + av_buffer_default_free, NULL, 0); +if (new_pkt.buf) { +pkt->side_data = NULL; +pkt->side_data_elems = 0; +av_packet_unref(pkt); +} else { +av_freep(&new_pkt.data); +a = AVERROR(ENOMEM); +} +} +if (a < 0) { +av_log(codec, AV_LOG_ERROR, + "Failed to open bitstream filter %s for stream %d with codec %s", + bsfc->filter->name, pkt->stream_index, + codec->codec ? codec->codec->name : "copy"); +ret = a; +break; +} +*pkt = new_pkt; + +bsfc = bsfc->next; +} +return ret; +} ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: add automatic bitstream filtering; bump version
ffmpeg | branch: master | Rodger Combs | Wed Oct 7 21:32:14 2015 -0500| [1f9139b07b8a896b62c1f28f3d04acac33978c0d] | committer: Rodger Combs lavf: add automatic bitstream filtering; bump version This solves the problem discussed in https://ffmpeg.org/pipermail/ffmpeg-devel/2015-September/179238.html by allowing AVCodec::write_header to be delayed until after packets have been run through required bitstream filters in order to generate global extradata. It also provides a mechanism by which a muxer can add a bitstream filter to a stream automatically, rather than prompting the user to do so. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f9139b07b8a896b62c1f28f3d04acac33978c0d --- Changelog |1 + doc/APIchanges |3 +++ libavformat/avformat.h | 23 +++ libavformat/internal.h | 17 + libavformat/mux.c | 49 +--- libavformat/version.h |2 +- 6 files changed, 91 insertions(+), 4 deletions(-) diff --git a/Changelog b/Changelog index bc025ca..d9c2ea8 100644 --- a/Changelog +++ b/Changelog @@ -48,6 +48,7 @@ version : - SOFAlizer: virtual binaural acoustics filter - VAAPI VP9 hwaccel - audio high-order multiband parametric equalizer +- automatic bitstream filtering version 2.8: diff --git a/doc/APIchanges b/doc/APIchanges index 013e870..e0d5e84 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2015-12-28 - xxx - lavf 57.21.100 - avformat.h + Add automatic bitstream filtering; add av_apply_bitstream_filters() + 2015-12-22 - xxx - lavfi 6.21.101 - avfilter.h Deprecate avfilter_link_set_closed(). Applications are not supposed to mess with links, diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 39aedb5..95a645b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -600,6 +600,29 @@ typedef struct AVOutputFormat { */ int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); enum AVCodecID data_codec; /**< default data codec */ +/** + * Initialize format. May allocate data here, and set any AVFormatContext or + * AVStream parameters that need to be set before packets are sent. + * This method must not write output. + * + * Any allocations made here must be freed in deinit(). + */ +int (*init)(struct AVFormatContext *); +/** + * Deinitialize format. If present, this is called whenever the muxer is being + * destroyed, regardless of whether or not the header has been written. + * + * If a trailer is being written, this is called after write_trailer(). + * + * This is called if init() fails as well. + */ +void (*deinit)(struct AVFormatContext *); +/** + * Set up any necessary bitstream filtering and extract any extra data needed + * for the global header. + * Return 0 if more packets from this stream must be checked; 1 if not. + */ +int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); } AVOutputFormat; /** * @} diff --git a/libavformat/internal.h b/libavformat/internal.h index 4297cb8..0e59da0 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -117,6 +117,11 @@ struct AVFormatInternal { int inject_global_side_data; int avoid_negative_ts_use_pts; + +/** + * Whether or not a header has already been written + */ +int header_written; }; struct AVStreamInternal { @@ -125,6 +130,18 @@ struct AVStreamInternal { * from dts. */ int reorder; + +/** + * bitstream filter to run on stream + * - encoding: Set by muxer using ff_stream_add_bitstream_filter + * - decoding: unused + */ +AVBitStreamFilterContext *bsfc; + +/** + * Whether or not check_bitstream should still be run on each packet + */ +int bitstream_checked; }; #ifdef __GNUC__ diff --git a/libavformat/mux.c b/libavformat/mux.c index 05d4170..2da8cf2 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -405,6 +405,11 @@ FF_ENABLE_DEPRECATION_WARNINGS *options = tmp; } +if (s->oformat->init && (ret = s->oformat->init(s)) < 0) { +s->oformat->deinit(s); +goto fail; +} + return 0; fail: @@ -456,7 +461,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) if ((ret = init_muxer(s, options)) < 0) return ret; -if (s->oformat->write_header) { +if (s->oformat->write_header && !s->oformat->check_bitstream) { ret = s->oformat->write_header(s); if (ret >= 0 && s->pb && s->pb->error < 0) ret = s->pb->error; @@ -464,6 +469,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary
[FFmpeg-cvslog] lavfi/drawutils: support NV12 and NV21
ffmpeg | branch: master | Rodger Combs | Mon May 9 20:52:06 2016 -0500| [d645182227e8830de4de59a7b9ebec1b7e714d12] | committer: Rodger Combs lavfi/drawutils: support NV12 and NV21 > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d645182227e8830de4de59a7b9ebec1b7e714d12 --- libavfilter/drawutils.c | 33 - tests/ref/fate/filter-pixfmts-pad |2 ++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c index d37c83e..3146bfa 100644 --- a/libavfilter/drawutils.c +++ b/libavfilter/drawutils.c @@ -205,8 +205,6 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) return AVERROR(ENOSYS); nb_planes = FFMAX(nb_planes, c->plane + 1); } -if ((desc->log2_chroma_w || desc->log2_chroma_h) && nb_planes < 3) -return AVERROR(ENOSYS); /* exclude NV12 and NV21 */ memset(draw, 0, sizeof(*draw)); draw->desc = desc; draw->format= format; @@ -214,7 +212,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags) memcpy(draw->pixelstep, pixelstep, sizeof(draw->pixelstep)); draw->hsub[1] = draw->hsub[2] = draw->hsub_max = desc->log2_chroma_w; draw->vsub[1] = draw->vsub[2] = draw->vsub_max = desc->log2_chroma_h; -for (i = 0; i < ((desc->nb_components - 1) | 1); i++) +for (i = 0; i < (desc->nb_components - !!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)); i++) draw->comp_mask[desc->comp[i].plane] |= 1 << desc->comp[i].offset; return 0; @@ -243,20 +241,21 @@ void ff_draw_color(FFDrawContext *draw, FFDrawColor *color, const uint8_t rgba[4 color->comp[rgba_map[i]].u16[0] = color->comp[rgba_map[i]].u8[0] << (draw->desc->comp[rgba_map[i]].depth - 8); } } -} else if (draw->nb_planes == 3 || draw->nb_planes == 4) { +} else if (draw->nb_planes >= 2) { /* assume YUV */ -color->comp[0].u8[0] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]); -color->comp[1].u8[0] = RGB_TO_U_CCIR(rgba[0], rgba[1], rgba[2], 0); -color->comp[2].u8[0] = RGB_TO_V_CCIR(rgba[0], rgba[1], rgba[2], 0); +const AVPixFmtDescriptor *desc = draw->desc; +color->comp[desc->comp[0].plane].u8[desc->comp[0].offset] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]); +color->comp[desc->comp[1].plane].u8[desc->comp[1].offset] = RGB_TO_U_CCIR(rgba[0], rgba[1], rgba[2], 0); +color->comp[desc->comp[2].plane].u8[desc->comp[2].offset] = RGB_TO_V_CCIR(rgba[0], rgba[1], rgba[2], 0); color->comp[3].u8[0] = rgba[3]; -if (draw->desc->comp[0].depth > 8) -color->comp[0].u16[0] = color->comp[0].u8[0] << (draw->desc->comp[0].depth - 8); -if (draw->desc->comp[1].depth > 8) -color->comp[1].u16[0] = color->comp[1].u8[0] << (draw->desc->comp[1].depth - 8); -if (draw->desc->comp[2].depth > 8) -color->comp[2].u16[0] = color->comp[2].u8[0] << (draw->desc->comp[2].depth - 8); -if (draw->desc->comp[3].depth > 8) -color->comp[3].u16[0] = color->comp[3].u8[0] << (draw->desc->comp[3].depth - 8); +#define EXPAND(compn) \ +if (desc->comp[compn].depth > 8) \ +color->comp[desc->comp[compn].plane].u16[desc->comp[compn].offset] = \ +color->comp[desc->comp[compn].plane].u8[desc->comp[compn].offset] << (draw->desc->comp[compn].depth - 8) +EXPAND(3); +EXPAND(2); +EXPAND(1); +EXPAND(0); } else if (draw->format == AV_PIX_FMT_GRAY8 || draw->format == AV_PIX_FMT_GRAY8A) { color->comp[0].u8[0] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]); color->comp[1].u8[0] = rgba[3]; @@ -450,7 +449,7 @@ void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor *color, /* 0x101 * alpha is in the [ 2 ; 0x1001] range */ alpha = 0x101 * color->rgba[3] + 0x2; } -nb_planes = (draw->nb_planes - 1) | 1; /* eliminate alpha */ +nb_planes = draw->nb_planes - !!(draw->desc->flags & AV_PIX_FMT_FLAG_ALPHA); for (plane = 0; plane < nb_planes; plane++) { nb_comp = draw->pixelstep[plane]; p0 = pointer_at(draw, dst, dst_linesize, plane, x0, y0); @@ -627,7 +626,7 @@ void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color, } else { alpha = (0x101 * color->rgba[3] + 0x2) >> 8; } -nb_planes = (draw->nb_planes - 1) | 1; /* eliminate alpha */ +nb_planes = draw->nb_planes - !!(draw->desc->flags & AV_PIX_FMT_FLAG_ALPHA); for
[FFmpeg-cvslog] lavf: update auto-bsf to new BSF API
ffmpeg | branch: master | Rodger Combs | Wed Apr 20 01:15:35 2016 -0500| [af7e2734b9c1cd5b09208e343154ffc89a64d2c4] | committer: Rodger Combs lavf: update auto-bsf to new BSF API > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af7e2734b9c1cd5b09208e343154ffc89a64d2c4 --- libavformat/internal.h |5 ++-- libavformat/mux.c | 45 libavformat/segment.c |6 +++-- libavformat/utils.c| 59 4 files changed, 91 insertions(+), 24 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 8c2740b..647ad65 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -135,11 +135,12 @@ struct AVStreamInternal { int reorder; /** - * bitstream filter to run on stream + * bitstream filters to run on stream * - encoding: Set by muxer using ff_stream_add_bitstream_filter * - decoding: unused */ -AVBitStreamFilterContext *bsfc; +AVBSFContext **bsfcs; +int nb_bsfcs; /** * Whether or not check_bitstream should still be run on each packet diff --git a/libavformat/mux.c b/libavformat/mux.c index 105d762..a447645 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -1082,7 +1082,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, in int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) { -int ret, flush = 0; +int ret, flush = 0, i; ret = prepare_input_packet(s, pkt); if (ret < 0) @@ -1100,15 +1100,40 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) } } -av_apply_bitstream_filters(st->internal->avctx, pkt, st->internal->bsfc); -if (pkt->size == 0 && pkt->side_data_elems == 0) -return 0; -if (!st->codecpar->extradata && st->internal->avctx->extradata) { -int eret = ff_alloc_extradata(st->codecpar, st->internal->avctx->extradata_size); -if (eret < 0) -return AVERROR(ENOMEM); -st->codecpar->extradata_size = st->internal->avctx->extradata_size; -memcpy(st->codecpar->extradata, st->internal->avctx->extradata, st->internal->avctx->extradata_size); +for (i = 0; i < st->internal->nb_bsfcs; i++) { +AVBSFContext *ctx = st->internal->bsfcs[i]; +if (i > 0) { +AVBSFContext* prev_ctx = st->internal->bsfcs[i - 1]; +if (prev_ctx->par_out->extradata_size != ctx->par_in->extradata_size) { +if ((ret = avcodec_parameters_copy(ctx->par_in, prev_ctx->par_out)) < 0) +goto fail; +} +} +// TODO: when any bitstream filter requires flushing at EOF, we'll need to +// flush each stream's BSF chain on write_trailer. +if ((ret = av_bsf_send_packet(ctx, pkt)) < 0) { +av_log(ctx, AV_LOG_ERROR, + "Failed to send packet to filter %s for stream %d", + ctx->filter->name, pkt->stream_index); +goto fail; +} +// TODO: when any automatically-added bitstream filter is generating multiple +// output packets for a single input one, we'll need to call this in a loop +// and write each output packet. +if ((ret = av_bsf_receive_packet(ctx, pkt)) < 0) { +if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) +return 0; +av_log(ctx, AV_LOG_ERROR, + "Failed to send packet to filter %s for stream %d", + ctx->filter->name, pkt->stream_index); +goto fail; +} +if (i == st->internal->nb_bsfcs - 1) { +if (ctx->par_out->extradata_size != st->codecpar->extradata_size) { +if ((ret = avcodec_parameters_copy(st->codecpar, ctx->par_out)) < 0) +goto fail; +} +} } if (s->debug & FF_FDEBUG_TS) diff --git a/libavformat/segment.c b/libavformat/segment.c index df6f4b5..4c6c6d4 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -966,8 +966,10 @@ static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt) if (ret == 1) { AVStream *st = s->streams[pkt->stream_index]; AVStream *ost = oc->streams[pkt->stream_index]; -st->internal->bsfc = ost->internal->bsfc; -ost->internal->bsfc = NULL; +st->internal->bsfcs = ost->internal->bsfcs; +
[FFmpeg-cvslog] lavf/srtdec: fix probing files with negative first timestamps
ffmpeg | branch: master | Rodger Combs | Mon Jun 6 13:26:36 2016 -0500| [1df401505c6d209961016ba881d18bedf6af61eb] | committer: Rodger Combs lavf/srtdec: fix probing files with negative first timestamps > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1df401505c6d209961016ba881d18bedf6af61eb --- libavformat/srtdec.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 585aa6a..9ab7a4e 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -52,7 +52,10 @@ static int srt_probe(AVProbeData *p) /* Check if the next line matches a SRT timestamp */ if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0) return 0; -if (buf[0] >= '0' && buf[0] <= '9' && strstr(buf, " --> ") +pbuf = buf; +if (buf[0] == '-') + pbuf++; +if (pbuf[0] >= '0' && pbuf[0] <= '9' && strstr(buf, " --> ") && sscanf(buf, "%*d:%*d:%*d%*1[,.]%*d --> %*d:%*d:%*d%*1[,.]%d", &v) == 1) return AVPROBE_SCORE_MAX; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: deprecate av_apply_bitstream_filters
ffmpeg | branch: master | Rodger Combs | Wed Apr 20 01:11:59 2016 -0500| [150e5e13b1fae125fd7ec2d91fa56b5be958668e] | committer: Rodger Combs lavf: deprecate av_apply_bitstream_filters > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=150e5e13b1fae125fd7ec2d91fa56b5be958668e --- libavformat/avformat.h |3 +++ libavformat/utils.c|4 2 files changed, 7 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 4eb1140..c881808 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2873,8 +2873,11 @@ int avformat_queue_attached_pictures(AVFormatContext *s); * @return >=0 on success; * AVERROR code on failure */ +#if FF_API_OLD_BSF +attribute_deprecated int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc); +#endif /** * @} diff --git a/libavformat/utils.c b/libavformat/utils.c index 1d73b25..866dfb5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5006,6 +5006,8 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a return 1; } +#if FF_API_OLD_BSF +FF_DISABLE_DEPRECATION_WARNINGS int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { @@ -5059,6 +5061,8 @@ int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, } return ret; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif void ff_format_io_close(AVFormatContext *s, AVIOContext **pb) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/srtdec: fix indent
ffmpeg | branch: master | Rodger Combs | Sat Jun 25 15:53:11 2016 -0500| [6ee7adb881e4513ebacf76ba97d413fcbd6cf3e3] | committer: Rodger Combs lavf/srtdec: fix indent > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ee7adb881e4513ebacf76ba97d413fcbd6cf3e3 --- libavformat/srtdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c index 9ab7a4e..067db63 100644 --- a/libavformat/srtdec.c +++ b/libavformat/srtdec.c @@ -54,7 +54,7 @@ static int srt_probe(AVProbeData *p) return 0; pbuf = buf; if (buf[0] == '-') - pbuf++; +pbuf++; if (pbuf[0] >= '0' && pbuf[0] <= '9' && strstr(buf, " --> ") && sscanf(buf, "%*d:%*d:%*d%*1[,.]%*d --> %*d:%*d:%*d%*1[,.]%d", &v) == 1) return AVPROBE_SCORE_MAX; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskaenc: move skipped metadata keys to separate function
ffmpeg | branch: master | Rodger Combs | Mon Sep 5 21:42:24 2016 -0500| [6ede4e93ca0468dc1645677ad540f575c941ff7a] | committer: Rodger Combs lavf/matroskaenc: move skipped metadata keys to separate function > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6ede4e93ca0468dc1645677ad540f575c941ff7a --- libavformat/matroskaenc.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 2a2877f..decb66d 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1308,6 +1308,16 @@ static int mkv_write_tag_targets(AVFormatContext *s, return 0; } +static int mkv_check_tag_name(const char *name, unsigned int elementid) +{ +return av_strcasecmp(name, "title") && + av_strcasecmp(name, "stereo_mode") && + av_strcasecmp(name, "creation_time") && + av_strcasecmp(name, "encoding_tool") && + (elementid != MATROSKA_ID_TAGTARGETS_TRACKUID || +av_strcasecmp(name, "language")); +} + static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int elementid, unsigned int uid, ebml_master *tags) { @@ -1320,12 +1330,7 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme return ret; while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) { -if (av_strcasecmp(t->key, "title") && -av_strcasecmp(t->key, "stereo_mode") && -av_strcasecmp(t->key, "creation_time") && -av_strcasecmp(t->key, "encoding_tool") && -(elementid != MATROSKA_ID_TAGTARGETS_TRACKUID || - av_strcasecmp(t->key, "language"))) { +if (mkv_check_tag_name(t->key, elementid)) { ret = mkv_write_simpletag(s->pb, t); if (ret < 0) return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskaenc: use mkv_check_tag_name consistently
ffmpeg | branch: master | Rodger Combs | Mon Sep 5 22:26:16 2016 -0500| [843e72ea5542845a0a9fed743517c14a92279885] | committer: Rodger Combs lavf/matroskaenc: use mkv_check_tag_name consistently Previously, we used a different list of checks when deciding whether to write a set of tags at all than we did when deciding whether to write an individual tag in the set. This resulted in sometimes writing an empty tag master and seekhead. Now we use mkv_check_tag_name everywhere, so if a dictionary is entirely composed of tags we skip, we don't write a tag master at all. This affected the test file, since "language" was on one list but not the other, so we were writing an empty tag master there. The test hash is updated to reflect that change. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=843e72ea5542845a0a9fed743517c14a92279885 --- libavformat/matroskaenc.c | 10 +- tests/fate/matroska.mak | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 7deccaa..3eeb09b 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1342,12 +1342,12 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme return 0; } -static int mkv_check_tag(AVDictionary *m) +static int mkv_check_tag(AVDictionary *m, unsigned int elementid) { AVDictionaryEntry *t = NULL; while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) -if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) +if (mkv_check_tag_name(t->key, elementid)) return 1; return 0; @@ -1361,7 +1361,7 @@ static int mkv_write_tags(AVFormatContext *s) ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); -if (mkv_check_tag(s->metadata)) { +if (mkv_check_tag(s->metadata, 0)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } @@ -1369,7 +1369,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; -if (!mkv_check_tag(st->metadata)) +if (!mkv_check_tag(st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); @@ -1398,7 +1398,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; -if (!mkv_check_tag(ch->metadata)) +if (!mkv_check_tag(ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id + mkv->chapter_id_offset, &tags); diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak index 8cf1734..8e4a1e8 100644 --- a/tests/fate/matroska.mak +++ b/tests/fate/matroska.mak @@ -4,6 +4,6 @@ FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux fate-matroska-remux: CMD = md5 -i $(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v copy -fflags +bitexact -strict -2 -f matroska fate-matroska-remux: CMP = oneline -fate-matroska-remux: REF = 5ebcfaa8e3d534f8a800a58fd2b0aca6 +fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/matroskaenc: skip writing "duration" tags
ffmpeg | branch: master | Rodger Combs | Mon Sep 5 21:43:18 2016 -0500| [3829a02738c16cfc84f41fd4b55a34c03386a65b] | committer: Rodger Combs lavf/matroskaenc: skip writing "duration" tags > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3829a02738c16cfc84f41fd4b55a34c03386a65b --- libavformat/matroskaenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index decb66d..7deccaa 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1314,6 +1314,7 @@ static int mkv_check_tag_name(const char *name, unsigned int elementid) av_strcasecmp(name, "stereo_mode") && av_strcasecmp(name, "creation_time") && av_strcasecmp(name, "encoding_tool") && + av_strcasecmp(name, "duration") && (elementid != MATROSKA_ID_TAGTARGETS_TRACKUID || av_strcasecmp(name, "language")); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/Makefile: g729dec: fix missing file
ffmpeg | branch: master | Rodger Combs | Wed Feb 3 07:14:33 2016 -0600| [1177e42121360a50fa864bab1897468b2e0d1d22] | committer: Rodger Combs lavc/Makefile: g729dec: fix missing file > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1177e42121360a50fa864bab1897468b2e0d1d22 --- libavcodec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 7396468..fa2318a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -297,7 +297,7 @@ OBJS-$(CONFIG_G723_1_DECODER) += g723_1dec.o g723_1.o \ acelp_vectors.o celp_filters.o celp_math.o OBJS-$(CONFIG_G723_1_ENCODER) += g723_1enc.o g723_1.o \ acelp_vectors.o celp_filters.o celp_math.o -OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o +OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/Makefile: add missing ADPCM_THP_LE objs
ffmpeg | branch: master | Rodger Combs | Wed Feb 3 08:21:27 2016 -0600| [7c5fed15a8dfb6192960a14e876afa913d4f86fd] | committer: Rodger Combs lavc/Makefile: add missing ADPCM_THP_LE objs > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c5fed15a8dfb6192960a14e876afa913d4f86fd --- libavcodec/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index fa2318a..9c7302a 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -753,6 +753,7 @@ OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_SWF_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_SWF_ENCODER) += adpcmenc.o adpcm_data.o OBJS-$(CONFIG_ADPCM_THP_DECODER) += adpcm.o adpcm_data.o +OBJS-$(CONFIG_ADPCM_THP_LE_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o adpcm_data.o OBJS-$(CONFIG_ADPCM_XA_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER) += adpcm.o adpcm_data.o ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ass_split: fix handling of streams with no [Events] or Format: line
ffmpeg | branch: master | Rodger Combs | Fri Dec 4 06:42:48 2015 -0600| [3b32e1313c6d68aa10bc7d97ad505382def833b0] | committer: Rodger Combs ass_split: fix handling of streams with no [Events] or Format: line > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3b32e1313c6d68aa10bc7d97ad505382def833b0 --- libavcodec/ass_split.c | 36 +++- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index beaba7e..cdb1aa2 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -229,7 +229,7 @@ static inline const char *skip_space(const char *buf) return buf; } -static int *get_default_field_orders(const ASSSection *section) +static int *get_default_field_orders(const ASSSection *section, int *number) { int i; int *order = av_malloc_array(FF_ARRAY_ELEMS(section->fields), sizeof(*order)); @@ -238,8 +238,9 @@ static int *get_default_field_orders(const ASSSection *section) return NULL; for (i = 0; section->fields[i].name; i++) order[i] = i; +*number = i; while (i < FF_ARRAY_ELEMS(section->fields)) -order[i] = -1; +order[i++] = -1; return order; } @@ -255,12 +256,26 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) ctx->current_section = -1; break; } -if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':')) { -/* skip comments */ -} else if (section->format_header && !order) { +if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':')) +goto next_line; // skip comments + +len = strcspn(buf, ":\r\n"); +if (buf[len] == ':' && +(!section->fields_header || strncmp(buf, section->fields_header, len))) { +for (i = 0; i < FF_ARRAY_ELEMS(ass_sections); i++) { +if (ass_sections[i].fields_header && +!strncmp(buf, ass_sections[i].fields_header, len)) { +ctx->current_section = i; +section = &ass_sections[ctx->current_section]; +number = &ctx->field_number[ctx->current_section]; +order = ctx->field_order[ctx->current_section]; +break; +} +} +} +if (section->format_header && !order) { len = strlen(section->format_header); -if (strncmp(buf, section->format_header, len) || buf[len] != ':') -goto next_line; +if (buf[len] == ':' && !strncmp(buf, section->format_header, len)) { buf += len + 1; while (!is_eol(*buf)) { buf = skip_space(buf); @@ -278,7 +293,10 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) buf = skip_space(buf + len + (buf[len] == ',')); } ctx->field_order[ctx->current_section] = order; -} else if (section->fields_header) { +goto next_line; +} +} +if (section->fields_header) { len = strlen(section->fields_header); if (!strncmp(buf, section->fields_header, len) && buf[len] == ':') { uint8_t *ptr, *struct_ptr = realloc_section_array(ctx); @@ -286,7 +304,7 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) /* No format header line found so far, assume default */ if (!order) { -order = get_default_field_orders(section); +order = get_default_field_orders(section, number); if (!order) return NULL; ctx->field_order[ctx->current_section] = order; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ass_split: reindent
ffmpeg | branch: master | Rodger Combs | Sat Sep 10 00:29:50 2016 -0500| [dca03ec5f4d5ca28efc8a80c591412fab5821d81] | committer: Rodger Combs ass_split: reindent > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dca03ec5f4d5ca28efc8a80c591412fab5821d81 --- libavcodec/ass_split.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index cdb1aa2..d3e8a8d 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -276,23 +276,23 @@ static const char *ass_split_section(ASSSplitContext *ctx, const char *buf) if (section->format_header && !order) { len = strlen(section->format_header); if (buf[len] == ':' && !strncmp(buf, section->format_header, len)) { -buf += len + 1; -while (!is_eol(*buf)) { -buf = skip_space(buf); -len = strcspn(buf, ", \r\n"); -if (!(tmp = av_realloc_array(order, (*number + 1), sizeof(*order -return NULL; -order = tmp; -order[*number] = -1; -for (i=0; section->fields[i].name; i++) -if (!strncmp(buf, section->fields[i].name, len)) { -order[*number] = i; -break; -} -(*number)++; -buf = skip_space(buf + len + (buf[len] == ',')); -} -ctx->field_order[ctx->current_section] = order; +buf += len + 1; +while (!is_eol(*buf)) { +buf = skip_space(buf); +len = strcspn(buf, ", \r\n"); +if (!(tmp = av_realloc_array(order, (*number + 1), sizeof(*order +return NULL; +order = tmp; +order[*number] = -1; +for (i=0; section->fields[i].name; i++) +if (!strncmp(buf, section->fields[i].name, len)) { +order[*number] = i; +break; +} +(*number)++; +buf = skip_space(buf + len + (buf[len] == ',')); +} +ctx->field_order[ctx->current_section] = order; goto next_line; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: add a flag to enable/disable automatic bitstream filtering
ffmpeg | branch: master | Rodger Combs | Thu Apr 7 02:59:39 2016 -0500| [1f6d7eb47070afc4394348721cd149f940ad2386] | committer: Rodger Combs lavf: add a flag to enable/disable automatic bitstream filtering This is mostly useful for muxers that wrap other muxers, such as dashenc and segment. The actual duplicated bitstream filtering is largely harmless, but delaying the header can cause problems when the muxer intended the header to be written to a separate file. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f6d7eb47070afc4394348721cd149f940ad2386 --- libavformat/avformat.h | 1 + libavformat/mux.c | 5 - libavformat/options_table.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 74915a1..43b225b 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1449,6 +1449,7 @@ typedef struct AVFormatContext { #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep it separate. #define AVFMT_FLAG_FAST_SEEK 0x8 ///< Enable fast, but inaccurate seeks for some formats #define AVFMT_FLAG_SHORTEST 0x10 ///< Stop muxing when the shortest stream stops. +#define AVFMT_FLAG_AUTO_BSF 0x20 ///< Wait for packet data before writing a header, and add bitstream filters as requested by the muxer /** * Maximum size of the data read from input for determining diff --git a/libavformat/mux.c b/libavformat/mux.c index 176af59..bbfc0fc 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -500,7 +500,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options) if ((ret = init_muxer(s, options)) < 0) return ret; -if (!s->oformat->check_bitstream) { +if (!(s->oformat->check_bitstream && s->flags & AVFMT_FLAG_AUTO_BSF)) { ret = write_header_internal(s); if (ret < 0) goto fail; @@ -830,6 +830,9 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket *pkt) { AVStream *st = s->streams[pkt->stream_index]; int i, ret; +if (!(s->flags & AVFMT_FLAG_AUTO_BSF)) +return 1; + if (s->oformat->check_bitstream) { if (!st->internal->bitstream_checked) { if ((ret = s->oformat->check_bitstream(s, pkt)) < 0) diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 699809a..9d61d5a 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -39,7 +39,7 @@ static const AVOption avformat_options[] = { {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 = 500 }, 32, INT64_MAX, D}, {"formatprobesize", "number of bytes to probe file format", OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, INT_MAX-1, D}, {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, -{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"}, +{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS | AVFMT_FLAG_AUTO_BSF }, INT_MIN, INT_MAX, D|E, "fflags"}, {"flush_packets", "reduce the latency by flushing out packets immediately", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, E, "fflags"}, {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"}, @@ -55,6 +55,7 @@ static const AVOption avformat_options[] = { {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D}, {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" }, {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" }, +{"autobsf", "add needed bsfs automatically (delays header until each stream's first packet is written)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_AUTO_BSF }, 0, 0, E, "fflags" }, {"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, D}, {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D}, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: add linker export script support on Darwin
ffmpeg | branch: master | Rodger Combs | Fri Sep 9 18:12:34 2016 -0500| [63fbeebf6ecb40b21db84d42f9f18867b3f89dca] | committer: Rodger Combs configure: add linker export script support on Darwin This isn't a "version script" in the usual sense, since it doesn't set symbol versions directly. Instead, the version for the whole .dylib is set in the linker flags, and we generate a list of symbol patterns to export. This allows us to keep our local symbols (e.g. ff_*) local on the platform. The Darwin linker's exported_symbols_list format is a bit different than the one used by the GNU linker. It doesn't handle local symbols at all, since when a list is provided, all unlisted symbols are local by default; thus, we remove local sections. It doesn't handle per-version sections, so we remove the headers and brackets. It expects symbols to be prefixed with an underscore. It errors if a listed symbol with no wildcards is not present in the output, so we append an asterisk to any symbol that doesn't already end in one. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63fbeebf6ecb40b21db84d42f9f18867b3f89dca --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 2b141fb..ee7e852 100755 --- a/configure +++ b/configure @@ -4705,6 +4705,8 @@ case $target_os in { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } check_header dispatch/dispatch.h && add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore' +version_script='-exported_symbols_list' +VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n /global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E "s/(.+[^*])/\1*/"' ;; msys*) die "Native MSYS builds are discouraged, please use the MINGW environment." ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog