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
|
https://github.com/opencv/opencv/commit/99091a62463e
--- modules/highgui/src/cap_ffmpeg_impl.hpp.orig 2016-09-16 15:55:58 UTC
+++ modules/highgui/src/cap_ffmpeg_impl.hpp
@@ -170,6 +170,10 @@ extern "C" {
#define AV_PIX_FMT_GRAY16BE PIX_FMT_GRAY16BE
#endif
+#ifndef PKT_FLAG_KEY
+#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
+#endif
+
#if LIBAVUTIL_BUILD >= (LIBAVUTIL_VERSION_MICRO >= 100 \
? CALC_FFMPEG_VERSION(52, 38, 100) : CALC_FFMPEG_VERSION(52, 13, 0))
#define USE_AV_FRAME_GET_BUFFER 1
@@ -1478,7 +1482,11 @@ static AVStream *icv_add_video_stream_FFMPEG(AVFormatC
// some formats want stream headers to be seperate
if(oc->oformat->flags & AVFMT_GLOBALHEADER)
{
+#if LIBAVCODEC_BUILD > CALC_FFMPEG_VERSION(56, 35, 0)
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+#else
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+#endif
}
#endif
@@ -1502,23 +1510,24 @@ static int icv_av_write_frame_FFMPEG( AVFormatContext
#endif
int ret = OPENCV_NO_FRAMES_WRITTEN_CODE;
- if (oc->oformat->flags & AVFMT_RAWPICTURE) {
+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
+ if (oc->oformat->flags & AVFMT_RAWPICTURE)
+ {
/* raw video case. The API will change slightly in the near
futur for that */
AVPacket pkt;
av_init_packet(&pkt);
-#ifndef PKT_FLAG_KEY
-#define PKT_FLAG_KEY AV_PKT_FLAG_KEY
-#endif
-
pkt.flags |= PKT_FLAG_KEY;
pkt.stream_index= video_st->index;
pkt.data= (uint8_t *)picture;
pkt.size= sizeof(AVPicture);
ret = av_write_frame(oc, &pkt);
- } else {
+ }
+ else
+#endif
+ {
/* encode the image */
AVPacket pkt;
av_init_packet(&pkt);
@@ -1676,7 +1685,9 @@ void CvVideoWriter_FFMPEG::close()
/* write the trailer, if any */
if(ok && oc)
{
- if( (oc->oformat->flags & AVFMT_RAWPICTURE) == 0 )
+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
+ if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
+#endif
{
for(;;)
{
@@ -1910,7 +1921,10 @@ bool CvVideoWriter_FFMPEG::open( const char * filename
outbuf = NULL;
- if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
+#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(57, 0, 0)
+ if (!(oc->oformat->flags & AVFMT_RAWPICTURE))
+#endif
+ {
/* allocate output buffer */
/* assume we will never get codec output with more than 4 bytes per pixel... */
outbuf_size = width*height*4;
@@ -2204,7 +2218,11 @@ AVStream* OutputMediaStream_FFMPEG::addVideoStream(AVF
// some formats want stream headers to be seperate
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
{
- c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ #if LIBAVCODEC_BUILD > CALC_FFMPEG_VERSION(56, 35, 0)
+ c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
+ #else
+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ #endif
}
#endif
|