| 1 |
/***************************************************************************** |
|---|
| 2 |
* |
|---|
| 3 |
* Avi Import Component Private Header |
|---|
| 4 |
* |
|---|
| 5 |
* Copyright(C) 2006 Christoph Naegeli <chn1@mac.com> |
|---|
| 6 |
* |
|---|
| 7 |
* This program is free software ; you can redistribute it and/or modify |
|---|
| 8 |
* it under the terms of the GNU General Public License as published by |
|---|
| 9 |
* the Free Software Foundation ; either version 2 of the License, or |
|---|
| 10 |
* (at your option) any later version. |
|---|
| 11 |
* |
|---|
| 12 |
* This program is distributed in the hope that it will be useful, |
|---|
| 13 |
* but WITHOUT ANY WARRANTY ; without even the implied warranty of |
|---|
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 |
* GNU General Public License for more details. |
|---|
| 16 |
* |
|---|
| 17 |
* You should have received a copy of the GNU General Public License |
|---|
| 18 |
* along with this program ; if not, write to the Free Software |
|---|
| 19 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 |
* |
|---|
| 21 |
****************************************************************************/ |
|---|
| 22 |
|
|---|
| 23 |
#ifndef __FF_PRIVATE__ |
|---|
| 24 |
#define __FF_PRIVATE__ |
|---|
| 25 |
|
|---|
| 26 |
#include "avformat.h" |
|---|
| 27 |
#include <QuickTime/Movies.h> |
|---|
| 28 |
|
|---|
| 29 |
/* Data structres needed for import */ |
|---|
| 30 |
struct _NCStream { |
|---|
| 31 |
int index; |
|---|
| 32 |
AVStream *str; |
|---|
| 33 |
SampleDescriptionHandle sampleHdl; |
|---|
| 34 |
AudioStreamBasicDescription asbd; |
|---|
| 35 |
Media media; |
|---|
| 36 |
UInt32 vbr; |
|---|
| 37 |
AVRational base; |
|---|
| 38 |
int64_t lastpts; |
|---|
| 39 |
SampleReference64Record lastSample; |
|---|
| 40 |
}; |
|---|
| 41 |
typedef struct _NCStream NCStream; |
|---|
| 42 |
|
|---|
| 43 |
/* Utilities */ |
|---|
| 44 |
ComponentResult check_system(); |
|---|
| 45 |
|
|---|
| 46 |
/* Library initialization */ |
|---|
| 47 |
void register_parsers(); |
|---|
| 48 |
|
|---|
| 49 |
/* Public interface of the DataRef interface */ |
|---|
| 50 |
OSStatus url_open_dataref(ByteIOContext *pb, Handle dataRef, OSType dataRefType); |
|---|
| 51 |
|
|---|
| 52 |
/* Import routines */ |
|---|
| 53 |
int prepare_track(AVFormatContext *ic, NCStream **out_map, Track targetTrack, Handle dataRef, OSType dataRefType); |
|---|
| 54 |
int prepare_movie(AVFormatContext *ic, NCStream **out_map, Movie theMovie, Handle dataRef, OSType dataRefType); |
|---|
| 55 |
void initialize_video_map(NCStream *map, Track targetTrack, Handle dataRef, OSType dataRefType); |
|---|
| 56 |
void initialize_audio_map(NCStream *map, Track targetTrack, Handle dataRef, OSType dataRefType); |
|---|
| 57 |
|
|---|
| 58 |
short import_avi(AVFormatContext *ic, NCStream *map, int64_t aviheader_offset); |
|---|
| 59 |
void import_without_index(AVFormatContext *ic, NCStream *map, int64_t aviheader_offset); |
|---|
| 60 |
|
|---|
| 61 |
OSType map_video_codec_to_mov_tag(enum CodecID codec_id); |
|---|
| 62 |
void map_avi_to_mov_tag(enum CodecID codec_id, AudioStreamBasicDescription *asbd); |
|---|
| 63 |
uint8_t *create_cookie(AVCodecContext *codec, int *cookieSize, UInt32 formatID); |
|---|
| 64 |
Handle create_strf_ext(AVCodecContext *codec); |
|---|
| 65 |
|
|---|
| 66 |
uint8_t *write_int32(uint8_t *target, int32_t data); |
|---|
| 67 |
uint8_t *write_int16(uint8_t *target, int16_t data); |
|---|
| 68 |
uint8_t *write_data(uint8_t *target, uint8_t* data, int32_t data_size); |
|---|
| 69 |
|
|---|
| 70 |
#define BSWAP(a) ( (((a)&0xff) << 24) | (((a)&0xff00) << 8) | (((a)&0xff0000) >> 8) | (((a) >> 24) & 0xff) ) |
|---|
| 71 |
|
|---|
| 72 |
#define IS_AVI(x) (x == 'AVI ' || x == 'VfW ' || x == 'VFW ') |
|---|
| 73 |
|
|---|
| 74 |
#endif |
|---|