[FFmpeg-cvslog] mpegvideodata: drop useless comments

2020-03-16 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Mar  9 
14:11:29 2020 +0100| [2e53b7eea13531bc8cbea5fe04957c90ce4a2d1f] | committer: 
Anton Khirnov

mpegvideodata: drop useless comments

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

 libavcodec/mpegvideodata.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/libavcodec/mpegvideodata.c b/libavcodec/mpegvideodata.c
index 5f1d8f7c00..da0638e052 100644
--- a/libavcodec/mpegvideodata.c
+++ b/libavcodec/mpegvideodata.c
@@ -19,7 +19,6 @@
 #include 
 
 const uint8_t ff_default_chroma_qscale_table[32] = {
-//   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
 };
@@ -32,7 +31,6 @@ const uint8_t ff_mpeg2_non_linear_qscale[32] = {
 };
 
 const uint8_t ff_mpeg1_dc_scale_table[128] = {
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
@@ -44,7 +42,6 @@ const uint8_t ff_mpeg1_dc_scale_table[128] = {
 };
 
 static const uint8_t mpeg2_dc_scale_table1[128] = {
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
@@ -56,7 +53,6 @@ static const uint8_t mpeg2_dc_scale_table1[128] = {
 };
 
 static const uint8_t mpeg2_dc_scale_table2[128] = {
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -68,7 +64,6 @@ static const uint8_t mpeg2_dc_scale_table2[128] = {
 };
 
 static const uint8_t mpeg2_dc_scale_table3[128] = {
-//  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,

___
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] h264dec: do not return a value from init_dimensions()

2020-03-16 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Apr 17 
10:40:55 2017 +0200| [e38b8b0dc6eb1011ec814bcadf5ece015eb250eb] | committer: 
Anton Khirnov

h264dec: do not return a value from init_dimensions()

There are no failure cases left in this function.

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

 libavcodec/h264_slice.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 652d2a1f14..34f659b299 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -864,7 +864,7 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 }
 
 /* export coded and cropped frame dimensions to AVCodecContext */
-static int init_dimensions(H264Context *h)
+static void init_dimensions(H264Context *h)
 {
 const SPS *sps = (const SPS*)h->ps.sps;
 int cr = sps->crop_right;
@@ -902,8 +902,6 @@ static int init_dimensions(H264Context *h)
 h->crop_left   = cl;
 h->crop_top= ct;
 h->crop_bottom = cb;
-
-return 0;
 }
 
 static int h264_slice_header_init(H264Context *h)
@@ -1068,9 +1066,7 @@ static int h264_init_ps(H264Context *h, const 
H264SliceContext *sl, int first_sl
 h->width  = 16 * h->mb_width;
 h->height = 16 * h->mb_height;
 
-ret = init_dimensions(h);
-if (ret < 0)
-return ret;
+init_dimensions(h);
 
 if (sps->video_signal_type_present_flag) {
 h->avctx->color_range = sps->full_range > 0 ? AVCOL_RANGE_JPEG

___
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] examples/avio_dir_cmd: drop support for move/delete operations

2020-03-16 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Fri Jan 10 
12:10:09 2020 +0100| [15546f772c686412d3e823ff8db266796541846e] | committer: 
Anton Khirnov

examples/avio_dir_cmd: drop support for move/delete operations

They use non-public functions, which is unacceptable for a public API
example. Rename the example back to avio_list_dir.

This effectively reverts c84d208c275d6a43b3c3421d38772179abf8acee and
767d780ec001167b2fd8f6cfe4ef78a3a8b1e34c.

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

 configure|  4 +-
 doc/examples/.gitignore  |  2 +-
 doc/examples/Makefile|  2 +-
 doc/examples/Makefile.example|  2 +-
 doc/examples/{avio_dir_cmd.c => avio_list_dir.c} | 56 ++--
 5 files changed, 9 insertions(+), 57 deletions(-)

diff --git a/configure b/configure
index 6ceb0c7af4..18f2841765 100755
--- a/configure
+++ b/configure
@@ -1667,7 +1667,7 @@ COMPONENT_LIST="
 "
 
 EXAMPLE_LIST="
-avio_dir_cmd_example
+avio_list_dir_example
 avio_reading_example
 decode_audio_example
 decode_video_example
@@ -3615,7 +3615,7 @@ yadif_cuda_filter_deps="ffnvcodec"
 yadif_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
 
 # examples
-avio_dir_cmd_deps="avformat avutil"
+avio_list_dir_deps="avformat avutil"
 avio_reading_deps="avformat avcodec avutil"
 decode_audio_example_deps="avcodec avutil"
 decode_video_example_deps="avcodec avutil"
diff --git a/doc/examples/.gitignore b/doc/examples/.gitignore
index 75152cb50b..44960e1de7 100644
--- a/doc/examples/.gitignore
+++ b/doc/examples/.gitignore
@@ -1,4 +1,4 @@
-/avio_dir_cmd
+/avio_list_dir
 /avio_reading
 /decode_audio
 /decode_video
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index 2935424e54..81bfd34d5d 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -1,4 +1,4 @@
-EXAMPLES-$(CONFIG_AVIO_DIR_CMD_EXAMPLE)  += avio_dir_cmd
+EXAMPLES-$(CONFIG_AVIO_LIST_DIR_EXAMPLE) += avio_list_dir
 EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE)  += avio_reading
 EXAMPLES-$(CONFIG_DECODE_AUDIO_EXAMPLE)  += decode_audio
 EXAMPLES-$(CONFIG_DECODE_VIDEO_EXAMPLE)  += decode_video
diff --git a/doc/examples/Makefile.example b/doc/examples/Makefile.example
index 6428154c51..a232d97f98 100644
--- a/doc/examples/Makefile.example
+++ b/doc/examples/Makefile.example
@@ -11,7 +11,7 @@ CFLAGS += -Wall -g
 CFLAGS := $(shell pkg-config --cflags $(FFMPEG_LIBS)) $(CFLAGS)
 LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS)
 
-EXAMPLES=   avio_dir_cmd   \
+EXAMPLES=   avio_list_dir  \
 avio_reading   \
 decode_audio   \
 decode_video   \
diff --git a/doc/examples/avio_dir_cmd.c b/doc/examples/avio_list_dir.c
similarity index 69%
rename from doc/examples/avio_dir_cmd.c
rename to doc/examples/avio_list_dir.c
index 0722bd9ab1..3073baaefa 100644
--- a/doc/examples/avio_dir_cmd.c
+++ b/doc/examples/avio_list_dir.c
@@ -102,38 +102,15 @@ static int list_op(const char *input_dir)
 return ret;
 }
 
