forked from panda3d/panda3d
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathffmpegVirtualFile.h
More file actions
71 lines (57 loc) · 1.75 KB
/
ffmpegVirtualFile.h
File metadata and controls
71 lines (57 loc) · 1.75 KB
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
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file ffmpegVirtualFile.h
* @author jyelon
* @date 2007-08-01
*/
#ifndef FFMPEGVIRTUALFILE_H
#define FFMPEGVIRTUALFILE_H
#include "pandabase.h"
#include "config_movies.h"
#include "filename.h"
#include "subfileInfo.h"
#include <stdarg.h>
extern "C" {
#include <libavformat/avio.h>
}
struct URLContext;
struct AVFormatContext;
/**
* Enables ffmpeg to access panda's VFS. Create an instance of the
* FfmpegVirtualFile for each ffmpeg stream you wish to open.
*/
class EXPCL_FFMPEG FfmpegVirtualFile {
public:
FfmpegVirtualFile();
FfmpegVirtualFile(const FfmpegVirtualFile ©) = delete;
~FfmpegVirtualFile();
FfmpegVirtualFile &operator = (const FfmpegVirtualFile ©) = delete;
bool open_vfs(const Filename &filename);
bool open_subfile(const SubfileInfo &info);
void close();
INLINE bool is_open() const;
INLINE AVFormatContext *get_format_context() const;
static void register_protocol();
private:
// These are callbacks passed to ffmpeg and cannot change signature.
static int read_packet(void *opaque, uint8_t *buf, int buf_size);
static int64_t seek(void *opaque, int64_t offset, int whence);
static void log_callback(void *ptr, int level, const char *fmt, va_list v1);
private:
AVIOContext *_io_context;
AVFormatContext *_format_context;
std::streampos _start;
std::streamsize _size;
std::istream *_in;
pifstream _file_in;
bool _owns_in;
int _buffer_size;
};
#include "ffmpegVirtualFile.I"
#endif // FFMPEGVIRTUALFILE_H