[FFmpeg-devel] [PATCH] aacenc: quit when the audio queue reaches 0 rather than keeping track of empty frames

2016-11-06 Thread Rostislav Pehlivanov
The libopus encoder does the same thing and its better than
keeping track of when the empty flush frames appear.

Signed-off-by: Rostislav Pehlivanov 
---
 libavcodec/aacenc.c | 9 +++--
 libavcodec/aacenc.h | 1 -
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 363ed05..956e974 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -520,13 +520,13 @@ static int aac_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 int chan_el_counter[4];
 FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
 
-if (s->last_frame == 2)
-return 0;
-
 /* add current frame to queue */
 if (frame) {
 if ((ret = ff_af_queue_add(>afq, frame)) < 0)
 return ret;
+} else {
+if (!s->afq.remaining_samples || (!s->afq.frame_alloc && 
!s->afq.frame_count))
+return 0;
 }
 
 copy_input_samples(s, frame);
@@ -841,9 +841,6 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 s->lambda_sum += s->lambda;
 s->lambda_count++;
 
-if (!frame)
-s->last_frame++;
-
 ff_af_queue_remove(>afq, avctx->frame_size, >pts,
>duration);
 
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 38a9734..9d244fd 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -112,7 +112,6 @@ typedef struct AACEncContext {
 struct FFPsyPreprocessContext* psypp;
 AACCoefficientsEncoder *coder;
 int cur_channel; ///< current channel for 
coder context
-int last_frame;
 int random_state;
 float lambda;
 int last_frame_pb_count; ///< number of bits for the 
previous frame
-- 
2.10.2

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


[FFmpeg-devel] [PATCH] mpegaudio_parser: don't return AVERROR_PATCHWELCOME

2016-11-06 Thread Andreas Cadhalpun
The API does not allow returning AVERROR codes.

It triggers an assert in av_parser_parse2.

Signed-off-by: Andreas Cadhalpun 
---
 libavcodec/mpegaudio_parser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 873f941..8c39825 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -98,7 +98,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 } else if (codec_id == AV_CODEC_ID_MP3ADU) {
 avpriv_report_missing_feature(avctx,
 "MP3ADU full parser");
-return AVERROR_PATCHWELCOME;
+return 0; /* parsers must not return error codes */
 }
 
 break;
-- 
2.10.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 01/12] adxdec: validate sample_rate

2016-11-06 Thread Andreas Cadhalpun
On 02.11.2016 23:09, Andreas Cadhalpun wrote:
> In the absence of further comments, I intend to push this set in a few days.

I've pushed this now.

Best regards,
Andreas

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


[FFmpeg-devel] [PATCH] hls: fix leaking avio_opts on hls_read_header error

2016-11-06 Thread Andreas Cadhalpun
Use the hls_close function to reduce code duplication.

Signed-off-by: Andreas Cadhalpun 
---
 libavformat/hls.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 2bf86fa..3ae3c7c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1593,6 +1593,19 @@ static void update_noheader_flag(AVFormatContext *s)
 s->ctx_flags &= ~AVFMTCTX_NOHEADER;
 }
 
+static int hls_close(AVFormatContext *s)
+{
+HLSContext *c = s->priv_data;
+
+free_playlist_list(c);
+free_variant_list(c);
+free_rendition_list(c);
+
+av_dict_free(>avio_opts);
+
+return 0;
+}
+
 static int hls_read_header(AVFormatContext *s)
 {
 void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb;
@@ -1794,9 +1807,7 @@ static int hls_read_header(AVFormatContext *s)
 
 return 0;
 fail:
-free_playlist_list(c);
-free_variant_list(c);
-free_rendition_list(c);
+hls_close(s);
 return ret;
 }
 
@@ -2013,19 +2024,6 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return AVERROR_EOF;
 }
 
-static int hls_close(AVFormatContext *s)
-{
-HLSContext *c = s->priv_data;
-
-free_playlist_list(c);
-free_variant_list(c);
-free_rendition_list(c);
-
-av_dict_free(>avio_opts);
-
-return 0;
-}
-
 static int hls_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
 {
-- 
2.10.2
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3 v2] avformat/hls: Add missing error check for avcodec_parameters_copy()

2016-11-06 Thread Andreas Cadhalpun
On 06.11.2016 23:52, Anssi Hannula wrote:
> Signed-off-by: Anssi Hannula 
> ---
> 
> 07.11.2016, 00:35, Andreas Cadhalpun kirjoitti:
>> On 06.11.2016 22:44, Anssi Hannula wrote:
>>> Signed-off-by: Anssi Hannula 
>>> ---
>>>  libavformat/hls.c | 18 ++
>>>  1 file changed, 14 insertions(+), 4 deletions(-)
>>>
>>
>> This misses checking the return code of the other occurrence of
>> set_stream_info_from_input_stream in hls_read_packet.
> 
> Argh, true. Here's a new one.
> 
> 
>  libavformat/hls.c | 27 +--
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 

LGTM.

Best regards,
Andreas

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


[FFmpeg-devel] [PATCH 3/3 v2] avformat/hls: Add missing error check for avcodec_parameters_copy()

2016-11-06 Thread Anssi Hannula
Signed-off-by: Anssi Hannula 
---

07.11.2016, 00:35, Andreas Cadhalpun kirjoitti:
> On 06.11.2016 22:44, Anssi Hannula wrote:
>> Signed-off-by: Anssi Hannula 
>> ---
>>  libavformat/hls.c | 18 ++
>>  1 file changed, 14 insertions(+), 4 deletions(-)
>>
> 
> This misses checking the return code of the other occurrence of
> set_stream_info_from_input_stream in hls_read_packet.

Argh, true. Here's a new one.


 libavformat/hls.c | 27 +--
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ce52bf5..2bf86fa 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1528,9 +1528,13 @@ static void add_stream_to_programs(AVFormatContext *s, 
struct playlist *pls, AVS
 av_dict_set_int(>metadata, "variant_bitrate", bandwidth, 0);
 }
 
-static void set_stream_info_from_input_stream(AVStream *st, struct playlist 
*pls, AVStream *ist)
+static int set_stream_info_from_input_stream(AVStream *st, struct playlist 
*pls, AVStream *ist)
 {
-avcodec_parameters_copy(st->codecpar, ist->codecpar);
+int err;
+
+err = avcodec_parameters_copy(st->codecpar, ist->codecpar);
+if (err < 0)
+return err;
 
 if (pls->is_id3_timestamped) /* custom timestamps via id3 */
 avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
@@ -1538,11 +1542,15 @@ static void set_stream_info_from_input_stream(AVStream 
*st, struct playlist *pls
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
 
 st->internal->need_context_update = 1;
+
+return 0;
 }
 
 /* add new subdemuxer streams to our context, if any */
 static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist 
*pls)
 {
+int err;
+
 while (pls->n_main_streams < pls->ctx->nb_streams) {
 int ist_idx = pls->n_main_streams;
 AVStream *st = avformat_new_stream(s, NULL);
@@ -1552,11 +1560,13 @@ static int 
update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *p
 return AVERROR(ENOMEM);
 
 st->id = pls->index;
-set_stream_info_from_input_stream(st, pls, ist);
-
 dynarray_add(>main_streams, >n_main_streams, st);
 
 add_stream_to_programs(s, pls, st);
+
+err = set_stream_info_from_input_stream(st, pls, ist);
+if (err < 0)
+return err;
 }
 
 return 0;
@@ -1990,8 +2000,13 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 /* There may be more situations where this would be useful, but this 
at least
  * handles newly probed codecs properly (i.e. request_probe by 
mpegts). */
-if (ist->codecpar->codec_id != st->codecpar->codec_id)
-set_stream_info_from_input_stream(st, pls, ist);
+if (ist->codecpar->codec_id != st->codecpar->codec_id) {
+ret = set_stream_info_from_input_stream(st, pls, ist);
+if (ret < 0) {
+av_packet_unref(pkt);
+return ret;
+}
+}
 
 return 0;
 }
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH 3/3] avformat/hls: Add missing error check for avcodec_parameters_copy()

2016-11-06 Thread Andreas Cadhalpun
On 06.11.2016 22:44, Anssi Hannula wrote:
> Signed-off-by: Anssi Hannula 
> ---
>  libavformat/hls.c | 18 ++
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 

This misses checking the return code of the other occurrence of
set_stream_info_from_input_stream in hls_read_packet.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH 2/3 v2] avformat/hls: Fix probing mpegts audio streams that use probing

2016-11-06 Thread Andreas Cadhalpun
On 06.11.2016 22:44, Anssi Hannula wrote:
> Commit 04964ac311abe670f ("avformat/hls: Fix missing streams in some
> cases with MPEG TS") caused a regression where subdemuxer streams that
> use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly.
> 
> This is because the codec parameters from the subdemuxer stream, once
> probed, are not passed on to the main stream.
> 
> Fix that by updating the codec parameters if the codec id changes.
> 
> Signed-off-by: Anssi Hannula 
> ---
> 
> v2: Added need_context_update = 1 and shortened the av_rescale_q() call to use
> the new ist pointer.
> 
>  libavformat/hls.c | 16 ++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 6fb652c..ce52bf5 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1536,6 +1536,8 @@ static void set_stream_info_from_input_stream(AVStream 
> *st, struct playlist *pls
>  avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
>  else
>  avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
> ist->time_base.den);
> +
> +st->internal->need_context_update = 1;
>  }
>  
>  /* add new subdemuxer streams to our context, if any */
> @@ -1950,6 +1952,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
> *pkt)
>  /* If we got a packet, return it */
>  if (minplaylist >= 0) {
>  struct playlist *pls = c->playlists[minplaylist];
> +AVStream *ist;
> +AVStream *st;
>  
>  ret = update_streams_from_subdemuxer(s, pls);
>  if (ret < 0) {
> @@ -1972,15 +1976,23 @@ static int hls_read_packet(AVFormatContext *s, 
> AVPacket *pkt)
>  return AVERROR_BUG;
>  }
>  
> +ist = pls->ctx->streams[pls->pkt.stream_index];
> +st = pls->main_streams[pls->pkt.stream_index];
> +
>  *pkt = pls->pkt;
> -pkt->stream_index = pls->main_streams[pls->pkt.stream_index]->index;
> +pkt->stream_index = st->index;
>  reset_packet(>playlists[minplaylist]->pkt);
>  
>  if (pkt->dts != AV_NOPTS_VALUE)
>  c->cur_timestamp = av_rescale_q(pkt->dts,
> -
> pls->ctx->streams[pls->pkt.stream_index]->time_base,
> +ist->time_base,
>  AV_TIME_BASE_Q);
>  
> +/* There may be more situations where this would be useful, but this 
> at least
> + * handles newly probed codecs properly (i.e. request_probe by 
> mpegts). */
> +if (ist->codecpar->codec_id != st->codecpar->codec_id)
> +set_stream_info_from_input_stream(st, pls, ist);
> +
>  return 0;
>  }
>  return AVERROR_EOF;
> 

Works fine, thanks!

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


Re: [FFmpeg-devel] [PATCH 1/3] avformat/hls: Factor copying stream info to a separate function

2016-11-06 Thread Andreas Cadhalpun
On 06.11.2016 22:44, Anssi Hannula wrote:
> Signed-off-by: Anssi Hannula 
> ---
> 
>  libavformat/hls.c | 18 +++---
>  1 file changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 3c09dd8..6fb652c 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1528,6 +1528,16 @@ static void add_stream_to_programs(AVFormatContext *s, 
> struct playlist *pls, AVS
>  av_dict_set_int(>metadata, "variant_bitrate", bandwidth, 0);
>  }
>  
> +static void set_stream_info_from_input_stream(AVStream *st, struct playlist 
> *pls, AVStream *ist)
> +{
> +avcodec_parameters_copy(st->codecpar, ist->codecpar);
> +
> +if (pls->is_id3_timestamped) /* custom timestamps via id3 */
> +avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
> +else
> +avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
> ist->time_base.den);
> +}
> +
>  /* add new subdemuxer streams to our context, if any */
>  static int update_streams_from_subdemuxer(AVFormatContext *s, struct 
> playlist *pls)
>  {
> @@ -1540,13 +1550,7 @@ static int 
> update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *p
>  return AVERROR(ENOMEM);
>  
>  st->id = pls->index;
> -
> -avcodec_parameters_copy(st->codecpar, ist->codecpar);
> -
> -if (pls->is_id3_timestamped) /* custom timestamps via id3 */
> -avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
> -else
> -avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
> ist->time_base.den);
> +set_stream_info_from_input_stream(st, pls, ist);
>  
>  dynarray_add(>main_streams, >n_main_streams, st);
>  
> 

OK.

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


Re: [FFmpeg-devel] [PATCH] avformat: Allow forcing use of AVParsers

2016-11-06 Thread Hendrik Leppkes
On Sun, Nov 6, 2016 at 9:16 PM, Michael Niedermayer
 wrote:
> TODO: version bump, docs
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/avformat.h  | 8 
>  libavformat/options_table.h | 7 +++
>  libavformat/utils.c | 3 +++
>  3 files changed, 18 insertions(+)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index f9f4d72..96e6b94 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1899,6 +1899,14 @@ typedef struct AVFormatContext {
>   * - decoding: set by user through AVOptions (NO direct access)
>   */
>  char *protocol_blacklist;
> +
> +/**
> + * Force parsing.
> + * - encoding: unused
> + * - decoding: set by user through AVOptions (NO direct access)
> + */
> +int force_parsing;
> +

Might be a good idea to document  that this takes the same values as
st->need_parsing (ie. AVSTREAM_PARSE_* constants), otherwise its
really not obvious when using the API - only in the AVOptions.

>  } AVFormatContext;
>
>  int av_format_get_probe_score(const AVFormatContext *s);
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 9d61d5a..50ea3c1 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -105,6 +105,13 @@ static const AVOption avformat_options[] = {
>  {"format_whitelist", "List of demuxers that are allowed to be used", 
> OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
> CHAR_MAX, D },
>  {"protocol_whitelist", "List of protocols that are allowed to be used", 
> OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
> CHAR_MAX, D },
>  {"protocol_blacklist", "List of protocols that are not allowed to be used", 
> OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
> CHAR_MAX, D },
> +{"forceparsing", "force use of AVParsers", OFFSET(force_parsing), 
> AV_OPT_TYPE_INT, { .i64 = -1 },  -1, AVSTREAM_PARSE_FULL_ONCE, D, 
> "forceparsing"},
> +{"none",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_NONE 
>   }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"full",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL 
>   }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"headers", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_HEADERS  
>   }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"timestamps",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AVSTREAM_PARSE_TIMESTAMPS }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"once",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 
> AVSTREAM_PARSE_FULL_ONCE  }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"raw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL_RAW 
>   }, INT_MIN, INT_MAX, D, "forceparsing" },
>  {NULL},
>  };
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5664646..23e063f 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4264,6 +4264,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
>   * timestamps have their first few packets buffered and the
>   * timestamps corrected before they are returned to the user */
>  st->cur_dts = RELATIVE_TS_BASE;
> +
> +if (s->force_parsing >= 0)
> +st->need_parsing = s->force_parsing;
>  } else {
>  st->cur_dts = AV_NOPTS_VALUE;
>  }
> --
> 2.10.2
>
> ___
> 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] avfilter/vf_drawtext: fixed default/flt formatting ignoring offset parameter

2016-11-06 Thread Michael Niedermayer
On Mon, Sep 26, 2016 at 04:36:01PM -0400, Alexander Agranovsky wrote:
> 

>  vf_drawtext.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> c20a7bcfcac020dda3970d547556227e2a19e822  
> 0001-avfilter-vf_drawtext-fixed-default-flt-formatting-ig.patch
> 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 

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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] avformat/hls: Fix probing mpegts audio streams that use probing

2016-11-06 Thread Anssi Hannula
05.11.2016, 19:51, Andreas Cadhalpun kirjoitti:
> On 05.11.2016 18:47, Andreas Cadhalpun wrote:
>> On 05.11.2016 17:39, Anssi Hannula wrote:
>>> @@ -1981,6 +1986,11 @@ static int hls_read_packet(AVFormatContext *s, 
>>> AVPacket *pkt)
>>>  
>>> pls->ctx->streams[pls->pkt.stream_index]->time_base,
>>>  AV_TIME_BASE_Q);
>>>  
>>> +/* There may be more situations where this would be useful, but 
>>> this at least
>>> + * handles newly probed codecs properly (i.e. request_probe by 
>>> mpegts). */
>>> +if (ist->codecpar->codec_id != st->codecpar->codec_id)
>>> +set_stream_info_from_input_stream(st, pls, ist);
>>
>> This has to set:
>> ist->internal->need_context_update = 1;
>   ^
> Should have been 'st' not 'ist'.

Thanks for the comments, followup is a new set with
need_context_update = 1 added to set_stream_info_from_input_stream() and
an additional patch to add error checks for the use of
avcodec_parameters_copy().


Anssi Hannula (3):
  avformat/hls: Factor copying stream info to a separate function
  avformat/hls: Fix probing mpegts audio streams that use probing
  avformat/hls: Add missing error check for avcodec_parameters_copy()

-- 
Anssi Hannula

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


[FFmpeg-devel] [PATCH 1/3] avformat/hls: Factor copying stream info to a separate function

2016-11-06 Thread Anssi Hannula
Signed-off-by: Anssi Hannula 
---

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

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c09dd8..6fb652c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1528,6 +1528,16 @@ static void add_stream_to_programs(AVFormatContext *s, 
struct playlist *pls, AVS
 av_dict_set_int(>metadata, "variant_bitrate", bandwidth, 0);
 }
 
+static void set_stream_info_from_input_stream(AVStream *st, struct playlist 
*pls, AVStream *ist)
+{
+avcodec_parameters_copy(st->codecpar, ist->codecpar);
+
+if (pls->is_id3_timestamped) /* custom timestamps via id3 */
+avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
+else
+avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
+}
+
 /* add new subdemuxer streams to our context, if any */
 static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist 
*pls)
 {
@@ -1540,13 +1550,7 @@ static int 
update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *p
 return AVERROR(ENOMEM);
 
 st->id = pls->index;
-
-avcodec_parameters_copy(st->codecpar, ist->codecpar);
-
-if (pls->is_id3_timestamped) /* custom timestamps via id3 */
-avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
-else
-avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
+set_stream_info_from_input_stream(st, pls, ist);
 
 dynarray_add(>main_streams, >n_main_streams, st);
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 3/3] avformat/hls: Add missing error check for avcodec_parameters_copy()

2016-11-06 Thread Anssi Hannula
Signed-off-by: Anssi Hannula 
---
 libavformat/hls.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ce52bf5..a744908 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1528,9 +1528,13 @@ static void add_stream_to_programs(AVFormatContext *s, 
struct playlist *pls, AVS
 av_dict_set_int(>metadata, "variant_bitrate", bandwidth, 0);
 }
 
-static void set_stream_info_from_input_stream(AVStream *st, struct playlist 
*pls, AVStream *ist)
+static int set_stream_info_from_input_stream(AVStream *st, struct playlist 
*pls, AVStream *ist)
 {
-avcodec_parameters_copy(st->codecpar, ist->codecpar);
+int err;
+
+err = avcodec_parameters_copy(st->codecpar, ist->codecpar);
+if (err)
+return err;
 
 if (pls->is_id3_timestamped) /* custom timestamps via id3 */
 avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
@@ -1538,11 +1542,15 @@ static void set_stream_info_from_input_stream(AVStream 
*st, struct playlist *pls
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
 
 st->internal->need_context_update = 1;
+
+return 0;
 }
 
 /* add new subdemuxer streams to our context, if any */
 static int update_streams_from_subdemuxer(AVFormatContext *s, struct playlist 
*pls)
 {
+int err;
+
 while (pls->n_main_streams < pls->ctx->nb_streams) {
 int ist_idx = pls->n_main_streams;
 AVStream *st = avformat_new_stream(s, NULL);
@@ -1552,11 +1560,13 @@ static int 
update_streams_from_subdemuxer(AVFormatContext *s, struct playlist *p
 return AVERROR(ENOMEM);
 
 st->id = pls->index;
-set_stream_info_from_input_stream(st, pls, ist);
-
 dynarray_add(>main_streams, >n_main_streams, st);
 
 add_stream_to_programs(s, pls, st);
+
+err = set_stream_info_from_input_stream(st, pls, ist);
+if (err)
+return err;
 }
 
 return 0;
-- 
2.7.4

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


[FFmpeg-devel] [PATCH 2/3 v2] avformat/hls: Fix probing mpegts audio streams that use probing

2016-11-06 Thread Anssi Hannula
Commit 04964ac311abe670f ("avformat/hls: Fix missing streams in some
cases with MPEG TS") caused a regression where subdemuxer streams that
use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly.

This is because the codec parameters from the subdemuxer stream, once
probed, are not passed on to the main stream.

Fix that by updating the codec parameters if the codec id changes.

Signed-off-by: Anssi Hannula 
---

v2: Added need_context_update = 1 and shortened the av_rescale_q() call to use
the new ist pointer.

 libavformat/hls.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 6fb652c..ce52bf5 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1536,6 +1536,8 @@ static void set_stream_info_from_input_stream(AVStream 
*st, struct playlist *pls
 avpriv_set_pts_info(st, 33, 1, MPEG_TIME_BASE);
 else
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
+
+st->internal->need_context_update = 1;
 }
 
 /* add new subdemuxer streams to our context, if any */
@@ -1950,6 +1952,8 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 /* If we got a packet, return it */
 if (minplaylist >= 0) {
 struct playlist *pls = c->playlists[minplaylist];
+AVStream *ist;
+AVStream *st;
 
 ret = update_streams_from_subdemuxer(s, pls);
 if (ret < 0) {
@@ -1972,15 +1976,23 @@ static int hls_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 return AVERROR_BUG;
 }
 
+ist = pls->ctx->streams[pls->pkt.stream_index];
+st = pls->main_streams[pls->pkt.stream_index];
+
 *pkt = pls->pkt;
-pkt->stream_index = pls->main_streams[pls->pkt.stream_index]->index;
+pkt->stream_index = st->index;
 reset_packet(>playlists[minplaylist]->pkt);
 
 if (pkt->dts != AV_NOPTS_VALUE)
 c->cur_timestamp = av_rescale_q(pkt->dts,
-
pls->ctx->streams[pls->pkt.stream_index]->time_base,
+ist->time_base,
 AV_TIME_BASE_Q);
 
+/* There may be more situations where this would be useful, but this 
at least
+ * handles newly probed codecs properly (i.e. request_probe by 
mpegts). */
+if (ist->codecpar->codec_id != st->codecpar->codec_id)
+set_stream_info_from_input_stream(st, pls, ist);
+
 return 0;
 }
 return AVERROR_EOF;
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH] flv format support mp3 audio with 48khz

2016-11-06 Thread Michael Niedermayer
On Wed, Sep 28, 2016 at 05:26:35PM +0200, wm4 wrote:
> On Wed, 28 Sep 2016 07:47:47 -0700
> fuqiuping  wrote:
> 
> > ---
> >  libavformat/flvenc.c |8 
> >  1 files changed, 8 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
> > index 99903f5..296426a 100644
> > --- a/libavformat/flvenc.c
> > +++ b/libavformat/flvenc.c
> > @@ -107,6 +107,13 @@ static int get_audio_flags(AVFormatContext *s, 
> > AVCodecParameters *par)
> >  return FLV_CODECID_SPEEX | FLV_SAMPLERATE_11025HZ | 
> > FLV_SAMPLESSIZE_16BIT;
> >  } else {
> >  switch (par->sample_rate) {
> > +case 48000:
> > +if (par->codec_id == AV_CODEC_ID_MP3) {
> > +flags |= FLV_SAMPLERATE_44100HZ;
> 
> This looks wrong. It should have a code comment why it's right, even
> though it 'll look wrong to every single person who look at tit for the
> first time.

added comment
applied

thx

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

There will always be a question for which you do not know the correct answer.


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


Re: [FFmpeg-devel] [PATCH] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

2016-11-06 Thread Michael Niedermayer
On Sun, Nov 06, 2016 at 09:31:09AM -0800, Dave Yeo wrote:
> On 11/06/16 04:34 AM, Michael Niedermayer wrote:
> >>src/libavformat/tcp.c: In function 'tcp_open':
> >>>src/libavformat/tcp.c:128:25: error: dereferencing pointer to
> >>>incomplete type
> >>>  if (!sockaddr_v6->sin6_port){
> >>>  ^
> >>>src/libavformat/tcp.c:129:24: error: dereferencing pointer to
> >>>incomplete type
> >>>  sockaddr_v6->sin6_port = htons(port);
> >>> ^
> >>>make: *** [libavformat/tcp.o] Error 1
> >>>make: *** Waiting for unfinished jobs
> >does this fix it: ?
> >
> >diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> >index fd10a56..25abafc 100644
> >--- a/libavformat/tcp.c
> >+++ b/libavformat/tcp.c
> >@@ -122,6 +122,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
> >flags)
> >  cur_ai = ai;
> >
> >   restart:
> >+#if HAVE_STRUCT_SOCKADDR_IN6
> >  // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode 
> > IPv4 address can not resolve port number.
> >  if (cur_ai->ai_family == AF_INET6){
> >  struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
> > *)cur_ai->ai_addr;
> >@@ -129,6 +130,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
> >flags)
> >  sockaddr_v6->sin6_port = htons(port);
> >  }
> >  }
> >+#endif
> >
> >  fd = ff_socket(cur_ai->ai_family,
> > cur_ai->ai_socktype,
> 
> Yes, that seems to fix it.

applied

thanks

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

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


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


[FFmpeg-devel] [PATCH] avformat: Allow forcing use of AVParsers

2016-11-06 Thread Michael Niedermayer
TODO: version bump, docs

Signed-off-by: Michael Niedermayer 
---
 libavformat/avformat.h  | 8 
 libavformat/options_table.h | 7 +++
 libavformat/utils.c | 3 +++
 3 files changed, 18 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f9f4d72..96e6b94 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1899,6 +1899,14 @@ typedef struct AVFormatContext {
  * - decoding: set by user through AVOptions (NO direct access)
  */
 char *protocol_blacklist;
+
+/**
+ * Force parsing.
+ * - encoding: unused
+ * - decoding: set by user through AVOptions (NO direct access)
+ */
+int force_parsing;
+
 } AVFormatContext;
 
 int av_format_get_probe_score(const AVFormatContext *s);
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 9d61d5a..50ea3c1 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -105,6 +105,13 @@ static const AVOption avformat_options[] = {
 {"format_whitelist", "List of demuxers that are allowed to be used", 
OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
CHAR_MAX, D },
 {"protocol_whitelist", "List of protocols that are allowed to be used", 
OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
CHAR_MAX, D },
 {"protocol_blacklist", "List of protocols that are not allowed to be used", 
OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL },  CHAR_MIN, 
CHAR_MAX, D },
+{"forceparsing", "force use of AVParsers", OFFSET(force_parsing), 
AV_OPT_TYPE_INT, { .i64 = -1 },  -1, AVSTREAM_PARSE_FULL_ONCE, D, 
"forceparsing"},
+{"none",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_NONE   
}, INT_MIN, INT_MAX, D, "forceparsing" },
+{"full",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL   
}, INT_MIN, INT_MAX, D, "forceparsing" },
+{"headers", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_HEADERS
}, INT_MIN, INT_MAX, D, "forceparsing" },
+{"timestamps",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_TIMESTAMPS 
}, INT_MIN, INT_MAX, D, "forceparsing" },
+{"once",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL_ONCE  
}, INT_MIN, INT_MAX, D, "forceparsing" },
+{"raw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL_RAW   
}, INT_MIN, INT_MAX, D, "forceparsing" },
 {NULL},
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5664646..23e063f 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4264,6 +4264,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
  * timestamps have their first few packets buffered and the
  * timestamps corrected before they are returned to the user */
 st->cur_dts = RELATIVE_TS_BASE;
+
+if (s->force_parsing >= 0)
+st->need_parsing = s->force_parsing;
 } else {
 st->cur_dts = AV_NOPTS_VALUE;
 }
-- 
2.10.2

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


Re: [FFmpeg-devel] [PATCH] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

2016-11-06 Thread Dave Yeo

On 11/06/16 04:34 AM, Michael Niedermayer wrote:

src/libavformat/tcp.c: In function 'tcp_open':
>src/libavformat/tcp.c:128:25: error: dereferencing pointer to
>incomplete type
>  if (!sockaddr_v6->sin6_port){
>  ^
>src/libavformat/tcp.c:129:24: error: dereferencing pointer to
>incomplete type
>  sockaddr_v6->sin6_port = htons(port);
> ^
>make: *** [libavformat/tcp.o] Error 1
>make: *** Waiting for unfinished jobs

does this fix it: ?

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fd10a56..25abafc 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
  cur_ai = ai;

   restart:
+#if HAVE_STRUCT_SOCKADDR_IN6
  // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 
address can not resolve port number.
  if (cur_ai->ai_family == AF_INET6){
  struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
*)cur_ai->ai_addr;
@@ -129,6 +130,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
  sockaddr_v6->sin6_port = htons(port);
  }
  }
+#endif

  fd = ff_socket(cur_ai->ai_family,
 cur_ai->ai_socktype,


Yes, that seems to fix it.
Thanks,
Dave
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/af_volumedetect: Remove dependency on channel layout

2016-11-06 Thread Michael Niedermayer
On Sat, Sep 10, 2016 at 11:21:28AM +0200, Nicolas George wrote:
> Le decadi 20 fructidor, an CCXXIV, Michael Niedermayer a écrit :
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavfilter/af_volumedetect.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> LGTM, thanks.
> 
> Note that to allow the filter to work with unknown layouts, they must be
> declared as supported:
> 
>   ff_set_common_channel_layouts(ctx, ff_all_channel_counts());

changed

applied

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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


Re: [FFmpeg-devel] [PATCH v3] ffmpeg: parameters for filter thread counts

2016-11-06 Thread Michael Niedermayer
On Sun, Nov 06, 2016 at 09:20:33AM -0500, DeHackEd wrote:
> On 11/06/2016 06:44 AM, Michael Niedermayer wrote:
> > On Sun, Oct 30, 2016 at 09:25:39AM -0400, DeHackEd wrote:
> > [...]
> > 
> >>  if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, , 
> >> )) < 0)
> >> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> >> index 4d25fff..dc94380 100644
> >> --- a/ffmpeg_opt.c
> >> +++ b/ffmpeg_opt.c
> >> @@ -3365,12 +3365,16 @@ const OptionDef options[] = {
> >>  "set profile", "profile" },
> >>  { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { 
> >> .off = OFFSET(filters) },
> >>  "set stream filtergraph", "filter_graph" },
> >> +{ "filter_threads",  HAS_ARG | OPT_INT,  { 
> >> _nbthreads },
> >> +"number of non-complex filter threads" },
> >>  { "filter_script",  HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { 
> >> .off = OFFSET(filter_scripts) },
> >>  "read stream filtergraph description from a file", "filename" },
> >>  { "reinit_filter",  HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT,{ 
> >> .off = OFFSET(reinit_filters) },
> >>  "reinit filtergraph on input parameter changes", "" },
> >>  { "filter_complex", HAS_ARG | OPT_EXPERT,{ 
> >> .func_arg = opt_filter_complex },
> >>  "create a complex filtergraph", "graph_description" },
> >> +{ "filter_complex_threads", HAS_ARG | OPT_INT,   { 
> >> _complex_nbthreads },
> >> +"number of threads for -filter_complex" },
> >>  { "lavfi",  HAS_ARG | OPT_EXPERT,{ 
> >> .func_arg = opt_filter_complex },
> >>  "create a complex filtergraph", "graph_description" },
> >>  { "filter_complex_script", HAS_ARG | OPT_EXPERT, { 
> >> .func_arg = opt_filter_complex_script },
> > 
> > why are there 2 options instead of 1 ?
> > 
> 
> One affects -filter_complex filtergraphs, one affects -af and -vf 
> filtergraphs...
> 
> The main motivation was that you typically have one -filter_complex graph, 
> but could have many -af and -vf filtergraphs,
> so if you are trying to limit how many threads you use then you would have 
> different needs depending on which type you
> are using.

ok, makes sense

patch applied

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


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


Re: [FFmpeg-devel] [PATCH] doc/libx26[45]: Add documentation for forced-idr

2016-11-06 Thread Michael Niedermayer
On Sun, Nov 06, 2016 at 01:46:30PM +, Derek Buitenhuis wrote:
> Signed-off-by: Derek Buitenhuis 
> ---
> As request by Michael.
> ---
>  doc/encoders.texi | 8 
>  1 file changed, 8 insertions(+)

applied

thx

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

Does the universe only have a finite lifespan? No, its going to go on
forever, its just that you wont like living in it. -- Hiranya Peiri


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


Re: [FFmpeg-devel] [PATCH v3] ffmpeg: parameters for filter thread counts

2016-11-06 Thread DeHackEd
On 11/06/2016 06:44 AM, Michael Niedermayer wrote:
> On Sun, Oct 30, 2016 at 09:25:39AM -0400, DeHackEd wrote:
> [...]
> 
>>  if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, , 
>> )) < 0)
>> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
>> index 4d25fff..dc94380 100644
>> --- a/ffmpeg_opt.c
>> +++ b/ffmpeg_opt.c
>> @@ -3365,12 +3365,16 @@ const OptionDef options[] = {
>>  "set profile", "profile" },
>>  { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { 
>> .off = OFFSET(filters) },
>>  "set stream filtergraph", "filter_graph" },
>> +{ "filter_threads",  HAS_ARG | OPT_INT,  { 
>> _nbthreads },
>> +"number of non-complex filter threads" },
>>  { "filter_script",  HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { 
>> .off = OFFSET(filter_scripts) },
>>  "read stream filtergraph description from a file", "filename" },
>>  { "reinit_filter",  HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT,{ .off 
>> = OFFSET(reinit_filters) },
>>  "reinit filtergraph on input parameter changes", "" },
>>  { "filter_complex", HAS_ARG | OPT_EXPERT,{ 
>> .func_arg = opt_filter_complex },
>>  "create a complex filtergraph", "graph_description" },
>> +{ "filter_complex_threads", HAS_ARG | OPT_INT,   { 
>> _complex_nbthreads },
>> +"number of threads for -filter_complex" },
>>  { "lavfi",  HAS_ARG | OPT_EXPERT,{ 
>> .func_arg = opt_filter_complex },
>>  "create a complex filtergraph", "graph_description" },
>>  { "filter_complex_script", HAS_ARG | OPT_EXPERT, { 
>> .func_arg = opt_filter_complex_script },
> 
> why are there 2 options instead of 1 ?
> 

One affects -filter_complex filtergraphs, one affects -af and -vf 
filtergraphs...

The main motivation was that you typically have one -filter_complex graph, but 
could have many -af and -vf filtergraphs,
so if you are trying to limit how many threads you use then you would have 
different needs depending on which type you
are using.


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


Re: [FFmpeg-devel] [PATCH 2/2] avformat/hls: Fix probing mpegts audio streams that use probing

2016-11-06 Thread Anssi Hannula
05.11.2016, 19:27, Hendrik Leppkes kirjoitti:
> On Sat, Nov 5, 2016 at 5:39 PM, Anssi Hannula  wrote:
>> Commit 04964ac311abe670f ("avformat/hls: Fix missing streams in some
>> cases with MPEG TS") caused a regression where subdemuxer streams that
>> use probing (e.g. dts/eac3/mp2 in mpegts) no longer get probed properly.
>>
>> This is because the codec parameters from the subdemuxer stream, once
>> probed, are not passed on to the main stream.
>>
>> Fix that by updating the codec parameters if the codec id changes.
>>
>> Signed-off-by: Anssi Hannula 
>> ---
>>  libavformat/hls.c | 12 +++-
>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/hls.c b/libavformat/hls.c
>> index 6fb652c..8527f33 100644
>> --- a/libavformat/hls.c
>> +++ b/libavformat/hls.c
>> @@ -1950,6 +1950,8 @@ static int hls_read_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>  /* If we got a packet, return it */
>>  if (minplaylist >= 0) {
>>  struct playlist *pls = c->playlists[minplaylist];
>> +AVStream *ist;
>> +AVStream *st;
>>
>>  ret = update_streams_from_subdemuxer(s, pls);
>>  if (ret < 0) {
>> @@ -1972,8 +1974,11 @@ static int hls_read_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>  return AVERROR_BUG;
>>  }
>>
>> +ist = pls->ctx->streams[pls->pkt.stream_index];
>> +st = pls->main_streams[pls->pkt.stream_index];
>> +
>>  *pkt = pls->pkt;
>> -pkt->stream_index = pls->main_streams[pls->pkt.stream_index]->index;
>> +pkt->stream_index = st->index;
>>  reset_packet(>playlists[minplaylist]->pkt);
>>
>>  if (pkt->dts != AV_NOPTS_VALUE)
>> @@ -1981,6 +1986,11 @@ static int hls_read_packet(AVFormatContext *s, 
>> AVPacket *pkt)
>>  
>> pls->ctx->streams[pls->pkt.stream_index]->time_base,
>>  AV_TIME_BASE_Q);
>>
>> +/* There may be more situations where this would be useful, but 
>> this at least
>> + * handles newly probed codecs properly (i.e. request_probe by 
>> mpegts). */
>> +if (ist->codecpar->codec_id != st->codecpar->codec_id)
>> +set_stream_info_from_input_stream(st, pls, ist);
>> +
> 
> A better solution would be checking
> ist->internal->need_context_update, and also setting this in the
> output stream when you copy params over, so the generic code knows
> things changed.

AFAICS that flag has already been handled & cleared by
read_frame_internal() at this point.

So I'll do what Andreas suggested and just set it to 1 here (or in
set_stream_in_from_input_stream), unless I'm missing something...

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


[FFmpeg-devel] [PATCH] doc/libx26[45]: Add documentation for forced-idr

2016-11-06 Thread Derek Buitenhuis
Signed-off-by: Derek Buitenhuis 
---
As request by Michael.
---
 doc/encoders.texi | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 5a60e7e..ba60e0a 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1751,6 +1751,10 @@ Exhaustive search.
 Hadamard exhaustive search (slowest).
 @end table
 
+@item forced-idr
+Normally, when forcing a I-frame type, the encoder can select any type
+of I-frame. This option forces it to choose an IDR-frame.
+
 @item subq (@emph{subme})
 Sub-pixel motion estimation method.
 
@@ -2041,6 +2045,10 @@ Set the x265 preset.
 @item tune
 Set the x265 tune parameter.
 
+@item forced-idr
+Normally, when forcing a I-frame type, the encoder can select any type
+of I-frame. This option forces it to choose an IDR-frame.
+
 @item x265-params
 Set x265 options using a list of @var{key}=@var{value} couples separated
 by ":". See @command{x265 --help} for a list of options.
-- 
1.8.3.1

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Fallback to finding non-keyframe in fix_index, if keyframe search fails.

2016-11-06 Thread Derek Buitenhuis
On 11/6/2016 12:40 PM, Michael Niedermayer wrote:
> IMO we should support it if its possible without large hacks

I don't really have an opinion myself, so to speak. I was just noting it.

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


Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Fallback to finding non-keyframe in fix_index, if keyframe search fails.

2016-11-06 Thread Michael Niedermayer
On Sun, Nov 06, 2016 at 10:08:23AM +0530, Sasi Inguva wrote:
> When I play the file using Quicktime Player 7 , it errs out saying "invalid
> public movie atom found" . Quicktime 10.4 shows a black screen . Even vlc
> doesn't play the video. It's true that it used to work before, but  don't
> know if we need to support it.

IMO we should support it if its possible without large hacks

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

What does censorship reveal? It reveals fear. -- Julian Assange


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


Re: [FFmpeg-devel] [PATCH] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

2016-11-06 Thread Michael Niedermayer
On Sun, Nov 06, 2016 at 12:22:04AM -0700, Dave Yeo wrote:
> On 08/24/16 03:46 AM, liu jc wrote:
> >Signed-off-by: liujingchao 
> >---
> >  libavformat/tcp.c | 8 
> >  1 file changed, 8 insertions(+)
> >  mode change 100644 => 100755 libavformat/tcp.c
> >
> >diff --git a/libavformat/tcp.c b/libavformat/tcp.c
> >old mode 100644
> >new mode 100755
> >index c105479..fd10a56
> >--- a/libavformat/tcp.c
> >+++ b/libavformat/tcp.c
> >@@ -122,6 +122,14 @@ static int tcp_open(URLContext *h, const char *uri, int 
> >flags)
> >  cur_ai = ai;
> >
> >   restart:
> >+// workaround for IOS9 getaddrinfo in IPv6 only network use hardcode 
> >IPv4 address can not resolve port number.
> >+if (cur_ai->ai_family == AF_INET6){
> >+struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
> >*)cur_ai->ai_addr;
> >+if (!sockaddr_v6->sin6_port){
> >+sockaddr_v6->sin6_port = htons(port);
> >+}
> >+}
> >+
> >  fd = ff_socket(cur_ai->ai_family,
> > cur_ai->ai_socktype,
> > cur_ai->ai_protocol);
> >
> 
> src/libavformat/tcp.c: In function 'tcp_open':
> src/libavformat/tcp.c:128:25: error: dereferencing pointer to
> incomplete type
>  if (!sockaddr_v6->sin6_port){
>  ^
> src/libavformat/tcp.c:129:24: error: dereferencing pointer to
> incomplete type
>  sockaddr_v6->sin6_port = htons(port);
> ^
> make: *** [libavformat/tcp.o] Error 1
> make: *** Waiting for unfinished jobs

does this fix it: ?

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index fd10a56..25abafc 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
 cur_ai = ai;

  restart:
+#if HAVE_STRUCT_SOCKADDR_IN6
 // workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 
address can not resolve port number.
 if (cur_ai->ai_family == AF_INET6){
 struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
*)cur_ai->ai_addr;
@@ -129,6 +130,7 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
 sockaddr_v6->sin6_port = htons(port);
 }
 }
+#endif

 fd = ff_socket(cur_ai->ai_family,
cur_ai->ai_socktype,


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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


Re: [FFmpeg-devel] [PATCH] lavf/mpegtsenc: write metadata descriptor for timed ID3 packets

2016-11-06 Thread Stefano Sabatini
On date Sunday 2016-08-21 18:23:21 +0200, Michael Niedermayer encoded:
> On Sun, Aug 21, 2016 at 10:44:27AM +0200, Stefano Sabatini wrote:
> > On date Saturday 2016-08-20 18:57:52 +0200, Michael Niedermayer encoded:
> > > On Sat, Aug 20, 2016 at 03:48:35PM +0200, Stefano Sabatini wrote:
> > > > On date Thursday 2016-05-19 18:45:35 +0200, Stefano Sabatini encoded:
> > > > > This is required since some softwares are not able to correctly 
> > > > > recognize
> > > > > the metadata.
> > > > > ---
> > > > >  libavformat/mpegtsenc.c | 24 ++--
> > > > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > > > 
> > > > Updated, with some more documentation and references to the MPEGTS
> > > > standard.
> > > > 
> > > > Note: this patch was created comparing the output of FFmpeg with those
> > > > from encoding.com and elemental. With the change the output metadata
> > > > can be read by third-party players.
> > > > 
> > > > If the maintainers prefer, I can enable this output mode through a
> > > > flag.
> > > > -- 
> > > > FFmpeg = Fiendish & Fiendish Mastering Purposeless Egregious Goblin
> > > 
> > > >  mpegtsenc.c |   24 ++--
> > > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > > > 3a6655bca70653c64bfb5f2073d01feee73e64c2  
> > > > 0003-lavf-mpegtsenc-write-metadata-descriptor-for-timed-I.patch
> > > > From 20f22c426a9f5c59d28f66a17b59d62301503d67 Mon Sep 17 00:00:00 2001
> > > > From: Stefano Sabatini 
> > > > Date: Tue, 12 Apr 2016 18:16:21 +0200
> > > > Subject: [PATCH] lavf/mpegtsenc: write metadata descriptor for timed ID3
> > > >  packets
> > > > 
> > > > This is required since some programs are not able to correctly recognize
> > > > the metadata. See H.222, 2.6.58 Metadata pointer descriptor.
> > > > 
> > > > putstr8() is modified in order to allow to skip writing the string
> > > > length.
> > > > ---
> > > >  libavformat/mpegtsenc.c | 24 ++--
> > > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > > > 
> > > > diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> > > > index b437100..6f40615 100644
> > > > --- a/libavformat/mpegtsenc.c
> > > > +++ b/libavformat/mpegtsenc.c
> > > > @@ -256,7 +256,7 @@ static void mpegts_write_pat(AVFormatContext *s)
> > > >  }
> > > >  
> > > >  /* NOTE: !str is accepted for an empty string */
> > > > -static void putstr8(uint8_t **q_ptr, const char *str)
> > > > +static void putstr8(uint8_t **q_ptr, const char *str, int write_len)
> > > 
> > > breaks build, putstr8() seems after the place where a use is added
> > > in git master, or i did somehing silly
> > 
> > Another patch is needed (already approved, but doesn't make sense
> > without this other patch), in attachment.
> 
> patches probably ok

