[FFmpeg-cvslog] movenc: Add support for writing language codes into ISML manifests

2016-09-29 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Tue Sep 27 01:10:22 
2016 +0300| [cc725ebe484c7e0d8de44e5c3c2050dc894e5a4b] | committer: Josh de Kock

movenc: Add support for writing language codes into ISML manifests

Streaming servers appear to ignore all other language metadata.

Signed-off-by: Jan Ekström 
Signed-off-by: Josh de Kock 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc725ebe484c7e0d8de44e5c3c2050dc894e5a4b
---

 libavformat/movenc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 8992782..7de4580 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3611,6 +3611,9 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 const char *type;
 int track_id = track->track_id;
 
+AVStream *st = track->st;
+AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", 
NULL,0);
+
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
 type = "video";
 } else if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -3631,6 +3634,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 manifest_bit_rate);
 param_write_int(pb, "systemBitrate", manifest_bit_rate);
 param_write_int(pb, "trackID", track_id);
+param_write_string(pb, "systemLanguage", lang ? lang->value : "und");
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
 if (track->par->codec_id == AV_CODEC_ID_H264) {
 uint8_t *ptr;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Changelog: Mention edts support.

2016-09-29 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
14:44:08 2016 +0200| [29a76ff525e34e5f5e27c5db86c281f4502435cf] | committer: 
Carl Eugen Hoyos

Changelog: Mention edts support.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=29a76ff525e34e5f5e27c5db86c281f4502435cf
---

 Changelog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Changelog b/Changelog
index 4e4b4bf..d7f5dc9 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version :
 - sdl2 output device
 - sdl2 support for ffplay
 - sdl1 output device and sdl1 support removed
+- extended mov edit list support
 
 
 version 3.1:

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavf/movenc: Put correct display aspect ratio in ARES atom.

2016-09-29 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
15:41:17 2016 +0200| [e84eeca5779b894ea1739296e17c4361d4638de7] | committer: 
Carl Eugen Hoyos

lavf/movenc: Put correct display aspect ratio in ARES atom.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e84eeca5779b894ea1739296e17c4361d4638de7
---

 libavformat/movenc.c  | 6 +-
 libavformat/version.h | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7de4580..8b4aa5f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1071,6 +1071,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack 
*track)
 int i;
 int interlaced;
 int cid;
+int display_width = track->par->width;
 
 if (track->vos_data && track->vos_len > 0x29) {
 if (ff_dnxhd_parse_header_prefix(track->vos_data) != 0) {
@@ -1122,7 +1123,10 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack 
*track)
 ffio_wfourcc(pb, "ARES");
 ffio_wfourcc(pb, "0001");
 avio_wb32(pb, cid); /* dnxhd cid, some id ? */
-avio_wb32(pb, track->par->width);
+if (   track->par->sample_aspect_ratio.num > 0
+&& track->par->sample_aspect_ratio.den > 0)
+display_width = display_width * track->par->sample_aspect_ratio.num / 
track->par->sample_aspect_ratio.den;
+avio_wb32(pb, display_width);
 /* values below are based on samples created with quicktime and avid 
codecs */
 if (interlaced) {
 avio_wb32(pb, track->par->height / 2);
diff --git a/libavformat/version.h b/libavformat/version.h
index 848403e..5e7448a 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  51
-#define LIBAVFORMAT_VERSION_MICRO 101
+#define LIBAVFORMAT_VERSION_MICRO 102
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavf/mov: Read display aspect ratio from ares atom also for dnxhd.

2016-09-29 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
15:29:03 2016 +0200| [fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126] | committer: 
Carl Eugen Hoyos

lavf/mov: Read display aspect ratio from ares atom also for dnxhd.

Fixes aspect ratio of sample in ticket #2125.
Fixes aspect ratio of sample in ticket #5325.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126
---

 libavformat/mov.c  | 3 ++-
 libavformat/version.h  | 2 +-
 tests/ref/fate/dnxhd-mbaff | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 8b7bbf1..a15c8d1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1487,7 +1487,8 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (cid == 0xd4d || cid == 0xd4e)
 par->width = 1440;
 return 0;
-} else if (par->codec_tag == MKTAG('A', 'V', 'd', '1') &&
+} else if ((par->codec_tag == MKTAG('A', 'V', 'd', '1') ||
+par->codec_tag == MKTAG('A', 'V', 'd', 'n')) &&
atom.size >= 24) {
 int num, den;
 avio_skip(pb, 12);
diff --git a/libavformat/version.h b/libavformat/version.h
index b0b5593..848403e 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -33,7 +33,7 @@
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  51
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/fate/dnxhd-mbaff b/tests/ref/fate/dnxhd-mbaff
index d694cfe..8e95227 100644
--- a/tests/ref/fate/dnxhd-mbaff
+++ b/tests/ref/fate/dnxhd-mbaff
@@ -2,5 +2,5 @@
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 1440x1080
-#sar 0: 4/3
+#sar 0: 1/1
 0,  0,  0,1,  6220800, 0xe78198c0

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] ffmpeg: pass the hwaccel frames context to the decoder

2016-09-29 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Thu Sep 29 
10:29:10 2016 +0200| [bfbf86ef18f756c4e27ab569309ef8bc7a5531ac] | committer: 
Timo Rothenpieler

ffmpeg: pass the hwaccel frames context to the decoder

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bfbf86ef18f756c4e27ab569309ef8bc7a5531ac
---

 ffmpeg.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index d0f247e..9a8e65a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2547,6 +2547,13 @@ static enum AVPixelFormat get_format(AVCodecContext *s, 
const enum AVPixelFormat
 }
 continue;
 }
