diff options
Diffstat (limited to 'src/mov_encoder_writer.cc')
-rw-r--r-- | src/mov_encoder_writer.cc | 185 |
1 files changed, 18 insertions, 167 deletions
diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc index d53d805..98e5ece 100644 --- a/src/mov_encoder_writer.cc +++ b/src/mov_encoder_writer.cc @@ -31,6 +31,9 @@ /* * $Log$ + * Revision 1.12 2005/07/22 15:59:39 deva + * *** empty log message *** + * * Revision 1.11 2005/07/09 16:23:15 deva * Added audio. * @@ -137,14 +140,20 @@ MovEncoderWriter::~MovEncoderWriter() delete file; } +//#define WRITE_DV 1 + void MovEncoderWriter::thread_main() { info->info("MovEncoderWriter::run"); Frame *frame; +#ifndef WRITE_DV + write_header(); +#endif/*WRITE_DV*/ + while(running) { sem_wait(sem); @@ -161,10 +170,19 @@ void MovEncoderWriter::thread_main() int ret = 0; +#ifndef WRITE_DV + if(frame->number%2 == 1) write_audio_header((unsigned short int)frame->size); else write_video_header((unsigned short int)frame->size); ret = file->Write(frame->data, frame->size); + +#else/*WRITE_DV*/ + + if(frame->number%2 == 0) ret = file->Write(frame->data, frame->size); + +#endif/*WRITE_DV*/ + frame_number++; wrote ++; @@ -327,170 +345,3 @@ void MovEncoderWriter::write_audio_header(unsigned short int psize) } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/* -void MovEncoderWriter::write_video_header(unsigned short int psize) -{ - // PES Header startcode - char startcode[] = { - 0x00, 0x00, 0x01 - }; - - file->Write(startcode, sizeof(startcode)); - - // Audio stream, index = 0 - char streamID[] = { - 0xE0 - }; - - file->Write(streamID, sizeof(streamID)); - - char packetsize[] = { 0x00, 0x00 }; - - psize += sizeof(startcode) + sizeof(streamID) + sizeof(packetsize); - - packetsize[0] = ((char*)&psize)[1]; - packetsize[1] = ((char*)&psize)[0]; - - file->Write(packetsize, sizeof(packetsize)); -} - -void MovEncoderWriter::write_audio_header(unsigned short int psize) -{ - // PES Header startcode - char startcode[] = { - 0x00, 0x00, 0x01 - }; - - file->Write(startcode, sizeof(startcode)); - - // Audio stream, index = 0 - char streamID[] = { - 0xC0 - }; - - file->Write(streamID, sizeof(streamID)); - - char packetsize[] = { 0x00, 0x00 }; - - psize += sizeof(startcode) + sizeof(streamID) + sizeof(packetsize); - - packetsize[0] = ((char*)&psize)[1]; - packetsize[1] = ((char*)&psize)[0]; - - file->Write(packetsize, sizeof(packetsize)); -} - -void MovEncoderWriter::write_header() -{ - // PACK - char pack_start_code[] = { - 0x00, 0x00, 0x01, 0xBA, - }; - - file->Write(pack_start_code, sizeof(pack_start_code)); - - char pack_data[] = { - 0x21, // SCR-32 thru 30, marker bit - 0x00, 0x01, // SCR-29 thru 15, marker bit - 0x1E, 0x81, // SCR-14 thru 0, marker bit - 0x80, 0x1B, 0x83 // Marker bit, mux_rate, marker_bit - }; - - file->Write(pack_data, sizeof(pack_data)); - - // SYSTEM - char system_header_start_code[] = { - 0x00, 0x00, 0x01, 0xBB, - }; - - file->Write(system_header_start_code, sizeof(system_header_start_code)); - - char system_data[] = { - 0x00, 0x0C, // Header length - 0x80, 0x1B, 0x83, // Marker bit, rate_bound,marker_bit - 0x07, // Audio bound, fixed_flag, CSPS_flag - 0xA1, // system_audio_lock_flag, system_video_lock_flag - 0xFF, // Reserved byte - 0xC0, // Stream id (audio) - // 0xC0, 0x20, // '11', STD_buffer_bound_scale, STD_buffer_size_bound - 0xFF, 0xFF, // '11', STD_buffer_bound_scale, STD_buffer_size_bound - 0xE0, // Stream id (video) - // 0xE0, 0x2E // '11', STD_buffer_bound_scale, STD_buffer_size_bound - 0xFF, 0xFF // '11', STD_buffer_bound_scale, STD_buffer_size_bound - }; - - file->Write(system_data, sizeof(system_data)); - - char padding_header_start_code[] = { - 0x00, 0x00, 0x01, 0xBE - }; - - file->Write(padding_header_start_code, sizeof(padding_header_start_code)); - - char padding_data[] = { - 0x00, 0x04, // Padding length - 0x0F, 0xFF, 0xFF, 0xFF // Padding - }; - - file->Write(padding_data, sizeof(padding_data)); -} -*/ |