-static int del_op(const char *url)
-{
-int ret = avpriv_io_delete(url);
-if (ret < 0)
-av_log(NULL, AV_LOG_ERROR, "Cannot delete '%s': %s.\n", url, 
av_err2str(ret));
-return ret;
-}
-
-static int move_op(const char *src, const char *dst)
-{
-int ret = avpriv_io_move(src, dst);
-if (ret < 0)
-av_log(NULL, AV_LOG_ERROR, "Cannot move '%s' into '%s': %s.\n", src, 
dst, av_err2str(ret));
-return ret;
-}
-
-
 static void usage(const char *program_name)
 {
-fprintf(stderr, "usage: %s OPERATION entry1 [entry2]\n"
-"API example program to show how to manipulate resources "
-"accessed through AVIOContext.\n"
-"OPERATIONS:\n"
-"list  list content of the directory\n"
-"move  rename content in directory\n"
-"del   delete content in directory\n",
-program_name);
+fprintf(stderr, "usage: %s input_dir\n"
+"API example program to show how to list files in directory "
+"accessed through AVIOContext.\n", program_name);
 }
 
 int main(int argc, char *argv[])
 {
-const char *op = NULL;
 int ret;
 
 av_log_set_level(AV_LOG_DEBUG);
@@ -145,32 +122,7 @@ int main(int argc, char *argv[])
 
 avformat_network_init();
 
-op = argv[1];
-if (strcmp(op, "list") == 0) {
-if (argc < 3) {
-av_log(NULL, AV_LOG_INFO, "Missing argument for list 
operation.\n");
-ret = AVERROR(EINVAL);
-} else {
-ret = list_op(argv[2]);
-}
-} else if (strcmp(op, "del") == 0) {
-if (argc < 3) {
-av_log(NULL, AV_LOG_INFO, "Missing argument for del operation.\n");
-ret = AVERROR(EINVAL);
-  

[FFmpeg-cvslog] vp3: eliminate copy_fields

2020-03-16 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Apr 11 
09:27:08 2016 +0200| [1b17988cb55297f152ca1701555c4ecf2005014a] | committer: 
Anton Khirnov

vp3: eliminate copy_fields

It is very fragile against fields being moved and hides what is actually
being copied. Copy all the fields explicitly instead.

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

 libavcodec/vp3.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 903871e93d..d53dd87029 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2595,10 +2595,6 @@ static int vp3_update_thread_context(AVCodecContext 
*dst, const AVCodecContext *
 Vp3DecodeContext *s = dst->priv_data, *s1 = src->priv_data;
 int qps_changed = 0, i, err;
 
-#define copy_fields(to, from, start_field, end_field) \
-memcpy(&to->start_field, &from->start_field,  \
-   (char *) &to->end_field - (char *) &to->start_field)
-
 if (!s1->current_frame.f->data[0] ||
 s->width != s1->width || s->height != s1->height) {
 if (s != s1)
@@ -2642,9 +2638,11 @@ static int vp3_update_thread_context(AVCodecContext 
*dst, const AVCodecContext *
 memcpy(&s->bounding_values_array, &s1->bounding_values_array,
sizeof(s->bounding_values_array));
 
-if (qps_changed)
-copy_fields(s, s1, qps, superblock_count);
-#undef copy_fields
+if (qps_changed) {
+memcpy(s->qps,  s1->qps,  sizeof(s->qps));
+memcpy(s->last_qps, s1->last_qps, sizeof(s->last_qps));
+s->nqps = s1->nqps;
+}
 }
 
 return update_frames(dst);

___
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] mpegvideo: drop an unnecessary function parameter

2020-03-16 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Tue Mar 10 
14:14:14 2020 +0100| [7f0a7e3e63ff0d342772cbc7e6e5d652900d6710] | committer: 
Anton Khirnov

mpegvideo: drop an unnecessary function parameter

It is always 0.

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

 libavcodec/mpegvideo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 5516ed8b7c..22cab2854b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -346,9 +346,9 @@ av_cold void ff_mpv_idct_init(MpegEncContext *s)
 ff_init_scantable(s->idsp.idct_permutation, &s->intra_v_scantable, 
ff_alternate_vertical_scan);
 }
 
-static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
+static int alloc_picture(MpegEncContext *s, Picture *pic)
 {
-return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 0,
+return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, 0, 0,
 s->chroma_x_shift, s->chroma_y_shift, 
s->out_format,
 s->mb_stride, s->mb_width, s->mb_height, 
s->b8_stride,
 &s->linesize, &s->uvlinesize);
@@ -1259,7 +1259,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext 
*avctx)
 
 pic->f->coded_picture_number = s->coded_picture_number++;
 
-if (alloc_picture(s, pic, 0) < 0)
+if (alloc_picture(s, pic) < 0)
 return -1;
 
 s->current_picture_ptr = pic;
@@ -1320,7 +1320,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext 
*avctx)
 s->last_picture_ptr->f->key_frame = 0;
 s->last_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P;
 
-if (alloc_picture(s, s->last_picture_ptr, 0) < 0) {
+if (alloc_picture(s, s->last_picture_ptr) < 0) {
 s->last_picture_ptr = NULL;
 return -1;
 }
@@ -1361,7 +1361,7 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext 
*avctx)
 s->next_picture_ptr->f->key_frame = 0;
 s->next_picture_ptr->f->pict_type = AV_PICTURE_TYPE_P;
 
-if (alloc_picture(s, s->next_picture_ptr, 0) < 0) {
+if (alloc_picture(s, s->next_picture_ptr) < 0) {
 s->next_picture_ptr = NULL;
 return -1;
 }

___
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] lavd/avfoundation: Add basic transport control observation for capable devices.

2020-03-16 Thread Thilo Borgmann
ffmpeg | branch: master | Thilo Borgmann  | Thu Mar  5 
12:32:49 2020 +0100| [39fbd0631407f6ce7575699248cb05057203af58] | committer: 
Thilo Borgmann

lavd/avfoundation: Add basic transport control observation for capable devices.

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

 libavdevice/avfoundation.m | 67 --
 1 file changed, 59 insertions(+), 8 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 0d854a18a3..43b2edb44d 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -88,7 +88,6 @@ typedef struct
 int64_t first_pts;
 int64_t first_audio_pts;
 pthread_mutex_t frame_lock;
-pthread_cond_t  frame_wait_cond;
 id  avf_delegate;
 id  avf_audio_delegate;
 
@@ -130,6 +129,10 @@ typedef struct
 AVCaptureAudioDataOutput *audio_output;
 CMSampleBufferRef current_frame;
 CMSampleBufferRef current_audio_frame;
+
+AVCaptureDevice  *observed_device;
+AVCaptureDeviceTransportControlsPlaybackMode observed_mode;
+int  observed_quit;
 } AVFContext;
 
 static void lock_frames(AVFContext* ctx)
@@ -163,10 +166,50 @@ static void unlock_frames(AVFContext* ctx)
 {
 if (self = [super init]) {
 _context = context;
+
+// start observing if a device is set for it
+if (_context->observed_device) {
+NSString *keyPath = 
NSStringFromSelector(@selector(transportControlsPlaybackMode));
+NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew;
+
+[_context->observed_device addObserver: self
+forKeyPath: keyPath
+   options: options
+   context: _context];
+}
 }
 return self;
 }
 
+- (void)dealloc {
+// stop observing if a device is set for it
+NSString *keyPath = 
NSStringFromSelector(@selector(transportControlsPlaybackMode));
+[_context->observed_device removeObserver: self forKeyPath: keyPath];
+[super dealloc];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+  ofObject:(id)object
+change:(NSDictionary *)change
+   context:(void *)context {
+if (context == _context) {
+AVCaptureDeviceTransportControlsPlaybackMode mode =
+[change[NSKeyValueChangeNewKey] integerValue];
+
+if (mode != _context->observed_mode) {
+if (mode == AVCaptureDeviceTransportControlsNotPlayingMode) {
+_context->observed_quit = 1;
+}
+_context->observed_mode = mode;
+}
+} else {
+[super observeValueForKeyPath: keyPath
+ ofObject: object
+   change: change
+  context: context];
+}
+}
+
 - (void)  captureOutput:(AVCaptureOutput *)captureOutput
   didOutputSampleBuffer:(CMSampleBufferRef)videoFrame
  fromConnection:(AVCaptureConnection *)connection
@@ -179,8 +222,6 @@ static void unlock_frames(AVFContext* ctx)
 
 _context->current_frame = (CMSampleBufferRef)CFRetain(videoFrame);
 
-pthread_cond_signal(&_context->frame_wait_cond);
-
 unlock_frames(_context);
 
 ++_context->frames_captured;
@@ -225,8 +266,6 @@ static void unlock_frames(AVFContext* ctx)
 
 _context->current_audio_frame = (CMSampleBufferRef)CFRetain(audioFrame);
 
-pthread_cond_signal(&_context->frame_wait_cond);
-
 unlock_frames(_context);
 
 ++_context->audio_frames_captured;
@@ -253,7 +292,6 @@ static void destroy_context(AVFContext* ctx)
 av_freep(&ctx->audio_buffer);
 
 pthread_mutex_destroy(&ctx->frame_lock);
-pthread_cond_destroy(&ctx->frame_wait_cond);
 
 if (ctx->current_frame) {
 CFRelease(ctx->current_frame);
@@ -499,6 +537,15 @@ static int add_video_device(AVFormatContext *s, 
AVCaptureDevice *video_device)
 }
 [ctx->video_output setAlwaysDiscardsLateVideoFrames:ctx->drop_late_frames];
 
+// check for transport control support and set observer device if supported
+int trans_ctrl = [video_device transportControlsSupported];
+AVCaptureDeviceTransportControlsPlaybackMode trans_mode = [video_device 
transportControlsPlaybackMode];
+
+if (trans_ctrl) {
+ctx->observed_mode   = trans_mode;
+ctx->observed_device = video_device;
+}
+
 ctx->avf_delegate = [[AVFFrameReceiver alloc] initWithContext:ctx];
 
 queue = dispatch_queue_create("avf_queue", NULL);
@@ -709,7 +756,6 @@ static int avf_read_header(AVFormatContext *s)
 ctx->first_audio_pts= av_gettime();
 
 pthread_mutex_init(&ctx->frame_lock, NULL);
-pthread_cond_init(&ctx->frame_wait_cond, NULL);
 
 #if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_

[FFmpeg-cvslog] fate/ffmpeg: add a second, simple sub2video test

2020-03-16 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Thu Mar 12 00:38:33 
2020 +0200| [9c8a5fd57e36d0d734e41f816b498cea4a9d735b] | committer: Jan Ekström

fate/ffmpeg: add a second, simple sub2video test

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

 tests/fate/ffmpeg.mak  |  9 
 tests/ref/fate/sub2video_basic | 95 ++
 2 files changed, 104 insertions(+)

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 967150983a..835aab3665 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -56,6 +56,15 @@ fate-sub2video: CMD = framecrc \
   -filter_complex 
"sws_flags=+accurate_rnd+bitexact\;[0:0]scale=720:480[v]\;[v][1:0]overlay[v2]" \
   -map "[v2]" -c:v rawvideo -map 1:s -c:s dvdsub
 
+# Very basic sub2video example, decode and convert to AVFrame with sub2video.
+# Attempt to not touch timestamps.
+FATE_SAMPLES_FFMPEG-$(call ALLYES, VOBSUB_DEMUXER DVDSUB_DECODER AVFILTER) += 
fate-sub2video_basic
+fate-sub2video_basic: CMD = framecrc \
+  -i $(TARGET_SAMPLES)/sub/vobsub.idx \
+  -vsync passthrough -copyts \
+  -filter_complex "sws_flags=+accurate_rnd+bitexact\;[0:s:0]scale" \
+  -c:v rawvideo
+
 FATE_FFMPEG-$(call ALLYES, PCM_S16LE_DEMUXER PCM_S16LE_MUXER PCM_S16LE_DECODER 
PCM_S16LE_ENCODER) += fate-unknown_layout-pcm
 fate-unknown_layout-pcm: $(AREF)
 fate-unknown_layout-pcm: CMD = md5 \
diff --git a/tests/ref/fate/sub2video_basic b/tests/ref/fate/sub2video_basic
new file mode 100644
index 00..5f72e292c9
--- /dev/null
+++ b/tests/ref/fate/sub2video_basic
@@ -0,0 +1,95 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 720x480
+#sar 0: 0/1
+0,   3312,   3312,1,  1382400, 0x
+0,   3312,   3312,1,  1382400, 0x8c93c2ba
+0,   3436,   3436,1,  1382400, 0x
+0,   3684,   3684,1,  1382400, 0xb02e32ca
+0,   3802,   3802,1,  1382400, 0x
+0,   4520,   4520,1,  1382400, 0x83b71116
+0,   4584,   4584,1,  1382400, 0x
+0,   4586,   4586,1,  1382400, 0x85547fd1
+0,   4645,   4645,1,  1382400, 0x
+0,   4648,   4648,1,  1382400, 0x
+0,   4648,   4648,1,  1382400, 0xb6a8f181
+0,   4715,   4715,1,  1382400, 0x
+0,   4717,   4717,1,  1382400, 0xb64d1a2c
+0,   4748,   4748,1,  1382400, 0x
+0,   4750,   4750,1,  1382400, 0x7b37ecf3
+0,   4792,   4792,1,  1382400, 0x
+0,   4993,   4993,1,  1382400, 0xdc025bd1
+0,   5027,   5027,1,  1382400, 0x
+0,   5029,   5029,1,  1382400, 0x688b294d
+0,   5068,   5068,1,  1382400, 0x
+0,   5070,   5070,1,  1382400, 0xa2b33d1b
+0,   5117,   5117,1,  1382400, 0x
+0,   5119,   5119,1,  1382400, 0xb3e525e3
+0,   5168,   5168,1,  1382400, 0x
+0,   5170,   5170,1,  1382400, 0xaa8fbdd7
+0,   5216,   5216,1,  1382400, 0x
+0,   5218,   5218,1,  1382400, 0x7b7f26dd
+0,   5249,   5249,1,  1382400, 0x
+0,   5251,   5251,1,  1382400, 0x15e2f836
+0,   5289,   5289,1,  1382400, 0x
+0,   5291,   5291,1,  1382400, 0x0fee9b0c
+0,   5358,   5358,1,  1382400, 0x
+0,   5360,   5360,1,  1382400, 0x89d62791
+0,   5429,   5429,1,  1382400, 0x
+0,   5431,   5431,1,  1382400, 0xa6a9fd74
+0,   5490,   5490,1,  1382400, 0x
+0,   5491,   5491,1,  1382400, 0x7896178d
+0,   5537,   5537,1,  1382400, 0x
+0,   5588,   5588,1,  1382400, 0x01751a52
+0,   5647,   5647,1,  1382400, 0x
+0,   5688,   5688,1,  1382400, 0xa3959c6f
+0,   5770,   5770,1,  1382400, 0x
+0,   5772,   5772,1,  1382400, 0x3d3ea47b
+0,   5826,   5826,1,  1382400, 0x
+0,   5828,   5828,1,  1382400, 0x593f8b24
+0,   5931,   5931,1,  1382400, 0x
+0,   5933,   5933,1,  1382400, 0x171f05ba
+0,   6001,   6001,1,  1382400, 0x
+0,   6003,   6003,1,  1382400, 0xb014cdf1
+0,   6054,   6054,1,  1382400, 0x
+0,   6839,   6839,1,  1382400, 0xd918e667
+0,   6880,   6880,1,  1382400, 0x
+0,   7386,   7386,1,  1382400, 0xc9406331
+0,   7419,   7419,1,  1382400, 0x
+0,   7501,   7501,1,  1382400, 0xaf08b10d
+0,   7549,   7549,  

[FFmpeg-cvslog] fate/ffmpeg: add test for time limited sub2video instance

2020-03-16 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Thu Mar 12 01:22:15 
2020 +0200| [c149f16db14a82bbbd95482060403dde823af184] | committer: Jan Ekström

fate/ffmpeg: add test for time limited sub2video instance

Utilizes a subpicture sample with one decodable subpicture for the
test.

Based on a failing test case in reported by Michael in
https://ffmpeg.org/pipermail/ffmpeg-devel/2019-February/240398.html
which at the time had no test case for it.

Additionally, this is the first test case for the presentation
graphics format.

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

 tests/fate/ffmpeg.mak | 10 ++
 tests/ref/fate/sub2video_time_limited |  8 
 2 files changed, 18 insertions(+)

diff --git a/tests/fate/ffmpeg.mak b/tests/fate/ffmpeg.mak
index 835aab3665..0b0610f647 100644
--- a/tests/fate/ffmpeg.mak
+++ b/tests/fate/ffmpeg.mak
@@ -65,6 +65,16 @@ fate-sub2video_basic: CMD = framecrc \
   -filter_complex "sws_flags=+accurate_rnd+bitexact\;[0:s:0]scale" \
   -c:v rawvideo
 
+# Time-limited run with a sample that doesn't require seeking and
+# contains samples within the initial period.
+FATE_SAMPLES_FFMPEG-$(call ALLYES, SUP_DEMUXER PGSSUB_DECODER AVFILTER) += 
fate-sub2video_time_limited
+fate-sub2video_time_limited: CMD = framecrc \
+  -i $(TARGET_SAMPLES)/sub/pgs_sub.sup \
+  -vsync passthrough -copyts \
+  -t 15 \
+  -filter_complex "sws_flags=+accurate_rnd+bitexact\;[0:s:0]scale" \
+  -c:v rawvideo
+
 FATE_FFMPEG-$(call ALLYES, PCM_S16LE_DEMUXER PCM_S16LE_MUXER PCM_S16LE_DECODER 
PCM_S16LE_ENCODER) += fate-unknown_layout-pcm
 fate-unknown_layout-pcm: $(AREF)
 fate-unknown_layout-pcm: CMD = md5 \
diff --git a/tests/ref/fate/sub2video_time_limited 
b/tests/ref/fate/sub2video_time_limited
new file mode 100644
index 00..9fb6fb06f9
--- /dev/null
+++ b/tests/ref/fate/sub2video_time_limited
@@ -0,0 +1,8 @@
+#tb 0: 1/25
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1920x1080
+#sar 0: 0/1
+0,  2,  2,1,  8294400, 0x
+0,  2,  2,1,  8294400, 0xa87c518f
+0, 10, 10,1,  8294400, 0xa87c518f

___
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] ffmpeg: explicitly handle sub2video subpicture initialization

2020-03-16 Thread Jan Ekström
ffmpeg | branch: master | Jan Ekström  | Sat Feb 23 01:48:08 
2019 +0200| [7ba3ea212fc054ba48618bf87018269fee5504ce] | committer: Jan Ekström

ffmpeg: explicitly handle sub2video subpicture initialization

Each time the sub2video structure is initialized, the sub2video
subpicture is initialized together with the first received heartbeat.
The heartbeat's PTS is utilized as the subpicture start time.

Additionally, add some documentation on the stages.

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

 fftools/ffmpeg.c| 22 +++---
 fftools/ffmpeg.h|  3 ++-
 fftools/ffmpeg_filter.c |  8 +++-
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index e5fbd479a8..aaaf241314 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -237,7 +237,7 @@ static void sub2video_push_ref(InputStream *ist, int64_t 
pts)
 }
 }
 
