fix build with latest ffmpeg, bug #376447
authorAlexis Ballier <aballier@gentoo.org>
Sat, 17 Dec 2011 14:09:05 +0000 (14:09 +0000)
committerAlexis Ballier <aballier@gentoo.org>
Sat, 17 Dec 2011 14:09:05 +0000 (14:09 +0000)
Package-Manager: portage-2.2.0_alpha81/cvs/Linux x86_64
RepoMan-Options: --force

media-video/vdr2jpeg/ChangeLog
media-video/vdr2jpeg/files/vdr2jpeg-0.1.9-ffmpeg.patch [new file with mode: 0644]
media-video/vdr2jpeg/vdr2jpeg-0.1.9.ebuild

index 03cb7cd8fb0f5fc31f2a5a4d4cca20fecceb3f0b..208f8c8ccaf761afc28593e2f5402c5ce44c7b9a 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for media-video/vdr2jpeg
 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/vdr2jpeg/ChangeLog,v 1.23 2011/10/30 19:41:35 hd_brummy Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/vdr2jpeg/ChangeLog,v 1.24 2011/12/17 14:09:05 aballier Exp $
+
+  17 Dec 2011; Alexis Ballier <aballier@gentoo.org> vdr2jpeg-0.1.9.ebuild,
+  +files/vdr2jpeg-0.1.9-ffmpeg.patch:
+  fix build with latest ffmpeg, bug #376447
 
   30 Oct 2011; Joerg Bornkessel <hd_brummy@gentoo.org> vdr2jpeg-0.1.9.ebuild:
   changed to gentoo mirror for dead berlios mirror; no new project page yet
