[FFmpeg-cvslog] ffplay: add option to allow custom seek interval

2018-09-05 Thread Gyan Doshi
ffmpeg | branch: master | Gyan Doshi  | Sat Sep  1 11:51:17 
2018 +0530| [1a4a8df249426c85ba6c96ef5ab022afaaf4dc8f] | committer: Gyan Doshi

ffplay: add option to allow custom seek interval

At present, left and right keys are hardcoded to seek by 10 seconds.

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

 doc/ffplay.texi  | 2 ++
 fftools/ffplay.c | 8 +---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/ffplay.texi b/doc/ffplay.texi
index c95956ea17..dcb86ce13c 100644
--- a/doc/ffplay.texi
+++ b/doc/ffplay.texi
@@ -60,6 +60,8 @@ Play @var{duration} seconds of audio/video.
 see @ref{time duration syntax,,the Time duration section in the 
ffmpeg-utils(1) manual,ffmpeg-utils}.
 @item -bytes
 Seek by bytes.
+@item -seek_interval
+Set custom interval, in seconds, for seeking using left/right keys. Default is 
10 seconds.
 @item -nodisp
 Disable graphical display.
 @item -noborder
diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 5d9121e5b7..e375a32ec2 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -319,6 +319,7 @@ static int video_disable;
 static int subtitle_disable;
 static const char* wanted_stream_spec[AVMEDIA_TYPE_NB] = {0};
 static int seek_by_bytes = -1;
+static float seek_interval = 10;
 static int display_disable;
 static int borderless;
 static int startup_volume = 100;
@@ -3343,10 +3344,10 @@ static void event_loop(VideoState *cur_stream)
 seek_chapter(cur_stream, -1);
 break;
 case SDLK_LEFT:
-incr = -10.0;
+incr = seek_interval ? -seek_interval : -10.0;
 goto do_seek;
 case SDLK_RIGHT:
-incr = 10.0;
+incr = seek_interval ? seek_interval : 10.0;
 goto do_seek;
 case SDLK_UP:
 incr = 60.0;
