Re: [FFmpeg-devel] [PATCH 1/2] compat/avisynth: minor update for alpha offsets

2016-09-26 Thread Stephen Hutchinson

On 8/30/2016 8:26 PM, Stephen Hutchinson wrote:

---
 compat/avisynth/avisynth_c.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h
index 605b92a..2f84dd1 100644
--- a/compat/avisynth/avisynth_c.h
+++ b/compat/avisynth/avisynth_c.h
@@ -533,7 +533,11 @@ typedef struct AVS_VideoFrame {
   volatile long refcount;
   AVS_VideoFrameBuffer * vfb;
   int offset, pitch, row_size, height, offsetU, offsetV, pitchUV;  // U 
offsets are from top of picture.
-  int row_sizeUV, heightUV;
+  int row_sizeUV, heightUV; // for Planar RGB offsetU, offsetV is for the 2nd 
and 3rd Plane.
+// for Planar RGB pitchUV and row_sizeUV = 0, 
because when no VideoInfo (MakeWriteable)
+// the decision on existance of UV is checked by 
zero pitch
+  // AVS+ extension, avisynth.h: class does not break plugins if appended here
+  int offsetA, pitchA, row_sizeA; // 4th alpha plane support, pitch and 
row_size is 0 is none
 } AVS_VideoFrame;

 // Access functions for AVS_VideoFrame
