[libav-devel] [PATCH 1/3] lavc: remove old unused audio conversion functions.

2013-10-27 Thread Anton Khirnov
---
 libavcodec/Makefile   |1 -
 libavcodec/audioconvert.c |  116 -
 libavcodec/audioconvert.h |   70 ---
 3 files changed, 187 deletions(-)
 delete mode 100644 libavcodec/audioconvert.c
 delete mode 100644 libavcodec/audioconvert.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8e0d60d..6f80a9e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -11,7 +11,6 @@ HEADERS = avcodec.h   
  \
   xvmc.h\
 
 OBJS = allcodecs.o  \
-   audioconvert.o   \
avpacket.o   \
avpicture.o  \
bitstream.o  \
diff --git a/libavcodec/audioconvert.c b/libavcodec/audioconvert.c
deleted file mode 100644
index 3714de7..000
--- a/libavcodec/audioconvert.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * audio conversion
- * Copyright (c) 2006 Michael Niedermayer 
- *
- * This file is part of Libav.
- *
- * Libav 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.
- *
- * Libav 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 Libav; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * audio conversion
- * @author Michael Niedermayer 
- */
-
-#include "libavutil/avstring.h"
-#include "libavutil/common.h"
-#include "libavutil/libm.h"
-#include "libavutil/samplefmt.h"
-#include "avcodec.h"
-#include "audioconvert.h"
-
-struct AVAudioConvert {
-int in_channels, out_channels;
-int fmt_pair;
-};
-
-AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int 
out_channels,
-   enum AVSampleFormat in_fmt, int 
in_channels,
-   const float *matrix, int flags)
-{
-AVAudioConvert *ctx;
-if (in_channels!=out_channels)
-return NULL;  /* FIXME: not supported */
-ctx = av_malloc(sizeof(AVAudioConvert));
-if (!ctx)
-return NULL;
-ctx->in_channels = in_channels;
-ctx->out_channels = out_channels;
-ctx->fmt_pair = out_fmt + AV_SAMPLE_FMT_NB*in_fmt;
-return ctx;
-}
-
-void av_audio_convert_free(AVAudioConvert *ctx)
-{
-av_free(ctx);
-}
-
-int av_audio_convert(AVAudioConvert *ctx,
-   void * const out[6], const int out_stride[6],
- const void * const  in[6], const int  in_stride[6], int 
len)
-{
-int ch;
-
-//FIXME optimize common cases
-
-for(ch=0; chout_channels; ch++){
-const int is=  in_stride[ch];
-const int os= out_stride[ch];
-const uint8_t *pi=  in[ch];
-uint8_t *po= out[ch];
-uint8_t *end= po + os*len;
-if(!out[ch])
-continue;
-
-#define CONV(ofmt, otype, ifmt, expr)\
-if(ctx->fmt_pair == ofmt + AV_SAMPLE_FMT_NB*ifmt){\
-do{\
-*(otype*)po = expr; pi += is; po += os;\
-}while(po < end);\
-}
-
-//FIXME put things below under ifdefs so we do not waste space for cases no 
codec will need
-//FIXME rounding ?
-
- CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_U8 ,  *(const 
uint8_t*)pi)
-else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_U8 , (*(const 
uint8_t*)pi - 0x80)<<8)
-else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_U8 , (*(const 
uint8_t*)pi - 0x80)<<24)
-else CONV(AV_SAMPLE_FMT_FLT, float  , AV_SAMPLE_FMT_U8 , (*(const 
uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
-else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_U8 , (*(const 
uint8_t*)pi - 0x80)*(1.0 / (1<<7)))
-else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S16, (*(const 
int16_t*)pi>>8) + 0x80)
-else CONV(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16,  *(const 
int16_t*)pi)
-else CONV(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16,  *(const 
int16_t*)pi<<16)
-else CONV(AV_SAMPLE_FMT_FLT, float  , AV_SAMPLE_FMT_S16,  *(const 
int16_t*)pi*(1.0 / (1<<15)))
-else CONV(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S16,  *(const 
int16_t*)pi*(1.0 / (1<<15)))
-else CONV(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S32, (*(const 
int32_t*)pi>>24) + 0x80)
-else CONV(AV_SAMPLE_FMT_S16, i

[libav-devel] [PATCH 3/3] lavfi: do not export the filters from shared objects

2013-10-27 Thread Anton Khirnov
---
 libavfilter/af_aformat.c  |2 +-
 libavfilter/af_amix.c |2 +-
 libavfilter/af_anull.c|2 +-
 libavfilter/af_ashowinfo.c|2 +-
 libavfilter/af_asyncts.c  |2 +-
 libavfilter/af_channelmap.c   |2 +-
 libavfilter/af_channelsplit.c |2 +-
 libavfilter/af_join.c |2 +-
 libavfilter/af_resample.c |2 +-
 libavfilter/af_volume.c   |2 +-
 libavfilter/allfilters.c  |8 
 libavfilter/asink_anullsink.c |2 +-
 libavfilter/asrc_anullsrc.c   |2 +-
 libavfilter/buffersink.c  |4 ++--
 libavfilter/buffersrc.c   |4 ++--
 libavfilter/fifo.c|4 ++--
 libavfilter/setpts.c  |4 ++--
 libavfilter/split.c   |4 ++--
 libavfilter/trim.c|4 ++--
 libavfilter/vf_aspect.c   |4 ++--
 libavfilter/vf_blackframe.c   |2 +-
 libavfilter/vf_boxblur.c  |2 +-
 libavfilter/vf_copy.c |2 +-
 libavfilter/vf_crop.c |2 +-
 libavfilter/vf_cropdetect.c   |2 +-
 libavfilter/vf_delogo.c   |2 +-
 libavfilter/vf_drawbox.c  |2 +-
 libavfilter/vf_drawtext.c |2 +-
 libavfilter/vf_fade.c |2 +-
 libavfilter/vf_fieldorder.c   |2 +-
 libavfilter/vf_format.c   |4 ++--
 libavfilter/vf_fps.c  |2 +-
 libavfilter/vf_frei0r.c   |4 ++--
 libavfilter/vf_gradfun.c  |2 +-
 libavfilter/vf_hflip.c|2 +-
 libavfilter/vf_hqdn3d.c   |2 +-
 libavfilter/vf_interlace.c|2 +-
 libavfilter/vf_libopencv.c|2 +-
 libavfilter/vf_lut.c  |2 +-
 libavfilter/vf_null.c |2 +-
 libavfilter/vf_overlay.c  |2 +-
 libavfilter/vf_pad.c  |2 +-
 libavfilter/vf_pixdesctest.c  |2 +-
 libavfilter/vf_scale.c|2 +-
 libavfilter/vf_select.c   |2 +-
 libavfilter/vf_settb.c|2 +-
 libavfilter/vf_showinfo.c |2 +-
 libavfilter/vf_transpose.c|2 +-
 libavfilter/vf_unsharp.c  |2 +-
 libavfilter/vf_vflip.c|2 +-
 libavfilter/vf_yadif.c|2 +-
 libavfilter/vsink_nullsink.c  |2 +-
 libavfilter/vsrc_color.c  |2 +-
 libavfilter/vsrc_movie.c  |2 +-
 libavfilter/vsrc_nullsrc.c|2 +-
 libavfilter/vsrc_testsrc.c|4 ++--
 56 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index 1f11b48..f074673 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -139,7 +139,7 @@ static const AVFilterPad avfilter_af_aformat_outputs[] = {
 { NULL }
 };
 
-AVFilter avfilter_af_aformat = {
+AVFilter ff_af_aformat = {
 .name  = "aformat",
 .description   = NULL_IF_CONFIG_SMALL("Convert the input audio to one of 
the specified formats."),
 .init  = init,
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 2df0507..bfba150 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -551,7 +551,7 @@ static const AVFilterPad avfilter_af_amix_outputs[] = {
 { NULL }
 };
 
-AVFilter avfilter_af_amix = {
+AVFilter ff_af_amix = {
 .name  = "amix",
 .description   = NULL_IF_CONFIG_SMALL("Audio mixing."),
 .priv_size = sizeof(MixContext),
diff --git a/libavfilter/af_anull.c b/libavfilter/af_anull.c
index a791064..6d7caf3 100644
--- a/libavfilter/af_anull.c
+++ b/libavfilter/af_anull.c
@@ -43,7 +43,7 @@ static const AVFilterPad avfilter_af_anull_outputs[] = {
 { NULL }
 };
 
-AVFilter avfilter_af_anull = {
+AVFilter ff_af_anull = {
 .name  = "anull",
 .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the 
output."),
 
diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c
index c347391..2a2edcf 100644
--- a/libavfilter/af_ashowinfo.c
+++ b/libavfilter/af_ashowinfo.c
@@ -127,7 +127,7 @@ static const AVFilterPad outputs[] = {
 { NULL },
 };
 
-AVFilter avfilter_af_ashowinfo = {
+AVFilter ff_af_ashowinfo = {
 .name= "ashowinfo",
 .description = NULL_IF_CONFIG_SMALL("Show textual information for each 
audio frame."),
 .priv_size   = sizeof(AShowInfoContext),
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 0ddd8b6..b76ddf0 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -313,7 +313,7 @@ static const AVFilterPad avfilter_af_asyncts_outputs[] = {
 { NULL }
 };
 
-AVFilter avfilter_af_asyncts = {
+AVFilter ff_af_asyncts = {
 .name= "asyncts",
 .description = NULL_IF_CONFIG_SMALL("Sync audio data to timestamps"),
 
diff --git a/libavfilter/af_channelmap.c b/libavfilter/af_channelmap.c
index 34d2457..71d51e7 100644
--- a/libavfilter/af_channelmap.c
+++ b/libavfilter/af_channelmap.c
@@ -400,7 +400,7 @@ static const AVFilterPad avfilter_af_channelmap_outputs[] = 
{
 { NULL }
 };
 
-AVFilter avfilter_af_channelmap = {
+AVFilter ff_af_channelmap = {
 .name  = "channelmap",
  

[libav-devel] [PATCH 2/3] lavf: do not export av_register_{rtp, rdt}_dynamic_payload_handlers from shared objects

2013-10-27 Thread Anton Khirnov
---
 libavformat/allformats.c |4 ++--
 libavformat/rdt.c|2 +-
 libavformat/rdt.h|2 +-
 libavformat/rtpdec.c |2 +-
 libavformat/rtpdec.h |2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 36a782b..d72a127 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -210,8 +210,8 @@ void av_register_all(void)
 REGISTER_MUXDEMUX(SAP,  sap);
 REGISTER_DEMUXER (SDP,  sdp);
 #if CONFIG_RTPDEC
-av_register_rtp_dynamic_payload_handlers();
-av_register_rdt_dynamic_payload_handlers();
+ff_register_rtp_dynamic_payload_handlers();
+ff_register_rdt_dynamic_payload_handlers();
 #endif
 REGISTER_DEMUXER (SEGAFILM, segafilm);
 REGISTER_MUXER   (SEGMENT,  segment);
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index 33b0eb8..a90c168 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -564,7 +564,7 @@ RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", 
AVMEDIA_TYPE_AUDIO);
 RDT_HANDLER(video,  "x-pn-realvideo",AVMEDIA_TYPE_VIDEO);
 RDT_HANDLER(audio,  "x-pn-realaudio",AVMEDIA_TYPE_AUDIO);
 
-void av_register_rdt_dynamic_payload_handlers(void)
+void ff_register_rdt_dynamic_payload_handlers(void)
 {
 ff_register_dynamic_payload_handler(&rdt_video_handler);
 ff_register_dynamic_payload_handler(&rdt_audio_handler);
diff --git a/libavformat/rdt.h b/libavformat/rdt.h
index a393299..bd16890 100644
--- a/libavformat/rdt.h
+++ b/libavformat/rdt.h
@@ -62,7 +62,7 @@ void ff_rdt_calc_response_and_checksum(char response[41], 
char chksum[9],
 /**
  * Register RDT-related dynamic payload handlers with our cache.
  */
-void av_register_rdt_dynamic_payload_handlers(void);
+void ff_register_rdt_dynamic_payload_handlers(void);
 
 /**
  * Add subscription information to Subscribe parameter string.
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index e910021..3984489 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -58,7 +58,7 @@ void 
ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler)
 rtp_first_dynamic_payload_handler = handler;
 }
 
-void av_register_rtp_dynamic_payload_handlers(void)
+void ff_register_rtp_dynamic_payload_handlers(void)
 {
 ff_register_dynamic_payload_handler(&ff_amr_nb_dynamic_handler);
 ff_register_dynamic_payload_handler(&ff_amr_wb_dynamic_handler);
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 5539936..6b16117 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -205,7 +205,7 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, 
const char *p,
 PayloadContext *data,
 char *attr, char *value));
 
-void av_register_rtp_dynamic_payload_handlers(void);
+void ff_register_rtp_dynamic_payload_handlers(void);
 
 /**
  * Close the dynamic buffer and make a packet from it.
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] asyncts: fix assignment parenthesis

2013-10-27 Thread Anton Khirnov

On Mon, 28 Oct 2013 03:00:39 +0100, Vittorio Giovara 
 wrote:
> ---
>  libavfilter/af_asyncts.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
> index 0ddd8b6..3ecd4ff 100644
> --- a/libavfilter/af_asyncts.c
> +++ b/libavfilter/af_asyncts.c
> @@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
>  if (s->first_pts != AV_NOPTS_VALUE)
>  handle_trimming(ctx);
>  
> -if (nb_samples = get_delay(s)) {
> +if ((nb_samples = get_delay(s))) {

Err...and what exactly does this fix?

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] asyncts: fix assignment parenthesis

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/af_asyncts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 0ddd8b6..3ecd4ff 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
 if (s->first_pts != AV_NOPTS_VALUE)
 handle_trimming(ctx);
 
-if (nb_samples = get_delay(s)) {
+if ((nb_samples = get_delay(s))) {
 AVFrame *buf = ff_get_audio_buffer(link, nb_samples);
 if (!buf)
 return AVERROR(ENOMEM);
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/3] avfilter: fix const use of avfilter_next

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/avfilter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 68e0f2c..b18c0cb 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -277,7 +277,7 @@ const
 #endif
 AVFilter *avfilter_get_by_name(const char *name)
 {
-AVFilter *f = NULL;
+const AVFilter *f = NULL;
 
 if (!name)
 return NULL;
@@ -343,7 +343,7 @@ static void *filter_child_next(void *obj, void *prev)
 
 static const AVClass *filter_child_class_next(const AVClass *prev)
 {
-AVFilter *f = NULL;
+const AVFilter *f = NULL;
 
 while (prev && (f = avfilter_next(f)))
 if (f->priv_class == prev)
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/3] avfilter: have avfilter_get_by_name return const for next bump

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/avfilter.c | 3 +++
 libavfilter/avfilter.h | 3 +++
 libavfilter/version.h  | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 88e39bf..68e0f2c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -272,6 +272,9 @@ int ff_poll_frame(AVFilterLink *link)
 
 static AVFilter *first_filter;
 
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
 AVFilter *avfilter_get_by_name(const char *name)
 {
 AVFilter *f = NULL;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index ca11be9..9f14afd 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -764,6 +764,9 @@ int avfilter_register(AVFilter *filter);
  * @return the filter definition, if any matching one is registered.
  * NULL if none found.
  */
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
 AVFilter *avfilter_get_by_name(const char *name);
 
 /**
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 9c84e0f..02f348e 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -68,5 +68,8 @@
 #ifndef FF_API_OLD_FILTER_REGISTER
 #define FF_API_OLD_FILTER_REGISTER  (LIBAVFILTER_VERSION_MAJOR < 4)
 #endif
+#ifndef FF_API_NOCONST_GET_NAME
+#define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 4)
+#endif
 
 #endif /* AVFILTER_VERSION_H */
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] avfilter: use the new const attribute for avfilter_get_by_name

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/avfilter.c  | 4 
 libavfilter/avfiltergraph.c | 6 ++
 libavfilter/graphparser.c   | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b18c0cb..c2691e5 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -284,7 +284,11 @@ AVFilter *avfilter_get_by_name(const char *name)
 
 while ((f = avfilter_next(f)))
 if (!strcmp(f->name, name))
+#if !FF_API_NOCONST_GET_NAME
 return f;
+#else
+return (AVFilter *)f;
+#endif
 
 return NULL;
 }
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 0fc385c..6414816 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -316,6 +316,9 @@ static int query_formats(AVFilterGraph *graph, AVClass 
*log_ctx)
 
 if (convert_needed) {
 AVFilterContext *convert;
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
 AVFilter *filter;
 AVFilterLink *inlink, *outlink;
 char scale_args[256];
@@ -782,6 +785,9 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass 
*log_ctx)
 for (j = 0; j < f->nb_inputs; j++) {
 AVFilterLink *link = f->inputs[j];
 AVFilterContext *fifo_ctx;
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
 AVFilter *fifo;
 char name[32];
 
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 00764b6..88cc254 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -94,6 +94,9 @@ static char *parse_link_name(const char **buf, void *log_ctx)
 static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int 
index,
  const char *filt_name, const char *args, void 
*log_ctx)
 {
+#if !FF_API_NOCONST_GET_NAME
+const
+#endif
 AVFilter *filt;
 char inst_name[30];
 char tmp_args[256];
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] wtv: fix variable sign in format

2013-10-27 Thread Vittorio Giovara
 libavformat/wtv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index b144eb6..0c24fd7 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -525,7 +525,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, 
const char *key, int ty
 else
 snprintf(buf, buf_size, "%"PRIi64, num);
 } else if (type == 5 && length == 2) {
-snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
+snprintf(buf, buf_size, "%u", avio_rl16(pb));
 } else if (type == 6 && length == 16) {
 ff_asf_guid guid;
 avio_read(pb, guid, 16);
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] HNM4/HNM4A demuxer & video decoder

2013-10-27 Thread David Kment

updated again, patch attached.


 Changelog|   1 +
 doc/general.texi |   3 +
 libavcodec/Makefile  |   1 +
 libavcodec/allcodecs.c   |   1 +
 libavcodec/avcodec.h |   1 +
 libavcodec/codec_desc.c  |   7 +
 libavcodec/hnm4video.c   | 459 +++
 libavcodec/version.h |   2 +-
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/hnm.c| 205 +
 libavformat/version.h|   2 +-
 12 files changed, 682 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 4032d07..547d7d2 100644
--- a/Changelog
+++ b/Changelog
@@ -40,6 +40,7 @@ version 10:
 - Opus in Ogg demuxing
 - Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support)
 - F4V muxer
+- HNM version 4 demuxer and video decoder added
 
 
 version 9:
diff --git a/doc/general.texi b/doc/general.texi
index c2dc272..c50e89f 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -194,6 +194,8 @@ library:
 @item GXF   @tab X @tab X
 @tab General eXchange Format SMPTE 360M, used by Thomson Grass Valley
  playout servers.
+@item HNM @tab   @tab X
+@tab Only version 4 supported, used in some games from Cryo Interactive
 @item id Quake II CIN video @tab   @tab X
 @item id RoQ@tab X @tab X
 @tab Used in Quake III, Jedi Knight 2, other computer games.
@@ -524,6 +526,7 @@ following image formats are supported:
 @item H.263+ / H.263-1998 / H.263 version 2  @tab  X  @tab  X
 @item H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10  @tab  E  @tab  X
 @tab encoding supported through external library libx264
+@item HNM version 4  @tab @tab  X
 @item HuffYUV@tab  X  @tab  X
 @item HuffYUV FFmpeg variant @tab  X  @tab  X
 @item IBM Ultimotion @tab @tab  X
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8e0d60d..f64a56f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -197,6 +197,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o
   \
   h264_loopfilter.o h264_direct.o  
\
   cabac.o h264_sei.o h264_ps.o 
\
   h264_refs.o h264_cavlc.o h264_cabac.o
+OBJS-$(CONFIG_HNM4_VIDEO_DECODER)  += hnm4video.o
 OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
 OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
 OBJS-$(CONFIG_IAC_DECODER) += imc.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 55d7957..b62efb9 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -153,6 +153,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(H263I, h263i);
 REGISTER_ENCODER(H263P, h263p);
 REGISTER_DECODER(H264,  h264);
+REGISTER_DECODER(HNM4_VIDEO,hnm4_video);
 REGISTER_ENCDEC (HUFFYUV,   huffyuv);
 REGISTER_DECODER(IDCIN, idcin);
 REGISTER_DECODER(IFF_BYTERUN1,  iff_byterun1);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 84bfccb..3d2412e 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -274,6 +274,7 @@ enum AVCodecID {
 AV_CODEC_ID_ESCAPE130,
 AV_CODEC_ID_G2M,
 AV_CODEC_ID_WEBP,
+AV_CODEC_ID_HNM4_VIDEO,
 
 /* various PCM "codecs" */
 AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at the 
start of audio codecs
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index f486cb2..ddeca8a 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1236,6 +1236,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY |
  AV_CODEC_PROP_LOSSLESS,
 },
+{
+.id= AV_CODEC_ID_HNM4_VIDEO,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "hnm4video",
+.long_name = NULL_IF_CONFIG_SMALL("HNM 4 video"),
+.props = AV_CODEC_PROP_LOSSY,
+},
 
 /* various PCM "codecs" */
 {
diff --git a/libavcodec/hnm4video.c b/libavcodec/hnm4video.c
new file mode 100644
index 000..22acd0d
--- /dev/null
+++ b/libavcodec/hnm4video.c
@@ -0,0 +1,459 @@
+/*
+ * Cryo Interactive Entertainment HNM4 video decoder
+ * Copyright (c) 2012 David Kment
+ *
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 det

Re: [libav-devel] [PATCH] lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.

2013-10-27 Thread Justin Ruggles
On 10/27/2013 04:49 PM, Anton Khirnov wrote:
> Just crccheck prints a warning, crccheck+explode returns an error.
> 
> Also document this behavior.
> ---
>  libavcodec/ac3dec.c  |2 ++
>  libavcodec/alsdec.c  |2 ++
>  libavcodec/avcodec.h |7 +++
>  libavcodec/takdec.c  |6 --
>  libavcodec/tta.c |6 --
>  libavcodec/wavpack.c |8 +---
>  6 files changed, 24 insertions(+), 7 deletions(-)

LGTM

Thanks,
Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: remove unreliable timestamp guessing heuristic

2013-10-27 Thread Luca Barbato
On 27/10/13 21:47, Anton Khirnov wrote:
> 
> On Sun, 27 Oct 2013 21:24:58 +0100, Luca Barbato  wrote:
>> On 27/10/13 21:16, Anton Khirnov wrote:
>>> ---
>>>  libavformat/avformat.h |8 
>>>  libavformat/seek.c |3 ---
>>>  libavformat/seek.h |1 -
>>>  libavformat/utils.c|   22 --
>>>  4 files changed, 34 deletions(-)
>>>
>>
>> If it doesn't break the usual suspect (aka ogg and ts) fine.
>>
> 
> It's h264 only, so no ogg (but maybe omg^wogm)
> 
> Otherwise, I have no idea whether there are any weird samples it might break,
> but we know of at least one sample it fixes.
> 
> If it results in some breakage, then we'll fix it properly.
> 
We'll see then.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] h263: Check init_get_bits return value

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 12:22:20 +0100, Luca Barbato  wrote:
> From: Michael Niedermayer 
> 
> And use init_get_bits8 to check for integer overflows while at it.
> 
> CC: libav-sta...@libav.org
> Signed-off-by: Luca Barbato 
> ---
> 
> We expect the first call to fail to find a vol header apparently, I hadn't
> look that deeply into mpeg4 yet (first I had to clean it up a bit).
> 
>  libavcodec/h263dec.c | 17 +++--
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 

LGTM

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avfilter: correctly return/use a const pointer

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 17:23:13 +0100, Vittorio Giovara 
 wrote:
> ---
>  libavfilter/avfilter.c | 6 +++---
>  libavfilter/avfilter.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 88e39bf..6b933ad 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -272,9 +272,9 @@ int ff_poll_frame(AVFilterLink *link)
>  
>  static AVFilter *first_filter;
>  
> -AVFilter *avfilter_get_by_name(const char *name)
> +const AVFilter *avfilter_get_by_name(const char *name)

This should be conditional, as it's an API change. I.e. under a FF_API define
triggered on the next bump

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] avio: K&R formatting cosmetics

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 14:45:29 +0100, Luca Barbato  wrote:
> ---
>  libavformat/avio.c | 88 
> ++
>  1 file changed, 49 insertions(+), 39 deletions(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 689d4a1..8f079bf 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -42,8 +42,10 @@ URLProtocol *ffurl_protocol_next(URLProtocol *prev)
>  static const char *urlcontext_to_name(void *ptr)
>  {
>  URLContext *h = (URLContext *)ptr;
> -if(h->prot) return h->prot->name;
> -elsereturn "NULL";
> +if (h->prot)
> +return h->prot->name;
> +else
> +return "NULL";
>  }
>  
>  static void *urlcontext_child_next(void *obj, void *prev)
> @@ -68,26 +70,25 @@ static const AVClass *urlcontext_child_class_next(const 
> AVClass *prev)
>  if (p->priv_data_class)
>  return p->priv_data_class;
>  return NULL;
> -
>  }
>  
> -static const AVOption options[] = {{NULL}};
> +static const AVOption options[] = { { NULL } };
>  const AVClass ffurl_context_class = {
> -.class_name = "URLContext",
> -.item_name  = urlcontext_to_name,
> -.option = options,
> -.version= LIBAVUTIL_VERSION_INT,
> -.child_next = urlcontext_child_next,
> +.class_name   = "URLContext",
> +.item_name= urlcontext_to_name,
> +.option   = options,
> +.version  = LIBAVUTIL_VERSION_INT,
> +.child_next   = urlcontext_child_next,
>  .child_class_next = urlcontext_child_class_next,
>  };
>  /*@}*/
>  
> -
>  const char *avio_enum_protocols(void **opaque, int output)
>  {
>  URLProtocol *p;
>  *opaque = ffurl_protocol_next(*opaque);
> -if (!(p = *opaque)) return NULL;
> +if (!(p = *opaque))
> +return NULL;
>  if ((output && p->url_write) || (!output && p->url_read))
>  return p->name;
>  return avio_enum_protocols(opaque, output);
> @@ -97,20 +98,21 @@ int ffurl_register_protocol(URLProtocol *protocol, int 
> size)
>  {
>  URLProtocol **p;
>  if (size < sizeof(URLProtocol)) {
> -URLProtocol* temp = av_mallocz(sizeof(URLProtocol));
> +URLProtocol *temp = av_mallocz(sizeof(URLProtocol));
>  memcpy(temp, protocol, size);
>  protocol = temp;
>  }
>  p = &first_protocol;
> -while (*p != NULL) p = &(*p)->next;
> -*p = protocol;
> +while (*p != NULL)
> +p = &(*p)->next;
> +*p = protocol;
>  protocol->next = NULL;
>  return 0;
>  }
>  
> -static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
> -   const char *filename, int flags,
> -   const AVIOInterruptCB *int_cb)
> +static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
> +  const char *filename, int flags,
> +  const AVIOInterruptCB *int_cb)
>  {
>  URLContext *uc;
>  int err;
> @@ -125,16 +127,16 @@ static int url_alloc_for_protocol (URLContext **puc, 
> struct URLProtocol *up,
>  goto fail;
>  }
>  uc->av_class = &ffurl_context_class;
> -uc->filename = (char *) &uc[1];
> +uc->filename = (char *)&uc[1];
>  strcpy(uc->filename, filename);
> -uc->prot = up;
> -uc->flags = flags;
> -uc->is_streamed = 0; /* default = not streamed */
> +uc->prot= up;
> +uc->flags   = flags;
> +uc->is_streamed = 0; /* default = not streamed */
>  uc->max_packet_size = 0; /* default: stream file */
>  if (up->priv_data_size) {
>  uc->priv_data = av_mallocz(up->priv_data_size);
>  if (up->priv_data_class) {
> -*(const AVClass**)uc->priv_data = up->priv_data_class;
> +*(const AVClass **)uc->priv_data = up->priv_data_class;
>  av_opt_set_defaults(uc->priv_data);
>  }
>  }
> @@ -143,7 +145,7 @@ static int url_alloc_for_protocol (URLContext **puc, 
> struct URLProtocol *up,
>  
>  *puc = uc;
>  return 0;
> - fail:
> +fail:
>  *puc = NULL;
>  #if CONFIG_NETWORK
>  if (up->flags & URL_PROTOCOL_FLAG_NETWORK)
> @@ -152,19 +154,22 @@ static int url_alloc_for_protocol (URLContext **puc, 
> struct URLProtocol *up,
>  return err;
>  }
>  
> -int ffurl_connect(URLContext* uc, AVDictionary **options)
> +int ffurl_connect(URLContext *uc, AVDictionary **options)
>  {
>  int err =
> -uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, 
> uc->flags, options) :
> +uc->prot->url_open2 ? uc->prot->url_open2(uc,
> +  uc->filename,
> +  uc->flags,
> +  options) :
>  uc->prot->url_open(uc, uc->filename, uc->flags);
>  if (err)
>  return err;
>  uc->is_connected

[libav-devel] [PATCH] lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.

2013-10-27 Thread Anton Khirnov
Just crccheck prints a warning, crccheck+explode returns an error.

Also document this behavior.
---
 libavcodec/ac3dec.c  |2 ++
 libavcodec/alsdec.c  |2 ++
 libavcodec/avcodec.h |7 +++
 libavcodec/takdec.c  |6 --
 libavcodec/tta.c |6 --
 libavcodec/wavpack.c |8 +---
 6 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index fd0bf33..d664325 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1330,6 +1330,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void 
*data,
 if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2],
s->frame_size - 2)) {
 av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
+if (avctx->err_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
 err = AAC_AC3_PARSE_ERROR_CRC;
 }
 }
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index d4f103b..782a1b8 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1545,6 +1545,8 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame_ptr,
 if (ctx->cur_frame_length != sconf->frame_length &&
 ctx->crc_org != ctx->crc) {
 av_log(avctx, AV_LOG_ERROR, "CRC error.\n");
+if (avctx->err_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 }
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 84bfccb..ad45d97 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2332,6 +2332,13 @@ typedef struct AVCodecContext {
  * - decoding: Set by user.
  */
 int err_recognition;
+
+/**
+ * Verify checksums embedded in the bitstream (could be of either encoded or
+ * decoded data, depending on the codec) and print an error message on 
mismatch.
+ * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the
+ * decoder returning an error.
+ */
 #define AV_EF_CRCCHECK  (1<<0)
 #define AV_EF_BITSTREAM (1<<1)
 #define AV_EF_BUFFER(1<<2)
diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c
index 8b39661..0d2dcbb 100644
--- a/libavcodec/takdec.c
+++ b/libavcodec/takdec.c
@@ -693,7 +693,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void 
*data,
 if (avctx->err_recognition & AV_EF_CRCCHECK) {
 if (ff_tak_check_crc(pkt->data, hsize)) {
 av_log(avctx, AV_LOG_ERROR, "CRC error\n");
-return AVERROR_INVALIDDATA;
+if (avctx->err_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 }
 
@@ -867,7 +868,8 @@ static int tak_decode_frame(AVCodecContext *avctx, void 
*data,
 if (ff_tak_check_crc(pkt->data + hsize,
  get_bits_count(gb) / 8 - hsize)) {
 av_log(avctx, AV_LOG_ERROR, "CRC error\n");
-return AVERROR_INVALIDDATA;
+if (avctx->err_recognition & AV_EF_EXPLODE)
+return AVERROR_INVALIDDATA;
 }
 }
 
diff --git a/libavcodec/tta.c b/libavcodec/tta.c
index 53c8aca..4d2e2a0 100644
--- a/libavcodec/tta.c
+++ b/libavcodec/tta.c
@@ -275,7 +275,8 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
 avctx->extradata_size - 26 < total_frames * 4)
 av_log(avctx, AV_LOG_WARNING, "Seek table missing or too small\n");
 else if (avctx->err_recognition & AV_EF_CRCCHECK) {
-if (tta_check_crc(s, avctx->extradata + 22, total_frames * 4))
+int ret = tta_check_crc(s, avctx->extradata + 22, total_frames * 
4);
+if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE)
 return AVERROR_INVALIDDATA;
 }
 skip_bits_long(&s->gb, 32 * total_frames);
@@ -316,7 +317,8 @@ static int tta_decode_frame(AVCodecContext *avctx, void 
*data,
 int32_t *p;
 
 if (avctx->err_recognition & AV_EF_CRCCHECK) {
-if (buf_size < 4 || tta_check_crc(s, buf, buf_size - 4))
+if (buf_size < 4 ||
+(tta_check_crc(s, buf, buf_size - 4) && avctx->err_recognition & 
AV_EF_EXPLODE))
 return AVERROR_INVALIDDATA;
 }
 
diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index bdc2a81..cbc5b04 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -699,9 +699,11 @@ static inline int wv_unpack_mono(WavpackFrameContext *s, 
GetBitContext *gb,
 } while (!last && count < s->samples);
 
 wv_reset_saved_context(s);
-if ((s->avctx->err_recognition & AV_EF_CRCCHECK) &&
-wv_check_crc(s, crc, crc_extra_bits))
-return AVERROR_INVALIDDATA;
+if (s->avctx->err_recognition & AV_EF_CRCCHECK) {
+int ret = wv_check_crc(s, crc, crc_extra_bits);
+if (ret < 0 && s->avctx->err_recognition & AV_EF_EXPLODE)
+return ret;
+}
 
 return 0;
 }
-- 
1.7.10.4

___
libav-devel mailing list
libav

Re: [libav-devel] [PATCH] lavf: remove unreliable timestamp guessing heuristic

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 21:24:58 +0100, Luca Barbato  wrote:
> On 27/10/13 21:16, Anton Khirnov wrote:
> > ---
> >  libavformat/avformat.h |8 
> >  libavformat/seek.c |3 ---
> >  libavformat/seek.h |1 -
> >  libavformat/utils.c|   22 --
> >  4 files changed, 34 deletions(-)
> > 
> 
> If it doesn't break the usual suspect (aka ogg and ts) fine.
> 

It's h264 only, so no ogg (but maybe omg^wogm)

Otherwise, I have no idea whether there are any weird samples it might break,
but we know of at least one sample it fixes.

If it results in some breakage, then we'll fix it properly.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavf: remove unreliable timestamp guessing heuristic

2013-10-27 Thread Luca Barbato
On 27/10/13 21:16, Anton Khirnov wrote:
> ---
>  libavformat/avformat.h |8 
>  libavformat/seek.c |3 ---
>  libavformat/seek.h |1 -
>  libavformat/utils.c|   22 --
>  4 files changed, 34 deletions(-)
> 

If it doesn't break the usual suspect (aka ogg and ts) fine.


lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] lavf: remove unreliable timestamp guessing heuristic

2013-10-27 Thread Anton Khirnov
---
 libavformat/avformat.h |8 
 libavformat/seek.c |3 ---
 libavformat/seek.h |1 -
 libavformat/utils.c|   22 --
 4 files changed, 34 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index ce7a2f8..a8e3a7d 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -730,14 +730,6 @@ typedef struct AVStream {
 int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) 
*/
 
 // Timestamp generation support:
-/**
- * Timestamp corresponding to the last dts sync point.
- *
- * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
- * a DTS is received from the underlying container. Otherwise set to
- * AV_NOPTS_VALUE by default.
- */
-int64_t reference_dts;
 int64_t first_dts;
 int64_t cur_dts;
 int64_t last_IP_pts;
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 524cd87..e17cdcc 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -428,13 +428,11 @@ AVParserState *ff_store_parser_state(AVFormatContext *s)
 ss->parser= st->parser;
 ss->last_IP_pts   = st->last_IP_pts;
 ss->cur_dts   = st->cur_dts;
-ss->reference_dts = st->reference_dts;
 ss->probe_packets = st->probe_packets;
 
 st->parser= NULL;
 st->last_IP_pts   = AV_NOPTS_VALUE;
 st->cur_dts   = AV_NOPTS_VALUE;
-st->reference_dts = AV_NOPTS_VALUE;
 st->probe_packets = MAX_PROBE_PACKETS;
 }
 
@@ -467,7 +465,6 @@ void ff_restore_parser_state(AVFormatContext *s, 
AVParserState *state)
 st->parser= ss->parser;
 st->last_IP_pts   = ss->last_IP_pts;
 st->cur_dts   = ss->cur_dts;
-st->reference_dts = ss->reference_dts;
 st->probe_packets = ss->probe_packets;
 }
 
diff --git a/libavformat/seek.h b/libavformat/seek.h
index e79d7bd..44cd369 100644
--- a/libavformat/seek.h
+++ b/libavformat/seek.h
@@ -33,7 +33,6 @@ typedef struct AVParserStreamState {
 AVCodecParserContext   *parser;
 int64_t last_IP_pts;
 int64_t cur_dts;
-int64_t reference_dts;
 int probe_packets;
 } AVParserStreamState;
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 0700c5d..987d682 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -771,25 +771,6 @@ static void compute_pkt_fields(AVFormatContext *s, 
AVStream *st,
 pkt->dts += offset;
 }
 
-if (pc && pc->dts_sync_point >= 0) {
-// we have synchronization info from the parser
-int64_t den = st->codec->time_base.den * (int64_t) st->time_base.num;
-if (den > 0) {
-int64_t num = st->codec->time_base.num * (int64_t) 
st->time_base.den;
-if (pkt->dts != AV_NOPTS_VALUE) {
-// got DTS from the stream, update reference timestamp
-st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / 
den;
-pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-} else if (st->reference_dts != AV_NOPTS_VALUE) {
-// compute DTS based on reference timestamp
-pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / 
den;
-pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
-}
-if (pc->dts_sync_point > 0)
-st->reference_dts = pkt->dts; // new reference
-}
-}
-
 /* This may be redundant, but it should not hurt. */
 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts > 
pkt->dts)
 presentation_delayed = 1;
@@ -1214,7 +1195,6 @@ void ff_read_frame_flush(AVFormatContext *s)
 }
 st->last_IP_pts = AV_NOPTS_VALUE;
 st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an 
unspecified origin */
-st->reference_dts = AV_NOPTS_VALUE;
 
 st->probe_packets = MAX_PROBE_PACKETS;
 
@@ -1868,7 +1848,6 @@ static void estimate_timings_from_pts(AVFormatContext 
*ic, int64_t old_offset)
 st= ic->streams[i];
 st->cur_dts= st->first_dts;
 st->last_IP_pts = AV_NOPTS_VALUE;
-st->reference_dts = AV_NOPTS_VALUE;
 }
 }
 
@@ -2618,7 +2597,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, AVCodec 
*c)
 st->last_IP_pts = AV_NOPTS_VALUE;
 for(i=0; ipts_buffer[i]= AV_NOPTS_VALUE;
-st->reference_dts = AV_NOPTS_VALUE;
 
 st->sample_aspect_ratio = (AVRational){0,1};
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] g722dec: Change bits_per_codeword to the right option type

2013-10-27 Thread Luca Barbato
On 27/10/13 21:01, Martin Storsjö wrote:
> This isn't a set of flags but just a plain integer in the range
> 6-8.
> ---
>  libavcodec/g722dec.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c
> index 26aa6cf..26f288b 100644
> --- a/libavcodec/g722dec.c
> +++ b/libavcodec/g722dec.c
> @@ -44,7 +44,7 @@
>  #define OFFSET(x) offsetof(G722Context, x)
>  #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
>  static const AVOption options[] = {
> -{ "bits_per_codeword", "Bits per G722 codeword", 
> OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { .i64 = 8 }, 6, 8, AD },
> +{ "bits_per_codeword", "Bits per G722 codeword", 
> OFFSET(bits_per_codeword), AV_OPT_TYPE_INT, { .i64 = 8 }, 6, 8, AD },
>  { NULL }
>  };
>  
> 


Ok.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] g722dec: Change bits_per_codeword to the right option type

2013-10-27 Thread Martin Storsjö
This isn't a set of flags but just a plain integer in the range
6-8.
---
 libavcodec/g722dec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c
index 26aa6cf..26f288b 100644
--- a/libavcodec/g722dec.c
+++ b/libavcodec/g722dec.c
@@ -44,7 +44,7 @@
 #define OFFSET(x) offsetof(G722Context, x)
 #define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
-{ "bits_per_codeword", "Bits per G722 codeword", 
OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { .i64 = 8 }, 6, 8, AD },
+{ "bits_per_codeword", "Bits per G722 codeword", 
OFFSET(bits_per_codeword), AV_OPT_TYPE_INT, { .i64 = 8 }, 6, 8, AD },
 { NULL }
 };
 
-- 
1.7.9.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] fate.sh: Allow non-fast-forwards when updating sources

2013-10-27 Thread Martin Storsjö

On Fri, 25 Oct 2013, Diego Biurrun wrote:


---
tests/fate.sh |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/fate.sh b/tests/fate.sh
index 7505181..6e0c0c6 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -35,7 +35,7 @@ checkout(){
update()(
cd ${src} || return
case "$repo" in
-git:*) git pull --quiet ;;
+git:*) git fetch --force; git reset --hard origin/master ;;
esac
)

--
1.7.9.5


Ok with me.

// Martin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavr: check that current_buffer is not NULL before using it

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 15:03:57 -0400, Justin Ruggles  
wrote:
> Fixes a segfault during resampling when compiled with -DDEBUG.
> Fixes all fate-lavr-resample tests with -DDBUG.
> 
> CC:libav-sta...@libav.org
> ---
>  libavresample/utils.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavresample/utils.c b/libavresample/utils.c
> index b79def9..2dd3d06 100644
> --- a/libavresample/utils.c
> +++ b/libavresample/utils.c
> @@ -438,7 +438,8 @@ int attribute_align_arg 
> avresample_convert(AVAudioResampleContext *avr,
>  resample_out = &output_buffer;
>  else
>  resample_out = avr->resample_out_buffer;
> -av_dlog(avr, "[resample] %s to %s\n", current_buffer->name,
> +av_dlog(avr, "[resample] %s to %s\n",
> +current_buffer ? current_buffer->name : "null",
>  resample_out->name);
>  ret = ff_audio_resample(avr->resample, resample_out,
>  current_buffer);
> -- 
> 1.7.1
> 

Looks ok with the typo foxed.

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavr: check that current_buffer is not NULL before using it

2013-10-27 Thread Luca Barbato
On 27/10/13 20:03, Justin Ruggles wrote:
> Fixes a segfault during resampling when compiled with -DDEBUG.
> Fixes all fate-lavr-resample tests with -DDBUG.
> 
> CC:libav-sta...@libav.org
> ---
>  libavresample/utils.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavresample/utils.c b/libavresample/utils.c
> index b79def9..2dd3d06 100644
> --- a/libavresample/utils.c
> +++ b/libavresample/utils.c
> @@ -438,7 +438,8 @@ int attribute_align_arg 
> avresample_convert(AVAudioResampleContext *avr,
>  resample_out = &output_buffer;
>  else
>  resample_out = avr->resample_out_buffer;
> -av_dlog(avr, "[resample] %s to %s\n", current_buffer->name,
> +av_dlog(avr, "[resample] %s to %s\n",
> +current_buffer ? current_buffer->name : "null",
>  resample_out->name);
>  ret = ff_audio_resample(avr->resample, resample_out,
>  current_buffer);
> 

Ok.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavr: check that current_buffer is not NULL before using it

2013-10-27 Thread Diego Biurrun
On Sun, Oct 27, 2013 at 03:03:57PM -0400, Justin Ruggles wrote:
> Fixes a segfault during resampling when compiled with -DDEBUG.
> Fixes all fate-lavr-resample tests with -DDBUG.
> 
> CC:libav-sta...@libav.org
> ---
>  libavresample/utils.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

LGTM

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavr: check that current_buffer is not NULL before using it

2013-10-27 Thread Justin Ruggles
On 10/27/2013 03:03 PM, Justin Ruggles wrote:
> Fixes a segfault during resampling when compiled with -DDEBUG.
> Fixes all fate-lavr-resample tests with -DDBUG.

oops. typo fixed locally.

-Justin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] lavr: check that current_buffer is not NULL before using it

2013-10-27 Thread Justin Ruggles
Fixes a segfault during resampling when compiled with -DDEBUG.
Fixes all fate-lavr-resample tests with -DDBUG.

CC:libav-sta...@libav.org
---
 libavresample/utils.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavresample/utils.c b/libavresample/utils.c
index b79def9..2dd3d06 100644
--- a/libavresample/utils.c
+++ b/libavresample/utils.c
@@ -438,7 +438,8 @@ int attribute_align_arg 
avresample_convert(AVAudioResampleContext *avr,
 resample_out = &output_buffer;
 else
 resample_out = avr->resample_out_buffer;
-av_dlog(avr, "[resample] %s to %s\n", current_buffer->name,
+av_dlog(avr, "[resample] %s to %s\n",
+current_buffer ? current_buffer->name : "null",
 resample_out->name);
 ret = ff_audio_resample(avr->resample, resample_out,
 current_buffer);
-- 
1.7.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] wtv: silence a format warning

2013-10-27 Thread Justin Ruggles
On 10/27/2013 01:18 PM, Vittorio Giovara wrote:
> ---
>  libavformat/wtv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/wtv.c b/libavformat/wtv.c
> index b144eb6..b150e21 100644
> --- a/libavformat/wtv.c
> +++ b/libavformat/wtv.c
> @@ -525,7 +525,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, 
> const char *key, int ty
>  else
>  snprintf(buf, buf_size, "%"PRIi64, num);
>  } else if (type == 5 && length == 2) {
> -snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
> +snprintf(buf, buf_size, "%"PRIi16, (short int) avio_rl16(pb));
>  } else if (type == 6 && length == 16) {
>  ff_asf_guid guid;
>  avio_read(pb, guid, 16);

avio_rl16() returns unsigned int. If the intent is to treat it as signed
16-bit, just casting it like that has implementation-defined behavior.
The correct way to do this would be with a union (for an example see
libavcodec/mathops.h:ff_u8_to_s8() or libavutil/intreadwrite.h:av_alias*)

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/3] wtv: silence a format warning

2013-10-27 Thread Vittorio Giovara
---
 libavformat/wtv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index b144eb6..b150e21 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -525,7 +525,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, 
const char *key, int ty
 else
 snprintf(buf, buf_size, "%"PRIi64, num);
 } else if (type == 5 && length == 2) {
-snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
+snprintf(buf, buf_size, "%"PRIi16, (short int) avio_rl16(pb));
 } else if (type == 6 && length == 16) {
 ff_asf_guid guid;
 avio_read(pb, guid, 16);
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/3] ansi: fix possible use of uninitialized variables

2013-10-27 Thread Vittorio Giovara
---
 libavcodec/ansi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index ae67f3c..c0b6d61 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -224,7 +224,8 @@ static int execute_code(AVCodecContext * avctx, int c)
 default:
 avpriv_request_sample(avctx, "Unsupported screen mode");
 }
-if (width != avctx->width || height != avctx->height) {
+if (s->args[0] != 7 && // line wrapping does not init width and height
+(width != avctx->width || height != avctx->height)) {
 av_frame_unref(s->frame);
 avcodec_set_dimensions(avctx, width, height);
 ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF);
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/3] avfilter: fix use of const avfilter_get_by_name

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/avfiltergraph.c | 4 ++--
 libavfilter/graphparser.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 0fc385c..1c09685 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -316,7 +316,7 @@ static int query_formats(AVFilterGraph *graph, AVClass 
*log_ctx)
 
 if (convert_needed) {
 AVFilterContext *convert;
-AVFilter *filter;
+const AVFilter *filter;
 AVFilterLink *inlink, *outlink;
 char scale_args[256];
 char inst_name[30];
@@ -782,7 +782,7 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass 
*log_ctx)
 for (j = 0; j < f->nb_inputs; j++) {
 AVFilterLink *link = f->inputs[j];
 AVFilterContext *fifo_ctx;
-AVFilter *fifo;
+const AVFilter *fifo;
 char name[32];
 
 if (!link->dstpad->needs_fifo)
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 00764b6..28bcbdc 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -94,7 +94,7 @@ static char *parse_link_name(const char **buf, void *log_ctx)
 static int create_filter(AVFilterContext **filt_ctx, AVFilterGraph *ctx, int 
index,
  const char *filt_name, const char *args, void 
*log_ctx)
 {
-AVFilter *filt;
+const AVFilter *filt;
 char inst_name[30];
 char tmp_args[256];
 int ret;
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] fate: fix fieldorder test

2013-10-27 Thread Vittorio Giovara
On Sat, Oct 26, 2013 at 6:26 PM, Luca Barbato  wrote:
> On 26/10/13 18:21, Vittorio Giovara wrote:
>> From: Paul B Mahol 
>>
>> swscale is called in from the 420 to 422 conversion
>> ---
>> now complete patch...
>> Vittorio
>>
>
> Just for being annoying, what about using the 422 source from start and
> avoid a roundtrip to swscale?
>
> lu

Getting a 422 source would require redoing the whole test in a
different way and only other format easily obtainable (y8) is mostly
useless.
So for now let's settle on adding the bitexactact flags.

The world longs for a hero named avscale.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/3] vf_fieldorder: remove superfluous get_video_buffer

2013-10-27 Thread Vittorio Giovara
On Thu, Oct 24, 2013 at 2:22 PM, Vittorio Giovara
 wrote:
> ---
>  libavfilter/vf_fieldorder.c |9 -
>  1 file changed, 9 deletions(-)
>
> diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
> index 852c871..cd8040d 100644
> --- a/libavfilter/vf_fieldorder.c
> +++ b/libavfilter/vf_fieldorder.c
> @@ -84,14 +84,6 @@ static int config_input(AVFilterLink *inlink)
>  return 0;
>  }
>
> -static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
> -{
> -AVFilterContext   *ctx= inlink->dst;
> -AVFilterLink  *outlink= ctx->outputs[0];
> -
> -return ff_get_video_buffer(outlink, w, h);
> -}
> -
>  static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>  {
>  AVFilterContext   *ctx = inlink->dst;
> @@ -174,7 +166,6 @@ static const AVFilterPad avfilter_vf_fieldorder_inputs[] 
> = {
>  .name = "default",
>  .type = AVMEDIA_TYPE_VIDEO,
>  .config_props = config_input,
> -.get_video_buffer = get_video_buffer,
>  .filter_frame = filter_frame,
>  .needs_writable   = 1,
>  },
> --
> 1.7.9.5
>

Ping review.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avfilter: correctly return/use a const pointer

2013-10-27 Thread Vittorio Giovara
---
 libavfilter/avfilter.c | 6 +++---
 libavfilter/avfilter.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 88e39bf..6b933ad 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -272,9 +272,9 @@ int ff_poll_frame(AVFilterLink *link)
 
 static AVFilter *first_filter;
 
-AVFilter *avfilter_get_by_name(const char *name)
+const AVFilter *avfilter_get_by_name(const char *name)
 {
-AVFilter *f = NULL;
+const AVFilter *f = NULL;
 
 if (!name)
 return NULL;
@@ -340,7 +340,7 @@ static void *filter_child_next(void *obj, void *prev)
 
 static const AVClass *filter_child_class_next(const AVClass *prev)
 {
-AVFilter *f = NULL;
+const AVFilter *f = NULL;
 
 while (prev && (f = avfilter_next(f)))
 if (f->priv_class == prev)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index ca11be9..d8f868c 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -764,7 +764,7 @@ int avfilter_register(AVFilter *filter);
  * @return the filter definition, if any matching one is registered.
  * NULL if none found.
  */
-AVFilter *avfilter_get_by_name(const char *name);
+const AVFilter *avfilter_get_by_name(const char *name);
 
 /**
  * Iterate over all registered filters.
-- 
1.8.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 05/50] oggparsetheora: check av_mallocz result

2013-10-27 Thread Vittorio Giovara
On Sun, Oct 27, 2013 at 11:09 AM, Anton Khirnov  wrote:
> ---
>  libavformat/oggparsetheora.c |2 ++
>  1 file changed, 2 insertions(+)

OK
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] lavc: don't set AVFrame.pts to random numbers in decoders.

2013-10-27 Thread Luca Barbato
On 27/10/13 15:35, Anton Khirnov wrote:
> ---
>  libavcodec/h261dec.c   |1 -
>  libavcodec/ituh263dec.c|1 -
>  libavcodec/mpeg4videodec.c |8 
>  3 files changed, 10 deletions(-)
> 

Looks fishy indeed.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] lavc: don't set AVFrame.pts to random numbers in decoders.

2013-10-27 Thread Anton Khirnov
---
 libavcodec/h261dec.c   |1 -
 libavcodec/ituh263dec.c|1 -
 libavcodec/mpeg4videodec.c |8 
 3 files changed, 10 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 10489e1..4842fa0 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -477,7 +477,6 @@ static int h261_decode_picture_header(H261Context *h)
 s->picture_number = (s->picture_number & ~31) + i;
 
 s->avctx->time_base  = (AVRational) { 1001, 3 };
-s->current_picture.f.pts = s->picture_number;
 
 /* PTYPE starts here */
 skip_bits1(&s->gb); /* split screen off */
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 25dd4d9..2ddc227 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -885,7 +885,6 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
 i = get_bits(&s->gb, 8); /* picture timestamp */
 if( (s->picture_number&~0xFF)+i < s->picture_number)
 i+= 256;
-s->current_picture_ptr->f.pts =
 s->picture_number= (s->picture_number&~0xFF) + i;
 
 /* PTYPE starts here */
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 2b486ce..9a0b42b 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1965,14 +1965,6 @@ static int decode_vop_header(MpegEncContext *s, 
GetBitContext *gb){
 }
 }
 
-if(s->avctx->time_base.num)
-s->current_picture_ptr->f.pts = (s->time + s->avctx->time_base.num / 
2) / s->avctx->time_base.num;
-else
-s->current_picture_ptr->f.pts = AV_NOPTS_VALUE;
-if(s->avctx->debug&FF_DEBUG_PTS)
-av_log(s->avctx, AV_LOG_DEBUG, "MPEG4 PTS: %"PRId64"\n",
-   s->current_picture_ptr->f.pts);
-
 check_marker(gb, "before vop_coded");
 
 /* vop coded */
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/3] lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.

2013-10-27 Thread Justin Ruggles
On 10/27/2013 04:16 AM, Anton Khirnov wrote:
> diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
> index fd0bf33..80a1391 100644
> --- a/libavcodec/ac3dec.c
> +++ b/libavcodec/ac3dec.c
> @@ -1330,7 +1330,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, 
> void *data,
>  if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2],
> s->frame_size - 2)) {
>  av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
> -err = AAC_AC3_PARSE_ERROR_CRC;
> +if (avctx->err_recognition & AV_EF_EXPLODE)
> +err = AAC_AC3_PARSE_ERROR_CRC;
>  }
>  }
>  }

