Commit f4800440 authored by Jan Gerber's avatar Jan Gerber
Browse files

update to current ffmpeg api, disable deinterlace(api gone, needs avfilter support)

parent f79141a9
......@@ -179,7 +179,7 @@ void json_codec_info(FILE *output, AVCodecContext *enc, int indent) {
case AVMEDIA_TYPE_VIDEO:
codec_name = fix_codec_name(codec_name);
json_add_key_value(output, "codec", (void *)codec_name, JSON_STRING, 0, indent);
if (enc->pix_fmt != PIX_FMT_NONE) {
if (enc->pix_fmt != AV_PIX_FMT_NONE) {
json_add_key_value(output, "pixel_format", (void *)av_get_pix_fmt_name(enc->pix_fmt), JSON_STRING, 0, indent);
}
if (enc->width) {
......
......@@ -149,7 +149,7 @@ static AVFrame *frame_alloc(int pix_fmt, int width, int height) {
uint8_t *picture_buf;
int size;
picture = avcodec_alloc_frame();
picture = av_frame_alloc();
if (!picture)
return NULL;
size = avpicture_get_size (pix_fmt, width, height);
......@@ -232,7 +232,7 @@ static ff2theora ff2theora_init() {
this->kate_streams=NULL;
this->ignore_non_utf8 = 0;
this->pix_fmt = PIX_FMT_YUV420P;
this->pix_fmt = AV_PIX_FMT_YUV420P;
// ffmpeg2theora --nosound -f dv -H 32000 -S 0 -v 8 -x 384 -y 288 -G 1.5 input.dv
this->video_gamma = 0.0;
......@@ -1374,6 +1374,10 @@ void ff2theora_output(ff2theora this) {
exit(1);
}
if (!(audio_frame = av_frame_alloc())) {
fprintf(stderr, "Failed to allocate memory\n");
exit(1);
}
av_init_packet(&avpkt);
/* main decoding loop */
......@@ -1467,14 +1471,18 @@ void ff2theora_output(ff2theora this) {
display_width, display_height);
output_tmp_p=NULL;
}
/*
if ((this->deinterlace==0 && frame->interlaced_frame) ||
this->deinterlace==1) {
if (avpicture_deinterlace((AVPicture *)output,(AVPicture *)output_tmp,this->pix_fmt,display_width,display_height)<0) {
fprintf(stderr, "Deinterlace failed.\n");
exit(1);
}
}
else{
else
*/
{
av_picture_copy((AVPicture *)output, (AVPicture *)output_tmp, this->pix_fmt,
display_width, display_height);
}
......@@ -1566,10 +1574,6 @@ void ff2theora_output(ff2theora this) {
int bytes_per_sample = av_get_bytes_per_sample(aenc->sample_fmt);
if (avpkt.size > 0) {
if (!audio_frame && !(audio_frame = avcodec_alloc_frame())) {
fprintf(stderr, "Failed to allocate memory\n");
exit(1);
}
len1 = avcodec_decode_audio4(astream->codec, audio_frame, &got_frame, &avpkt);
if (len1 < 0) {
/* if error, we skip the frame */
......@@ -1616,7 +1620,6 @@ void ff2theora_output(ff2theora this) {
}
}
oggmux_add_audio(&info, audio_p, dst_nb_samples, audio_eos);
avcodec_free_frame(&audio_frame);
this->sample_count += dst_nb_samples;
}
if(audio_eos) {
......@@ -1813,6 +1816,7 @@ void ff2theora_output(ff2theora this) {
write_seek_index (&info);
}
av_frame_free(&audio_frame);
oggmux_close(&info);
if (ppContext)
pp_free_context(ppContext);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment