Blender V4.3
writemovie.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include <cstring>
11
12#include "MEM_guardedalloc.h"
13
14#include "DNA_scene_types.h"
15
16#include "BLI_utildefines.h"
17
18#include "BKE_report.hh"
19
20#ifdef WITH_FFMPEG
21# include "BKE_writeffmpeg.hh"
22#endif
23
24#include "BKE_writemovie.hh"
25
26static bool start_stub(void * /*context_v*/,
27 const Scene * /*scene*/,
28 RenderData * /*rd*/,
29 int /*rectx*/,
30 int /*recty*/,
31 ReportList * /*reports*/,
32 bool /*preview*/,
33 const char * /*suffix*/)
34{
35 return false;
36}
37
38static void end_stub(void * /*context_v*/) {}
39
40static bool append_stub(void * /*context_v*/,
41 RenderData * /*rd*/,
42 int /*start_frame*/,
43 int /*frame*/,
44 const ImBuf * /*image*/,
45 const char * /*suffix*/,
46 ReportList * /*reports*/)
47{
48 return false;
49}
50
51static void *context_create_stub()
52{
53 return nullptr;
54}
55
56static void context_free_stub(void * /*context_v*/) {}
57
59{
60 static bMovieHandle mh = {nullptr};
61 /* Stub callbacks in case ffmpeg is not compiled in. */
65 mh.get_movie_path = nullptr;
68
69#ifdef WITH_FFMPEG
70 if (ELEM(imtype,
78 {
79 mh.start_movie = BKE_ffmpeg_start;
80 mh.append_movie = BKE_ffmpeg_append;
81 mh.end_movie = BKE_ffmpeg_end;
82 mh.get_movie_path = BKE_ffmpeg_filepath_get;
83 mh.context_create = BKE_ffmpeg_context_create;
84 mh.context_free = BKE_ffmpeg_context_free;
85 }
86#else
87 (void)imtype;
88#endif
89
90 return (mh.append_movie != append_stub) ? &mh : nullptr;
91}
92
93void BKE_movie_filepath_get(char filepath[/*FILE_MAX*/ 1024],
94 const RenderData *rd,
95 bool preview,
96 const char *suffix)
97{
99 if (mh && mh->get_movie_path) {
100 mh->get_movie_path(filepath, rd, preview, suffix);
101 }
102 else {
103 filepath[0] = '\0';
104 }
105}
#define ELEM(...)
@ R_IMF_IMTYPE_FFMPEG
@ R_IMF_IMTYPE_AVIJPEG
@ R_IMF_IMTYPE_H264
@ R_IMF_IMTYPE_AVIRAW
@ R_IMF_IMTYPE_THEORA
@ R_IMF_IMTYPE_AV1
@ R_IMF_IMTYPE_XVID
Read Guarded memory(de)allocation.
struct ImageFormatData im_format
bool(* append_movie)(void *context_v, RenderData *rd, int start_frame, int frame, const ImBuf *image, const char *suffix, ReportList *reports)
void(* end_movie)(void *context_v)
void(* get_movie_path)(char filepath[1024], const RenderData *rd, bool preview, const char *suffix)
bool(* start_movie)(void *context_v, const Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports, bool preview, const char *suffix)
void(* context_free)(void *context_v)
void *(* context_create)()
static void context_free_stub(void *)
Definition writemovie.cc:56
void BKE_movie_filepath_get(char filepath[1024], const RenderData *rd, bool preview, const char *suffix)
Definition writemovie.cc:93
static bool append_stub(void *, RenderData *, int, int, const ImBuf *, const char *, ReportList *)
Definition writemovie.cc:40
static void * context_create_stub()
Definition writemovie.cc:51
static void end_stub(void *)
Definition writemovie.cc:38
bMovieHandle * BKE_movie_handle_get(const char imtype)
Definition writemovie.cc:58
static bool start_stub(void *, const Scene *, RenderData *, int, int, ReportList *, bool, const char *)
Definition writemovie.cc:26