Jeremy,
I've been tinkering with tdmake and some API calls. This doesn't have the new options for tdmake, but does include some rough api's (pathed against CVS and includes Windows stdin patch):
tivo_full_raw_header * init_full_header(void);
void free_full_header(tivo_full_raw_header * hdr);
tivo_stream_chunk * get_chunk(tivo_full_raw_header * hdr, unsigned int idx);
int set_chunk_data(tivo_full_raw_header * hdr, unsigned int idx, unsigned char * buffer, unsigned int buffer_length);
int decrypt_full_header(tivo_full_raw_header * hdr, char mak[12]);
Is this what you had in mind?
*** WARNING - THIS IS ALPHA CODE AND NO TESTING HAS BEEN DONE. THIS IS MEANT FOR DISCUSSION ONLY. PLEASE DO NOT USE THIS PATCH UNLESS IT IS RELEASED.
Logged In: YES
user_id=749423
Originator: NO
That's actually more complex than what I was thinking. I figured something like:
int write_tivo_header(char * mak, tivo_stream_header* hdr, int flags, tivo_stream_chunk** chunk_array, void * fh, write_func_t write_handler);
The write_func_t typedef is in tivodecoder.h
The caller would set the chunk_count in the hdr struct, and optionally provide a flag to say that you want the function to preserve the version info (if this flag is not set, it would set it to 0x4 0x5). After the function, the mpeg_offset field would be set up, as well as the chunk_size of each chunk (I don't really like that the amount of memory allocated to the chunk would not equal chunk_size at that point, but I don't really see a way around it except realloc'ing the chunk, which is even worse). The chunks would be encrypted (except for the XML chunk). The data would be written to the file using the write_handler function and the fh parameter, padded with zeros up to the mpeg_offset.
Does this seem reasonable to you?
Logged In: YES
user_id=749423
Originator: NO
BTW, you should be able to attach additional patches to this same entry in the tracker, rather than making a whole new entry for a new rev of the patch...
Logged In: YES
user_id=749423
Originator: NO
BTW, you should be able to attach additional patches to this same entry in the tracker, rather than making a whole new entry for a new rev of the patch...
Logged In: YES
user_id=1302043
Originator: YES
Here's a more complete api implementation and tdmake. I change tdcat to show how I was considering the api calls.
It seems to me that with write_tivo_header, the caller still has a lot of work to do. They need to make the header and all of the chunks, then write_tivo_header will align, pad, encrypt, and validate all at once - correct?
Sorry for the new patch entry, but I thought since it was more of a proposed api patch I should separate it from the previous patch. Maybe a different name would have been appropriate.
File Added: tdmake.patch3.tgz
Logged In: YES
user_id=1302043
Originator: YES
File Added: tivodecode-new4.tgz
Logged In: YES
user_id=1302043
Originator: YES
File Added: tdmake.patch4.tgz