-void sub2video_update(InputStream *ist, AVSubtitle *sub)
+void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub)
 {
 AVFrame *frame = ist->sub2video.frame;
 int8_t *dst;
@@ -254,7 +254,12 @@ void sub2video_update(InputStream *ist, AVSubtitle *sub)
  AV_TIME_BASE_Q, ist->st->time_base);
 num_rects = sub->num_rects;
 } else {
-pts   = ist->sub2video.end_pts;
+/* If we are initializing the system, utilize current heartbeat
+   PTS as the start time, and show until the following subpicture
+   is received. Otherwise, utilize the previous subpicture's end time
+   as the fall-back value. */
+pts   = ist->sub2video.initialize ?
+heartbeat_pts : ist->sub2video.end_pts;
 end_pts   = INT64_MAX;
 num_rects = 0;
 }
@@ -269,6 +274,7 @@ void sub2video_update(InputStream *ist, AVSubtitle *sub)
 sub2video_copy_rect(dst, dst_linesize, frame->width, frame->height, 
sub->rects[i]);
 sub2video_push_ref(ist, pts);
 ist->sub2video.end_pts = end_pts;
+ist->sub2video.initialize = 0;
 }
 
 static void sub2video_heartbeat(InputStream *ist, int64_t pts)
@@ -291,9 +297,11 @@ static void sub2video_heartbeat(InputStream *ist, int64_t 
pts)
 /* do not send the heartbeat frame if the subtitle is already ahead */
 if (pts2 <= ist2->sub2video.last_pts)
 continue;