In this case particular case, err being set will trigger error
concealment. It seems like a good idea to do error concealment with just
AV_EF_CRCCHECK set, not only when AV_EF_EXPLODE is also set.

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 08/50] lavc/utils: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:09 AM, Anton Khirnov wrote:
> ---
>  libavcodec/utils.c |   14 +-
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 1e0026d..262f081 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -934,15 +934,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
> *avctx, const AVCodec *code
>  goto free_and_end;
>  
>  if (avctx->coded_width && avctx->coded_height && !avctx->width && 
> !avctx->height)
> -avcodec_set_dimensions(avctx, avctx->coded_width, 
> avctx->coded_height);
> +ret = ff_set_dimensions(avctx, avctx->coded_width, 
> avctx->coded_height);
>  else if (avctx->width && avctx->height)
> -avcodec_set_dimensions(avctx, avctx->width, avctx->height);
> +ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
> +if (ret < 0)
> +goto free_and_end;
>  
>  if ((avctx->coded_width || avctx->coded_height || avctx->width || 
> avctx->height)
>  && (  av_image_check_size(avctx->coded_width, avctx->coded_height, 
> 0, avctx) < 0
> || av_image_check_size(avctx->width,   avctx->height,   
> 0, avctx) < 0)) {
>  av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height 
> values\n");
> -avcodec_set_dimensions(avctx, 0, 0);
> +ff_set_dimensions(avctx, 0, 0);
>  }
>  
>  /* if the decoder init function was already called previously,
> @@ -1334,7 +1336,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, 
> uint8_t *buf, int buf_size,
>  
>  static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
>  {
> -int size = 0;
> +int size = 0, ret;
>  const uint8_t *data;
>  uint32_t flags;
>  
> @@ -1377,8 +1379,10 @@ static int apply_param_change(AVCodecContext *avctx, 
> AVPacket *avpkt)
>  goto fail;
>  avctx->width  = bytestream_get_le32(&data);
>  avctx->height = bytestream_get_le32(&data);
> -avcodec_set_dimensions(avctx, avctx->width, avctx->height);
>  size -= 8;
> +ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
> +if (ret < 0)
> +return ret;
>  }
>  
>  return 0;

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 09/50] ansi: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/ansi.c |6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
> index ae67f3c..3f30ae9 100644
> --- a/libavcodec/ansi.c
> +++ b/libavcodec/ansi.c
> @@ -89,7 +89,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
>  s->bg  = DEFAULT_BG_COLOR;
>  
>  if (!avctx->width || !avctx->height)
> -avcodec_set_dimensions(avctx, 80<<3, 25<<4);
> +ff_set_dimensions(avctx, 80 << 3, 25 << 4);
>  
>  return 0;
>  }
> @@ -226,7 +226,9 @@ static int execute_code(AVCodecContext * avctx, int c)
>  }
>  if (width != avctx->width || height != avctx->height) {
>  av_frame_unref(s->frame);
> -avcodec_set_dimensions(avctx, width, height);
> +ret = ff_set_dimensions(avctx, width, height);
> +if (ret < 0)
> +return ret;
>  ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF);
>  if (ret < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 23/50] gifdec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/gifdec.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c
> index a233797..4814230 100644
> --- a/libavcodec/gifdec.c
> +++ b/libavcodec/gifdec.c
> @@ -292,9 +292,10 @@ static int gif_decode_frame(AVCodecContext *avctx, void 
> *data, int *got_frame,
>  return ret;
>  
>  avctx->pix_fmt = AV_PIX_FMT_PAL8;
> -if ((ret = av_image_check_size(s->screen_width, s->screen_height, 0, 
> avctx)) < 0)
> +
> +ret = ff_set_dimensions(avctx, s->screen_width, s->screen_height);
> +if (ret < 0)
>  return ret;
> -avcodec_set_dimensions(avctx, s->screen_width, s->screen_height);
>  
>  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 28/50] libopenjpegdec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/libopenjpegdec.c |   11 ---
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
> index 0062701..77a37e9 100644
> --- a/libavcodec/libopenjpegdec.c
> +++ b/libavcodec/libopenjpegdec.c
> @@ -33,6 +33,7 @@
>  #include "libavutil/pixfmt.h"
>  #include "libavutil/opt.h"
>  #include "avcodec.h"
> +#include "internal.h"
>  #include "thread.h"
>  
>  #define JP2_SIG_TYPE0x6A502020
> @@ -315,13 +316,9 @@ static int libopenjpeg_decode_frame(AVCodecContext 
> *avctx,
>  height = (height + (1 << ctx->lowres) - 1) >> ctx->lowres;
>  }
>  
> -if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) {
> -av_log(avctx, AV_LOG_ERROR,
> -   "%dx%d dimension invalid.\n", width, height);
> -goto done;
> -}
> -
> -avcodec_set_dimensions(avctx, width, height);
> +ret = ff_set_dimensions(avctx, width, height);
> +if (ret < 0)
> +return ret;
>  
>  if (avctx->pix_fmt != AV_PIX_FMT_NONE)
>  if (!libopenjpeg_matches_pix_fmt(image, avctx->pix_fmt))

It looks like 'goto done' is needed to do some cleaning up.

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 34/50] pcx: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/pcx.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
> index ad92d75..6c51f6c 100644
> --- a/libavcodec/pcx.c
> +++ b/libavcodec/pcx.c
> @@ -135,10 +135,10 @@ static int pcx_decode_frame(AVCodecContext *avctx, void 
> *data, int *got_frame,
>  
>  buf += 128;
>  
> -if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
> +ret = ff_set_dimensions(avctx, w, h);
> +if (ret < 0)
>  return ret;
> -if (w != avctx->width || h != avctx->height)
> -avcodec_set_dimensions(avctx, w, h);
> +
>  if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>  return ret;

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 36/50] pictordec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/pictordec.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
> index 2d72977..33c4545 100644
> --- a/libavcodec/pictordec.c
> +++ b/libavcodec/pictordec.c
> @@ -141,9 +141,9 @@ static int decode_frame(AVCodecContext *avctx,
>  avctx->pix_fmt = AV_PIX_FMT_PAL8;
>  
>  if (s->width != avctx->width && s->height != avctx->height) {
> -if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
> -return -1;
> -avcodec_set_dimensions(avctx, s->width, s->height);
> +ret = ff_set_dimensions(avctx, s->width, s->height);
> +if (ret < 0)
> +return ret;
>  }
>  
>  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 37/50] ptx: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/ptx.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c
> index 527e39a..9810e00 100644
> --- a/libavcodec/ptx.c
> +++ b/libavcodec/ptx.c
> @@ -55,10 +55,10 @@ static int ptx_decode_frame(AVCodecContext *avctx, void 
> *data, int *got_frame,
>  
>  buf += offset;
>  
> -if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
> +ret = ff_set_dimensions(avctx, w, h);
> +if (ret < 0)
>  return ret;
> -if (w != avctx->width || h != avctx->height)
> -avcodec_set_dimensions(avctx, w, h);
> +
>  if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>  return ret;

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 42/50] svq1dec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/svq1dec.c |5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c
> index 7d3ef50..3b1a275 100644
> --- a/libavcodec/svq1dec.c
> +++ b/libavcodec/svq1dec.c
> @@ -638,7 +638,10 @@ static int svq1_decode_frame(AVCodecContext *avctx, void 
> *data,
>  av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result);
>  return result;
>  }
> -avcodec_set_dimensions(avctx, s->width, s->height);
> +
> +result = ff_set_dimensions(avctx, s->width, s->height);
> +if (result < 0)
> +return result;
>  
>  if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) ||
>  (avctx->skip_frame >= AVDISCARD_NONKEY &&

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 40/50] sgidec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/sgidec.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
> index 476311d..928806f 100644
> --- a/libavcodec/sgidec.c
> +++ b/libavcodec/sgidec.c
> @@ -200,9 +200,9 @@ static int decode_frame(AVCodecContext *avctx,
>  return -1;
>  }
>  
> -if (av_image_check_size(s->width, s->height, 0, avctx))
> -return -1;
> -avcodec_set_dimensions(avctx, s->width, s->height);
> +ret = ff_set_dimensions(avctx, s->width, s->height);
> +if (ret < 0)
> +return ret;
>  
>  if (ff_get_buffer(avctx, p, 0) < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n");

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 41/50] sunrast: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/sunrast.c |   10 --
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c
> index 4147cf0..ffa685c 100644
> --- a/libavcodec/sunrast.c
> +++ b/libavcodec/sunrast.c
> @@ -61,10 +61,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, 
> void *data,
>  av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n");
>  return AVERROR_INVALIDDATA;
>  }
> -if (av_image_check_size(w, h, 0, avctx)) {
> -av_log(avctx, AV_LOG_ERROR, "invalid image size\n");
> -return AVERROR_INVALIDDATA;
> -}
>  if (maptype == RMT_RAW) {
>  avpriv_request_sample(avctx, "Unknown colormap type");
>  return AVERROR_PATCHWELCOME;
> @@ -90,8 +86,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, 
> void *data,
>  return AVERROR_INVALIDDATA;
>  }
>  
> -if (w != avctx->width || h != avctx->height)
> -avcodec_set_dimensions(avctx, w, h);
> +ret = ff_set_dimensions(avctx, w, h);
> +if (ret < 0)
> +return ret;
> +
>  if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>  return ret;

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 04/50] oggparsetheora: return meaningful error codes

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:09 AM, Anton Khirnov wrote:
> ---
>  libavformat/oggparsetheora.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/oggparsetheora.c b/libavformat/oggparsetheora.c
> index 614cc29..ce4a462 100644
> --- a/libavformat/oggparsetheora.c
> +++ b/libavformat/oggparsetheora.c
> @@ -68,7 +68,7 @@ static int theora_header(AVFormatContext * s, int idx)
>  if (thp->version < 0x030100) {
>  av_log(s, AV_LOG_ERROR,
> "Too old or unsupported Theora (%x)\n", thp->version);
> -return -1;
> +return AVERROR(ENOSYS);
>  }
>  
>  width  = get_bits(&gb, 16) << 4;
> @@ -118,10 +118,10 @@ static int theora_header(AVFormatContext * s, int idx)
>  ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, 
> os->psize - 7);
>  case 0x82:
>  if (!thp->version)
> -return -1;
> +return AVERROR_INVALIDDATA;
>  break;
>  default:
> -return -1;
> +return AVERROR_INVALIDDATA;
>  }
>  
>  if ((err = av_reallocp(&st->codec->extradata,

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 06/50] lavc: replace avcodec_set_dimensions with ff_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:09 AM, Anton Khirnov wrote:
> avcodec_set_dimensions() is supposed to be an internal utility function,
> there is no reason whatsoever for it to be public. Therefore deprecate
> it.
> ---
>  libavcodec/avcodec.h  |6 ++
>  libavcodec/internal.h |6 ++
>  libavcodec/utils.c|   19 +++
>  libavcodec/version.h  |3 +++
>  4 files changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 84bfccb..856eda5 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -4019,7 +4019,13 @@ enum AVPixelFormat avcodec_default_get_format(struct 
> AVCodecContext *s, const en
>   * @}
>   */
>  
> +#if FF_API_SET_DIMENSIONS
> +/**
> + * @deprecated this function is not supposed to be used from outside of lavc
> + */
> +attribute_deprecated
>  void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
> +#endif
>  
>  /**
>   * Put a string representing the codec tag codec_tag in buf.
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index f57bedc..2133137 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -166,4 +166,10 @@ const uint8_t *avpriv_find_start_code(const uint8_t 
> *restrict p,
>const uint8_t *end,
>uint32_t *restrict state);
>  
> +/**
> + * Check that the provided frame dimensions are valid and set them on the 
> codec
> + * context.
> + */
> +int ff_set_dimensions(AVCodecContext *s, int width, int height);
> +
>  #endif /* AVCODEC_INTERNAL_H */
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index d14d4f4..1e0026d 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -152,12 +152,23 @@ unsigned avcodec_get_edge_width(void)
>  return EDGE_WIDTH;
>  }
>  
> +#if FF_API_SET_DIMENSIONS
>  void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
>  {
> -s->coded_width  = width;
> -s->coded_height = height;
> -s->width= width;
> -s->height   = height;
> +ff_set_dimensions(s, width, height);
> +}
> +#endif
> +
> +int ff_set_dimensions(AVCodecContext *s, int width, int height)
> +{
> +int ret = av_image_check_size(width, height, 0, s);
> +
> +if (ret < 0)
> +width = height = 0;
> +s->width  = s->coded_width  = width;
> +s->height = s->coded_height = height;
> +
> +return ret;
>  }
>  
>  #if HAVE_NEON || ARCH_PPC || HAVE_MMX
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index e394c76..321c7ef 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -73,5 +73,8 @@
>  #ifndef FF_API_VOXWARE
>  #define FF_API_VOXWARE   (LIBAVCODEC_VERSION_MAJOR < 56)
>  #endif
> +#ifndef FF_API_SET_DIMENSIONS
> +#define FF_API_SET_DIMENSIONS(LIBAVCODEC_VERSION_MAJOR < 56)
> +#endif
>  
>  #endif /* AVCODEC_VERSION_H */

