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 90 91 92 93 94 95
|
IMPORT MODULE WRITING HOWTO
---------------------------
Some very short documentation on writing import modules for transcode
include this file:
------------------
#include "transcode.h" // definition of vob_t and transfer_t structures
data exchange structures for modules:
-----------------------------------
typedef struct _vob_t {
// see transcode.h for details
} vob_t;
typedef struct _transfer_t {
int flag; // specifies context: TC_VIDEO for video
TC_AUDIO for audio
// or passes an integer to the module
FILE *fd; // file handle for input stream
// NULL if import module performs reading
int size; // total amount of bytes in the buffer
char *buffer; // pointer to data array with frame data
char *buffer2;
int attributes;
} transfer_t;
single function interface:
--------------------------
int tc_import(int opt, void *para1, void *para2);
exit codes: all handled by transcode
TC_IMPORT_UNKNOWN option not supported
TC_IMPORT_OK no error, hopefully the default
TC_IMPORT_ERROR a critical error occurred
input parameter:
opt contains the requested action id
para1/2 its actually meaning depends on option
requested method:
transcode calls the following routines in this order
for both import modules, i.e., first for video and subsequent with the
audio context flag set.
[1]
opt=TC_IMPORT_NAME
para1=_transfer_t
para2=NULL
requested action: print out some general module infos to stderr
and inherit transcode verbosity flag
(optional return capability flag)
//>0.3.3 of transcode interpret flag returned
//to read module capabilities for sanity checks
status: optional
[2]
opt=TC_IMPORT_OPEN
para1=_transfer_t
para2=_vob_t
requested action: return a file handle for reading from the pipe or
return NULL if import modules handles data read
status: required if following option is not implemented
[3]
opt=TC_IMPORT_DECODE
para1=_transfer_t
para2=_vob_t
requested action: return a frame and the total amount of bytes read
//>0.3.3 of transcode accepts import module returned amount
//of bytes in buffer. Module does the error checks anyway.
status: required if previous option is not implemented
[4]
opt=TC_IMPORT_CLOSE
para1=_transfer_t
para2=NULL
requested action: close streams or any open files, free memory and prepare
module removal
status: required
|