Video.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 _GAZEBO_COMMON_VIDEO_HH_
18 #define _GAZEBO_COMMON_VIDEO_HH_
19 
20 #include <string>
21 #include "gazebo/util/system.hh"
22 
23 struct AVFormatContext;
24 struct AVCodecContext;
25 struct AVFrame;
26 struct AVPicture;
27 struct SwsContext;
28 
29 namespace gazebo
30 {
31  namespace common
32  {
35 
38  class GZ_COMMON_VISIBLE Video
39  {
41  public: Video();
42 
44  public: virtual ~Video();
45 
50  public: bool Load(const std::string &_filename);
51 
54  public: int GetWidth() const;
55 
58  public: int GetHeight() const;
59 
63  public: bool GetNextFrame(unsigned char **_buffer);
64 
66  private: void Cleanup();
67 
69  private: AVFormatContext *formatCtx;
70 
72  private: AVCodecContext *codecCtx;
73 
75  private: AVFrame *avFrame;
76 
78  private: AVFrame *avFrameDst;
79 
81  private: SwsContext *swsCtx;
82 
84  private: int videoStream;
85  };
87  }
88 }
89 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
int GetWidth() const
Get the width of the video in pixels.
Video()
Constructor.
int GetHeight() const
Get the height of the video in pixels.
Handle video encoding and decoding using libavcodec.
Definition: Video.hh:38
virtual ~Video()
Destructor.
bool GetNextFrame(unsigned char **_buffer)
Get the next frame of the video.
bool Load(const std::string &_filename)
Load a video file.