From: Good Guy Date: Mon, 12 Feb 2018 00:58:46 +0000 (-0700) Subject: audio wave icons, viewer wave image, 7 lib updates, tweak file size X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=418e8644335db47143bc421f11be2c2e68901d45;p=goodguy%2Fhistory.git audio wave icons, viewer wave image, 7 lib updates, tweak file size --- diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 6c640328..68886913 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -23,6 +23,7 @@ #include "assetedit.h" #include "assetpopup.h" #include "assets.h" +#include "audiodevice.h" #include "awindowgui.h" #include "awindow.h" #include "bccmodels.h" @@ -98,9 +99,36 @@ AssetVIcon::~AssetVIcon() VFrame *AssetVIcon::frame() { + Asset *asset = (Asset *)picon->indexable; + if( !asset->video_data && audio_data && audio_size && length > 0 ) { + if( !temp ) temp = new VFrame(0, -1, vw, vh, BC_RGB888, -1); + temp->clear_frame(); + int sample_rate = asset->get_sample_rate(); + int64_t audio_samples = asset->get_audio_samples(); + double duration = (double)audio_samples / sample_rate; + picon->draw_hue_bar(temp, duration); + int secs = length / frame_rate + 0.5; + if( !secs ) secs = 1; + int bfrsz = VICON_SAMPLE_RATE; + int samples = audio_size/sizeof(vicon_audio_t); + double line_pos = (double)seq_no/(length-1); + int audio_pos = samples * line_pos * (secs-1)/secs; + vicon_audio_t *audio_data = ((vicon_audio_t *)this->audio_data) + audio_pos; + static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1; + double data[bfrsz], sample_scale = 1./mx; + int len = samples - audio_pos; + if( len > bfrsz ) len = bfrsz; + int i = 0; + while( i < len ) data[i++] = *audio_data++ * sample_scale; + while( i < bfrsz ) data[i++] = 0; + picon->draw_wave(temp, data, bfrsz, RED, GREEN); + int x = (vw-1) * line_pos; + temp->pixel_rgb = RED; + temp->draw_line(x,0, x,vh); + return temp; + } if( seq_no >= images.size() ) { MWindow *mwindow = picon->mwindow; - Asset *asset = (Asset *)picon->indexable; File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1); if( !file ) return 0; if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) { @@ -139,6 +167,120 @@ int AssetVIcon::get_vy() return lbox->get_item_y(picon) + lbox->get_title_h(); } +void AssetVIcon::load_audio() +{ + MWindow *mwindow = picon->mwindow; + Asset *asset = (Asset *)picon->indexable; + File *file = mwindow->audio_cache->check_out(asset, mwindow->edl, 1); + int channels = asset->get_audio_channels(); + if( channels > 2 ) channels = 2; + int sample_rate = asset->get_sample_rate(); + int bfrsz = sample_rate; + Samples samples(bfrsz); + double time_scale = (double)sample_rate / VICON_SAMPLE_RATE; + vicon_audio_t *audio_data = (vicon_audio_t *)this->audio_data; + static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1; + double sample_scale = (double)mx / channels; + int audio_pos = 0, audio_len = audio_size/sizeof(vicon_audio_t); + while( audio_pos < audio_len ) { + int64_t pos = audio_pos * time_scale; + for( int ch=0; chset_channel(ch); + file->set_audio_position(pos); + file->read_samples(&samples, bfrsz); + double *data = samples.get_data(); + for( int64_t k=audio_pos; k= bfrsz ) break; + int v = audio_data[k] + data[i] * sample_scale; + audio_data[k] = CLIP(v, -mx,mx); + } + } + audio_pos = (pos + bfrsz) / time_scale; + } + mwindow->audio_cache->check_in(asset); +} + + +AssetVIconAudio::AssetVIconAudio(AWindowGUI *gui) + : Thread(1, 0, 0) +{ + this->gui = gui; + audio = new AudioDevice(gui->mwindow); + interrupted = 0; + vicon = 0; +} +AssetVIconAudio::~AssetVIconAudio() +{ + delete audio; +} + +void AssetVIconAudio::run() +{ + int channels = 2; + int64_t bfrsz = VICON_SAMPLE_RATE; + MWindow *mwindow = gui->mwindow; + EDL *edl = mwindow->edl; + EDLSession *session = edl->session; + AudioOutConfig *aconfig = session->playback_config->aconfig; + audio->open_output(aconfig, VICON_SAMPLE_RATE, bfrsz, channels, 0); + audio->start_playback(); + double out0[bfrsz], out1[bfrsz], *out[2] = { out0, out1 }; + vicon_audio_t *audio_data = (vicon_audio_t *)vicon->audio_data; + static const int mx = (1<<(8*sizeof(*audio_data)-1)) - 1; + + int audio_len = vicon->audio_size/sizeof(vicon_audio_t); + while( !interrupted ) { + int len = audio_len - audio_pos; + if( len <= 0 ) break; + if( len > bfrsz ) len = bfrsz; + int k = audio_pos; + for( int i=0; iwrite_buffer(out, channels, len); + } + + if( !interrupted ) + audio->set_last_buffer(); + audio->stop_audio(interrupted ? 0 : 1); + audio->close_all(); +} + +void AssetVIconAudio::start(AssetVIcon *vicon) +{ + if( running() ) return; + interrupted = 0; + audio_pos = 0; + this->vicon = vicon; + Thread::start(); +} + +void AssetVIconAudio::stop(int wait) +{ + if( running() && !interrupted ) { + interrupted = 1; + audio->stop_audio(wait); + } + Thread::join(); + if( vicon ) { + vicon->playing_audio = 0; + vicon = 0; + } +} + +void AssetVIcon::start_audio() +{ + picon->gui->vicon_audio->stop(0); + playing_audio = 1; + picon->gui->vicon_audio->start(this); +} + +void AssetVIcon::stop_audio() +{ + picon->gui->vicon_audio->stop(0); + playing_audio = 0; +} AssetPicon::AssetPicon(MWindow *mwindow, AWindowGUI *gui, Indexable *indexable) @@ -212,6 +354,26 @@ AssetPicon::~AssetPicon() } } +void AssetPicon::draw_hue_bar(VFrame *frame, double duration) +{ + float t = duration > 1 ? (log(duration) / log(3600.f)) : 0; + if( t > 1 ) t = 1; + float h = 300 * t, s = 1., v = 1.; + float r, g, b; // duration, 0..1hr == hue red..magenta + HSV::hsv_to_rgb(r,g,b, h,s,v); + int ih = frame->get_h()/8, iw = frame->get_w(); + int ir = r * 256; CLAMP(ir, 0,255); + int ig = g * 256; CLAMP(ig, 0,255); + int ib = b * 256; CLAMP(ib, 0,255); + unsigned char **rows = frame->get_rows(); + for( int y=0; yget_w(), h = frame->get_h(); @@ -303,7 +465,7 @@ void AssetPicon::create_objects() file->read_frame(gui->temp_picon); mwindow->video_cache->check_in(asset); - gui->lock_window("AssetPicon::create_objects 1"); + gui->lock_window("AssetPicon::create_objects 0"); icon = new BC_Pixmap(gui, pixmap_w, pixmap_h); icon->draw_vframe(gui->temp_picon, 0, 0, pixmap_w, pixmap_h, 0, 0); @@ -319,6 +481,13 @@ void AssetPicon::create_objects() if( secs > 5 ) secs = 5; int64_t length = secs * gui->vicon_thread->refresh_rate; vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length); + if( asset->audio_data && secs > 0 ) { + gui->unlock_window(); + int audio_len = VICON_SAMPLE_RATE*secs+0.5; + vicon->init_audio(audio_len*sizeof(vicon_audio_t)); + vicon->load_audio(); + gui->lock_window("AssetPicon::create_objects 1"); + } gui->vicon_thread->add_vicon(vicon); } @@ -353,36 +522,32 @@ void AssetPicon::create_objects() int sample_rate = asset->get_sample_rate(); int channels = asset->get_audio_channels(); if( channels > 2 ) channels = 2; - int64_t length = asset->get_audio_samples(); - double duration = (double)length / sample_rate; - float t = duration > 1 ? (logf(duration) / logf(3600.f)) : 0; - if( t > 1 ) t = 1; - float h = 300 * t, s = 1., v = 1.; - float r, g, b; // duration, 0..1hr == hue red..magenta - HSV::hsv_to_rgb(r,g,b, h,s,v); - int ih = icon_vframe->get_h()/8, iw = icon_vframe->get_w(); - int ir = r * 256; CLAMP(ir, 0,255); - int ig = g * 256; CLAMP(ig, 0,255); - int ib = b * 256; CLAMP(ib, 0,255); - unsigned char **rows = icon_vframe->get_rows(); - for( int y=0; yget_audio_samples(); + double duration = (double)audio_samples / sample_rate; + draw_hue_bar(icon_vframe, duration); + int bfrsz = sample_rate; + Samples samples(bfrsz); static int line_colors[2] = { GREEN, YELLOW }; static int base_colors[2] = { RED, PINK }; for( int i=channels; --i>=0; ) { file->set_channel(i); file->set_audio_position(0); - file->read_samples(&samples, length); - draw_wave(icon_vframe, samples.get_data(), length, + file->read_samples(&samples, bfrsz); + draw_wave(icon_vframe, samples.get_data(), bfrsz, base_colors[i], line_colors[i]); } mwindow->audio_cache->check_in(asset); + if( asset->awindow_folder == AW_MEDIA_FOLDER ) { + double secs = duration; + if( secs > 5 ) secs = 5; + double refresh_rate = gui->vicon_thread->refresh_rate; + int64_t length = secs * refresh_rate; + vicon = new AssetVIcon(this, pixmap_w, pixmap_h, refresh_rate, length); + int audio_len = VICON_SAMPLE_RATE*secs+0.5; + vicon->init_audio(audio_len*sizeof(vicon_audio_t)); + vicon->load_audio(); + gui->vicon_thread->add_vicon(vicon); + } gui->lock_window("AssetPicon::create_objects 4"); icon = new BC_Pixmap(gui, pixmap_w, pixmap_h); icon->draw_vframe(icon_vframe, @@ -529,6 +694,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow) allow_iconlisting = 1; remove_plugin = 0; vicon_thread = 0; + vicon_audio = 0; vicon_drawing = 1; displayed_folder = AW_NO_FOLDER; } @@ -545,6 +711,7 @@ AWindowGUI::~AWindowGUI() displayed_assets[1].remove_all_objects(); delete vicon_thread; + delete vicon_audio; delete newfolder_thread; delete asset_menu; @@ -715,6 +882,7 @@ void AWindowGUI::create_objects() vicon_thread = new VIconThread(asset_list); vicon_thread->start(); + vicon_audio = new AssetVIconAudio(this); add_subwindow(divider = new AWindowDivider(mwindow, this, mwindow->theme->adivider_x, mwindow->theme->adivider_y, @@ -1714,7 +1882,8 @@ int AWindowAssets::selection_changed() BC_ListBox::deactivate_selection(); return 1; } - else if( get_button_down() && get_buttonpress() == 1 && + else if( gui->vicon_drawing && + get_button_down() && get_buttonpress() == 1 && (item = (AssetPicon*)get_selection(0, 0)) ) { VIcon *vicon = 0; if( !gui->vicon_thread->viewing ) { diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index 985b4a0e..703c9764 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -27,6 +27,7 @@ #include "assetpopup.inc" #include "asset.inc" #include "assets.inc" +#include "audiodevice.inc" #include "awindow.inc" #include "awindowgui.inc" #include "clippopup.inc" @@ -55,7 +56,8 @@ public: void create_objects(); void reset(); - void draw_wave(VFrame *frame, double *dp, int len, + static void draw_hue_bar(VFrame *frame, double t); + static void draw_wave(VFrame *frame, double *dp, int len, int base_color, int line_color); MWindow *mwindow; @@ -81,6 +83,25 @@ public: VIcon *vicon; }; +typedef int16_t vicon_audio_t; + +class AssetVIconAudio : public Thread +{ +public: + AssetVIconAudio(AWindowGUI *gui); + ~AssetVIconAudio(); + + void run(); + void start(AssetVIcon *vicon); + void stop(int wait); + + AWindowGUI *gui; + AudioDevice *audio; + AssetVIcon *vicon; + int interrupted; + int audio_pos; +}; + class AssetVIcon : public VIcon { public: AssetPicon *picon; @@ -91,6 +112,9 @@ public: int64_t set_seq_no(int64_t no); int get_vx(); int get_vy(); + void load_audio(); + void start_audio(); + void stop_audio(); AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length); ~AssetVIcon(); @@ -241,6 +265,7 @@ public: // Temporary for reading picons from files VFrame *temp_picon; VIconThread *vicon_thread; + AssetVIconAudio *vicon_audio; int64_t plugin_visibility; AWindowRemovePlugin *remove_plugin; diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index db6312bc..d5bd045f 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -19,10 +19,12 @@ * */ +#include "arender.h" #include "asset.h" #include "assets.h" #include "awindowgui.h" #include "awindow.h" +#include "cache.h" #include "canvas.h" #include "clip.h" #include "clipedit.h" @@ -44,9 +46,12 @@ #include "mwindow.h" #include "playtransport.h" #include "preferences.h" +#include "renderengine.h" +#include "samples.h" #include "theme.h" #include "timebar.h" #include "tracks.h" +#include "transportque.h" #include "vframe.h" #include "vplayback.h" #include "vtimebar.h" @@ -91,6 +96,47 @@ VWindowGUI::~VWindowGUI() // delete source; } +void VWindowGUI::draw_wave() +{ + TransportCommand command; + command.command = NORMAL_FWD; + command.get_edl()->copy_all(vwindow->get_edl()); + command.change_type = CHANGE_ALL; + command.realtime = 0; + RenderEngine *render_engine = new RenderEngine(0, mwindow->preferences, 0, 0); + CICache *cache = new CICache(mwindow->preferences); + render_engine->set_acache(cache); + render_engine->arm_command(&command); + + double duration = 1.; + int w = mwindow->edl->session->output_w; + int h = mwindow->edl->session->output_h; + VFrame *vframe = new VFrame(w, h, BC_RGB888); + int sample_rate = mwindow->edl->get_sample_rate(); + int channels = mwindow->edl->session->audio_channels; + if( channels > 2 ) channels = 2; + int64_t bfrsz = sample_rate * duration; + Samples *samples[MAXCHANNELS]; + int ch = 0; + while( ch < channels ) samples[ch++] = new Samples(bfrsz); + while( ch < MAXCHANNELS ) samples[ch++] = 0; + render_engine->arender->process_buffer(samples, bfrsz, 0); + + static int line_colors[2] = { GREEN, YELLOW }; + static int base_colors[2] = { RED, PINK }; + for( int i=channels; --i>=0; ) { + AssetPicon::draw_wave(vframe, samples[i]->get_data(), bfrsz, + base_colors[i], line_colors[i]); + } + + for( int i=channels; --i>=0; ) delete samples[i]; + delete render_engine; + delete cache; + delete canvas->refresh_frame; + canvas->refresh_frame = vframe; + canvas->draw_refresh(1); +} + void VWindowGUI::change_source(EDL *edl, const char *title) { //printf("VWindowGUI::change_source %d\n", __LINE__); @@ -105,6 +151,10 @@ void VWindowGUI::change_source(EDL *edl, const char *title) lock_window("VWindowGUI::change_source"); canvas->clear(); + if( edl && + !edl->tracks->playable_video_tracks() && + edl->tracks->playable_audio_tracks() ) + draw_wave(); timebar->update(0); set_title(string); unlock_window(); diff --git a/cinelerra-5.1/cinelerra/vwindowgui.h b/cinelerra-5.1/cinelerra/vwindowgui.h index 039067e9..da10c484 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.h +++ b/cinelerra-5.1/cinelerra/vwindowgui.h @@ -72,6 +72,7 @@ public: // void update_labels(); // void update_points(); void update_meters(); + void draw_wave(); MWindow *mwindow; VWindow *vwindow; diff --git a/cinelerra-5.1/configure.ac b/cinelerra-5.1/configure.ac index 70326a93..ff203afe 100644 --- a/cinelerra-5.1/configure.ac +++ b/cinelerra-5.1/configure.ac @@ -148,7 +148,7 @@ if test "x$WANT_GIT_FFMPEG" != "xno" ; then fi PKG_3RD([fftw],[auto], - [fftw-3.3.6-pl2], + [fftw-3.3.7], [ .libs/libfftw3.a \ libbench2/libbench2.a \ rdft/scalar/r2cb/.libs/librdft_scalar_r2cb.a \ @@ -162,8 +162,7 @@ PKG_3RD([fftw],[auto], dft/scalar/.libs/libdft_scalar.a \ dft/.libs/libdft.a \ kernel/.libs/libkernel.a \ - simd-support/.libs/libsimd_support.a \ - simd-support/.libs/libsimd_sse2_nonportable.a ], + simd-support/.libs/libsimd_support.a ], [ api ]) PKG_3RD([flac],[auto], @@ -184,7 +183,7 @@ PKG_3RD([giflib],[yes], [ lib ]) PKG_3RD([ilmbase],[auto], - [ilmbase-2.2.0], + [ilmbase-2.2.1], [ Iex/.libs/libIex.a \ IexMath/.libs/libIexMath.a \ Half/.libs/libHalf.a \ @@ -195,7 +194,7 @@ PKG_3RD([ilmbase],[auto], PKG_DEF([ladspa], [ladspa-0.4.17], [], []) PKG_3RD([lame],[auto], - [lame-3.99.5], + [lame-3.100], [ libmp3lame/.libs/libmp3lame.a \ mpglib/.libs/libmpgdecoder.a ], [ include ]) @@ -283,7 +282,7 @@ PKG_3RD([mjpegtools],[yes], [ . lavtools utils ]) PKG_3RD([openexr],[auto], - [openexr-2.2.0], + [openexr-2.2.1], [ IlmImf/.libs/libIlmImf.a \ IlmImfUtil/.libs/libIlmImfUtil.a ], [ IlmImf config ]) @@ -298,7 +297,7 @@ PKG_3RD([openexr],[auto], # []) # PKG_3RD([tiff],[auto], - [tiff-4.0.6], + [tiff-4.0.9], [ libtiff/.libs/libtiff.a \ libtiff/.libs/libtiffxx.a \ port/.libs/libport.a ],[ @@ -310,12 +309,12 @@ PKG_3RD([twolame],[auto], [ libtwolame ]) PKG_3RD([x264],[auto], - [x264-snapshot-20170426-2245], + [x264-snapshot-20180118-2245], [ libx264.a ], [ . ]) PKG_3RD([x265],[auto], - [x265_2.5], + [x265_v2.6], [ libx265.a ], [ . source ]) diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index e050bfe3..22afff8e 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -781,6 +781,12 @@ static inline int64_t ipow(int m, int n) for( int64_t vv=m; n>0; vv*=vv,n>>=1 ) if( n & 1 ) v *= vv; return v; } +static inline int ilen(int64_t v) +{ + int len = 1; + while( len<16 && (v/=10)>0 ) ++len; + return len; +} int BC_FileBox::create_tables() { @@ -817,21 +823,23 @@ int BC_FileBox::create_tables() static const long double kk = logl(1000.)/logl(1024.); size = expl(kk*logl((long double)size)) + 0.5; } - int len = 1; - for( int64_t s=size; len<16 && (s/=10)>0; ++len ); - int drop = len-3; + int len = ilen(size), drop = len-3, round = 1; + if( round && drop > 0 ) { //round + size += ipow(10,drop)/2; + len = ilen(size); drop = len-3; + } size /= ipow(10,drop); int sfx = (len-1)/3; int digits = (sfx+1)*3 - len; int64_t frac = ipow(10,digits); int mant = size / frac; int fraction = size - mant*frac; - if( fraction ) - sprintf(string, "%d.%0*d%s", - mant, digits, fraction, suffix[sfx]); + sfx = *suffix[sfx]; + if( sfx && size_format == FILEBOX_SIZE_1000 ) sfx += 'a'-'A'; + if( digits ) + sprintf(string, "%d.%0*d%c", mant, digits, fraction, sfx); else - sprintf(string, "%d%s", - mant, suffix[sfx]); + sprintf(string, "%d%c", mant, sfx); } else { sprintf(string, "%jd", size); diff --git a/cinelerra-5.1/guicast/vicon.C b/cinelerra-5.1/guicast/vicon.C index 92986663..031e9530 100644 --- a/cinelerra-5.1/guicast/vicon.C +++ b/cinelerra-5.1/guicast/vicon.C @@ -13,17 +13,22 @@ VIcon(int vw, int vh, double rate) this->vw = vw; this->vh = vh; this->frame_rate = rate; - this->cycle_start = 0; - this->age = 0; - this->seq_no = 0; - this->in_use = 1; - this->hidden = 0; + + cycle_start = 0; + age = 0; + seq_no = 0; + in_use = 1; + hidden = 0; + audio_data = 0; + audio_size = 0; + playing_audio = 0; } VIcon:: ~VIcon() { clear_images(); + delete [] audio_data; } void VIcon:: @@ -207,6 +212,8 @@ int VIconThread::del_vicon(VIcon *&vicon) void VIconThread::set_view_popup(VIcon *vicon) { + if( !vicon && this->vicon ) + this->vicon->stop_audio(); this->vicon = vicon; } @@ -218,6 +225,7 @@ update_view() VFrame *frame = viewing->frame(); view_win = new_view_window(frame); view_win->show_window(); + vicon->start_audio(); } wdw->set_active_subwindow(view_win); return 1; @@ -278,7 +286,11 @@ run() now = timer->get_difference(); if( now >= draw_flash ) break; draw(next); - if( !next->seq_no ) next->cycle_start = now; + if( !next->seq_no ) { + next->cycle_start = now; + if( next->playing_audio ) + next->start_audio(); + } int64_t ref_no = (now - next->cycle_start) / 1000. * refresh_rate; int count = ref_no - next->seq_no; if( count < 1 ) count = 1; @@ -319,6 +331,14 @@ run() } } + +void VIcon::init_audio(int audio_size) +{ + this->audio_size = audio_size; + audio_data = new uint8_t[audio_size]; + memset(audio_data, 0, audio_size); +} + void VIcon::dump(const char *dir) { mkdir(dir,0777); diff --git a/cinelerra-5.1/guicast/vicon.h b/cinelerra-5.1/guicast/vicon.h index bbb0549a..59758bab 100644 --- a/cinelerra-5.1/guicast/vicon.h +++ b/cinelerra-5.1/guicast/vicon.h @@ -41,16 +41,22 @@ public: ArrayList images; int64_t seq_no; double cycle_start, age, frame_rate; + int audio_size, playing_audio; + uint8_t *audio_data; int64_t vframes() { return images.size(); } void reset() { seq_no = 0; cycle_start = 0; age = 0; } void reset(double rate) { reset(); frame_rate = rate; } void clear_images() { images.remove_all_objects(); } + void init_audio(int audio_size); virtual int64_t set_seq_no(int64_t no) { return seq_no = no; } virtual VFrame *frame() { return *images[seq_no]; } virtual int get_vx() { return 0; } virtual int get_vy() { return 0; } + virtual void load_audio() {} + virtual void start_audio() {} + virtual void stop_audio() {} void add_image(VFrame *frm, int ww, int hh, int vcmdl); void draw_vframe(BC_WindowBase *wdw, int x, int y); diff --git a/cinelerra-5.1/guicast/vicon.inc b/cinelerra-5.1/guicast/vicon.inc index f105e480..21a59a10 100644 --- a/cinelerra-5.1/guicast/vicon.inc +++ b/cinelerra-5.1/guicast/vicon.inc @@ -4,6 +4,7 @@ #define VICON_WIDTH 80 #define VICON_HEIGHT 45 #define VICON_RATE 24 +#define VICON_SAMPLE_RATE 44100 class ViewWindow; class VIconThread; diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch4 b/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch4 new file mode 100644 index 00000000..e218ae5a --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch4 @@ -0,0 +1,110 @@ +--- a/libavcodec/libx264.c 2017-12-10 14:35:08.000000000 -0700 ++++ b/libavcodec/libx264.c 2018-02-08 16:57:46.028108824 -0700 +@@ -279,7 +279,11 @@ + + x264_picture_init( &x4->pic ); + x4->pic.img.i_csp = x4->params.i_csp; ++#if X264_BUILD >= 153 ++ if (x4->params.i_bitdepth > 8) ++#else + if (x264_bit_depth > 8) ++#endif + x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; + x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt); + +@@ -490,6 +494,9 @@ + x4->params.p_log_private = avctx; + x4->params.i_log_level = X264_LOG_DEBUG; + x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); ++#if X264_BUILD >= 153 ++ x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; ++#endif + + PARSE_X264_OPT("weightp", wpredp); + +@@ -701,24 +708,8 @@ + if (x4->nal_hrd >= 0) + x4->params.i_nal_hrd = x4->nal_hrd; + +- if (x4->motion_est >= 0) { ++ if (x4->motion_est >= 0) + x4->params.analyse.i_me_method = x4->motion_est; +-#if FF_API_MOTION_EST +-FF_DISABLE_DEPRECATION_WARNINGS +- } else { +- if (avctx->me_method == ME_EPZS) +- x4->params.analyse.i_me_method = X264_ME_DIA; +- else if (avctx->me_method == ME_HEX) +- x4->params.analyse.i_me_method = X264_ME_HEX; +- else if (avctx->me_method == ME_UMH) +- x4->params.analyse.i_me_method = X264_ME_UMH; +- else if (avctx->me_method == ME_FULL) +- x4->params.analyse.i_me_method = X264_ME_ESA; +- else if (avctx->me_method == ME_TESA) +- x4->params.analyse.i_me_method = X264_ME_TESA; +-FF_ENABLE_DEPRECATION_WARNINGS +-#endif +- } + + if (x4->coder >= 0) + x4->params.b_cabac = x4->coder; +@@ -878,6 +869,24 @@ + AV_PIX_FMT_NV20, + AV_PIX_FMT_NONE + }; ++static const enum AVPixelFormat pix_fmts_all[] = { ++ AV_PIX_FMT_YUV420P, ++ AV_PIX_FMT_YUVJ420P, ++ AV_PIX_FMT_YUV422P, ++ AV_PIX_FMT_YUVJ422P, ++ AV_PIX_FMT_YUV444P, ++ AV_PIX_FMT_YUVJ444P, ++ AV_PIX_FMT_NV12, ++ AV_PIX_FMT_NV16, ++#ifdef X264_CSP_NV21 ++ AV_PIX_FMT_NV21, ++#endif ++ AV_PIX_FMT_YUV420P10, ++ AV_PIX_FMT_YUV422P10, ++ AV_PIX_FMT_YUV444P10, ++ AV_PIX_FMT_NV20, ++ AV_PIX_FMT_NONE ++}; + #if CONFIG_LIBX264RGB_ENCODER + static const enum AVPixelFormat pix_fmts_8bit_rgb[] = { + AV_PIX_FMT_BGR0, +@@ -889,12 +898,16 @@ + + static av_cold void X264_init_static(AVCodec *codec) + { ++#if X264_BUILD < 153 + if (x264_bit_depth == 8) + codec->pix_fmts = pix_fmts_8bit; + else if (x264_bit_depth == 9) + codec->pix_fmts = pix_fmts_9bit; + else if (x264_bit_depth == 10) + codec->pix_fmts = pix_fmts_10bit; ++#else ++ codec->pix_fmts = pix_fmts_all; ++#endif + } + + #define OFFSET(x) offsetof(X264Context, x) +@@ -958,6 +971,7 @@ + { "vbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, + { "cbr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR}, INT_MIN, INT_MAX, VE, "nal-hrd" }, + { "avcintra-class","AVC-Intra class 50/100/200", OFFSET(avcintra_class),AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 200 , VE}, ++ { "me_method", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"}, + { "motion-est", "Set motion estimation method", OFFSET(motion_est), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, X264_ME_TESA, VE, "motion-est"}, + { "dia", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_DIA }, INT_MIN, INT_MAX, VE, "motion-est" }, + { "hex", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = X264_ME_HEX }, INT_MIN, INT_MAX, VE, "motion-est" }, +@@ -1002,9 +1016,6 @@ + { "nr", "-1" }, + #endif + { "me_range", "-1" }, +-#if FF_API_MOTION_EST +- { "me_method", "-1" }, +-#endif + { "subq", "-1" }, + #if FF_API_PRIVATE_OPT + { "b_strategy", "-1" }, diff --git a/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch5 b/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch5 new file mode 100644 index 00000000..f7db4c30 --- /dev/null +++ b/cinelerra-5.1/thirdparty/src/ffmpeg-3.4.1.patch5 @@ -0,0 +1,61 @@ +--- a/libavcodec/libx265.c 2017-12-10 14:35:08.000000000 -0700 ++++ b/libavcodec/libx265.c 2018-02-08 16:57:46.028108824 -0700 +@@ -45,6 +45,7 @@ + int forced_idr; + char *preset; + char *tune; ++ char *profile; + char *x265_opts; + } libx265Context; + +@@ -114,11 +115,11 @@ + ctx->params->sourceHeight = avctx->height; + ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); + +- if ((avctx->color_primaries <= AVCOL_PRI_BT2020 && ++ if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 && + avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) || +- (avctx->color_trc <= AVCOL_TRC_BT2020_12 && ++ (avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 && + avctx->color_trc != AVCOL_TRC_UNSPECIFIED) || +- (avctx->colorspace <= AVCOL_SPC_BT2020_CL && ++ (avctx->colorspace <= AVCOL_SPC_ICTCP && + avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) { + + ctx->params->vui.bEnableVideoSignalTypePresentFlag = 1; +@@ -220,6 +221,18 @@ + } + } + ++ if (ctx->profile) { ++ if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) { ++ int i; ++ av_log(avctx, AV_LOG_ERROR, "Invalid or incompatible profile set: %s.\n", ctx->profile); ++ av_log(avctx, AV_LOG_INFO, "Possible profiles:"); ++ for (i = 0; x265_profile_names[i]; i++) ++ av_log(avctx, AV_LOG_INFO, " %s", x265_profile_names[i]); ++ av_log(avctx, AV_LOG_INFO, "\n"); ++ return AVERROR(EINVAL); ++ } ++ } ++ + ctx->encoder = ctx->api->encoder_open(ctx->params); + if (!ctx->encoder) { + av_log(avctx, AV_LOG_ERROR, "Cannot open libx265 encoder.\n"); +@@ -294,7 +307,7 @@ + for (i = 0; i < nnal; i++) + payload += nal[i].sizeBytes; + +- ret = ff_alloc_packet(pkt, payload); ++ ret = ff_alloc_packet2(avctx, pkt, payload, payload); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); + return ret; +@@ -392,6 +412,7 @@ + { "forced-idr", "if forcing keyframes, force them as IDR frames", OFFSET(forced_idr),AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, + { "preset", "set the x265 preset", OFFSET(preset), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { "tune", "set the x265 tune parameter", OFFSET(tune), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, ++ { "profile", "set the x265 profile", OFFSET(profile), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { "x265-params", "set the x265 configuration using a :-separated list of key=value parameters", OFFSET(x265_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { NULL } + }; diff --git a/cinelerra-5.1/thirdparty/src/fftw-3.3.6-pl2.tar.xz b/cinelerra-5.1/thirdparty/src/fftw-3.3.6-pl2.tar.xz deleted file mode 100644 index c6fe3715..00000000 Binary files a/cinelerra-5.1/thirdparty/src/fftw-3.3.6-pl2.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/fftw-3.3.7.tar.xz b/cinelerra-5.1/thirdparty/src/fftw-3.3.7.tar.xz new file mode 100644 index 00000000..7cb22173 Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/fftw-3.3.7.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/ilmbase-2.2.0.tar.xz b/cinelerra-5.1/thirdparty/src/ilmbase-2.2.0.tar.xz deleted file mode 100644 index d785ae71..00000000 Binary files a/cinelerra-5.1/thirdparty/src/ilmbase-2.2.0.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/ilmbase-2.2.1.tar.xz b/cinelerra-5.1/thirdparty/src/ilmbase-2.2.1.tar.xz new file mode 100644 index 00000000..026ee916 Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/ilmbase-2.2.1.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/lame-3.100.tar.xz b/cinelerra-5.1/thirdparty/src/lame-3.100.tar.xz new file mode 100644 index 00000000..2c25311b Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/lame-3.100.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/lame-3.99.5.tar.xz b/cinelerra-5.1/thirdparty/src/lame-3.99.5.tar.xz deleted file mode 100644 index 5c5bd8f0..00000000 Binary files a/cinelerra-5.1/thirdparty/src/lame-3.99.5.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/openexr-2.2.0.tar.xz b/cinelerra-5.1/thirdparty/src/openexr-2.2.1.tar.xz similarity index 62% rename from cinelerra-5.1/thirdparty/src/openexr-2.2.0.tar.xz rename to cinelerra-5.1/thirdparty/src/openexr-2.2.1.tar.xz index b712cc2c..80cc3d60 100644 Binary files a/cinelerra-5.1/thirdparty/src/openexr-2.2.0.tar.xz and b/cinelerra-5.1/thirdparty/src/openexr-2.2.1.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/tiff-4.0.6.tar.xz b/cinelerra-5.1/thirdparty/src/tiff-4.0.6.tar.xz deleted file mode 100644 index 17922574..00000000 Binary files a/cinelerra-5.1/thirdparty/src/tiff-4.0.6.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/tiff-4.0.9.tar.xz b/cinelerra-5.1/thirdparty/src/tiff-4.0.9.tar.xz new file mode 100644 index 00000000..529bf8e1 Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/tiff-4.0.9.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz b/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz deleted file mode 100644 index d5cfdd8e..00000000 Binary files a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.patch1 b/cinelerra-5.1/thirdparty/src/x264-snapshot-20180118-2245.patch1 similarity index 100% rename from cinelerra-5.1/thirdparty/src/x264-snapshot-20170426-2245.patch1 rename to cinelerra-5.1/thirdparty/src/x264-snapshot-20180118-2245.patch1 diff --git a/cinelerra-5.1/thirdparty/src/x264-snapshot-20180118-2245.tar.xz b/cinelerra-5.1/thirdparty/src/x264-snapshot-20180118-2245.tar.xz new file mode 100644 index 00000000..6cc5bd6c Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x264-snapshot-20180118-2245.tar.xz differ diff --git a/cinelerra-5.1/thirdparty/src/x265_2.5.tar.xz b/cinelerra-5.1/thirdparty/src/x265_2.5.tar.xz deleted file mode 100644 index 55e6976a..00000000 Binary files a/cinelerra-5.1/thirdparty/src/x265_2.5.tar.xz and /dev/null differ diff --git a/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz b/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz new file mode 100644 index 00000000..cc16d1b1 Binary files /dev/null and b/cinelerra-5.1/thirdparty/src/x265_v2.6.tar.xz differ