LGTM

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] avio: K&R formatting cosmetics

2013-10-27 Thread Luca Barbato
---
 libavformat/avio.c | 88 ++
 1 file changed, 49 insertions(+), 39 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index 689d4a1..8f079bf 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -42,8 +42,10 @@ URLProtocol *ffurl_protocol_next(URLProtocol *prev)
 static const char *urlcontext_to_name(void *ptr)
 {
 URLContext *h = (URLContext *)ptr;
-if(h->prot) return h->prot->name;
-elsereturn "NULL";
+if (h->prot)
+return h->prot->name;
+else
+return "NULL";
 }
 
 static void *urlcontext_child_next(void *obj, void *prev)
@@ -68,26 +70,25 @@ static const AVClass *urlcontext_child_class_next(const 
AVClass *prev)
 if (p->priv_data_class)
 return p->priv_data_class;
 return NULL;
-
 }
 
-static const AVOption options[] = {{NULL}};
+static const AVOption options[] = { { NULL } };
 const AVClass ffurl_context_class = {
-.class_name = "URLContext",
-.item_name  = urlcontext_to_name,
-.option = options,
-.version= LIBAVUTIL_VERSION_INT,
-.child_next = urlcontext_child_next,
+.class_name   = "URLContext",
+.item_name= urlcontext_to_name,
+.option   = options,
+.version  = LIBAVUTIL_VERSION_INT,
+.child_next   = urlcontext_child_next,
 .child_class_next = urlcontext_child_class_next,
 };
 /*@}*/
 
-
 const char *avio_enum_protocols(void **opaque, int output)
 {
 URLProtocol *p;
 *opaque = ffurl_protocol_next(*opaque);
-if (!(p = *opaque)) return NULL;
+if (!(p = *opaque))
+return NULL;
 if ((output && p->url_write) || (!output && p->url_read))
 return p->name;
 return avio_enum_protocols(opaque, output);
@@ -97,20 +98,21 @@ int ffurl_register_protocol(URLProtocol *protocol, int size)
 {
 URLProtocol **p;
 if (size < sizeof(URLProtocol)) {
-URLProtocol* temp = av_mallocz(sizeof(URLProtocol));
+URLProtocol *temp = av_mallocz(sizeof(URLProtocol));
 memcpy(temp, protocol, size);
 protocol = temp;
 }
 p = &first_protocol;
-while (*p != NULL) p = &(*p)->next;
-*p = protocol;
+while (*p != NULL)
+p = &(*p)->next;
+*p = protocol;
 protocol->next = NULL;
 return 0;
 }
 
-static int url_alloc_for_protocol (URLContext **puc, struct URLProtocol *up,
-   const char *filename, int flags,
-   const AVIOInterruptCB *int_cb)
+static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up,
+  const char *filename, int flags,
+  const AVIOInterruptCB *int_cb)
 {
 URLContext *uc;
 int err;
@@ -125,16 +127,16 @@ static int url_alloc_for_protocol (URLContext **puc, 
struct URLProtocol *up,
 goto fail;
 }
 uc->av_class = &ffurl_context_class;
-uc->filename = (char *) &uc[1];
+uc->filename = (char *)&uc[1];
 strcpy(uc->filename, filename);
-uc->prot = up;
-uc->flags = flags;
-uc->is_streamed = 0; /* default = not streamed */
+uc->prot= up;
+uc->flags   = flags;
+uc->is_streamed = 0; /* default = not streamed */
 uc->max_packet_size = 0; /* default: stream file */
 if (up->priv_data_size) {
 uc->priv_data = av_mallocz(up->priv_data_size);
 if (up->priv_data_class) {
-*(const AVClass**)uc->priv_data = up->priv_data_class;
+*(const AVClass **)uc->priv_data = up->priv_data_class;
 av_opt_set_defaults(uc->priv_data);
 }
 }
@@ -143,7 +145,7 @@ static int url_alloc_for_protocol (URLContext **puc, struct 
URLProtocol *up,
 
 *puc = uc;
 return 0;
- fail:
+fail:
 *puc = NULL;
 #if CONFIG_NETWORK
 if (up->flags & URL_PROTOCOL_FLAG_NETWORK)
@@ -152,19 +154,22 @@ static int url_alloc_for_protocol (URLContext **puc, 
struct URLProtocol *up,
 return err;
 }
 
-int ffurl_connect(URLContext* uc, AVDictionary **options)
+int ffurl_connect(URLContext *uc, AVDictionary **options)
 {
 int err =
-uc->prot->url_open2 ? uc->prot->url_open2(uc, uc->filename, uc->flags, 
options) :
+uc->prot->url_open2 ? uc->prot->url_open2(uc,
+  uc->filename,
+  uc->flags,
+  options) :
 uc->prot->url_open(uc, uc->filename, uc->flags);
 if (err)
 return err;
 uc->is_connected = 1;
 //We must be careful here as ffurl_seek() could be slow, for example for 
http
-if(   (uc->flags & AVIO_FLAG_WRITE)
-   || !strcmp(uc->prot->name, "file"))
-if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
-uc->is_streamed= 1;
+if ((uc->flags & AVIO_FLAG_WRITE)
+|| !strcmp(uc->pr

Re: [libav-devel] [PATCH 02/50] lavc: add error checking to apply_param_change.

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:09 AM, Anton Khirnov wrote:
> ---
>  libavcodec/utils.c |   51 +--
>  1 file changed, 37 insertions(+), 14 deletions(-)

LGTM

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 43/50] targa: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/targa.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/targa.c b/libavcodec/targa.c
> index 9f0b286..4b736c9 100644
> --- a/libavcodec/targa.c
> +++ b/libavcodec/targa.c
> @@ -142,10 +142,10 @@ static int decode_frame(AVCodecContext *avctx,
>  return AVERROR_INVALIDDATA;
>  }
>  
> -if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
> +ret = ff_set_dimensions(avctx, w, h);
> +if (ret < 0)
>  return ret;
> -if(w != avctx->width || h != avctx->height)
> -avcodec_set_dimensions(avctx, w, h);
> +
>  if ((ret = ff_get_buffer(avctx, p, 0)) < 0){
>  av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
>  return ret;

Ok.

-Justin
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 44/50] tiff: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/tiff.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 735eafe..7fb0e7a 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -296,9 +296,9 @@ static int init_image(TiffContext *s, AVFrame *frame)
>  return AVERROR_INVALIDDATA;
>  }
>  if (s->width != s->avctx->width || s->height != s->avctx->height) {
> -if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 
> 0)
> +ret = ff_set_dimensions(s->avctx, s->width, s->height);
> +if (ret < 0)
>  return ret;
> -avcodec_set_dimensions(s->avctx, s->width, s->height);
>  }
>  if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) {
>  av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");

Ok.

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 50/50] webp: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Justin Ruggles
On 10/27/2013 06:10 AM, Anton Khirnov wrote:
> ---
>  libavcodec/webp.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/webp.c b/libavcodec/webp.c
> index 8ad24f8..cf431fe 100644
> --- a/libavcodec/webp.c
> +++ b/libavcodec/webp.c
> @@ -1085,10 +1085,10 @@ static int vp8_lossless_decode_frame(AVCodecContext 
> *avctx, AVFrame *p,
> s->width, w);
>  }
>  s->height = h;
> -ret = av_image_check_size(s->width, s->height, 0, avctx);
> +
> +ret = ff_set_dimensions(avctx, s->width, s->height);
>  if (ret < 0)
>  return ret;
> -avcodec_set_dimensions(avctx, s->width, s->height);
>  
>  s->has_alpha = get_bits1(&s->gb);
>  