diff --git a/media-video/vdr2jpeg/files/vdr2jpeg-0.1.9-ffmpeg.patch b/media-video/vdr2jpeg/files/vdr2jpeg-0.1.9-ffmpeg.patch
new file mode 100644 (file)
index 0000000..c004e4b
--- /dev/null
@@ -0,0 +1,319 @@
+Index: vdr2jpeg-0.1.9/ffm.cpp
+===================================================================
+--- vdr2jpeg-0.1.9.orig/ffm.cpp
++++ vdr2jpeg-0.1.9/ffm.cpp
+@@ -185,7 +185,7 @@ static bool do_video_out(AVFormatContext
+     }else
+         ost->sync_opts= lrintf(get_sync_ipts(ost) / av_q2d(enc->time_base));
+-    nb_frames= FFMIN(nb_frames, max_frames[CODEC_TYPE_VIDEO] - ost->frame_number);
++    nb_frames= FFMIN(nb_frames, max_frames[AVMEDIA_TYPE_VIDEO] - ost->frame_number);
+     if (nb_frames <= 0)
+         return true;
+@@ -221,7 +221,7 @@ static bool do_video_out(AVFormatContext
+             if(dec->coded_frame && enc->coded_frame->pts != AV_NOPTS_VALUE)
+                 pkt.pts= av_rescale_q(enc->coded_frame->pts, enc->time_base, ost->st->time_base);
+             if(dec->coded_frame && dec->coded_frame->key_frame)
+-                pkt.flags |= PKT_FLAG_KEY;
++                pkt.flags |= AV_PKT_FLAG_KEY;
+             av_interleaved_write_frame(s, &pkt);
+             enc->coded_frame = old_frame;
+@@ -245,7 +245,7 @@ static bool do_video_out(AVFormatContext
+                 big_picture.quality = (int)ist->st->quality;
+             }else
+                 big_picture.quality = (int)ost->st->quality;
+-                big_picture.pict_type = 0;
++                big_picture.pict_type = AV_PICTURE_TYPE_NONE;
+ //            big_picture.pts = AV_NOPTS_VALUE;
+             big_picture.pts= ost->sync_opts;
+ //            big_picture.pts= av_rescale(ost->sync_opts, AV_TIME_BASE*(int64_t)enc->time_base.num, enc->time_base.den);
+@@ -268,7 +268,7 @@ static bool do_video_out(AVFormatContext
+    pkt.dts != AV_NOPTS_VALUE ? av_rescale(pkt.dts, enc->time_base.den, AV_TIME_BASE*(int64_t)enc->time_base.num) : -1);*/
+                 if(enc->coded_frame && enc->coded_frame->key_frame)
+-                    pkt.flags |= PKT_FLAG_KEY;
++                    pkt.flags |= AV_PKT_FLAG_KEY;
+                 av_interleaved_write_frame(s, &pkt);
+                 *frame_size = ret;
+             }
+@@ -316,13 +316,17 @@ static int output_packet(AVInputStream *
+         data_size = 0;
+         if (ist->decoding_needed) {
+             switch(ist->st->codec->codec_type) {
+-            case CODEC_TYPE_VIDEO:
++            case AVMEDIA_TYPE_VIDEO:
+                     data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
+                     /* XXX: allocate picture correctly */
+                     avcodec_get_frame_defaults(&picture);
++                  AVPacket pkt;
++                  av_init_packet( &pkt );
++                  pkt.data = ptr;
++                  pkt.size = len;
+-                    ret = avcodec_decode_video(ist->st->codec,
+-                                               &picture, &got_picture, ptr, len);
++                    ret = avcodec_decode_video2(ist->st->codec,
++                                               &picture, &got_picture, &pkt);
+                     ist->st->quality= picture.quality;
+                     if (ret < 0)
+                         goto fail_decode;
+@@ -341,7 +345,7 @@ static int output_packet(AVInputStream *
+                 goto fail_decode;
+             }
+         } else {
+-            if(ist->st->codec->codec_type == CODEC_TYPE_VIDEO) {
++            if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+                 if (ist->st->codec->time_base.num != 0) {
+                     ist->next_pts += ((int64_t)AV_TIME_BASE *
+                                       ist->st->codec->time_base.num) /
+@@ -354,16 +358,6 @@ static int output_packet(AVInputStream *
+             len = 0;
+         }
+-        /* frame rate emulation */
+-        if (ist->st->codec->rate_emu) {
+-            int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec->time_base.num, 1000000, ist->st->codec->time_base.den);
+-            int64_t now = av_gettime() - ist->start;
+-            if (pts > now)
+-                usleep(pts - now);
+-
+-            ist->frame++;
+-        }
+-
+ #if 0
+         /* mpeg PTS deordering : if it is a P or I frame, the PTS
+            is the one of the next displayed one */
+@@ -398,7 +392,7 @@ static int output_packet(AVInputStream *
+                     if (ost->encoding_needed) {
+                         switch(ost->st->codec->codec_type) {
+-                        case CODEC_TYPE_VIDEO:
++                        case AVMEDIA_TYPE_VIDEO:
+                             if(!do_video_out(os, ost, ist, &picture, &frame_size))
+                                return -1;
+                             break;
+@@ -415,9 +409,9 @@ static int output_packet(AVInputStream *
+                         avcodec_get_frame_defaults(&avframe);
+                         ost->st->codec->coded_frame= &avframe;
+-                        avframe.key_frame = pkt->flags & PKT_FLAG_KEY;
++                        avframe.key_frame = pkt->flags & AV_PKT_FLAG_KEY;
+-                        if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO) {
++                        if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
+                             ost->sync_opts++;
+                         }
+@@ -438,7 +432,7 @@ static int output_packet(AVInputStream *
+                         opkt.flags= pkt->flags;
+                         //FIXME remove the following 2 lines they shall be replaced by the bitstream filters
+-                        if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & PKT_FLAG_KEY))
++                        if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY))
+                             opkt.destruct= av_destruct_packet;
+                         av_interleaved_write_frame(os, &opkt);
+@@ -459,7 +453,7 @@ static int output_packet(AVInputStream *
+                 AVCodecContext *enc= ost->st->codec;
+                 os = output_files[ost->file_index];
+-                if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
++                if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
+                     continue;
+                 if (ost->encoding_needed) {
+@@ -469,10 +463,10 @@ static int output_packet(AVInputStream *
+                         pkt.stream_index= ost->index;
+                         switch(ost->st->codec->codec_type) {
+-                        case CODEC_TYPE_VIDEO:
++                        case AVMEDIA_TYPE_VIDEO:
+                             ret = avcodec_encode_video(enc, bit_buffer, bit_buffer_size, NULL);
+                             if(enc->coded_frame && enc->coded_frame->key_frame)
+-                                pkt.flags |= PKT_FLAG_KEY;
++                                pkt.flags |= AV_PKT_FLAG_KEY;
+                             break;
+                         default:
+                             ret=-1;
+@@ -547,11 +541,6 @@ static bool av_encode(AVFormatContext **
+             ist->index = k;
+             ist->discard = 1; /* the stream is discarded by default
+                                  (changed later) */
+-
+-            if (ist->st->codec->rate_emu) {
+-                ist->start = av_gettime();
+-                ist->frame = 0;
+-            }
+         }
+     }
+@@ -641,20 +630,20 @@ static bool av_encode(AVFormatContext **
+             else
+                 codec->time_base = ist->st->time_base;
+             switch(codec->codec_type) {
+-            case CODEC_TYPE_VIDEO:
++            case AVMEDIA_TYPE_VIDEO:
+                 codec->pix_fmt = icodec->pix_fmt;
+                 codec->width = icodec->width;
+                 codec->height = icodec->height;
+                 codec->has_b_frames = icodec->has_b_frames;
+                 break;
+-            case CODEC_TYPE_SUBTITLE:
++            case AVMEDIA_TYPE_SUBTITLE:
+                 break;
+             default:
+                 return false;
+             }
+         } else {
+             switch(codec->codec_type) {
+-            case CODEC_TYPE_VIDEO:
++            case AVMEDIA_TYPE_VIDEO:
+                 ost->video_resample = ((codec->width != icodec->width) ||
+                         (codec->height != icodec->height) ||
+                         (codec->pix_fmt != icodec->pix_fmt));
+@@ -686,7 +675,7 @@ static bool av_encode(AVFormatContext **
+                 return false;
+             }
+         }
+-        if(codec->codec_type == CODEC_TYPE_VIDEO){
++        if(codec->codec_type == AVMEDIA_TYPE_VIDEO){
+             int size= codec->width * codec->height;
+             bit_buffer_size= FFMAX(bit_buffer_size, 4*size);
+         }
+@@ -738,7 +727,7 @@ static bool av_encode(AVFormatContext **
+                         ist->file_index, ist->index);
+                 return false;
+             }
+-            //if (ist->st->codec->codec_type == CODEC_TYPE_VIDEO)
++            //if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+             //    ist->st->codec->flags |= CODEC_FLAG_REPEAT_FIELD;
+         }
+     }
+@@ -786,7 +775,7 @@ static bool av_encode(AVFormatContext **
+             ost = ost_table[i];
+             os = output_files[ost->file_index];
+             ist = ist_table[ost->source_index];
+-            if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
++            if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+                 opts = ost->sync_opts * av_q2d(ost->st->codec->time_base);
+             else
+                 opts = ost->st->pts.val * av_q2d(ost->st->time_base);
+@@ -924,22 +913,22 @@ static bool av_encode(AVFormatContext **
+ void print_error(const char *filename, int err)
+ {
+     switch(err) {
+-    case AVERROR_NUMEXPECTED:
++    case AVERROR(EINVAL):
+         fprintf(stderr, "%s: Incorrect image filename syntax.\n", 
+                 filename);
+         break;
+     case AVERROR_INVALIDDATA:
+         fprintf(stderr, "%s: Error while parsing header\n", filename);
+         break;
+-    case AVERROR_NOFMT:
++    case AVERROR(EILSEQ):
+         fprintf(stderr, "%s: Unknown format\n", filename);
+         break;
+-    case AVERROR_IO:
++    case AVERROR(EIO):
+         fprintf(stderr, "%s: I/O error occured\n"
+               "Usually that means that input file is truncated and/or corrupted.\n",
+               filename);
+         break;
+-    case AVERROR_NOMEM:
++    case AVERROR(ENOMEM):
+         fprintf(stderr, "%s: memory allocation error occured\n", filename);
+         break;
+     default:
+@@ -968,9 +957,9 @@ static bool opt_input_file(const char *f
+     ap->pix_fmt = frame_pix_fmt;
+     ap->channel = 0;
+     ap->standard = 0;
+-    ap->video_codec_id = CODEC_ID_NONE;
++    ic->video_codec_id = CODEC_ID_NONE;
+     if(pgmyuv_compatibility_hack)
+-        ap->video_codec_id= CODEC_ID_PGMYUV;
++        ic->video_codec_id= CODEC_ID_PGMYUV;
+     /* open the input file with generic libav function */
+     err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
+@@ -999,7 +988,7 @@ static bool opt_input_file(const char *f
+         AVCodecContext *enc = ic->streams[i]->codec;
+         enc->thread_count= 1;
+         switch(enc->codec_type) {
+-        case CODEC_TYPE_VIDEO:
++        case AVMEDIA_TYPE_VIDEO:
+             frame_height = enc->height;
+             frame_width = enc->width;
+             frame_aspect_ratio = av_q2d(enc->sample_aspect_ratio) * enc->width / enc->height;
+@@ -1020,13 +1009,12 @@ static bool opt_input_file(const char *f
+             frame_rate      = rfps;
+             frame_rate_base = rfps_base;
+-            enc->rate_emu = 0;
+             break;
+-        case CODEC_TYPE_DATA:
++        case AVMEDIA_TYPE_DATA:
+             break;
+-        case CODEC_TYPE_SUBTITLE:
++        case AVMEDIA_TYPE_SUBTITLE:
+             break;
+-        case CODEC_TYPE_UNKNOWN:
++        case AVMEDIA_TYPE_UNKNOWN:
+             break;
+         default:
+             //av_abort();
+@@ -1058,12 +1046,12 @@ static void check_video_inputs(int *has_
+         for(i=0;i<ic->nb_streams;i++) {
+             AVCodecContext *enc = ic->streams[i]->codec;
+             switch(enc->codec_type) {
+-            case CODEC_TYPE_VIDEO:
++            case AVMEDIA_TYPE_VIDEO:
+                 has_video = 1;
+                 break;
+-            case CODEC_TYPE_DATA:
+-            case CODEC_TYPE_UNKNOWN:
+-            case CODEC_TYPE_SUBTITLE:
++            case AVMEDIA_TYPE_DATA:
++            case AVMEDIA_TYPE_UNKNOWN:
++            case AVMEDIA_TYPE_SUBTITLE:
+                 break;
+             default:
+                 //av_abort();
+@@ -1086,14 +1074,14 @@ static bool new_video_stream(AVFormatCon
+         fprintf(stderr, "Could not alloc stream\n");
+         return false;
+     }
+-    avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO);
++    avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
+     video_enc = st->codec;
+     {
+         AVCodec *codec;
+-        codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
++        codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
+         video_enc->codec_id = codec_id;
+         codec = avcodec_find_encoder(codec_id);
+@@ -1203,7 +1191,7 @@ static bool opt_output_file(const char *
+     oc = avformat_alloc_context();
+     if (!file_oformat) {
+-        file_oformat = guess_format(NULL, filename, NULL);
++        file_oformat = av_guess_format(NULL, filename, NULL);
+         if (!file_oformat) {
+             fprintf(stderr, "Unable for find a suitable output format for '%s'\n",
+                     filename);
+@@ -1239,7 +1227,7 @@ static bool opt_output_file(const char *
+     /* check filename in case of an image number is expected */
+     if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
+         if (!av_filename_number_test(oc->filename)) {
+-            print_error(oc->filename, AVERROR_NUMEXPECTED);
++            print_error(oc->filename, AVERROR(EINVAL));
+             return false;
+         }
+     }
index 7f4db9671419f0817e76bf65cb1031c41d444d53..17aa39eed829091a2816d838c83cea215585282f 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/vdr2jpeg/vdr2jpeg-0.1.9.ebuild,v 1.3 2011/10/30 19:41:35 hd_brummy Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/vdr2jpeg/vdr2jpeg-0.1.9.ebuild,v 1.4 2011/12/17 14:09:05 aballier Exp $
 
 EAPI=4
 
@@ -26,6 +26,7 @@ src_prepare() {
                -e "s:usr/local:usr:" \
                -e "s:-o vdr2jpeg:\$(LDFLAGS) -o vdr2jpeg:" \
                Makefile || die
+       epatch "${FILESDIR}/${P}-ffmpeg.patch"
 }
 
 src_install() {