From f9733b615614a990d3e047f251b4ad1ea48a0534 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 22 Jul 2005 15:59:39 +0000 Subject: *** empty log message *** --- src/mov_encoder.cc | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/mov_encoder.cc') diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc index f21cc3a..74f9b90 100644 --- a/src/mov_encoder.cc +++ b/src/mov_encoder.cc @@ -39,6 +39,9 @@ /* * $Log$ + * Revision 1.36 2005/07/22 15:59:39 deva + * *** empty log message *** + * * Revision 1.35 2005/07/07 12:42:19 deva * *** empty log message *** * @@ -150,9 +153,6 @@ MovEncoder::MovEncoder(sem_t *r_sem, info = i; info->info("MovEncoder"); - // fame = new LibFAMEWrapper(info); - // lame = new LibLAMEWrapper(info); - running = true; inputqueue = in; @@ -170,11 +170,11 @@ MovEncoder::MovEncoder(sem_t *r_sem, MovEncoder::~MovEncoder() { info->info("~MovEncoder"); - - // delete fame; - // delete lame; } + +//#define COPY_DV 1 + // this runs in a thread void MovEncoder::thread_main() { @@ -192,11 +192,15 @@ void MovEncoder::thread_main() Frame *out_a_frame; LibFAMEWrapper fame(info); - LibLAMEWrapper lame(info); + // LibLAMEWrapper lame(info); while(running) { sem_wait(input_sem); + // Make a new instance for every frame sequence (usually 5) to ensure no + // frame dependencies are broken when running multithreaded. + LibLAMEWrapper lame(info); + // Lock inout mutex pthread_mutex_lock(input_mutex); item = inputqueue->front(); @@ -211,6 +215,18 @@ void MovEncoder::thread_main() for(unsigned int cnt = 0; cnt < item->size(); cnt++) { in_frame = item->at(cnt); +#ifdef COPY_DV + + // Encode video + out_v_frame = new Frame(in_frame->data, in_frame->size); + out_v_frame->number = in_frame->number; + + // Encode audio + out_a_frame = new Frame(in_frame->data, in_frame->size); + out_a_frame->number = in_frame->number + 1; + +#else /*COPY_DV*/ + // Encode video out_v_frame = fame.encode(in_frame); out_v_frame->number = in_frame->number; @@ -219,6 +235,7 @@ void MovEncoder::thread_main() out_a_frame = lame.encode(in_frame); out_a_frame->number = in_frame->number + 1; +#endif /*COPY_DV*/ delete in_frame; // Lock output mutex -- cgit v1.2.3