Ok

-Justin

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/5] lavc: split slice and frame threading functions into separate files

2013-10-27 Thread Luca Barbato
On 27/10/13 13:17, Anton Khirnov wrote:

Doesn't look bad even after a second read, there are few nits that might
wait till they are globally fixed (e.g. include order).

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/5] pthread: drop avcodec_ prefixes from static functions

2013-10-27 Thread Luca Barbato
I like the set a lot, seems good, I'd re-read the split patch again soon.

lu
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 7/7] lavc: move FF_ASPECT_EXTENDED from avcodec.h to h263.h

2013-10-27 Thread Luca Barbato
On 27/10/13 13:12, Anton Khirnov wrote:
> It's for internal use only.
> ---
>  libavcodec/avcodec.h |2 ++
>  libavcodec/h263.h|4 
>  libavcodec/version.h |3 +++
>  3 files changed, 9 insertions(+)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 6/7] lavc: deprecate unused FF_BUG_OLD_MSMPEG4

2013-10-27 Thread Luca Barbato
On 27/10/13 13:12, Anton Khirnov wrote:
> ---
>  libavcodec/avcodec.h   |2 ++
>  libavcodec/options_table.h |2 ++
>  libavcodec/version.h   |3 +++
>  3 files changed, 7 insertions(+)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/7] lavc: schedule FF_BUG_AC_VLC for removal on the next major bump.

2013-10-27 Thread Luca Barbato
On 27/10/13 13:11, Anton Khirnov wrote:
> It has been deprecated/unused for about 10 years.
> ---
>  libavcodec/avcodec.h   |2 ++
>  libavcodec/options_table.h |2 ++
>  libavcodec/version.h   |3 +++
>  3 files changed, 7 insertions(+)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 4/7] lavc: deprecate FF_DEBUG_VIS_*

2013-10-27 Thread Luca Barbato
On 27/10/13 13:11, Anton Khirnov wrote:
> Those flags have no effect since
> 37045e422903695e610cca6ecb753df643ab9380.
> ---
>  libavcodec/avcodec.h   |2 ++
>  libavcodec/options_table.h |2 ++
>  2 files changed, 4 insertions(+)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 3/7] lavc: deprecate AVCodecContext.debug_mv

2013-10-27 Thread Luca Barbato
On 27/10/13 13:11, Anton Khirnov wrote:
> It has been unused since 37045e422903695e610cca6ecb753df643ab9380.
> ---
>  libavcodec/avcodec.h   |7 ---
>  libavcodec/options_table.h |2 ++
>  libavcodec/pthread.c   |1 -
>  3 files changed, 6 insertions(+), 4 deletions(-)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 2/7] avplay: drop -vismv option which does not do anything anymore

2013-10-27 Thread Luca Barbato
On 27/10/13 13:11, Anton Khirnov wrote:
> ---
>  Changelog   |1 +
>  avplay.c|9 -
>  doc/avplay.texi |2 --
>  3 files changed, 1 insertion(+), 11 deletions(-)
> 

I doubt we'll add it back much soon.

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 1/7] lavc: deprecate FF_DEBUG_MV and remove all traces of its use

2013-10-27 Thread Luca Barbato
On 27/10/13 13:11, Anton Khirnov wrote:
> It has not been actually used since
> 37045e422903695e610cca6ecb753df643ab9380, when the broken vismv code was
> removed.
> ---
>  avconv.c   |3 ---
>  libavcodec/avcodec.h   |5 +
>  libavcodec/mpegvideo.c |3 +--
>  libavcodec/options_table.h |2 ++
>  libavcodec/version.h   |3 +++
>  5 files changed, 11 insertions(+), 5 deletions(-)
> 

Ok.

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 5/5] lavc: move AVCodecContext.pkt to AVCodecInternal

2013-10-27 Thread Anton Khirnov
It's a private field, not meant to be accessed from outside lavc.
---
 libavcodec/avcodec.h   |8 +++-
 libavcodec/internal.h  |6 ++
 libavcodec/pthread_frame.c |2 +-
 libavcodec/rawdec.c|3 ++-
 libavcodec/utils.c |8 
 libavcodec/version.h   |3 +++
 6 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f5464d0..8ab2ebc 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2662,14 +2662,12 @@ typedef struct AVCodecContext {
  */
 int error_rate;
 
+#if FF_API_CODEC_PKT
 /**
- * Current packet as passed into the decoder, to avoid having
- * to pass the packet into every function. Currently only valid
- * inside lavc and get/release_buffer callbacks.
- * - decoding: set by avcodec_decode_*, read by get_buffer() for setting 
pkt_pts
- * - encoding: unused
+ * @deprecated this field is not supposed to be accessed from outside lavc
  */
 AVPacket *pkt;
+#endif
 
 /**
  * VBV delay coded in the last frame (in periods of a 27 MHz clock).
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 9a57209..4648c02 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -88,6 +88,12 @@ typedef struct AVCodecInternal {
 FramePool *pool;
 
 void *thread_ctx;
+
+/**
+ * Current packet as passed into the decoder, to avoid having to pass the
+ * packet into every function.
+ */
+AVPacket *pkt;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index c2d12c8..3dff960 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -608,7 +608,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 }
 
 *copy = *src;
-copy->pkt = &p->avpkt;
 
 copy->internal = av_malloc(sizeof(AVCodecInternal));
 if (!copy->internal) {
@@ -617,6 +616,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
 }
 *copy->internal = *src->internal;
 copy->internal->thread_ctx = p;
+copy->internal->pkt = &p->avpkt;
 
 if (!i) {
 src = copy;
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 24d06f3..a8227c7 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -25,6 +25,7 @@
  */
 
 #include "avcodec.h"
+#include "internal.h"
 #include "raw.h"
 #include "libavutil/buffer.h"
 #include "libavutil/common.h"
@@ -150,7 +151,7 @@ static int raw_decode(AVCodecContext *avctx, void *data, 
int *got_frame,
 frame->pict_type= AV_PICTURE_TYPE_I;
 frame->key_frame= 1;
 frame->reordered_opaque = avctx->reordered_opaque;
-frame->pkt_pts  = avctx->pkt->pts;
+frame->pkt_pts  = avctx->internal->pkt->pts;
 
 if (buf_size < context->frame_size - (avctx->pix_fmt == AV_PIX_FMT_PAL8 ?
   AVPALETTE_SIZE : 0))
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7b5c796..da519b5 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -613,7 +613,7 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, 
int flags)
 default: return AVERROR(EINVAL);
 }
 
-frame->pkt_pts = avctx->pkt ? avctx->pkt->pts : AV_NOPTS_VALUE;
+frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : 
AV_NOPTS_VALUE;
 frame->reordered_opaque = avctx->reordered_opaque;
 
 #if FF_API_GET_BUFFER
@@ -1402,7 +1402,7 @@ int attribute_align_arg 
avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
 if ((avctx->coded_width || avctx->coded_height) && 
av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
 return -1;
 
-avctx->pkt = avpkt;
+avctx->internal->pkt = avpkt;
 ret = apply_param_change(avctx, avpkt);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
@@ -1467,7 +1467,7 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 
 *got_frame_ptr = 0;
 
-avctx->pkt = avpkt;
+avctx->internal->pkt = avpkt;
 
 if (!avpkt->data && avpkt->size) {
 av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
@@ -1522,7 +1522,7 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
AVSubtitle *sub,
 {
 int ret;
 
-avctx->pkt = avpkt;
+avctx->internal->pkt = avpkt;
 *got_sub_ptr = 0;
 ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
 if (*got_sub_ptr)
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 62201f5..8f6ae3c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -91,5 +91,8 @@
 #ifndef FF_API_THREAD_OPAQUE
 #define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_CODEC_PKT
+#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
1.7.10.4


[libav-devel] [PATCH 2/5] lavc: split slice and frame threading functions into separate files

2013-10-27 Thread Anton Khirnov
---
 libavcodec/Makefile   |4 +-
 libavcodec/pthread.c  |  952 +
 libavcodec/{pthread.c => pthread_frame.c} |  280 +
 libavcodec/pthread_internal.h |   34 ++
 libavcodec/pthread_slice.c|  224 +++
 5 files changed, 286 insertions(+), 1208 deletions(-)
 copy libavcodec/{pthread.c => pthread_frame.c} (76%)
 create mode 100644 libavcodec/pthread_internal.h
 create mode 100644 libavcodec/pthread_slice.c

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8e0d60d..5455de2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -673,8 +673,8 @@ OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF)   += 
remove_extradata_bsf.o
 OBJS-$(CONFIG_TEXT2MOVSUB_BSF)+= movsub_bsf.o
 
 # thread libraries
-OBJS-$(HAVE_PTHREADS)  += pthread.o
-OBJS-$(HAVE_W32THREADS)+= pthread.o
+OBJS-$(HAVE_PTHREADS)  += pthread.o pthread_slice.o 
pthread_frame.o
+OBJS-$(HAVE_W32THREADS)+= pthread.o pthread_slice.o 
pthread_frame.o
 
 SKIPHEADERS+= %_tablegen.h  \
   %_tables.h\
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index ce969af..682fd05 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -29,948 +29,10 @@
  * @see doc/multithreading.txt
  */
 
-#include "config.h"
-
 #include "avcodec.h"
 #include "internal.h"
+#include "pthread_internal.h"
 #include "thread.h"
-#include "libavutil/avassert.h"
-#include "libavutil/common.h"
-#include "libavutil/cpu.h"
-#include "libavutil/internal.h"
-
-#if HAVE_PTHREADS
-#include 
-#elif HAVE_W32THREADS
-#include "compat/w32pthreads.h"
-#endif
-
-typedef int (action_func)(AVCodecContext *c, void *arg);
-typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int 
threadnr);
-
-typedef struct ThreadContext {
-pthread_t *workers;
-action_func *func;
-action_func2 *func2;
-void *args;
-int *rets;
-int rets_count;
-int job_count;
-int job_size;
-
-pthread_cond_t last_job_cond;
-pthread_cond_t current_job_cond;
-pthread_mutex_t current_job_lock;
-unsigned current_execute;
-int current_job;
-int done;
-} ThreadContext;
-
-/**
- * Context used by codec threads and stored in their AVCodecContext 
thread_opaque.
- */
-typedef struct PerThreadContext {
-struct FrameThreadContext *parent;
-
-pthread_t  thread;
-intthread_init;
-pthread_cond_t input_cond;  ///< Used to wait for a new packet from 
the main thread.
-pthread_cond_t progress_cond;   ///< Used by child threads to wait for 
progress to change.
-pthread_cond_t output_cond; ///< Used by the main thread to wait for 
frames to finish.
-
-pthread_mutex_t mutex;  ///< Mutex used to protect the contents of 
the PerThreadContext.
-pthread_mutex_t progress_mutex; ///< Mutex used to protect frame progress 
values and progress_cond.
-
-AVCodecContext *avctx;  ///< Context used to decode packets passed 
to this thread.
-
-AVPacket   avpkt;   ///< Input packet (for decoding) or output 
(for encoding).
-uint8_t   *buf; ///< backup storage for packet data when 
the input packet is not refcounted
-intallocated_buf_size; ///< Size allocated for buf
-
-AVFrame frame;  ///< Output frame (for decoding) or input 
(for encoding).
-int got_frame;  ///< The output of got_picture_ptr from 
the last avcodec_decode_video() call.
-int result; ///< The result of the last codec 
decode/encode() call.
-
-enum {
-STATE_INPUT_READY,  ///< Set when the thread is awaiting a 
packet.
-STATE_SETTING_UP,   ///< Set before the codec has called 
ff_thread_finish_setup().
-STATE_GET_BUFFER,   /**<
- * Set when the codec calls get_buffer().
- * State is returned to STATE_SETTING_UP 
afterwards.
- */
-STATE_SETUP_FINISHED///< Set after the codec has called 
ff_thread_finish_setup().
-} state;
-
-/**
- * Array of frames passed to ff_thread_release_buffer().
- * Frames are released after all threads referencing them are finished.
- */
-AVFrame *released_buffers;
-int  num_released_buffers;
-int  released_buffers_allocated;
-
-AVFrame *requested_frame;   ///< AVFrame the codec passed to 
get_buffer()
-int  requested_flags;   ///< flags passed to get_buffer() for 
requested_frame
-} PerThreadContext;
-
-/**
- * Context stored in the client AVCodecContext thread_opaque.
- */
-typedef struct FrameThreadContext {
-PerThreadContext *threads; ///< The contexts for each thread.
-PerThreadContext

[libav-devel] [PATCH 4/5] pthread: store thread contexts in AVCodecInternal instead of AVCodecContext

2013-10-27 Thread Anton Khirnov
It's a private field, it should not be visible to callers.

Deprecate AVCodecContext.thread_opaque
---
 libavcodec/avcodec.h   |8 
 libavcodec/internal.h  |2 ++
 libavcodec/options.c   |1 -
 libavcodec/pthread_frame.c |   43 ++-
 libavcodec/pthread_slice.c |   12 ++--
 libavcodec/utils.c |2 +-
 libavcodec/version.h   |3 +++
 7 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0e5a805..f5464d0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2522,13 +2522,13 @@ typedef struct AVCodecContext {
  */
 int (*execute2)(struct AVCodecContext *c, int (*func)(struct 
AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, 
int count);
 
+#if FF_API_THREAD_OPAQUE
 /**
- * thread opaque
- * Can be used by execute() to store some per AVCodecContext stuff.
- * - encoding: set by execute()
- * - decoding: set by execute()
+ * @deprecated this field should not be used from outside of lavc
  */
+attribute_deprecated
 void *thread_opaque;
+#endif
 
 /**
  * noise vs. sse weight for the nsse comparsion function
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 2133137..9a57209 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -86,6 +86,8 @@ typedef struct AVCodecInternal {
 AVFrame to_free;
 
 FramePool *pool;
+
+void *thread_ctx;
 } AVCodecInternal;
 
 struct AVCodecDefault {
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 8d36c01..2e41ce4 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -150,7 +150,6 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 dest->codec   = NULL;
 dest->slice_offset= NULL;
 dest->hwaccel = NULL;
-dest->thread_opaque   = NULL;
 dest->internal= NULL;
 
 /* reallocate values that should be allocated separately */
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index d16078f..c2d12c8 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -46,7 +46,7 @@
 #include "libavutil/mem.h"
 
 /**
- * Context used by codec threads and stored in their AVCodecContext 
thread_opaque.
+ * Context used by codec threads and stored in their AVCodecInternal 
thread_ctx.
  */
 typedef struct PerThreadContext {
 struct FrameThreadContext *parent;
@@ -93,7 +93,7 @@ typedef struct PerThreadContext {
 } PerThreadContext;
 
 /**
- * Context stored in the client AVCodecContext thread_opaque.
+ * Context stored in the client AVCodecInternal thread_ctx.
  */
 typedef struct FrameThreadContext {
 PerThreadContext *threads; ///< The contexts for each thread.
@@ -365,7 +365,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
AVFrame *picture, int *got_picture_ptr,
AVPacket *avpkt)
 {
-FrameThreadContext *fctx = avctx->thread_opaque;
+FrameThreadContext *fctx = avctx->internal->thread_ctx;
 int finished = fctx->next_finished;
 PerThreadContext *p;
 int err;
@@ -441,7 +441,7 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int 
field)
 
 if (!progress || progress[field] >= n) return;
 
-p = f->owner->thread_opaque;
+p = f->owner->internal->thread_ctx;
 
 if (f->owner->debug&FF_DEBUG_THREADS)
 av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, 
n, field);
@@ -459,7 +459,7 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int 
field)
 
 if (!progress || progress[field] >= n) return;
 
-p = f->owner->thread_opaque;
+p = f->owner->internal->thread_ctx;
 
 if (f->owner->debug&FF_DEBUG_THREADS)
 av_log(f->owner, AV_LOG_DEBUG, "thread awaiting %d field %d from 
%p\n", n, field, progress);
@@ -471,7 +471,7 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int 
field)
 }
 
 void ff_thread_finish_setup(AVCodecContext *avctx) {
-PerThreadContext *p = avctx->thread_opaque;
+PerThreadContext *p = avctx->internal->thread_ctx;
 
 if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
 
@@ -500,7 +500,7 @@ static void park_frame_worker_threads(FrameThreadContext 
*fctx, int thread_count
 
 void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
 {
-FrameThreadContext *fctx = avctx->thread_opaque;
+FrameThreadContext *fctx = avctx->internal->thread_ctx;
 const AVCodec *codec = avctx->codec;
 int i;
 
@@ -544,16 +544,16 @@ void ff_frame_thread_free(AVCodecContext *avctx, int 
thread_count)
 
 if (i) {
 av_freep(&p->avctx->priv_data);
-av_freep(&p->avctx->internal);
 av_freep(&p->avctx->slice_offset);
 }
 
+av_freep(&p->avctx->internal);
 av_freep(&p->avctx);
 }
 
 av_freep(&fctx->threads);
 pthread_mutex_destroy(&fc

[libav-devel] [PATCH 3/5] pthread_slice: rename ThreadContext -> SliceThreadContext

2013-10-27 Thread Anton Khirnov
This should prevent confusion with frame threading.
---
 libavcodec/pthread_slice.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index 67ba3dd..2eca313 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -42,7 +42,7 @@
 typedef int (action_func)(AVCodecContext *c, void *arg);
 typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int 
threadnr);
 
-typedef struct ThreadContext {
+typedef struct SliceThreadContext {
 pthread_t *workers;
 action_func *func;
 action_func2 *func2;
@@ -58,12 +58,12 @@ typedef struct ThreadContext {
 unsigned current_execute;
 int current_job;
 int done;
-} ThreadContext;
+} SliceThreadContext;
 
 static void* attribute_align_arg worker(void *v)
 {
 AVCodecContext *avctx = v;
-ThreadContext *c = avctx->thread_opaque;
+SliceThreadContext *c = avctx->thread_opaque;
 unsigned last_execute = 0;
 int our_job = c->job_count;
 int thread_count = avctx->thread_count;
@@ -98,7 +98,7 @@ static void* attribute_align_arg worker(void *v)
 
 void ff_slice_thread_free(AVCodecContext *avctx)
 {
-ThreadContext *c = avctx->thread_opaque;
+SliceThreadContext *c = avctx->thread_opaque;
 int i;
 
 pthread_mutex_lock(&c->current_job_lock);
@@ -116,7 +116,7 @@ void ff_slice_thread_free(AVCodecContext *avctx)
 av_freep(&avctx->thread_opaque);
 }
 
-static av_always_inline void thread_park_workers(ThreadContext *c, int 
thread_count)
+static av_always_inline void thread_park_workers(SliceThreadContext *c, int 
thread_count)
 {
 while (c->current_job != thread_count + c->job_count)
 pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
@@ -125,7 +125,7 @@ static av_always_inline void 
thread_park_workers(ThreadContext *c, int thread_co
 
 static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, 
int *ret, int job_count, int job_size)
 {
-ThreadContext *c= avctx->thread_opaque;
+SliceThreadContext *c= avctx->thread_opaque;
 int dummy_ret;
 
 if (!(avctx->active_thread_type&FF_THREAD_SLICE) || avctx->thread_count <= 
1)
@@ -158,7 +158,7 @@ static int thread_execute(AVCodecContext *avctx, 
action_func* func, void *arg, i
 
 static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void 
*arg, int *ret, int job_count)
 {
-ThreadContext *c= avctx->thread_opaque;
+SliceThreadContext *c= avctx->thread_opaque;
 c->func2 = func2;
 return thread_execute(avctx, NULL, arg, ret, job_count, 0);
 }
@@ -166,7 +166,7 @@ static int thread_execute2(AVCodecContext *avctx, 
action_func2* func2, void *arg
 int ff_slice_thread_init(AVCodecContext *avctx)
 {
 int i;
-ThreadContext *c;
+SliceThreadContext *c;
 int thread_count = avctx->thread_count;
 
 #if HAVE_W32THREADS
@@ -188,7 +188,7 @@ int ff_slice_thread_init(AVCodecContext *avctx)
 return 0;
 }
 
-c = av_mallocz(sizeof(ThreadContext));
+c = av_mallocz(sizeof(SliceThreadContext));
 if (!c)
 return -1;
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/5] pthread: drop avcodec_ prefixes from static functions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/pthread.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 480a115..ce969af 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -174,7 +174,7 @@ static void* attribute_align_arg worker(void *v)
 }
 }
 
-static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int 
thread_count)
+static av_always_inline void thread_park_workers(ThreadContext *c, int 
thread_count)
 {
 while (c->current_job != thread_count + c->job_count)
 pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
@@ -201,7 +201,7 @@ static void thread_free(AVCodecContext *avctx)
 av_freep(&avctx->thread_opaque);
 }
 
-static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, 
void *arg, int *ret, int job_count, int job_size)
+static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, 
int *ret, int job_count, int job_size)
 {
 ThreadContext *c= avctx->thread_opaque;
 int dummy_ret;
@@ -229,16 +229,16 @@ static int avcodec_thread_execute(AVCodecContext *avctx, 
action_func* func, void
 c->current_execute++;
 pthread_cond_broadcast(&c->current_job_cond);
 
-avcodec_thread_park_workers(c, avctx->thread_count);
+thread_park_workers(c, avctx->thread_count);
 
 return 0;
 }
 
-static int avcodec_thread_execute2(AVCodecContext *avctx, action_func2* func2, 
void *arg, int *ret, int job_count)
+static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void 
*arg, int *ret, int job_count)
 {
 ThreadContext *c= avctx->thread_opaque;
 c->func2 = func2;
-return avcodec_thread_execute(avctx, NULL, arg, ret, job_count, 0);
+return thread_execute(avctx, NULL, arg, ret, job_count, 0);
 }
 
 static int thread_init_internal(AVCodecContext *avctx)
@@ -290,10 +290,10 @@ static int thread_init_internal(AVCodecContext *avctx)
 }
 }
 
-avcodec_thread_park_workers(c, thread_count);
+thread_park_workers(c, thread_count);
 
-avctx->execute = avcodec_thread_execute;
-avctx->execute2 = avcodec_thread_execute2;
+avctx->execute = thread_execute;
+avctx->execute2 = thread_execute2;
 return 0;
 }
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 4/7] lavc: deprecate FF_DEBUG_VIS_*