@@ -753,7 +757,7 @@ enum {
   AVS_CPUF_SSSE3  = 0x200,   //  Core 2
   AVS_CPUF_SSE4   = 0x400,   //  Penryn, Wolfdale, Yorkfield
   AVS_CPUF_SSE4_1 = 0x400,
-//AVS_CPUF_AVX= 0x800,   //  Sandy Bridge, Bulldozer
+  AVS_CPUF_AVX= 0x800,   //  Sandy Bridge, Bulldozer
   AVS_CPUF_SSE4_2= 0x1000,   //  Nehalem
 //AVS_CPUF_AVX2  = 0x2000,   //  Haswell
 //AVS_CPUF_AVX512= 0x4000,   //  Knights Landing



Consider this patch revoked.  The changes don't affect FFmpeg's
handling of the discrete alpha formats, so my being cautious and
sending this patch wasn't necessary.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] avisynth: fix Planar RGB output

2016-09-26 Thread Stephen Hutchinson

On 8/30/2016 8:26 PM, Stephen Hutchinson wrote:

---
 libavformat/avisynth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 1fe8e08..1acc44f 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -690,8 +690,10 @@ static int avisynth_read_packet_video(AVFormatContext *s, 
AVPacket *pkt,
 #ifdef USING_AVISYNTH
 /* Flip Planar RGB video. */
 if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) ||
-avs_library.avs_is_planar_rgba(avs->vi)))
+avs_library.avs_is_planar_rgba(avs->vi))) {
+src_p = src_p + (planeheight - 1) * pitch;
 pitch = -pitch;
+}
 #endif

 avs_library.avs_bit_blt(avs->env, dst_p, rowsize, src_p, pitch,



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


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-09-26 Thread Lou Logan
Hi,

On Sun, Sep 25, 2016, at 04:32 AM, Pallavi Kumari wrote:
[...]
> I want to propose the idea of implementing filters for ffmpeg that would
> give different audio fingerprints for an audio which could be reused by
> other people for variety of applications.

chromaprint comes to mind. It may be of interest to you:
https://ffmpeg.org/ffmpeg-formats.html#chromaprint
https://acoustid.org/chromaprint
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mpegtsenc: Set min PID for data pkt to 0x0010

2016-09-26 Thread Andrey Turkin
Nevermind, I didn't though this through. Default value is high enough to
comply with all standards.  If someone really wants/needs to use 0x0010 as
PMT/data pids then it should be permitted since it is permitted by
13818-1:2000. By the same logic upper limit should be set to 0x1FFE. Though
it would be good if someone with an access to later versions of the
standard could verify if these limits are still the same.

2016-09-27 6:24 GMT+03:00 Andrey Turkin :

> ISO 18318 reserves PIDs 0x00-0x0F
> DVB also reserves PIDs 0x10-0x1F
> ARIB also reserves PIDs 0x20-0x2F
> ATSC also reserves PID 0x1FFB
>
> So, if there is going to be change to permitted PIDs assignment anyway, I
> suggest to go with safest choice and use 0x0030-0x1FEF range
>
> 2016-09-27 4:41 GMT+03:00 Michael Niedermayer :
>
>> On Sat, Sep 24, 2016 at 12:06:07PM +0200, Carl Eugen Hoyos wrote:
>> > Hi!
>> >
>> > Attached patch fixes ticket #1673.
>> > ISO13818-1 indeed specifies in §2.4.3.3 that values
>> > up to 0xF are reserved.
>> >
>> > Please comment, Carl Eugen
>>
>> >  mpegtsenc.c |2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > 60a99310ff7b9ef476fa1d70bb01ffcaaf550226
>> 0001-lavf-mpegtsenc-Set-min-PID-for-data-pkt-to-0x0010.patch
>> > From 06371416c00eaf73430d1bb7d841167356adbe23 Mon Sep 17 00:00:00 2001
>> > From: Sylvain Laurent 
>> > Date: Sat, 24 Sep 2016 12:01:34 +0200
>> > Subject: [PATCH] lavf/mpegtsenc: Set min PID for data pkt to 0x0010.
>> >
>> > Fixes ticket #1673.
>> > ---
>> >  libavformat/mpegtsenc.c |2 +-
>> >  1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
>> > index fd849e5..c10a3bf 100644
>> > --- a/libavformat/mpegtsenc.c
>> > +++ b/libavformat/mpegtsenc.c
>> > @@ -1843,7 +1843,7 @@ static const AVOption options[] = {
>> >{ .i64 = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM },
>> >  { "mpegts_start_pid", "Set the first pid.",
>> >offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT,
>> > -  { .i64 = 0x0100 }, 0x0020, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
>> > +  { .i64 = 0x0100 }, 0x0010, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
>> >  { "mpegts_m2ts_mode", "Enable m2ts mode.",
>>
>> the previous limit was set by Zach Swena (in CC)
>> was there a reason why it was 0x20 and not 0x10 ?
>>
>> Thanks
>>
>> [...]
>>
>>
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> Never trust a computer, one day, it may think you are the virus. -- Compn
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mpegtsenc: Set min PID for data pkt to 0x0010

2016-09-26 Thread Andrey Turkin
ISO 18318 reserves PIDs 0x00-0x0F
DVB also reserves PIDs 0x10-0x1F
ARIB also reserves PIDs 0x20-0x2F
ATSC also reserves PID 0x1FFB

So, if there is going to be change to permitted PIDs assignment anyway, I
suggest to go with safest choice and use 0x0030-0x1FEF range

2016-09-27 4:41 GMT+03:00 Michael Niedermayer :

> On Sat, Sep 24, 2016 at 12:06:07PM +0200, Carl Eugen Hoyos wrote:
> > Hi!
> >
> > Attached patch fixes ticket #1673.
> > ISO13818-1 indeed specifies in §2.4.3.3 that values
> > up to 0xF are reserved.
> >
> > Please comment, Carl Eugen
>
> >  mpegtsenc.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 60a99310ff7b9ef476fa1d70bb01ffcaaf550226  0001-lavf-mpegtsenc-Set-min-
> PID-for-data-pkt-to-0x0010.patch
> > From 06371416c00eaf73430d1bb7d841167356adbe23 Mon Sep 17 00:00:00 2001
> > From: Sylvain Laurent 
> > Date: Sat, 24 Sep 2016 12:01:34 +0200
> > Subject: [PATCH] lavf/mpegtsenc: Set min PID for data pkt to 0x0010.
> >
> > Fixes ticket #1673.
> > ---
> >  libavformat/mpegtsenc.c |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > index fd849e5..c10a3bf 100644
> > --- a/libavformat/mpegtsenc.c
> > +++ b/libavformat/mpegtsenc.c
> > @@ -1843,7 +1843,7 @@ static const AVOption options[] = {
> >{ .i64 = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM },
> >  { "mpegts_start_pid", "Set the first pid.",
> >offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT,
> > -  { .i64 = 0x0100 }, 0x0020, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
> > +  { .i64 = 0x0100 }, 0x0010, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
> >  { "mpegts_m2ts_mode", "Enable m2ts mode.",
>
> the previous limit was set by Zach Swena (in CC)
> was there a reason why it was 0x20 and not 0x10 ?
>
> Thanks
>
> [...]
>
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Never trust a computer, one day, it may think you are the virus. -- Compn
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffprobe: don't use AVStream.codec to set decoder framerate

2016-09-26 Thread James Almer
Also don't set time_base. It's deprecated for decoding and avcodec_open2()
will overwrite it

Signed-off-by: James Almer 
---
 ffprobe.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/ffprobe.c b/ffprobe.c
index b59f11e..bb3979c 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2612,10 +2612,7 @@ static int open_input_file(InputFile *ifile, const char 
*filename)
 exit(1);
 
 av_codec_set_pkt_timebase(ist->dec_ctx, stream->time_base);
-#if FF_API_LAVF_AVCTX
-ist->dec_ctx->time_base = stream->codec->time_base;
-ist->dec_ctx->framerate = stream->codec->framerate;
-#endif
+ist->dec_ctx->framerate = stream->avg_frame_rate;
 
 if (avcodec_open2(ist->dec_ctx, codec, ) < 0) {
 av_log(NULL, AV_LOG_WARNING, "Could not open codec for input 
stream %d\n",
-- 
2.9.1

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


[FFmpeg-devel] [PATCH 1/3] lavc/utils.c: Subtract skip_samples when frame is DISCARDed.

2016-09-26 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavcodec/utils.c   | 16 +++-
 libavcodec/version.h |  2 +-
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b0345b6..6323156 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2320,7 +2320,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 uint32_t discard_padding = 0;
 uint8_t skip_reason = 0;
 uint8_t discard_reason = 0;
-int demuxer_skip_samples = 0;
 // copy to ensure we do not change avpkt
 AVPacket tmp = *avpkt;
 int did_split = av_packet_split_side_data();
@@ -2328,7 +2327,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 if (ret < 0)
 goto fail;
 
-demuxer_skip_samples = avctx->internal->skip_samples;
 avctx->internal->pkt = 
 if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
 ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, );
@@ -2353,13 +2351,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 frame->sample_rate = avctx->sample_rate;
 }
 
-
-if (frame->flags & AV_FRAME_FLAG_DISCARD) {
-// If using discard frame flag, ignore skip_samples set by the 
decoder.
-avctx->internal->skip_samples = demuxer_skip_samples;
-*got_frame_ptr = 0;
-}
-
 side= av_packet_get_side_data(avctx->internal->pkt, 
AV_PKT_DATA_SKIP_SAMPLES, _size);
 if(side && side_size>=10) {
 avctx->internal->skip_samples = AV_RL32(side);
@@ -2369,6 +2360,13 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 skip_reason = AV_RL8(side + 8);
 discard_reason = AV_RL8(side + 9);
 }
+
+if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
+!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+avctx->internal->skip_samples -= frame->nb_samples;
+*got_frame_ptr = 0;
+}
+
 if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
 !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
 if(frame->nb_samples <= avctx->internal->skip_samples){
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 9e44eca..71dac40 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  57
-#define LIBAVCODEC_VERSION_MINOR  58
+#define LIBAVCODEC_VERSION_MINOR  59
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [PATCH 1/3] lavc/utils.c: Subtract skip_samples when frame is DISCARDed.

2016-09-26 Thread Sasi Inguva
On Mon, Sep 26, 2016 at 6:01 PM, Michael Niedermayer  wrote:

> On Mon, Sep 26, 2016 at 11:42:50AM -0700, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavcodec/utils.c | 16 +++-
> >  1 file changed, 7 insertions(+), 9 deletions(-)
>
> applying just this patch breaks
>
> ./ffmpeg_g -f u8 -ar 16000 -ac 1 -i sync_audio.raw -acodec libmp3lame
> test.mov
> ./ffmpeg_g -i test.mov test.mov.wav
>
> applying both doesnt break this though
> not sure if thats a problem or not ...
>
> version bump is missing
>
> Done.

>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Dictatorship naturally arises out of democracy, and the most aggravated
> form of tyranny and slavery out of the most extreme liberty. -- Plato
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] lavc/utils.c: Subtract skip_samples when frame is DISCARDed.

2016-09-26 Thread Sasi Inguva
On Mon, Sep 26, 2016 at 6:01 PM, Michael Niedermayer  wrote:

> On Mon, Sep 26, 2016 at 11:42:50AM -0700, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavcodec/utils.c | 16 +++-
> >  1 file changed, 7 insertions(+), 9 deletions(-)
>
> applying just this patch breaks
>
> ./ffmpeg_g -f u8 -ar 16000 -ac 1 -i sync_audio.raw -acodec libmp3lame
> test.mov
> ./ffmpeg_g -i test.mov test.mov.wav
>
> applying both doesnt break this though
> not sure if thats a problem or not ...
>
> Yes. it needs the next patch setting skip_samples correctly in mov.c for
this file to work.


> version bump is missing
>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Dictatorship naturally arises out of democracy, and the most aggravated
> form of tyranny and slavery out of the most extreme liberty. -- Plato
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mpegtsenc: Set min PID for data pkt to 0x0010

2016-09-26 Thread Michael Niedermayer
On Sat, Sep 24, 2016 at 12:06:07PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #1673.
> ISO13818-1 indeed specifies in §2.4.3.3 that values 
> up to 0xF are reserved.
> 
> Please comment, Carl Eugen

>  mpegtsenc.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 60a99310ff7b9ef476fa1d70bb01ffcaaf550226  
> 0001-lavf-mpegtsenc-Set-min-PID-for-data-pkt-to-0x0010.patch
> From 06371416c00eaf73430d1bb7d841167356adbe23 Mon Sep 17 00:00:00 2001
> From: Sylvain Laurent 
> Date: Sat, 24 Sep 2016 12:01:34 +0200
> Subject: [PATCH] lavf/mpegtsenc: Set min PID for data pkt to 0x0010.
> 
> Fixes ticket #1673.
> ---
>  libavformat/mpegtsenc.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index fd849e5..c10a3bf 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -1843,7 +1843,7 @@ static const AVOption options[] = {
>{ .i64 = 0x1000 }, 0x0010, 0x1f00, AV_OPT_FLAG_ENCODING_PARAM },
>  { "mpegts_start_pid", "Set the first pid.",
>offsetof(MpegTSWrite, start_pid), AV_OPT_TYPE_INT,
> -  { .i64 = 0x0100 }, 0x0020, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
> +  { .i64 = 0x0100 }, 0x0010, 0x0f00, AV_OPT_FLAG_ENCODING_PARAM },
>  { "mpegts_m2ts_mode", "Enable m2ts mode.",

the previous limit was set by Zach Swena (in CC)
was there a reason why it was 0x20 and not 0x10 ?

Thanks

[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Never trust a computer, one day, it may think you are the virus. -- Compn


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


Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 08:06:47PM -0300, James Almer wrote:
> This commit is based on commit 35c8580 from Anton Khirnov 
> which was skipped in b8945c4.
> 
> The avcodec_copy_context() call in the encode path is left in place for now
> as AVStream.codec is apparently still required even after porting ffmpeg to
> the new bsf API.
> 
> Signed-off-by: James Almer 
> ---
>  ffmpeg.c | 25 -
>  ffmpeg.h |  1 +
>  ffmpeg_opt.c |  3 +++
>  3 files changed, 16 insertions(+), 13 deletions(-)

Tested-by: Michael


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus


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


Re: [FFmpeg-devel] [PATCH 2/3] doc/muxers: fix error for hlsenc exmpales

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 04:04:55PM +0800, Steven Liu wrote:
> 

>  muxers.texi |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 44f5601d940ca8826a22c66cdbbb640b1ee247c5  
> 0002-doc-muxers-fix-error-for-hlsenc-exmpales.patch
> From 513e8ab789eff6ca7ab4fffd13b3124db34e7d0e Mon Sep 17 00:00:00 2001
> From: Steven Liu 
> Date: Mon, 26 Sep 2016 13:56:58 +0800

> Subject: [PATCH 2/3] doc/muxers: fix error for hlsenc exmpales

not a english word


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"


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


Re: [FFmpeg-devel] [PATCH 1/3] lavc/utils.c: Subtract skip_samples when frame is DISCARDed.

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 11:42:50AM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/utils.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)

applying just this patch breaks

./ffmpeg_g -f u8 -ar 16000 -ac 1 -i sync_audio.raw -acodec libmp3lame test.mov
./ffmpeg_g -i test.mov test.mov.wav

applying both doesnt break this though
not sure if thats a problem or not ...

version bump is missing


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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mp3dec: read encoder delay/padding from Info tag

2016-09-26 Thread Jon Toohill
A similar concern was raised in a previous related patch:
http://ffmpeg.org/pipermail/ffmpeg-devel/2016-May/194690.html
I think the resolution at the time was to go ahead with using both, since
both are used widely and serve slightly different purposes, although I do
agree that it's confusing.

I think I could use AV_PKT_DATA_SKIP_SAMPLES here, and change mp3enc to use
that to fill out the Info tag. But that only seems worthwhile to me if
there is a general consensus to move to just AV_PKT_DATA_SKIP_SAMPLES (and
deprecate/remove initial_padding and trailing_padding). If there's a
concrete case where knowing trailing_padding at the start of a stream is
necessary, then that's not possible, but I'm pretty new to this and don't
know of one. Thoughts?


Jon Toohill |  Google Play Music |  jtooh...@google.com |  (650) 215-0770

On Mon, Sep 26, 2016 at 11:30 AM, wm4  wrote:

> On Mon, 26 Sep 2016 10:13:39 -0700
> Jon Toohill  wrote:
>
> > ---
> >  libavformat/mp3dec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> > index 56c7f8c..9cc85a3 100644
> > --- a/libavformat/mp3dec.c
> > +++ b/libavformat/mp3dec.c
> > @@ -239,6 +239,8 @@ static void mp3_parse_info_tag(AVFormatContext *s,
> AVStream *st,
> >
> >  mp3->start_pad = v>>12;
> >  mp3->  end_pad = v&4095;
> > +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> > +st->codecpar->trailing_padding = mp3->end_pad;
> >  st->start_skip_samples = mp3->start_pad + 528 + 1;
> >  if (mp3->frames) {
> >  st->first_discard_sample = -mp3->end_pad + 528 + 1 +
> mp3->frames * (int64_t)spf;
>
> I'm somewhat suspicious about this, because mp3dec.c uses
> AV_PKT_DATA_SKIP_SAMPLES to communicate delay/padding
> (libavformat/utils.c turns the start_skip_samples field into side
> data). So I'm not quite convinced is this mess of FFmpeg and Libav API
> mixture is healthy. Opinions welcome.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread James Almer
This commit is based on commit 35c8580 from Anton Khirnov 
which was skipped in b8945c4.

The avcodec_copy_context() call in the encode path is left in place for now
as AVStream.codec is apparently still required even after porting ffmpeg to
the new bsf API.

Signed-off-by: James Almer 
---
 ffmpeg.c | 25 -
 ffmpeg.h |  1 +
 ffmpeg_opt.c |  3 +++
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index df55a49..bbde63b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -516,6 +516,7 @@ static void ffmpeg_cleanup(int ret)
 av_dict_free(>encoder_opts);
 
 av_parser_close(ost->parser);
+avcodec_free_context(>parser_avctx);
 
 av_freep(>forced_keyframes);
 av_expr_free(ost->forced_keyframes_pexpr);
@@ -1899,7 +1900,7 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
&& ost->st->codecpar->codec_id != AV_CODEC_ID_MPEG2VIDEO
&& ost->st->codecpar->codec_id != AV_CODEC_ID_VC1
) {
-int ret = av_parser_change(ost->parser, ost->st->codec,
+int ret = av_parser_change(ost->parser, ost->parser_avctx,
  , ,
  pkt->data, pkt->size,
  pkt->flags & AV_PKT_FLAG_KEY);
@@ -2723,9 +2724,7 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 exit_program(1);
 }
 /*
- * FIXME: this is only so that the bitstream filters and parsers (that 
still
- * work with a codec context) get the parameter values.
- * This should go away with the new BSF/parser API.
+ * FIXME: ost->st->codec should't be needed here anymore.
  */
 ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);
 if (ret < 0)
@@ -2757,15 +2756,11 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 
1});
 ost->st->codec->codec= ost->enc_ctx->codec;
 } else if (ost->stream_copy) {
-// copy timebase while removing common factors
-ost->st->time_base = av_add_q(ost->st->codec->time_base, 
(AVRational){0, 1});
-
 /*
- * FIXME: this is only so that the bitstream filters and parsers (that 
still
- * work with a codec context) get the parameter values.
- * This should go away with the new BSF/parser API.
+ * FIXME: will the codec context used by the parser during streamcopy
+ * This should go away with the new parser API.
  */
-ret = avcodec_parameters_to_context(ost->st->codec, ost->st->codecpar);
+ret = avcodec_parameters_to_context(ost->parser_avctx, 
ost->st->codecpar);
 if (ret < 0)
 return ret;
 }
@@ -3007,12 +3002,13 @@ static int transcode_init(void)
 ost->frame_rate = ist->framerate;
 ost->st->avg_frame_rate = ost->frame_rate;
 
-ost->st->time_base = ist->st->time_base;
-
 ret = avformat_transfer_internal_stream_timing_info(oc->oformat, 
ost->st, ist->st, copy_tb);
 if (ret < 0)
 return ret;
 
+// copy timebase while removing common factors
+ost->st->time_base = 
av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
+
 if (ist->st->nb_side_data) {
 ost->st->side_data = av_realloc_array(NULL, 
ist->st->nb_side_data,
   
sizeof(*ist->st->side_data));
@@ -3038,6 +3034,9 @@ static int transcode_init(void)
 }
 
 ost->parser = av_parser_init(par_dst->codec_id);
+ost->parser_avctx = avcodec_alloc_context3(NULL);
+if (!ost->parser_avctx)
+return AVERROR(ENOMEM);
 
 switch (par_dst->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
diff --git a/ffmpeg.h b/ffmpeg.h
index b7f8b7a..0d01d2b 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -477,6 +477,7 @@ typedef struct OutputStream {
 int keep_pix_fmt;
 
 AVCodecParserContext *parser;
+AVCodecContext   *parser_avctx;
 
 /* stats */
 // combined size of all the packets written
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 73da546..d202f43 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2300,6 +2300,7 @@ loop_end:
 avio_read(pb, attachment, len);
 
 ost = new_attachment_stream(o, oc, -1);
+ost->stream_copy   = 0;
 ost->attachment_filename   = o->attachments[i];
 ost->st->codecpar->extradata  = attachment;
 ost->st->codecpar->extradata_size = len;
@@ -2309,6 +2310,7 @@ loop_end:
 avio_closep();
 }
 
+#if FF_API_LAVF_AVCTX
 for (i = nb_output_streams - oc->nb_streams; i < nb_output_streams; i++) { 
//for all streams of this output file
   

Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 07:17:20PM -0300, James Almer wrote:
> On 9/26/2016 6:38 PM, Michael Niedermayer wrote:
> > On Mon, Sep 26, 2016 at 02:39:13PM -0300, James Almer wrote:
> >> This commit is based on commit 35c8580 from Anton Khirnov 
> >> 
> >> which was skipped in b8945c4.
> >>
> >> The avcodec_copy_context() call in the encode path is left in place for now
> >> as AVStream.codec is apparently still required even after porting ffmpeg to
> >> the new bsf API.
> >>
> >> Signed-off-by: James Almer 
> >> ---
> >>  ffmpeg.c | 25 -
> >>  ffmpeg.h |  1 +
> >>  ffmpeg_opt.c | 12 +---
> >>  3 files changed, 14 insertions(+), 24 deletions(-)
> > 
> > This breaks
> > ./ffmpeg -i matrixbench_mpeg2.mpg -flags +bitexact -t 1 -codec copy -f 
> > framecrc -
> > compared to the case before the patch and without codec copy
> > "#software: Lavf57.50.100"
> > is output
> 
> AVCodecContext flag bitexact is (for now) converted into AVFormatContext flag
> bitexact, and by removing the chunk in ffmpeg_opt.c that sets the former in
> st->codec, this doesn't happen anymore.
> 
> This is from init_muxer() libavformat/mux.c, and it's scheduled for removal
> with FF_API_LAVF_BITEXACT and ultimately with FF_API_LAVF_AVCTX, so i guess
> i'll leave the chunk in question in place and just wrap it up with a check
> for the latter define. Is that ok?

ok, can you post the resulting patch so i can test if it breaks
anything else ?

also totally off topic but related
we should add a '-bitexact' option instead of requiring to set both
flags. i think someone had suggested this previously but it seems to
be sliping down on my todo list ... if someone wants to add that ...

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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


Re: [FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: support mkdir_p for use_localtime_mkdir

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 04:04:32PM +0800, Steven Liu wrote:
> 

>  hlsenc.c |   31 ++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 8647c63d575b475e6e19b6427061787e39081bc4  
> 0001-avformat-hlsenc-support-mkdir_p-for-use_localtime_mk.patch
> From 4897d06fc1c9c4d9d302942b6e3ac8a8e25aa793 Mon Sep 17 00:00:00 2001
> From: Steven Liu <lingjiujia...@gmail.com>
> Date: Mon, 26 Sep 2016 13:50:31 +0800
> Subject: [PATCH 1/3] avformat/hlsenc: support mkdir_p for use_localtime_mkdir
> 
> when use use_localtime_mkdir to create multi level dir,
> ffmpeg give error message:
> ffmpeg -i ~/Movies/objectC/facebook.mp4 -c copy -use_localtime 1
> -use_localtime_mkdir 1 -hls_segment_filename '%Y%m%d/file-%Y%m%d/%s.ts'
> out.m3u8
> error message:
> Could not create directory 20160926/file-20160926 with use_localtime_mkdir
> add mkdir_p for support the multi level dir
> 
> Signed-off-by: Steven Liu <lingjiujia...@gmail.com>
> ---
>  libavformat/hlsenc.c | 31 ++-
>  1 file changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 428bae4..ac79759 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -133,6 +133,35 @@ typedef struct HLSContext {
>  double initial_prog_date_time;
>  } HLSContext;
>  
> +static int mkdir_p(const char *path) {

> +char *temp = strdup(path);

mixing malloc() based functions and av_malloc() is not safe
av_strdup()



> +char *pos = temp;
> +
> +if (!path) {
> +return -1;
> +}
> +
> +if (!strncmp(temp, "/", 1)) {

missing allocation failure check



> +pos++;
> +} else if (!strncmp(temp, "./", 2)) {
> +pos += 2;
> +}
> +for ( ; *pos != '\0'; ++pos) {
> +if (*pos == '/') {
> +*pos = '\0';
> +mkdir(temp, 0755);
> +*pos = '/';
> +}
> +}
> +
> +if (*(pos - 1) != '/') {

all the '/' stuff looks non portable (windows)


[...]


-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
conveniently.
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.


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


[FFmpeg-devel] [PATCH 2/2] movenc: Add support for writing language codes into ISML manifests

2016-09-26 Thread Jan Ekström
Streaming servers appear to ignore all other language metadata.

Signed-off-by: Jan Ekström 
---
 libavformat/movenc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index d5ed1dd..28edb18 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) {
@@ -3630,6 +3633,7 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 (int64_t)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;
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH 2/4] V10 - SCTE-35 extraction from mpegts

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 10:59:45AM -0700, Carlos Fernandez Sanz wrote:
> From: Carlos Fernandez 
> 
> Signed-off-by: Carlos Fernandez 
> ---
>  libavformat/mpegts.c | 64 
> ++--
>  1 file changed, 62 insertions(+), 2 deletions(-)
> 

this breaks fate:
make: *** [fate-h264-skip-nokey] Error 1
make: *** [fate-h264-skip-nointra] Error 1
make: *** [fate-ts-demux] Error 1
make: *** [fate-copy-trac4914] Error 1
make: *** [fate-copy-trac4914-avi] Error 1
make: *** [fate-lavf-ts] Error 1

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato


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


[FFmpeg-devel] [PATCH 0/2 v2] Various improvements to movenc's smooth streaming support

2016-09-26 Thread Jan Ekström
Enables writing a bit rate field into the ISML manifest when bit rate is not
set but maxrate is, adds support for language codes in the smooth streaming
manifest.

Updated to work with post-codecpar. Timestamp patch was dropped since there
is a patch available to be tested which enables the usage of negative
CTS offsets, leading to the initial sample's CTS and DTS to match. If that
patch works, smooth streaming output should rather be locked to that mode.

Jan Ekström (2):
  movenc: use similar logic to DASH when writing bit rate to ISML
  movenc: Add support for writing language codes into ISML manifests

 libavformat/movenc.c | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

-- 
2.7.4

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


[FFmpeg-devel] [PATCH 1/2] movenc: use similar logic to DASH when writing bit rate to ISML

2016-09-26 Thread Jan Ekström
This way, in case of bit rate not being set, max_bitrate will be
used instead. This enables, for example, re-using max_bitrate
information from the input or doing transcoding with a rate
control mode that is not bit rate based.

Signed-off-by: Jan Ekström 
---
 libavformat/movenc.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 449d0b5..d5ed1dd 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3581,6 +3581,9 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 {
 int64_t pos = avio_tell(pb);
 int i;
+int64_t manifest_bit_rate = 0;
+AVCPBProperties *props = NULL;
+
 static const uint8_t uuid[] = {
 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
@@ -3615,9 +3618,17 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 } else {
 continue;
 }
+
+props = (AVCPBProperties*)av_stream_get_side_data(track->st, 
AV_PKT_DATA_CPB_PROPERTIES, NULL);
+
+if (track->par->bit_rate)
+manifest_bit_rate = track->par->bit_rate;
+else if (props)
+manifest_bit_rate = props->max_bitrate;
+
 avio_printf(pb, "<%s systemBitrate=\"%"PRId64"\">\n", type,
-(int64_t)track->par->bit_rate);
-param_write_int(pb, "systemBitrate", track->par->bit_rate);
+(int64_t)manifest_bit_rate);
+param_write_int(pb, "systemBitrate", manifest_bit_rate);
 param_write_int(pb, "trackID", track_id);
 if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
 if (track->par->codec_id == AV_CODEC_ID_H264) {
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread James Almer
On 9/26/2016 6:38 PM, Michael Niedermayer wrote:
> On Mon, Sep 26, 2016 at 02:39:13PM -0300, James Almer wrote:
>> This commit is based on commit 35c8580 from Anton Khirnov 
>> which was skipped in b8945c4.
>>
>> The avcodec_copy_context() call in the encode path is left in place for now
>> as AVStream.codec is apparently still required even after porting ffmpeg to
>> the new bsf API.
>>
>> Signed-off-by: James Almer 
>> ---
>>  ffmpeg.c | 25 -
>>  ffmpeg.h |  1 +
>>  ffmpeg_opt.c | 12 +---
>>  3 files changed, 14 insertions(+), 24 deletions(-)
> 
> This breaks
> ./ffmpeg -i matrixbench_mpeg2.mpg -flags +bitexact -t 1 -codec copy -f 
> framecrc -
> compared to the case before the patch and without codec copy
> "#software: Lavf57.50.100"
> is output

AVCodecContext flag bitexact is (for now) converted into AVFormatContext flag
bitexact, and by removing the chunk in ffmpeg_opt.c that sets the former in
st->codec, this doesn't happen anymore.

This is from init_muxer() libavformat/mux.c, and it's scheduled for removal
with FF_API_LAVF_BITEXACT and ultimately with FF_API_LAVF_AVCTX, so i guess
i'll leave the chunk in question in place and just wrap it up with a check
for the latter define. Is that ok?

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


Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 02:39:13PM -0300, James Almer wrote:
> This commit is based on commit 35c8580 from Anton Khirnov 
> which was skipped in b8945c4.
> 
> The avcodec_copy_context() call in the encode path is left in place for now
> as AVStream.codec is apparently still required even after porting ffmpeg to
> the new bsf API.
> 
> Signed-off-by: James Almer 
> ---
>  ffmpeg.c | 25 -
>  ffmpeg.h |  1 +
>  ffmpeg_opt.c | 12 +---
>  3 files changed, 14 insertions(+), 24 deletions(-)

This breaks
./ffmpeg -i matrixbench_mpeg2.mpg -flags +bitexact -t 1 -codec copy -f framecrc 
-
compared to the case before the patch and without codec copy
"#software: Lavf57.50.100"
is output

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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin


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


[FFmpeg-devel] [PATCH] avfilter/vf_drawtext: fixed default/flt formatting ignoring offset parameter

2016-09-26 Thread Alexander Agranovsky


From 9f183abbdde7fa50b9425165dd792d2770098749 Mon Sep 17 00:00:00 2001
From: Alex Agranovsky 
Date: Mon, 26 Sep 2016 16:23:45 -0400
Subject: [PATCH] avfilter/vf_drawtext: fixed default/flt formatting ignoring 
offset parameter

Signed-off-by: Alex Agranovsky 
---
 libavfilter/vf_drawtext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 214aef0..489db40 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -809,7 +809,7 @@ static int func_pts(AVFilterContext *ctx, AVBPrint *bp,
 pts += (double)delta / AV_TIME_BASE;
 }
 if (!strcmp(fmt, "flt")) {
-av_bprintf(bp, "%.6f", s->var_values[VAR_T]);
+av_bprintf(bp, "%.6f", pts);
 } else if (!strcmp(fmt, "hms")) {
 if (isnan(pts)) {
 av_bprintf(bp, " ??:??:??.???");
-- 
2.5.4 (Apple Git-61)

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding.

2016-09-26 Thread Sasi Inguva
Sent three separate patches. PTAL. Thanks.

On Fri, Sep 23, 2016 at 6:55 PM, Michael Niedermayer  wrote:

> On Fri, Sep 23, 2016 at 06:20:18PM -0700, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavcodec/utils.c   | 16 +++---
> >  libavformat/mov.c| 81
> 
>
> >  tests/fate-run.sh|  2 +-
>
> this belongs in a seperate patch
>
> libavcodec and libavformat changes should also be split into 2
> patches to keep things cleanly seperated
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Breaking DRM is a little like attempting to break through a door even
> though the window is wide open and the only thing in the house is a bunch
> of things you dont want and which you would get tomorrow for free anyway
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] avformat: add av_stream_get_codec_timebase()

2016-09-26 Thread James Almer
On 9/26/2016 3:22 PM, wm4 wrote:
> On Mon, 26 Sep 2016 14:39:12 -0300
> James Almer  wrote:
> 
>> This will allow ffmpeg.c to stop using AVStream.codec in some cases
>>
>> Signed-off-by: James Almer 
>> ---
>> TODO: Version bump, APIChanges entry.
>>
>>  libavformat/avformat.h |  7 +++
>>  libavformat/utils.c| 10 ++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>> index ae70cc8..057f8c5 100644
>> --- a/libavformat/avformat.h
>> +++ b/libavformat/avformat.h
>> @@ -2922,6 +2922,13 @@ int 
>> avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
>>enum AVTimebaseSource 
>> copy_tb);
>>  
>>  /**
>> + * Get the internal codec timebase from a stream.
>> + *
>> + * @param st  input stream to extract the timebase from
>> + */
>> +AVRational av_stream_get_codec_timebase(const AVStream *st);
>> +
>> +/**
>>   * @}
>>   */
>>  
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index 3e0f57d..abb5fb9 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -5383,3 +5383,13 @@ int 
>> avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
>>  
>>  return 0;
>>  }
>> +
>> +AVRational av_stream_get_codec_timebase(const AVStream *st)
>> +{
>> +// See avformat_transfer_internal_stream_timing_info() TODO.
>> +#if FF_API_LAVF_AVCTX
>> +FF_DISABLE_DEPRECATION_WARNINGS
>> +return st->codec->time_base;
>> +FF_ENABLE_DEPRECATION_WARNINGS
>> +#endif
>> +}
> 
> So if FF_API_LAVF_AVCTX is finally removed, this function changes its
> behavior to launching nethack? I don't get it.

That's why i added the comment about seeing the
avformat_transfer_internal_stream_timing_info() TODO. It should use
st->internal->avctx when that happens, much like the other function.

I can add that inside an #else if you prefer, but many other things
would break without further changes as soon as AVStream.codec is
gone beside this function anyway, like for example the one with the
TODO in question.

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


[FFmpeg-devel] [PATCH 2/3] lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding. Adjust skip_samples field correctly in case of DISCARDed aud

2016-09-26 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavformat/mov.c| 81 
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac |  2 +-
 tests/ref/fate/gaplessenc-pcm-to-mov-aac |  2 +-
 3 files changed, 72 insertions(+), 13 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b84d9c0..bb86780 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2856,6 +2856,21 @@ static int64_t add_index_entry(AVStream *st, int64_t 
pos, int64_t timestamp,
 }
 
 /**
+ * Rewrite timestamps of index entries in the range [end_index - 
frame_duration_buffer_size, end_index)
+ * by subtracting end_ts successively by the amounts given in 
frame_duration_buffer.
+ */
+static void fix_index_entry_timestamps(AVStream* st, int end_index, int64_t 
end_ts,
+   int64_t* frame_duration_buffer,
+   int frame_duration_buffer_size) {
+int i = 0;
+av_assert0(end_index >= 0 && end_index <= st->nb_index_entries);
+for (i = 0; i < frame_duration_buffer_size; i++) {
+end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 - i];
+st->index_entries[end_index - 1 - i].timestamp = end_ts;
+}
+}
+
+/**
  * Append a new ctts entry to ctts_data.
  * Returns the new ctts_count if successful, else returns -1.
  */
@@ -2919,7 +2934,10 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 int64_t edit_list_media_time_dts = 0;
 int64_t edit_list_start_encountered = 0;
 int64_t search_timestamp = 0;
-
+int64_t* frame_duration_buffer = NULL;
+int num_discarded_begin = 0;
+int first_non_zero_audio_edit = -1;
+int packet_skip_samples = 0;
 
 if (!msc->elst_data || msc->elst_count <= 0) {
 return;
@@ -2955,6 +2973,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 edit_list_index++;
 edit_list_dts_counter = edit_list_dts_entry_end;
 edit_list_dts_entry_end += edit_list_duration;
+num_discarded_begin = 0;
 if (edit_list_media_time == -1) {
 continue;
 }
@@ -2962,7 +2981,14 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 // If we encounter a non-negative edit list reset the 
skip_samples/start_pad fields and set them
 // according to the edit list below.
 if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
-st->skip_samples = msc->start_pad = 0;
+if (first_non_zero_audio_edit < 0) {
+first_non_zero_audio_edit = 1;
+} else {
+first_non_zero_audio_edit = 0;
+}
+
+if (first_non_zero_audio_edit > 0)
+st->skip_samples = msc->start_pad = 0;
 }
 
 //find closest previous key frame
@@ -3041,24 +3067,57 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 }
 
 if (curr_cts < edit_list_media_time || curr_cts >= 
(edit_list_duration + edit_list_media_time)) {
-if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && curr_cts 
< edit_list_media_time &&
-curr_cts + frame_duration > edit_list_media_time &&
-st->skip_samples == 0 && msc->start_pad == 0) {
-st->skip_samples = msc->start_pad = edit_list_media_time - 
curr_cts;
-
-// Shift the index entry timestamp by skip_samples to be 
correct.
-edit_list_dts_counter -= st->skip_samples;
+if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && 
st->codecpar->codec_id != AV_CODEC_ID_VORBIS &&
+curr_cts < edit_list_media_time && curr_cts + 
frame_duration > edit_list_media_time &&
+first_non_zero_audio_edit > 0) {
+ packet_skip_samples = edit_list_media_time - curr_cts;
+ st->skip_samples += packet_skip_samples;
+
+// Shift the index entry timestamp by packet_skip_samples 
to be correct.
+edit_list_dts_counter -= packet_skip_samples;
 if (edit_list_start_encountered == 0)  {
-  edit_list_start_encountered = 1;
+edit_list_start_encountered = 1;
+// Make timestamps strictly monotonically increasing 
for audio, by rewriting timestamps for
+// discarded packets.
+if (frame_duration_buffer) {
+  fix_index_entry_timestamps(st, st->nb_index_entries, 
edit_list_dts_counter,
+ frame_duration_buffer, 
num_discarded_begin);
+  av_freep(_duration_buffer);
+}
 }
 
-av_log(mov->fc, AV_LOG_DEBUG, "skip %d audio samples from 
curr_cts: %"PRId64"\n", st->skip_samples, curr_cts);
+av_log(mov->fc, 

[FFmpeg-devel] [PATCH 3/3] tests/fate-run.sh: Show packet flags for fate gapless tests.

2016-09-26 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 tests/fate-run.sh|  2 +-
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 32 ++--
 tests/ref/fate/gaplessenc-pcm-to-mov-aac | 32 ++--
 tests/ref/fate/gaplessinfo-itunes1   | 32 ++--
 tests/ref/fate/gaplessinfo-itunes2   | 32 ++--
 5 files changed, 65 insertions(+), 65 deletions(-)

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index c640cc5..cca8fa0 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -107,7 +107,7 @@ probegaplessinfo(){
 pktfile1="${outdir}/${test}.pkts"
 framefile1="${outdir}/${test}.frames"
 cleanfiles="$cleanfiles $pktfile1 $framefile1"
-run ffprobe${PROGSUF} -bitexact -select_streams a -of compact 
-count_packets -show_entries packet=pts,dts,duration:stream=nb_read_packets -v 
0 "$filename" "$@" > "$pktfile1"
+run ffprobe${PROGSUF} -bitexact -select_streams a -of compact 
-count_packets -show_entries 
packet=pts,dts,duration,flags:stream=nb_read_packets -v 0 "$filename" "$@" > 
"$pktfile1"
 head -n 8 "$pktfile1"
 tail -n 9 "$pktfile1"
 run ffprobe${PROGSUF} -bitexact -select_streams a -of compact 
-count_frames -show_entries 
frame=pkt_pts,pkt_dts,best_effort_timestamp,pkt_duration,nb_samples:stream=nb_read_frames
 -v 0 "$filename" "$@" > "$framefile1"
diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac 
b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
index 789681f..ed68487 100644
--- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
+++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
@@ -7,22 +7,22 @@ duration_ts=103326
 start_time=0.00
 duration=2.367000
 [/FORMAT]
-packet|pts=-1024|dts=-1024|duration=1024
-packet|pts=0|dts=0|duration=1024
-packet|pts=1024|dts=1024|duration=1024
-packet|pts=2048|dts=2048|duration=1024
-packet|pts=3072|dts=3072|duration=1024
-packet|pts=4096|dts=4096|duration=1024
-packet|pts=5120|dts=5120|duration=1024
-packet|pts=6144|dts=6144|duration=1024
-packet|pts=95232|dts=95232|duration=1024
-packet|pts=96256|dts=96256|duration=1024
-packet|pts=97280|dts=97280|duration=1024
-packet|pts=98304|dts=98304|duration=1024
-packet|pts=99328|dts=99328|duration=1024
-packet|pts=100352|dts=100352|duration=1024
-packet|pts=101376|dts=101376|duration=1024
-packet|pts=102400|dts=102400|duration=926
+packet|pts=-1024|dts=-1024|duration=1024|flags=KD
+packet|pts=0|dts=0|duration=1024|flags=K_
+packet|pts=1024|dts=1024|duration=1024|flags=K_
+packet|pts=2048|dts=2048|duration=1024|flags=K_
+packet|pts=3072|dts=3072|duration=1024|flags=K_
+packet|pts=4096|dts=4096|duration=1024|flags=K_
+packet|pts=5120|dts=5120|duration=1024|flags=K_
+packet|pts=6144|dts=6144|duration=1024|flags=K_
+packet|pts=95232|dts=95232|duration=1024|flags=K_
+packet|pts=96256|dts=96256|duration=1024|flags=K_
+packet|pts=97280|dts=97280|duration=1024|flags=K_
+packet|pts=98304|dts=98304|duration=1024|flags=K_
+packet|pts=99328|dts=99328|duration=1024|flags=K_
+packet|pts=100352|dts=100352|duration=1024|flags=K_
+packet|pts=101376|dts=101376|duration=1024|flags=K_
+packet|pts=102400|dts=102400|duration=926|flags=K_
 stream|nb_read_packets=102
 
frame|pkt_pts=0|pkt_dts=0|best_effort_timestamp=0|pkt_duration=1024|nb_samples=1024
 
frame|pkt_pts=1024|pkt_dts=1024|best_effort_timestamp=1024|pkt_duration=1024|nb_samples=1024
diff --git a/tests/ref/fate/gaplessenc-pcm-to-mov-aac 
b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
index 8702611..b5f9182 100644
--- a/tests/ref/fate/gaplessenc-pcm-to-mov-aac
+++ b/tests/ref/fate/gaplessenc-pcm-to-mov-aac
@@ -7,22 +7,22 @@ duration_ts=529200
 start_time=0.00
 duration=12.024000
 [/FORMAT]
-packet|pts=-1024|dts=-1024|duration=1024
-packet|pts=0|dts=0|duration=1024
-packet|pts=1024|dts=1024|duration=1024
-packet|pts=2048|dts=2048|duration=1024
-packet|pts=3072|dts=3072|duration=1024
-packet|pts=4096|dts=4096|duration=1024
-packet|pts=5120|dts=5120|duration=1024
-packet|pts=6144|dts=6144|duration=1024
-packet|pts=521216|dts=521216|duration=1024
-packet|pts=522240|dts=522240|duration=1024
-packet|pts=523264|dts=523264|duration=1024
-packet|pts=524288|dts=524288|duration=1024
-packet|pts=525312|dts=525312|duration=1024
-packet|pts=526336|dts=526336|duration=1024
-packet|pts=527360|dts=527360|duration=1024
-packet|pts=528384|dts=528384|duration=816
+packet|pts=-1024|dts=-1024|duration=1024|flags=KD
+packet|pts=0|dts=0|duration=1024|flags=K_
+packet|pts=1024|dts=1024|duration=1024|flags=K_
+packet|pts=2048|dts=2048|duration=1024|flags=K_
+packet|pts=3072|dts=3072|duration=1024|flags=K_
+packet|pts=4096|dts=4096|duration=1024|flags=K_
+packet|pts=5120|dts=5120|duration=1024|flags=K_
+packet|pts=6144|dts=6144|duration=1024|flags=K_
+packet|pts=521216|dts=521216|duration=1024|flags=K_
+packet|pts=522240|dts=522240|duration=1024|flags=K_
+packet|pts=523264|dts=523264|duration=1024|flags=K_

[FFmpeg-devel] [PATCH 1/3] lavc/utils.c: Subtract skip_samples when frame is DISCARDed.

2016-09-26 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavcodec/utils.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b0345b6..6323156 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2320,7 +2320,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 uint32_t discard_padding = 0;
 uint8_t skip_reason = 0;
 uint8_t discard_reason = 0;
-int demuxer_skip_samples = 0;
 // copy to ensure we do not change avpkt
 AVPacket tmp = *avpkt;
 int did_split = av_packet_split_side_data();
@@ -2328,7 +2327,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 if (ret < 0)
 goto fail;
 
-demuxer_skip_samples = avctx->internal->skip_samples;
 avctx->internal->pkt = 
 if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
 ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, );
@@ -2353,13 +2351,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 frame->sample_rate = avctx->sample_rate;
 }
 
-
-if (frame->flags & AV_FRAME_FLAG_DISCARD) {
-// If using discard frame flag, ignore skip_samples set by the 
decoder.
-avctx->internal->skip_samples = demuxer_skip_samples;
-*got_frame_ptr = 0;
-}
-
 side= av_packet_get_side_data(avctx->internal->pkt, 
AV_PKT_DATA_SKIP_SAMPLES, _size);
 if(side && side_size>=10) {
 avctx->internal->skip_samples = AV_RL32(side);
@@ -2369,6 +2360,13 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 skip_reason = AV_RL8(side + 8);
 discard_reason = AV_RL8(side + 9);
 }
+
+if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
+!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+avctx->internal->skip_samples -= frame->nb_samples;
+*got_frame_ptr = 0;
+}
+
 if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
 !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
 if(frame->nb_samples <= avctx->internal->skip_samples){
-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [PATCH 1/2] avformat: add av_stream_get_codec_timebase()

2016-09-26 Thread wm4
On Mon, 26 Sep 2016 14:39:12 -0300
James Almer  wrote:

> This will allow ffmpeg.c to stop using AVStream.codec in some cases
> 
> Signed-off-by: James Almer 
> ---
> TODO: Version bump, APIChanges entry.
> 
>  libavformat/avformat.h |  7 +++
>  libavformat/utils.c| 10 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index ae70cc8..057f8c5 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -2922,6 +2922,13 @@ int 
> avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
>enum AVTimebaseSource 
> copy_tb);
>  
>  /**
> + * Get the internal codec timebase from a stream.
> + *
> + * @param st  input stream to extract the timebase from
> + */
> +AVRational av_stream_get_codec_timebase(const AVStream *st);
> +
> +/**
>   * @}
>   */
>  
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 3e0f57d..abb5fb9 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -5383,3 +5383,13 @@ int 
> avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
>  
>  return 0;
>  }
> +
> +AVRational av_stream_get_codec_timebase(const AVStream *st)
> +{
> +// See avformat_transfer_internal_stream_timing_info() TODO.
> +#if FF_API_LAVF_AVCTX
> +FF_DISABLE_DEPRECATION_WARNINGS
> +return st->codec->time_base;
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
> +}

So if FF_API_LAVF_AVCTX is finally removed, this function changes its
behavior to launching nethack? I don't get it.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/4] V9 - SCTE-35 extraction from mpegts

2016-09-26 Thread Carlos Fernandez Sanz
On Sun, Sep 4, 2016 at 9:48 AM, Marton Balint  wrote:
>
> Sorry for the delay. Below some comments.

Thanks for that. I've submitted a new patch that hopefully addresses
everything. Definitely much cleaner now.

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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mp3dec: read encoder delay/padding from Info tag

2016-09-26 Thread wm4
On Mon, 26 Sep 2016 10:13:39 -0700
Jon Toohill  wrote:

> ---
>  libavformat/mp3dec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> index 56c7f8c..9cc85a3 100644
> --- a/libavformat/mp3dec.c
> +++ b/libavformat/mp3dec.c
> @@ -239,6 +239,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, 
> AVStream *st,
>  
>  mp3->start_pad = v>>12;
>  mp3->  end_pad = v&4095;
> +st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
> +st->codecpar->trailing_padding = mp3->end_pad;
>  st->start_skip_samples = mp3->start_pad + 528 + 1;
>  if (mp3->frames) {
>  st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames 
> * (int64_t)spf;

I'm somewhat suspicious about this, because mp3dec.c uses
AV_PKT_DATA_SKIP_SAMPLES to communicate delay/padding
(libavformat/utils.c turns the start_skip_samples field into side
data). So I'm not quite convinced is this mess of FFmpeg and Libav API
mixture is healthy. Opinions welcome.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/4] V10 - SCTE-35 extraction from mpegts

2016-09-26 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavformat/mpegts.c | 64 ++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b31d233..ad6f141 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -725,6 +725,12 @@ static const StreamType HDMV_types[] = {
 { 0 },
 };
 
+/* SCTE types */
+static const StreamType SCTE_types[] = {
+{ 0x86, AVMEDIA_TYPE_DATA,  AV_CODEC_ID_SCTE_35},
+{ 0 },
+};
+
 /* ATSC ? */
 static const StreamType MISC_types[] = {
 { 0x81, AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
@@ -872,6 +878,13 @@ static void reset_pes_packet_state(PESContext *pes)
 av_buffer_unref(>buffer);
 }
 
+static void new_data_packet(const uint8_t *buffer, int len, AVPacket *pkt)
+{
+av_init_packet(pkt);
+pkt->data = buffer;
+pkt->size = len;
+}
+
 static int new_pes_packet(PESContext *pes, AVPacket *pkt)
 {
 char *sd;
@@ -1590,6 +1603,27 @@ static void m4sl_cb(MpegTSFilter *filter, const uint8_t 
*section,
 av_free(mp4_descr[i].dec_config_descr);
 }
 
+static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
+int section_len)
+{
+AVProgram *prg = NULL;
+MpegTSContext *ts = filter->u.section_filter.opaque;
+
+int idx = ff_find_stream_index(ts->stream, filter->pid);
+new_data_packet(section, section_len, ts->pkt);
+if (idx >= 0) {
+ts->pkt->stream_index = idx;
+}
+prg = av_find_program_from_stream(ts->stream, NULL, idx);
+if (prg && prg->pcr_pid != -1 && prg->discard != AVDISCARD_ALL) {
+MpegTSFilter *f = ts->pids[prg->pcr_pid];
+if(f)
+ts->pkt->pts = ts->pkt->dts = f->last_pcr/300;
+}
+ts->stop_parse = 1;
+
+}
+
 static const uint8_t opus_coupled_stream_cnt[9] = {
 1, 0, 1, 1, 2, 2, 2, 3, 3
 };
@@ -1868,6 +1902,12 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 return 0;
 }
 
+static int is_pes_stream(int stream_type, uint32_t prog_reg_desc)
+{
+return !(stream_type == 0x13 ||
+ stream_type == 0x86 && prog_reg_desc == AV_RL32("CUEI"));
+}
+
 static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int 
section_len)
 {
 MpegTSContext *ts = filter->u.section_filter.opaque;
@@ -1975,7 +2015,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 pes->st->id = pes->pid;
 }
 st = pes->st;
-} else if (stream_type != 0x13) {
+
+} else if (is_pes_stream(stream_type, prog_reg_desc)) {
 if (ts->pids[pid])
 mpegts_close_filter(ts, ts->pids[pid]); // wrongly added sdt 
filter probably
 pes = add_pes_stream(ts, pid, pcr_pid);
@@ -1994,7 +2035,9 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t 
*section, int section_len
 if (!st)
 goto out;
 st->id = pid;
+mpegts_find_stream_type(st, stream_type, SCTE_types);
 st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
+mpegts_open_section_filter(ts, pid, scte_data_cb, ts, 1);
 }
 }
 
@@ -2317,7 +2360,22 @@ static int handle_packet(MpegTSContext *ts, const 
uint8_t *packet)
 }
 }
 }
-
+if(0) {
+AVProgram *prg = NULL;
+int idx = ff_find_stream_index(ts->stream, pid);
+p++;
+new_data_packet(p,p_end - p, ts->pkt);
+if (idx >= 0) {
+ts->pkt->stream_index = idx;
+}
+prg = av_find_program_from_stream(ts->stream, prg, idx);
+if (prg->pcr_pid != -1 && prg->discard != AVDISCARD_ALL) {
+MpegTSFilter *f = ts->pids[prg->pcr_pid];
+if(f)
+ts->pkt->pts = ts->pkt->dts = f->last_pcr/300;
+}
+ts->stop_parse = 1;
+}
 } else {
 int ret;
 // Note: The position here points actually behind the current packet.
@@ -2730,6 +2788,8 @@ static int mpegts_read_packet(AVFormatContext *s, 
AVPacket *pkt)
 ret = 0;
 break;
 }
