1 --- OpenCV-2.2.0/modules/highgui/src/cap_ffmpeg.cpp.orig 2010-12-05 04:35:25.000000000 +0100
2 +++ OpenCV-2.2.0/modules/highgui/src/cap_ffmpeg.cpp 2011-06-29 16:24:22.527412497 +0200
4 AVCodecContext *enc = &ic->streams[i]->codec;
7 - if( CODEC_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
8 + if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
9 AVCodec *codec = avcodec_find_decoder(enc->codec_id);
11 avcodec_open(enc, codec) < 0)
15 #if LIBAVFORMAT_BUILD > 4628
16 - avcodec_decode_video(video_st->codec,
19 + av_init_packet(&avpkt);
20 + avpkt.data = packet.data;
21 + avpkt.size = packet.size;
22 + avpkt.flags = AV_PKT_FLAG_KEY;
23 + avcodec_decode_video2(video_st->codec,
24 picture, &got_picture,
25 - packet.data, packet.size);
29 avcodec_decode_video(&video_st->codec,
30 picture, &got_picture,
32 static const char * icvFFMPEGErrStr(int err)
35 - case AVERROR_NUMEXPECTED:
36 + case AVERROR(EINVAL):
37 return "Incorrect filename syntax";
38 case AVERROR_INVALIDDATA:
39 return "Invalid data in header";
41 + case AVERROR(EILSEQ):
42 return "Unknown format";
45 return "I/O error occurred";
47 + case AVERROR(ENOMEM):
48 return "Memory allocation error";
54 #if LIBAVFORMAT_BUILD > 4621
55 - c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
56 + c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
58 c->codec_id = oc->oformat->video_codec;
61 //if(codec_tag) c->codec_tag=codec_tag;
62 codec = avcodec_find_encoder(c->codec_id);
64 - c->codec_type = CODEC_TYPE_VIDEO;
65 + c->codec_type = AVMEDIA_TYPE_VIDEO;
67 /* put sample parameters */
68 c->bit_rate = bitrate;
73 - pkt.flags |= PKT_FLAG_KEY;
74 + pkt.flags |= AV_PKT_FLAG_KEY;
75 pkt.stream_index= video_st->index;
76 pkt.data= (uint8_t *)picture;
77 pkt.size= sizeof(AVPicture);
79 pkt.pts = c->coded_frame->pts;
81 if(c->coded_frame->key_frame)
82 - pkt.flags |= PKT_FLAG_KEY;
83 + pkt.flags |= AV_PKT_FLAG_KEY;
84 pkt.stream_index= video_st->index;
90 /* auto detect the output format from the name and fourcc code. */
91 - fmt = guess_format(NULL, filename, NULL);
92 + fmt = av_guess_format(NULL, filename, NULL);
99 // alloc memory for context
100 - oc = av_alloc_format_context();
101 + oc = avformat_alloc_context();