2013-10-27 Thread Anton Khirnov
Those flags have no effect since
37045e422903695e610cca6ecb753df643ab9380.
---
 libavcodec/avcodec.h   |2 ++
 libavcodec/options_table.h |2 ++
 2 files changed, 4 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2e559b7..320dbdd 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2316,8 +2316,10 @@ typedef struct AVCodecContext {
 #define FF_DEBUG_ER  0x0400
 #define FF_DEBUG_MMCO0x0800
 #define FF_DEBUG_BUGS0x1000
+#if FF_API_DEBUG_MV
 #define FF_DEBUG_VIS_QP  0x2000
 #define FF_DEBUG_VIS_MB_TYPE 0x4000
+#endif
 #define FF_DEBUG_BUFFERS 0x8000
 #define FF_DEBUG_THREADS 0x0001
 
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index bd6b7af..d9517b4 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -218,8 +218,10 @@ static const AVOption avcodec_options[] = {
 {"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, 
INT_MIN, INT_MAX, V|D, "debug"},
 {"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, 
{.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"},
 {"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, 
INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
 {"vis_qp", "visualize quantization parameter (QP), lower QP are tinted 
greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, 
V|D, "debug"},
 {"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+#endif
 {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
 {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, "debug"},
 #if FF_API_DEBUG_MV
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 2/7] avplay: drop -vismv option which does not do anything anymore

2013-10-27 Thread Anton Khirnov
---
 Changelog   |1 +
 avplay.c|9 -
 doc/avplay.texi |2 --
 3 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/Changelog b/Changelog
index 4032d07..06bbe57 100644
--- a/Changelog
+++ b/Changelog
@@ -40,6 +40,7 @@ version 10:
 - Opus in Ogg demuxing
 - Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support)
 - F4V muxer
+- remove avplay -vismv option, which has not worked for a long time
 
 
 version 9:
diff --git a/avplay.c b/avplay.c
index 00becbe..bb8c689 100644
--- a/avplay.c
+++ b/avplay.c
@@ -242,7 +242,6 @@ static int show_status = 1;
 static int av_sync_type = AV_SYNC_AUDIO_MASTER;
 static int64_t start_time = AV_NOPTS_VALUE;
 static int64_t duration = AV_NOPTS_VALUE;
-static int debug_mv = 0;
 static int step = 0;
 static int workaround_bugs = 1;
 static int fast = 0;
@@ -2036,7 +2035,6 @@ static int stream_component_open(VideoState *is, int 
stream_index)
 opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, 
ic->streams[stream_index], NULL);
 
 codec = avcodec_find_decoder(avctx->codec_id);
-avctx->debug_mv  = debug_mv;
 avctx->workaround_bugs   = workaround_bugs;
 avctx->idct_algo = idct;
 avctx->skip_frame= skip_frame;
@@ -2812,12 +2810,6 @@ static int opt_duration(void *optctx, const char *opt, 
const char *arg)
 return 0;
 }
 
-static int opt_vismv(void *optctx, const char *opt, const char *arg)
-{
-debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
-return 0;
-}
-
 static const OptionDef options[] = {
 #include "cmdutils_common_opts.h"
 { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", 
"width" },
@@ -2837,7 +2829,6 @@ static const OptionDef options[] = {
 { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = 
opt_frame_pix_fmt }, "set pixel format", "format" },
 { "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" },
 { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, { &workaround_bugs }, "workaround 
bugs", "" },
-{ "vismv", HAS_ARG | OPT_EXPERT, { .func_arg = opt_vismv }, "visualize 
motion vectors", "" },
 { "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant 
optimizations", "" },
 { "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" },
 { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { &decoder_reorder_pts }, "let 
decoder reorder pts 0=off 1=on -1=auto", ""},
diff --git a/doc/avplay.texi b/doc/avplay.texi
index b856f9b..50142ab 100644
--- a/doc/avplay.texi
+++ b/doc/avplay.texi
@@ -78,8 +78,6 @@ Show the stream duration, the codec parameters, the current 
position in
 the stream and the audio/video synchronisation drift.
 @item -bug
 Work around bugs.
-@item -vismv
-Visualize motion vectors.
 @item -fast
 Non-spec-compliant optimizations.
 @item -genpts
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 6/7] lavc: deprecate unused FF_BUG_OLD_MSMPEG4

2013-10-27 Thread Anton Khirnov
---
 libavcodec/avcodec.h   |2 ++
 libavcodec/options_table.h |2 ++
 libavcodec/version.h   |3 +++
 3 files changed, 7 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 93576c6..6295bea 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2248,7 +2248,9 @@ typedef struct AVCodecContext {
  */
 int workaround_bugs;
 #define FF_BUG_AUTODETECT   1  ///< autodetection
+#if FF_API_OLD_MSMPEG4
 #define FF_BUG_OLD_MSMPEG4  2
+#endif
 #define FF_BUG_XVID_ILACE   4
 #define FF_BUG_UMP4 8
 #define FF_BUG_NO_PADDING   16
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index f80b622..addfed4 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -117,7 +117,9 @@ static const AVOption avcodec_options[] = {
 {"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 
INT_MIN, INT_MAX},
 {"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), 
AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"},
 {"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, 
INT_MIN, INT_MAX, V|D, "bug"},
+#if FF_API_OLD_MSMPEG4
 {"old_msmpeg4", "some old lavc-generated MSMPEG4v3 files (no autodetection)", 
0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, 
"bug"},
+#endif
 {"xvid_ilace", "Xvid interlacing bug (autodetected if FOURCC == XVIX)", 0, 
AV_OPT_TYPE_CONST, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"},
 {"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"},
 {"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 28193ac..83a224f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -82,5 +82,8 @@
 #ifndef FF_API_AC_VLC
 #define FF_API_AC_VLC(LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_OLD_MSMPEG4
+#define FF_API_OLD_MSMPEG4   (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 3/7] lavc: deprecate AVCodecContext.debug_mv

2013-10-27 Thread Anton Khirnov
It has been unused since 37045e422903695e610cca6ecb753df643ab9380.
---
 libavcodec/avcodec.h   |7 ---
 libavcodec/options_table.h |2 ++
 libavcodec/pthread.c   |1 -
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f406e8f..2e559b7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2321,15 +2321,16 @@ typedef struct AVCodecContext {
 #define FF_DEBUG_BUFFERS 0x8000
 #define FF_DEBUG_THREADS 0x0001
 
+#if FF_API_DEBUG_MV
 /**
- * debug
- * - encoding: Set by user.
- * - decoding: Set by user.
+ * @deprecated this option does not have any effect
  */
+attribute_deprecated
 int debug_mv;
 #define FF_DEBUG_VIS_MV_P_FOR  0x0001 //visualize forward predicted MVs of 
P frames
 #define FF_DEBUG_VIS_MV_B_FOR  0x0002 //visualize forward predicted MVs of 
B frames
 #define FF_DEBUG_VIS_MV_B_BACK 0x0004 //visualize backward predicted MVs 
of B frames
+#endif
 
 /**
  * Error recognition; may misdetect some more or less valid parts as 
errors.
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index c551363..bd6b7af 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -222,10 +222,12 @@ static const AVOption avcodec_options[] = {
 {"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
 {"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
 {"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
 {"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), AV_OPT_TYPE_INT, 
{.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"},
 {"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"},
 {"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"},
 {"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"},
+#endif
 {"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 
= DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, 
{.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
 {"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, 
{.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index b646f66..480a115 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -423,7 +423,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 dst->opaque   = src->opaque;
 dst->debug= src->debug;
-dst->debug_mv = src->debug_mv;
 
 dst->slice_flags = src->slice_flags;
 dst->flags2  = src->flags2;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 5/7] lavc: schedule FF_BUG_AC_VLC for removal on the next major bump.

2013-10-27 Thread Anton Khirnov
It has been deprecated/unused for about 10 years.
---
 libavcodec/avcodec.h   |2 ++
 libavcodec/options_table.h |2 ++
 libavcodec/version.h   |3 +++
 3 files changed, 7 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 320dbdd..93576c6 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2253,7 +2253,9 @@ typedef struct AVCodecContext {
 #define FF_BUG_UMP4 8
 #define FF_BUG_NO_PADDING   16
 #define FF_BUG_AMV  32
+#if FF_API_AC_VLC
 #define FF_BUG_AC_VLC   0  ///< Will be removed, libavcodec can now 
handle these non-compliant files by default.
+#endif
 #define FF_BUG_QPEL_CHROMA  64
 #define FF_BUG_STD_QPEL 128
 #define FF_BUG_QPEL_CHROMA2 256
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index d9517b4..f80b622 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -122,7 +122,9 @@ static const AVOption avcodec_options[] = {
 {"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"},
 {"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"},
 {"amv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, 
V|D, "bug"},
+#if FF_API_AC_VLC
 {"ac_vlc", "illegal VLC bug (autodetected per FOURCC)", 0, AV_OPT_TYPE_CONST, 
{.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"},
+#endif
 {"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA }, 
INT_MIN, INT_MAX, V|D, "bug"},
 {"std_qpel", "old standard qpel (autodetected per FOURCC/version)", 0, 
AV_OPT_TYPE_CONST, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"},
 {"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA2 }, 
INT_MIN, INT_MAX, V|D, "bug"},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index af022d9..28193ac 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -79,5 +79,8 @@
 #ifndef FF_API_DEBUG_MV
 #define FF_API_DEBUG_MV  (LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_AC_VLC
+#define FF_API_AC_VLC(LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 7/7] lavc: move FF_ASPECT_EXTENDED from avcodec.h to h263.h

2013-10-27 Thread Anton Khirnov
It's for internal use only.
---
 libavcodec/avcodec.h |2 ++
 libavcodec/h263.h|4 
 libavcodec/version.h |3 +++
 3 files changed, 9 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6295bea..0e5a805 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1184,7 +1184,9 @@ typedef struct AVCodecContext {
  */
 int coded_width, coded_height;
 
+#if FF_API_ASPECT_EXTENDED
 #define FF_ASPECT_EXTENDED 15
+#endif
 
 /**
  * the number of pictures in a group of pictures, or 0 for intra_only
diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 4f58f92..c6ad618 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -26,6 +26,10 @@
 #include "mpegvideo.h"
 #include "rl.h"
 
+#if !FF_API_ASPECT_EXTENDED
+#define FF_ASPECT_EXTENDED 15
+#endif
+
 // The defines below define the number of bits that are read at once for
 // reading vlc values. Changing these may improve speed and data cache needs
 // be aware though that decreasing them may need the number of stages that is
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 83a224f..b787f48 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -85,5 +85,8 @@
 #ifndef FF_API_OLD_MSMPEG4
 #define FF_API_OLD_MSMPEG4   (LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_ASPECT_EXTENDED
+#define FF_API_ASPECT_EXTENDED   (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 1/7] lavc: deprecate FF_DEBUG_MV and remove all traces of its use

2013-10-27 Thread Anton Khirnov
It has not been actually used since
37045e422903695e610cca6ecb753df643ab9380, when the broken vismv code was
removed.
---
 avconv.c   |3 ---
 libavcodec/avcodec.h   |5 +
 libavcodec/mpegvideo.c |3 +--
 libavcodec/options_table.h |2 ++
 libavcodec/version.h   |3 +++
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/avconv.c b/avconv.c
index 7351b77..0cab53c 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1740,9 +1740,6 @@ static int transcode_init(void)
 av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too 
low."
  "It takes bits/s as argument, not 
kbits/s\n");
 extra_size += ost->st->codec->extradata_size;
-
-if (ost->st->codec->me_threshold)
-input_streams[ost->source_index]->st->codec->debug |= 
FF_DEBUG_MV;
 } else {
 av_opt_set_dict(ost->st->codec, &ost->opts);
 }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 856eda5..f406e8f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2303,7 +2303,12 @@ typedef struct AVCodecContext {
 #define FF_DEBUG_BITSTREAM   4
 #define FF_DEBUG_MB_TYPE 8
 #define FF_DEBUG_QP  16
+#if FF_API_DEBUG_MV
+/**
+ * @deprecated this option does nothing
+ */
 #define FF_DEBUG_MV  32
+#endif
 #define FF_DEBUG_DCT_COEFF   0x0040
 #define FF_DEBUG_SKIP0x0080
 #define FF_DEBUG_STARTCODE   0x0100
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 718f946..ae458ab 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -321,8 +321,7 @@ static int alloc_picture_tables(MpegEncContext *s, Picture 
*pic)
 return AVERROR(ENOMEM);
 }
 
-if (s->out_format == FMT_H263 || s->encoding ||
-   (s->avctx->debug & FF_DEBUG_MV) || s->avctx->debug_mv) {
+if (s->out_format == FMT_H263 || s->encoding) {
 int mv_size= 2 * (b8_array_size + 4) * sizeof(int16_t);
 int ref_index_size = 4 * mb_array_size;
 
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 5e9d484..c551363 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -208,7 +208,9 @@ static const AVOption avcodec_options[] = {
 {"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, 
INT_MIN, INT_MAX, V|D, "debug"},
 {"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
 {"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = 
FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
 {"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, 
INT_MAX, V|D, "debug"},
+#endif
 {"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, 
INT_MIN, INT_MAX, V|D, "debug"},
 {"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, 
INT_MAX, V|D, "debug"},
 {"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, 
INT_MIN, INT_MAX, V|D, "debug"},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 321c7ef..af022d9 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -76,5 +76,8 @@
 #ifndef FF_API_SET_DIMENSIONS
 #define FF_API_SET_DIMENSIONS(LIBAVCODEC_VERSION_MAJOR < 56)
 #endif
+#ifndef FF_API_DEBUG_MV
+#define FF_API_DEBUG_MV  (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
 
 #endif /* AVCODEC_VERSION_H */
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] dcadec: use request_channel_layout instead of request_channels

2013-10-27 Thread Anton Khirnov

On Sun, 27 Oct 2013 12:28:19 +0100, Vittorio Giovara 
 wrote:
> On Sun, Oct 27, 2013 at 8:32 AM, Anton Khirnov  wrote:
> >
> > *stab*
> >
> 
> Whopps, sorry, I did check with FATE and no failures were reported but
> I'll be working more on this later.

FATE does not test everything, so you should always make sure you have a good
enough understanding of what it is you're trying to do.

(though it should test this specific feature, i wonder why didn't it fail)

-- 
Anton Khirnov
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] dcadec: use request_channel_layout instead of request_channels

2013-10-27 Thread Vittorio Giovara
On Sun, Oct 27, 2013 at 8:32 AM, Anton Khirnov  wrote:
>
> *stab*
>

Whopps, sorry, I did check with FATE and no failures were reported but
I'll be working more on this later.
Vittorio
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH] h263: Check init_get_bits return value

2013-10-27 Thread Luca Barbato
From: Michael Niedermayer 

And use init_get_bits8 to check for integer overflows while at it.

CC: libav-sta...@libav.org
Signed-off-by: Luca Barbato 
---

We expect the first call to fail to find a vol header apparently, I hadn't
look that deeply into mpeg4 yet (first I had to clean it up a bit).

 libavcodec/h263dec.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index a1c7b00..8060d8f 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -405,12 +405,15 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 }

 if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) // divx 
5.01+/xvid frame reorder
-init_get_bits(&s->gb, s->bitstream_buffer,
-  s->bitstream_buffer_size * 8);
+ret = init_get_bits8(&s->gb, s->bitstream_buffer,
+ s->bitstream_buffer_size);
 else
-init_get_bits(&s->gb, buf, buf_size * 8);
+ret = init_get_bits8(&s->gb, buf, buf_size);
 s->bitstream_buffer_size = 0;

+if (ret < 0)
+return ret;
+
 if (!s->context_initialized)
 // we need the idct permutaton for reading a custom matrix
 if ((ret = ff_MPV_common_init(s)) < 0)
@@ -434,9 +437,11 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 if (s->avctx->extradata_size && s->picture_number == 0) {
 GetBitContext gb;

-init_get_bits(&gb, s->avctx->extradata,
-  s->avctx->extradata_size * 8);
-ret = ff_mpeg4_decode_picture_header(s, &gb);
+ret = init_get_bits8(&gb, s->avctx->extradata,
+ s->avctx->extradata_size);
+if (ret < 0)
+return ret;
+ff_mpeg4_decode_picture_header(s, &gb);
 }
 ret = ff_mpeg4_decode_picture_header(s, &s->gb);
 } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
--
1.8.3.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 33/50] mpegvideo_parser: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Luca Barbato
On 27/10/13 11:10, Anton Khirnov wrote:
> ---
>  libavcodec/mpegvideo_parser.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
> index 3219c10..bec1b36 100644
> --- a/libavcodec/mpegvideo_parser.c
> +++ b/libavcodec/mpegvideo_parser.c
> @@ -62,7 +62,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext 
> *s,
>  pc->width  = (buf[0] << 4) | (buf[1] >> 4);
>  pc->height = ((buf[1] & 0x0f) << 8) | buf[2];
>  if(!avctx->width || !avctx->height || !avctx->coded_width || 
> !avctx->coded_height){
> -avcodec_set_dimensions(avctx, pc->width, pc->height);
> +ff_set_dimensions(avctx, pc->width, pc->height);
>  did_set_size=1;
>  }
>  frame_rate_index = buf[3] & 0xf;
> @@ -90,7 +90,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext 
> *s,
>  pc->height |=( vert_size_ext << 12);
>  avctx->bit_rate += (bit_rate_ext << 18) * 400;
>  if(did_set_size)
> -avcodec_set_dimensions(avctx, pc->width, 
> pc->height);
> +ff_set_dimensions(avctx, pc->width, pc->height);
>  avctx->time_base.den = pc->frame_rate.den * 
> (frame_rate_ext_n + 1) * 2;
>  avctx->time_base.num = pc->frame_rate.num * 
> (frame_rate_ext_d + 1);
>  avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
> 

Remind me to change this to return an error later.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH] fate: add ffv1.0 test

2013-10-27 Thread Luca Barbato
On 27/10/13 10:14, Peter B. wrote:
> I was trying to read myself into FATE, in order to be able to add
> additional tests for FFV1.
> 
> I've already read the documentation about FATE [1], and I've already
> managed to add new testing rules for FFV1 (in tests/fate/vcodec.mak).
> btw: The FATE docs [1] only describe how to run the existing tests, but
> I didn't find information about how to create new ones.
> 
> So far so good, but now I have some questions:
> 
> 1) How do I add the reference files, required for tests to be able to diff?

You can upload to our local ftp[1] and drop me a note.

> 2) How do I get a LCOV HTML report locally?

https://wiki.libav.org/GcovCoverageHowTo

> I'd like to cover more lines of FFV1's code, and therefore would like to
> be able to view the "LCOV - code coverage report" [2] from my local tests.
> 
> I assumed that running the "fate.sh" script for submitting FATE results
> would create those HTML pages.

No it would provide a FATE report.

> I've created a "fate_config.sh" file, based on
> "doc/fate_config.sh.template" and ran the tests.

> Any suggestions how I could have a local LCOV view?

In theory all you need is in the wiki page I linked.

I'll write a nicer howto on add FATE tests soon (I plan to refactor fate
a little more)

[1] http://upload.libav.org
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 38/50] rv10: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/rv10.c |9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index f790c1f..f80625a 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -28,6 +28,7 @@
 #include "libavutil/imgutils.h"
 #include "avcodec.h"
 #include "error_resilience.h"
+#include "internal.h"
 #include "mpegvideo.h"
 #include "mpeg4video.h"
 #include "h263.h"
@@ -358,10 +359,12 @@ static int rv20_decode_picture_header(RVDecContext *rv)
 if (new_w != s->width || new_h != s->height) {
 av_log(s->avctx, AV_LOG_DEBUG,
"attempting to change resolution to %dx%d\n", new_w, new_h);
-if (av_image_check_size(new_w, new_h, 0, s->avctx) < 0)
-return AVERROR_INVALIDDATA;
 ff_MPV_common_end(s);
-avcodec_set_dimensions(s->avctx, new_w, new_h);
+
+ret = ff_set_dimensions(s->avctx, new_w, new_h);
+if (ret < 0)
+return ret;
+
 s->width  = new_w;
 s->height = new_h;
 if ((ret = ff_MPV_common_init(s)) < 0)
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 32/50] mpeg4video_parser: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/mpeg4video_parser.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index e291262..dfba84c 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -20,6 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "internal.h"
 #include "parser.h"
 #include "mpegvideo.h"
 #include "mpeg4video.h"
@@ -89,7 +90,9 @@ static int av_mpeg4_decode_header(AVCodecParserContext *s1,
 init_get_bits(gb, buf, 8 * buf_size);
 ret = ff_mpeg4_decode_picture_header(s, gb);
 if (s->width && (!avctx->width || !avctx->height || !avctx->coded_width || 
!avctx->coded_height)) {
-avcodec_set_dimensions(avctx, s->width, s->height);
+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
 }
 s1->pict_type= s->pict_type;
 pc->first_picture = 0;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 28/50] libopenjpegdec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/libopenjpegdec.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index 0062701..77a37e9 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -33,6 +33,7 @@
 #include "libavutil/pixfmt.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
+#include "internal.h"
 #include "thread.h"
 
 #define JP2_SIG_TYPE0x6A502020
@@ -315,13 +316,9 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 height = (height + (1 << ctx->lowres) - 1) >> ctx->lowres;
 }
 
-if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) {
-av_log(avctx, AV_LOG_ERROR,
-   "%dx%d dimension invalid.\n", width, height);
-goto done;
-}
-
-avcodec_set_dimensions(avctx, width, height);
+ret = ff_set_dimensions(avctx, width, height);
+if (ret < 0)
+return ret;
 
 if (avctx->pix_fmt != AV_PIX_FMT_NONE)
 if (!libopenjpeg_matches_pix_fmt(image, avctx->pix_fmt))
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 20/50] eatgv: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/eatgv.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/eatgv.c b/libavcodec/eatgv.c
index fabc516..3602795 100644
--- a/libavcodec/eatgv.c
+++ b/libavcodec/eatgv.c
@@ -269,9 +269,11 @@ static int tgv_decode_frame(AVCodecContext *avctx,
 s->width  = AV_RL16(&buf[0]);
 s->height = AV_RL16(&buf[2]);
 if (s->avctx->width != s->width || s->avctx->height != s->height) {
-avcodec_set_dimensions(s->avctx, s->width, s->height);
 av_freep(&s->frame_buffer);
 av_frame_unref(&s->last_frame);
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
 }
 
 pal_count = AV_RL16(&buf[6]);
@@ -282,9 +284,6 @@ static int tgv_decode_frame(AVCodecContext *avctx,
 }
 }
 
-if ((ret = av_image_check_size(s->width, s->height, 0, avctx)) < 0)
-return ret;
-
 if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0)
 return ret;
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 14/50] dpx: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/dpx.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index da7457d..c1f163b 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -147,10 +147,10 @@ static int decode_frame(AVCodecContext *avctx,
 return AVERROR_INVALIDDATA;
 }
 
-if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
 return ret;
-if (w != avctx->width || h != avctx->height)
-avcodec_set_dimensions(avctx, w, h);
+
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 return ret;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 44/50] tiff: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/tiff.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 735eafe..7fb0e7a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -296,9 +296,9 @@ static int init_image(TiffContext *s, AVFrame *frame)
 return AVERROR_INVALIDDATA;
 }
 if (s->width != s->avctx->width || s->height != s->avctx->height) {
-if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
 return ret;
-avcodec_set_dimensions(s->avctx, s->width, s->height);
 }
 if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) {
 av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 27/50] kgv1dec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/kgv1dec.c |7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavcodec/kgv1dec.c b/libavcodec/kgv1dec.c
