Gazebo Common

API Reference

6.0.0
ffmpeg_inc.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_COMMON_FFMPEG_INC_HH_
18#define GZ_COMMON_FFMPEG_INC_HH_
19
21// v4.2.7 (Ubuntu Focal)
22// libavutil 56. 31.100 / 56. 31.100
23// libavcodec 58. 54.100 / 58. 54.100
24// libavformat 58. 29.100 / 58. 29.100
25// libavdevice 58. 8.100 / 58. 8.100
26// libavfilter 7. 57.100 / 7. 57.100
27// libavresample 4. 0. 0 / 4. 0. 0
28// libswscale 5. 5.100 / 5. 5.100
29// libswresample 3. 5.100 / 3. 5.100
30// libpostproc 55. 5.100 / 55. 5.100
31
32// v4.4.1 (Windows CI vcpkg)
33// libavutil 56. 70.100 / 56. 70.100
34// libavcodec 58.134.100 / 58.134.100
35// libavformat 58. 76.100 / 58. 76.100
36// libavdevice 58. 13.100 / 58. 13.100
37// libavfilter 7.110.100 / 7.110.100
38// libswscale 5. 9.100 / 5. 9.100
39// libswresample 3. 9.100 / 3. 9.100
40// libpostproc 55. 9.100 / 55. 9.100
41
42// v4.4.2 (Ubuntu Jammy)
43// libavutil 56. 70.100 / 56. 70.100
44// libavcodec 58.134.100 / 58.134.100
45// libavformat 58. 76.100 / 58. 76.100
46// libavdevice 58. 13.100 / 58. 13.100
47// libavfilter 7.110.100 / 7.110.100
48// libswscale 5. 9.100 / 5. 9.100
49// libswresample 3. 9.100 / 3. 9.100
50// libpostproc 55. 9.100 / 55. 9.100
51
52// v5.1 (homebrew)
53// libavutil 57. 28.100 / 57. 28.100
54// libavcodec 59. 37.100 / 59. 37.100
55// libavformat 59. 27.100 / 59. 27.100
56// libavdevice 59. 7.100 / 59. 7.100
57// libavfilter 8. 44.100 / 8. 44.100
58// libswscale 6. 7.100 / 6. 7.100
59// libswresample 4. 7.100 / 4. 7.100
60// libpostproc 56. 6.100 / 56. 6.100
61
63// v5.0.1 (conda-forge)
64// libavutil 57. 17.100 / 57. 17.100
65// libavcodec 59. 18.100 / 59. 18.100
66// libavformat 59. 16.100 / 59. 16.100
67// libavdevice 59. 4.100 / 59. 4.100
68// libavfilter 8. 24.100 / 8. 24.100
69// libswscale 6. 4.100 / 6. 4.100
70// libswresample 4. 3.100 / 4. 3.100
71// libpostproc 56. 3.100 / 56. 3.100
72
73
74#include <string>
75
76#include <gz/common/config.hh>
77
78#ifndef _WIN32
79#pragma GCC system_header
80#endif
81
82#ifndef INT64_C
83#define INT64_C(c) (c ## LL)
84#define UINT64_C(c) (c ## ULL)
85#endif
86
87#ifndef AV_ERROR_MAX_STRING_SIZE
88#define AV_ERROR_MAX_STRING_SIZE 64
89#endif
90
91extern "C" {
92#include <libavcodec/avcodec.h>
93#include <libavformat/avformat.h>
94#include <libswscale/swscale.h>
95#include <libavutil/mathematics.h>
96#include <libavutil/opt.h>
97#include <libavutil/error.h>
98#include <libavutil/imgutils.h>
99#include <libavutil/hwcontext.h>
100
101#if defined(HAVE_AVDEVICE)
102#include <libavdevice/avdevice.h>
103#endif
104}
105
106#include <gz/common/av/Export.hh>
107
108namespace gz
109{
110 namespace common
111 {
112 // av_err2str only works in C99, this is a version that works in C++;
113 // https://github.com/joncampbell123/composite-video-simulator/issues/5#issuecomment-611885908
114 inline std::string av_err2str_cpp(int errnum)
115 {
116 thread_local char buf[AV_ERROR_MAX_STRING_SIZE];
117 memset(buf, 0, sizeof(buf));
118 // lavu 51.58.100
119 return av_make_error_string(buf, AV_ERROR_MAX_STRING_SIZE, errnum);
120 }
121 }
122}
123
124#endif