summaryrefslogtreecommitdiff
blob: bfde3a92c78fff69424aa9b224c872c7ffd1a5a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Index: D:/WaterWATCH/dev/opencv/modules/highgui/src/cap_ffmpeg.cpp
===================================================================
--- D:/WaterWATCH/dev/opencv/modules/highgui/src/cap_ffmpeg.cpp	(revision 2112)
+++ D:/WaterWATCH/dev/opencv/modules/highgui/src/cap_ffmpeg.cpp	(revision 2113)
@@ -466,7 +466,7 @@
         AVCodecContext *enc = &ic->streams[i]->codec;
 #endif
 
-        if( CODEC_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
+        if( AVMEDIA_TYPE_VIDEO == enc->codec_type && video_stream < 0) {
             AVCodec *codec = avcodec_find_decoder(enc->codec_id);
             if (!codec ||
             avcodec_open(enc, codec) < 0)
@@ -550,15 +550,27 @@
 		        continue;
     		}
 
-#if LIBAVFORMAT_BUILD > 4628
-        avcodec_decode_video(video_st->codec,
-                             picture, &got_picture,
-                             packet.data, packet.size);
-#else
-        avcodec_decode_video(&video_st->codec,
-                             picture, &got_picture,
-                             packet.data, packet.size);
-#endif
+
+		AVPacket avpkt;
+		av_init_packet(&avpkt);
+		avpkt.data = packet.data;
+		avpkt.size = packet.size;
+		//
+		// HACK for CorePNG to decode as normal PNG by default
+		// same method used by ffmpeg
+		avpkt.flags = AV_PKT_FLAG_KEY;
+		avcodec_decode_video2(video_st->codec,
+                              picture, &got_picture, &avpkt);
+//Functions Removed from ffmpeg on 4/19/11
+//#if LIBAVFORMAT_BUILD > 4628
+//        avcodec_decode_video(video_st->codec,
+//                             picture, &got_picture,
+//                             packet.data, packet.size);
+//#else
+//        avcodec_decode_video(&video_st->codec,
+//                             picture, &got_picture,
+//                             packet.data, packet.size);
+//#endif
 
         if (got_picture) {
             // we have a new picture, so memorize it
@@ -899,7 +911,7 @@
 #endif
 
 #if LIBAVFORMAT_BUILD > 4621
-	c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO);
+	c->codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
 #else
 	c->codec_id = oc->oformat->video_codec;
 #endif
@@ -911,7 +923,7 @@
     //if(codec_tag) c->codec_tag=codec_tag;
 	codec = avcodec_find_encoder(c->codec_id);
 
-	c->codec_type = CODEC_TYPE_VIDEO;
+	c->codec_type = AVMEDIA_TYPE_VIDEO;
 
 	/* put sample parameters */
 	c->bit_rate = bitrate;
@@ -998,7 +1010,7 @@
         AVPacket pkt;
         av_init_packet(&pkt);
 
-        pkt.flags |= PKT_FLAG_KEY;
+        pkt.flags |= AV_PKT_FLAG_KEY;
         pkt.stream_index= video_st->index;
         pkt.data= (uint8_t *)picture;
         pkt.size= sizeof(AVPicture);
@@ -1018,7 +1030,7 @@
 			pkt.pts = c->coded_frame->pts;
 #endif
             if(c->coded_frame->key_frame)
-                pkt.flags |= PKT_FLAG_KEY;
+                pkt.flags |= AV_PKT_FLAG_KEY;
             pkt.stream_index= video_st->index;
             pkt.data= outbuf;
             pkt.size= out_size;
@@ -1215,7 +1227,7 @@
 	av_register_all ();
 
 	/* auto detect the output format from the name and fourcc code. */
-	fmt = guess_format(NULL, filename, NULL);
+	fmt = av_guess_format(NULL, filename, NULL);
 	if (!fmt)
         return false;
 
@@ -1238,7 +1250,7 @@
 #endif
 
     // alloc memory for context
-	oc = av_alloc_format_context();
+	oc = avformat_alloc_context();
 	assert (oc);
 
 	/* set file name */