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 +#if (AVERROR_INVALIDDATA) != (AVERROR(EINVAL))
39 case AVERROR_INVALIDDATA:
40 return "Invalid data in header";
43 + case AVERROR(EILSEQ):
44 return "Unknown format";
47 return "I/O error occurred";
49 + case AVERROR(ENOMEM):
50 return "Memory allocation error";
56 #if LIBAVFORMAT_BUILD > 4621
57 - c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
58 + c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
60 c->codec_id = oc->oformat->video_codec;
63 //if(codec_tag) c->codec_tag=codec_tag;
64 codec = avcodec_find_encoder(c->codec_id);
66 - c->codec_type = CODEC_TYPE_VIDEO;
67 + c->codec_type = AVMEDIA_TYPE_VIDEO;
69 /* put sample parameters */
70 c->bit_rate = bitrate;
75 - pkt.flags |= PKT_FLAG_KEY;
76 + pkt.flags |= AV_PKT_FLAG_KEY;
77 pkt.stream_index= video_st->index;
78 pkt.data= (uint8_t *)picture;
79 pkt.size= sizeof(AVPicture);
81 pkt.pts = c->coded_frame->pts;
83 if(c->coded_frame->key_frame)
84 - pkt.flags |= PKT_FLAG_KEY;
85 + pkt.flags |= AV_PKT_FLAG_KEY;
86 pkt.stream_index= video_st->index;
92 /* auto detect the output format from the name and fourcc code. */
93 - fmt = guess_format(NULL, filename, NULL);
94 + fmt = av_guess_format(NULL, filename, NULL);
101 // alloc memory for context
102 - oc = av_alloc_format_context();
103 + oc = avformat_alloc_context();