+
+if (ist->hw_frames_ctx) {
+s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx);
+if (!s->hw_frames_ctx)
+return AV_PIX_FMT_NONE;
+}
+
 ist->active_hwaccel_id = hwaccel->id;
 ist->hwaccel_pix_fmt   = *p;
 break;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] ffmpeg_cuvid: make use of new av_hwdevice_ctx_create api

2016-09-29 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Thu Sep 
29 11:11:24 2016 +0200| [856e1eacf7f3c0b5607aae7902d1498c2218f92e] | committer: 
Timo Rothenpieler

ffmpeg_cuvid: make use of new av_hwdevice_ctx_create api

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=856e1eacf7f3c0b5607aae7902d1498c2218f92e
---

 ffmpeg_cuvid.c | 125 ++---
 1 file changed, 22 insertions(+), 103 deletions(-)

diff --git a/ffmpeg_cuvid.c b/ffmpeg_cuvid.c
index 866f43b..bd2d975 100644
--- a/ffmpeg_cuvid.c
+++ b/ffmpeg_cuvid.c
@@ -17,12 +17,9 @@
  */
 
 #include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_cuda.h"
 
 #include "ffmpeg.h"
 
-#include 
-
 typedef struct CUVIDContext {
 AVBufferRef *hw_frames_ctx;
 } CUVIDContext;
@@ -60,24 +57,13 @@ int cuvid_init(AVCodecContext *avctx)
 return 0;
 }
 
-static void cuvid_ctx_free(AVHWDeviceContext *ctx)
-{
-AVCUDADeviceContext *hwctx = ctx->hwctx;
-cuCtxDestroy(hwctx->cuda_ctx);
-}
-
 int cuvid_transcode_init(OutputStream *ost)
 {
 InputStream *ist;
 const enum AVPixelFormat *pix_fmt;
-AVCUDADeviceContext *device_hwctx;
-AVHWDeviceContext *device_ctx;
 AVHWFramesContext *hwframe_ctx;
+AVBufferRef *device_ref = NULL;
 CUVIDContext *ctx = NULL;
-CUdevice device;
-CUcontext cuda_ctx = NULL;
-CUcontext dummy;
-CUresult err;
 int ret = 0;
 
 av_log(NULL, AV_LOG_TRACE, "Initializing cuvid transcoding\n");
@@ -117,113 +103,46 @@ int cuvid_transcode_init(OutputStream *ost)
 }
 }
 
