[FFmpeg-cvslog] avcodec/nvenc: set correct error code
ffmpeg | branch: master | Pan Bian | Mon Nov 27 09:52:50 2017 +0800| [eb69e7bed80a1c8afee9acf9f8daff6be5e9ea62] | committer: Timo Rothenpieler avcodec/nvenc: set correct error code In function process_output_surface(), the return value is 0 on the path that av_mallocz() returns a NULL pointer. 0 indicates success, which deviates from the fact. Return "AVERROR(ENOMEM)" instead of "0". Signed-off-by: Pan Bian Signed-off-by: Timo Rothenpieler > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb69e7bed80a1c8afee9acf9f8daff6be5e9ea62 --- libavcodec/nvenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 79f7dce5f1..4a91d99720 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -1763,8 +1763,10 @@ static int process_output_surface(AVCodecContext *avctx, AVPacket *pkt, NvencSur } slice_offsets = av_mallocz(slice_mode_data * sizeof(*slice_offsets)); -if (!slice_offsets) +if (!slice_offsets) { +res = AVERROR(ENOMEM); goto error; +} lock_params.version = NV_ENC_LOCK_BITSTREAM_VER; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/hlsenc: Modularized playlist creation to allow reuse
ffmpeg | branch: master | Karthick J | Wed Nov 29 19:44:15 2017 +0800| [da49cdf6401ea3caa616c226f24dfb407633acd0] | committer: Steven Liu avformat/hlsenc: Modularized playlist creation to allow reuse > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da49cdf6401ea3caa616c226f24dfb407633acd0 --- libavformat/Makefile | 2 +- libavformat/hlsenc.c | 115 +++--- libavformat/hlsplaylist.c | 138 ++ libavformat/hlsplaylist.h | 51 + 4 files changed, 211 insertions(+), 95 deletions(-) diff --git a/libavformat/Makefile b/libavformat/Makefile index b1e7b193f4..fd8b9f9899 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -215,7 +215,7 @@ OBJS-$(CONFIG_HDS_MUXER) += hdsenc.o OBJS-$(CONFIG_HEVC_DEMUXER) += hevcdec.o rawdec.o OBJS-$(CONFIG_HEVC_MUXER)+= rawenc.o OBJS-$(CONFIG_HLS_DEMUXER) += hls.o -OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o +OBJS-$(CONFIG_HLS_MUXER) += hlsenc.o hlsplaylist.o OBJS-$(CONFIG_HNM_DEMUXER) += hnm.o OBJS-$(CONFIG_ICO_DEMUXER) += icodec.o OBJS-$(CONFIG_ICO_MUXER) += icoenc.o diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index d5c732f472..f63b08d709 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -46,6 +46,7 @@ #include "avformat.h" #include "avio_internal.h" #include "http.h" +#include "hlsplaylist.h" #include "internal.h" #include "os_support.h" @@ -97,13 +98,6 @@ typedef enum { SEGMENT_TYPE_FMP4, } SegmentType; -typedef enum { -PLAYLIST_TYPE_NONE, -PLAYLIST_TYPE_EVENT, -PLAYLIST_TYPE_VOD, -PLAYLIST_TYPE_NB, -} PlaylistType; - typedef struct VariantStream { unsigned number; int64_t sequence; @@ -1055,19 +1049,6 @@ static void hls_free_segments(HLSSegment *p) } } -static void write_m3u8_head_block(HLSContext *hls, AVIOContext *out, int version, - int target_duration, int64_t sequence) -{ -avio_printf(out, "#EXTM3U\n"); -avio_printf(out, "#EXT-X-VERSION:%d\n", version); -if (hls->allowcache == 0 || hls->allowcache == 1) { -avio_printf(out, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? "NO" : "YES"); -} -avio_printf(out, "#EXT-X-TARGETDURATION:%d\n", target_duration); -avio_printf(out, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); -av_log(hls, AV_LOG_VERBOSE, "EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence); -} - static void hls_rename_temp_file(AVFormatContext *s, AVFormatContext *oc) { size_t len = strlen(oc->filename); @@ -1133,8 +1114,7 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } -avio_printf(master_pb, "#EXTM3U\n"); -avio_printf(master_pb, "#EXT-X-VERSION:%d\n", hls->version); +ff_hls_write_playlist_version(master_pb, hls->version); /* For variant streams with video add #EXT-X-STREAM-INF tag with attributes*/ for (i = 0; i < hls->nb_varstreams; i++) { @@ -1175,18 +1155,7 @@ static int create_master_playlist(AVFormatContext *s, bandwidth += aud_st->codecpar->bit_rate; bandwidth += bandwidth / 10; -if (!bandwidth) { -av_log(NULL, AV_LOG_WARNING, -"Bandwidth info not available, set audio and video bitrates\n"); -av_freep(&m3u8_rel_name); -continue; -} - -avio_printf(master_pb, "#EXT-X-STREAM-INF:BANDWIDTH=%d", bandwidth); -if (vid_st && vid_st->codecpar->width > 0 && vid_st->codecpar->height > 0) -avio_printf(master_pb, ",RESOLUTION=%dx%d", vid_st->codecpar->width, -vid_st->codecpar->height); -avio_printf(master_pb, "\n%s\n\n", m3u8_rel_name); +ff_hls_write_stream_info(vid_st, master_pb, bandwidth, m3u8_rel_name); av_freep(&m3u8_rel_name); } @@ -1215,6 +1184,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) char *iv_string = NULL; AVDictionary *options = NULL; double prog_date_time = vs->initial_prog_date_time; +double *prog_date_time_p = (hls->flags & HLS_PROGRAM_DATE_TIME) ? &prog_date_time : NULL; int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0); hls->version = 3; @@ -1245,12 +1215,8 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) } vs->discontinuity_set = 0; -write_m3u8_head_block(hls, out, hls->version, target_duration, sequence); -if (hls->pl_type == PLAYLIST_TYPE_EVENT) { -avio_printf(out, "#EXT-X-PLAYLIST-TYPE:EVENT\n"); -} else if (hls->pl_type == PLAYLIST_TYPE_VOD) { -avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n"); -} +ff_hls_write_playlist_header(out, hls->version, hls->allowcache, + target_duration, sequence, hls->pl_type);
[FFmpeg-cvslog] avformat/hlsplaylist: fix header include guard
ffmpeg | branch: master | James Almer | Wed Nov 29 13:02:37 2017 -0300| [85b84e12433031efc11a079fa989d831a7b0099b] | committer: James Almer avformat/hlsplaylist: fix header include guard Fixes fate-source Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85b84e12433031efc11a079fa989d831a7b0099b --- libavformat/hlsplaylist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index fd36c7e6c2..3445b5f297 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVFORMAT_HLSPLAYLIST_H_ -#define AVFORMAT_HLSPLAYLIST_H_ +#ifndef AVFORMAT_HLSPLAYLIST_H +#define AVFORMAT_HLSPLAYLIST_H #include "libavutil/common.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/hlsplaylist: add missing header includes
ffmpeg | branch: master | James Almer | Wed Nov 29 13:09:23 2017 -0300| [91127355f5863e1f830e0a718036ad7189f42df3] | committer: James Almer avformat/hlsplaylist: add missing header includes Fixes checkheaders. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=91127355f5863e1f830e0a718036ad7189f42df3 --- libavformat/hlsplaylist.h | 4 1 file changed, 4 insertions(+) diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index 3445b5f297..9263a6463b 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -23,7 +23,11 @@ #ifndef AVFORMAT_HLSPLAYLIST_H #define AVFORMAT_HLSPLAYLIST_H +#include + #include "libavutil/common.h" +#include "avformat.h" +#include "avio.h" typedef enum { PLAYLIST_TYPE_NONE, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] vp9_parser: don't split superframes into separate packets
ffmpeg | branch: master | wm4 | Wed Nov 29 17:07:26 2017 +0100| [0c162854c1fa2a1e43ce5588b67842675f45e3c7] | committer: wm4 vp9_parser: don't split superframes into separate packets We did this for the sake of the decoder. With the vp9 change, it's not necessary anymore. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0c162854c1fa2a1e43ce5588b67842675f45e3c7 --- libavcodec/vp9_parser.c | 127 1 file changed, 10 insertions(+), 117 deletions(-) diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c index 9900e7ab1f..9531f34a32 100644 --- a/libavcodec/vp9_parser.c +++ b/libavcodec/vp9_parser.c @@ -25,21 +25,19 @@ #include "libavcodec/get_bits.h" #include "parser.h" -typedef struct VP9ParseContext { -int n_frames; // 1-8 -int size[8]; -int marker_size; -int64_t pts; -} VP9ParseContext; - -static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) +static int parse(AVCodecParserContext *ctx, + AVCodecContext *avctx, + const uint8_t **out_data, int *out_size, + const uint8_t *data, int size) { -VP9ParseContext *s = ctx->priv_data; GetBitContext gb; -int res, profile, keyframe, invisible; +int res, profile, keyframe; -if ((res = init_get_bits8(&gb, buf, size)) < 0) -return res; +*out_data = data; +*out_size = size; + +if ((res = init_get_bits8(&gb, data, size)) < 0) +return size; // parsers can't return errors get_bits(&gb, 2); // frame marker profile = get_bits1(&gb); profile |= get_bits1(&gb) << 1; @@ -47,10 +45,8 @@ static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) if (get_bits1(&gb)) { keyframe = 0; -invisible = 0; } else { keyframe = !get_bits1(&gb); -invisible = !get_bits1(&gb); } if (!keyframe) { @@ -61,113 +57,10 @@ static int parse_frame(AVCodecParserContext *ctx, const uint8_t *buf, int size) ctx->key_frame = 1; } -if (!invisible) { -if (ctx->pts == AV_NOPTS_VALUE) -ctx->pts = s->pts; -s->pts = AV_NOPTS_VALUE; -} else if (ctx->pts != AV_NOPTS_VALUE) { -s->pts = ctx->pts; -ctx->pts = AV_NOPTS_VALUE; -} - -return 0; -} - -static int parse(AVCodecParserContext *ctx, - AVCodecContext *avctx, - const uint8_t **out_data, int *out_size, - const uint8_t *data, int size) -{ -VP9ParseContext *s = ctx->priv_data; -int full_size = size; -int marker; - -if (size <= 0) { -*out_size = 0; -*out_data = data; - -return 0; -} - -if (s->n_frames > 0) { -int i; -int size_sum = 0; - -for (i = 0; i < s->n_frames ;i++) -size_sum += s->size[i]; -size_sum += s->marker_size; - -if (size_sum != size) { -av_log(avctx, AV_LOG_ERROR, "Inconsistent input frame sizes %d %d\n", - size_sum, size); -s->n_frames = 0; -} -} - -if (s->n_frames > 0) { -*out_data = data; -*out_size = s->size[--s->n_frames]; -parse_frame(ctx, *out_data, *out_size); - -return s->n_frames > 0 ? *out_size : size /* i.e. include idx tail */; -} - -marker = data[size - 1]; -if ((marker & 0xe0) == 0xc0) { -int nbytes = 1 + ((marker >> 3) & 0x3); -int n_frames = 1 + (marker & 0x7), idx_sz = 2 + n_frames * nbytes; - -if (size >= idx_sz && data[size - idx_sz] == marker) { -const uint8_t *idx = data + size + 1 - idx_sz; -int first = 1; - -switch (nbytes) { -#define case_n(a, rd) \ -case a: \ -while (n_frames--) { \ -unsigned sz = rd; \ -idx += a; \ -if (sz == 0 || sz > size) { \ -s->n_frames = 0; \ -*out_size = size; \ -*out_data = data; \ -av_log(avctx, AV_LOG_ERROR, \ - "Invalid superframe packet size: %u frame size: %d\n", \ - sz, size); \ -return full_size; \ -} \ -if (first) { \ -first = 0; \ -*out_data = data; \ -*out_size = sz; \ -s->n_frames = n_frames; \ -} else { \ -s->size[n_frames] = sz; \ -} \ -data += sz; \ -size -= sz; \ -} \ -s->marker_size = size; \ -parse_frame(ctx, *out_data, *out_size); \ -return s->n_frames > 0 ? *out_size : full_size - -case_n(1, *idx); -cas
[FFmpeg-cvslog] vp9: use superframe split BSF
ffmpeg | branch: master | wm4 | Fri Nov 17 14:15:22 2017 +0100| [a5679933c1b8b6bef5c5c3eb7c70d06c695066cf] | committer: wm4 vp9: use superframe split BSF webm usually has invisible superframes merged with normal frames. (vpxenc muxes them in this form, which is evidence enough that this is the standard webm packet format. It's rather unclear whether ffmpeg is even allowed to remux them with split packets.) The vp9 decoder needs them to be in separate packets for multithreading to work. Add the BSF to the decoder, so the conversion happens automatically. This contains the important part of fa1749dd34c55fb9, which was apparently skipped in commit d417e95af76. This restores Libav API compatibility. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5679933c1b8b6bef5c5c3eb7c70d06c695066cf --- libavcodec/version.h | 2 +- libavcodec/vp9.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/version.h b/libavcodec/version.h index 55bb5c5e01..d67b689142 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 6 -#define LIBAVCODEC_VERSION_MICRO 101 +#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 1ea2869c4c..6241f01de1 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -1795,6 +1795,7 @@ AVCodec ff_vp9_decoder = { .init_thread_copy = ONLY_IF_THREADS_ENABLED(vp9_decode_init_thread_copy), .update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context), .profiles = NULL_IF_CONFIG_SMALL(ff_vp9_profiles), +.bsfs = "vp9_superframe_split", .hw_configs= (const AVCodecHWConfigInternal*[]) { #if CONFIG_VP9_DXVA2_HWACCEL HWACCEL_DXVA2(vp9), ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/amfenc: move config.h include where it's needed
ffmpeg | branch: master | James Almer | Wed Nov 29 14:24:08 2017 -0300| [a198c1386a4f90cd6ae06874d1cdc2e3c0891fb8] | committer: James Almer avcodec/amfenc: move config.h include where it's needed Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a198c1386a4f90cd6ae06874d1cdc2e3c0891fb8 --- libavcodec/amfenc.c | 2 ++ libavcodec/amfenc.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index 49d64e6946..f8b68070ae 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.h" + #include "libavutil/avassert.h" #include "libavutil/imgutils.h" #include "libavutil/hwcontext.h" diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h index 8b59b506c5..84f0aad2fa 100644 --- a/libavcodec/amfenc.h +++ b/libavcodec/amfenc.h @@ -26,7 +26,6 @@ #include "libavutil/fifo.h" -#include "config.h" #include "avcodec.h" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc/samidec: properly raise errors from sami_paragraph_to_ass()
ffmpeg | branch: master | Clément Bœsch | Wed Nov 29 22:23:36 2017 +0100| [8d51d10eb895bda02ab0f8b3af082b5c9a781690] | committer: Clément Bœsch lavc/samidec: properly raise errors from sami_paragraph_to_ass() > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d51d10eb895bda02ab0f8b3af082b5c9a781690 --- libavcodec/samidec.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 6a598060ef..e32f238c62 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -138,9 +138,12 @@ static int sami_decode_frame(AVCodecContext *avctx, const char *ptr = avpkt->data; SAMIContext *sami = avctx->priv_data; -if (ptr && avpkt->size > 0 && !sami_paragraph_to_ass(avctx, ptr)) { +if (ptr && avpkt->size > 0) { +int ret = sami_paragraph_to_ass(avctx, ptr); +if (ret < 0) +return ret; // TODO: pass escaped sami->encoded_source.str as source -int ret = ff_ass_add_rect(sub, sami->full.str, sami->readorder++, 0, NULL, NULL); +ret = ff_ass_add_rect(sub, sami->full.str, sami->readorder++, 0, NULL, NULL); if (ret < 0) return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/samidec: check av_strdup() return value
ffmpeg | branch: master | Pan Bian | Mon Nov 27 14:56:32 2017 +0800| [61bbc537ab2305392bd170a6f404ed6402bee4a8] | committer: Clément Bœsch avcodec/samidec: check av_strdup() return value In function sami_paragraph_to_ass(), the return value of av_strdup() is not checked. To avoid potential NULL dereference, the return value should be checked against NULL. Signed-off-by: Pan Bian > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=61bbc537ab2305392bd170a6f404ed6402bee4a8 --- libavcodec/samidec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/samidec.c b/libavcodec/samidec.c index 2620424750..6a598060ef 100644 --- a/libavcodec/samidec.c +++ b/libavcodec/samidec.c @@ -48,6 +48,9 @@ static int sami_paragraph_to_ass(AVCodecContext *avctx, const char *src) AVBPrint *dst_content = &sami->encoded_content; AVBPrint *dst_source = &sami->encoded_source; +if (!dupsrc) +return AVERROR(ENOMEM); + av_bprint_clear(&sami->encoded_content); av_bprint_clear(&sami->content); av_bprint_clear(&sami->encoded_source); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] examples/hw_decode: Use hw-config information to find pixfmt
ffmpeg | branch: master | Mark Thompson | Tue Nov 28 13:58:31 2017 +| [b0d9eab7f202f439b7c28e23ed1852abc814cd52] | committer: Mark Thompson examples/hw_decode: Use hw-config information to find pixfmt This removes all remaining device-type specificity. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0d9eab7f202f439b7c28e23ed1852abc814cd52 --- doc/examples/hw_decode.c | 54 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/doc/examples/hw_decode.c b/doc/examples/hw_decode.c index 9c7adbf51a..83a5808bf7 100644 --- a/doc/examples/hw_decode.c +++ b/doc/examples/hw_decode.c @@ -44,34 +44,6 @@ static AVBufferRef *hw_device_ctx = NULL; static enum AVPixelFormat hw_pix_fmt; static FILE *output_file = NULL; -static enum AVPixelFormat find_fmt_by_hw_type(const enum AVHWDeviceType type) -{ -enum AVPixelFormat fmt; - -switch (type) { -case AV_HWDEVICE_TYPE_VAAPI: -fmt = AV_PIX_FMT_VAAPI; -break; -case AV_HWDEVICE_TYPE_DXVA2: -fmt = AV_PIX_FMT_DXVA2_VLD; -break; -case AV_HWDEVICE_TYPE_D3D11VA: -fmt = AV_PIX_FMT_D3D11; -break; -case AV_HWDEVICE_TYPE_VDPAU: -fmt = AV_PIX_FMT_VDPAU; -break; -case AV_HWDEVICE_TYPE_VIDEOTOOLBOX: -fmt = AV_PIX_FMT_VIDEOTOOLBOX; -break; -default: -fmt = AV_PIX_FMT_NONE; -break; -} - -return fmt; -} - static int hw_decoder_init(AVCodecContext *ctx, const enum AVHWDeviceType type) { int err = 0; @@ -184,18 +156,22 @@ int main(int argc, char *argv[]) AVCodec *decoder = NULL; AVPacket packet; enum AVHWDeviceType type; +int i; if (argc < 4) { -fprintf(stderr, "Usage: %s \n", argv[0]); +fprintf(stderr, "Usage: %s \n", argv[0]); return -1; } av_register_all(); type = av_hwdevice_find_type_by_name(argv[1]); -hw_pix_fmt = find_fmt_by_hw_type(type); -if (hw_pix_fmt == -1) { -fprintf(stderr, "Cannot support '%s' in this example.\n", argv[1]); +if (type == AV_HWDEVICE_TYPE_NONE) { +fprintf(stderr, "Device type %s is not supported.\n", argv[1]); +fprintf(stderr, "Available device types:"); +while((type = av_hwdevice_iterate_types(type)) != AV_HWDEVICE_TYPE_NONE) +fprintf(stderr, " %s", av_hwdevice_get_type_name(type)); +fprintf(stderr, "\n"); return -1; } @@ -218,6 +194,20 @@ int main(int argc, char *argv[]) } video_stream = ret; +for (i = 0;; i++) { +const AVCodecHWConfig *config = avcodec_get_hw_config(decoder, i); +if (!config) { +fprintf(stderr, "Decoder %s does not support device type %s.\n", +decoder->name, av_hwdevice_get_type_name(type)); +return -1; +} +if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && +config->device_type == type) { +hw_pix_fmt = config->pix_fmt; +break; +} +} + if (!(decoder_ctx = avcodec_alloc_context3(decoder))) return AVERROR(ENOMEM); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '45d7be7f930cf707ead07416e10e2d0e061e99ce'
ffmpeg | branch: master | James Almer | Wed Nov 29 21:06:23 2017 -0300| [eb01ac6c75b5b42a9d50d405248cb3315ccb3965] | committer: James Almer Merge commit '45d7be7f930cf707ead07416e10e2d0e061e99ce' * commit '45d7be7f930cf707ead07416e10e2d0e061e99ce': prores: Always assume limited range This commit is a noop, see 755207dc53d6d18a4a9e07ffb0d3a10f75836f79 Merged-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eb01ac6c75b5b42a9d50d405248cb3315ccb3965 --- ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e'
ffmpeg | branch: master | James Almer | Wed Nov 29 21:04:33 2017 -0300| [dde7b1d4857fa710113d1fc365bc4ea7707e3156] | committer: James Almer Merge commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e' * commit 'b843b343d8a3210ae37a2342b1904a5bd1e5fc6e': qsvenc: cavlc option is only available for h264 Merged-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dde7b1d4857fa710113d1fc365bc4ea7707e3156 --- libavcodec/qsvenc.c | 17 + libavcodec/qsvenc.h | 1 - libavcodec/qsvenc_h264.c | 5 - 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 2bc19f5241..fbd4d85379 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -532,14 +532,6 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (avctx->codec_id != AV_CODEC_ID_HEVC) { q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; q->extco.Header.BufferSz = sizeof(q->extco); -#if FF_API_CODER_TYPE -FF_DISABLE_DEPRECATION_WARNINGS -if (avctx->coder_type != 0) -q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC; -FF_ENABLE_DEPRECATION_WARNINGS -#endif -q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON - : MFX_CODINGOPTION_UNKNOWN; q->extco.PicTimingSEI = q->pic_timing_sei ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN; @@ -548,6 +540,15 @@ FF_ENABLE_DEPRECATION_WARNINGS q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (avctx->codec_id == AV_CODEC_ID_H264) { +#if FF_API_CODER_TYPE +FF_DISABLE_DEPRECATION_WARNINGS +if (avctx->coder_type >= 0) +q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON + : MFX_CODINGOPTION_UNKNOWN; + if (avctx->strict_std_compliance != FF_COMPLIANCE_NORMAL) q->extco.NalHrdConformance = avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index 12e3444b75..5cfd17446d 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -70,7 +70,6 @@ { "adaptive_i", "Adaptive I-frame placement", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ -{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, \ typedef int SetEncodeCtrlCB (AVCodecContext *avctx, const AVFrame *frame, mfxEncodeCtrl* enc_ctrl); diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 389335f39d..3242062b40 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -102,6 +102,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx) static const AVOption options[] = { QSV_COMMON_OPTS +{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "pic_timing_sei","Insert picture timing SEI with pic_struct_syntax element", OFFSET(qsv.pic_timing_sei), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, VE }, { "single_sei_nal_unit","Put all the SEI messages into one NALU", OFFSET(qsv.single_sei_nal_unit), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, @@ -154,7 +155,9 @@ static const AVCodecDefault qsv_enc_defaults[] = { // same as the x264 default { "g", "250" }, { "bf","3" }, -{ "coder", "ac"}, +#if FF_API_CODER_TYPE +{ "coder", "-1"}, +#endif { "flags", "+cgop" }, #if FF_API_PRIVATE_OPT == diff --cc libavcodec/qsvenc.c index 2bc19f5241,9db9eb375c..fbd4d85379 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@@ -532,18 -540,7 +532,10 @@@ static int init_video_param(AVCodecCont if (avctx->codec_id != AV_CODEC_ID_HEVC) { q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; q->extco.Header.BufferSz = sizeof(q->extco); - #if FF_API_CODER_TYPE - FF_DISA
[FFmpeg-cvslog] stereo3d: Support view type for frame sequence type
ffmpeg | branch: master | Vittorio Giovara | Mon Sep 25 15:09:21 2017 +0200| [99e9697e3a12ab4a6638a36b95edafd6a98f9eaa] | committer: Vittorio Giovara stereo3d: Support view type for frame sequence type Implement detection in h264 and hevc and insertion in framepack filter. Signed-off-by: Vittorio Giovara > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99e9697e3a12ab4a6638a36b95edafd6a98f9eaa --- doc/APIchanges | 3 +++ libavcodec/h264_sei.c | 7 --- libavcodec/h264_sei.h | 1 + libavcodec/h264_slice.c| 7 +++ libavcodec/hevc_sei.c | 9 + libavcodec/hevc_sei.h | 1 + libavcodec/hevcdec.c | 7 +++ libavfilter/vf_framepack.c | 2 ++ libavutil/stereo3d.h | 24 libavutil/version.h| 2 +- 10 files changed, 55 insertions(+), 8 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 9f3a1f2465..a7ecbcdaae 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2017-03-23 API changes, most recent first: +2017-xx-xx - xxx - lavu 56.7.0 - stereo3d.h + Add view field to AVStereo3D structure and AVStereo3DView enum. + 2017-xx-xx - xxx - lavc 58.5.0 - avcodec.h Add avcodec_get_hw_frames_parameters(). diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index 03fca9017f..da5d33c36c 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -314,10 +314,11 @@ static int decode_frame_packing_arrangement(H264SEIFramePacking *h, h->quincunx_subsampling = get_bits1(gb); h->content_interpretation_type= get_bits(gb, 6); -// the following skips: spatial_flipping_flag, frame0_flipped_flag, -// field_views_flag, current_frame_is_frame0_flag, +// spatial_flipping_flag, frame0_flipped_flag, field_views_flag +skip_bits(gb, 3); +h->current_frame_is_frame0_flag = get_bits1(gb); // frame0_self_contained_flag, frame1_self_contained_flag -skip_bits(gb, 6); +skip_bits(gb, 2); if (!h->quincunx_subsampling && h->arrangement_type != 5) skip_bits(gb, 16); // frame[01]_grid_position_[xy] diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h index f6ac6034da..c3a19dd831 100644 --- a/libavcodec/h264_sei.h +++ b/libavcodec/h264_sei.h @@ -108,6 +108,7 @@ typedef struct H264SEIFramePacking { int arrangement_type; int content_interpretation_type; int quincunx_subsampling; +int current_frame_is_frame0_flag; } H264SEIFramePacking; typedef struct H264SEIDisplayOrientation { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 5dd01d836e..1b968ebd50 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1112,6 +1112,13 @@ static int h264_export_frame_props(H264Context *h) if (fp->content_interpretation_type == 2) stereo->flags = AV_STEREO3D_FLAG_INVERT; + +if (fp->arrangement_type == 5) { +if (fp->current_frame_is_frame0_flag) +stereo->view = AV_STEREO3D_VIEW_LEFT; +else +stereo->view = AV_STEREO3D_VIEW_RIGHT; +} } if (h->sei.display_orientation.present && diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 0a5d4440bf..2bf170601d 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -57,10 +57,11 @@ static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetB s->quincunx_subsampling = get_bits1(gb); s->content_interpretation_type= get_bits(gb, 6); -// the following skips spatial_flipping_flag frame0_flipped_flag -// field_views_flag current_frame_is_frame0_flag -// frame0_self_contained_flag frame1_self_contained_flag -skip_bits(gb, 6); +// spatial_flipping_flag, frame0_flipped_flag, field_views_flag +skip_bits(gb, 3); +s->current_frame_is_frame0_flag = get_bits1(gb); +// frame0_self_contained_flag, frame1_self_contained_flag +skip_bits(gb, 2); if (!s->quincunx_subsampling && s->arrangement_type != 5) skip_bits(gb, 16); // frame[01]_grid_position_[xy] diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h index e4aeac1fbe..8d4f5df69f 100644 --- a/libavcodec/hevc_sei.h +++ b/libavcodec/hevc_sei.h @@ -67,6 +67,7 @@ typedef struct HEVCSEIFramePacking { int arrangement_type; int content_interpretation_type; int quincunx_subsampling; +int current_frame_is_frame0_flag; } HEVCSEIFramePacking; typedef struct HEVCSEIDisplayOrientation { diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index a1619cf4bd..f1d1c77497 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2397,6 +2397,13 @@ static int set_side_data(HEVCContext *s) if (s->sei.frame_packing.content_interpretation_type == 2) stereo->flags = AV_STEREO3D_FLAG_INVERT; + +
[FFmpeg-cvslog] qsvenc: cavlc option is only available for h264
ffmpeg | branch: master | Li, Zhong | Mon Nov 27 11:19:57 2017 -0500| [b843b343d8a3210ae37a2342b1904a5bd1e5fc6e] | committer: Maxym Dmytrychenko qsvenc: cavlc option is only available for h264 Moving option definition to h264 implementation and fixing command line defaults in order to properly respect cavlc input value Signed-off-by: Zhong Li Signed-off-by: Maxym Dmytrychenko > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b843b343d8a3210ae37a2342b1904a5bd1e5fc6e --- libavcodec/qsvenc.c | 17 + libavcodec/qsvenc.h | 3 +-- libavcodec/qsvenc_h264.c | 5 - 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index c7e5947361..9db9eb375c 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -540,19 +540,20 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (avctx->codec_id != AV_CODEC_ID_HEVC) { q->extco.Header.BufferId = MFX_EXTBUFF_CODING_OPTION; q->extco.Header.BufferSz = sizeof(q->extco); -#if FF_API_CODER_TYPE -FF_DISABLE_DEPRECATION_WARNINGS -if (avctx->coder_type != 0) -q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC; -FF_ENABLE_DEPRECATION_WARNINGS -#endif -q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON - : MFX_CODINGOPTION_UNKNOWN; if (q->rdo >= 0) q->extco.RateDistortionOpt = q->rdo > 0 ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; if (avctx->codec_id == AV_CODEC_ID_H264) { +#if FF_API_CODER_TYPE +FF_DISABLE_DEPRECATION_WARNINGS +if (avctx->coder_type >= 0) +q->cavlc = avctx->coder_type == FF_CODER_TYPE_VLC; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +q->extco.CAVLC = q->cavlc ? MFX_CODINGOPTION_ON + : MFX_CODINGOPTION_UNKNOWN; + if (avctx->strict_std_compliance != FF_COMPLIANCE_NORMAL) q->extco.NalHrdConformance = avctx->strict_std_compliance > FF_COMPLIANCE_NORMAL ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h index a6399040e9..9b0b84b919 100644 --- a/libavcodec/qsvenc.h +++ b/libavcodec/qsvenc.h @@ -66,8 +66,7 @@ { "extbrc", "Extended bitrate control", OFFSET(qsv.extbrc), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "adaptive_i", "Adaptive I-frame placement", OFFSET(qsv.adaptive_i), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ { "adaptive_b", "Adaptive B-frame placement", OFFSET(qsv.adaptive_b), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ -{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, \ -{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, \ +{ "b_strategy", "Strategy to choose between I/P/B-frames", OFFSET(qsv.b_strategy),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, typedef struct QSVEncContext { AVCodecContext *avctx; diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index a968dcfdf5..1365faccea 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -67,6 +67,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx) static const AVOption options[] = { QSV_COMMON_OPTS +{ "cavlc", "Enable CAVLC", OFFSET(qsv.cavlc), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE }, { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE }, { "single_sei_nal_unit","Put all the SEI messages into one NALU", OFFSET(qsv.single_sei_nal_unit), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, { "max_dec_frame_buffering", "Maximum number of frames buffered in the DPB", OFFSET(qsv.max_dec_frame_buffering), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UINT16_MAX, VE }, @@ -106,7 +107,9 @@ static const AVCodecDefault qsv_enc_defaults[] = { // same as the x264 default { "g", "250" }, { "bf","3" }, -{ "coder", "ac"}, +#if FF_API_CODER_TYPE +{ "coder", "-1"}, +#endif { "flags", "+cgop" }, #if FF_API_PRIVATE_OPT ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
ffmpeg | branch: master | James Almer | Wed Nov 29 21:06:49 2017 -0300| [d268094f889479a8edee43d8c847da8838b8bf0f] | committer: James Almer Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa' * commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa': stereo3d: Support view type for frame sequence type Merged-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d268094f889479a8edee43d8c847da8838b8bf0f --- doc/APIchanges | 3 +++ libavcodec/h264_sei.c | 7 --- libavcodec/h264_sei.h | 1 + libavcodec/h264_slice.c| 7 +++ libavcodec/hevc_sei.c | 9 + libavcodec/hevc_sei.h | 1 + libavcodec/hevcdec.c | 7 +++ libavfilter/vf_framepack.c | 2 ++ libavutil/stereo3d.h | 24 libavutil/version.h| 3 +-- tests/ref/fate/vp8-alpha | 2 +- 11 files changed, 56 insertions(+), 10 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 44a740e51f..4af69c64bd 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2017-xx-xx - xxx - lavu 56.4.100 / 56.7.0 - stereo3d.h + Add view field to AVStereo3D structure and AVStereo3DView enum. + 2017-xx-xx - xxx - lavc 58.6.100 - avcodec.h Add const to AVCodecContext.hwaccel. diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index ae5f39f775..27a37247b5 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -322,10 +322,11 @@ static int decode_frame_packing_arrangement(H264SEIFramePacking *h, h->quincunx_sampling_flag = get_bits1(gb); h->content_interpretation_type= get_bits(gb, 6); -// the following skips: spatial_flipping_flag, frame0_flipped_flag, -// field_views_flag, current_frame_is_frame0_flag, +// spatial_flipping_flag, frame0_flipped_flag, field_views_flag +skip_bits(gb, 3); +h->current_frame_is_frame0_flag = get_bits1(gb); // frame0_self_contained_flag, frame1_self_contained_flag -skip_bits(gb, 6); +skip_bits(gb, 2); if (!h->quincunx_sampling_flag && h->frame_packing_arrangement_type != 5) skip_bits(gb, 16); // frame[01]_grid_position_[xy] diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h index a53f1899fa..817b4eaae9 100644 --- a/libavcodec/h264_sei.h +++ b/libavcodec/h264_sei.h @@ -125,6 +125,7 @@ typedef struct H264SEIFramePacking { int frame_packing_arrangement_repetition_period; int content_interpretation_type; int quincunx_sampling_flag; +int current_frame_is_frame0_flag; } H264SEIFramePacking; typedef struct H264SEIDisplayOrientation { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index da76b9293f..fff3112649 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1233,6 +1233,13 @@ static int h264_export_frame_props(H264Context *h) if (fp->content_interpretation_type == 2) stereo->flags = AV_STEREO3D_FLAG_INVERT; + +if (fp->frame_packing_arrangement_type == 5) { +if (fp->current_frame_is_frame0_flag) +stereo->view = AV_STEREO3D_VIEW_LEFT; +else +stereo->view = AV_STEREO3D_VIEW_RIGHT; +} } } diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 6ce1669820..8dd975508a 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -95,10 +95,11 @@ static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetB s->quincunx_subsampling = get_bits1(gb); s->content_interpretation_type= get_bits(gb, 6); -// the following skips spatial_flipping_flag frame0_flipped_flag -// field_views_flag current_frame_is_frame0_flag -// frame0_self_contained_flag frame1_self_contained_flag -skip_bits(gb, 6); +// spatial_flipping_flag, frame0_flipped_flag, field_views_flag +skip_bits(gb, 3); +s->current_frame_is_frame0_flag = get_bits1(gb); +// frame0_self_contained_flag, frame1_self_contained_flag +skip_bits(gb, 2); if (!s->quincunx_subsampling && s->arrangement_type != 5) skip_bits(gb, 16); // frame[01]_grid_position_[xy] diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h index d290aaab53..e92da25bbf 100644 --- a/libavcodec/hevc_sei.h +++ b/libavcodec/hevc_sei.h @@ -67,6 +67,7 @@ typedef struct HEVCSEIFramePacking { int arrangement_type; int content_interpretation_type; int quincunx_subsampling; +int current_frame_is_frame0_flag; } HEVCSEIFramePacking; typedef struct HEVCSEIDisplayOrientation { diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 5ec6105d2f..433a7056ea 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2647,6 +2647,13 @@ static int set_side_data(HEVCContext *s) if (s->sei.frame_packing.content
[FFmpeg-cvslog] prores: Always assume limited range
ffmpeg | branch: master | Vittorio Giovara | Wed Sep 27 17:28:55 2017 -0400| [45d7be7f930cf707ead07416e10e2d0e061e99ce] | committer: Vittorio Giovara prores: Always assume limited range As defined by the specification. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=45d7be7f930cf707ead07416e10e2d0e061e99ce --- libavcodec/proresdec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/proresdec.c b/libavcodec/proresdec.c index 8a53719d9f..1659927e66 100644 --- a/libavcodec/proresdec.c +++ b/libavcodec/proresdec.c @@ -176,6 +176,7 @@ static int decode_frame_header(ProresContext *ctx, const uint8_t *buf, avctx->color_primaries = buf[14]; avctx->color_trc = buf[15]; avctx->colorspace = buf[16]; +avctx->color_range = AVCOL_RANGE_MPEG; ctx->qmat_changed = 0; ptr = buf + 20; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/dnxhddec: Do not overwrite colorspace if the container has set it.
ffmpeg | branch: master | Steven Robertson | Tue Nov 28 16:49:46 2017 -0800| [c6a905b91d935f78f5c33f6ce2dbe294b3353b77] | committer: Michael Niedermayer avcodec/dnxhddec: Do not overwrite colorspace if the container has set it. The existing logic overrides container metadata even in cases where the container metadata must be trusted (e.g. HDR). The original spec had no provision for specifying color volume, so many files rely on the assumption of Rec. 709. An update to the spec included a 'clv' field for explicitly signaling that the container should be trusted in an existing bitfield in the frame header, but the default of 0 from old encoders forces Rec. 709, which would break any HDR stream. Because there is no place in DNxHR for specifying a transfer function, DNxHR HDR files must include container-level color information. This patch maintains the existing behavior of choosing the 709 over the 601 matrix when container-level information is missing, and allows container-level information to win if present. Signed-off-by: Steven Robertson Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6a905b91d935f78f5c33f6ce2dbe294b3353b77 --- libavcodec/dnxhddec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index f46e41a456..05f4458f99 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -93,7 +93,9 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx) ctx->avctx = avctx; ctx->cid = -1; -avctx->colorspace = AVCOL_SPC_BT709; +if (avctx->colorspace == AVCOL_SPC_UNSPECIFIED) { +avctx->colorspace = AVCOL_SPC_BT709; +} avctx->coded_width = FFALIGN(avctx->width, 16); avctx->coded_height = FFALIGN(avctx->height, 16); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse
ffmpeg | branch: master | Karthick J | Thu Nov 30 10:54:54 2017 +0800| [3684b5e56a54b850bd725ffc63cb454e23fd79db] | committer: Steven Liu avformat/hlsenc: Refactored 'get_int_from_double' function to allow reuse > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3684b5e56a54b850bd725ffc63cb454e23fd79db --- libavformat/hlsenc.c | 7 +-- libavformat/hlsplaylist.h | 5 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index f63b08d709..cdfbf45823 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -203,11 +203,6 @@ typedef struct HLSContext { int http_persistent; } HLSContext; -static int get_int_from_double(double val) -{ -return (int)((val - (int)val) >= 0.001) ? (int)(val + 1) : (int)val; -} - static int mkdir_p(const char *path) { int ret = 0; char *temp = av_strdup(path); @@ -1211,7 +1206,7 @@ static int hls_window(AVFormatContext *s, int last, VariantStream *vs) for (en = vs->segments; en; en = en->next) { if (target_duration <= en->duration) -target_duration = get_int_from_double(en->duration); +target_duration = hls_get_int_from_double(en->duration); } vs->discontinuity_set = 0; diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index 9263a6463b..4cbc8cacc9 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -36,6 +36,11 @@ typedef enum { PLAYLIST_TYPE_NB, } PlaylistType; +static inline int hls_get_int_from_double(double val) +{ +return (int)((val - (int)val) >= 0.001) ? (int)(val + 1) : (int)val; +} + void ff_hls_write_playlist_version(AVIOContext *out, int version); void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/dashenc: Option to generate hls playlist as well
ffmpeg | branch: master | Karthick J | Thu Nov 30 10:55:51 2017 +0800| [8c2b37e678e3d5ab16fef471fffc741b88622a85] | committer: Steven Liu avformat/dashenc: Option to generate hls playlist as well This is to take full advantage of Common Media Application Format(CMAF). Now server can generate one content and serve both HLS and DASH players. Reviewed-by: Steven Liu > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c2b37e678e3d5ab16fef471fffc741b88622a85 --- doc/muxers.texi | 3 ++ libavformat/Makefile | 2 +- libavformat/dashenc.c | 110 +++--- 3 files changed, 108 insertions(+), 7 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 8ec48c2055..3d0c7bfbd3 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -249,6 +249,9 @@ DASH-templated name to used for the media segments. Default is "chunk-stream$Rep URL of the page that will return the UTC timestamp in ISO format. Example: "https://time.akamai.com/?iso"; @item -http_user_agent @var{user_agent} Override User-Agent field in HTTP header. Applicable only for HTTP output. +@item -hls_playlist @var{hls_playlist} +Generate HLS playlist files as well. The master playlist is generated with the filename master.m3u8. +One media playlist file is generated for each stream with filenames media_0.m3u8, media_1.m3u8, etc. @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. diff --git a/libavformat/Makefile b/libavformat/Makefile index fd8b9f9899..4bffdf2205 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -135,7 +135,7 @@ OBJS-$(CONFIG_CONCAT_DEMUXER)+= concatdec.o OBJS-$(CONFIG_CRC_MUXER) += crcenc.o OBJS-$(CONFIG_DATA_DEMUXER) += rawdec.o OBJS-$(CONFIG_DATA_MUXER)+= rawenc.o -OBJS-$(CONFIG_DASH_MUXER)+= dash.o dashenc.o +OBJS-$(CONFIG_DASH_MUXER)+= dash.o dashenc.o hlsplaylist.o OBJS-$(CONFIG_DASH_DEMUXER) += dash.o dashdec.o OBJS-$(CONFIG_DAUD_DEMUXER) += dauddec.o OBJS-$(CONFIG_DAUD_MUXER)+= daudenc.o diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 0fee3cd86a..1783675d00 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -36,6 +36,7 @@ #include "avc.h" #include "avformat.h" #include "avio_internal.h" +#include "hlsplaylist.h" #include "internal.h" #include "isom.h" #include "os_support.h" @@ -101,6 +102,8 @@ typedef struct DASHContext { const char *media_seg_name; const char *utc_timing_url; const char *user_agent; +int hls_playlist; +int master_playlist_created; } DASHContext; static struct codec_string { @@ -217,6 +220,14 @@ static void set_http_options(AVDictionary **options, DASHContext *c) av_dict_set(options, "user_agent", c->user_agent, 0); } +static void get_hls_playlist_name(char *playlist_name, int string_size, + const char *base_url, int id) { +if (base_url) +snprintf(playlist_name, string_size, "%smedia_%d.m3u8", base_url, id); +else +snprintf(playlist_name, string_size, "media_%d.m3u8", id); +} + static int flush_init_segment(AVFormatContext *s, OutputStream *os) { DASHContext *c = s->priv_data; @@ -262,7 +273,8 @@ static void dash_free(AVFormatContext *s) av_freep(&c->streams); } -static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext *c) +static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext *c, +int representation_id, int final) { int i, start_index = 0, start_number = 1; if (c->window_size) { @@ -322,6 +334,55 @@ static void output_segment_list(OutputStream *os, AVIOContext *out, DASHContext } avio_printf(out, "\t\t\t\t\n"); } +if (c->hls_playlist && start_index < os->nb_segments) +{ +int timescale = os->ctx->streams[0]->time_base.den; +char temp_filename_hls[1024]; +char filename_hls[1024]; +AVIOContext *out_hls = NULL; +AVDictionary *http_opts = NULL; +int target_duration = 0; +const char *proto = avio_find_protocol_name(c->dirname); +int use_rename = proto && !strcmp(proto, "file"); + +get_hls_playlist_name(filename_hls, sizeof(filename_hls), + c->dirname, representation_id); + +snprintf(temp_filename_hls, sizeof(temp_filename_hls), use_rename ? "%s.tmp" : "%s", filename_hls); + +set_http_options(&http_opts, c); +avio_open2(&out_hls, temp_filename_hls, AVIO_FLAG_WRITE, NULL, &http_opts); +av_dict_free(&http_opts); +for (i = start_index; i < os->nb_segments; i++) { +Segment *seg = os->segments[
[FFmpeg-cvslog] avformat/avc: free buffer in ff_isom_write_avcc on failure
ffmpeg | branch: master | James Almer | Fri Nov 24 20:26:08 2017 -0300| [d5af8afbe4698273b2ef9b57487489b40f7888b1] | committer: James Almer avformat/avc: free buffer in ff_isom_write_avcc on failure Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d5af8afbe4698273b2ef9b57487489b40f7888b1 --- libavformat/avc.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index 85441df8f7..d989594bb0 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -145,8 +145,10 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) buf += size; } -if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) -return AVERROR_INVALIDDATA; +if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) { +ret = AVERROR_INVALIDDATA; +goto fail; +} avio_w8(pb, 1); /* version */ avio_w8(pb, sps[1]); /* profile */ @@ -160,9 +162,11 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) avio_w8(pb, 1); /* number of pps */ avio_wb16(pb, pps_size); avio_write(pb, pps, pps_size); + +fail: av_free(start); -return 0; +return ret; } int ff_avc_write_annexb_extradata(const uint8_t *in, uint8_t **buf, int *size) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/avc: refactor ff_isom_write_avcc
ffmpeg | branch: master | James Almer | Fri Nov 24 19:45:54 2017 -0300| [9cd361c5c1f3550df9b2d4bd13b02ea592727f7c] | committer: James Almer avformat/avc: refactor ff_isom_write_avcc This lets us remove one indentation level. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9cd361c5c1f3550df9b2d4bd13b02ea592727f7c --- libavformat/avc.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index 5232ed55f8..a764ec0422 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -105,17 +105,22 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { +uint8_t *buf = NULL, *end, *start = NULL; +uint8_t *sps = NULL, *pps = NULL; +uint32_t sps_size = 0, pps_size = 0; +int ret; + if (len <= 6) return AVERROR_INVALIDDATA; /* check for H.264 start code */ -if (AV_RB32(data) == 0x0001 || -AV_RB24(data) == 0x01) { -uint8_t *buf=NULL, *end, *start; -uint32_t sps_size=0, pps_size=0; -uint8_t *sps=0, *pps=0; +if (AV_RB32(data) != 0x0001 && +AV_RB24(data) != 0x01) { +avio_write(pb, data, len); +return 0; +} -int ret = ff_avc_parse_nal_units_buf(data, &buf, &len); +ret = ff_avc_parse_nal_units_buf(data, &buf, &len); if (ret < 0) return ret; start = buf; @@ -156,9 +161,6 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) avio_wb16(pb, pps_size); avio_write(pb, pps, pps_size); av_free(start); -} else { -avio_write(pb, data, len); -} return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/avc: reindent after the last commit
ffmpeg | branch: master | James Almer | Fri Nov 24 19:47:47 2017 -0300| [df20619b649e82598d0e6efab291b427922b8ca4] | committer: James Almer avformat/avc: reindent after the last commit Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=df20619b649e82598d0e6efab291b427922b8ca4 --- libavformat/avc.c | 91 --- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index a764ec0422..85441df8f7 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -113,54 +113,55 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) if (len <= 6) return AVERROR_INVALIDDATA; -/* check for H.264 start code */ -if (AV_RB32(data) != 0x0001 && -AV_RB24(data) != 0x01) { -avio_write(pb, data, len); -return 0; +/* check for H.264 start code */ +if (AV_RB32(data) != 0x0001 && +AV_RB24(data) != 0x01) { +avio_write(pb, data, len); +return 0; +} + +ret = ff_avc_parse_nal_units_buf(data, &buf, &len); +if (ret < 0) +return ret; +start = buf; +end = buf + len; + +/* look for sps and pps */ +while (end - buf > 4) { +uint32_t size; +uint8_t nal_type; +size = FFMIN(AV_RB32(buf), end - buf - 4); +buf += 4; +nal_type = buf[0] & 0x1f; + +if (nal_type == 7) { /* SPS */ +sps = buf; +sps_size = size; +} else if (nal_type == 8) { /* PPS */ +pps = buf; +pps_size = size; } -ret = ff_avc_parse_nal_units_buf(data, &buf, &len); -if (ret < 0) -return ret; -start = buf; -end = buf + len; - -/* look for sps and pps */ -while (end - buf > 4) { -uint32_t size; -uint8_t nal_type; -size = FFMIN(AV_RB32(buf), end - buf - 4); -buf += 4; -nal_type = buf[0] & 0x1f; - -if (nal_type == 7) { /* SPS */ -sps = buf; -sps_size = size; -} else if (nal_type == 8) { /* PPS */ -pps = buf; -pps_size = size; -} - -buf += size; -} +buf += size; +} + +if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) +return AVERROR_INVALIDDATA; + +avio_w8(pb, 1); /* version */ +avio_w8(pb, sps[1]); /* profile */ +avio_w8(pb, sps[2]); /* profile compat */ +avio_w8(pb, sps[3]); /* level */ +avio_w8(pb, 0xff); /* 6 bits reserved (11) + 2 bits nal size length - 1 (11) */ +avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (1) */ + +avio_wb16(pb, sps_size); +avio_write(pb, sps, sps_size); +avio_w8(pb, 1); /* number of pps */ +avio_wb16(pb, pps_size); +avio_write(pb, pps, pps_size); +av_free(start); -if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) -return AVERROR_INVALIDDATA; - -avio_w8(pb, 1); /* version */ -avio_w8(pb, sps[1]); /* profile */ -avio_w8(pb, sps[2]); /* profile compat */ -avio_w8(pb, sps[3]); /* level */ -avio_w8(pb, 0xff); /* 6 bits reserved (11) + 2 bits nal size length - 1 (11) */ -avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (1) */ - -avio_wb16(pb, sps_size); -avio_write(pb, sps, sps_size); -avio_w8(pb, 1); /* number of pps */ -avio_wb16(pb, pps_size); -avio_write(pb, pps, pps_size); -av_free(start); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/avc: return an error in ff_isom_write_avcc if the buffer lenght is too small
ffmpeg | branch: master | James Almer | Fri Nov 24 19:42:50 2017 -0300| [ae7df68edd79bce5c318810c6b307ee4e81cd2a6] | committer: James Almer avformat/avc: return an error in ff_isom_write_avcc if the buffer lenght is too small Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ae7df68edd79bce5c318810c6b307ee4e81cd2a6 --- libavformat/avc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index 094a95821f..5232ed55f8 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -105,7 +105,9 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { -if (len > 6) { +if (len <= 6) +return AVERROR_INVALIDDATA; + /* check for H.264 start code */ if (AV_RB32(data) == 0x0001 || AV_RB24(data) == 0x01) { @@ -157,7 +159,6 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) } else { avio_write(pb, data, len); } -} return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/avc: support writting more than one sps/pps in ff_isom_write_avcc
ffmpeg | branch: master | James Almer | Fri Nov 24 22:36:22 2017 -0300| [8d33e8661694f45a4552d3a3eff736a0f0d17932] | committer: James Almer avformat/avc: support writting more than one sps/pps in ff_isom_write_avcc Addresses ticket #6864 Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d33e8661694f45a4552d3a3eff736a0f0d17932 --- libavformat/avc.c | 51 ++- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/libavformat/avc.c b/libavformat/avc.c index d989594bb0..ec50033a04 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -20,6 +20,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavcodec/h264.h" #include "avformat.h" #include "avio.h" #include "avc.h" @@ -105,10 +106,11 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { +AVIOContext *sps_pb = NULL, *pps_pb = NULL; uint8_t *buf = NULL, *end, *start = NULL; uint8_t *sps = NULL, *pps = NULL; uint32_t sps_size = 0, pps_size = 0; -int ret; +int ret, nb_sps = 0, nb_pps = 0; if (len <= 6) return AVERROR_INVALIDDATA; @@ -126,6 +128,13 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) start = buf; end = buf + len; +ret = avio_open_dyn_buf(&sps_pb); +if (ret < 0) +goto fail; +ret = avio_open_dyn_buf(&pps_pb); +if (ret < 0) +goto fail; + /* look for sps and pps */ while (end - buf > 4) { uint32_t size; @@ -135,35 +144,51 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) nal_type = buf[0] & 0x1f; if (nal_type == 7) { /* SPS */ -sps = buf; -sps_size = size; +nb_sps++; +if (size > UINT16_MAX || nb_sps >= H264_MAX_SPS_COUNT) { +ret = AVERROR_INVALIDDATA; +goto fail; +} +avio_wb16(sps_pb, size); +avio_write(sps_pb, buf, size); } else if (nal_type == 8) { /* PPS */ -pps = buf; -pps_size = size; +nb_pps++; +if (size > UINT16_MAX || nb_pps >= H264_MAX_PPS_COUNT) { +ret = AVERROR_INVALIDDATA; +goto fail; +} +avio_wb16(pps_pb, size); +avio_write(pps_pb, buf, size); } buf += size; } +sps_size = avio_close_dyn_buf(sps_pb, &sps); +pps_size = avio_close_dyn_buf(pps_pb, &pps); -if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) { +if (sps_size < 6 || !pps_size) { ret = AVERROR_INVALIDDATA; goto fail; } avio_w8(pb, 1); /* version */ -avio_w8(pb, sps[1]); /* profile */ -avio_w8(pb, sps[2]); /* profile compat */ -avio_w8(pb, sps[3]); /* level */ +avio_w8(pb, sps[3]); /* profile */ +avio_w8(pb, sps[4]); /* profile compat */ +avio_w8(pb, sps[5]); /* level */ avio_w8(pb, 0xff); /* 6 bits reserved (11) + 2 bits nal size length - 1 (11) */ -avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (1) */ +avio_w8(pb, 0xe0 | nb_sps); /* 3 bits reserved (111) + 5 bits number of sps */ -avio_wb16(pb, sps_size); avio_write(pb, sps, sps_size); -avio_w8(pb, 1); /* number of pps */ -avio_wb16(pb, pps_size); +avio_w8(pb, nb_pps); /* number of pps */ avio_write(pb, pps, pps_size); fail: +if (!sps) +avio_close_dyn_buf(sps_pb, &sps); +if (!pps) +avio_close_dyn_buf(pps_pb, &pps); +av_free(sps); +av_free(pps); av_free(start); return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: select vp9_superframe_split_bsf when enabling vp9_decoder
ffmpeg | branch: master | James Almer | Thu Nov 30 01:51:16 2017 -0300| [5a366f9770dd7b02b0721b2857d6baa96acdb0af] | committer: James Almer configure: select vp9_superframe_split_bsf when enabling vp9_decoder This is required since a5679933c1b8b6bef5c5c3eb7c70d06c695066cf Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a366f9770dd7b02b0721b2857d6baa96acdb0af --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 4e7254eaeb..1fa16e9dba 100755 --- a/configure +++ b/configure @@ -2637,7 +2637,7 @@ vp6a_decoder_select="vp6_decoder" vp6f_decoder_select="vp6_decoder" vp7_decoder_select="h264pred videodsp vp8dsp" vp8_decoder_select="h264pred videodsp vp8dsp" -vp9_decoder_select="videodsp vp9_parser" +vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf" webp_decoder_select="vp8_decoder exif" wmalossless_decoder_select="llauddsp" wmapro_decoder_select="mdct sinewin wma_freqs" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog