This repository was archived by the owner on Jul 30, 2022. It is now read-only.
mirrored from https://chromium.googlesource.com/webm/webmquicktime
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathWebMCommon.h
89 lines (73 loc) · 2.36 KB
/
WebMCommon.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2010 The WebM project authors. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
#ifndef _WEBM_COMMON_H_
#define _WEBM_COMMON_H_ 1
//Here are some common data structs and functions to support them
#if defined(__APPLE_CC__)
#include <QuickTime/QuickTime.h>
#else
#include <QuickTimeComponents.h>
#if defined(TARGET_OS_WIN32)
#define _WINIOCTL_
#error windows
#include <windows.h>
#endif /* TARGET_OS_WIN32 */
#endif /* __APPLE_CC__ */
typedef struct
{
void *data;
UInt32 size;
UInt32 offset;
}WebMBuffer;
enum{
KEY_FRAME = 0x01,
VIDEO_FRAME = 0x02,
AUDIO_FRAME = 0x04,
ALT_REF_FRAME = 0x08
};
typedef struct
{
void *data;
UInt32 size;
UInt32 offset; //pointer to the end of output buffers data.
UInt64 timeMs; //time in milliseconds
UInt16 frameType; //corresponds to above frame types
UInt32 indx;
} WebMBufferedFrame;
//these frames should be queued chronologically
typedef struct
{
WebMBufferedFrame** queue;
int maxSize; //the maximum allocated memory
int size;
} WebMQueuedFrames;
typedef struct
{
MovieExportGetPropertyUPP propertyProc;
MovieExportGetDataUPP dataProc;
void *refCon;
MovieExportGetDataParams params;
Boolean eos;
TimeValue64 time; //This time must be based on the source Time scale
TimeScale timeScale;
long trackID;
} StreamSource;
void initFrameQueue(WebMQueuedFrames *queue);
WebMBufferedFrame* getFrame(WebMQueuedFrames *queue);
void popFrame(WebMQueuedFrames *queue);
// returns -1 on memory error
int addFrameToQueue(WebMQueuedFrames *queue, void * data,UInt32 size, UInt64 timeMs, UInt16 frameType, UInt32 indx);
int frameQueueSize(WebMQueuedFrames *queue);
int freeFrameQueue(WebMQueuedFrames *queue);
void initMovieGetParams(StreamSource *get);
void dbg_printDataParams(StreamSource *get);
ComponentResult initStreamSource(StreamSource *source, TimeScale scale,
long trackID, MovieExportGetPropertyUPP propertyProc,
MovieExportGetDataUPP getDataProc, void *refCon);
double getTimeAsSeconds(StreamSource *source);
#endif