rework playback speed and speed auto sampling, change conver to transcode, change...
authorGood Guy <good1.2guy@gmail.com>
Fri, 22 Nov 2019 18:52:30 +0000 (11:52 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 22 Nov 2019 18:52:30 +0000 (11:52 -0700)
20 files changed:
cinelerra-5.1/cinelerra/amodule.C
cinelerra-5.1/cinelerra/amodule.h
cinelerra-5.1/cinelerra/audioalsa.C
cinelerra-5.1/cinelerra/convert.C
cinelerra-5.1/cinelerra/ffmpeg.C
cinelerra-5.1/cinelerra/virtualaconsole.C
cinelerra-5.1/doc/shortcuts.html
cinelerra-5.1/ffmpeg/video/16mmto264.mp4
cinelerra-5.1/ffmpeg/video/avc422.m2ts
cinelerra-5.1/ffmpeg/video/faststart_h264.mp4
cinelerra-5.1/ffmpeg/video/faststart_h264.qt
cinelerra-5.1/ffmpeg/video/h264-10bit.mp4
cinelerra-5.1/ffmpeg/video/h264.f4v
cinelerra-5.1/ffmpeg/video/h264.mp4
cinelerra-5.1/ffmpeg/video/hd_h264.youtube
cinelerra-5.1/ffmpeg/video/pass1of2_h264.mp4
cinelerra-5.1/ffmpeg/video/pass2of2_h264.mp4
cinelerra-5.1/ffmpeg/video/sd_h264.youtube
cinelerra-5.1/ffmpeg/video/uhd_h264.youtube
cinelerra-5.1/ffmpeg/video/visually_lossless.m2ts

index aee3f5f084431e9fb45b503bba95ac3ad382ed28..50b58884784a42b882c425ae913f846745195eae 100644 (file)
@@ -151,8 +151,6 @@ AModule::AModule(RenderEngine *renderengine,
        transition_temp = 0;
        speed_temp = 0;
        bzero(nested_output, sizeof(Samples*) * MAX_CHANNELS);
-       bzero(prev_head, SPEED_OVERLAP * sizeof(double));
-       bzero(prev_tail, SPEED_OVERLAP * sizeof(double));
        meter_history = new MeterHistory();
        nested_allocation = 0;
        resample = 0;
@@ -216,11 +214,10 @@ int AModule::import_samples(AEdit *edit,
        Samples *buffer,
        int64_t fragment_len)
 {
+       const int debug = 0;
        int result = 0;
 // start in EDL samplerate
-       int64_t start_source = start_project -
-               edit_startproject +
-               edit_startsource;
+       int64_t start_source = start_project - edit_startproject + edit_startsource;
 // fragment size adjusted for speed curve
        int64_t speed_fragment_len = fragment_len;
 // boundaries of input fragment required for speed curve
@@ -232,51 +229,32 @@ int AModule::import_samples(AEdit *edit,
        double speed_position1 = speed_position;
 // position in source where speed curve finishes
        double speed_position2 = speed_position;
-
 // Need speed curve processing
        int have_speed = 0;
 // Temporary buffer for rendering speed curve
        Samples *speed_buffer = buffer;
-       const int debug = 0;
 
-if(debug) printf("AModule::import_samples %d edit=%p nested_edl=%p\n",
-__LINE__,
-edit,
-nested_edl);
-       if(nested_edl && edit->channel >= nested_edl->session->audio_channels)
+       if( nested_edl && edit->channel >= nested_edl->session->audio_channels )
                return 1;
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
-
        this->channel = edit->channel;
-if(debug) printf("AModule::import_samples %d speed_fragment_len=%jd\n",
-__LINE__,
-speed_fragment_len);
-
-
-
+       int dir = direction == PLAY_FORWARD ? 1 : -1;
 
 // apply speed curve to source position so the timeline agrees with the playback
-       if(track->has_speed())
-       {
+       if( track->has_speed() ) {
 // get speed adjusted position from start of edit.
-               FloatAuto *previous = 0;
-               FloatAuto *next = 0;
+               FloatAuto *previous = 0, *next = 0;
                FloatAutos *speed_autos = (FloatAutos*)track->automation->autos[AUTOMATION_SPEED];
                speed_position += speed_autos->automation_integral(edit_startproject,
                                start_project-edit_startproject, PLAY_FORWARD);
                speed_position1 = speed_position;
 
-
 // calculate boundaries of input fragment required for speed curve
                max_position = speed_position;
                min_position = speed_position;
-               for(int64_t i = start_project; i < start_project + fragment_len; i++)
-               {
-                       double speed = speed_autos->get_value(i,
-                               PLAY_FORWARD,
-                               previous,
-                               next);
-                       speed_position += speed;
+               int64_t pos = start_project;
+               for( int64_t i=0; i<fragment_len; ++i,pos+=dir ) {
+                       double speed = speed_autos->get_value(pos, direction, previous, next);
+                       speed_position += dir*speed;
                        if(speed_position > max_position) max_position = speed_position;
                        if(speed_position < min_position) min_position = speed_position;
                }
@@ -301,59 +279,32 @@ speed_fragment_len);
                start_source = (int64_t)min_position;
                have_speed = 1;
 
-
-
 // swap in the temp buffer
-               if(speed_temp && speed_temp->get_allocated() < speed_fragment_len)
-               {
-                       delete speed_temp;
-                       speed_temp = 0;
+               if(speed_temp && speed_temp->get_allocated() < speed_fragment_len) {
+                       delete speed_temp;  speed_temp = 0;
                }
-
                if(!speed_temp)
-               {
                        speed_temp = new Samples(speed_fragment_len);
-               }
-
                speed_buffer = speed_temp;
        }
 
-
-
-       if(speed_fragment_len == 0)
+       if( speed_fragment_len == 0 )
                return 1;
 
-
-
 // Source is a nested EDL
-       if(edit->nested_edl)
-       {
-               int command;
+       if( edit->nested_edl ) {
+               int command = direction == PLAY_REVERSE ?
+                       NORMAL_REWIND : NORMAL_FWD;
                asset = 0;
 
-               if(direction == PLAY_REVERSE)
-                       command = NORMAL_REWIND;
-               else
-                       command = NORMAL_FWD;
-
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
-               if(!nested_edl || nested_edl->id != edit->nested_edl->id)
-               {
+               if( !nested_edl || nested_edl->id != edit->nested_edl->id ) {
                        nested_edl = edit->nested_edl;
-                       if(nested_renderengine)
-                       {
-                               delete nested_renderengine;
-                               nested_renderengine = 0;
+                       if( nested_renderengine ) {
+                               delete nested_renderengine;  nested_renderengine = 0;
                        }
-
-                       if(!nested_command)
-                       {
+                       if( !nested_command )
                                nested_command = new TransportCommand;
-                       }
-
-
-                       if(!nested_renderengine)
-                       {
+                       if( !nested_renderengine ) {
                                nested_command->command = command;
                                nested_command->get_edl()->copy_all(nested_edl);
                                nested_command->change_type = CHANGE_ALL;
@@ -373,350 +324,144 @@ if(debug) printf("AModule::import_samples %d\n", __LINE__);
 if(debug) printf("AModule::import_samples %d speed_fragment_len=%d\n", __LINE__, (int)speed_fragment_len);
 
 // Allocate output buffers for all channels
-               for(int i = 0; i < nested_edl->session->audio_channels; i++)
-               {
-                       if(nested_allocation < speed_fragment_len)
-                       {
-                               delete nested_output[i];
-                               nested_output[i] = 0;
+               for( int i=0; i<nested_edl->session->audio_channels; ++i ) {
+                       if( nested_allocation < speed_fragment_len ) {
+                               delete nested_output[i];  nested_output[i] = 0;
                        }
-
                        if(!nested_output[i])
-                       {
                                nested_output[i] = new Samples(speed_fragment_len);
-                       }
                }
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
 
-               if(nested_allocation < speed_fragment_len)
+               if( nested_allocation < speed_fragment_len )
                        nested_allocation = speed_fragment_len;
 
 // Update direction command
                nested_renderengine->command->command = command;
 
 // Render the segment
-               if(!nested_renderengine->arender)
-               {
+               if( !nested_renderengine->arender )
                        bzero(speed_buffer->get_data(), speed_fragment_len * sizeof(double));
-               }
-               else
-               if(sample_rate != nested_edl->session->sample_rate)
-               {
-// Read through sample rate converter.
-                       if(!resample)
-                       {
+               else if(sample_rate != nested_edl->session->sample_rate) {
+                       if( !resample )
                                resample = new AModuleResample(this);
-                       }
-
-if(debug) printf("AModule::import_samples %d %d %d\n",
-__LINE__,
-(int)sample_rate,
-(int)nested_edl->session->sample_rate);
                        result = resample->resample(speed_buffer,
-                               speed_fragment_len,
-                               nested_edl->session->sample_rate,
-                               sample_rate,
-                               start_source,
-                               direction);
+                               speed_fragment_len, nested_edl->session->sample_rate,
+                               sample_rate, start_source, direction);
 // Resample reverses to keep it running forward.
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                }
-               else
-               {
+               else {
 // Render without resampling
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                        result = nested_renderengine->arender->process_buffer(
-                               nested_output,
-                               speed_fragment_len,
-                               start_source);
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
+                               nested_output, speed_fragment_len, start_source);
                        memcpy(speed_buffer->get_data(),
                                nested_output[edit->channel]->get_data(),
                                speed_fragment_len * sizeof(double));
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
 
 // Reverse fragment so ::render can apply transitions going forward.
-                       if(direction == PLAY_REVERSE)
-                       {
+                       if( direction == PLAY_REVERSE ) {
                                Resample::reverse_buffer(speed_buffer->get_data(), speed_fragment_len);
                        }
                }
-
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
        }
-       else
+       else if( edit->asset ) {
 // Source is an asset
-       if(edit->asset)
-       {
                nested_edl = 0;
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                asset = edit->asset;
-
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                get_cache()->age();
 
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
-               if(nested_renderengine)
-               {
-                       delete nested_renderengine;
-                       nested_renderengine = 0;
+               if( nested_renderengine ) {
+                       delete nested_renderengine;  nested_renderengine = 0;
                }
 
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
-
-               if(!(file = get_cache()->check_out(
-                       asset,
-                       get_edl())))
-               {
+               if( !(file = get_cache()->check_out( asset, get_edl())) ) {
 // couldn't open source file / skip the edit
                        printf(_("AModule::import_samples Couldn't open %s.\n"), asset->path);
                        result = 1;
                }
-               else
-               {
+               else {
                        result = 0;
 
-
-                       if(sample_rate != asset->sample_rate)
-                       {
+                       if( sample_rate != asset->sample_rate ) {
 // Read through sample rate converter.
-                               if(!resample)
-                               {
+                               if( !resample )
                                        resample = new AModuleResample(this);
-                               }
-
-if(debug) printf("AModule::import_samples %d %d %d\n",
-__LINE__,
-sample_rate,
-asset->sample_rate);
                                result = resample->resample(speed_buffer,
-                                       speed_fragment_len,
-                                       asset->sample_rate,
-                                       sample_rate,
-                                       start_source,
-                                       direction);
+                                       speed_fragment_len, asset->sample_rate,
+                                       sample_rate, start_source, direction);
 // Resample reverses to keep it running forward.
                        }
-                       else
-                       {
-
-if(debug)
-printf("AModule::import_samples %d channel=%d start_source=%jd len=%d\n", __LINE__, edit->channel, start_source, (int)speed_fragment_len);
+                       else {
                                file->set_audio_position(start_source);
                                file->set_channel(edit->channel);
                                result = file->read_samples(speed_buffer, speed_fragment_len);
 // Reverse fragment so ::render can apply transitions going forward.
-if(debug) printf("AModule::import_samples %d speed_buffer=%p data=%p speed_fragment_len=%d\n",
-__LINE__,
-(void*)speed_buffer,
-(void*)speed_buffer->get_data(),
-(int)speed_fragment_len);
                                if(direction == PLAY_REVERSE)
-                               {
                                        Resample::reverse_buffer(speed_buffer->get_data(), speed_fragment_len);
-                               }
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                        }
 
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                        get_cache()->check_in(asset);
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
                        file = 0;
-
-
-
-
-
                }
        }
-       else
-       {
+       else {
                nested_edl = 0;
                asset = 0;
-if(debug) printf("AModule::import_samples %d %p %d\n", __LINE__, speed_buffer->get_data(), (int)speed_fragment_len);
-               if(speed_fragment_len > 0) bzero(speed_buffer->get_data(), speed_fragment_len * sizeof(double));
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
+               if( speed_fragment_len > 0 )
+                       bzero(speed_buffer->get_data(), speed_fragment_len * sizeof(double));
        }
-if(debug) printf("AModule::import_samples %d\n", __LINE__);
-
-
-
-
-
-
-
-
 
 // Stretch it to fit the speed curve
 // Need overlapping buffers to get the interpolation to work, but this
 // screws up sequential effects.
-       if(have_speed)
-       {
-               FloatAuto *previous = 0;
-               FloatAuto *next = 0;
-               FloatAutos *speed_autos = (FloatAutos*)track->automation->autos[AUTOMATION_SPEED];
+       if( have_speed ) {
                double *buffer_samples = buffer->get_data();
-               double *speed_samples = speed_buffer->get_data();
-
-//printf("AModule::import_samples %d %lld\n", __LINE__, speed_fragment_len);
-
-               if(speed_fragment_len == 0)
-               {
-                       bzero(buffer_samples, fragment_len * sizeof(double));
-                       bzero(prev_tail, SPEED_OVERLAP * sizeof(double));
-                       bzero(prev_head, SPEED_OVERLAP * sizeof(double));
-               }
-               else
-               {
-// buffer is now reversed
-                       if(direction == PLAY_REVERSE)
-                       {
-                               int out_offset = 0;
-                               speed_position = speed_position2;
-       //printf("AModule::import_samples %d %lld %lld\n", __LINE__, start_project, speed_fragment_len);
-                               for(int64_t i = start_project + fragment_len;
-                                       i != start_project;
-                                       i--)
-                               {
-       // funky sample reordering, because the source is a reversed buffer
-                                       int in_offset = (int64_t)(speed_fragment_len - 1 - speed_position);
-                                       CLAMP(in_offset, 0, speed_fragment_len - 1);
-                                       buffer_samples[out_offset++] = speed_samples[in_offset];
-                                       double speed = speed_autos->get_value(i,
-                                               PLAY_REVERSE,
-                                               previous,
-                                               next);
-                                       speed_position -= speed;
-                               }
-       //printf("AModule::import_samples %d %f\n", __LINE__, speed_position);
-                       }
-                       else
-                       {
-                               int out_offset = 0;
-// position in buffer to read
-                               speed_position = speed_position1 - start_source;
-
-//printf("AModule::import_samples %d %f\n", __LINE__, speed_position);
-                               for(int64_t i = start_project; i < start_project + fragment_len; i++)
-                               {
-                                       double speed = speed_autos->get_value(i,
-                                               PLAY_FORWARD,
-                                               previous,
-                                               next);
-                                       double next_speed_position = speed_position + speed;
-
-                                       int in_offset = (int)(speed_position);
-                                       if(fabs(speed) >= 1.0)
-                                       {
-                                               int total = abs(speed);
-                                               double accum = 0;
-                                               for(int j = 0; j < total; j++)
-                                               {
-                                                       int in_offset2 = in_offset + (speed > 0 ? j : -j);
-
-                                                       CLAMP(in_offset2, 0, speed_fragment_len - 1);
-                                                       accum += speed_samples[in_offset2];
-                                               }
-
-
-                                               buffer_samples[out_offset++] = accum / total;
+               if( speed_fragment_len > 0 ) {
+                       FloatAuto *previous = 0;
+                       FloatAuto *next = 0;
+                       FloatAutos *speed_autos = (FloatAutos*)track->automation->autos[AUTOMATION_SPEED];
+                       double *speed_samples = speed_buffer->get_data();
+                       int len1 = speed_fragment_len-1;
+                       int out_offset = dir>0 ? 0 : fragment_len-1;
+                       speed_position = speed_position1;
+                       int64_t speed_pos = speed_position;
+
+                       int64_t pos = start_project;
+                       for( int64_t i=0; i<fragment_len; ++i,pos+=dir ) {
+                               double speed = speed_autos->get_value(pos,
+                                       direction, previous, next);
+                               double next_position = speed_position + dir*speed;
+                               int64_t next_pos = next_position;
+                               int d = next_pos >= speed_pos ? 1 : -1;
+                               int k = speed_pos - start_source;
+                               double sample = speed_samples[bclip(k, 0,len1)];
+                               int total = abs(next_pos - speed_pos);
+                               if( total > 1 ) {
+                                       for( int j=total; --j>0; ) {
+                                               k += d;
+                                               sample += speed_samples[bclip(k, 0,len1)];
                                        }
-                                       else
-                                       {
-
-
-// if(in_offset < 0 || in_offset >= speed_fragment_len)
-// printf("AModule::import_samples %d %d %d\n",
-// __LINE__,
-// in_offset,
-// speed_fragment_len);
-
-                                               int in_offset1 = in_offset;
-                                               int in_offset2 = in_offset;
-
-                                               if(speed < 0)
-                                               {
-                                                       in_offset1 += SPEED_OVERLAP;
-                                                       in_offset2 = in_offset1 - 1;
-                                               }
-                                               else
-                                               {
-                                                       in_offset1 -= SPEED_OVERLAP;
-                                                       in_offset2 = in_offset1 + 1;
-                                               }
-
-                                               CLAMP(in_offset1, -SPEED_OVERLAP, speed_fragment_len - 1 + SPEED_OVERLAP);
-                                               CLAMP(in_offset2, -SPEED_OVERLAP, speed_fragment_len - 1 + SPEED_OVERLAP);
-
-                                               double value1 = 0;
-                                               if(in_offset1 >= speed_fragment_len)
-                                               {
-                                                       value1 = prev_head[in_offset1 - speed_fragment_len];
-                                               }
-                                               else
-                                               if(in_offset1 >= 0)
-                                               {
-                                                       value1 = speed_samples[in_offset1];
-                                               }
-                                               else
-                                               {
-//printf("AModule::import_samples %d %d\n", __LINE__, in_offset1);
-                                                       value1 = prev_tail[SPEED_OVERLAP + in_offset1];
-                                               }
+                                       sample /= total;
+                               }
 #if 0
-                                               double value2 = 0;
-                                               if(in_offset2 >= speed_fragment_len)
-                                               {
-                                                       value2 = prev_head[in_offset2 - speed_fragment_len];
-                                               }
-                                               else
-                                               if(in_offset2 >= 0)
-                                               {
-                                                       value2 = speed_samples()[in_offset2];
-                                               }
-                                               else
-                                               {
-                                                       value2 = prev_tail[SPEED_OVERLAP + in_offset2];
-                                               }
-
-                                               double fraction = speed_position - floor(speed_position);
-                                               buffer_samples[out_offset++] =
-                                                       value1 * (1.0 - fraction) +
-                                                       value2 * fraction;
-#endif
-                                               buffer_samples[out_offset++] = value1;
-
-
-                                       }
-
-                                       speed_position = next_speed_position;
+                               else if( total < 1 ) {
+                                       k += d;
+                                       double next_sample = speed_samples[bclip(k, 0,len1)];
+                                       double v = speed_position - speed_pos;
+                                       sample = (1.-v) * sample + v * next_sample;
                                }
-                       }
-
-                       for(int i = 0; i < SPEED_OVERLAP; i++)
-                       {
-                               int offset = speed_fragment_len -
-                                       SPEED_OVERLAP +
-                                       i;
-                               CLAMP(offset, 0, speed_fragment_len - 1);
-//printf("AModule::import_samples %d %d\n", __LINE__, offset, );
-                               prev_tail[i] = speed_samples[offset];
-                               offset = i;
-                               CLAMP(offset, 0, speed_fragment_len - 1);
-                               prev_head[i] = speed_samples[offset];
+#endif
+                               buffer_samples[out_offset] = sample;
+                               out_offset += dir;
+                               speed_position = next_position;
+                               speed_pos = next_pos;
                        }
                }
        }
 
-
-
-
-
        return result;
 }
 
 
-
 int AModule::render(Samples *buffer,
        int64_t input_len,
        int64_t start_position,
index 6781d38c63b604735a061c27058bd805097128a0..1d17bf0f63d85d367f5bf4b356bc550cf0ca294a 100644 (file)
@@ -109,10 +109,6 @@ public:
        Samples *transition_temp;
 // Temporary buffer for rendering speed curve
        Samples *speed_temp;
-// Previous buffers for rendering speed curve
-#define SPEED_OVERLAP 4
-       double prev_head[SPEED_OVERLAP];
-       double prev_tail[SPEED_OVERLAP];
 
 // Pointer to an asset for the resampler
        Asset *asset;
index f256a506057900187921c2d08a799bd1e8b2d39a..e5c9fdfbd1b7ca15271cddffbdc5a46e78d89955 100644 (file)
@@ -579,7 +579,7 @@ int AudioALSA::write_buffer(char *buffer, int size)
                                done = 1;
                }
                else {
-                       printf("AudioALSA::write_buffer err %d(%s) at sample %jd\n",
+                       printf(_("AudioALSA::write_buffer err %d(%s) at sample %jd\n"),
                                ret, snd_strerror(ret), device->current_position());
                        Timer::delay(50);
 //                     snd_pcm_resume(get_output());
index 9f4bfbd0c0834ff535a9c10e13d3ff6931331834..d42bac496d7485a43036d99ba70d00a10932636d 100644 (file)
@@ -166,7 +166,7 @@ EDL *ConvertRender::convert_edl(EDL *edl, Indexable *idxbl)
        char path[BCTEXTLEN];
        FileSystem fs;  fs.extract_name(path, copy_asset->path);
        strcpy(copy_edl->local_session->clip_title, path);
-       strcpy(copy_edl->local_session->clip_notes, _("Convert clip"));
+       strcpy(copy_edl->local_session->clip_notes, _("Transcode clip"));
        int64_t video_frames = idxbl->get_video_frames();
        double frame_rate = idxbl->get_frame_rate();
        double video_length = video_frames / frame_rate;
@@ -318,18 +318,18 @@ void ConvertRender::run()
                create_copy(i);
 
        canceled = progress->is_cancelled();
-printf("convert: failed=%d canceled=%d\n", failed, canceled);
+printf(_("convert: failed=%d canceled=%d\n"), failed, canceled);
        double elapsed_time = progress_timer->get_scaled_difference(1);
 
        char elapsed[BCSTRLEN], text[BCSTRLEN];
        Units::totext(elapsed, elapsed_time, TIME_HMS2);
-       printf("ConvertRender::run: done in %s\n", elapsed);
+       printf(_("TranscodeRender::run: done in %s\n"), elapsed);
        if( canceled )
-               strcpy(text, _("convert cancelled"));
+               strcpy(text, _("transcode cancelled"));
        else if( failed )
-               strcpy(text, _("convert failed"));
+               strcpy(text, _("transcode failed"));
        else
-               sprintf(text, _("convert %d files, render time %s"),
+               sprintf(text, _("transcode %d files, render time %s"),
                        needed_copies.size(), elapsed);
 // stop progress bar
        stop_progress(text);
@@ -338,7 +338,7 @@ printf("convert: failed=%d canceled=%d\n", failed, canceled);
                mwindow->finish_convert(remove_originals);
        }
        else if( !canceled ) {
-               eprintf(_("Error making convert."));
+               eprintf(_("Error making transcode."));
        }
 
        if( !canceled && beep > 0 ) {
@@ -372,7 +372,7 @@ void ConvertRender::start_progress()
        int64_t total_samples = total_len * format_asset->sample_rate;
        mwindow->gui->lock_window("Render::start_progress");
        progress = mwindow->mainprogress->
-               start_progress(_("Convert files..."), total_samples);
+               start_progress(_("Transcode files..."), total_samples);
        mwindow->gui->unlock_window();
        convert_progress = new ConvertProgress(mwindow, this);
        convert_progress->start();
@@ -489,7 +489,7 @@ void ConvertRender::create_copy(int i)
 }
 
 ConvertWindow::ConvertWindow(MWindow *mwindow, ConvertDialog *dialog, int x, int y)
- : BC_Window(_(PROGRAM_NAME ": Convert settings"), x, y, WIDTH, HEIGHT,
+ : BC_Window(_(PROGRAM_NAME ": Transcode settings"), x, y, WIDTH, HEIGHT,
                -1, -1, 0, 0, 1)
 {
        this->mwindow = mwindow;
@@ -580,7 +580,7 @@ void ConvertFormatTools::update_format()
 
 
 ConvertMenuItem::ConvertMenuItem(MWindow *mwindow)
- : BC_MenuItem(_("Convert..."),  _("Alt-e"), 'e')
+ : BC_MenuItem(_("Transcode..."),  _("Alt-e"), 'e')
 {
        this->mwindow = mwindow;
        set_alt();
@@ -610,7 +610,7 @@ ConvertDialog::ConvertDialog(MWindow *mwindow)
        this->mwindow = mwindow;
        gui = 0;
        asset = new Asset;
-       strcpy(suffix, ".convert");
+       strcpy(suffix, ".transcode");
 // quicker than some, not as good as others
        asset->format = FILE_FFMPEG;
        strcpy(asset->fformat, "mp4");
index e72ea7af9ce323dfd08a7b95bd81f7046147e36b..794added52ba6e9519ccd06f45f96dec2ad6de0f 100644 (file)
@@ -2372,7 +2372,7 @@ int FFMPEG::open_decoder()
        }
        if( bad_time && !(fflags & FF_BAD_TIMES) ) {
                fflags |= FF_BAD_TIMES;
-               printf("FFMPEG::open_decoder: some stream have bad times: %s\n",
+               printf(_("FFMPEG::open_decoder: some stream have bad times: %s\n"),
                        fmt_ctx->url);
        }
        ff_unlock();
index 02a86dcf8b2f972ea23ed8111d512d0aeb31c5de..4afc12f7f7b1d822b445a5be7984f2ce37ce2ed4 100644 (file)
@@ -196,60 +196,40 @@ if(debug) printf("VirtualAConsole::process_buffer %d\n", __LINE__);
                !interrupt)
        {
 // speed parameters
+               float speed = renderengine->command->get_speed();
 // length compensated for speed
                int real_output_len = 0;
-// output sample
-               double sample;
-               int k;
                double *audio_out_packed[MAX_CHANNELS];
                int audio_channels = renderengine->get_edl()->session->audio_channels;
 
-               for(int i = 0, j = 0;
-                       i < audio_channels;
-                       i++)
-               {
-                       audio_out_packed[j++] = arender->audio_out[i]->get_data();
-               }
-               for(int i = 0;
-                       i < audio_channels;
-                       i++)
-               {
-                       int in, out;
+               for( int i=0; i<audio_channels; ++i )
+                       audio_out_packed[i] = arender->audio_out[i]->get_data();
 
+               for( int i=0; i<audio_channels; ++i ) {
                        double *current_buffer = audio_out_packed[i];
-
 // Time stretch the fragment to the real_output size
-                       if(renderengine->command->get_speed() > 1)
-                       {
-// Number of samples in real output buffer for each to sample rendered.
-                               int interpolate_len = (int)renderengine->command->get_speed();
-                               for(in = 0, out = 0; in < len; )
-                               {
-                                       sample = 0;
-                                       for(k = 0; k < interpolate_len; k++)
-                                       {
-                                               sample += current_buffer[in++];
-                                       }
-
-                                       sample /= renderengine->command->get_speed();
+                       if( speed > 1 ) {
+                               int out = 0;
+                               for( int in=0; in<len; ) {
+// samples in real output buffer for each to sample rendered.
+                                       int end = (out+1) * speed;
+                                       if( end > len ) end = len;
+                                       int k = end - in;
+                                       double sample = 0;
+                                       while( in < end ) sample += current_buffer[in++];
+                                       if( k > 0 ) sample /= k;
                                        current_buffer[out++] = sample;
                                }
                                real_output_len = out;
                        }
-                       else
-                       if(renderengine->command->get_speed() < 1)
-                       {
-// number of samples to skip
-                               int interpolate_len = (int)(1.0 / renderengine->command->get_speed());
-                               real_output_len = len * interpolate_len;
-
-                               for(in = len - 1, out = real_output_len - 1; in >= 0; )
-                               {
-                                       for(k = 0; k < interpolate_len; k++)
-                                       {
-                                               current_buffer[out--] = current_buffer[in];
-                                       }
-                                       in--;
+                       else if( speed < 1 ) {
+                               int end = len / speed;
+                               real_output_len = end;
+                               for( int in=len, out=end; --in>=0; ) {
+// samples rendered in real output buffer sample.
+                                       int start = in / speed;
+                                       double v = current_buffer[in];
+                                       while( --out >= start ) current_buffer[out] = v;
                                }
                        }
                        else
@@ -257,53 +237,23 @@ if(debug) printf("VirtualAConsole::process_buffer %d\n", __LINE__);
                }
 
 // Wait until video is ready
-               if(arender->first_buffer)
-               {
+               if( arender->first_buffer ) {
                        renderengine->first_frame_lock->lock("VirtualAConsole::process_buffer");
                        arender->first_buffer = 0;
                }
-               if(!renderengine->audio->get_interrupted())
-               {
+               if( !renderengine->audio->get_interrupted() ) {
                        renderengine->audio->write_buffer(audio_out_packed, audio_channels,
                                real_output_len);
                }
 
-               if(renderengine->audio->get_interrupted()) interrupt = 1;
+               if( renderengine->audio->get_interrupted() )
+                       interrupt = 1;
        }
 
-if(debug) printf("VirtualAConsole::process_buffer %d\n", __LINE__);
-
-
-
-
-
        return result;
 }
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 int VirtualAConsole::init_rendering(int duplicate)
 {
        return 0;
index dce291fdd51d4198d7f17b2ef4096e4466204d30..29c8c53b44c7d4829f64743c69a91ed387e67341 100644 (file)
@@ -7,7 +7,7 @@
        <title></title>
        <meta name="generator" content="LibreOffice 5.2.7.2 (Linux)"/>
        <meta name="created" content="00:00:00"/>
-       <meta name="changed" content="2019-07-08T19:40:27.221227659"/>
+       <meta name="changed" content="2019-11-18T19:40:27.221227659"/>
        
        <style type="text/css">
                body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small }
                <td align="left"><font face="Liberation Serif" size=4>Alt-r</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Bring up Proxy settings window</font></td>
        </tr>
+       <tr>
+               <td height="26" align="right"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Convert</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Alt-e</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Bring up the Convert menu</font></td>
+       </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Save settings</font></td>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Mid. click+drag</font></td>
                <td align="left"><font face="Liberation Serif" size=4><br></font></td>
-               <td align="left"><font face="Liberation Serif" size=4>If zoom in, pans the view</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Pans the view/moves the image</font></td>
+       </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Middle mouse</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Shift</font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Returns to Auto zoom</font></td>
        </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Zooms in</font></td>
        </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Mouse wheel up</font></td>
+               <td align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Zooms in</font></td>
+       </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Lt clk Zoom</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Ctrl</font></td>
                <td align="left"><font face="Liberation Serif" size=4>Zooms out </font></td>
        </tr>
+       <tr>
+               <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Mouse wheel dn</font></td>
+               <td align="left"><font face="Liberation Serif" size=4><br></font></td>
+               <td align="left"><font face="Liberation Serif" size=4>Zooms out</font></td>
+       </tr>
        <tr>
                <td height="26" align="left"><font face="Liberation Serif" size=4><br></font></td>
                <td align="left"><font face="Liberation Serif" size=4>Lt clk Zoom</font></td>
index f67f7181c4b59a753c1501599fbc9f831f0cbd02..780acc882176bcdd031eab150cf1a561d486591f 100644 (file)
@@ -19,4 +19,4 @@ b-pyramid=strict
 bufsize=30000000
 maxrate=40000000
 refs=3
-x264opts cabac=1:keyint=24
+x264-params cabac=1:keyint=24
index 4271cd627855a4ed225c30bc3bd7c70827e475f9..4e131f9a2614fc3bac7eadf95e16cbb2e13a3252 100644 (file)
@@ -12,4 +12,4 @@ profile=high422
 preset=medium
 pixel_format=yuv422p
 flags=+cgop
-x264opts keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8
+x264-params keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8
index 9e7d6151f38948e9f975a7e793f5a552cbee4d39..0f08bf148f24ce21f0a304525ee467d4418075f9 100644 (file)
@@ -9,4 +9,4 @@ level=41
 bf=8
 refs=4
 # use framerate for 1 keyframe/sec, needed for seeks
-x264opts cabac=1:me_range=24:bframes=8:keyint=60:keyint_min=25:qpmin=0:qpmax=69:qpstep=4
+x264-params cabac=1:me_range=24:bframes=8:keyint=60:keyint_min=25:qpmin=0:qpmax=69:qpstep=4
index 53f9b438d010e900400557ea83b21bd553c3ada6..8941ef7af8ada7baa44a8d1034b84bd02f9f2632 100644 (file)
@@ -1,4 +1,4 @@
 fqt libx264
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=25
-x264opts keyint=25
+x264-params keyint=25
index 8f7e7010dfb0cb3dca350cde138587efd611a880..bb66e790a0998c9ecde4df8558aae0a32baa550c 100644 (file)
@@ -3,4 +3,4 @@ cin_pix_fmt=yuv420p10le
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=25
 profile=high10
-x264opts keyint=25
+x264-params keyint=25
index 94d66a89566b12c3bbd5f74c9b4deecc79d54a07..59389368d4f9f00a32a630f0bda3211d8a556f51 100644 (file)
@@ -3,4 +3,4 @@ profile=baseline
 level=3.0
 preset=medium
 keyint_min=25
-x264opts keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8
+x264-params keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8
index 64b05ba004d9d6e36c74892ffa73e20c5e710d3b..8b04e3e64c817cbf62d3efb18040fef2d2a512a2 100644 (file)
@@ -1,4 +1,4 @@
 mp4 libx264
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=25
-x264opts keyint=25
+x264-params keyint=25
index 612d9c4c183cdf87cfef68935dff1acc69a20f0d..e5fb91dbcae260da450436f9b6d3185204265e84 100644 (file)
@@ -5,4 +5,4 @@ b=10000k
 profile=high
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=24
-x264opts keyint=24
+x264-params keyint=24
index 85f8f8f4f91a1941b302e7b6ddef560e20ab7197..900879a873def1968164296009e6c08812c86d73 100644 (file)
@@ -5,4 +5,4 @@ passlogfile /tmp/2passes_h264.log
 b=2600k
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=25
-x264opts keyint=25
+x264-params keyint=25
index 25c7dd1983105b13ea4b10bb83289ee011a0aa55..8eb33667b0c0407d5301b61b422d714952069402 100644 (file)
@@ -5,4 +5,4 @@ passlogfile /tmp/2passes_h264.log
 b=2600k
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=25
-x264opts keyint=25
+x264-params keyint=25
index 007eb43df53c34d5ec718d9630e308da6350f30b..f0038fb24254edc3f595d00c97ee156089b09926 100644 (file)
@@ -5,4 +5,4 @@ b=2500k
 profile=high
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=24
-x264opts keyint=24
+x264-params keyint=24
index 5d83b5f7ca16e515513f316f72b6cd2fb7df3154..f3bdbeb1ec0d95721288085813dc43442489ee39 100644 (file)
@@ -5,4 +5,4 @@ b=80000k
 profile=high
 # use framerate for 1 keyframe/sec, needed for seeks
 keyint_min=24
-x264opts keyint=24
+x264-params keyint=24
index db41439c28cde43170255a74809463df78f17520..01b53132b6427ed7df2f6ab1af9b5a5824841956 100644 (file)
@@ -15,5 +15,4 @@ colorspace=bt709
 color_trc=bt709
 color_primaries=bt709
 flags=+cgop
-# must be last for bdcreate.C
-x264opts keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8
+x264-params keyint=25:min-keyint=4:qpmin=3:qpmax=33:qp_step=4:merange=8