@@ -3582,6 +3583,7 @@ static const OptionDef options[] = {
 { "ss", HAS_ARG, { .func_arg = opt_seek }, "seek to a given position in 
seconds", "pos" },
 { "t", HAS_ARG, { .func_arg = opt_duration }, "play  \"duration\" seconds 
of audio/video", "duration" },
 { "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 
1=on -1=auto", "val" },
+{ "seek_interval", OPT_FLOAT | HAS_ARG, { &seek_interval }, "set seek 
interval for left/right keys, in seconds", "seconds" },
 { "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" },
 { "noborder", OPT_BOOL, { &borderless }, "borderless window" },
 { "volume", OPT_INT | HAS_ARG, { &startup_volume}, "set startup volume 
0=min 100=max", "volume" },
@@ -3652,7 +3654,7 @@ void show_help_default(const char *opt, const char *arg)
"c   cycle program\n"
"w   cycle video filters or show modes\n"
"s   activate frame-step mode\n"
-   "left/right  seek backward/forward 10 seconds\n"
+   "left/right  seek backward/forward 10 seconds or to custom 
interval if -seek_interval is set\n"
"down/up seek backward/forward 1 minute\n"
"page down/page up   seek backward/forward 10 minutes\n"
"right mouse click   seek to percentage in file corresponding to 
fraction of width\n"

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


[FFmpeg-cvslog] avcodec/mips: [loongson] reoptimize put and add pixels clamped functions.

2018-09-05 Thread Shiyou Yin
ffmpeg | branch: master | Shiyou Yin  | Wed Sep  5 
18:31:05 2018 +0800| [776909e42e2a9cef37035f070464bbbfa3441c39] | committer: 
Michael Niedermayer

avcodec/mips: [loongson] reoptimize put and add pixels clamped functions.

Simplify the usage of intermediate variable addr and remove unused variable 
all64
in following functions:
1. ff_put_pixels_clamped_mmi
2. ff_put_signed_pixels_clamped_mmi
3. ff_add_pixels_clamped_mmi

This optimization speed up mpeg4 decode about 2% on loongson platform(tested 
with 3A3000).

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mips/idctdsp_mmi.c | 155 +-
 1 file changed, 62 insertions(+), 93 deletions(-)

diff --git a/libavcodec/mips/idctdsp_mmi.c b/libavcodec/mips/idctdsp_mmi.c
index b7979650fd..a96dac4704 100644
--- a/libavcodec/mips/idctdsp_mmi.c
+++ b/libavcodec/mips/idctdsp_mmi.c
@@ -29,9 +29,6 @@ void ff_put_pixels_clamped_mmi(const int16_t *block,
 uint8_t *av_restrict pixels, ptrdiff_t line_size)
 {
 double ftmp[8];
-mips_reg addr[1];
-DECLARE_VAR_ALL64;
-DECLARE_VAR_ADDRT;
 
 __asm__ volatile (
 MMI_LDC1(%[ftmp0], %[block], 0x00)
@@ -42,60 +39,44 @@ void ff_put_pixels_clamped_mmi(const int16_t *block,
 MMI_LDC1(%[ftmp5], %[block], 0x28)
 MMI_LDC1(%[ftmp6], %[block], 0x30)
 MMI_LDC1(%[ftmp7], %[block], 0x38)
-PTR_ADDU   "%[addr0],   %[pixels],  %[line_size]\n\t"
 "packushb   %[ftmp0],   %[ftmp0],   %[ftmp1]\n\t"
 "packushb   %[ftmp2],   %[ftmp2],   %[ftmp3]\n\t"
 "packushb   %[ftmp4],   %[ftmp4],   %[ftmp5]\n\t"
 "packushb   %[ftmp6],   %[ftmp6],   %[ftmp7]\n\t"
 MMI_SDC1(%[ftmp0], %[pixels], 0x00)
-MMI_SDC1(%[ftmp2], %[addr0], 0x00)
-MMI_SDXC1(%[ftmp4], %[addr0], %[line_size], 0x00)
-MMI_SDXC1(%[ftmp6], %[pixels], %[line_sizex3], 0x00)
-: [ftmp0]"=&f"(ftmp[0]),[ftmp1]"=&f"(ftmp[1]),
-  [ftmp2]"=&f"(ftmp[2]),[ftmp3]"=&f"(ftmp[3]),
-  [ftmp4]"=&f"(ftmp[4]),[ftmp5]"=&f"(ftmp[5]),
-  [ftmp6]"=&f"(ftmp[6]),[ftmp7]"=&f"(ftmp[7]),
-  RESTRICT_ASM_ALL64
-  RESTRICT_ASM_ADDRT
-  [addr0]"=&r"(addr[0]),
-  [pixels]"+&r"(pixels)
-: [line_size]"r"((mips_reg)line_size),
-  [line_sizex3]"r"((mips_reg)(line_size*3)),
-  [block]"r"(block)
-: "memory"
-);
-
-pixels += line_size*4;
-block += 32;
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp2], %[pixels], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp4], %[pixels], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp6], %[pixels], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
 
-__asm__ volatile (
-MMI_LDC1(%[ftmp0], %[block], 0x00)
-MMI_LDC1(%[ftmp1], %[block], 0x08)
-MMI_LDC1(%[ftmp2], %[block], 0x10)
-MMI_LDC1(%[ftmp3], %[block], 0x18)
-MMI_LDC1(%[ftmp4], %[block], 0x20)
-MMI_LDC1(%[ftmp5], %[block], 0x28)
-MMI_LDC1(%[ftmp6], %[block], 0x30)
-MMI_LDC1(%[ftmp7], %[block], 0x38)
-PTR_ADDU   "%[addr0],   %[pixels],  %[line_size]\n\t"
+MMI_LDC1(%[ftmp0], %[block], 0x40)
+MMI_LDC1(%[ftmp1], %[block], 0x48)
+MMI_LDC1(%[ftmp2], %[block], 0x50)
+MMI_LDC1(%[ftmp3], %[block], 0x58)
+MMI_LDC1(%[ftmp4], %[block], 0x60)
+MMI_LDC1(%[ftmp5], %[block], 0x68)
+MMI_LDC1(%[ftmp6], %[block], 0x70)
+MMI_LDC1(%[ftmp7], %[block], 0x78)
 "packushb   %[ftmp0],   %[ftmp0],   %[ftmp1]\n\t"
 "packushb   %[ftmp2],   %[ftmp2],   %[ftmp3]\n\t"
 "packushb   %[ftmp4],   %[ftmp4],   %[ftmp5]\n\t"
 "packushb   %[ftmp6],   %[ftmp6],   %[ftmp7]\n\t"
 MMI_SDC1(%[ftmp0], %[pixels], 0x00)
-MMI_SDC1(%[ftmp2], %[addr0], 0x00)
-MMI_SDXC1(%[ftmp4], %[addr0], %[line_size], 0x00)
-MMI_SDXC1(%[ftmp6], %[pixels], %[line_sizex3], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp2], %[pixels], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp4], %[pixels], 0x00)
+PTR_ADDU   "%[pixels],  %[pixels],  %[line_size]\n\t"
+MMI_SDC1(%[ftmp6], %[pixels], 0x00)
 : [ftmp0]"=&f"(ftmp[0]),[ftmp1]"=&f"(ftmp[1]),
   [ftmp2]"=&f"(ftmp[2]),[ftmp3]"=&f"(ftmp[3]),
   [ftm

[FFmpeg-cvslog] avformat/mxfdec: do not use sound essence descriptor quantization bits for bits_per_coded_sample

2018-09-05 Thread Marton Balint
ffmpeg | branch: master | Marton Balint  | Sun Aug 26 21:23:02 
2018 +0200| [6aaf1b504c6a0e0e5e2f4c97712b0f83a4115e10] | committer: Marton 
Balint

avformat/mxfdec: do not use sound essence descriptor quantization bits for 
bits_per_coded_sample

It refers to the uncompressed quantization, therefore is not correct for AAC.

Also change mxf_set_pts to work based on current edit unit if
bits_per_coded_sample is not available.

Fixes error messages in the sample of ticket #7366.

Signed-off-by: Marton Balint 

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

 libavformat/mxfdec.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8e1089620f..134f27784b 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2390,7 +2390,6 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 if (st->codecpar->codec_id == AV_CODEC_ID_NONE || 
(st->codecpar->codec_id == AV_CODEC_ID_PCM_ALAW && (enum 
AVCodecID)container_ul->id != AV_CODEC_ID_NONE))
 st->codecpar->codec_id = (enum AVCodecID)container_ul->id;
 st->codecpar->channels = descriptor->channels;
-st->codecpar->bits_per_coded_sample = descriptor->bits_per_sample;
 
 if (descriptor->sample_rate.den > 0) {
 st->codecpar->sample_rate = descriptor->sample_rate.num / 
descriptor->sample_rate.den;
@@ -2423,6 +2422,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
 } else if (st->codecpar->codec_id == AV_CODEC_ID_MP2) {
 st->need_parsing = AVSTREAM_PARSE_FULL;
 }
+st->codecpar->bits_per_coded_sample = 
av_get_bits_per_sample(st->codecpar->codec_id);
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
 enum AVMediaType type;
 container_ul = mxf_get_codec_ul(mxf_data_essence_container_uls, 
essence_container_ul);
@@ -3269,7 +3269,8 @@ static int64_t mxf_set_current_edit_unit(MXFContext *mxf, 
AVStream *st, int64_t
 static int mxf_set_audio_pts(MXFContext *mxf, AVCodecParameters *par,
  AVPacket *pkt)
 {
-MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
+AVStream *st = mxf->fc->streams[pkt->stream_index];
+MXFTrack *track = st->priv_data;
 int64_t bits_per_sample = par->bits_per_coded_sample;
 
 if (!bits_per_sample)
@@ -3280,8 +3281,10 @@ static int mxf_set_audio_pts(MXFContext *mxf, 
AVCodecParameters *par,
 if (   par->channels <= 0
 || bits_per_sample <= 0
 || par->channels * (int64_t)bits_per_sample < 8)
-return AVERROR(EINVAL);
-track->sample_count += pkt->size / (par->channels * 
(int64_t)bits_per_sample / 8);
+track->sample_count = mxf_compute_sample_count(mxf, st, 
av_rescale_q(track->sample_count, st->time_base, av_inv_q(track->edit_rate)) + 
1);
+else
+track->sample_count += pkt->size / (par->channels * 
(int64_t)bits_per_sample / 8);
+
 return 0;
 }
 

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


[FFmpeg-cvslog] avformat/dashdec: minus minBufferTime when there have value

2018-09-05 Thread Steven Liu
ffmpeg | branch: master | Steven Liu  | Thu Sep  6 
13:40:56 2018 +0800| [7bb90a9449bc845ffbde0eea0dfcaf2b3eed4256] | committer: 
Steven Liu

avformat/dashdec: minus minBufferTime when there have value

fix ticket 7382

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

 libavformat/dashdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 154b1426b9..497e7e469c 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1341,7 +1341,7 @@ static int64_t calc_cur_seg_no(AVFormatContext *s, struct 
representation *pls)
 } else if (pls->fragment_duration){
 av_log(s, AV_LOG_TRACE, "in fragment_duration mode 
fragment_timescale = %"PRId64", presentation_timeoffset = %"PRId64"\n", 
pls->fragment_timescale, pls->presentation_timeoffset);
 if (pls->presentation_timeoffset) {
-num = pls->first_seq_no + (((get_current_time_in_sec() - 
c->availability_start_time) * 
pls->fragment_timescale)-pls->presentation_timeoffset) / pls->fragment_duration;
+num = pls->first_seq_no + (((get_current_time_in_sec() - 
c->availability_start_time) * 
pls->fragment_timescale)-pls->presentation_timeoffset) / pls->fragment_duration 
- c->min_buffer_time;
 } else if (c->publish_time > 0 && !c->availability_start_time) {
 if (c->min_buffer_time) {
 num = pls->first_seq_no + (((c->publish_time + 
pls->fragment_duration) - c->suggested_presentation_delay) * 
pls->fragment_timescale) / pls->fragment_duration - c->min_buffer_time;

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