+} else if (ts->pids[i] && ts->pids[i]->type == MPEGTS_SECTION) {
+return ret;
 }
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 4/4] V10 - Correct Indentation

2016-09-26 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavformat/hlsenc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index b210fe6..127b2ab 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -373,12 +373,12 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls, double
 else
 en->sub_filename[0] = '\0';
 
-en->duration = duration;
-en->pos  = pos;
-en->event= event;
-en->size = size;
+en->duration   = duration;
+en->pos= pos;
+en->event  = event;
+en->size   = size;
 en->start_pts  = start_pts;
-en->next = NULL;
+en->next   = NULL;
 
 if (hls->scte_iface) {
 if (hls->scte_iface->event_state == EVENT_OUT_CONT) {
-- 
2.7.4

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


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-09-26 Thread Pallavi Kumari
Thanks for the inspiring reply Nicholas :) I am glad that you find the idea
very interesting.

>> I think this could be a very interesting project, but maybe also very
hard.
>> I myself do not have the skills or knowledge to help in any way in that
area.

I have been reading few papers related to such field and have some basic
idea as my research interest is in the area of information retrieval, ML
and Deep learning. I think this could be doable. Also, looking forward for
mentor(s) for this project.

>> OTOH, there is one use that I have in mind that may not be covered by
existing algorithms: fingerprinting a short
>> segment of audio to search for it efficiently and accurately in a larger
footage without access to the original
>> segment, and even if it was subjected to a different lossy codec or even
small changes in pitch or speed. To be
>> honest, I do not know if it is even possible, but it would be very
useful.

This was something in my mind too. Music application like Shazam does a
pretty good job for this purpose.  Given a piece of music from an audio (or
humming manual) it finds exact song and the similar songs.

Algorithms for the above scenario can be done by doing spectrum analysis
(fingerprinting) technique. Let me make a draft explaining algorithmic
steps in details.

Looking forward to more interesting views/opinions.


Regards,
Pallavi,
IRC - atana

On Mon, Sep 26, 2016 at 10:33 PM, Nicolas George  wrote:

> Le quartidi 4 vendémiaire, an CCXXV, Pallavi Kumari a écrit :
> > I want to propose the idea of implementing filters for ffmpeg that would
> > give different audio fingerprints for an audio which could be reused by
> > other people for variety of applications. Goal of this system is given a
> > song as a input, it would spits out similar sounding songs. Some of its
> > applications are:
> >
> > * detecting duplicate songs
> > * retrieving similar songs
> > * can be used for recommending songs
> > * clustering songs based on content/tags
>
> > Kindly, let me know if the proposed idea sounds interesting and relevant
> to
> > the community. I would be happy to share a rough draft containing
> details.
>
> I think this could be a very interesting project, but maybe also very hard.
> I myself do not have the skills or knowledge to help in any way in that
> area.
>
> I think a few fingerprinting algorithms of the kind exist. Implementing
> them
> with ffmpeg's DSP infrastructure would probably be easier than designing
> one
> from scratch.
>
> OTOH, there is one use that I have in mind that may not be covered by
> existing algorithms: fingerprinting a short segment of audio to search for
> it efficiently and accurately in a larger footage without access to the
> original segment, and even if it was subjected to a different lossy codec
> or
> even small changes in pitch or speed. To be honest, I do not know if it is
> even possible, but it would be very useful.
>
> Regards,
>
> --
>   Nicolas George
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/4] V10 - Adding SCTE-35 CUI codec

