summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_ffmpeg.c1
-rw-r--r--libmpcodecs/ad_twin.c2
-rw-r--r--libmpcodecs/ae_lavc.c2
-rw-r--r--libmpcodecs/vd.c7
-rw-r--r--libmpcodecs/vd_ffmpeg.c2
-rw-r--r--libmpcodecs/ve_lavc.c4
-rw-r--r--libmpcodecs/ve_x264.c47
7 files changed, 23 insertions, 42 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index bf3da1cbbe..fd354f8ba7 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -68,6 +68,7 @@ static int init(sh_audio_t *sh_audio)
}
lavc_context->request_channels = audio_output_channels;
lavc_context->codec_tag = sh_audio->format; //FOURCC
+ lavc_context->codec_type = CODEC_TYPE_AUDIO;
lavc_context->codec_id = lavc_codec->id; // not sure if required, imho not --A'rpi
/* alloc extra data */
diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c
index 395567128a..280b4cb8c1 100644
--- a/libmpcodecs/ad_twin.c
+++ b/libmpcodecs/ad_twin.c
@@ -184,7 +184,7 @@ void uninit(sh_audio_t *sh)
FreeLibrary(vqf_dll);
}
-int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
+static int control(sh_audio_t *sh_audio,int cmd,void* arg, ...)
{
switch(cmd) {
case ADCTRL_QUERY_FORMAT:
diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c
index 81b76ee062..4032141c72 100644
--- a/libmpcodecs/ae_lavc.c
+++ b/libmpcodecs/ae_lavc.c
@@ -170,6 +170,8 @@ int mpae_init_lavc(audio_encoder_t *encoder)
return 0;
}
+ lavc_actx->codec_type = CODEC_TYPE_AUDIO;
+ lavc_actx->codec_id = lavc_acodec->id;
// put sample parameters
lavc_actx->channels = encoder->params.channels;
lavc_actx->sample_rate = encoder->params.sample_rate;
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 62a3fcbdda..1910af62ee 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -121,8 +121,9 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
if (!sh->disp_w || !sh->disp_h)
return 0;
- mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "VDec: vo config request - %d x %d (preferred colorspace: %s)\n", w, h,
- vo_format_name(preferred_outfmt));
+ mp_msg(MSGT_DECVIDEO, MSGL_V,
+ "VDec: vo config request - %d x %d (preferred colorspace: %s)\n",
+ w, h, vo_format_name(preferred_outfmt));
if (get_video_quality_max(sh) <= 0 && divx_quality) {
// user wants postprocess but no pp filter yet:
@@ -216,7 +217,7 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
return 0; // failed
}
out_fmt = sh->codec->outfmt[j];
- mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "VDec: using %s as output csp (no %d)\n",
+ mp_msg(MSGT_CPLAYER, MSGL_V, "VDec: using %s as output csp (no %d)\n",
vo_format_name(out_fmt), j);
sh->outfmtidx = j;
sh->vfilter = vf;
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index dfc7958a23..886a07f3cb 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -246,6 +246,8 @@ static int init(sh_video_t *sh){
ctx->avctx = avcodec_alloc_context();
avctx = ctx->avctx;
avctx->opaque = sh;
+ avctx->codec_type = CODEC_TYPE_VIDEO;
+ avctx->codec_id = lavc_codec->id;
#if CONFIG_VDPAU
if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index c9d60a202a..f798378dbe 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -331,7 +331,7 @@ static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int size, i;
- void *p;
+ char *p;
mux_v->bih->biWidth=width;
mux_v->bih->biHeight=height;
@@ -1047,6 +1047,8 @@ static int vf_open(vf_instance_t *vf, char* args){
vf->priv->pic = avcodec_alloc_frame();
vf->priv->context = avcodec_alloc_context();
+ vf->priv->context->codec_type = CODEC_TYPE_VIDEO;
+ vf->priv->context->codec_id = vf->priv->codec->id;
return 1;
}
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index 3a909cdfb7..6733b8c641 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -59,20 +59,6 @@ static int turbo = 0;
static x264_param_t param;
static int parse_error = 0;
-static int encode_nals(uint8_t *buf, int size, x264_nal_t *nals, int nnal){
- uint8_t *p = buf;
- int i;
-
- for(i = 0; i < nnal; i++){
- int s = x264_nal_encode(p, &size, 1, nals + i);
- if(s < 0)
- return -1;
- p += s;
- }
-
- return p - buf;
-}
-
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in);
@@ -189,21 +175,13 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in
}
if(!param.b_repeat_headers){
- uint8_t *extradata;
x264_nal_t *nal;
- int extradata_size, nnal, i, s = 0;
+ int extradata_size, nnal;
- x264_encoder_headers(mod->x264, &nal, &nnal);
-
- /* 5 bytes NAL header + worst case escaping */
- for(i = 0; i < nnal; i++)
- s += 5 + nal[i].i_payload * 4 / 3;
-
- extradata = malloc(s);
- extradata_size = encode_nals(extradata, s, nal, nnal);
+ extradata_size = x264_encoder_headers(mod->x264, &nal, &nnal);
mod->mux->bih= realloc(mod->mux->bih, sizeof(BITMAPINFOHEADER) + extradata_size);
- memcpy(mod->mux->bih + 1, extradata, extradata_size);
+ memcpy(mod->mux->bih + 1, nal->p_payload, extradata_size);
mod->mux->bih->biSize= sizeof(BITMAPINFOHEADER) + extradata_size;
}
@@ -218,12 +196,10 @@ static int config(struct vf_instance* vf, int width, int height, int d_width, in
static int control(struct vf_instance* vf, int request, void *data)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
- int count = 256; // giant HACK, x264_encoder_encode may incorrectly return 0
- // when threads > 1 and delayed frames pending
switch(request){
case VFCTRL_FLUSH_FRAMES:
- while(encode_frame(vf, NULL) == 0 && --count);
- while(encode_frame(vf, NULL) > 0);
+ while (x264_encoder_delayed_frames(mod->x264) > 0)
+ encode_frame(vf, NULL);
return CONTROL_TRUE;
default:
return CONTROL_UNKNOWN;
@@ -273,23 +249,20 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in)
x264_picture_t pic_out;
x264_nal_t *nal;
int i_nal;
- int i_size = 0;
- int i;
+ int i_size;
- if(x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out) < 0) {
+ i_size = x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out);
+
+ if(i_size<0) {
mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n");
return -1;
}
-
- for(i=0; i < i_nal; i++) {
- int i_data = mod->mux->buffer_size - i_size;
- i_size += x264_nal_encode(mod->mux->buffer + i_size, &i_data, 1, &nal[i]);
- }
if(i_size>0) {
int keyframe = (pic_out.i_type == X264_TYPE_IDR) ||
(pic_out.i_type == X264_TYPE_I
&& param.i_frame_reference == 1
&& !param.i_bframe);
+ memcpy(mod->mux->buffer, nal->p_payload, i_size);
muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
}
else