Applied, thanks.
-- 
FFmpeg = Fundamentalist Frenzy Mythic Powerful Elfic Geisha
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3] ffmpeg: parameters for filter thread counts

2016-11-06 Thread Michael Niedermayer
On Sun, Oct 30, 2016 at 09:25:39AM -0400, DeHackEd wrote:
[...]

>  if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, , 
> )) < 0)
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 4d25fff..dc94380 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -3365,12 +3365,16 @@ const OptionDef options[] = {
>  "set profile", "profile" },
>  { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off 
> = OFFSET(filters) },
>  "set stream filtergraph", "filter_graph" },
> +{ "filter_threads",  HAS_ARG | OPT_INT,  { 
> _nbthreads },
> +"number of non-complex filter threads" },
>  { "filter_script",  HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off 
> = OFFSET(filter_scripts) },
>  "read stream filtergraph description from a file", "filename" },
>  { "reinit_filter",  HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT,{ .off 
> = OFFSET(reinit_filters) },
>  "reinit filtergraph on input parameter changes", "" },
>  { "filter_complex", HAS_ARG | OPT_EXPERT,{ 
> .func_arg = opt_filter_complex },
>  "create a complex filtergraph", "graph_description" },
> +{ "filter_complex_threads", HAS_ARG | OPT_INT,   { 
> _complex_nbthreads },
> +"number of threads for -filter_complex" },
>  { "lavfi",  HAS_ARG | OPT_EXPERT,{ 
> .func_arg = opt_filter_complex },
>  "create a complex filtergraph", "graph_description" },
>  { "filter_complex_script", HAS_ARG | OPT_EXPERT, { 
> .func_arg = opt_filter_complex_script },

why are there 2 options instead of 1 ?

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

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 


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


Re: [FFmpeg-devel] [PATCH] workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 address can not resolve port number.

2016-11-06 Thread Dave Yeo

On 08/24/16 03:46 AM, liu jc wrote:

Signed-off-by: liujingchao 
---
  libavformat/tcp.c | 8 
  1 file changed, 8 insertions(+)
  mode change 100644 => 100755 libavformat/tcp.c

diff --git a/libavformat/tcp.c b/libavformat/tcp.c
old mode 100644
new mode 100755
index c105479..fd10a56
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -122,6 +122,14 @@ static int tcp_open(URLContext *h, const char *uri, int 
flags)
  cur_ai = ai;

   restart:
+// workaround for IOS9 getaddrinfo in IPv6 only network use hardcode IPv4 
address can not resolve port number.
+if (cur_ai->ai_family == AF_INET6){
+struct sockaddr_in6 * sockaddr_v6 = (struct sockaddr_in6 
*)cur_ai->ai_addr;
+if (!sockaddr_v6->sin6_port){
+sockaddr_v6->sin6_port = htons(port);
+}
+}
+
  fd = ff_socket(cur_ai->ai_family,
 cur_ai->ai_socktype,
 cur_ai->ai_protocol);



src/libavformat/tcp.c: In function 'tcp_open':
src/libavformat/tcp.c:128:25: error: dereferencing pointer to incomplete 
type

 if (!sockaddr_v6->sin6_port){
 ^
src/libavformat/tcp.c:129:24: error: dereferencing pointer to incomplete 
type

 sockaddr_v6->sin6_port = htons(port);
^
make: *** [libavformat/tcp.o] Error 1
make: *** Waiting for unfinished jobs

Dave

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