Re: [FFmpeg-devel] implement process_command for vf_scale and vf_crop

2015-07-05 Thread Bernd Blessmann

Am 25.06.2015 um 16:20 schrieb Bernd Blessmann:

Hi all,

I want to implement process_command for vf_scale.c and vf_crop.c in order to 
use zmq to change
scaling and cropping dynamically.

I have implemented it using av_opt_set() and calling config_props() for scale 
and config_input() and
config_output() for crop. I am using the config_-functions because they handle 
variable parsing and
checking of the values. But I do not know if this is the right way to do it and 
if it is safe to
call these functions from process_command.

Maybe someone can comment on these implementation or outline a way to implement 
process_command for
these filters.

I attach patches including my implementation so far.



I just answer myself to my posting as a reminder. Maybe my posting has been 
overseen.
If I am totally wrong here (in this list, with my implementation or with the patch format), please 
let me know.


Thanks a lot
  Bernd


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


Re: [FFmpeg-devel] [PATCH] snow: remove strange av_assert2

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 09:11:44PM +0200, Andreas Cadhalpun wrote:
> On 03.07.2015 01:04, Michael Niedermayer wrote:
> > On Fri, Jul 03, 2015 at 12:31:31AM +0200, Andreas Cadhalpun wrote:
> >> It asserts that the frame linesize is larger than 37, but it can be
> >> smaller and decoding such frames works. Thus it is unclear what this
> >> assert is good for.
> > 
> > i think it was due to the layout of some temporary /scratch buffer
> > 
> > maybe in the emulated_edge_mc() call in ff_snow_pred_block() but
> > iam not sure
> 
> I couldn't find a problem with the layout of the tmp/scratchbuf buffer
> for small strides.
> 
> > as stride becomes too small its no longer possible to store some elements
> > that is when they are larger
> 
> Can you explain how elements can be too larger to fit?

emulated_edge_mc() writes a block of width x height,
if stride < width this will not work as intended

iam quite unsure if this is the intended thing for the assert to
check, i hthik there was more code that possibly was fixed

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Avoid a single point of failure, be that a person or equipment.


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


[FFmpeg-devel] [PATCH 3/4] concatdec: add support for specifying outpoint of files

2015-07-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/demuxers.texi   | 13 +
 libavformat/concatdec.c | 22 --
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 4bad1c8..4ba797e 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -129,6 +129,19 @@ directive) will be reduced based on their specified In 
point.
 Because of potential packets before the specified In point, packet timestamps
 may overlap between two concatenated files.
 
+@item @code{out @var{timestamp}}
+Out point of the file. When the demuxer reaches the specified timestamp in any
+of the streams, it handles it as an end of file condition. Out point is
+exclusive, which means that the demuxer will not output packets which has a
+timestamp greater or equal to Out point.
+
+This directive works best with intra frame codecs, because for non-intra frame
+ones you will usually not get enough packets to decode the last few frames
+before the specified Out point.
+
+The duration of the files (if not specified by the @code{duration}
+directive) will be reduced based on their specified Out point.
+
 @item @code{stream}
 Introduce a stream in the virtual file.
 All subsequent stream-related directives apply to the last introduced
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 11e6759..eaf34b0 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -44,6 +44,7 @@ typedef struct {
 int64_t duration;
 ConcatStream *streams;
 int64_t inpoint;
+int64_t outpoint;
 int nb_streams;
 } ConcatFile;
 
@@ -145,6 +146,7 @@ static int add_file(AVFormatContext *avf, char *filename, 
ConcatFile **rfile,
 file->start_time = AV_NOPTS_VALUE;
 file->duration   = AV_NOPTS_VALUE;
 file->inpoint= AV_NOPTS_VALUE;
+file->outpoint   = AV_NOPTS_VALUE;
 
 return 0;
 
@@ -360,7 +362,7 @@ static int concat_read_header(AVFormatContext *avf)
 }
 if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0)
 goto fail;
-} else if (!strcmp(keyword, "duration") || !strcmp(keyword, "in")) {
+} else if (!strcmp(keyword, "duration") || !strcmp(keyword, "in") || 
!strcmp(keyword, "out")) {
 char *dur_str = get_keyword(&cursor);
 int64_t dur;
 if (!file) {
@@ -377,6 +379,8 @@ static int concat_read_header(AVFormatContext *avf)
 file->duration = dur;
 else if (!strcmp(keyword, "in"))
 file->inpoint = dur;
+else if (!strcmp(keyword, "out"))
+file->outpoint = dur;
 } else if (!strcmp(keyword, "stream")) {
 if (!avformat_new_stream(avf, NULL))
 FAIL(AVERROR(ENOMEM));
@@ -443,6 +447,8 @@ static int open_next_file(AVFormatContext *avf)
 cat->cur_file->duration = cat->avf->duration;
 if (cat->cur_file->inpoint != AV_NOPTS_VALUE)
 cat->cur_file->duration -= (cat->cur_file->inpoint - 
file_start_time);
+if (cat->cur_file->outpoint != AV_NOPTS_VALUE)
+cat->cur_file->duration -= cat->avf->duration - 
(cat->cur_file->outpoint - file_start_time);
 }
 
 if (++fileno >= cat->nb_files) {
@@ -504,6 +510,16 @@ static int64_t get_cur_file_inpoint(ConcatContext *cat)
 return file_inpoint;
 }
 
+/* Returns true if the packet pts is greater or equal to the specified 
outpoint. */
+static int packet_after_outpoint(ConcatContext *cat, AVPacket *pkt)
+{
+if (cat->cur_file->outpoint != AV_NOPTS_VALUE && pkt->pts != 
AV_NOPTS_VALUE) {
+return av_compare_ts(pkt->pts, 
cat->avf->streams[pkt->stream_index]->time_base,
+ cat->cur_file->outpoint, AV_TIME_BASE_Q) >= 0;
+}
+return 0;
+}
+
 static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
 {
 ConcatContext *cat = avf->priv_data;
@@ -520,7 +536,9 @@ static int concat_read_packet(AVFormatContext *avf, 
AVPacket *pkt)
 
 while (1) {
 ret = av_read_frame(cat->avf, pkt);
-if (ret == AVERROR_EOF) {
+if (ret == AVERROR_EOF || packet_after_outpoint(cat, pkt)) {
+if (ret == 0)
+av_packet_unref(pkt);
 if ((ret = open_next_file(avf)) < 0)
 return ret;
 continue;
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 4/4] concatdec: add support for injecting packet metadata

2015-07-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/demuxers.texi   |  4 
 libavformat/concatdec.c | 30 ++
 2 files changed, 34 insertions(+)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 4ba797e..28244f3 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -142,6 +142,10 @@ before the specified Out point.
 The duration of the files (if not specified by the @code{duration}
 directive) will be reduced based on their specified Out point.
 
+@item @code{metadata @var{string}}
+Metadata of the file. The specified metadata (which consists of
+@code{key=value} pairs seperated by commas) will be set for each file packet.
+
 @item @code{stream}
 Introduce a stream in the virtual file.
 All subsequent stream-related directives apply to the last introduced
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index eaf34b0..66e81c8 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -45,6 +45,8 @@ typedef struct {
 ConcatStream *streams;
 int64_t inpoint;
 int64_t outpoint;
+char *metadata;
+int metadata_len;
 int nb_streams;
 } ConcatFile;
 
@@ -329,6 +331,7 @@ static int concat_read_close(AVFormatContext *avf)
 avformat_close_input(&cat->avf);
 for (i = 0; i < cat->nb_files; i++) {
 av_freep(&cat->files[i].url);
+av_freep(&cat->files[i].metadata);
 av_freep(&cat->files[i].streams);
 }
 av_freep(&cat->files);
@@ -381,6 +384,27 @@ static int concat_read_header(AVFormatContext *avf)
 file->inpoint = dur;
 else if (!strcmp(keyword, "out"))
 file->outpoint = dur;
+} else if (!strcmp(keyword, "metadata")) {
+AVDictionary *opts = NULL;
+char *metadata;
+if (file->metadata) {
+av_log(avf, AV_LOG_ERROR, "Line %d: metadata is already 
provided\n", line);
+FAIL(AVERROR_INVALIDDATA);
+}
+metadata = av_get_token((const char **)&cursor, SPACE_CHARS);
+if (!metadata) {
+av_log(avf, AV_LOG_ERROR, "Line %d: metadata required\n", 
line);
+FAIL(AVERROR_INVALIDDATA);
+}
+if ((ret = av_dict_parse_string(&opts, metadata, "=", ",", 0)) < 
0) {
+av_log(avf, AV_LOG_ERROR, "Line %d: failed to parse metadata 
string\n", line);
+av_freep(&metadata);
+av_dict_free(&opts);
+FAIL(AVERROR_INVALIDDATA);
+}
+file->metadata = av_packet_pack_dictionary(opts, 
&file->metadata_len);
+av_freep(&metadata);
+av_dict_free(&opts);
 } else if (!strcmp(keyword, "stream")) {
 if (!avformat_new_stream(avf, NULL))
 FAIL(AVERROR(ENOMEM));
@@ -576,6 +600,12 @@ static int concat_read_packet(AVFormatContext *avf, 
AVPacket *pkt)
 av_log(avf, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n",
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
+if (cat->cur_file->metadata) {
+uint8_t* metadata;
+if (!(metadata = av_packet_new_side_data(pkt, 
AV_PKT_DATA_STRINGS_METADATA, cat->cur_file->metadata_len)))
+return AVERROR(ENOMEM);
+memcpy(metadata, cat->cur_file->metadata, cat->cur_file->metadata_len);
+}
 return ret;
 }
 
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/4] concatdec: store eof condition in context

2015-07-05 Thread Marton Balint
This is needed later for outpoint support which may leave the last file in a
not-eof state.

Signed-off-by: Marton Balint 
---
 libavformat/concatdec.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index c61a1a3..11e6759 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -55,6 +55,7 @@ typedef struct {
 AVFormatContext *avf;
 int safe;
 int seekable;
+int eof;
 ConcatMatchMode stream_match_mode;
 unsigned auto_convert;
 } ConcatContext;
@@ -444,8 +445,10 @@ static int open_next_file(AVFormatContext *avf)
 cat->cur_file->duration -= (cat->cur_file->inpoint - 
file_start_time);
 }
 
-if (++fileno >= cat->nb_files)
+if (++fileno >= cat->nb_files) {
+cat->eof = 1;
 return AVERROR_EOF;
+}
 return open_file(avf, fileno);
 }
 
@@ -509,6 +512,9 @@ static int concat_read_packet(AVFormatContext *avf, 
AVPacket *pkt)
 ConcatStream *cs;
 AVStream *st;
 
+if (cat->eof)
+return AVERROR_EOF;
+
 if (!cat->avf)
 return AVERROR(EIO);
 
@@ -640,6 +646,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
 cat->cur_file = cur_file_saved;
 } else {
 avformat_close_input(&cur_avf_saved);
+cat->eof = 0;
 }
 return ret;
 }
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 1/4] concatdec: add support for specifying inpoint of files