2016-09-26 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavcodec/avcodec.h| 3 ++-
 libavcodec/codec_desc.c | 6 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index b174116..0eee2ab 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -630,7 +630,8 @@ enum AVCodecID {
 /* other specific kind of codecs (generally used for attachments) */
 AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,   ///< A dummy ID pointing at 
the start of various fake codecs.
 AV_CODEC_ID_TTF = 0x18000,
-
+AV_CODEC_ID_SCTE_35,/**< Contain no valid time stamp in DTS PTS of 
avpacket, avpacket data contain time stamp
+  in scte-35 format which is relative to DTS/PTS 
of video stream */
 AV_CODEC_ID_BINTEXT= 0x18800,
 AV_CODEC_ID_XBIN,
 AV_CODEC_ID_IDF,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 24948ca..2612215 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2964,6 +2964,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .long_name = NULL_IF_CONFIG_SMALL("binary data"),
 .mime_types= MT("application/octet-stream"),
 },
+{
+.id= AV_CODEC_ID_SCTE_35,
+.type  = AVMEDIA_TYPE_DATA,
+.name  = "scte_35",
+.long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
+},
 
 /* deprecated codec ids */
 };
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 3/4] V10 - SCTE-35 support in hlsenc

2016-09-26 Thread Carlos Fernandez Sanz
From: Carlos Fernandez 

Signed-off-by: Carlos Fernandez 
---
 libavformat/Makefile  |   2 +-
 libavformat/hlsenc.c  | 110 ---
 libavformat/scte_35.c | 527 ++
 libavformat/scte_35.h |  86 
 4 files changed, 702 insertions(+), 23 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 5d827d31..9218606 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -205,7 +205,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 scte_35.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 428bae4..b210fe6 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -1,4 +1,4 @@
-/*
+ /*
  * Apple HTTP Live Streaming segmenter
  * Copyright (c) 2012, Luca Barbato
  *
@@ -38,6 +38,7 @@
 #include "avio_internal.h"
 #include "internal.h"
 #include "os_support.h"
+#include "scte_35.h"
 
 #define KEYSIZE 16
 #define LINE_BUFFER_SIZE 1024
@@ -48,6 +49,10 @@ typedef struct HLSSegment {
 double duration; /* in seconds */
 int64_t pos;
 int64_t size;
+struct scte_35_event *event;
+int out;
+int adv_count;
+int64_t start_pts;
 
 char key_uri[LINE_BUFFER_SIZE + 1];
 char iv_string[KEYSIZE*2 + 1];
@@ -92,6 +97,8 @@ typedef struct HLSContext {
 uint32_t flags;// enum HLSFlags
 uint32_t pl_type;  // enum PlaylistType
 char *segment_filename;
+char *adv_filename;
+char *adv_subfilename;
 
 int use_localtime;  ///< flag to expand filename with localtime
 int use_localtime_mkdir;///< flag to mkdir dirname in timebased filename
@@ -108,6 +115,8 @@ typedef struct HLSContext {
 int nb_entries;
 int discontinuity_set;
 
+int adv_count;
+struct scte_35_interface *scte_iface;
 HLSSegment *segments;
 HLSSegment *last_segment;
 HLSSegment *old_segments;
@@ -208,6 +217,8 @@ static int hls_delete_old_segments(HLSContext *hls) {
 av_freep();
 previous_segment = segment;
 segment = previous_segment->next;
+if (hls->scte_iface)
+hls->scte_iface->unref_scte35_event(_segment->event);
 av_free(previous_segment);
 }
 
@@ -327,8 +338,8 @@ static int hls_mux_init(AVFormatContext *s)
 }
 
 /* Create a new segment and append it to the segment list */
-static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, 
double duration,
-  int64_t pos, int64_t size)
+static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, 
double duration, int64_t pos,
+  int64_t start_pts, struct scte_35_event *event, 
int64_t size)
 {
 HLSSegment *en = av_malloc(sizeof(*en));
 char *tmp, *p;
@@ -364,9 +375,23 @@ static int hls_append_segment(struct AVFormatContext *s, 
HLSContext *hls, double
 
 en->duration = duration;
 en->pos  = pos;
+en->event= event;
 en->size = size;
+en->start_pts  = start_pts;
 en->next = NULL;
 
+if (hls->scte_iface) {
+if (hls->scte_iface->event_state == EVENT_OUT_CONT) {
+en->adv_count = hls->adv_count;;
+hls->adv_count++;
+en->out = hls->scte_iface->event_state;
+} else {
+hls->adv_count = 0;
+en->out = hls->scte_iface->event_state;
+}
+}
+
+
 if (hls->key_info_file) {
 av_strlcpy(en->key_uri, hls->key_uri, sizeof(en->key_uri));
 av_strlcpy(en->iv_string, hls->iv_string, sizeof(en->iv_string));
@@ -440,7 +465,7 @@ static int parse_playlist(AVFormatContext *s, const char 
*url)
 new_start_pos = avio_tell(hls->avf->pb);
 hls->size = new_start_pos - hls->start_pos;
 av_strlcpy(hls->avf->filename, line, sizeof(line));
-ret = hls_append_segment(s, hls, hls->duration, 
hls->start_pos, hls->size);
+ret = hls_append_segment(s, hls, hls->duration, 
hls->start_pos, 0, NULL, hls->size);
 if (ret < 0)
 goto fail;
 hls->start_pos = new_start_pos;
@@ -570,9 +595,23 @@ static int hls_window(AVFormatContext *s, int last)
 avio_printf(out, "#EXT-X-PROGRAM-DATE-TIME:%s.%03d%s\n", buf0, 
milli, buf1);
 prog_date_time += en->duration;
 }
-if (hls->baseurl)
-avio_printf(out, "%s", hls->baseurl);
-

[FFmpeg-devel] [PATCH 0/4] V10 - SCTE-35

2016-09-26 Thread Carlos Fernandez Sanz
- Addressed all issues (I think) raised by cus. Major refactor from v9 

Carlos Fernandez (4):
  Adding SCTE-35 CUI codec
  SCTE-35 extraction from mpegts
  SCTE-35 support in hlsenc
  Correct Indentation

 libavcodec/avcodec.h|   3 +-
 libavcodec/codec_desc.c |   6 +
 libavformat/Makefile|   2 +-
 libavformat/hlsenc.c| 118 ---
 libavformat/mpegts.c|  64 +-
 libavformat/scte_35.c   | 527 
 libavformat/scte_35.h   |  86 
 7 files changed, 776 insertions(+), 30 deletions(-)
 create mode 100644 libavformat/scte_35.c
 create mode 100644 libavformat/scte_35.h

-- 
2.7.4

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


[FFmpeg-devel] [PATCH 1/2] avformat: add av_stream_get_codec_timebase()

2016-09-26 Thread James Almer
This will allow ffmpeg.c to stop using AVStream.codec in some cases

Signed-off-by: James Almer 
---
TODO: Version bump, APIChanges entry.

 libavformat/avformat.h |  7 +++
 libavformat/utils.c| 10 ++
 2 files changed, 17 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ae70cc8..057f8c5 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2922,6 +2922,13 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
   enum AVTimebaseSource 
copy_tb);
 
 /**
+ * Get the internal codec timebase from a stream.
+ *
+ * @param st  input stream to extract the timebase from
+ */
+AVRational av_stream_get_codec_timebase(const AVStream *st);
+
+/**
  * @}
  */
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3e0f57d..abb5fb9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5383,3 +5383,13 @@ int avformat_transfer_internal_stream_timing_info(const 
AVOutputFormat *ofmt,
 
 return 0;
 }
+
+AVRational av_stream_get_codec_timebase(const AVStream *st)
+{
+// See avformat_transfer_internal_stream_timing_info() TODO.
+#if FF_API_LAVF_AVCTX
+FF_DISABLE_DEPRECATION_WARNINGS
+return st->codec->time_base;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+}
-- 
2.9.1

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


[FFmpeg-devel] [PATCH 2/2] ffmpeg: stop using AVStream.codec on stream copy

2016-09-26 Thread James Almer
This commit is based on commit 35c8580 from Anton Khirnov 
which was skipped in b8945c4.

The avcodec_copy_context() call in the encode path is left in place for now
as AVStream.codec is apparently still required even after porting ffmpeg to
the new bsf API.

Signed-off-by: James Almer 
---
 ffmpeg.c | 25 -
 ffmpeg.h |  1 +
 ffmpeg_opt.c | 12 +---
 3 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index df55a49..bbde63b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -516,6 +516,7 @@ static void ffmpeg_cleanup(int ret)
 av_dict_free(>encoder_opts);
 
 av_parser_close(ost->parser);
+avcodec_free_context(>parser_avctx);
 
 av_freep(>forced_keyframes);
 av_expr_free(ost->forced_keyframes_pexpr);
@@ -1899,7 +1900,7 @@ static void do_streamcopy(InputStream *ist, OutputStream 
*ost, const AVPacket *p
&& ost->st->codecpar->codec_id != AV_CODEC_ID_MPEG2VIDEO
&& ost->st->codecpar->codec_id != AV_CODEC_ID_VC1
) {
-int ret = av_parser_change(ost->parser, ost->st->codec,
+int ret = av_parser_change(ost->parser, ost->parser_avctx,
  , ,
  pkt->data, pkt->size,
  pkt->flags & AV_PKT_FLAG_KEY);
@@ -2723,9 +2724,7 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 exit_program(1);
 }
 /*
- * FIXME: this is only so that the bitstream filters and parsers (that 
still
- * work with a codec context) get the parameter values.
- * This should go away with the new BSF/parser API.
+ * FIXME: ost->st->codec should't be needed here anymore.
  */
 ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx);
 if (ret < 0)
@@ -2757,15 +2756,11 @@ static int init_output_stream(OutputStream *ost, char 
*error, int error_len)
 ost->st->time_base = av_add_q(ost->enc_ctx->time_base, (AVRational){0, 
1});
 ost->st->codec->codec= ost->enc_ctx->codec;
 } else if (ost->stream_copy) {
-// copy timebase while removing common factors
-ost->st->time_base = av_add_q(ost->st->codec->time_base, 
(AVRational){0, 1});
-
 /*
- * FIXME: this is only so that the bitstream filters and parsers (that 
still
- * work with a codec context) get the parameter values.
- * This should go away with the new BSF/parser API.
+ * FIXME: will the codec context used by the parser during streamcopy
+ * This should go away with the new parser API.
  */
-ret = avcodec_parameters_to_context(ost->st->codec, ost->st->codecpar);
+ret = avcodec_parameters_to_context(ost->parser_avctx, 
ost->st->codecpar);
 if (ret < 0)
 return ret;
 }
@@ -3007,12 +3002,13 @@ static int transcode_init(void)
 ost->frame_rate = ist->framerate;
 ost->st->avg_frame_rate = ost->frame_rate;
 
-ost->st->time_base = ist->st->time_base;
-
 ret = avformat_transfer_internal_stream_timing_info(oc->oformat, 
ost->st, ist->st, copy_tb);
 if (ret < 0)
 return ret;
 
+// copy timebase while removing common factors
+ost->st->time_base = 
av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
+
 if (ist->st->nb_side_data) {
 ost->st->side_data = av_realloc_array(NULL, 
ist->st->nb_side_data,
   
sizeof(*ist->st->side_data));
@@ -3038,6 +3034,9 @@ static int transcode_init(void)
 }
 
 ost->parser = av_parser_init(par_dst->codec_id);
+ost->parser_avctx = avcodec_alloc_context3(NULL);
+if (!ost->parser_avctx)
+return AVERROR(ENOMEM);
 
 switch (par_dst->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
diff --git a/ffmpeg.h b/ffmpeg.h
index b7f8b7a..0d01d2b 100644
--- a/ffmpeg.h
+++ b/ffmpeg.h
@@ -477,6 +477,7 @@ typedef struct OutputStream {
 int keep_pix_fmt;
 
 AVCodecParserContext *parser;
+AVCodecContext   *parser_avctx;
 
 /* stats */
 // combined size of all the packets written
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 73da546..0dd06a7 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2300,6 +2300,7 @@ loop_end:
 avio_read(pb, attachment, len);
 
 ost = new_attachment_stream(o, oc, -1);
+ost->stream_copy   = 0;
 ost->attachment_filename   = o->attachments[i];
 ost->st->codecpar->extradata  = attachment;
 ost->st->codecpar->extradata_size = len;
@@ -2309,17 +2310,6 @@ loop_end:
 avio_closep();
 }
 
-for (i = nb_output_streams - oc->nb_streams; i < nb_output_streams; i++) { 
//for all streams of this output file
-

Re: [FFmpeg-devel] [PATCH 2/2] lavf/mxfdec: begin utilizing the newly parsed widths and heights

2016-09-26 Thread Jan Ekstrom
On Sep 26, 2016 04:05, "Marton Balint"  wrote:
>
> Overriding width/height with display width/height does not seem right, check 
> what happens with a PAL IMX50 MXF file for example. If you want to signal 
> this, then a stream side data with some AVPanScan values might make more 
> sense.
>

Such a file was actually the reason why I started looking into this :)
. And it would all depend on the definition of width/height in
codecpar, which as far as I can tell is not clearly cut (see the notes
regarding container crop in at least the AVC decoder, I think?). My
understanding was that it would be the displayed width/height. Of
course, the container cropping/padding makes this less simple, since
you have:

1) Decoded picture
2) Decoder cropped picture (what the decoders *currently* output)
3) Decoder cropped picture cropped/padded according to available metadata

So my understanding was - since a decoder should output the pictures
according to 3) - that the displayed width/height fields should be
utilized for signaling the final display width/height of the picture.
The X/Y offset handling of course should have had its own fields
*somewhere* so that stuff could be done in some common part of avcodec
(for example). But if the codecpar->width/height is specified to 2)
(at least in lavf), then of course side data would be the correct way
to handle this. Also thanks for the hint regarding AVPanScan, I had no
idea this existed. Will have to check if it actually is used anywhere.

Best regards,
Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/4] lavf/mp3enc: write encoder delay/padding upon closing

2016-09-26 Thread James Almer
On 9/26/2016 2:13 PM, Jon Toohill wrote:
> trailing_padding is not known before encoding.
> ---
>  libavformat/mp3enc.c | 20 +---
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
> index de63401..433b070 100644
> --- a/libavformat/mp3enc.c
> +++ b/libavformat/mp3enc.c
> @@ -247,12 +247,7 @@ static int mp3_write_xing(AVFormatContext *s)
>  ffio_fill(dyn_ctx, 0, 8); // empty replaygain fields
>  avio_w8(dyn_ctx, 0);  // unknown encoding flags
>  avio_w8(dyn_ctx, 0);  // unknown abr/minimal bitrate
> -
> -// encoder delay
> -if (par->initial_padding - 528 - 1 >= 1 << 12) {
> -av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
> -}
> -avio_wb24(dyn_ctx, FFMAX(par->initial_padding - 528 - 1, 0)<<12);
> +avio_wb24(dyn_ctx, 0);// empty encoder delay/padding
>  
>  avio_w8(dyn_ctx,   0); // misc
>  avio_w8(dyn_ctx,   0); // mp3gain
> @@ -381,7 +376,7 @@ static void mp3_update_xing(AVFormatContext *s)
>  AVReplayGain *rg;
>  uint16_t tag_crc;
>  uint8_t *toc;
> -int i, rg_size;
> +int i, rg_size, delay, padding;
>  
>  /* replace "Xing" identification string with "Info" for CBR files. */
>  if (!mp3->has_variable_bitrate)
> @@ -422,6 +417,17 @@ static void mp3_update_xing(AVFormatContext *s)
>  }
>  }
>  
> +/* write encoder delay/padding */
> +delay = FFMAX(s->streams[0]->codec->initial_padding - 528 - 1, 0);
> +padding = s->streams[0]->codec->trailing_padding;

codecpar.

> +if (delay >= 1 << 12) {
> +av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
> +}
> +if (padding >= 1 << 12) {
> +av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
> +}
> +AV_WB24(mp3->xing_frame + mp3->xing_offset + 141, (delay << 12) + 
> padding);
> +
>  AV_WB32(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 8, 
> mp3->audio_size);
>  AV_WB16(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 4, 
> mp3->audio_crc);
>  
> 

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


Re: [FFmpeg-devel] [PATCH 1/4] ffmpeg: re-copy codec contexts after encoding

2016-09-26 Thread James Almer
On 9/26/2016 2:13 PM, Jon Toohill wrote:
> This preserves changes to fields of AVCodecContext that get
> updated during encoding, such as trailing_padding (which
> may not be known until encoding is complete).
> ---
>  ffmpeg.c | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index df55a49..1e973f5 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -4243,6 +4243,21 @@ static int transcode(void)
>  
>  term_exit();
>  
> +/* update output codec contexts after encoding */
> +for (i = 0; i < nb_output_streams; i++) {
> +ost = output_streams[i];
> +if (ost->encoding_needed) {
> +ret = avcodec_copy_context(
> +
> output_files[ost->file_index]->ctx->streams[ost->index]->codec,
> +ost->enc_ctx);

We ported ffmpeg to codecpar, so AVStream.codec shouldn't be used anymore.

While i can't say if adding this chunk here is a good idea or even correct
to begin with, you should in any case use avcodec_parameters_from_context()
to copy parameters to the output stream's codecpar context.

> +if (ret < 0) {
> +av_log(ost, AV_LOG_ERROR, "Error copying final codec 
> context: %s\n", av_err2str(ret));
> +if (exit_on_error)
> +exit_program(1);
> +}
> +}
> +}
> +
>  /* write the trailer if needed and close file */
>  for (i = 0; i < nb_output_files; i++) {
>  os = output_files[i]->ctx;
> 

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


[FFmpeg-devel] [PATCH 3/4] lavf/mp3enc: write encoder delay/padding upon closing

2016-09-26 Thread Jon Toohill
trailing_padding is not known before encoding.
---
 libavformat/mp3enc.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index de63401..433b070 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -247,12 +247,7 @@ static int mp3_write_xing(AVFormatContext *s)
 ffio_fill(dyn_ctx, 0, 8); // empty replaygain fields
 avio_w8(dyn_ctx, 0);  // unknown encoding flags
 avio_w8(dyn_ctx, 0);  // unknown abr/minimal bitrate
-
-// encoder delay
-if (par->initial_padding - 528 - 1 >= 1 << 12) {
-av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
-}
-avio_wb24(dyn_ctx, FFMAX(par->initial_padding - 528 - 1, 0)<<12);
+avio_wb24(dyn_ctx, 0);// empty encoder delay/padding
 
 avio_w8(dyn_ctx,   0); // misc
 avio_w8(dyn_ctx,   0); // mp3gain
@@ -381,7 +376,7 @@ static void mp3_update_xing(AVFormatContext *s)
 AVReplayGain *rg;
 uint16_t tag_crc;
 uint8_t *toc;
-int i, rg_size;
+int i, rg_size, delay, padding;
 
 /* replace "Xing" identification string with "Info" for CBR files. */
 if (!mp3->has_variable_bitrate)
@@ -422,6 +417,17 @@ static void mp3_update_xing(AVFormatContext *s)
 }
 }
 
+/* write encoder delay/padding */
+delay = FFMAX(s->streams[0]->codec->initial_padding - 528 - 1, 0);
+padding = s->streams[0]->codec->trailing_padding;
+if (delay >= 1 << 12) {
+av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
+}
+if (padding >= 1 << 12) {
+av_log(s, AV_LOG_WARNING, "Too many samples of initial padding.\n");
+}
+AV_WB24(mp3->xing_frame + mp3->xing_offset + 141, (delay << 12) + padding);
+
 AV_WB32(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 8, 
mp3->audio_size);
 AV_WB16(mp3->xing_frame + mp3->xing_offset + XING_SIZE - 4, 
mp3->audio_crc);
 
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 4/4] lavf/mp3dec: read encoder delay/padding from Info tag

2016-09-26 Thread Jon Toohill
---
 libavformat/mp3dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 56c7f8c..9cc85a3 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -239,6 +239,8 @@ static void mp3_parse_info_tag(AVFormatContext *s, AVStream 
*st,
 
 mp3->start_pad = v>>12;
 mp3->  end_pad = v&4095;
+st->codecpar->initial_padding = mp3->start_pad + 528 + 1;
+st->codecpar->trailing_padding = mp3->end_pad;
 st->start_skip_samples = mp3->start_pad + 528 + 1;
 if (mp3->frames) {
 st->first_discard_sample = -mp3->end_pad + 528 + 1 + mp3->frames * 
(int64_t)spf;
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 1/4] ffmpeg: re-copy codec contexts after encoding

2016-09-26 Thread Jon Toohill
This preserves changes to fields of AVCodecContext that get
updated during encoding, such as trailing_padding (which
may not be known until encoding is complete).
---
 ffmpeg.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/ffmpeg.c b/ffmpeg.c
index df55a49..1e973f5 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4243,6 +4243,21 @@ static int transcode(void)
 
 term_exit();
 
+/* update output codec contexts after encoding */
+for (i = 0; i < nb_output_streams; i++) {
+ost = output_streams[i];
+if (ost->encoding_needed) {
+ret = avcodec_copy_context(
+output_files[ost->file_index]->ctx->streams[ost->index]->codec,
+ost->enc_ctx);
+if (ret < 0) {
+av_log(ost, AV_LOG_ERROR, "Error copying final codec context: 
%s\n", av_err2str(ret));
+if (exit_on_error)
+exit_program(1);
+}
+}
+}
+
 /* write the trailer if needed and close file */
 for (i = 0; i < nb_output_files; i++) {
 os = output_files[i]->ctx;
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 2/4] lavc/libmp3lame: set trailing_padding after flushing encoder

2016-09-26 Thread Jon Toohill
---
 libavcodec/libmp3lame.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c
index 5642264..1566921 100644
--- a/libavcodec/libmp3lame.c
+++ b/libavcodec/libmp3lame.c
@@ -218,6 +218,7 @@ static int mp3lame_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 } else {
 lame_result = lame_encode_flush(s->gfp, s->buffer + s->buffer_index,
 s->buffer_size - s->buffer_index);
+avctx->trailing_padding = FFMAX(lame_get_encoder_padding(s->gfp) - 528 
- 1, 0);
 }
 if (lame_result < 0) {
 if (lame_result == -1) {
-- 
2.8.0.rc3.226.g39d4020

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


[FFmpeg-devel] [PATCH 0/4] Handle trailing_padding in MP3 Info tag

2016-09-26 Thread Jon Toohill
Trimming trailing_padding samples from the end of the track is not yet
implemented.

Jon Toohill (4):
  ffmpeg: re-copy codec contexts after encoding
  lavc/libmp3lame: set trailing_padding after flushing encoder
  lavf/mp3enc: write encoder delay/padding upon closing
  lavf/mp3dec: read encoder delay/padding from Info tag

 ffmpeg.c| 15 +++
 libavcodec/libmp3lame.c |  1 +
 libavformat/mp3dec.c|  2 ++
 libavformat/mp3enc.c| 20 +---
 4 files changed, 31 insertions(+), 7 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-26 Thread wm4
On Sun, 25 Sep 2016 19:32:37 +0200
Stefano Sabatini  wrote:

> On date Saturday 2016-09-24 15:21:11 +0200, wm4 encoded:
> > On Fri, 23 Sep 2016 19:46:16 +0200
> > Stefano Sabatini  wrote:
> >   
> > > On date Friday 2016-09-23 09:34:19 +0200, wm4 encoded:  
> > > > On Thu, 22 Sep 2016 18:50:27 +0200
> > > > Stefano Sabatini  wrote:
> > > [...]  
> > > > > Ping. I'd like to commit this if there are no objections. Also,
> > > > > possibly add a muxer to generate output directly readable by the
> > > > > demuxer (this way we don't need ffprobe for generating the output, and
> > > > > we avoid the ordering issue).
> > > > 
> > > > I'm sorry to jump in as a nay-sayer, but it looks like a quite fishy
> > > > concept and I still don't get why it's supposed to be needed. The
> > > > documentation also doesn't say what this is supposed to be useful for.  
> > > >   
> > > 
> > > I'll extend the documentation to add some possibly useful use cases.
> > > 
> > > My use case: I need to build a data stream with scripting/manual
> > > editing. Since I don't want to have to rely on a binary format (which
> > > is not ideal for that use case) I needed a format simple enough to be
> > > written and analysed without special tools, but with a simple text
> > > editor.  
> > 
> > I still don't get it. Your description makes me think of something like
> > EDL, but that doesn't seem to have anything to do with it.  
> 
> EDL as "Edit Decision List"? No I don't think this is related at
> all.
> 
> Suppose you want to inject a data stream, you have the data and you
> know where to insert it given its PTS. With this muxer you can
> handcraft a textual file in the ffprobe_default format and use ffmpeg
> to inject the new data stream.

What's a "data stream"? Inject into what? And why?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [OPW] OPW Project Proposal

2016-09-26 Thread Nicolas George
Le quartidi 4 vendémiaire, an CCXXV, Pallavi Kumari a écrit :
> I want to propose the idea of implementing filters for ffmpeg that would
> give different audio fingerprints for an audio which could be reused by
> other people for variety of applications. Goal of this system is given a
> song as a input, it would spits out similar sounding songs. Some of its
> applications are:
> 
> * detecting duplicate songs
> * retrieving similar songs
> * can be used for recommending songs
> * clustering songs based on content/tags

> Kindly, let me know if the proposed idea sounds interesting and relevant to
> the community. I would be happy to share a rough draft containing details.

I think this could be a very interesting project, but maybe also very hard.
I myself do not have the skills or knowledge to help in any way in that
area.

I think a few fingerprinting algorithms of the kind exist. Implementing them
with ffmpeg's DSP infrastructure would probably be easier than designing one
from scratch.

OTOH, there is one use that I have in mind that may not be covered by
existing algorithms: fingerprinting a short segment of audio to search for
it efficiently and accurately in a larger footage without access to the
original segment, and even if it was subjected to a different lossy codec or
even small changes in pitch or speed. To be honest, I do not know if it is
even possible, but it would be very useful.

Regards,

-- 
  Nicolas George


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


Re: [FFmpeg-devel] [PATCH] avcodec/mpegvideo_enc: fix memory leak

2016-09-26 Thread Timo Rothenpieler
> Will push later today, unless someone has a better idea how to address
> this issue.
> Maybe some way to not use av_frame_copy_props in the first place?

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


[FFmpeg-devel] [PATCH] pass TLS args for RTSPS

2016-09-26 Thread jayridge
From: Jay Ridgeway 

rename URISTR to NONNULLSTR
---
 libavformat/rtsp.c| 19 ---
 libavformat/rtsp.h|  8 
 libavformat/tls_gnutls.c  |  7 +++
 libavformat/tls_openssl.c |  7 +++
 libavformat/tls_schannel.c|  7 +++
 libavformat/tls_securetransport.c |  7 +++
 6 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c6292c5..179a59b 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -78,6 +78,7 @@
 { "reorder_queue_size", "set number of packets to buffer for handling of 
reordered packets", OFFSET(reordering_queue_size), AV_OPT_TYPE_INT, { .i64 = -1 
}, -1, INT_MAX, DEC }, \
 { "buffer_size","Underlying protocol send/receive buffer size",
  OFFSET(buffer_size),   AV_OPT_TYPE_INT, { .i64 = -1 }, 
-1, INT_MAX, DEC|ENC } \
 
+#define NONNULLSTR(s) (s ? s : "")
 
 const AVOption ff_rtsp_options[] = {
 { "initial_pause",  "do not start playing the stream immediately", 
OFFSET(initial_pause), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DEC },
@@ -97,6 +98,10 @@ const AVOption ff_rtsp_options[] = {
 { "stimeout", "set timeout (in microseconds) of socket TCP I/O 
operations", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, 
DEC },
 COMMON_OPTS(),
 { "user-agent", "override User-Agent header", OFFSET(user_agent), 
AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, DEC },
+{ "ca_file", "Certificate Authority database file", OFFSET(ca_file), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC|ENC },
+{ "tls_verify", "Verify the peer certificate", OFFSET(verify), 
AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, DEC|ENC},
+{ "cert_file", "Certificate file", OFFSET(cert_file), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, DEC|ENC },
+{ "key_file", "Private key file", OFFSET(key_file),  AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, DEC|ENC },
 { NULL },
 };
 
@@ -1812,9 +1817,17 @@ redirect:
 } else {
 int ret;
 /* open the tcp connection */
-ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
-host, port,
-"?timeout=%d", rt->stimeout);
+if (strcmp("tls", lower_rtsp_proto) == 0) {
+ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
+host, port,
+
"?timeout=%d=%d=%s_file=%s_file=%s",
+rt->stimeout, rt->verify, NONNULLSTR(rt->ca_file),
+NONNULLSTR(rt->cert_file), NONNULLSTR(rt->key_file));
+} else {
+ff_url_join(tcpname, sizeof(tcpname), lower_rtsp_proto, NULL,
+host, port,
+"?timeout=%d", rt->stimeout);
+}
 if ((ret = ffurl_open_whitelist(>rtsp_hd, tcpname, 
AVIO_FLAG_READ_WRITE,
>interrupt_callback, NULL, s->protocol_whitelist, 
s->protocol_blacklist, NULL)) < 0) {
 err = ret;
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 852fd67..fa872a8 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -408,6 +408,14 @@ typedef struct RTSPState {
 
 char default_lang[4];
 int buffer_size;
+
+/** The following are used for RTSPS streams */
+//@{
+char *ca_file;
+int verify;
+char *cert_file;
+char *key_file;
+//@}
 } RTSPState;
 
 #define RTSP_FLAG_FILTER_SRC  0x1/**< Filter incoming UDP packets -
diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 991b36b..ecc80bf 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -235,6 +235,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, 
int size)
 return print_tls_error(h, ret);
 }
 
+static int tls_get_file_handle(URLContext *h)
+{
+TLSContext *c = h->priv_data;
+return ffurl_get_file_handle(c->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
 TLS_COMMON_OPTIONS(TLSContext, tls_shared),
 { NULL }
@@ -253,6 +259,7 @@ const URLProtocol ff_tls_gnutls_protocol = {
 .url_read   = tls_read,
 .url_write  = tls_write,
 .url_close  = tls_close,
+.url_get_file_handle = tls_get_file_handle,
 .priv_data_size = sizeof(TLSContext),
 .flags  = URL_PROTOCOL_FLAG_NETWORK,
 .priv_data_class = _class,
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 46eb3e6..1455392 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -283,6 +283,12 @@ static int tls_write(URLContext *h, const uint8_t *buf, 
int size)
 return print_tls_error(h, ret);
 }
 
+static int tls_get_file_handle(URLContext *h)
+{
+TLSContext *c = h->priv_data;
+return ffurl_get_file_handle(c->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
 TLS_COMMON_OPTIONS(TLSContext, tls_shared),
 { NULL }
@@ -301,6 +307,7 @@ const URLProtocol 

Re: [FFmpeg-devel] [PATCH] avformat/concatdec: don't call open_file when seek position within a file

2016-09-26 Thread Nicolas George
Le quintidi 5 vendémiaire, an CCXXV, raymond zheng a écrit :
> ping...

Sorry for the delay, I forgot yesterday. It looks nice at first glance, but
I will need a little more time for testing.

Regards,

-- 
  Nicolas George


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


[FFmpeg-devel] [PATCH]lavf/riffenc: Always write unexpected channel_mask

2016-09-26 Thread Carl Eugen Hoyos
Hi!

Attached patch allows to write arbitrary (mono) channel_masks 
even for 16bit 48kHz pcm audio.

Please comment, Carl Eugen
From de791edddeb16aadaa28f7ab53f1f60a9874 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 26 Sep 2016 12:36:54 +0200
Subject: [PATCH] lavf/riffenc: Always write unexpected channel_mask.

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

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 36e6ac7..8ff7923 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -71,6 +71,8 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
 frame_size = av_get_audio_frame_duration2(par, par->block_align);
 
 waveformatextensible = (par->channels > 2 && par->channel_layout) ||
+   par->channels == 1 && par->channel_layout && 
par->channel_layout != AV_CH_LAYOUT_MONO ||
+   par->channels == 2 && par->channel_layout && 
par->channel_layout != AV_CH_LAYOUT_STEREO ||
par->sample_rate > 48000 ||
par->codec_id == AV_CODEC_ID_EAC3 ||
av_get_bits_per_sample(par->codec_id) > 16;
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH] avcodec/mpegvideo_enc: fix memory leak

2016-09-26 Thread Timo Rothenpieler
> When the input frames contain side data, it will accumulate endlessly in
> the coded frame, as av_frame_copy_props will append any new side data.
> ---
>  libavcodec/mpegvideo_enc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 87d7954..5cd654f 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1735,6 +1735,7 @@ static void frame_end(MpegEncContext *s)
>  
>  #if FF_API_CODED_FRAME
>  FF_DISABLE_DEPRECATION_WARNINGS
> +av_frame_unref(s->avctx->coded_frame);
>  av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
>  FF_ENABLE_DEPRECATION_WARNINGS
>  #endif
> 

Will push later today, unless someone has a better idea how to address
this issue.
Maybe some way to not use av_frame_copy_props in the first place?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/concatdec: don't call open_file when seek position within a file

2016-09-26 Thread raymond zheng
ping...

2016-09-23 11:48 GMT+08:00 raymondzheng1...@gmail.com <
raymondzheng1...@gmail.com>:

> Thanks for your suggest, I have modified patch. see below.
> ---
>  libavformat/concatdec.c | 24 +---
>  1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index b3a430e..5cc239a 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -689,7 +689,7 @@ static int try_seek(AVFormatContext *avf, int stream,
>  }
>
>  static int real_seek(AVFormatContext *avf, int stream,
> - int64_t min_ts, int64_t ts, int64_t max_ts, int
> flags)
> + int64_t min_ts, int64_t ts, int64_t max_ts, int
> flags, AVFormatContext *cur_avf)
>  {
>  ConcatContext *cat = avf->priv_data;
>  int ret, left, right;
> @@ -711,13 +711,19 @@ static int real_seek(AVFormatContext *avf, int
> stream,
>  left  = mid;
>  }
>
> -if ((ret = open_file(avf, left)) < 0)
> -return ret;
> +if (cat->cur_file != >files[left]) {
> +if ((ret = open_file(avf, left)) < 0)
> +return ret;
> +} else {
> +cat->avf = cur_avf;
> +}
>
>  ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
>  if (ret < 0 &&
>  left < cat->nb_files - 1 &&
>  cat->files[left + 1].start_time < max_ts) {
> +if (cat->cur_file == >files[left])
> +cat->avf = NULL;
>  if ((ret = open_file(avf, left + 1)) < 0)
>  return ret;
>  ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
> @@ -738,13 +744,17 @@ static int concat_seek(AVFormatContext *avf, int
> stream,
>  if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
>  return AVERROR(ENOSYS);
>  cat->avf = NULL;
> -if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
> -if (cat->avf)
> -avformat_close_input(>avf);
> +if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags,
> cur_avf_saved)) < 0) {
> +if (cat->cur_file != cur_file_saved) {
> +if (cat->avf)
> +avformat_close_input(>avf);
> +}
>  cat->avf  = cur_avf_saved;
>  cat->cur_file = cur_file_saved;
>  } else {
> -avformat_close_input(_avf_saved);
> +if (cat->cur_file != cur_file_saved) {
> +avformat_close_input(_avf_saved);
> +}
>  cat->eof = 0;
>  }
>  return ret;
> --
> 2.7.4
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: support mkdir_p for use_localtime_mkdir

2016-09-26 Thread Steven Liu



0001-avformat-hlsenc-support-mkdir_p-for-use_localtime_mk.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] doc/muxers: fix error for hlsenc exmpales

2016-09-26 Thread Steven Liu



0002-doc-muxers-fix-error-for-hlsenc-exmpales.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/2] lavf/mxfdec: add support for all of the picture size and offset fields

2016-09-26 Thread Carl Eugen Hoyos
2016-09-26 8:42 GMT+02:00 Jan Ekstrom :
> On Sep 26, 2016 09:29, "Carl Eugen Hoyos"  wrote:
>>
>> 2016-09-26 1:52 GMT+02:00 Jan Ekström :
>>
>> If this fixes anything (I am not sure I understand: Are you changing a
>> type which introduces a possible undefined behaviour, so you add an
>> additional check at the same time?) it should be part of above new
>> patch imo (or an independent patch).
>
> The specification notes that width and height are uint32 in MXF. Thus the
> old type of "int" was incorrect. The width and height of codecpar are "int"
> so by fixing the type it can overflow (you'd get negative values), and thus
> have to be capped.
>
> The old code would have had thus an overflow happen naturally in the
> case of a large enough unsigned integer as the value would have been
> read into an int.

I thought no overflow happens in that case but it does not really matter:
FFmpeg ignores even 16bit width / height (for msb set).

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


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Allow to disable writing the timecode track

2016-09-26 Thread Carl Eugen Hoyos
2016-09-25 21:47 GMT+02:00 Clément Bœsch :

>> +{ "write_tmcd", "force or disable writing tmcd", 
>> offsetof(MOVMuxContext, write_tmcd), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, 
>> AV_OPT_FLAG_ENCODING_PARAM},
>
> AV_OPT_TYPE_BOOL

Applied with that change.

[...]

> Didn't test nor looked in depth, but OK if it disable timecode in
> MP4 by default. Timecode is only (badly) "standardized" in MOV,
> so we shouldn't write such track in MP4.

Independent patch sent, this changes (requested) behaviour.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf/movenc: Only write timecode track for mov by default

2016-09-26 Thread Carl Eugen Hoyos
Hi!

As requested by Clément, no opinion here.

Please comment, Carl Eugen
From 233aaff6511c3b105a7ac2dad2d55d03455df153 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 26 Sep 2016 08:52:36 +0200
Subject: [PATCH] lavf/movenc: Only write timecode track for mov by default.

---
 Changelog|1 +
 doc/muxers.texi  |2 +-
 libavformat/movenc.c |2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 4e4b4bf..7e99767 100644
--- a/Changelog
+++ b/Changelog
@@ -35,6 +35,7 @@ version :
 - sdl2 output device
 - sdl2 support for ffplay
 - sdl1 output device and sdl1 support removed
+- Write timecode track only for mov output by default
 
 
 version 3.1:
diff --git a/doc/muxers.texi b/doc/muxers.texi
index c8a056f..87dccf5 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -886,7 +886,7 @@ circumstances (avoiding basing track fragment location 
calculations
 on the implicit end of the previous track fragment).
 @item -write_tmcd
 Specify @code{on} to force writing a timecode track, @code{off} to disable it
-and @code{auto} to write a timecode track only for mov and mp4 output 
(default).
+and @code{auto} to write a timecode track only for mov output (default).
 @end table
 
 @subsection Example
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 449d0b5..83840a6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5540,7 +5540,7 @@ static int mov_write_header(AVFormatContext *s)
 }
 }
 
-if (   mov->write_tmcd == -1 && (mov->mode == MODE_MOV || mov->mode == 
MODE_MP4)
+if (   mov->write_tmcd == -1 && mov->mode == MODE_MOV
 || mov->write_tmcd == 1) {
 tmcd_track = mov->nb_streams;
 
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/mxfdec: add support for all of the picture size and offset fields

2016-09-26 Thread Jan Ekstrom
On Sep 26, 2016 09:29, "Carl Eugen Hoyos"  wrote:
>
> 2016-09-26 1:52 GMT+02:00 Jan Ekström :
>
> If this fixes anything (I am not sure I understand: Are you changing a
> type which introduces a possible undefined behaviour, so you add an
> additional check at the same time?) it should be part of above new
> patch imo (or an independent patch).
>

The specification notes that width and height are uint32 in MXF. Thus the
old type of "int" was incorrect. The width and height of codecpar are "int"
so by fixing the type it can overflow (you'd get negative values), and thus
have to be capped.

The old code would have had thus an overflow happen naturally in the case
of a large enough unsigned integer as the value would have been read into
an int.

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


Re: [FFmpeg-devel] [PATCH 1/2] lavf/mxfdec: add support for all of the picture size and offset fields

2016-09-26 Thread Carl Eugen Hoyos
2016-09-26 1:52 GMT+02:00 Jan Ekström :
> * Renames the `width` and `height` entries to `stored_{width,height}`
>   according to the specification's naming.

This should be a separate patch. (Although I wonder how useful it is:
Are you planning to add yourself as mxf maintainer? This would be
very welcome.)

> * Switches the data type of widths and heights to uint32_t according
>   to specification, adds additional checks to make sure we don't
>   overflow INT_MAX as codecpar->{width,height} are signed integers.

If this fixes anything (I am not sure I understand: Are you changing a
type which introduces a possible undefined behaviour, so you add an
additional check at the same time?) it should be part of above new
patch imo (or an independent patch).

> * Adds and parses the sampled and display width and height entries.

The rest should be added together with the side data injection.

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


Re: [FFmpeg-devel] [PATCH]lavf/utils: Do not overflow in update_initial_timestamps().

2016-09-26 Thread Carl Eugen Hoyos
2016-09-25 23:55 GMT+02:00 Michael Niedermayer :

>> > probably ok
>> > it might be ultimately easier to reject demuxer output that has
>> > timestamps close to INT64 MAX/MIN instead of protecting all
>> > computations one by one though
>>
>> I don't disagree but I am probably unable to improve the patch.
>> Do you want me to apply?
>
> ive posted an alternative

Looks much simpler, thank you!

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