Re: [FFmpeg-devel] [PATCH] lavfi: USPP filter

2014-12-12 Thread Stefano Sabatini
On date Friday 2014-12-12 12:15:44 +0530, arwa arif encoded:
[...]
> From b075eb959b00124de6c54a058fec865647d9dd17 Mon Sep 17 00:00:00 2001
> From: Arwa Arif 
> Date: Fri, 12 Dec 2014 11:14:26 +0530
> Subject: [PATCH] Delete mp=uspp
> 
> ---
>  doc/filters.texi  |1 -
>  libavfilter/Makefile  |1 -
>  libavfilter/libmpcodecs/vf_uspp.c |  394 
> -
>  libavfilter/version.h |2 +-
>  libavfilter/vf_mp.c   |4 -
>  5 files changed, 1 insertion(+), 401 deletions(-)
>  delete mode 100644 libavfilter/libmpcodecs/vf_uspp.c

LGTM, thanks.
-- 
FFmpeg = Formidable Fascinating Mortal Puritan Elitist Gospel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] Adding closed caption decoder

2014-12-12 Thread Anshul
On 12/06/2014 04:24 PM, Anshul wrote:
> On 12/06/2014 04:22 PM, Anshul wrote:
>> On 12/05/2014 07:56 PM, Nicolas George wrote:
>>> Hi. I had time to look at the code with some more details. Comments are
>>> below.
>>>
 >From 31f69ccfb45247a7cc203084a931b8523284aa13 Mon Sep 17 00:00:00 2001
 From: Anshul Maheshwari 
 Date: Wed, 3 Dec 2014 23:37:22 +0530
 Subject: [PATCH 2/2] Adding Closed caption Decoder

 ---
  libavcodec/Makefile   |   1 +
  libavcodec/allcodecs.c|   1 +
  libavcodec/ccaption_dec.c | 318 
 ++
  3 files changed, 320 insertions(+)
  create mode 100644 libavcodec/ccaption_dec.c

 diff --git a/libavcodec/Makefile b/libavcodec/Makefile
 index fa0f53d..bbc516d 100644
 --- a/libavcodec/Makefile
 +++ b/libavcodec/Makefile
 @@ -173,6 +173,7 @@ OBJS-$(CONFIG_BRENDER_PIX_DECODER) += brenderpix.o
  OBJS-$(CONFIG_C93_DECODER) += c93.o
  OBJS-$(CONFIG_CAVS_DECODER)+= cavs.o cavsdec.o cavsdsp.o \
cavsdata.o mpeg12data.o
 +OBJS-$(CONFIG_CCAPTION_DECODER)+= ccaption_dec.o
  OBJS-$(CONFIG_CDGRAPHICS_DECODER)  += cdgraphics.o
  OBJS-$(CONFIG_CDXL_DECODER)+= cdxl.o
  OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
 diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
 index 0d39d33..8c07388 100644
 --- a/libavcodec/allcodecs.c
 +++ b/libavcodec/allcodecs.c
 @@ -480,6 +480,7 @@ void avcodec_register_all(void)
  /* subtitles */
  REGISTER_ENCDEC (SSA,   ssa);
  REGISTER_ENCDEC (ASS,   ass);
 +REGISTER_DECODER(CCAPTION,  ccaption);
  REGISTER_ENCDEC (DVBSUB,dvbsub);
  REGISTER_ENCDEC (DVDSUB,dvdsub);
  REGISTER_DECODER(JACOSUB,   jacosub);
 diff --git a/libavcodec/ccaption_dec.c b/libavcodec/ccaption_dec.c
 new file mode 100644
 index 000..0a7dfd8
 --- /dev/null
 +++ b/libavcodec/ccaption_dec.c
 @@ -0,0 +1,318 @@
 +/*
 + * Closed Caption Decoding
 + * Copyright (c) 2014 Anshul Maheshwari
 + *
 + * 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 even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with FFmpeg; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
 02110-1301 USA
 + */
 +
 +#include "avcodec.h"
 +#include "ass.h"
 +
 +#define SCREEN_ROWS 15
 +#define SCREEN_COLUMNS 32
 +
 +#define SET_FLAG(var, val) ( var |= ( 1 << (val) ) )
 +#define UNSET_FLAG(var, val) ( var &=  ~( 1 << (val)) )
 +#define CHECK_FLAG(var, val) ( (var) & (1 << (val) ) )
 +
 +enum cc_mode {
 +CCMODE_POPON,
 +CCMODE_PAINTON,
 +CCMODE_ROLLUP_2,
 +CCMODE_ROLLUP_3,
 +CCMODE_ROLLUP_4,
 +CCMODE_TEXT,
 +};
 +
 +struct Screen {
 +uint8_t characters[SCREEN_ROWS][SCREEN_COLUMNS+1];
>>> Maybe add a comment about the +1?
>> done
 +/*
 + * row used flag will be 0 when none in use other wise it will have 
 its
 + * corrosponding bit high.
>>> Language nit. I suggest: "Bitmask of used rows; if a bit is not set, the
>>> corresponding row is not used."
>> done
 + * for setting row 1  use row | (1 >> 1)
 + * for setting row 15 use row | (1 >> 15)
>>> Are you sure that is ">>" and not "<<"? And is it a good idea to number
>>> starting from 1?
>> It was just commented in wrong way, corrected comment.
 + */
 +int16_t  row_used;
 +};
 +
 +
 +typedef struct CCaptionSubContext {
 +int parity_table[256];
 +int row_cnt;
 +struct Screen screen[2];
 +int active_screen;
 +int cursor_row;
 +int cursor_column;
 +AVBPrint buffer;
 +/* erase display memory */
 +int edm;
>>> It is used only a handful of times: I suggest a more meaningful name instead
>>> of a comment: "erase_disp_mem" for example.
>> done
 +int rollup;
 +enum  cc_mode mode;
 +int64_t start_time;
 +/* visible screen time */
 +int64_t startv_time;
>>> Is the v a typo?
>> no it was written to express v = visible

Re: [FFmpeg-devel] [PATCH] avformat: add dump_metadata_lines

2014-12-12 Thread wm4
On Fri, 12 Dec 2014 02:24:54 +0100
Michael Niedermayer  wrote:

> On Thu, Dec 11, 2014 at 01:18:21AM +, Vittorio Giovara wrote:
> > On Wed, Dec 10, 2014 at 1:23 PM, wm4  wrote:
> > > On Wed, 10 Dec 2014 03:38:03 +0100
> > > Lukasz Marek  wrote:
> > >
> > >> W dniu środa, 10 grudnia 2014 Vittorio Giovara 
> > >> 
> > >> napisał(a):
> > >>
> > >> > On Tue, Dec 9, 2014 at 10:17 PM, wm4  > >> > >
> > >> > wrote:
> > >> > > On Tue,  9 Dec 2014 14:10:22 +0100
> > >> > > Michael Niedermayer > wrote:
> > >> > >
> > >> > >> TODO: bump version, update APIChanges
> > >> > >>
> > >> > >> Signed-off-by: Michael Niedermayer >
> > >> > >> ---
> > >> > >>  libavformat/avformat.h  |8 
> > >> > >>  libavformat/dump.c  |   24 ++--
> > >> > >>  libavformat/options_table.h |1 +
> > >> > >>  3 files changed, 27 insertions(+), 6 deletions(-)
> > >> > >>
> > >> > >> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> > >> > >> index 2e54ed1..cbe3608 100644
> > >> > >> --- a/libavformat/avformat.h
> > >> > >> +++ b/libavformat/avformat.h
> > >> > >> @@ -1616,6 +1616,14 @@ typedef struct AVFormatContext {
> > >> > >>   */
> > >> > >>  char *format_whitelist;
> > >> > >>
> > >> > >> +/**
> > >> > >> + * Maximum number of lines per metadata tag to dump with 
> > >> > >> av_log.
> > >> > >> + * -1 means default
> > >> > >> + * - encoding: unused
> > >> > >> + * - decoding: set by user through AVOptions (NO direct access)
> > >> > >> + */
> > >> > >> +int dump_metadata_lines;
> > >> > >> +
> > >> > >>  
> > >> > >> /*
> > >> > >>   * All fields below this line are not part of the public API. 
> > >> > >> They
> > >> > >>   * may not be used outside of libavformat and can be changed 
> > >> > >> and
> > >> > >> diff --git a/libavformat/dump.c b/libavformat/dump.c
> > >> > >> index 56b37ff..38286b8 100644
> > >> > >> --- a/libavformat/dump.c
> > >> > >> +++ b/libavformat/dump.c
> > >> > >> @@ -126,7 +126,7 @@ static void print_fps(double d, const char 
> > >> > >> *postfix)
> > >> > >>  av_log(NULL, AV_LOG_INFO, "%1.0fk %s", d / 1000, postfix);
> > >> > >>  }
> > >> > >>
> > >> > >> -static void dump_metadata(void *ctx, AVDictionary *m, const char
> > >> > *indent)
> > >> > >> +static void dump_metadata(void *ctx, AVDictionary *m, const char
> > >> > *indent, int dump_metadata_lines_arg)
> > >> > >>  {
> > >> > >>  if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language",
> > >> > NULL, 0))) {
> > >> > >>  AVDictionaryEntry *tag = NULL;
> > >> > >> @@ -135,16 +135,28 @@ static void dump_metadata(void *ctx, 
> > >> > >> AVDictionary
> > >> > *m, const char *indent)
> > >> > >>  while ((tag = av_dict_get(m, "", tag, 
> > >> > >> AV_DICT_IGNORE_SUFFIX)))
> > >> > >>  if (strcmp("language", tag->key)) {
> > >> > >>  const char *p = tag->value;
> > >> > >> +int lines = 0;
> > >> > >> +int dump_metadata_lines = dump_metadata_lines_arg;
> > >> > >> +if (dump_metadata_lines == -1) {
> > >> > >> +dump_metadata_lines = strcmp("comment", 
> > >> > >> tag->key)
> > >> > ? 1 : 25;
> > >> > >> +}
> > >> > >>  av_log(ctx, AV_LOG_INFO,
> > >> > >> "%s  %-16s: ", indent, tag->key);
> > >> > >>  while (*p) {
> > >> > >>  char tmp[256];
> > >> > >>  size_t len = strcspn(p, "\x8\xa\xb\xc\xd");
> > >> > >> +if (lines >= dump_metadata_lines) {
> > >> > >> +av_log(ctx, AV_LOG_INFO, 
> > >> > >> "[%"SIZE_SPECIFIER"
> > >> > bytes ommited, use \'-dump_metadata_lines \' to see more]", 
> > >> > strlen(p));
> > >> > >> +break;
> > >> > >> +}
> > >> > >>  av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1));
> > >> > >>  av_log(ctx, AV_LOG_INFO, "%s", tmp);
> > >> > >>  p += len;
> > >> > >>  if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " ");
> > >> > >> -if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s
> > >> > %-16s: ", indent, "");
> > >> > >> +if (*p == 0xa) {
> > >> > >> +av_log(ctx, AV_LOG_INFO, "\n%s  %-16s: ",
> > >> > indent, "");
> > >> > >> +lines++;
> > >> > >> +}
> > >> > >>  if (*p) p++;
> > >> > >>  }
> > >> > >>  av_log(ctx, AV_LOG_INFO, "\n");
> > >> > >> @@ -420,7 +432,7 @@ static void dump_stream_format(AVFormatContext 
> > >> > >> *ic,
> > >> > int i,
> > >> > >>  av_log(NULL, AV_LOG_INFO, " (clean effects)");
> > >> > >>  av_log(NULL, AV_LOG_INFO, "\n");
> > >> > >>
> > >> > >> -dump_metadata(NULL, st->metadata, "

Re: [FFmpeg-devel] [PATCH] lavfi: USPP filter

2014-12-12 Thread wm4
On Fri, 12 Dec 2014 02:04:18 + (UTC)
Carl Eugen Hoyos  wrote:

> arwa arif  gmail.com> writes:
> 
> > I checked the ouput with quality 8, I am getting a broken output.
> 
> Yes, that's ticket #3596.
> 
> Congratulation for porting the filter, will you do fspp next?
> 

It's one ancient legacy filter that nobody uses enough?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



Re: [FFmpeg-devel] [PATCH] lavfi: USPP filter

2014-12-12 Thread Carl Eugen Hoyos
arwa arif  gmail.com> writes:

> Since, fspp is written in assembly language also, 
> I am not very sure if I will be able to do it.

You can start with the C variant only, then copy 
the asm code to a new file as done in this commit:
http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=a2c547ff

If you hit problems, ask here or on irc.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH]Fix leak reading invalid mxf files

2014-12-12 Thread Michael Niedermayer
On Wed, Dec 10, 2014 at 11:30:54AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #4173 for me.
> To be split in two parts.
> 
> Please comment, Carl Eugen

probably ok if tomas doesnt reply

[...]

-- 
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]Fix leak reading invalid mxf files

2014-12-12 Thread Tomas Härdin
On Wed, 2014-12-10 at 11:30 +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #4173 for me.
> To be split in two parts.
> 
> Please comment, Carl Eugen

Looks alright. Maybe you want to pass it a MXFMetadataSet** so you can
use av_freep() like before? But I suppose it doesn't matter since the
array gets free:d just a few lines below..

/Tomas


signature.asc
Description: This is a digitally signed message part
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/xiph: mark returned header pointers const from avpriv_split_xiph_headers()

2014-12-12 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/vorbis_parser.c |2 +-
 libavcodec/vorbisdec.c |2 +-
 libavcodec/vp3.c   |2 +-
 libavcodec/xiph.c  |2 +-
 libavcodec/xiph.h  |2 +-
 libavformat/matroskaenc.c  |2 +-
 libavformat/sdp.c  |2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index b99f115..547fd47 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -184,7 +184,7 @@ bad_header:
 static int vorbis_parse_init(AVVorbisParseContext *s,
  const uint8_t *extradata, int extradata_size)
 {
-uint8_t *header_start[3];
+const uint8_t *header_start[3];
 int header_len[3];
 int ret;
 
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
index fb16099..09a863f 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1017,7 +1017,7 @@ static av_cold int vorbis_decode_init(AVCodecContext 
*avctx)
 vorbis_context *vc = avctx->priv_data;
 uint8_t *headers   = avctx->extradata;
 int headers_len= avctx->extradata_size;
-uint8_t *header_start[3];
+const uint8_t *header_start[3];
 int header_len[3];
 GetBitContext *gb = &vc->gb;
 int hdr_type, ret;
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 8aca83a..0e37f0d 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -2437,7 +2437,7 @@ static av_cold int theora_decode_init(AVCodecContext 
*avctx)
 Vp3DecodeContext *s = avctx->priv_data;
 GetBitContext gb;
 int ptype;
-uint8_t *header_start[3];
+const uint8_t *header_start[3];
 int header_len[3];
 int i;
 
diff --git a/libavcodec/xiph.c b/libavcodec/xiph.c
index 49b978d..d072224 100644
--- a/libavcodec/xiph.c
+++ b/libavcodec/xiph.c
@@ -22,7 +22,7 @@
 #include "xiph.h"
 
 int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size,
-  int first_header_size, uint8_t *header_start[3],
+  int first_header_size, const uint8_t 
*header_start[3],
   int header_len[3])
 {
 int i;
diff --git a/libavcodec/xiph.h b/libavcodec/xiph.h
index b8ddbbe..1741a51 100644
--- a/libavcodec/xiph.h
+++ b/libavcodec/xiph.h
@@ -37,7 +37,7 @@
  * @return On error a negative value is returned, on success zero.
  */
 int avpriv_split_xiph_headers(const uint8_t *extradata, int extradata_size,
-  int first_header_size, uint8_t *header_start[3],
+  int first_header_size, const uint8_t 
*header_start[3],
   int header_len[3]);
 
 #endif /* AVCODEC_XIPH_H */
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e8e8da0..c781c8a 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -491,7 +491,7 @@ static int64_t mkv_write_cues(AVFormatContext *s, mkv_cues 
*cues, mkv_track *tra
 
 static int put_xiph_codecpriv(AVFormatContext *s, AVIOContext *pb, 
AVCodecContext *codec)
 {
-uint8_t *header_start[3];
+const uint8_t *header_start[3];
 int header_len[3];
 int first_header_size;
 int j;
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 5bf9de6..fadabbe 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -348,7 +348,7 @@ static char *extradata2config(AVCodecContext *c)
 static char *xiph_extradata2config(AVCodecContext *c)
 {
 char *config, *encoded_config;
-uint8_t *header_start[3];
+const uint8_t *header_start[3];
 int headers_len, header_len[3], config_len;
 int first_header_size;
 
-- 
1.7.9.5

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


Re: [FFmpeg-devel] [PATCH] avformat: Implement subtitle charenc guessing

2014-12-12 Thread Nicolas George
Le duodi 22 frimaire, an CCXXIII, Rodger Combs a écrit :
> This also moves general charenc conversion from avcodec to avformat;
> the version in avcodec is left, but renamed; I'm not sure if that's
> the optimal solution.
> 
> The documentation could probably use some improvements, and a few more
> options could be added to ENCA.
> 
> This very simply prefers libguess over ENCA, and ENCA over uchardet, but
> will fall back on a less-preferred guess if something decodes wrong, and will
> drop illegal sequences in iconv if all else fails.
> 
> It'd be possible to have ffmpeg.c present a UI if multiple guesses are
> returned, and other library consumers could do the same.

I will not have time to comment soon enough, but I have reservations about
this patch:

- core feature requiring non-trivial external dependencies;

- renaming an existing option;

- tying proper working of lavc decoders to the use of lavf.

Regards,

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


Re: [FFmpeg-devel] [PATCH] avformat: Implement subtitle charenc guessing

2014-12-12 Thread Lukasz Marek
On 12 December 2014 at 07:05, Rodger Combs  wrote:
>
> diff --git a/configure b/configure
> index e2e3619..a5a9f9b 100755
> --- a/configure
> +++ b/configure
> @@ -199,6 +199,9 @@ External library support:
>--enable-gnutls  enable gnutls, needed for https support
> if openssl is not used [no]
>--disable-iconv  disable iconv [autodetect]
> +  --disable-libguess   disable libguess [autodetect]
> +  --disable-uchardet   disable universalchardet [autodetect]
> +  --enable-encadisable enca [no]
>

enable


>--enable-ladspa  enable LADSPA audio filtering [no]
>--enable-libaacplus  enable AAC+ encoding via libaacplus [no]
>--enable-libass  enable libass subtitles rendering,
> @@ -1342,6 +1345,9 @@ EXTERNAL_LIBRARY_LIST="
>  frei0r
>  gnutls
>  iconv
> +libguess
> +uchardet
> +enca
>  ladspa
>  libaacplus
>  libass
> @@ -4358,6 +4364,7 @@ die_license_disabled gpl libxavs
>  die_license_disabled gpl libxvid
>  die_license_disabled gpl libzvbi
>  die_license_disabled gpl x11grab
> +die_license_disabled gpl enca
>
>  die_license_disabled nonfree libaacplus
>  die_license_disabled nonfree libfaac
> @@ -5117,6 +5124,14 @@ enabled vdpau && enabled xlib &&
>  # Funny iconv installations are not unusual, so check it after all flags
> have been set
>  disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h
> iconv -liconv || disable iconv
>
> +disabled iconv || disabled libguess || disable libguess && {
> +check_pkg_config libguess libguess.h libguess_determine_encoding &&
> require_pkg_config libguess libguess.h libguess_determine_encoding &&
> enable libguess;
> +}
> +disabled iconv || disabled uchardet || disable uchardet && {
> +check_pkg_config uchardet uchardet.h uchardet_new &&
> require_pkg_config uchardet uchardet.h uchardet_new && enable uchardet;
> +}
> +enabled enca && check_func_headers enca.h enca_analyse || check_lib2
> enca.h enca_analyse -lenca || die "ERROR: enca not found"
> +
>  enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
>
>  # add some useful compiler flags if supported
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 1d5b078..93b3105 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -472,7 +472,7 @@ static const AVOption avcodec_options[] = {
>  {"ka", "Karaoke",0, AV_OPT_TYPE_CONST, {.i64 =
> AV_AUDIO_SERVICE_TYPE_KARAOKE },   INT_MIN, INT_MAX, A|E,
> "audio_service_type"},
>  {"request_sample_fmt", "sample format audio decoders should prefer",
> OFFSET(request_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT,
> {.i64=AV_SAMPLE_FMT_NONE}, -1, INT_MAX, A|D, "request_sample_fmt"},
>  {"pkt_timebase", NULL, OFFSET(pkt_timebase), AV_OPT_TYPE_RATIONAL, {.dbl
> = 0 }, 0, INT_MAX, 0},
> -{"sub_charenc", "set input text subtitles character encoding",
> OFFSET(sub_charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX,
> S|D},
> +{"sub_charenc_lavc", "set input text subtitles character encoding",
> OFFSET(sub_charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX,
> S|D},
>

hmm, this is API break. is this really required?


+/**
> + * Add a character encoding guess to an AVFormatContext's list
> + *
> + * @param avctx the context to add to
> + * @param enc   the encoding name to add
> + *
> + * A copy is added, so the original string should be free()d if necessary.
> + * If the same encoding name is already present, it isn't added again.
> + * If NULL or an empty string is passed, it's not added.
> + */
> +static void add_charenc(AVFormatContext *avctx, const char *enc)
> +{
> +char *copy;
> +
> +if (!enc || !enc[0])
> +return;
> +
> +for (unsigned i = 0; i < avctx->nb_sub_charenc_guesses; i++)
> +if (!strcmp(avctx->sub_charenc_guesses[i], enc))
> +return;
> +
> +copy = av_strdup(enc);
> +if (!copy)
> +return;
> +
> +dynarray_add(&avctx->sub_charenc_guesses,
> &avctx->nb_sub_charenc_guesses,
> + copy);
>

av_dynarray_add_nofree is probably better.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/2] avcodec/avdct: support >8bit per sample dcts

2014-12-12 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavcodec/avdct.c |3 +++
 libavcodec/avdct.h |2 ++
 2 files changed, 5 insertions(+)

diff --git a/libavcodec/avdct.c b/libavcodec/avdct.c
index a01a6b7..f92c691 100644
--- a/libavcodec/avdct.c
+++ b/libavcodec/avdct.c
@@ -63,6 +63,8 @@ static const AVOption avdct_options[] = {
 {"xvidmmx", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"},
 {"faani", "floating point AAN IDCT (experimental / for debugging)", 0, 
AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"},
 {"simpleauto", "experimental / for debugging", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_IDCT_SIMPLEAUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
+
+{"bits_per_sample", "", OFFSET(bits_per_sample), AV_OPT_TYPE_INT, {.i64 = 8 }, 
0, 14, 0,},
 {NULL},
 };
 
@@ -99,6 +101,7 @@ int avcodec_dct_init(AVDCT *dsp)
 
 avctx->idct_algo = dsp->idct_algo;
 avctx->dct_algo  = dsp->dct_algo;
+avctx->bits_per_raw_sample = dsp->bits_per_sample;
 
 #define COPY(src, name) memcpy(&dsp->name, &src.name, sizeof(dsp->name))
 
diff --git a/libavcodec/avdct.h b/libavcodec/avdct.h
index 380efe1..272422e 100644
--- a/libavcodec/avdct.h
+++ b/libavcodec/avdct.h
@@ -65,6 +65,8 @@ typedef struct AVDCT {
 void (*get_pixels)(int16_t *block /* align 16 */,
const uint8_t *pixels /* align 8 */,
ptrdiff_t line_size);
+
+int bits_per_sample;
 } AVDCT;
 
 /**
-- 
1.7.9.5

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


[FFmpeg-devel] [PATCH 2/2] avfilter/vf_spp: support 10bit per sample

2014-12-12 Thread Michael Niedermayer
Signed-off-by: Michael Niedermayer 
---
 libavfilter/vf_spp.c |   89 --
 1 file changed, 71 insertions(+), 18 deletions(-)

diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 8eb0c7e..c03cf1f 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -186,6 +186,36 @@ static void store_slice_c(uint8_t *dst, const uint16_t 
*src,
 }
 }
 
+static void store_slice16_c(uint16_t *dst, const uint16_t *src,
+int dst_linesize, int src_linesize,
+int width, int height, int log2_scale,
+const uint8_t dither[8][8])
+{
+int y, x;
+
+#define STORE16(pos) do {   \
+temp = ((src[x + y*src_linesize + pos] << log2_scale) + (d[pos]>>1)) >> 5; 
  \
+if (temp & 0x400)   \
+temp = ~(temp >> 31);   \
+dst[x + y*dst_linesize + pos] = temp;   \
+} while (0)
+
+for (y = 0; y < height; y++) {
+const uint8_t *d = dither[y];
+for (x = 0; x < width; x += 8) {
+int temp;
+STORE16(0);
+STORE16(1);
+STORE16(2);
+STORE16(3);
+STORE16(4);
+STORE16(5);
+STORE16(6);
+STORE16(7);
+}
+}
+}
+
 static inline void add_block(uint16_t *dst, int linesize, const int16_t 
block[64])
 {
 int y;
@@ -212,7 +242,7 @@ static inline int norm_qscale(int qscale, int type)
 
 static void filter(SPPContext *p, uint8_t *dst, uint8_t *src,
int dst_linesize, int src_linesize, int width, int height,
-   const uint8_t *qp_table, int qp_stride, int is_luma)
+   const uint8_t *qp_table, int qp_stride, int is_luma, int 
sample_bytes)
 {
 int x, y, i;
 const int count = 1 << p->log2_count;
@@ -220,18 +250,26 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t 
*src,
 DECLARE_ALIGNED(16, uint64_t, block_align)[32];
 int16_t *block  = (int16_t *)block_align;
 int16_t *block2 = (int16_t *)(block_align + 16);
+uint16_t *psrc16 = (uint16_t*)p->src;
 
 for (y = 0; y < height; y++) {
 int index = 8 + 8*linesize + y*linesize;
-memcpy(p->src + index, src + y*src_linesize, width);
-for (x = 0; x < 8; x++) {
-p->src[index - x - 1] = p->src[index + x];
-p->src[index + width + x] = p->src[index + width - x - 1];
+memcpy(p->src + index*sample_bytes, src + y*src_linesize, 
width*sample_bytes);
+if (sample_bytes == 1) {
+for (x = 0; x < 8; x++) {
+p->src[index - x - 1] = p->src[index + x];
+p->src[index + width + x] = p->src[index + width - x - 1];
+}
+} else {
+for (x = 0; x < 8; x++) {
+psrc16[index - x - 1] = psrc16[index + x];
+psrc16[index + width + x] = psrc16[index + width - x - 1];
+}
 }
 }
 for (y = 0; y < 8; y++) {
-memcpy(p->src + (   7-y)*linesize, p->src + (   y+8)*linesize, 
linesize);
-memcpy(p->src + (height+8+y)*linesize, p->src + (height-y+7)*linesize, 
linesize);
+memcpy(p->src + (   7-y)*linesize * sample_bytes, p->src + (   
y+8)*linesize * sample_bytes, linesize * sample_bytes);
+memcpy(p->src + (height+8+y)*linesize * sample_bytes, p->src + 
(height-y+7)*linesize * sample_bytes, linesize * sample_bytes);
 }
 
 for (y = 0; y < height + 8; y += 8) {
@@ -250,18 +288,26 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t 
*src,
 const int x1 = x + offset[i + count - 1][0];
 const int y1 = y + offset[i + count - 1][1];
 const int index = x1 + y1*linesize;
-p->dct->get_pixels(block, p->src + index, linesize);
+p->dct->get_pixels(block, p->src + sample_bytes*index, 
sample_bytes*linesize);
 p->dct->fdct(block);
 p->requantize(block2, block, qp, p->dct->idct_permutation);
 p->dct->idct(block2);
 add_block(p->temp + index, linesize, block2);
 }
 }
-if (y)
-p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + 
y*linesize,
-   dst_linesize, linesize, width,
-   FFMIN(8, height + 8 - y), MAX_LEVEL - p->log2_count,
-   ldither);
+if (y) {
+if (sample_bytes == 1) {
+p->store_slice(dst + (y - 8) * dst_linesize, p->temp + 8 + 
y*linesize,
+   dst_linesize, linesize, width,
+   FFMIN(8, height + 8 - y), MAX_LEVEL - 
p->log2_count,

[FFmpeg-devel] [PATCH 1/5] lavu/dict: check for malloc failures

2014-12-12 Thread wm4
---
I didn't actually test these fixes, because someone just passed me
a list of failures found with failmalloc, rather than providing
reproducible test cases.
---
 libavutil/dict.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index 2983ea5..a362de0 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -75,6 +75,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 
 if (!m)
 m = *pm = av_mallocz(sizeof(*m));
+if (!m)
+goto err_out;
 
 if (tag) {
 if (flags & AV_DICT_DONT_OVERWRITE) {
@@ -100,6 +102,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 m->elems[m->count].key = (char*)(intptr_t)key;
 else
 m->elems[m->count].key = av_strdup(key);
+if (!m->elems[m->count].key)
+goto err_out;
 if (flags & AV_DICT_DONT_STRDUP_VAL) {
 m->elems[m->count].value = (char*)(intptr_t)value;
 } else if (oldval && flags & AV_DICT_APPEND) {
@@ -123,7 +127,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 return 0;
 
 err_out:
-if (!m->count) {
+if (m && !m->count) {
 av_free(m->elems);
 av_freep(pm);
 }
-- 
2.1.1

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


[FFmpeg-devel] [PATCH 3/5] lavu/dict: remove weird intptr_t cast

2014-12-12 Thread wm4
I can't come up with a reason why this would be needed.
---
 libavutil/dict.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index c4b97dc..e33e6a1 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -100,14 +100,14 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 }
 if (value) {
 if (flags & AV_DICT_DONT_STRDUP_KEY)
-m->elems[m->count].key = (char*)(intptr_t)key;
+m->elems[m->count].key = (char*)key;
 else
 m->elems[m->count].key = av_strdup(key);
 if (!m->elems[m->count].key)
 goto err_out;
 tmp = m->elems[m->count].key;
 if (flags & AV_DICT_DONT_STRDUP_VAL) {
-m->elems[m->count].value = (char*)(intptr_t)value;
+m->elems[m->count].value = (char*)value;
 } else if (oldval && flags & AV_DICT_APPEND) {
 int len = strlen(oldval) + strlen(value) + 1;
 char *newval = av_mallocz(len);
-- 
2.1.1

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


[FFmpeg-devel] [PATCH 2/5] lavu/dict: check for malloc failures some more

2014-12-12 Thread wm4
This fix is rather messy because of AV_DICT_DONT_STRDUP_VAL. It's not
even clear how this should be handled. Maybe freeing the user's data on
failure would actually be ok.
---
 libavutil/dict.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index a362de0..c4b97dc 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -72,6 +72,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 AVDictionary *m = *pm;
 AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags);
 char *oldval = NULL;
+void *tmp = NULL;
 
 if (!m)
 m = *pm = av_mallocz(sizeof(*m));
@@ -104,6 +105,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 m->elems[m->count].key = av_strdup(key);
 if (!m->elems[m->count].key)
 goto err_out;
+tmp = m->elems[m->count].key;
 if (flags & AV_DICT_DONT_STRDUP_VAL) {
 m->elems[m->count].value = (char*)(intptr_t)value;
 } else if (oldval && flags & AV_DICT_APPEND) {
@@ -117,7 +119,10 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 m->elems[m->count].value = newval;
 } else
 m->elems[m->count].value = av_strdup(value);
+if (!m->elems[m->count].value)
+goto err_out;
 m->count++;
+tmp = NULL;
 }
 if (!m->count) {
 av_free(m->elems);
@@ -133,6 +138,7 @@ err_out:
 }
 if (flags & AV_DICT_DONT_STRDUP_KEY) av_free((void*)key);
 if (flags & AV_DICT_DONT_STRDUP_VAL) av_free((void*)value);
+av_free(tmp);
 return AVERROR(ENOMEM);
 }
 
-- 
2.1.1

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


[FFmpeg-devel] [PATCH 4/5] lavc/avpacket: check for malloc failure

2014-12-12 Thread wm4
---
 libavcodec/avpacket.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 3c26046..1867476 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -546,8 +546,11 @@ int av_packet_ref(AVPacket *dst, const AVPacket *src)
 if (ret < 0)
 goto fail;
 memcpy(dst->buf->data, src->data, src->size);
-} else
+} else {
 dst->buf = av_buffer_ref(src->buf);
+if (!dst->buf)
+goto fail;
+}
 
 dst->size = src->size;
 dst->data = dst->buf->data;
-- 
2.1.1

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


[FFmpeg-devel] [PATCH 5/5] lavu/utils: check for malloc failure

2014-12-12 Thread wm4
---
 libavformat/utils.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5a2a72d..fc582b7 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3652,6 +3652,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const 
AVCodec *c)
 st->info->last_dts = AV_NOPTS_VALUE;
 
 st->codec = avcodec_alloc_context3(c);
+if (!st->codec) {
+av_free(st);
+return NULL;
+}
 if (s->iformat) {
 /* no default bitrate if decoding */
 st->codec->bit_rate = 0;
-- 
2.1.1

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


Re: [FFmpeg-devel] [PATCH 4/5] lavc/avpacket: check for malloc failure

2014-12-12 Thread Michael Niedermayer
On Fri, Dec 12, 2014 at 06:15:42PM +0100, wm4 wrote:
> ---
>  libavcodec/avpacket.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)

applied

thx

[...]
-- 
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]Set the default for --shlibdir to --libdir

2014-12-12 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes ticket #4183.

Please review, Carl Eugen
diff --git a/configure b/configure
index e2e3619..dc6c742 100755
--- a/configure
+++ b/configure
@@ -2685,7 +2685,7 @@ docdir_default='${prefix}/share/doc/ffmpeg'
 incdir_default='${prefix}/include'
 libdir_default='${prefix}/lib'
 mandir_default='${prefix}/share/man'
-shlibdir_default="$libdir_default"
+shlibdir_default='${LIBDIR}'
 
 # toolchain
 ar_default="ar"
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/5] lavu/utils: check for malloc failure

2014-12-12 Thread Michael Niedermayer
On Fri, Dec 12, 2014 at 06:15:43PM +0100, wm4 wrote:
> ---
>  libavformat/utils.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5a2a72d..fc582b7 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -3652,6 +3652,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, 
> const AVCodec *c)
>  st->info->last_dts = AV_NOPTS_VALUE;
>  
>  st->codec = avcodec_alloc_context3(c);
> +if (!st->codec) {
> +av_free(st);
> +return NULL;
> +}

this would leak st->info

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- 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/utils: check for malloc failure

2014-12-12 Thread wm4
---
Also fixed the commit message.
---
 libavformat/utils.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5a2a72d..8aee511 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3652,6 +3652,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const 
AVCodec *c)
 st->info->last_dts = AV_NOPTS_VALUE;
 
 st->codec = avcodec_alloc_context3(c);
+if (!st->codec) {
+av_free(st->info);
+av_free(st);
+return NULL;
+}
 if (s->iformat) {
 /* no default bitrate if decoding */
 st->codec->bit_rate = 0;
-- 
2.1.1

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


Re: [FFmpeg-devel] [PATCH 1/5] lavu/dict: check for malloc failures

2014-12-12 Thread Michael Niedermayer
On Fri, Dec 12, 2014 at 06:15:39PM +0100, wm4 wrote:
> ---
> I didn't actually test these fixes, because someone just passed me
> a list of failures found with failmalloc, rather than providing
> reproducible test cases.
> ---
>  libavutil/dict.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)

tested a bit

applied

thanks

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

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data


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


Re: [FFmpeg-devel] [PATCH] avformat/utils: check for malloc failure

2014-12-12 Thread Michael Niedermayer
On Fri, Dec 12, 2014 at 10:22:55PM +0100, wm4 wrote:
> ---
> Also fixed the commit message.
> ---
>  libavformat/utils.c | 5 +
>  1 file changed, 5 insertions(+)

applied

thanks

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

It is what and why we do it that matters, not just one of them.


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: add FFREPORT example

2014-12-12 Thread Michael Niedermayer
On Thu, Dec 11, 2014 at 12:00:09PM -0900, Lou Logan wrote:
> And fix a few nits.
> 
> Signed-off-by: Lou Logan 
> ---
>  doc/fftools-common-opts.texi | 18 +-
>  1 file changed, 13 insertions(+), 5 deletions(-)

should be ok

would be nice if named log levels could be used instead though

[...]
-- 
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]Set the default for --shlibdir to --libdir

2014-12-12 Thread Ivan Kalvachev
On 12/12/14, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes ticket #4183.
>
> Please review, Carl Eugen

You should also update the configure help text, as the default is not
PREFIX/lib anymore.

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


Re: [FFmpeg-devel] [PATCH 2/5] lavu/dict: check for malloc failures some more

2014-12-12 Thread Lukasz Marek

On 12.12.2014 18:15, wm4 wrote:

This fix is rather messy because of AV_DICT_DONT_STRDUP_VAL. It's not
even clear how this should be handled. Maybe freeing the user's data on
failure would actually be ok.


const char* arg suggests this function should not free it, but dict 
would free it eventually so I agree freeing it should be OK, and 
convenient for a user.


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


Re: [FFmpeg-devel] [PATCH]Set the default for --shlibdir to --libdir

2014-12-12 Thread Carl Eugen Hoyos
On Saturday 13 December 2014 01:12:02 am Ivan Kalvachev wrote:
> On 12/12/14, Carl Eugen Hoyos  wrote:
> > Hi!
> >
> > Attached patch fixes ticket #4183.
> >
> > Please review, Carl Eugen
>
> You should also update the configure help text, as the default is not
> PREFIX/lib anymore.

New patch attached.

Thank you, Carl Eugen
diff --git a/configure b/configure
index e2e3619..0ec1a7c 100755
--- a/configure
+++ b/configure
@@ -84,7 +84,7 @@ Standard options:
   --datadir=DIRinstall data files in DIR [PREFIX/share/ffmpeg]
   --docdir=DIR install documentation in DIR 
[PREFIX/share/doc/ffmpeg]
   --libdir=DIR install libs in DIR [PREFIX/lib]
-  --shlibdir=DIR   install shared libs in DIR [PREFIX/lib]
+  --shlibdir=DIR   install shared libs in DIR [LIBDIR]
   --incdir=DIR install includes in DIR [PREFIX/include]
   --mandir=DIR install man page in DIR [PREFIX/share/man]
   --enable-rpath   use rpath to allow installing libraries in paths
@@ -2685,7 +2685,7 @@ docdir_default='${prefix}/share/doc/ffmpeg'
 incdir_default='${prefix}/include'
 libdir_default='${prefix}/lib'
 mandir_default='${prefix}/share/man'
-shlibdir_default="$libdir_default"
+shlibdir_default='${LIBDIR}'
 
 # toolchain
 ar_default="ar"
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/5] lavu/dict: check for malloc failures some more

2014-12-12 Thread Michael Niedermayer
On Fri, Dec 12, 2014 at 06:15:40PM +0100, wm4 wrote:
> This fix is rather messy because of AV_DICT_DONT_STRDUP_VAL. It's not
> even clear how this should be handled. Maybe freeing the user's data on
> failure would actually be ok.
> ---
>  libavutil/dict.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavutil/dict.c b/libavutil/dict.c
> index a362de0..c4b97dc 100644
> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -72,6 +72,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
> char *value,
>  AVDictionary *m = *pm;
>  AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags);
>  char *oldval = NULL;
> +void *tmp = NULL;
>  
>  if (!m)
>  m = *pm = av_mallocz(sizeof(*m));
> @@ -104,6 +105,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
> char *value,
>  m->elems[m->count].key = av_strdup(key);
>  if (!m->elems[m->count].key)
>  goto err_out;
> +tmp = m->elems[m->count].key;
>  if (flags & AV_DICT_DONT_STRDUP_VAL) {
>  m->elems[m->count].value = (char*)(intptr_t)value;
>  } else if (oldval && flags & AV_DICT_APPEND) {
> @@ -117,7 +119,10 @@ int av_dict_set(AVDictionary **pm, const char *key, 
> const char *value,
>  m->elems[m->count].value = newval;
>  } else
>  m->elems[m->count].value = av_strdup(value);
> +if (!m->elems[m->count].value)
> +goto err_out;
>  m->count++;
> +tmp = NULL;
>  }
>  if (!m->count) {
>  av_free(m->elems);
> @@ -133,6 +138,7 @@ err_out:
>  }
>  if (flags & AV_DICT_DONT_STRDUP_KEY) av_free((void*)key);
>  if (flags & AV_DICT_DONT_STRDUP_VAL) av_free((void*)value);
> +av_free(tmp);

this will/can lead to double frees

[...]
-- 
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]Set the default for --shlibdir to --libdir

2014-12-12 Thread Michael Niedermayer
On Sat, Dec 13, 2014 at 01:50:03AM +0100, Carl Eugen Hoyos wrote:
> On Saturday 13 December 2014 01:12:02 am Ivan Kalvachev wrote:
> > On 12/12/14, Carl Eugen Hoyos  wrote:
> > > Hi!
> > >
> > > Attached patch fixes ticket #4183.
> > >
> > > Please review, Carl Eugen
> >
> > You should also update the configure help text, as the default is not
> > PREFIX/lib anymore.
> 
> New patch attached.
> 
> Thank you, Carl Eugen

>  configure |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 5499a4717addab272e5d29cccd7de96efe1a5766  patchshlibdir.diff
> diff --git a/configure b/configure
> index e2e3619..0ec1a7c 100755
> --- a/configure
> +++ b/configure
> @@ -84,7 +84,7 @@ Standard options:
>--datadir=DIRinstall data files in DIR [PREFIX/share/ffmpeg]
>--docdir=DIR install documentation in DIR 
> [PREFIX/share/doc/ffmpeg]
>--libdir=DIR install libs in DIR [PREFIX/lib]
> -  --shlibdir=DIR   install shared libs in DIR [PREFIX/lib]
> +  --shlibdir=DIR   install shared libs in DIR [LIBDIR]
>--incdir=DIR install includes in DIR [PREFIX/include]
>--mandir=DIR install man page in DIR [PREFIX/share/man]
>--enable-rpath   use rpath to allow installing libraries in paths
> @@ -2685,7 +2685,7 @@ docdir_default='${prefix}/share/doc/ffmpeg'
>  incdir_default='${prefix}/include'
>  libdir_default='${prefix}/lib'
>  mandir_default='${prefix}/share/man'
> -shlibdir_default="$libdir_default"
> +shlibdir_default='${LIBDIR}'

probably ok

[...]

-- 
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] doc: add FFREPORT example

2014-12-12 Thread Lou Logan
On Sat, 13 Dec 2014 00:30:27 +0100, Michael Niedermayer wrote:

> should be ok
> 
> would be nice if named log levels could be used instead though

Agreed. Anyway, I pushed this. Maybe I can figure out how to get it to
work with named log levels too.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: added HLS encryption

2014-12-12 Thread Michael Niedermayer
On Thu, Dec 11, 2014 at 12:27:37PM -0600, Christian Suloway wrote:
> Added HLS encryption with -hls_key_info_file  option. The
> first line of key_info_file specifies the key URI for the playlist, and
> the second line specifies the path to the file containing the encryption
> key. Changes to key_info_file will be reflected in segment encryption
> along with an entry in the playlist for the new key URI.
> 
> Also added -hls_flags random_iv option flag to use a random IV for
> encryption instead of the segment number.
> 
> Signed-off-by: Christian Suloway 
> ---
>  doc/muxers.texi  |  11 +++
>  libavformat/hlsenc.c | 257 
> +--
>  2 files changed, 262 insertions(+), 6 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index a1264d2..29a5de3 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -263,6 +263,13 @@ ffmpeg in.nut -hls_segment_filename 'file%03d.ts' 
> out.m3u8
>  This example will produce the playlist, @file{out.m3u8}, and segment files:
>  @file{file000.ts}, @file{file001.ts}, @file{file002.ts}, etc.
>  
> +@item hls_key_info_file @var{file}
> +Use in the information in @var{file} for segment encryption. The first line 
> of
> +@var{file} specifies the key URI for the playlist. The second line specifies
> +the path to the file containing the encryption key as a single packed array 
> of
> +16 octets in binary format. Changes to @var{file} will result in segment
> +encryption with the new key and an entry in the playlist for the new key URI.
> +
>  @item hls_flags single_file
>  If this flag is set, the muxer will store all segments in a single MPEG-TS
>  file, and will use byte ranges in the playlist. HLS playlists generated with
> @@ -277,6 +284,10 @@ Will produce the playlist, @file{out.m3u8}, and a single 
> segment file,
>  @item hls_flags delete_segments
>  Segment files removed from the playlist are deleted after a period of time
>  equal to the duration of the segment plus the duration of the playlist.
> +
> +@item hls_flags random_iv
> +Segment file encryption will use a random initialization vector (IV) instead 
> of
> +the segment number.
>  @end table
>  
>  @anchor{ico}
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 79f3a23..5bde70e 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -32,17 +32,24 @@
>  #include "libavutil/avstring.h"
>  #include "libavutil/opt.h"
>  #include "libavutil/log.h"
> +#include "libavutil/lfg.h"
> +#include "libavutil/random_seed.h"
>  
>  #include "avformat.h"
>  #include "internal.h"
>  #include "os_support.h"
>  
> +#define BLOCKSIZE 16
> +
>  typedef struct HLSSegment {
>  char filename[1024];
>  double duration; /* in seconds */
>  int64_t pos;
>  int64_t size;
>  
> +char *key_uri;
> +char *iv_string;
> +
>  struct HLSSegment *next;
>  } HLSSegment;
>  
> @@ -50,6 +57,7 @@ typedef enum HLSFlags {
>  // Generate a single media file and use byte ranges in the playlist.
>  HLS_SINGLE_FILE = (1 << 0),
>  HLS_DELETE_SEGMENTS = (1 << 1),
> +HLS_RANDOM_IV = (1 << 2),
>  } HLSFlags;
>  
>  typedef struct HLSContext {
> @@ -86,9 +94,23 @@ typedef struct HLSContext {
>  char *format_options_str;
>  AVDictionary *format_options;
>  
> +char *key_info_file;
> +char *key_file;
> +char *key_uri;
> +char *key_string;
> +char *iv_string;
> +AVLFG *lfg;
> +
>  AVIOContext *pb;
>  } HLSContext;
>  
> +static void hls_free_segment(HLSSegment *en)
> +{
> +   av_freep(&en->key_uri);
> +   av_freep(&en->iv_string);
> +   av_freep(&en);
> +}
> +
>  static int hls_delete_old_segments(HLSContext *hls) {
>  
>  HLSSegment *segment, *previous_segment = NULL;
> @@ -145,7 +167,7 @@ static int hls_delete_old_segments(HLSContext *hls) {
>  av_free(path);
>  previous_segment = segment;
>  segment = previous_segment->next;
> -av_free(previous_segment);
> +hls_free_segment(previous_segment);
>  }
>  
>  fail:
> @@ -154,6 +176,157 @@ fail:
>  return ret;
>  }
>  
> +static int hls_encryption_init(AVFormatContext *s)
> +{
> +HLSContext *hls = s->priv_data;
> +
> +if (hls->flags & HLS_RANDOM_IV) {
> +hls->lfg = av_malloc(sizeof(AVLFG));
> +if (!hls->lfg)
> +return AVERROR(ENOMEM);
> +av_lfg_init(hls->lfg, av_get_random_seed());
> +}
> +
> +return 0;
> +}
> +
> +static int hls_encryption_start(HLSContext *hls)
> +{
> +
> +int ret = 0, i, j, rotate_iv = 0;
> +AVIOContext *pb = NULL;
> +AVIOContext *dyn_buf = NULL;
> +uint8_t buf[1024], *tmp = NULL, *key = NULL, *iv = NULL;
> +char *p, *tstr, *saveptr = NULL, *key_string = NULL;
> +unsigned int u;
> +
> +if ((ret = avio_open(&pb, hls->key_info_file, AVIO_FLAG_READ)) < 0) {
> +av_log(hls, AV_LOG_ERROR, "error opening key info file %s\n",
> +  hls->key_info_file);
> +goto fai