-if (!hw_device_ctx) {
-hw_device_ctx = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA);
-if (!hw_device_ctx) {
-av_log(NULL, AV_LOG_ERROR, 
"av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA) failed\n");
-ret = AVERROR(ENOMEM);
-goto error;
-}
-
-err = cuInit(0);
-if (err != CUDA_SUCCESS) {
-av_log(NULL, AV_LOG_ERROR, "Could not initialize the CUDA driver 
API\n");
-ret = AVERROR_UNKNOWN;
-goto error;
-}
-
-err = cuDeviceGet(&device, 0); ///TODO: Make device index configurable
-if (err != CUDA_SUCCESS) {
-av_log(NULL, AV_LOG_ERROR, "Could not get the device number %d\n", 
0);
-ret = AVERROR_UNKNOWN;
-goto error;
-}
-
-err = cuCtxCreate(&cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, device);
-if (err != CUDA_SUCCESS) {
-av_log(NULL, AV_LOG_ERROR, "Error creating a CUDA context\n");
-ret = AVERROR_UNKNOWN;
-goto error;
-}
-
-device_ctx = (AVHWDeviceContext*)hw_device_ctx->data;
-device_ctx->free = cuvid_ctx_free;
-
-device_hwctx = device_ctx->hwctx;
-device_hwctx->cuda_ctx = cuda_ctx;
-
-err = cuCtxPopCurrent(&dummy);
-if (err != CUDA_SUCCESS) {
-av_log(NULL, AV_LOG_ERROR, "cuCtxPopCurrent failed\n");
-ret = AVERROR_UNKNOWN;
-goto error;
-}
-
-ret = av_hwdevice_ctx_init(hw_device_ctx);
-if (ret < 0) {
-av_log(NULL, AV_LOG_ERROR, "av_hwdevice_ctx_init failed\n");
+if (!ctx->hw_frames_ctx) {
+ret = av_hwdevice_ctx_create(&device_ref, AV_HWDEVICE_TYPE_CUDA,
+ ist->hwaccel_device, NULL, 0);
+if (ret < 0)
 goto error;
-}
-} else {
-device_ctx = (AVHWDeviceContext*)hw_device_ctx->data;
-device_hwctx = device_ctx->hwctx;
-cuda_ctx = device_hwctx->cuda_ctx;
-}
 
-if (device_ctx->type != AV_HWDEVICE_TYPE_CUDA) {
-av_log(NULL, AV_LOG_ERROR, "Hardware device context is already 
initialized for a diffrent hwaccel.\n");
-ret = AVERROR(EINVAL);
-goto error;
-}
-
-if (!ctx->hw_frames_ctx) {
-ctx->hw_frames_ctx = av_hwframe_ctx_alloc(hw_device_ctx);
+ctx->hw_frames_ctx = av_hwframe_ctx_alloc(device_ref);
 if (!ctx->hw_frames_ctx) {
 av_log(NULL, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
 ret = AVERROR(ENOMEM);
 goto error;
 }
-}
-
-/* This is a bit hacky, av_hwframe_ctx_init is called by the cuvid decoder
- * once it has probed the neccesary format information. But as 
filters/nvenc
- * need to know the format/sw_format, set them here so they are happy.
- * This is fine as long as CUVID doesn't add another supported pix_fmt.
- */
-hwframe_ctx = (AVHWFramesContext*)ctx->hw_frames_ctx->data;
-hwframe_ctx->format = AV_PIX_FMT_CUDA;
-hwframe_ctx->sw_format = AV_PIX_FMT_NV12;
-
-ost->hwaccel_ctx = ctx;
-ost->enc_ctx->hw_frames_ctx = av_buffer_ref(ctx->hw_frames_ctx);
-ost->enc_ctx->pix_fmt = AV_PIX_FMT_CUDA;
-
-if (!ost->enc_ctx->hw_frames_ctx) {
-av_log(NULL, AV_LOG_ERROR, "av_buffer_ref failed\n");
-ret = AVERROR(ENOMEM);
-goto error;
-}
+av_buf

[FFmpeg-cvslog] avformat/tee: Copy interrupt callback and flags to slave

2016-09-29 Thread Jan Sebechlebsky
ffmpeg | branch: master | Jan Sebechlebsky  | Fri 
Aug 12 22:30:03 2016 +0200| [81bab1074ff9071ea0c5ed91ae10e9e1b6e9ad30] | 
committer: Jan Sebechlebsky

avformat/tee: Copy interrupt callback and flags to slave

Copy interrupt callback to slave format context to allow
user to interrupt IO. Copy format flags as well.

Signed-off-by: Jan Sebechlebsky 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81bab1074ff9071ea0c5ed91ae10e9e1b6e9ad30
---

 libavformat/tee.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tee.c b/libavformat/tee.c
index 518af4a..d59ad4d 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -161,6 +161,8 @@ static int open_slave(AVFormatContext *avf, char *slave, 
TeeSlave *tee_slave)
 avf2->opaque   = avf->opaque;
 avf2->io_open  = avf->io_open;
 avf2->io_close = avf->io_close;
+avf2->interrupt_callback = avf->interrupt_callback;
+avf2->flags = avf->flags;
 
 tee_slave->stream_map = av_calloc(avf->nb_streams, 
sizeof(*tee_slave->stream_map));
 if (!tee_slave->stream_map) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


Re: [FFmpeg-cvslog] lavf/mov: Read display aspect ratio from ares atom also for dnxhd.

2016-09-29 Thread Michael Niedermayer
On Thu, Sep 29, 2016 at 03:57:12PM +0200, Carl Eugen Hoyos wrote:
> ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
> 15:29:03 2016 +0200| [fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126] | committer: 
> Carl Eugen Hoyos
> 
> lavf/mov: Read display aspect ratio from ares atom also for dnxhd.
> 
> Fixes aspect ratio of sample in ticket #2125.
> Fixes aspect ratio of sample in ticket #5325.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126

This changes the aspect for:
4876/DNxHD100_cid1260_example_cut.mov

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 1
"Used only once"- "Some unspecified defect prevented a second use"
"In good condition" - "Can be repaird by experienced expert"
"As is" - "You wouldnt want it even if you were payed for it, if you knew ..."


signature.asc
Description: Digital signature
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cuvid: use actual frame size for buffer allocation

2016-09-29 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Thu Sep 
29 18:56:39 2016 +0200| [f0ea96d8a2c902455bf0df1aa02deecceccfe930] | committer: 
Timo Rothenpieler

avcodec/cuvid: use actual frame size for buffer allocation

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0ea96d8a2c902455bf0df1aa02deecceccfe930
---

 libavcodec/cuvid.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index bd66f9e..faef711 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -199,8 +199,8 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 if (!hwframe_ctx->pool) {
 hwframe_ctx->format = AV_PIX_FMT_CUDA;
 hwframe_ctx->sw_format = AV_PIX_FMT_NV12;
-hwframe_ctx->width = FFALIGN(avctx->coded_width, 32);
-hwframe_ctx->height = FFALIGN(avctx->coded_height, 32);
+hwframe_ctx->width = FFALIGN(avctx->width, 32);
+hwframe_ctx->height = FFALIGN(avctx->height, 32);
 
 if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n");
@@ -397,7 +397,7 @@ static int cuvid_output_frame(AVCodecContext *avctx, 
AVFrame *frame)
 .dstPitch  = frame->linesize[i],
 .srcY  = offset,
 .WidthInBytes  = FFMIN(pitch, frame->linesize[i]),
-.Height= avctx->coded_height >> (i ? 1 : 0),
+.Height= avctx->height >> (i ? 1 : 0),
 };
 
 ret = CHECK_CU(cuMemcpy2D(&cpy));

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/hwcontext_cuda: use proper synchronization flag

2016-09-29 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Thu Sep 
29 20:40:23 2016 +0200| [97e7f03d356b26b01e440e817c21f157f99e0842] | committer: 
Timo Rothenpieler

avutil/hwcontext_cuda: use proper synchronization flag

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=97e7f03d356b26b01e440e817c21f157f99e0842
---

 libavutil/hwcontext_cuda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index fa24c5d..40d2971 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -283,7 +283,7 @@ static int cuda_device_create(AVHWDeviceContext *ctx, const 
char *device,
 return AVERROR_UNKNOWN;
 }
 
-err = cuCtxCreate(&hwctx->cuda_ctx, 0, cu_device);
+err = cuCtxCreate(&hwctx->cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cu_device);
 if (err != CUDA_SUCCESS) {
 av_log(ctx, AV_LOG_ERROR, "Error creating a CUDA context\n");
 return AVERROR_UNKNOWN;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cuvid: support a pre-initialized hw_frames_ctx

2016-09-29 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Thu Sep 
29 18:58:49 2016 +0200| [49511501aa06ac98e41f0aa30c75ec2868a7dbd2] | committer: 
Timo Rothenpieler

avcodec/cuvid: support a pre-initialized hw_frames_ctx

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=49511501aa06ac98e41f0aa30c75ec2868a7dbd2
---

 libavcodec/cuvid.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index faef711..ffe449f 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -52,7 +52,6 @@ typedef struct CuvidContext
 int64_t prev_pts;
 
 int internal_error;
-int ever_flushed;
 int decoder_flushing;
 
 cudaVideoCodec codec_type;
@@ -145,8 +144,12 @@ static int CUDAAPI cuvid_handle_video_sequence(void 
*opaque, CUVIDEOFORMAT* form
 return 0;
 }
 
-if (hwframe_ctx->pool && !ctx->ever_flushed) {
-av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already 
initialized\n");
+if (hwframe_ctx->pool && (
+hwframe_ctx->width < avctx->width ||
+hwframe_ctx->height < avctx->height ||
+hwframe_ctx->format != AV_PIX_FMT_CUDA ||
+hwframe_ctx->sw_format != AV_PIX_FMT_NV12)) {
+av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already initialized 
with incompatible parameters\n");
 ctx->internal_error = AVERROR(EINVAL);
 return 0;
 }
@@ -805,8 +808,6 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
 if (ret < 0)
 goto error;
 
-ctx->ever_flushed = 0;
-
 ctx->prev_pts = INT64_MIN;
 
 if (!avctx->pkt_timebase.num || !avctx->pkt_timebase.den)
@@ -828,8 +829,6 @@ static void cuvid_flush(AVCodecContext *avctx)
 CUVIDSOURCEDATAPACKET seq_pkt = { 0 };
 int ret;
 
-ctx->ever_flushed = 1;
-
 ret = CHECK_CU(cuCtxPushCurrent(cuda_ctx));
 if (ret < 0)
 goto error;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cuvid: make use of new av_hwdevice_ctx_create api

2016-09-29 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Thu Sep 
29 19:40:42 2016 +0200| [ba0e5165331d20fb5c37464460f20b7cc1571591] | committer: 
Timo Rothenpieler

avcodec/cuvid: make use of new av_hwdevice_ctx_create api

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba0e5165331d20fb5c37464460f20b7cc1571591
---

 libavcodec/cuvid.c   | 53 ++--
 libavcodec/version.h |  2 +-
 2 files changed, 11 insertions(+), 44 deletions(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index ffe449f..e9a1dd7 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -41,6 +41,8 @@ typedef struct CuvidContext
 CUvideodecoder cudecoder;
 CUvideoparser cuparser;
 
+char *cu_gpu;
+
 AVBufferRef *hwdevice;
 AVBufferRef *hwframe;
 
@@ -546,12 +548,6 @@ static av_cold int cuvid_decode_end(AVCodecContext *avctx)
 return 0;
 }
 
-static void cuvid_ctx_free(AVHWDeviceContext *ctx)
-{
-AVCUDADeviceContext *hwctx = ctx->hwctx;
-cuCtxDestroy(hwctx->cuda_ctx);
-}
-
 static int cuvid_test_dummy_decoder(AVCodecContext *avctx, CUVIDPARSERPARAMS 
*cuparseinfo)
 {
 CUVIDDECODECREATEINFO cuinfo;
@@ -599,7 +595,6 @@ static av_cold int cuvid_decode_init(AVCodecContext *avctx)
 AVHWDeviceContext *device_ctx;
 AVHWFramesContext *hwframe_ctx;
 CUVIDSOURCEDATAPACKET seq_pkt;
-CUdevice device;
 CUcontext cuda_ctx = NULL;
 CUcontext dummy;
 const AVBitStreamFilter *bsf;
@@ -637,54 +632,25 @@ static av_cold int cuvid_decode_init(AVCodecContext 
*avctx)
 ret = AVERROR(ENOMEM);
 goto error;
 }
-
-device_ctx = hwframe_ctx->device_ctx;
-device_hwctx = device_ctx->hwctx;
-cuda_ctx = device_hwctx->cuda_ctx;
 } else {
-ctx->hwdevice = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA);
-if (!ctx->hwdevice) {
-av_log(avctx, AV_LOG_ERROR, "Error allocating hwdevice\n");
-ret = AVERROR(ENOMEM);
-goto error;
-}
-
-ret = CHECK_CU(cuInit(0));
+ret = av_hwdevice_ctx_create(&ctx->hwdevice, AV_HWDEVICE_TYPE_CUDA, 
ctx->cu_gpu, NULL, 0);
 if (ret < 0)
 goto error;
 
-ret = CHECK_CU(cuDeviceGet(&device, 0));
-if (ret < 0)
-goto error;
-
-ret = CHECK_CU(cuCtxCreate(&cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, 
device));
-if (ret < 0)
-goto error;
-
-device_ctx = (AVHWDeviceContext*)ctx->hwdevice->data;
-device_ctx->free = cuvid_ctx_free;
-
-device_hwctx = device_ctx->hwctx;
-device_hwctx->cuda_ctx = cuda_ctx;
-
-ret = CHECK_CU(cuCtxPopCurrent(&dummy));
-if (ret < 0)
-goto error;
-
-ret = av_hwdevice_ctx_init(ctx->hwdevice);
-if (ret < 0) {
-av_log(avctx, AV_LOG_ERROR, "av_hwdevice_ctx_init failed\n");
-goto error;
-}
-
 ctx->hwframe = av_hwframe_ctx_alloc(ctx->hwdevice);
 if (!ctx->hwframe) {
 av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_alloc failed\n");
 ret = AVERROR(ENOMEM);
 goto error;
 }
+
+hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
 }
 
+device_ctx = hwframe_ctx->device_ctx;
+device_hwctx = device_ctx->hwctx;
+cuda_ctx = device_hwctx->cuda_ctx;
+
 memset(&ctx->cuparseinfo, 0, sizeof(ctx->cuparseinfo));
 memset(&ctx->cuparse_ext, 0, sizeof(ctx->cuparse_ext));
 memset(&seq_pkt, 0, sizeof(seq_pkt));
@@ -883,6 +849,7 @@ static const AVOption options[] = {
 { "weave","Weave deinterlacing (do nothing)",0, 
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Weave}, 0, 0, VD, 
"deint" },
 { "bob",  "Bob deinterlacing",   0, 
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Bob  }, 0, 0, VD, 
"deint" },
 { "adaptive", "Adaptive deinterlacing",  0, 
AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Adaptive }, 0, 0, VD, 
"deint" },
+{ "gpu",  "GPU to be used for decoding", OFFSET(cu_gpu), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD },
 { NULL }
 };
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 91abd31..de7280f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR  60
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #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


Re: [FFmpeg-cvslog] lavf/mov: Read display aspect ratio from ares atom also for dnxhd.

2016-09-29 Thread Carl Eugen Hoyos
2016-09-29 21:05 GMT+02:00 Michael Niedermayer :
> On Thu, Sep 29, 2016 at 03:57:12PM +0200, Carl Eugen Hoyos wrote:
>> ffmpeg | branch: master | Carl Eugen Hoyos  | Thu Sep 29 
>> 15:29:03 2016 +0200| [fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126] | committer: 
>> Carl Eugen Hoyos
>>
>> lavf/mov: Read display aspect ratio from ares atom also for dnxhd.
>>
>> Fixes aspect ratio of sample in ticket #2125.
>> Fixes aspect ratio of sample in ticket #5325.
>>
>> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fcce25ee5d2f3fbe4848dee4c3d11b195d2d8126
>
> This changes the aspect for:
> 4876/DNxHD100_cid1260_example_cut.mov

Yes, it is played "correctly" now, see encoder metadata
and my other related patch.

Carl Eugen
___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog