summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-03-05 22:24:57 +0100
committerwm4 <wm4@mplayer2.org>2012-03-05 22:24:57 +0100
commit8dc0743571630a08fd40fa88aa09b12b4ce65bf2 (patch)
treee1c4465768635d77954b5fd21ae726444ee4f48a /libmpcodecs
parentaebdf4f153438497b9310bd1417b5216f07e043b (diff)
parentafecdb681bed81b5df0ed18a300c68be603dfdf9 (diff)
downloadmpv-8dc0743571630a08fd40fa88aa09b12b4ce65bf2.tar.bz2
mpv-8dc0743571630a08fd40fa88aa09b12b4ce65bf2.tar.xz
Merge remote-tracking branch 'origin/master' into my_master
Conflicts: mplayer.c screenshot.c
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_dk3adpcm.c3
-rw-r--r--libmpcodecs/ad_ffmpeg.c27
-rw-r--r--libmpcodecs/ad_hwac3.c5
-rw-r--r--libmpcodecs/ad_imaadpcm.c3
-rw-r--r--libmpcodecs/ad_msadpcm.c5
-rw-r--r--libmpcodecs/vd_ffmpeg.c43
-rw-r--r--libmpcodecs/vd_mtga.c3
-rw-r--r--libmpcodecs/vd_realvid.c3
-rw-r--r--libmpcodecs/vd_sgi.c3
-rw-r--r--libmpcodecs/vd_theora.c3
-rw-r--r--libmpcodecs/vf.c2
-rw-r--r--libmpcodecs/vf_lavc.c4
-rw-r--r--libmpcodecs/vf_uspp.c7
13 files changed, 53 insertions, 58 deletions
diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c
index d1792ee46b..15027f88b1 100644
--- a/libmpcodecs/ad_dk3adpcm.c
+++ b/libmpcodecs/ad_dk3adpcm.c
@@ -32,8 +32,9 @@
#include <stdlib.h>
#include <unistd.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "ad_internal.h"
static const ad_info_t info =
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index cd742cf8f8..4a5062ba00 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include "talloc.h"
@@ -67,10 +68,10 @@ static int setup_format(sh_audio_t *sh_audio,
{
int sample_format = sh_audio->sample_format;
switch (lavc_context->sample_fmt) {
- case SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break;
- case SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break;
- case SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break;
- case SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break;
+ case AV_SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break;
+ case AV_SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break;
+ case AV_SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break;
+ case AV_SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break;
default:
mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n");
}
@@ -119,10 +120,12 @@ static int init(sh_audio_t *sh_audio)
struct priv *ctx = talloc_zero(NULL, struct priv);
sh_audio->context = ctx;
- lavc_context = avcodec_alloc_context();
+ lavc_context = avcodec_alloc_context3(lavc_codec);
ctx->avctx = lavc_context;
- lavc_context->drc_scale = opts->drc_level;
+ // Always try to set - option only exists for AC3 at the moment
+ av_opt_set_double(lavc_context, "drc_scale", opts->drc_level,
+ AV_OPT_SEARCH_CHILDREN);
lavc_context->sample_rate = sh_audio->samplerate;
lavc_context->bit_rate = sh_audio->i_bps * 8;
if (sh_audio->wf) {
@@ -156,7 +159,7 @@ static int init(sh_audio_t *sh_audio)
}
/* open it */
- if (avcodec_open(lavc_context, lavc_codec) < 0) {
+ if (avcodec_open2(lavc_context, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Could not open codec.\n");
uninit(sh_audio);
return 0;
@@ -195,10 +198,10 @@ static int init(sh_audio_t *sh_audio)
sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
switch (lavc_context->sample_fmt) {
- case SAMPLE_FMT_U8:
- case SAMPLE_FMT_S16:
- case SAMPLE_FMT_S32:
- case SAMPLE_FMT_FLT:
+ case AV_SAMPLE_FMT_U8:
+ case AV_SAMPLE_FMT_S16:
+ case AV_SAMPLE_FMT_S32:
+ case AV_SAMPLE_FMT_FLT:
break;
default:
uninit(sh_audio);
@@ -215,7 +218,7 @@ static void uninit(sh_audio_t *sh)
AVCodecContext *lavc_context = ctx->avctx;
if (lavc_context) {
- if (lavc_context->codec && avcodec_close(lavc_context) < 0)
+ if (avcodec_close(lavc_context) < 0)
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);
diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c
index f5d6fbc933..a11c2c90e7 100644
--- a/libmpcodecs/ad_hwac3.c
+++ b/libmpcodecs/ad_hwac3.c
@@ -26,11 +26,12 @@
#include <string.h>
#include <unistd.h>
+#include <libavutil/intreadwrite.h>
+#include <libavutil/common.h>
+
#include "config.h"
#include "mp_msg.h"
#include "mpbswap.h"
-#include "libavutil/common.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "ad_internal.h"
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c
index 2ca71f29de..84f667ecd6 100644
--- a/libmpcodecs/ad_imaadpcm.c
+++ b/libmpcodecs/ad_imaadpcm.c
@@ -38,8 +38,9 @@
#include <unistd.h>
#include <inttypes.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "ad_internal.h"
diff --git a/libmpcodecs/ad_msadpcm.c b/libmpcodecs/ad_msadpcm.c
index 162c7c04d3..eee89de2ea 100644
--- a/libmpcodecs/ad_msadpcm.c
+++ b/libmpcodecs/ad_msadpcm.c
@@ -28,9 +28,10 @@
#include <stdlib.h>
#include <unistd.h>
+#include <libavutil/common.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
-#include "libavutil/common.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "ad_internal.h"
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 0688aae7cc..5a45fef6d8 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -22,14 +22,16 @@
#include <time.h>
#include <stdbool.h>
+#include <libavutil/common.h>
+#include <libavutil/opt.h>
+#include <libavutil/intreadwrite.h>
+
#include "talloc.h"
#include "config.h"
#include "mp_msg.h"
#include "options.h"
#include "av_opts.h"
-#include "libavutil/common.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "fmt-conversion.h"
@@ -62,8 +64,6 @@ typedef struct {
int do_dr1;
int vo_initialized;
int best_csp;
- int b_age;
- int ip_age[2];
int qp_stat[32];
double qp_sum;
double inv_qp_sum;
@@ -86,7 +86,6 @@ static void uninit(struct sh_video *sh);
const m_option_t lavc_decode_opts_conf[] = {
OPT_INTRANGE("bug", lavc_param.workaround_bugs, 0, -1, 999999),
- OPT_INTRANGE("er", lavc_param.error_resilience, 0, 0, 99),
OPT_FLAG_ON("gray", lavc_param.gray, 0),
OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99),
OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99),
@@ -149,11 +148,10 @@ static int init(sh_video_t *sh)
&& lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8
&& lavc_codec->id != CODEC_ID_LAGARITH)
ctx->do_dr1 = 1;
- ctx->b_age = ctx->ip_age[0] = ctx->ip_age[1] = 256 * 256 * 256 * 64;
ctx->ip_count = ctx->b_count = 0;
ctx->pic = avcodec_alloc_frame();
- ctx->avctx = avcodec_alloc_context();
+ ctx->avctx = avcodec_alloc_context3(lavc_codec);
avctx = ctx->avctx;
avctx->opaque = sh;
avctx->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -209,7 +207,6 @@ static int init(sh_video_t *sh)
avctx->coded_width = sh->disp_w;
avctx->coded_height = sh->disp_h;
avctx->workaround_bugs = lavc_param->workaround_bugs;
- avctx->error_recognition = lavc_param->error_resilience;
if (lavc_param->gray)
avctx->flags |= CODEC_FLAG_GRAY;
avctx->flags2 |= lavc_param->fast;
@@ -272,7 +269,7 @@ static int init(sh_video_t *sh)
* MJPG fourcc :( */
if (!sh->bih || sh->bih->biSize <= sizeof(*sh->bih))
break;
- avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
+ av_opt_set_int(avctx, "extern_huff", 1, AV_OPT_SEARCH_CHILDREN);
avctx->extradata_size = sh->bih->biSize - sizeof(*sh->bih);
avctx->extradata = av_mallocz(avctx->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
@@ -318,7 +315,7 @@ static int init(sh_video_t *sh)
avctx->thread_count = lavc_param->threads;
/* open it */
- if (avcodec_open(avctx, lavc_codec) < 0) {
+ if (avcodec_open2(avctx, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
uninit(sh);
return 0;
@@ -550,19 +547,6 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic)
pic->opaque = mpi;
- if (pic->reference) {
- pic->age = ctx->ip_age[0];
-
- ctx->ip_age[0] = ctx->ip_age[1] + 1;
- ctx->ip_age[1] = 1;
- ctx->b_age++;
- } else {
- pic->age = ctx->b_age;
-
- ctx->ip_age[0]++;
- ctx->ip_age[1]++;
- ctx->b_age = 1;
- }
pic->type = FF_BUFFER_TYPE_USER;
/* The libavcodec reordered_opaque functionality is implemented by
@@ -626,9 +610,6 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
int dr1 = ctx->do_dr1;
AVPacket pkt;
- if (len <= 0)
- return NULL; // skipped frame
-
if (!dr1)
avctx->draw_horiz_band = NULL;
@@ -708,16 +689,16 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
all_frametime, (double)(len * 8) / sh->frametime / 1000.0,
(double)(all_len * 8) / all_frametime / 1000.0);
switch (pic->pict_type) {
- case FF_I_TYPE:
+ case AV_PICTURE_TYPE_I:
fprintf(fvstats, "type= I\n");
break;
- case FF_P_TYPE:
+ case AV_PICTURE_TYPE_P:
fprintf(fvstats, "type= P\n");
break;
- case FF_S_TYPE:
+ case AV_PICTURE_TYPE_S:
fprintf(fvstats, "type= S\n");
break;
- case FF_B_TYPE:
+ case AV_PICTURE_TYPE_B:
fprintf(fvstats, "type= B\n");
break;
default:
@@ -837,6 +818,8 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...)
return CONTROL_TRUE;
case VDCTRL_QUERY_UNSEEN_FRAMES:;
int delay = avctx->has_b_frames;
+ if (avctx->active_thread_type & FF_THREAD_FRAME)
+ delay += avctx->thread_count - 1;
return delay + 10;
case VDCTRL_RESET_ASPECT:
if (ctx->vo_initialized)
diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c
index 390166a3e6..861f898f80 100644
--- a/libmpcodecs/vd_mtga.c
+++ b/libmpcodecs/vd_mtga.c
@@ -26,10 +26,11 @@
#include <stdlib.h>
#include <string.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
#include "mp_msg.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "libvo/fastmemcpy.h"
#include "vd_internal.h"
diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c
index 8fc843855f..08637b1407 100644
--- a/libmpcodecs/vd_realvid.c
+++ b/libmpcodecs/vd_realvid.c
@@ -19,6 +19,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
#ifdef HAVE_LIBDL
@@ -26,7 +28,6 @@
#endif
#include "mp_msg.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "path.h"
#include "vd_internal.h"
diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c
index e7dd90cecc..1ec9b2e868 100644
--- a/libmpcodecs/vd_sgi.c
+++ b/libmpcodecs/vd_sgi.c
@@ -21,9 +21,10 @@
#include <stdio.h>
#include <stdlib.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
#include "mp_msg.h"
-#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "vd_internal.h"
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c
index 5ad3b35691..ba3c0d5d86 100644
--- a/libmpcodecs/vd_theora.c
+++ b/libmpcodecs/vd_theora.c
@@ -21,12 +21,13 @@
#include <stdarg.h>
#include <assert.h>
+#include <libavutil/intreadwrite.h>
+
#include "config.h"
#include "mp_msg.h"
#include "vd_internal.h"
-#include "ffmpeg_files/intreadwrite.h"
static const vd_info_t info = {
"Theora/VP3",
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index dda871a86d..83ae763fba 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -135,7 +135,9 @@ static const vf_info_t *const filter_list[] = {
&vf_info_palette,
&vf_info_pp7,
+#ifdef CONFIG_LIBPOSTPROC
&vf_info_pp,
+#endif
&vf_info_lavc,
&vf_info_lavcdeint,
&vf_info_screenshot,
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
index ba870a8b85..b2c1dd756d 100644
--- a/libmpcodecs/vf_lavc.c
+++ b/libmpcodecs/vf_lavc.c
@@ -71,7 +71,7 @@ static int config(struct vf_instance *vf,
vf->priv->outbuf_size=10000+width*height; // must be enough!
vf->priv->outbuf = malloc(vf->priv->outbuf_size);
- if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
+ if (avcodec_open2(&lavc_venc_context, vf->priv->codec, NULL) != 0) {
mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Could not open codec.\n");
return 0;
}
@@ -143,7 +143,7 @@ static int vf_open(vf_instance_t *vf, char *args){
return 0;
}
- vf->priv->context=avcodec_alloc_context();
+ vf->priv->context=avcodec_alloc_context3(vf->priv->codec);
vf->priv->pic = avcodec_alloc_frame();
// TODO: parse args ->
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index 332d59ee22..ae044b19a6 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -222,8 +222,7 @@ static int config(struct vf_instance *vf,
for(i=0; i< (1<<vf->priv->log2_count); i++){
AVCodecContext *avctx_enc;
- avctx_enc=
- vf->priv->avctx_enc[i]= avcodec_alloc_context();
+ avctx_enc = vf->priv->avctx_enc[i] = avcodec_alloc_context3(enc);
avctx_enc->width = width + BLOCK;
avctx_enc->height = height + BLOCK;
avctx_enc->time_base= (AVRational){1,25}; // meaningless
@@ -233,8 +232,8 @@ static int config(struct vf_instance *vf,
avctx_enc->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_LOW_DELAY;
avctx_enc->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
avctx_enc->global_quality= 123;
- avcodec_open(avctx_enc, enc);
- assert(avctx_enc->codec);
+ int res = avcodec_open2(avctx_enc, enc, NULL);
+ assert(res >= 0);
}
vf->priv->frame= avcodec_alloc_frame();
vf->priv->frame_dec= avcodec_alloc_frame();