-if (pts2 >= ist2->sub2video.end_pts ||
-(!ist2->sub2video.frame->data[0] && ist2->sub2video.end_pts < 
INT64_MAX))
-sub2video_update(ist2, NULL);
+if (pts2 >= ist2->sub2video.end_pts || ist2->sub2video.initialize)
+/* if we have hit the end of the current displayed subpicture,
+   or if we need to initialize the system, update the
+   overlayed subpicture and its start/end times */
+sub2video_update(ist2, pts2 + 1, NULL);
 for (j = 0, nb_reqs = 0; j < ist2->nb_filters; j++)
 nb_reqs += 
av_buffersrc_get_nb_failed_requests(ist2->filters[j]->filter);
 if (nb_reqs)
@@ -307,7 +315,7 @@ static void sub2video_flush(InputStream *ist)
 int ret;
 
 if (ist->sub2video.end_pts < INT64_MAX)
-sub2video_update(ist, NULL);
+sub2video_update(ist, INT64_MAX, NULL);
 for (i = 0; i < ist->nb_filters; i++) {
 ret = av_buffersrc_add_frame(ist->filters[i]->filter, NULL);
 if (ret != AVERROR_EOF && ret < 0)
@@ -2507,7 +2515,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket 
*pkt, int *got_output,
 return ret;
 
 if (ist->sub2video.frame) {
-sub2video_update(ist, &subtitle);
+sub2video_update(ist, INT64_MIN, &subtitle);
 } else if (ist->nb_filters) {
 if (!ist->sub2video.sub_queue)
 ist->sub2video.sub_queue = av_fifo_alloc(8 * sizeof(AVSubtitle));
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index c0b8eb599f..fbaae15377 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -348,6 +348,7 @@ typedef struct InputStream {
 AVFifoBuffer *sub_queue;///< queue of AVSubtitle* before filter 
init
 AVFrame *frame;
 int w, h;
+unsigned int initialize; ///< marks if sub2video_update should force 
an initialization
 } sub2video;
 
 int dr1;
@@ -645,7 +646,7 @@ int filtergraph_is_simple(FilterGraph *fg);
 int init_simple_filtergraph(InputStream *ist, OutputStream *ost);
 int init_complex_filtergraph(FilterGraph *fg);
 
-void sub2video_update(InputStream *ist, AVSubtitle *sub);
+void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle 
*sub);
 
 int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame);
 
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 40cc4c191c..b66faa50b5 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -740,6 +740,12 @@ static int sub2video_prepare(InputStream *ist, InputFilter 
*ifil