Open Broadcaster Software
Free, open source software for live streaming and recording
video-frame.h
Go to the documentation of this file.
1 /******************************************************************************
2  Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
17 
18 #pragma once
19 
20 #include "../util/bmem.h"
21 #include "video-io.h"
22 
23 struct video_frame {
26 };
27 
28 EXPORT void video_frame_init(struct video_frame *frame,
29  enum video_format format, uint32_t width, uint32_t height);
30 
31 static inline void video_frame_free(struct video_frame *frame)
32 {
33  if (frame) {
34  bfree(frame->data[0]);
35  memset(frame, 0, sizeof(struct video_frame));
36  }
37 }
38 
39 static inline struct video_frame *video_frame_create(
40  enum video_format format, uint32_t width, uint32_t height)
41 {
42  struct video_frame *frame;
43 
44  frame = (struct video_frame*)bzalloc(sizeof(struct video_frame));
45  video_frame_init(frame, format, width, height);
46  return frame;
47 }
48 
49 static inline void video_frame_destroy(struct video_frame *frame)
50 {
51  if (frame) {
52  bfree(frame->data[0]);
53  bfree(frame);
54  }
55 }
56 
57 EXPORT void video_frame_copy(struct video_frame *dst,
58  const struct video_frame *src, enum video_format format,
59  uint32_t height);
unsigned uint32_t
Definition: vc_stdint.h:31
video_format
Definition: video-io.h:33
unsigned char uint8_t
Definition: vc_stdint.h:27
#define EXPORT
Definition: c99defs.h:49
uint32_t linesize[MAX_AV_PLANES]
Definition: video-frame.h:25
Definition: video-frame.h:23
#define MAX_AV_PLANES
Definition: media-io-defs.h:20
EXPORT void video_frame_copy(struct video_frame *dst, const struct video_frame *src, enum video_format format, uint32_t height)
EXPORT void video_frame_init(struct video_frame *frame, enum video_format format, uint32_t width, uint32_t height)
EXPORT void bfree(void *ptr)
uint8_t * data[MAX_AV_PLANES]
Definition: video-frame.h:24