2015-07-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 doc/demuxers.texi   | 17 +
 libavformat/concatdec.c | 48 +++-
 2 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/doc/demuxers.texi b/doc/demuxers.texi
index 35a1561..4bad1c8 100644
--- a/doc/demuxers.texi
+++ b/doc/demuxers.texi
@@ -112,6 +112,23 @@ file is not available or accurate.
 If the duration is set for all files, then it is possible to seek in the
 whole concatenated video.
 
+@item @code{in @var{timestamp}}
+In point of the file. When the demuxer opens the file it instantly seeks to the
+specified timestamp. Seeking is done so that all streams can be presented
+successfully at In point.
+
+This directive works best with intra frame codecs, because for non-intra frame
+ones you will usually get extra packets before the actual In point and the
+decoded content will most likely contain frames before In point too.
+
+For each file, packets before the file In point will have timestamps less than
+the calculated start timestamp of the file (negative in case of the first
+file), and the duration of the files (if not specified by the @code{duration}
+directive) will be reduced based on their specified In point.
+
+Because of potential packets before the specified In point, packet timestamps
+may overlap between two concatenated files.
+
 @item @code{stream}
 Introduce a stream in the virtual file.
 All subsequent stream-related directives apply to the last introduced
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index e95ff34..c61a1a3 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -43,6 +43,7 @@ typedef struct {
 int64_t start_time;
 int64_t duration;
 ConcatStream *streams;
+int64_t inpoint;
 int nb_streams;
 } ConcatFile;
 
@@ -142,6 +143,7 @@ static int add_file(AVFormatContext *avf, char *filename, 
ConcatFile **rfile,
 file->url= url;
 file->start_time = AV_NOPTS_VALUE;
 file->duration   = AV_NOPTS_VALUE;
+file->inpoint= AV_NOPTS_VALUE;
 
 return 0;
 
@@ -308,6 +310,10 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
cat->files[fileno - 1].duration;
 if ((ret = match_streams(avf)) < 0)
 return ret;
+if (file->inpoint != AV_NOPTS_VALUE) {
+   if ((ret = avformat_seek_file(cat->avf, -1, INT64_MIN, file->inpoint, 
file->inpoint, 0) < 0))
+   return ret;
+}
 return 0;
 }
 
@@ -353,20 +359,23 @@ static int concat_read_header(AVFormatContext *avf)
 }
 if ((ret = add_file(avf, filename, &file, &nb_files_alloc)) < 0)
 goto fail;
-} else if (!strcmp(keyword, "duration")) {
+} else if (!strcmp(keyword, "duration") || !strcmp(keyword, "in")) {
 char *dur_str = get_keyword(&cursor);
 int64_t dur;
 if (!file) {
-av_log(avf, AV_LOG_ERROR, "Line %d: duration without file\n",
-   line);
+av_log(avf, AV_LOG_ERROR, "Line %d: %s without file\n",
+   line, keyword);
 FAIL(AVERROR_INVALIDDATA);
 }
 if ((ret = av_parse_time(&dur, dur_str, 1)) < 0) {
-av_log(avf, AV_LOG_ERROR, "Line %d: invalid duration '%s'\n",
-   line, dur_str);
+av_log(avf, AV_LOG_ERROR, "Line %d: invalid %s '%s'\n",
+   line, keyword, dur_str);
 goto fail;
 }
-file->duration = dur;
+if (!strcmp(keyword, "duration"))
+file->duration = dur;
+else if (!strcmp(keyword, "in"))
+file->inpoint = dur;
 } else if (!strcmp(keyword, "stream")) {
 if (!avformat_new_stream(avf, NULL))
 FAIL(AVERROR(ENOMEM));
@@ -428,8 +437,12 @@ static int open_next_file(AVFormatContext *avf)
 ConcatContext *cat = avf->priv_data;
 unsigned fileno = cat->cur_file - cat->files;
 
-if (cat->cur_file->duration == AV_NOPTS_VALUE)
+if (cat->cur_file->duration == AV_NOPTS_VALUE) {
+int64_t file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 
: cat->avf->start_time;
 cat->cur_file->duration = cat->avf->duration;
+if (cat->cur_file->inpoint != AV_NOPTS_VALUE)
+cat->cur_file->duration -= (cat->cur_file->inpoint - 
file_start_time);
+}
 
 if (++fileno >= cat->nb_files)
 return AVERROR_EOF;
@@ -476,11 +489,23 @@ static int filter_packet(AVFormatContext *avf, 
ConcatStream *cs, AVPacket *pkt)
 return 0;
 }
 
+static int64_t get_cur_file_inpoint(ConcatContext *cat)
+{
+int64_t file_inpoint = cat->cur_file->inpoint;
+if (file_inpoint == AV_NOPTS_VALUE) {
+int64_t file_start_time = cat->avf->start_time;
+if (file_start_time == AV_NOPTS_VALUE)
+file_start_time = 0;
+return file_start_time;
+  

Re: [FFmpeg-devel] [PATCH] libavcodec/qsvenc.c: More correct selection of alignment of a frame height depending whether an encoded sequence progressive or not.

2015-07-05 Thread Michael Niedermayer
On Sat, Jul 04, 2015 at 05:00:39PM +0300, Ivan Uskov wrote:
> Hello Hendrik,
> 
> The harm of hard-coded alignment 32 that typical 1280x720 progressive
> video should be encoded as 1280x736. I.e. absolutely superfluous
> stripe of macroblocks should be encoded.
> I can see that CODEC_FLAG_INTERLACED_DCT currently checks into
> dnxhddata.c
> dnxhdenc.c
> dvenc.c
> libx264.c
> libxavs.c
> mpegvideo_enc.c
> nvenc.c
> Why it can not be used by similar way in qsvenc.c?

actually i think its ok

the CODEC_FLAG_INTERLACED_DCT flag is intended for the user to be
able to choose the CODING mode, that is it allows (not forced)
interlaced DCT CODING
the flag says nothing about the content being interlaced.

allowing interlaced coding just by common sense implies that the
material is probably interlaced

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


[FFmpeg-devel] [PATCHv4] avcodec: Add support for Closed Caption export in h264

2015-07-05 Thread Kieran Kunhya
---
 libavcodec/h264.c |  9 +
 libavcodec/h264.h |  2 ++
 libavcodec/h264_sei.c | 39 +--
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index baedcf4..f62ad6a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -879,6 +879,15 @@ static void decode_postinit(H264Context *h, int 
setup_finished)
 }
 }
 
+if (h->a53_caption) {
+AVFrameSideData *sd =
+av_frame_new_side_data(cur->f, AV_FRAME_DATA_A53_CC, 
h->a53_caption_size);
+if (sd)
+memcpy(sd->data, h->a53_caption, h->a53_caption_size);
+av_freep(&h->a53_caption);
+h->a53_caption_size = 0;
+}
+
 cur->mmco_reset = h->mmco_reset;
 h->mmco_reset = 0;
 
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index edecc4b..11a9125 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -805,6 +805,8 @@ typedef struct H264Context {
 
 int missing_fields;
 
+int a53_caption_size;
+uint8_t *a53_caption;
 
 /* for frame threading, this is set to 1
  * after finish_setup() has been called, so we cannot modify
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 569db4e..fa0f4bf 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -43,6 +43,9 @@ void ff_h264_reset_sei(H264Context *h)
 h->sei_frame_packing_present=  0;
 h->sei_display_orientation_present = 0;
 h->sei_reguserdata_afd_present  =  0;
+if (h->a53_caption)
+av_freep(&h->a53_caption);
+h->a53_caption_size = 0;
 }
 
 static int decode_picture_timing(H264Context *h)
@@ -113,8 +116,7 @@ static int decode_registered_user_data(H264Context *h, int 
size)
 {
 uint32_t country_code;
 uint32_t user_identifier;
-int dtg_active_format;
-int flag;
+int flag, cc_count, user_data_type_code;
 
 if (size < 7)
 return AVERROR_INVALIDDATA;
@@ -152,6 +154,39 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif /* FF_API_AFD */
 }
 break;
+case MKBETAG('G', 'A', '9', '4'): // "GA94" closed captions
+if (size < 3)
+return AVERROR(EINVAL);
+user_data_type_code = get_bits(&h->gb, 8);
+if (user_data_type_code == 0x3) {
+skip_bits(&h->gb, 1);
+if (get_bits(&h->gb, 1)) {
+skip_bits(&h->gb, 1);
+cc_count = get_bits(&h->gb, 5);
+skip_bits(&h->gb, 8);
+size -= 2;
+if (cc_count && size >= cc_count*3) {
+int i;
+uint8_t *tmp;
+if ((int64_t)h->a53_caption_size + (int64_t)cc_count*3 
> INT_MAX)
+return AVERROR(EINVAL);
+
+// Allow merging of the cc data from two fields
+tmp = av_realloc(h->a53_caption, h->a53_caption_size + 
cc_count*3);
+if (!tmp)
+return AVERROR(ENOMEM);
+h->a53_caption = tmp;
+for (i = 0; i < cc_count; i++) {
+h->a53_caption[h->a53_caption_size++] = 
get_bits(&h->gb, 8);
+h->a53_caption[h->a53_caption_size++] = 
get_bits(&h->gb, 8);
+h->a53_caption[h->a53_caption_size++] = 
get_bits(&h->gb, 8);
+}
+
+skip_bits(&h->gb, 8);
+}
+}
+}
+break;
 default:
 skip_bits(&h->gb, size * 8);
 break;
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 4/4] lavc/utils: get rid of add_metadata_from_side_data forward declaration

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 07:02:04PM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavcodec/utils.c | 24 +++-
>  1 file changed, 11 insertions(+), 13 deletions(-)

applied

thanks

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

Republics decline into democracies and democracies degenerate into
despotisms. -- 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 3/4] lavc/utils: call add_metadata_from_side_data in ff_init_buffer_info

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 07:02:03PM +0200, Marton Balint wrote:
> This should ensure that each frame get its metadata from its proper packet
> regardless of frame delays caused by reordering or threading.
> 
> Signed-off-by: Marton Balint 
> ---
>  libavcodec/utils.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

applied

thanks

[...]
-- 
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


Re: [FFmpeg-devel] [PATCH 2/4] lavc/utils: change add_metadata_from_side_data to accept avpacket

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 07:02:02PM +0200, Marton Balint wrote:
> Signed-off-by: Marton Balint 
> ---
>  libavcodec/utils.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)

applied

thanks

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

No snowflake in an avalanche ever feels responsible. -- Voltaire


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/4] lavc/utils: remove redundant call to ff_init_buffer_info

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 07:02:01PM +0200, Marton Balint wrote:
> It does the same as calling ff_decode_frame_props.
> 
> Signed-off-by: Marton Balint 

applied

thanks

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

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


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


Re: [FFmpeg-devel] [PATCH] texi2pod: fix an unescaped left brace

2015-07-05 Thread James Almer
On 05/07/15 12:19 PM, Michael Niedermayer wrote:
> On Fri, Jul 03, 2015 at 10:05:51PM -0300, James Almer wrote:
>> On 01/07/15 6:32 PM, James Almer wrote:
>>> This silences some deprecation warnings
>>>
>>> Signed-off-by: James Almer 
>>> ---
>>>  doc/texi2pod.pl | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
>>> index e1ff6b4..9a9b34f 100644
>>> --- a/doc/texi2pod.pl
>>> +++ b/doc/texi2pod.pl
>>> @@ -384,7 +384,7 @@ sub postprocess
>>>  # @* is also impossible in .pod; we discard it and any newline that
>>>  # follows it.  Similarly, our macro @gol must be discarded.
>>>  
>>> -s/\@anchor{(?:[^\}]*)\}//g;
>>> +s/\@anchor\{(?:[^\}]*)\}//g;
>>>  s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
>>>  s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
>>>  s/;\s+\@pxref\{(?:[^\}]*)\}//g;
>>>
>>
>> Ping.
> 
> it looks good to me but this is not my area ...

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


Re: [FFmpeg-devel] [PATCH 4/4] avcodec: loongson optimized h264pred with mmi

2015-07-05 Thread Michael Niedermayer
On Sat, Jul 04, 2015 at 12:14:51PM +0800, 周晓勇 wrote:
> i will offer a download source of Fedora21 OS next Monday.
> i will run yum-builddep ffmpeg-xxx.src.rpm for preparing devel environment.
>  what else do you need to install, because it maybe slow for downloading 
> other packages abroad.
> the new FC21 build with mips64el N64 API and mips64r2(-march=loongson3a) isa, 
> and enabled ARCH_MIPS64 after ffmpeg configure.
> the FC19-O32 was slow, so aborted.

other things hmm
ccache, dash, screen



> 
> here i contrast the performance between libav and ffmpeg
> i run test on my x86_64 notebook(Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz):
> 
> ffmpeg version 2.5.7-0ubuntu0.15.04.1 Copyright (c) 2000-2015 the FFmpeg 
> developers
>   built with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
> avconv version 11.2-6:11.2-1, Copyright (c) 2000-2014 the Libav developers
>   built on Jan 18 2015 05:12:33 with gcc 4.9.2 (Ubuntu 4.9.2-10ubuntu2)
> 
> 1> single thread
> ---
> time ffmpeg -threads 1  -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 
> 4096 -y /dev/null
> 
> frame= 1253 fps= 38 q=0.0 Lsize= 3805988kB time=00:00:52.20 
> bitrate=597196.8kbits/s
> video:3805988kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 0.00%
> 
> real  0m33.163s
> user  0m33.092s
> sys   0m0.056s
> 
> ---
> time avconv -threads 1  -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 
> 4096 -y /dev/null
> 
> frame= 1253 fps= 40 q=0.0 Lsize= 3805988kB time=52.17 bitrate=597673.8kbits/s 
>
> video:3805988kB audio:0kB other streams:0kB global headers:0kB muxing 
> overhead: 0.00%
> 
> real  0m31.154s
> user  0m31.036s
> sys   0m0.108s
> 
> 2> multi-threads
> ---
> time ffmpeg -threads 1  -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 
> 4096 -y /dev/null
> 
> frame= 1253 fps= 78 q=0.0 Lsize= 3805988kB time=00:00:52.20 
> bitrate=597196.8kbits/s
> video:3805988kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
> muxing overhead: 0.00%
> 
> real  0m16.157s
> user  0m59.600s
> sys   0m0.328s
> 
> ---
> time avconv -threads 1  -i 1920x1080.mp4 -cpuflags 0 -f rawvideo -an -vframes 
> 4096 -y /dev/null
> 
> frame= 1253 fps= 84 q=0.0 Lsize= 3805988kB time=52.17 bitrate=597673.8kbits/s 
>
> video:3805988kB audio:0kB other streams:0kB global headers:0kB muxing 
> overhead: 0.00%
> 
> real  0m15.005s
> user  0m55.296s
> sys   0m0.240s
> 
> libav is faster than ffmpeg? 
> the test of other video has same conclusion.

there was a bug in -f rawvideo that resulted in a extra copy of the
image, ive just fixed it in master, its possible there are more bugs
of course

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


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


[FFmpeg-devel] [PATCH] avcodec/v410enc: Use ff_alloc_packet() instead of ff_alloc_packet2()

2015-07-05 Thread Michael Niedermayer
the later is not optimal when the buffer size is well known at allocation time

This avoids a memcpy()

about 1% faster

Signed-off-by: Michael Niedermayer 
---
 libavcodec/v410enc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/v410enc.c b/libavcodec/v410enc.c
index f2f7d73..5537a12 100644
--- a/libavcodec/v410enc.c
+++ b/libavcodec/v410enc.c
@@ -50,7 +50,7 @@ static int v410_encode_frame(AVCodecContext *avctx, AVPacket 
*pkt,
 uint32_t val;
 int i, j, ret;
 
-if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width * avctx->height * 4)) 
< 0)
+if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * 4)) < 0)
 return ret;
 dst = pkt->data;
 
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] snow: remove strange av_assert2

2015-07-05 Thread Andreas Cadhalpun
On 03.07.2015 01:04, Michael Niedermayer wrote:
> On Fri, Jul 03, 2015 at 12:31:31AM +0200, Andreas Cadhalpun wrote:
>> It asserts that the frame linesize is larger than 37, but it can be
>> smaller and decoding such frames works. Thus it is unclear what this
>> assert is good for.
> 
> i think it was due to the layout of some temporary /scratch buffer
> 
> maybe in the emulated_edge_mc() call in ff_snow_pred_block() but
> iam not sure

I couldn't find a problem with the layout of the tmp/scratchbuf buffer
for small strides.

> as stride becomes too small its no longer possible to store some elements
> that is when they are larger

Can you explain how elements can be too larger to fit?

> The assert should possibly be made conditional on such too large
> blocks occuring when stride is too small

I'd be happy to add a condition to the assert, so that it becomes
useful, I just don't know what condition that could be.
But in its current form the assert is wrong, as it can be triggered
even though decoding works just fine.

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


Re: [FFmpeg-devel] [libav-devel] [PATCH 2/2] wmalosslessdec: reset frame->nb_samples on packet loss

2015-07-05 Thread Andreas Cadhalpun
On 03.07.2015 01:44, Luca Barbato wrote:
> On 03/07/15 01:20, Luca Barbato wrote:
>> On 03/07/15 00:07, Andreas Cadhalpun wrote:
>>> Otherwise a frame with non-zero nb_samples but without any data can be
>>> returned.
>>>
>>> Signed-off-by: Andreas Cadhalpun 
>>> ---
>>>  libavcodec/wmalosslessdec.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
>>> index 8094db3..0c85c83 100644
>>> --- a/libavcodec/wmalosslessdec.c
>>> +++ b/libavcodec/wmalosslessdec.c
>>> @@ -1005,6 +1005,7 @@ static int decode_frame(WmallDecodeCtx *s)
>>>  if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) {
>>>  /* return an error if no frame could be decoded at all */
>>>  s->packet_loss = 1;
>>> +s->frame->nb_samples = 0;
>>>  return ret;
>>>  }
>>>  for (i = 0; i < s->num_channels; i++) {
>>>
>>
> 
> Actually it sounds more fishy. How packet_loss is reset w/out filling
> the frame?

Like that:
if (s->packet_loss) {
/* Reset number of saved bits so that the decoder does not start
 * to decode incomplete frames in the s->len_prefix == 0 case. */
s->num_saved_bits = 0;
s->packet_loss= 0;
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
}

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


Re: [FFmpeg-devel] [libav-devel] [PATCH 1/2] wmalosslessdec: avoid reading 0 bits with get_bits

2015-07-05 Thread Andreas Cadhalpun
On 03.07.2015 01:19, Luca Barbato wrote:
> On 03/07/15 00:07, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>  libavcodec/wmalosslessdec.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
>> index 843ce90..8094db3 100644
>> --- a/libavcodec/wmalosslessdec.c
>> +++ b/libavcodec/wmalosslessdec.c
>> @@ -488,7 +488,7 @@ static int decode_cdlms(WmallDecodeCtx *s)
>>  if ((1 << cbits) < s->cdlms[c][i].scaling + 1)
>>  cbits++;
>>  
>> -s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2;
>> +s->cdlms[c][i].bitsend = (cbits ? get_bits(&s->gb, cbits) : 
>> 0) + 2;
>>  shift_l = 32 - s->cdlms[c][i].bitsend;
>>  shift_r = 32 - s->cdlms[c][i].scaling - 2;
>>  for (j = 0; j < s->cdlms[c][i].coefsend; j++)
>>
> 
> cbits == 0 is valid?

I'm not sure, but it happens when s->cdlms[c][i].scaling is 0.

Best regards,
Andreas

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


Re: [FFmpeg-devel] [PATCH] library.mak: add rpath to shared libraries

2015-07-05 Thread Ganesh Ajjanagadde
On Sun, Jul 5, 2015 at 1:01 PM, Michael Niedermayer  wrote:
> On Sat, Jul 04, 2015 at 10:21:47AM -0400, Ganesh Ajjanagadde wrote:
>> On Sat, Jun 27, 2015 at 7:18 PM, Ganesh Ajjanagadde  wrote:
>> > On Sat, Jun 27, 2015 at 9:49 AM, Ganesh Ajjanagadde  
>> > wrote:
>> >> On Sat, Jun 27, 2015 at 2:22 AM, Hendrik Leppkes  
>> >> wrote:
>> >>> On Sat, Jun 27, 2015 at 3:09 AM, Ganesh Ajjanagadde
>> >>>  wrote:
>>  Fixes Ticket4673
>> 
>>  Signed-off-by: Ganesh Ajjanagadde 
>>  ---
>>   library.mak | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>>  diff --git a/library.mak b/library.mak
>>  index 29460b8..401da7c 100644
>>  --- a/library.mak
>>  +++ b/library.mak
>>  @@ -58,7 +58,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
>> 
>>   $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) 
>>  $(SUBDIR)lib$(NAME).ver
>>  $(SLIB_CREATE_DEF_CMD)
>>  -   $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) 
>>  $(FFEXTRALIBS)
>>  +   $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter 
>>  %.o,$$^) $(FFEXTRALIBS)
>>  $(SLIB_EXTRA_CMD)
>> >>>
>> >>> LDEXEFLAGS is clearly not the appropriate way to go about this. These
>> >>> flags are for executables, not for shared libraries.
>> >>>
>> >>> - Hendrik
>> >>
>> >> Ok, so is it fine if this gets added to LDFLAGS instead? Or should a
>> >> separate e.g LDLIBFLAGS be used?
>> >
>> > Attached is new patch that creates a LDLIBFLAGS.
>>
>> Ping.
>
> breaks build with mingw
>
> make
> ffmpeg/library.mak:111: *** commands commence before first target.  Stop.

Weird, builds fine with gcc. I don't have mingw with me, so can't
investigate this further.
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> There will always be a question for which you do not know the correct answer.
>
> ___
> 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] avfilter: add removegrain

2015-07-05 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 doc/filters.texi | 104 +++
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_removegrain.c | 660 +++
 4 files changed, 766 insertions(+)
 create mode 100644 libavfilter/vf_removegrain.c

diff --git a/doc/filters.texi b/doc/filters.texi
index 7cd0635..08bd97a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8005,6 +8005,110 @@ qp=2+2*sin(PI*qp)
 @end example
 @end itemize
 
+@section removegrain
+
+The removegrain filter is a spatial denoiser for progressive video.
+
+@table @option
+@item m0
+Set mode for the first plane.
+
+@item m1
+Set mode for the second plane.
+
+@item m2
+Set mode for the third plane.
+
+@item m3
+Set mode for the fourth plane.
+@end table
+
+Range of mode is from 0 to 24. Description of each mode follows:
+
+@table @var
+@item 0
+Leave input plane unchanged. Default.
+
+@item 1
+Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
+
+@item 2
+Clips the pixel with the second minimum and maximum of the 8 neighbour pixels.
+
+@item 3
+Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
+
+@item 4
+Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels.
+This is equivalent to a median filter.
+
+@item 5
+Line-sensitive clipping giving the minimal change.
+
+@item 6
+Line-sensitive clipping, intermediate.
+
+@item 7
+Line-sensitive clipping, intermediate.
+
+@item 8
+Line-sensitive clipping, intermediate.
+
+@item 9
+Line-sensitive clipping on a line where the neighbours pixels are the closest.
+
+@item 10
+Replaces the target pixel with the closest neighbour.
+
+@item 11
+[1 2 1] horizontal and vertical kernel blur.
+
+@item 12
+Same as mode 11.
+
+@item 13
+Bob mode, interpolates top field from the line where the neighbours
+pixels are the closest.
+
+@item 14
+Bob mode, interpolates bottom field from the line where the neighbours
+pixels are the closest.
+
+@item 15
+Bob mode, interpolates top field. Same as 13 but with a more complicated
+interpolation formula.
+
+@item 16
+Bob mode, interpolates bottom field. Same as 14 but with a more complicated
+interpolation formula.
+
+@item 17
+Clips the pixel with the minimum and maximum of respectively the maximum and
+minimum of each pair of opposite neighbour pixels.
+
+@item 18
+Line-sensitive clipping using opposite neighbours whose greatest distance from
+the current pixel is minimal.
+
+@item 19
+eplaces the pixel with the average of its 8 neighbours.
+
+@item 20
+Averages the 9 pixels ([1 1 1] horizontal and vertical blur).
+
+@item 21
+Clips pixels using the averages of opposite neighbour.
+
+@item 22
+Same as mode 21 but simpler and faster.
+
+@item 23
+Small edge and halo removal, but reputed useless.
+
+@item 24
+Similar as 23.
+@end table
+
 @section removelogo
 
 Suppress a TV station logo, using an image file to determine which
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 3e899f2..a623433 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -178,6 +178,7 @@ OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PSNR_FILTER)   += vf_psnr.o dualinput.o 
framesync.o
 OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o
 OBJS-$(CONFIG_QP_FILTER) += vf_qp.o
+OBJS-$(CONFIG_REMOVEGRAIN_FILTER)+= vf_removegrain.o
 OBJS-$(CONFIG_REMOVELOGO_FILTER) += bbox.o lswsutils.o lavfutils.o 
vf_removelogo.o
 OBJS-$(CONFIG_REPEATFIELDS_FILTER)   += vf_repeatfields.o
 OBJS-$(CONFIG_ROTATE_FILTER) += vf_rotate.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 6493389..ab0dc1d 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -193,6 +193,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(PSNR,   psnr,   vf);
 REGISTER_FILTER(PULLUP, pullup, vf);
 REGISTER_FILTER(QP, qp, vf);
+REGISTER_FILTER(REMOVEGRAIN,removegrain,vf);
 REGISTER_FILTER(REMOVELOGO, removelogo, vf);
 REGISTER_FILTER(REPEATFIELDS,   repeatfields,   vf);
 REGISTER_FILTER(ROTATE, rotate, vf);
diff --git a/libavfilter/vf_removegrain.c b/libavfilter/vf_removegrain.c
new file mode 100644
index 000..05cfd09
--- /dev/null
+++ b/libavfilter/vf_removegrain.c
@@ -0,0 +1,660 @@
+/*
+ * Copyright (c) 2012 Laurent de Soras
+ * Copyright (c) 2013 Fredrik Mellbin
+ * Copyright (c) 2015 Paul B Mahol
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without e

[FFmpeg-devel] [PATCH 3/4] lavc/utils: call add_metadata_from_side_data in ff_init_buffer_info

2015-07-05 Thread Marton Balint
This should ensure that each frame get its metadata from its proper packet
regardless of frame delays caused by reordering or threading.

Signed-off-by: Marton Balint 
---
 libavcodec/utils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 08fad3e..e1870f5 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -739,6 +739,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
+static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame);
+
 int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
 {
 AVPacket *pkt = avctx->internal->pkt;
@@ -772,6 +774,7 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame 
*frame)
 memcpy(frame_sd->data, packet_sd, size);
 }
 }
+add_metadata_from_side_data(pkt, frame);
 } else {
 frame->pkt_pts = AV_NOPTS_VALUE;
 av_frame_set_pkt_pos (frame, -1);
@@ -2406,7 +2409,6 @@ int attribute_align_arg 
avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
 if (picture->format == AV_PIX_FMT_NONE)   picture->format  
= avctx->pix_fmt;
 }
 }
-add_metadata_from_side_data(avctx->internal->pkt, picture);
 
 fail:
 emms_c(); //needed to avoid an emms_c() call before every return;
@@ -2548,7 +2550,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 frame->pkt_dts = avpkt->dts;
 }
 if (ret >= 0 && *got_frame_ptr) {
-add_metadata_from_side_data(avctx->internal->pkt, frame);
 avctx->frame_number++;
 av_frame_set_best_effort_timestamp(frame,
guess_correct_pts(avctx,
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 4/4] lavc/utils: get rid of add_metadata_from_side_data forward declaration

2015-07-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavcodec/utils.c | 24 +++-
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e1870f5..b80b4e7 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -739,7 +739,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
 }
 }
 
-static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame);
+static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame)
+{
+int size;
+const uint8_t *side_metadata;
+
+AVDictionary **frame_md = avpriv_frame_get_metadatap(frame);
+
+side_metadata = av_packet_get_side_data(avpkt,
+AV_PKT_DATA_STRINGS_METADATA, 
&size);
+return av_packet_unpack_dictionary(side_metadata, size, frame_md);
+}
 
 int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
 {
@@ -2299,18 +2309,6 @@ fail:
 return AVERROR_INVALIDDATA;
 }
 
-static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame)
-{
-int size;
-const uint8_t *side_metadata;
-
-AVDictionary **frame_md = avpriv_frame_get_metadatap(frame);
-
-side_metadata = av_packet_get_side_data(avpkt,
-AV_PKT_DATA_STRINGS_METADATA, 
&size);
-return av_packet_unpack_dictionary(side_metadata, size, frame_md);
-}
-
 static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame)
 {
 int ret;
-- 
2.1.4

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


[FFmpeg-devel] [PATCH 2/4] lavc/utils: change add_metadata_from_side_data to accept avpacket

2015-07-05 Thread Marton Balint
Signed-off-by: Marton Balint 
---
 libavcodec/utils.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index f20cafc..08fad3e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2296,14 +2296,14 @@ fail:
 return AVERROR_INVALIDDATA;
 }
 
-static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame)
+static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame)
 {
 int size;
 const uint8_t *side_metadata;
 
 AVDictionary **frame_md = avpriv_frame_get_metadatap(frame);
 
-side_metadata = av_packet_get_side_data(avctx->internal->pkt,
+side_metadata = av_packet_get_side_data(avpkt,
 AV_PKT_DATA_STRINGS_METADATA, 
&size);
 return av_packet_unpack_dictionary(side_metadata, size, frame_md);
 }
@@ -2406,7 +2406,7 @@ int attribute_align_arg 
avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
 if (picture->format == AV_PIX_FMT_NONE)   picture->format  
= avctx->pix_fmt;
 }
 }
-add_metadata_from_side_data(avctx, picture);
+add_metadata_from_side_data(avctx->internal->pkt, picture);
 
 fail:
 emms_c(); //needed to avoid an emms_c() call before every return;
@@ -2548,7 +2548,7 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 frame->pkt_dts = avpkt->dts;
 }
 if (ret >= 0 && *got_frame_ptr) {
-add_metadata_from_side_data(avctx, frame);
+add_metadata_from_side_data(avctx->internal->pkt, frame);
 avctx->frame_number++;
 av_frame_set_best_effort_timestamp(frame,
guess_correct_pts(avctx,
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] library.mak: add rpath to shared libraries

2015-07-05 Thread Michael Niedermayer
On Sat, Jul 04, 2015 at 10:21:47AM -0400, Ganesh Ajjanagadde wrote:
> On Sat, Jun 27, 2015 at 7:18 PM, Ganesh Ajjanagadde  wrote:
> > On Sat, Jun 27, 2015 at 9:49 AM, Ganesh Ajjanagadde  
> > wrote:
> >> On Sat, Jun 27, 2015 at 2:22 AM, Hendrik Leppkes  
> >> wrote:
> >>> On Sat, Jun 27, 2015 at 3:09 AM, Ganesh Ajjanagadde
> >>>  wrote:
>  Fixes Ticket4673
> 
>  Signed-off-by: Ganesh Ajjanagadde 
>  ---
>   library.mak | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
>  diff --git a/library.mak b/library.mak
>  index 29460b8..401da7c 100644
>  --- a/library.mak
>  +++ b/library.mak
>  @@ -58,7 +58,7 @@ $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
> 
>   $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SLIBOBJS) 
>  $(SUBDIR)lib$(NAME).ver
>  $(SLIB_CREATE_DEF_CMD)
>  -   $$(LD) $(SHFLAGS) $(LDFLAGS) $$(LD_O) $$(filter %.o,$$^) 
>  $(FFEXTRALIBS)
>  +   $$(LD) $(SHFLAGS) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter 
>  %.o,$$^) $(FFEXTRALIBS)
>  $(SLIB_EXTRA_CMD)
> >>>
> >>> LDEXEFLAGS is clearly not the appropriate way to go about this. These
> >>> flags are for executables, not for shared libraries.
> >>>
> >>> - Hendrik
> >>
> >> Ok, so is it fine if this gets added to LDFLAGS instead? Or should a
> >> separate e.g LDLIBFLAGS be used?
> >
> > Attached is new patch that creates a LDLIBFLAGS.
> 
> Ping.

breaks build with mingw

make
ffmpeg/library.mak:111: *** commands commence before first target.  Stop.

[...]
-- 
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


[FFmpeg-devel] [PATCH 1/4] lavc/utils: remove redundant call to ff_init_buffer_info

2015-07-05 Thread Marton Balint
It does the same as calling ff_decode_frame_props.

Signed-off-by: Marton Balint 
---
 libavcodec/utils.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e6d5227..f20cafc 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -892,8 +892,6 @@ static int get_buffer_internal(AVCodecContext *avctx, 
AVFrame *frame, int flags)
 ret = ff_decode_frame_props(avctx, frame);
 if (ret < 0)
 return ret;
-if ((ret = ff_init_buffer_info(avctx, frame)) < 0)
-return ret;
 
 if (hwaccel) {
 if (hwaccel->alloc_frame) {
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] movtextdec.c: Add support for highlight and hilightcolor box

2015-07-05 Thread Philip Langdale
On Sun,  5 Jul 2015 15:53:32 +0530
Niklesh Lalwani  wrote:

> From: Niklesh 
> 
> This patch adds support for decoding of Highlight and hilightcolor
> box as defined by 3GPP standards. The code is also reorganised to
> make it easier to maintain and read. Separate functions are defined
> that process each type of box. Signed-off-by: Niklesh

Looking good. Just a couple of comments below - and make sure your
commit description doesn't go past 72 columns.

>  --- libavcodec/movtextdec.c | 253
>  1 file changed, 172
> insertions(+), 81 deletions(-)
> 
> diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
> index a3afd91..0dab0b4 100644
> --- a/libavcodec/movtextdec.c
> +++ b/libavcodec/movtextdec.c
> @@ -37,31 +37,157 @@ typedef struct {
>  uint8_t style_flag;
>  } StyleBox;
>  
> +typedef struct {
> +uint16_t hlit_start;
> +uint16_t hlit_end;
> +} HighlightBox;
> +
> +typedef struct {
> +   uint8_t hlit_color[4];
> +} HilightcolorBox;
> +
> +typedef struct {
> +int styl;
> +int hlit;
> +int hclr;
> +} Box_flags;

You can use a single uint8_t here and bit flags, like you did for
the STYLE_FLAGs.

> +
> +typedef struct {
> +StyleBox **s;
> +StyleBox *s_temp;
> +HighlightBox h;
> +HilightcolorBox c;
> +Box_flags f;
> +uint16_t style_entries;
> +uint64_t tracksize;
> +int size_var;
> +int count_s;
> +} MovTextContext;
> +
> +struct Box
> +{
> +uint32_t type;
> +size_t base_size;
> +int (*decode)(const uint8_t *tsmb, MovTextContext *m, AVPacket
> *avpkt); +};
> +
> +static void mov_text_cleanup(MovTextContext *m)
> +{
> +int i;
> +if (m->f.styl) {
> +for(i = 0; i < m->count_s; i++) {
> +av_freep(&m->s[i]);
> +}
> +av_freep(&m->s);
> +}
> +}
> +
> +static int decode_hlit(const uint8_t *tsmb, MovTextContext *m,
> AVPacket *avpkt) +{
> +m->f.hlit = 1;
> +m->h.hlit_start = AV_RB16(tsmb);
> +tsmb += 2;
> +m->h.hlit_end = AV_RB16(tsmb);
> +tsmb += 2;
> +return 0;
> +}
> +
> +static int decode_hclr(const uint8_t *tsmb, MovTextContext *m,
> AVPacket *avpkt) +{
> +m->f.hclr = 1;
> +m->c.hlit_color[0] = *tsmb++;
> +m->c.hlit_color[1] = *tsmb++;
> +m->c.hlit_color[2] = *tsmb++;
> +m->c.hlit_color[3] = *tsmb++;
> +return 0;
> +}
> +
> +static int decode_styl(const uint8_t *tsmb, MovTextContext *m,
> AVPacket *avpkt) +{
> +int i;
> +m->style_entries = AV_RB16(tsmb);
> +tsmb += 2;
> +// A single style record is of length 12 bytes.
> +if (m->tracksize + m->size_var + 2 + m->style_entries * 12 >
> avpkt->size)
> +return -1;
> +
> +m->f.styl = 1;
> +for(i = 0; i < m->style_entries; i++) {
> +m->s_temp = av_malloc(sizeof(StyleBox));
> +if (!m->s_temp) {
> +mov_text_cleanup(m);
> +return AVERROR(ENOMEM);
> +}
> +m->s_temp->style_start = AV_RB16(tsmb);
> +tsmb += 2;
> +m->s_temp->style_end = AV_RB16(tsmb);
> +tsmb += 2;
> +// fontID = AV_RB16(tsmb);
> +tsmb += 2;
> +m->s_temp->style_flag = AV_RB8(tsmb);
> +av_dynarray_add(&m->s, &m->count_s, m->s_temp);
> +if(!m->s) {
> +mov_text_cleanup(m);
> +return AVERROR(ENOMEM);
> +}
> +// fontsize = AV_RB8(tsmb);
> +tsmb += 2;
> +// text-color-rgba
> +tsmb += 4;
> +}
> +return 0;
> +}
> +
> +struct Box box_types[] = {
> +{ MKBETAG('s','t','y','l'), 2, decode_styl },
> +{ MKBETAG('h','l','i','t'), 4, decode_hlit },
> +{ MKBETAG('h','c','l','r'), 4, decode_hclr }
> +};
> +
> +const static size_t box_count = sizeof(box_types) / sizeof(struct
> Box); +
>  static int text_to_ass(AVBPrint *buf, const char *text, const char
> *text_end,
> -StyleBox **s, int style_entries)
> +MovTextContext *m)
>  {
>  int i = 0;
>  int text_pos = 0;
>  while (text < text_end) {
> -for (i = 0; i < style_entries; i++) {
> -if (s[i]->style_flag && text_pos == s[i]->style_end) {
> -if (s[i]->style_flag & STYLE_FLAG_BOLD)
> -av_bprintf(buf, "{\\b0}");
> -if (s[i]->style_flag & STYLE_FLAG_ITALIC)
> -av_bprintf(buf, "{\\i0}");
> -if (s[i]->style_flag & STYLE_FLAG_UNDERLINE)
> -av_bprintf(buf, "{\\u0}");
> +if (m->f.styl) {
> +for (i = 0; i < m->style_entries; i++) {
> +if (m->s[i]->style_flag && text_pos ==
> m->s[i]->style_end) {
> +if (m->s[i]->style_flag & STYLE_FLAG_BOLD)
> +av_bprintf(buf, "{\\b0}");
> +if (m->s[i]->style_flag & STYLE_FLAG_ITALIC)
> +av_bprintf(buf, "{\\i0}");
> +if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
> +

[FFmpeg-devel] [PATCH] aacenc: fix option descriptions

2015-07-05 Thread Rostislav Pehlivanov
Since the new PNS implementation has been merged and is no longer considered 
proof of concept (as it's much more complex and better than the previous), 
change the comments to reflect that. We need people testing it (since all AAC 
profiles require it to be on by default) and having it tagged as proof of 
concept might drive some away.
---
 libavcodec/aacenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index a4248ff..f05f51b 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -879,10 +879,10 @@ static const AVOption aacenc_options[] = {
 {"twoloop",  "Two loop searching method", 0, AV_OPT_TYPE_CONST, {.i64 
= AAC_CODER_TWOLOOP}, INT_MIN, INT_MAX, AACENC_FLAGS, "aac_coder"},
 {"fast", "Constant quantizer",0, AV_OPT_TYPE_CONST, {.i64 
= AAC_CODER_FAST},INT_MIN, INT_MAX, AACENC_FLAGS, "aac_coder"},
 {"aac_pns", "Perceptual Noise Substitution", offsetof(AACEncContext, 
options.pns), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AACENC_FLAGS, "aac_pns"},
-{"disable",  "Disable PNS", 0, AV_OPT_TYPE_CONST, {.i64 =  0 }, 
INT_MIN, INT_MAX, AACENC_FLAGS, "aac_pns"},
-{"enable",   "Enable PNS (Proof of concept)",  0, AV_OPT_TYPE_CONST, 
{.i64 =  1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "aac_pns"},
+{"disable",  "Disable perceptual noise substitution", 0, 
AV_OPT_TYPE_CONST, {.i64 =  0 }, INT_MIN, INT_MAX, AACENC_FLAGS, "aac_pns"},
+{"enable",   "Enable perceptual noise substitution",  0, 
AV_OPT_TYPE_CONST, {.i64 =  1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "aac_pns"},
 {"aac_is", "Intensity stereo coding", offsetof(AACEncContext, 
options.intensity_stereo), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, AACENC_FLAGS, 
"intensity_stereo"},
-{"disable", "Disable intensity stereo coding", 0, AV_OPT_TYPE_CONST, 
{.i64 = 0}, INT_MIN, INT_MAX, AACENC_FLAGS, "intensity_stereo"},
+{"disable",  "Disable intensity stereo coding", 0, AV_OPT_TYPE_CONST, 
{.i64 = 0}, INT_MIN, INT_MAX, AACENC_FLAGS, "intensity_stereo"},
 {"enable",   "Enable intensity stereo coding", 0, AV_OPT_TYPE_CONST, 
{.i64 = 1}, INT_MIN, INT_MAX, AACENC_FLAGS, "intensity_stereo"},
 {NULL}
 };
-- 
2.1.4

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


Re: [FFmpeg-devel] [PATCH] texi2pod: fix an unescaped left brace

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 10:05:51PM -0300, James Almer wrote:
> On 01/07/15 6:32 PM, James Almer wrote:
> > This silences some deprecation warnings
> > 
> > Signed-off-by: James Almer 
> > ---
> >  doc/texi2pod.pl | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
> > index e1ff6b4..9a9b34f 100644
> > --- a/doc/texi2pod.pl
> > +++ b/doc/texi2pod.pl
> > @@ -384,7 +384,7 @@ sub postprocess
> >  # @* is also impossible in .pod; we discard it and any newline that
> >  # follows it.  Similarly, our macro @gol must be discarded.
> >  
> > -s/\@anchor{(?:[^\}]*)\}//g;
> > +s/\@anchor\{(?:[^\}]*)\}//g;
> >  s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
> >  s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
> >  s/;\s+\@pxref\{(?:[^\}]*)\}//g;
> > 
> 
> Ping.

it looks good to me but this is not my area ...

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


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


Re: [FFmpeg-devel] [PATCH v2 8/8] aacenc: implement Intensity Stereo encoding support

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 12:11:18AM -0300, Claudio Freire wrote:
> On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov
>  wrote:
> > This commit implements intensity stereo coding support to the native aac 
> > encoder. This is a way to increase the efficiency of the encoder by zeroing 
> > the right channel's spectral coefficients (in a channel pair) and 
> > rederiving them in the decoder using information from the scalefactor 
> > indices of special band types. This commit confomrs to the official ISO 
> > 13818-7 specifications, although due to their ambiguity certain deviations 
> > have been taken to ensure maximum sound quality. This commit has been 
> > extensively tested and has shown to not result in audiable audio artifacts 
> > unless in extreme cases. This commit also adds an option, aac_is, which has 
> > the value of 0 by default. Intensity Stereo is part of the scalable aac 
> > profile and is thus non-default.
> >
> > The way IS coding works is that it rederives the right channel's spectral 
> > coefficients from the left channel via the scalefactor index values left in 
> > the right channel. Since an entire band's spectral coefficients do not need 
> > to be coded, the encoder's efficiency jumps up and it unzeroes some high 
> > frequency values which it previously did not have enough bits to encode. 
> > That way less information is lost than the information lost by rederiving 
> > the spectral coefficients with some error. This is why the filesize of 
> > files encoded with IS do not decrease significantly. Users wishing that IS 
> > coding should reduce filesize are expected to reduce their encoding 
> > bitrates appropriately.
> >
> > This is V2 of the commit. The old version did not mark ms_mask as 0 since 
> > M/S and IS coding are incompactible, which resulted in distortions with M/S 
> > coding enabled. This version also improves phase detection by measuring it 
> > for every spectral coefficient in the band and using a simple majority rule 
> > to determine whether the coefficients are in or out of phase. Also, the 
> > energy values per spectral coefficient were changed as to reflect the 
> > official specifications.
> 
> 

> This one also looks identical to a WIP I thoroughly tested, so I
> believe this means the whole set is good to be pushed,

> if a committer
> agrees.

its really your decission not the commiters you are basically the
maintainer/expert about this code

applied

thanks

[...]
-- 
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


Re: [FFmpeg-devel] [PATCH v2 7/8] aacenc: add support for coding of IS spectral coefficients

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 12:09:34AM -0300, Claudio Freire wrote:
> On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov
>  wrote:
> > This commit adds support for the coding of intensity stereo spectral 
> > coefficients. It also fixes the Mid/Side coding of band_types higher than 
> > RESERVED_BT (M/S must not be applied to their spectral coefficients, but 
> > marking M/S as present in encode_ms_info() is okay). Much of the changes 
> > here were taken from the decoder and inverted. This commit does not change 
> > the functionality of the decoder as the previous patch in this series 
> > zeroes ms_mask and is_mask.
> >
> > Reviewed-by: Claudio Freire 
> 
> 
> Indeed, LGTM

applied

thaks

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


Re: [FFmpeg-devel] [PATCH-v2] avcodec: add new Videotoolbox hwaccel.

2015-07-05 Thread Hendrik Leppkes
On Sun, Jul 5, 2015 at 5:00 PM, Sebastien Zwickert  wrote:
>
>> On 05 Jul 2015, at 16:41, Sebastien Zwickert  wrote:
>>
>> As VDA is a wrapper of VideoToolbox framework, the changes base vda 
>> implementation
>> upon the videotoolbox implementation to factorize common part of code.
>
> This new patch does not break previous VDA implementation when VideoToolbox 
> is disabled
> or not public in Mac OS version prior to 10.8.
> Unfortunately,  I can’t test on a 10.6 or 10.7 box because my hardware is 
> supported by
> hardware acceleration only since 10.8.
>
> At least it returns me the right error when I try to use VDA on Mac OS 10.6.8 
> :
>
> [h264 @ 0x102906a00] Cannot initialize VDA -12470
>
> Where -12470 means not supported hardware from  VDA decoder API results code:
>
> kVDADecoderHardwareNotSupportedErr  = -12470
>
> Does anyone has supported hardware box running on these OS’s and have time to 
> make some tests ?
> It would be nice to report the results of the tests here.

For me the most important fact would be that I can build a binary with
VDA support, which will still run on 10.6, even if HWAccel does not
work on 10.6 - ie. no runtime dependency problems.
You seem to have that test covered, so thanks!

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


Re: [FFmpeg-devel] [PATCH-v2] avcodec: add new Videotoolbox hwaccel.

2015-07-05 Thread Sebastien Zwickert

> On 05 Jul 2015, at 16:41, Sebastien Zwickert  wrote:
> 
> delete mode 100644 ffmpeg_vda.c
> create mode 100644 ffmpeg_videotoolbox.c

-M as arguments to the format-patch CLI does not detect these as rename...

> rename libavcodec/{vda_internal.h => vda_vt_internal.h} (50%)

while these changes are detected.


Have I missed something ?


—
Sebastien Zwickert

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


Re: [FFmpeg-devel] [PATCH-v2] avcodec: add new Videotoolbox hwaccel.

2015-07-05 Thread Sebastien Zwickert

> On 05 Jul 2015, at 16:41, Sebastien Zwickert  wrote:
> 
> As VDA is a wrapper of VideoToolbox framework, the changes base vda 
> implementation
> upon the videotoolbox implementation to factorize common part of code.

This new patch does not break previous VDA implementation when VideoToolbox is 
disabled
or not public in Mac OS version prior to 10.8.
Unfortunately,  I can’t test on a 10.6 or 10.7 box because my hardware is 
supported by
hardware acceleration only since 10.8.

At least it returns me the right error when I try to use VDA on Mac OS 10.6.8 :

[h264 @ 0x102906a00] Cannot initialize VDA -12470

Where -12470 means not supported hardware from  VDA decoder API results code:

kVDADecoderHardwareNotSupportedErr  = -12470

Does anyone has supported hardware box running on these OS’s and have time to 
make some tests ?
It would be nice to report the results of the tests here.


—
Sebastien Zwickert

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


Re: [FFmpeg-devel] [PATCH v2 5/8] aacenc: use the new function for setting special band scalefactor indices

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 08:53:32AM -0300, Claudio Freire wrote:
> On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov
>  wrote:
> > This commit enables the function added with commit 7c10b87 and uses that 
> > new function for setting any special scalefactor indices. This commit does 
> > not change the behaviour of the encoder since no bands are being marked as 
> > either NOISE_BT(due to the previous PNS implementation removed in the 
> > previous commit) or INTENSITY_BT2/INTENSITY_BT.
> 
> 
> LGTM in conjunction with other patches in the set

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


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


Re: [FFmpeg-devel] [PATCH v2 2/8] aaccoder: remove previous PNS implementation from twoloop

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 08:52:48AM -0300, Claudio Freire wrote:
> On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov
>  wrote:
> > This commit undoes commit c5d4f87e8427c0952278ec247fa8ab1e6e52 and 
> > removes PNS band marking from the twoloop coder, which has been 
> > reimplemented in a better way in this series of patches.
> 
> 
> LGTM as long as the rest of the patch set is committed as well

applied

thanks

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

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


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


Re: [FFmpeg-devel] [PATCH v2 6/8] aaccoder: add a new perceptual noise substitution implementation

2015-07-05 Thread Michael Niedermayer
On Fri, Jul 03, 2015 at 12:07:42AM -0300, Claudio Freire wrote:
> On Thu, Jul 2, 2015 at 3:13 PM, Rostislav Pehlivanov
>  wrote:
> > This commit finalizes the PNS implementation previously added to the 
> > encoder by moving it to a seperate function search_for_pns() and thus 
> > making it coder-generic. This new implementation makes use of the spread 
> > field of the psy bands and the lambda quality feedback paremeter. The 
> > spread of the spectrum in a band prevents PNS from being used excessively 
> > and thus preserve more phase information in high frequencies.  The lambda 
> > parameter allows the number of PNS-marked bands to vary based on the lambda 
> > parameter and the amount of bits available, making better choices on which 
> > bands are to be marked as noise. Comparisons with the previous PNS 
> > implementation can be found here: 
> > https://trac.ffmpeg.org/attachment/wiki/Encode/AAC/
> >
> > This is V2 of the patch, the changes from the previous version being that 
> > this version uses the new band->spread metric from aacpsy and normalizes 
> > the energy using the group size. These changes were suggested by Claudio 
> > Freire on the mailing list. Another change is the use of lambda to alter 
> > the frequency threshold. This change makes the actual threshold frequencies 
> > vary between +-2Khz of what's specified, depending on frame encoding 
> > performance.
> 
> 
> LGTM. I probably should mention I already thoroughly tested a WIP
> version of the patch (which looks identical).

applied

thanks

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


[FFmpeg-devel] [PATCH-v2] avcodec: add new Videotoolbox hwaccel.

2015-07-05 Thread Sebastien Zwickert
As VDA is a wrapper of VideoToolbox framework, the changes base vda 
implementation
upon the videotoolbox implementation to factorize common part of code.

The changes allow the user to request a custom pixel format to the decoder
via a CLI option called videotoolbox_pixfmt.

---
 Changelog|   1 +
 MAINTAINERS  |   1 +
 Makefile |   5 +-
 configure|  19 +-
 ffmpeg.h |   3 +
 ffmpeg_opt.c |   8 +-
 ffmpeg_vda.c | 136 -
 ffmpeg_videotoolbox.c| 187 ++
 libavcodec/Makefile  |  12 +-
 libavcodec/allcodecs.c   |   5 +
 libavcodec/h263dec.c |   3 +
 libavcodec/h264_slice.c  |   4 +
 libavcodec/mpeg12dec.c   |   3 +
 libavcodec/vda.c |   2 +-
 libavcodec/vda_h264.c| 154 +
 libavcodec/{vda_internal.h => vda_vt_internal.h} |  32 +-
 libavcodec/version.h |   2 +-
 libavcodec/videotoolbox.c| 690 +++
 libavcodec/videotoolbox.h| 126 +
 libavutil/pixdesc.c  |   4 +
 libavutil/pixfmt.h   |   2 +
 21 files changed, 1112 insertions(+), 287 deletions(-)
 delete mode 100644 ffmpeg_vda.c
 create mode 100644 ffmpeg_videotoolbox.c
 rename libavcodec/{vda_internal.h => vda_vt_internal.h} (50%)
 create mode 100644 libavcodec/videotoolbox.c
 create mode 100644 libavcodec/videotoolbox.h

diff --git a/Changelog b/Changelog
index 9363608..7b38a8d 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@ version :
 - Many improvements to the JPEG 2000 decoder
 - Go2Meeting decoding support
 - adrawgraph audio and drawgraph video filter
+- OS X VideoToolbox support
 
 
 version 2.7:
diff --git a/MAINTAINERS b/MAINTAINERS
index fa9e966..7d6beaf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -303,6 +303,7 @@ Hardware acceleration:
   vaapi*Gwenole Beauchesne
   vda*  Sebastien Zwickert
   vdpau*Carl Eugen Hoyos
+  videotoolbox* Sebastien Zwickert
 
 
 libavdevice
diff --git a/Makefile b/Makefile
index 69f371b..d13bef9 100644
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,10 @@ $(foreach prog,$(AVBASENAMES),$(eval 
OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_o
 OBJS-ffmpeg   += ffmpeg_opt.o ffmpeg_filter.o
 OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o
 OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o
-OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_vda.o
+ifndef CONFIG_VIDEOTOOLBOX
+OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
+endif
+OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
 OBJS-ffserver += ffserver_config.o
 
 TESTTOOLS   = audiogen videogen rotozoom tiny_psnr tiny_ssim base64
diff --git a/configure b/configure
index cc23991..667de20 100755
--- a/configure
+++ b/configure
@@ -155,6 +155,7 @@ Hardware accelerators:
   --disable-vaapi  disable VAAPI code [autodetect]
   --disable-vdadisable VDA code [autodetect]
   --disable-vdpau  disable VDPAU code [autodetect]
+  --enable-videotoolboxenable VideoToolbox code [autodetect]
 
 Individual component options:
   --disable-everything disable all components listed below
@@ -1463,6 +1464,7 @@ HWACCEL_LIST="
 vaapi
 vda
 vdpau
+videotoolbox
 xvmc
 "
 
@@ -2342,14 +2344,18 @@ d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
 vaapi_deps="va_va_h"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
-vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
+vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore -framework CoreServices"
 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
+videotoolbox_deps="VideoToolbox_VideoToolbox_h pthreads"
+videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox 
-framework CoreMedia -framework QuartzCore -framework CoreServices"
 xvmc_deps="X11_extensions_XvMClib_h"
 
 h263_vaapi_hwaccel_deps="vaapi"
 h263_vaapi_hwaccel_select="h263_decoder"
 h263_vdpau_hwaccel_deps="vdpau"
 h263_vdpau_hwaccel_select="h263_decoder"
+h263_videotoolbox_hwaccel_deps="videotoolbox"
+h263_videotoolbox_hwaccel_select="h263_decoder"
 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
 h264_d3d11va_hwaccel_deps="d3d11va"
 h264_d3d11va_hwaccel_select="h264_decoder"
@@ -2372,6 +2378,8 @@ h264_vdpau_decoder_deps="vdpau"
 h264_vdpau_decoder_select="h264_d

Re: [FFmpeg-devel] [PATCH] avcodec: add new Videotoolbox hwaccel.

2015-07-05 Thread Sebastien Zwickert

> On 01 Jul 2015, at 05:57, Zhang Rui  wrote:
> 
>> +static void videotoolbox_default_free(AVCodecContext *avctx)
>> +{
>> +AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;
>> +
>> +if (videotoolbox) {
>> +if (videotoolbox->cm_fmt_desc)
>> +CFRelease(videotoolbox->cm_fmt_desc);
>> +
>> +if (videotoolbox->session)
> 
> Better add VTDecompressionSessionWaitForAsynchronousFrames() here,
> in case it is removed from videotoolbox_session_decode_frame() in
> future by chance.
> 
> Callback could be called even after VTDecompressionSessionInvalidate()
> when I try to work with flag kVTDecodeFrame_EnableAsynchronousDecompression
> and without VTDecompressionSessionWaitForAsynchronousFrames() per sample
> in my own player.

Thanks for the information.

In asynchronous decoding the VTDecompressionSessionWaitForAsynchronousFrames() 
function
should be called before invalidating the decompression session in order to 
flush delayed frames
(this function automatically calls the 
VTDecompressionSessionFinishDelayedFrames() function).

In the current implementation the kVTDecodeFrame_EnableAsynchronousDecompression
flag is not set and the user is not able to change the parameters passed to the 
videotoolbox
decode function. So the decoding is synchronous and the current place for 
flushing the delayed
frames is a good one :)

>> [...]


Best Regards,
--
Sebastien Zwickert
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 02:36:15PM +0200, Michael Niedermayer wrote:
> On Sun, Jul 05, 2015 at 03:51:07AM +0200, Michael Niedermayer wrote:
> > On Sat, Jul 04, 2015 at 01:15:51PM +0200, Michael Niedermayer wrote:
> > > On Sat, Jul 04, 2015 at 12:45:18PM +0200, Michael Niedermayer wrote:
> > > > On Fri, Jul 03, 2015 at 07:53:43PM +0200, Michael Niedermayer wrote:
> > > > > Hi all
> > > > > 
> > > > > It is POSSIBLE that we need to move to different servers/hosting.
> > > > > We have been informed that the free hosting and servers we use
> > > > > currently may become unavailable in the future.
> > > > > 
> > > > > Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with
> > > > > a free server and hosting, knows of some company who might provide us
> > > > > with that or wants to sponsor a server & hosting
> > > > > please reply ASAP
> > > > > 
> > > > > Thank you!
> > > > > 
> > > > > PS: please use reply to all so the thread does not get fragmented
> > > > > between mailing lists
> > > > 
> > > > The possibility changed to the worse
> > > > we must move
> > > > 
> > > > no details known ATM but if you can help please join
> > > > https://lists.sourceforge.net/lists/listinfo/ffmpeg-admins
> > > > used SF as i had nothing else, feel free to setup a better ML
> > > 
> > > note, to make this clear there will be no ffmpeg.org or mplayerhq.hu
> > > soon if noone helps
> > > we need a server we need volunteers to help with the move
> > 
> > quick update
> > we got a new server and transferred many things already (ill write
> > more later)
> > what is not transferred yet is trac and mailman
> > if someone reading this knows mailman and want to help please join
> > ##ffmpeg-admin on freenode
> 
> we will attempt to switch MX & lists.* that is mainly for mailman to
> the new server now it is possible that there will be some turbulences.
> All people with postfix & mailman experience are welcome in
> ##ffmpeg-admin
> 
> people who (un)subscribed within the last 24h might need to redo that

all lists* and MX should be switched now

if anyone has suggestions / experience with spam filtering with
postfix dont hesitate to post the suggestions
but any solution must be secure

[]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope


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


Re: [FFmpeg-devel] FFmpeg/MPlayer/rtmpdump possibly searching for a new server and hosting

2015-07-05 Thread Michael Niedermayer
On Sun, Jul 05, 2015 at 03:51:07AM +0200, Michael Niedermayer wrote:
> On Sat, Jul 04, 2015 at 01:15:51PM +0200, Michael Niedermayer wrote:
> > On Sat, Jul 04, 2015 at 12:45:18PM +0200, Michael Niedermayer wrote:
> > > On Fri, Jul 03, 2015 at 07:53:43PM +0200, Michael Niedermayer wrote:
> > > > Hi all
> > > > 
> > > > It is POSSIBLE that we need to move to different servers/hosting.
> > > > We have been informed that the free hosting and servers we use
> > > > currently may become unavailable in the future.
> > > > 
> > > > Thus if someone can provide the FFmpeg/MPlayer/rtmpdump projects with
> > > > a free server and hosting, knows of some company who might provide us
> > > > with that or wants to sponsor a server & hosting
> > > > please reply ASAP
> > > > 
> > > > Thank you!
> > > > 
> > > > PS: please use reply to all so the thread does not get fragmented
> > > > between mailing lists
> > > 
> > > The possibility changed to the worse
> > > we must move
> > > 
> > > no details known ATM but if you can help please join
> > > https://lists.sourceforge.net/lists/listinfo/ffmpeg-admins
> > > used SF as i had nothing else, feel free to setup a better ML
> > 
> > note, to make this clear there will be no ffmpeg.org or mplayerhq.hu
> > soon if noone helps
> > we need a server we need volunteers to help with the move
> 
> quick update
> we got a new server and transferred many things already (ill write
> more later)
> what is not transferred yet is trac and mailman
> if someone reading this knows mailman and want to help please join
> ##ffmpeg-admin on freenode

we will attempt to switch MX & lists.* that is mainly for mailman to
the new server now it is possible that there will be some turbulences.
All people with postfix & mailman experience are welcome in
##ffmpeg-admin

people who (un)subscribed within the last 24h might need to redo that

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


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/nvenc: Add support for H.264 High 444 Predictive encoding

2015-07-05 Thread Timo Rothenpieler
> Newer versions of the nvenc hardware support The High 444 Predictive profile
> of H.264, and can also do lossless encoding under this profile if desired.
> 
> This change introduces support for the profile, and exposes the appropriate
> presets for requesting lossless encoding.
> 
> I tested lossless by generating a baseline sample with testsrc converted
> to raw yuv444p, then encoded the sample with nvenc, then did a framemd5
> comparision of both the raw video and the nvenc encode. The framemd5
> reports were identical.
> 
> Signed-off-by: Philip Langdale 

pushed, thanks.


Timo



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


[FFmpeg-devel] [PATCH] movtextdec.c: Add support for highlight and hilightcolor box

2015-07-05 Thread Niklesh Lalwani
From: Niklesh 

This patch adds support for decoding of Highlight and hilightcolor box as 
defined by 3GPP standards. 
The code is also reorganised to make it easier to maintain and read. Separate 
functions are defined that process each type of box.
Signed-off-by: Niklesh 
---
 libavcodec/movtextdec.c | 253 
 1 file changed, 172 insertions(+), 81 deletions(-)

diff --git a/libavcodec/movtextdec.c b/libavcodec/movtextdec.c
index a3afd91..0dab0b4 100644
--- a/libavcodec/movtextdec.c
+++ b/libavcodec/movtextdec.c
@@ -37,31 +37,157 @@ typedef struct {
 uint8_t style_flag;
 } StyleBox;
 
+typedef struct {
+uint16_t hlit_start;
+uint16_t hlit_end;
+} HighlightBox;
+
+typedef struct {
+   uint8_t hlit_color[4];
+} HilightcolorBox;
+
+typedef struct {
+int styl;
+int hlit;
+int hclr;
+} Box_flags;
+
+typedef struct {
+StyleBox **s;
+StyleBox *s_temp;
+HighlightBox h;
+HilightcolorBox c;
+Box_flags f;
+uint16_t style_entries;
+uint64_t tracksize;
+int size_var;
+int count_s;
+} MovTextContext;
+
+struct Box
+{
+uint32_t type;
+size_t base_size;
+int (*decode)(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt);
+};
+
+static void mov_text_cleanup(MovTextContext *m)
+{
+int i;
+if (m->f.styl) {
+for(i = 0; i < m->count_s; i++) {
+av_freep(&m->s[i]);
+}
+av_freep(&m->s);
+}
+}
+
+static int decode_hlit(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
+{
+m->f.hlit = 1;
+m->h.hlit_start = AV_RB16(tsmb);
+tsmb += 2;
+m->h.hlit_end = AV_RB16(tsmb);
+tsmb += 2;
+return 0;
+}
+
+static int decode_hclr(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
+{
+m->f.hclr = 1;
+m->c.hlit_color[0] = *tsmb++;
+m->c.hlit_color[1] = *tsmb++;
+m->c.hlit_color[2] = *tsmb++;
+m->c.hlit_color[3] = *tsmb++;
+return 0;
+}
+
+static int decode_styl(const uint8_t *tsmb, MovTextContext *m, AVPacket *avpkt)
+{
+int i;
+m->style_entries = AV_RB16(tsmb);
+tsmb += 2;
+// A single style record is of length 12 bytes.
+if (m->tracksize + m->size_var + 2 + m->style_entries * 12 > avpkt->size)
+return -1;
+
+m->f.styl = 1;
+for(i = 0; i < m->style_entries; i++) {
+m->s_temp = av_malloc(sizeof(StyleBox));
+if (!m->s_temp) {
+mov_text_cleanup(m);
+return AVERROR(ENOMEM);
+}
+m->s_temp->style_start = AV_RB16(tsmb);
+tsmb += 2;
+m->s_temp->style_end = AV_RB16(tsmb);
+tsmb += 2;
+// fontID = AV_RB16(tsmb);
+tsmb += 2;
+m->s_temp->style_flag = AV_RB8(tsmb);
+av_dynarray_add(&m->s, &m->count_s, m->s_temp);
+if(!m->s) {
+mov_text_cleanup(m);
+return AVERROR(ENOMEM);
+}
+// fontsize = AV_RB8(tsmb);
+tsmb += 2;
+// text-color-rgba
+tsmb += 4;
+}
+return 0;
+}
+
+struct Box box_types[] = {
+{ MKBETAG('s','t','y','l'), 2, decode_styl },
+{ MKBETAG('h','l','i','t'), 4, decode_hlit },
+{ MKBETAG('h','c','l','r'), 4, decode_hclr }
+};
+
+const static size_t box_count = sizeof(box_types) / sizeof(struct Box);
+
 static int text_to_ass(AVBPrint *buf, const char *text, const char *text_end,
-StyleBox **s, int style_entries)
+MovTextContext *m)
 {
 int i = 0;
 int text_pos = 0;
 while (text < text_end) {
-for (i = 0; i < style_entries; i++) {
-if (s[i]->style_flag && text_pos == s[i]->style_end) {
-if (s[i]->style_flag & STYLE_FLAG_BOLD)
-av_bprintf(buf, "{\\b0}");
-if (s[i]->style_flag & STYLE_FLAG_ITALIC)
-av_bprintf(buf, "{\\i0}");
-if (s[i]->style_flag & STYLE_FLAG_UNDERLINE)
-av_bprintf(buf, "{\\u0}");
+if (m->f.styl) {
+for (i = 0; i < m->style_entries; i++) {
+if (m->s[i]->style_flag && text_pos == m->s[i]->style_end) {
+if (m->s[i]->style_flag & STYLE_FLAG_BOLD)
+av_bprintf(buf, "{\\b0}");
+if (m->s[i]->style_flag & STYLE_FLAG_ITALIC)
+av_bprintf(buf, "{\\i0}");
+if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
+av_bprintf(buf, "{\\u0}");
+}
+}
+for (i = 0; i < m->style_entries; i++) {
+if (m->s[i]->style_flag && text_pos == m->s[i]->style_start) {
+if (m->s[i]->style_flag & STYLE_FLAG_BOLD)
+av_bprintf(buf, "{\\b1}");
+if (m->s[i]->style_flag & STYLE_FLAG_ITALIC)
+av_bprintf(buf, "{\\i1}");
+if (m->s[i]->style_flag & STYLE_FLAG_UNDERLINE)
+av_bprintf(buf, "{\\u

Re: [FFmpeg-devel] [PATCH 7/9] lavf/http: increase range for listen, handle connection closing accordingly, add http_handshake and move handshake logic there

2015-07-05 Thread Stephan Holljes
On Sat, Jul 4, 2015 at 7:47 AM, Stephan Holljes
 wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  libavformat/http.c | 44 +++-
>  1 file changed, 31 insertions(+), 13 deletions(-)
>
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 3c1ec35..6338d80 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -129,7 +129,7 @@ static const AVOption options[] = {
>  { "end_offset", "try to limit the request to bytes preceding this 
> offset", OFFSET(end_off), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, INT64_MAX, D },
>  { "method", "Override the HTTP method or set the expected HTTP method 
> from a client", OFFSET(method), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D 
> | E },
>  { "reconnect", "auto reconnect after disconnect before EOF", 
> OFFSET(reconnect), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
> -{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
> 0 }, 0, 1, D | E },
> +{ "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 
> 0 }, 0, 2, D | E },
>  { NULL }
>  };
>
> @@ -305,8 +305,11 @@ static void handle_http_errors(URLContext *h, int error)
>  static const char bad_request[] = "HTTP/1.1 400 Bad 
> Request\r\nContent-Type: text/plain\r\n\r\n400 Bad Request\r\n";
>  static const char internal_server_error[] = "HTTP/1.1 500 Internal 
> server error\r\nContent-Type: text/plain\r\n\r\n500 Internal server 
> error\r\n";
>  HTTPContext *s = h->priv_data;
> +av_assert0(error < 0);
>  if (h->is_connected) {
>  switch(error) {
> +case 0:
> +break;
>  case AVERROR_HTTP_BAD_REQUEST:
>  ffurl_write(s->hd, bad_request, strlen(bad_request));
>  break;
> @@ -317,15 +320,33 @@ static void handle_http_errors(URLContext *h, int error)
>  }
>  }
>
> +static int http_handshake(URLContext *c) {
> +int ret, err, new_location;
> +HTTPContext *ch = c->priv_data;
> +URLContext *cl = ch->hd;
> +static const char header[] = "HTTP/1.1 200 OK\r\nContent-Type: 
> application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n";
> +if ((ret = ffurl_handshake(cl)) < 0)
> +return ret;
> +if ((err = http_read_header(c, &new_location)) < 0)
> +goto fail;
> +if ((ret = ffurl_write(cl, header, strlen(header))) < 0)
> +return ret;
> +// Avoid returning a positive value from ffurl_write()
> +ret = ret > 0 ? 0 : ret;
> +return ret;
> +fail:
> +handle_http_errors(c, err);
> +return ret;
> +}
> +
>  static int http_listen(URLContext *h, const char *uri, int flags,
> AVDictionary **options) {
>  HTTPContext *s = h->priv_data;
>  int ret;
> -static const char header[] = "HTTP/1.1 200 OK\r\nContent-Type: 
> application/octet-stream\r\nTransfer-Encoding: chunked\r\n\r\n";
>  char hostname[1024], proto[10];
>  char lower_url[100];
>  const char *lower_proto = "tcp";
> -int port, new_location;
> +int port;
>  s->chunked_post = 1;
>  av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), 
> &port,
>   NULL, 0, uri);
> @@ -333,18 +354,14 @@ static int http_listen(URLContext *h, const char *uri, 
> int flags,
>  lower_proto = "tls";
>  ff_url_join(lower_url, sizeof(lower_url), lower_proto, NULL, hostname, 
> port,
>  NULL);
> -av_dict_set(options, "listen", "1", 0);
> +if ((ret = av_dict_set_int(options, "listen", s->listen, 0)) < 0)
> +goto fail;
>  if ((ret = ffurl_open(&s->hd, lower_url, AVIO_FLAG_READ_WRITE,
>&h->interrupt_callback, options)) < 0)
>  goto fail;
> -if ((ret = http_read_header(h, &new_location)) < 0)
> - goto fail;
> -if ((ret = ffurl_write(s->hd, header, strlen(header))) < 0)
> - goto fail;
> -return 0;
> -
> +if (s->listen == 1) /* single client */
> +ret = http_handshake(h);
>  fail:
> -handle_http_errors(h, ret);
>  av_dict_free(&s->chained_options);
>  return ret;
>  }
> @@ -1262,8 +1279,7 @@ static int http_shutdown(URLContext *h, int flags)
>  HTTPContext *s = h->priv_data;
>
>  /* signal end of chunked encoding if used */
> -if (((flags & AVIO_FLAG_WRITE) && s->chunked_post) ||
> -((flags & AVIO_FLAG_READ) && s->chunked_post && s->listen)) {
> +if (((flags & AVIO_FLAG_WRITE) && s->chunked_post)) {

I just noticed that the removal of this test for s->listen introduces
a regression. Connections are not properly closed when http is used as
an input option. Attached patch is identical to this one without this
hunk.

>  ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
>  ret = ret > 0 ? 0 : ret;
>  s->end_chunked_post = 1;
> @@ -1365,6 +1381,8 @@ HTTP_CLASS(http);
>  URLProtocol ff_http_protocol = {
>  .name= "http",
>  .url_open2