index 1774f36..a5f360c 100644
--- a/libavcodec/kgv1dec.c
+++ b/libavcodec/kgv1dec.c
@@ -61,12 +61,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 h = (buf[1] + 1) * 8;
 buf += 2;
 
-if ((res = av_image_check_size(w, h, 0, avctx)) < 0)
-return res;
-
 if (w != avctx->width || h != avctx->height) {
 av_frame_unref(&c->prev);
-avcodec_set_dimensions(avctx, w, h);
+res = ff_set_dimensions(avctx, w, h);
+if (res < 0)
+return res;
 }
 
 maxcnt = w * h;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 17/50] eacmv: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/eacmv.c |   18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index 3b1256c..d39ebd3 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -129,19 +129,21 @@ static void cmv_decode_inter(CmvContext *s, AVFrame 
*frame, const uint8_t *buf,
 }
 }
 
-static void cmv_process_header(CmvContext *s, const uint8_t *buf, const 
uint8_t *buf_end)
+static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t 
*buf_end)
 {
-int pal_start, pal_count, i;
+int pal_start, pal_count, i, ret;
 
 if(buf_end - buf < 16) {
 av_log(s->avctx, AV_LOG_WARNING, "truncated header\n");
-return;
+return AVERROR_INVALIDDATA;
 }
 
 s->width  = AV_RL16(&buf[4]);
 s->height = AV_RL16(&buf[6]);
-if (s->avctx->width!=s->width || s->avctx->height!=s->height)
-avcodec_set_dimensions(s->avctx, s->width, s->height);
+
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
 
 s->avctx->time_base.num = 1;
 s->avctx->time_base.den = AV_RL16(&buf[10]);
@@ -154,6 +156,8 @@ static void cmv_process_header(CmvContext *s, const uint8_t 
*buf, const uint8_t
 s->palette[i] = AV_RB24(buf);
 buf += 3;
 }
+
+return 0;
 }
 
 #define EA_PREAMBLE_SIZE 8
@@ -174,7 +178,9 @@ static int cmv_decode_frame(AVCodecContext *avctx,
 return AVERROR_INVALIDDATA;
 
 if (AV_RL32(buf)==MVIh_TAG||AV_RB32(buf)==MVIh_TAG) {
-cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+ret = cmv_process_header(s, buf+EA_PREAMBLE_SIZE, buf_end);
+if (ret < 0)
+return ret;
 return buf_size;
 }
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 26/50] ivi_common: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/ivi_common.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c
index 7ca53b7..8c5d7f3 100644
--- a/libavcodec/ivi_common.c
+++ b/libavcodec/ivi_common.c
@@ -1015,7 +1015,10 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 av_log(avctx, AV_LOG_ERROR, "Buffer contains IP frames!\n");
 }
 
-avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height);
+result = ff_set_dimensions(avctx, ctx->planes[0].width, 
ctx->planes[0].height);
+if (result < 0)
+return result;
+
 if ((result = ff_get_buffer(avctx, frame, 0)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 return result;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 46/50] txd: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/txd.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 0eca07f..3bd986e 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -63,10 +63,10 @@ static int txd_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
 return AVERROR_PATCHWELCOME;
 }
 
-if ((ret = av_image_check_size(w, h, 0, avctx)) < 0)
+ret = ff_set_dimensions(avctx, w, h);
+if (ret < 0)
 return ret;
-if (w != avctx->width || h != avctx->height)
-avcodec_set_dimensions(avctx, w, h);
+
 if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
 return ret;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 01/50] libopenjpegdec: return meaningful error codes

2013-10-27 Thread Anton Khirnov
---
 libavcodec/libopenjpegdec.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c
index ca824c6..0062701 100644
--- a/libavcodec/libopenjpegdec.c
+++ b/libavcodec/libopenjpegdec.c
@@ -257,7 +257,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 opj_dinfo_t *dec;
 opj_cio_t *stream;
 opj_image_t *image;
-int width, height, ret = -1;
+int width, height, ret;
 int pixel_size = 0;
 int ispacked = 0;
 int i;
@@ -279,7 +279,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 
 if (!dec) {
 av_log(avctx, AV_LOG_ERROR, "Error initializing decoder.\n");
-return -1;
+return AVERROR_UNKNOWN;
 }
 opj_set_event_mgr((opj_common_ptr)dec, NULL, NULL);
 
@@ -294,7 +294,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 av_log(avctx, AV_LOG_ERROR,
"Codestream could not be opened for reading.\n");
 opj_destroy_decompress(dec);
-return -1;
+return AVERROR_UNKNOWN;
 }
 
 // Decode the header only.
@@ -304,7 +304,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 if (!image) {
 av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
 opj_destroy_decompress(dec);
-return -1;
+return AVERROR_UNKNOWN;
 }
 
 width  = image->x1 - image->x0;
@@ -315,7 +315,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 height = (height + (1 << ctx->lowres) - 1) >> ctx->lowres;
 }
 
-if (av_image_check_size(width, height, 0, avctx) < 0) {
+if ((ret = av_image_check_size(width, height, 0, avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR,
"%dx%d dimension invalid.\n", width, height);
 goto done;
@@ -340,7 +340,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 if (image->comps[i].prec > avctx->bits_per_raw_sample)
 avctx->bits_per_raw_sample = image->comps[i].prec;
 
-if (ff_thread_get_buffer(avctx, &frame, 0) < 0) {
+if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed\n");
 goto done;
 }
@@ -352,6 +352,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 if (!stream) {
 av_log(avctx, AV_LOG_ERROR,
"Codestream could not be opened for reading.\n");
+ret = AVERROR_UNKNOWN;
 goto done;
 }
 
@@ -362,6 +363,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 
 if (!image) {
 av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n");
+ret = AVERROR_UNKNOWN;
 goto done;
 }
 
@@ -398,6 +400,7 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx,
 break;
 default:
 av_log(avctx, AV_LOG_ERROR, "unsupported pixel size %d\n", pixel_size);
+ret = AVERROR_PATCHWELCOME;
 goto done;
 }
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 19/50] eatgq: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/eatgq.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c
index 0a3e0f6..1ead5f7 100644
--- a/libavcodec/eatgq.c
+++ b/libavcodec/eatgq.c
@@ -216,9 +216,10 @@ static int tgq_decode_frame(AVCodecContext *avctx,
 s->height = bytestream2_get_le16u(&s->gb);
 }
 
-if (s->avctx->width!=s->width || s->avctx->height!=s->height) {
-avcodec_set_dimensions(s->avctx, s->width, s->height);
-}
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
+
 tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb));
 bytestream2_skip(&s->gb, 3);
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 08/50] lavc/utils: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/utils.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1e0026d..262f081 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -934,15 +934,17 @@ int attribute_align_arg avcodec_open2(AVCodecContext 
*avctx, const AVCodec *code
 goto free_and_end;
 
 if (avctx->coded_width && avctx->coded_height && !avctx->width && 
!avctx->height)
-avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);
+ret = ff_set_dimensions(avctx, avctx->coded_width, 
avctx->coded_height);
 else if (avctx->width && avctx->height)
-avcodec_set_dimensions(avctx, avctx->width, avctx->height);
+ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
+if (ret < 0)
+goto free_and_end;
 
 if ((avctx->coded_width || avctx->coded_height || avctx->width || 
avctx->height)
 && (  av_image_check_size(avctx->coded_width, avctx->coded_height, 0, 
avctx) < 0
|| av_image_check_size(avctx->width,   avctx->height,   0, 
avctx) < 0)) {
 av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height 
values\n");
-avcodec_set_dimensions(avctx, 0, 0);
+ff_set_dimensions(avctx, 0, 0);
 }
 
 /* if the decoder init function was already called previously,
@@ -1334,7 +1336,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, 
uint8_t *buf, int buf_size,
 
 static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
 {
-int size = 0;
+int size = 0, ret;
 const uint8_t *data;
 uint32_t flags;
 
@@ -1377,8 +1379,10 @@ static int apply_param_change(AVCodecContext *avctx, 
AVPacket *avpkt)
 goto fail;
 avctx->width  = bytestream_get_le32(&data);
 avctx->height = bytestream_get_le32(&data);
-avcodec_set_dimensions(avctx, avctx->width, avctx->height);
 size -= 8;
+ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
+if (ret < 0)
+return ret;
 }
 
 return 0;
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 09/50] ansi: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/ansi.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index ae67f3c..3f30ae9 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -89,7 +89,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 s->bg  = DEFAULT_BG_COLOR;
 
 if (!avctx->width || !avctx->height)
-avcodec_set_dimensions(avctx, 80<<3, 25<<4);
+ff_set_dimensions(avctx, 80 << 3, 25 << 4);
 
 return 0;
 }
@@ -226,7 +226,9 @@ static int execute_code(AVCodecContext * avctx, int c)
 }
 if (width != avctx->width || height != avctx->height) {
 av_frame_unref(s->frame);
-avcodec_set_dimensions(avctx, width, height);
+ret = ff_set_dimensions(avctx, width, height);
+if (ret < 0)
+return ret;
 ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF);
 if (ret < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 45/50] truemotion1: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/truemotion1.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c
index c1e0863..57b3d23 100644
--- a/libavcodec/truemotion1.c
+++ b/libavcodec/truemotion1.c
@@ -397,15 +397,17 @@ static int truemotion1_decode_header(TrueMotion1Context 
*s)
 new_pix_fmt = AV_PIX_FMT_RGB555; // RGB565 is supported as well
 
 s->w >>= width_shift;
-if ((ret = av_image_check_size(s->w, s->h, 0, s->avctx)) < 0)
-return ret;
 
 if (s->w != s->avctx->width || s->h != s->avctx->height ||
 new_pix_fmt != s->avctx->pix_fmt) {
 av_frame_unref(&s->frame);
 s->avctx->sample_aspect_ratio = (AVRational){ 1 << width_shift, 1 };
 s->avctx->pix_fmt = new_pix_fmt;
-avcodec_set_dimensions(s->avctx, s->w, s->h);
+
+ret = ff_set_dimensions(s->avctx, s->w, s->h);
+if (ret < 0)
+return ret;
+
 av_fast_malloc(&s->vert_pred, &s->vert_pred_size, s->avctx->width * 
sizeof(unsigned int));
 }
 
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 10/50] avs: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/avs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/avs.c b/libavcodec/avs.c
index 6ff6d26..8e70a90 100644
--- a/libavcodec/avs.c
+++ b/libavcodec/avs.c
@@ -160,7 +160,7 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
 {
 AvsContext *s = avctx->priv_data;
 avctx->pix_fmt = AV_PIX_FMT_PAL8;
-avcodec_set_dimensions(avctx, 318, 198);
+ff_set_dimensions(avctx, 318, 198);
 avcodec_get_frame_defaults(&s->picture);
 return 0;
 }
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 21/50] eatqi: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/eatqi.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
index 9f7ec4d..2345cc7 100644
--- a/libavcodec/eatqi.c
+++ b/libavcodec/eatqi.c
@@ -111,8 +111,9 @@ static int tqi_decode_frame(AVCodecContext *avctx,
 tqi_calculate_qtable(s, buf[4]);
 buf += 8;
 
-if (s->avctx->width!=s->width || s->avctx->height!=s->height)
-avcodec_set_dimensions(s->avctx, s->width, s->height);
+ret = ff_set_dimensions(s->avctx, s->width, s->height);
+if (ret < 0)
+return ret;
 
 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 40/50] sgidec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/sgidec.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c
index 476311d..928806f 100644
--- a/libavcodec/sgidec.c
+++ b/libavcodec/sgidec.c
@@ -200,9 +200,9 @@ static int decode_frame(AVCodecContext *avctx,
 return -1;
 }
 
-if (av_image_check_size(s->width, s->height, 0, avctx))
-return -1;
-avcodec_set_dimensions(avctx, s->width, s->height);
+ret = ff_set_dimensions(avctx, s->width, s->height);
+if (ret < 0)
+return ret;
 
 if (ff_get_buffer(avctx, p, 0) < 0) {
 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n");
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 16/50] dvdsubdec: stop using deprecated avcodec_set_dimensions

2013-10-27 Thread Anton Khirnov
---
 libavcodec/dvdsubdec.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 3cc9022..c5e864d 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -21,6 +21,8 @@
 #include "avcodec.h"
 #include "get_bits.h"
 #include "dsputil.h"
+#include "internal.h"
+
 #include "libavutil/attributes.h"
 #include "libavutil/colorspace.h"
 #include "libavutil/imgutils.h"
@@ -527,9 +529,11 @@ static av_cold int dvdsub_init(AVCodecContext *avctx)
 }
 } else if (!strncmp("size:", cur, 5)) {
 int w, h;
-if (sscanf(cur + 5, "%dx%d", &w, &h) == 2 &&
-av_image_check_size(w, h, 0, avctx) >= 0)
-avcodec_set_dimensions(avctx, w, h);
+if (sscanf(cur + 5, "%dx%d", &w, &h) == 2) {
+   int ret = ff_set_dimensions(avctx, w, h);
+   if (ret < 0)
+   return ret;
+}
 }
 cur += strcspn(cur, "\n\r");
 cur += strspn(cur, "\n\r");
-- 
1.7.10.4

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


  1   2   >