if( !templ ) templ = previous;
if( !templ && this->autos )
templ = this->autos->default_auto;
- if( templ )
+ if( templ ) {
+ int orig_id = this->orig_id;
copy_from(templ);
+ this->orig_id = orig_id;
+ }
position = new_position;
return 0;
}
int BRender::set_video_map(int64_t position, int value)
{
- int update_gui = 0;
+printf("BRender::set_video_map(%jd, %d)\n", position, value);
map_lock->lock("BRender::set_video_map");
-
if(value == BRender::NOT_SCANNED)
{
printf(_("BRender::set_video_map called to set NOT_SCANNED\n"));
}
-
-// Preroll
- if(position < 0)
- {
- ;
- }
- else
-// In range
- if(position < map_size)
- {
- map[position] = value;
- }
- else
-// Obsolete EDL
- {
+ if( position < 0) {} // Preroll
+ else if( position < map_size ) map[position] = value; // In range
+ else // Obsolete EDL
printf(_("BRender::set_video_map %jd: attempt to set beyond end of map %jd.\n"),
position, map_size);
- }
+ int update_gui = 0;
// Maintain last contiguous here to reduce search time
- if(position == last_contiguous && last_contiguous < map_size )
- {
- int i;
- for(i = position + 1; i < map_size && map[i]; i++)
- {
- ;
- }
- last_contiguous = i;
+ if( position == last_contiguous && last_contiguous < map_size ) {
+ while( last_contiguous < map_size && map[last_contiguous] )
+ ++last_contiguous;
+ if( last_contiguous >= map_size ) update_gui = 1;
mwindow->session->brender_end = (double)last_contiguous /
mwindow->edl->session->frame_rate;
- if(timer->get_difference() > 1000 || last_contiguous >= map_size)
- {
- update_gui = 1;
- timer->update();
- }
}
+ if( timer->get_difference() > 1000 )
+ update_gui = 1;
map_lock->unlock();
- if(update_gui)
- {
+ if( update_gui ) {
+ timer->update();
mwindow->gui->lock_window("BRender::set_video_map");
mwindow->gui->update_timebar(1);
mwindow->gui->unlock_window();
#include "preferences.inc"
#include "samples.inc"
#include "vframe.inc"
-#include "packagingengine.h"
// ======================================= include file types here
{
public:
File();
- ~File();
+ virtual ~File();
int probe();
// Get attributes for various file formats.
int bytes_per_sample(int bits); // Convert the bit descriptor into a byte count.
// get record stream file descriptor
int record_fd();
+// brender update video map
+ virtual int write_frame_done(int64_t position) { return 0; }
Asset *asset; // Copy of asset since File outlives EDL
FileBase *file; // virtual class for file type
#include "asset.h"
#include "arender.h"
#include "cache.h"
+#include "edl.h"
#include "filebase.h"
#include "file.h"
#include "fileref.h"
#include "asset.inc"
#include "cache.inc"
+#include "edl.inc"
#include "filebase.h"
#include "file.inc"
+#include "maxchannels.h"
#include "renderengine.inc"
#include "samples.inc"
#include "transportque.inc"
else
if(do_video)
{
- if(compressed)
- {
- for(j = 0; j < file->asset->layers && !result; j++)
- for(i = 0; i < output_size[local_buffer] && !result; i++)
- result = file->write_compressed_frame(video_buffer[local_buffer][j][i]);
+ int layers = 1, count = output_size[local_buffer];
+ VFrame ***frames = video_buffer[local_buffer];
+ if( compressed ) {
+ layers = file->asset->layers;
+ for( j=0; j<layers && !result; ++j )
+ for( i=0; i<count && !result; ++i )
+ result = file->write_compressed_frame(frames[j][i]);
}
else
- {
- result = file->write_frames(video_buffer[local_buffer],
- output_size[local_buffer]);
+ result = file->write_frames(frames, count);
+ if( !result ) {
+ for( j=0; j<layers && !result; ++j )
+ for( i=0; i<count && !result; ++i )
+ file->write_frame_done(frames[j][i]->get_number());
}
}
result->video_start = video_position;
result->audio_end = result->audio_start +
Units::to_int64(scaled_len * default_asset->sample_rate);
+ if( result->audio_end > audio_end ) result->audio_end = audio_end;
result->video_end = result->video_start +
Units::to_int64(scaled_len * default_asset->frame_rate);
- if(result->video_end == result->video_start) result->video_end++;
+ if( result->video_end > video_end ) result->video_end = video_end;
+ if( result->video_end == result->video_start ) result->video_end++;
audio_position = result->audio_end;
video_position = result->video_end;
result->audio_do = default_asset->audio_data;
}
+PackageFile::PackageFile(PackageRenderer *package_renderer)
+{
+ this->package_renderer = package_renderer;
+}
+PackageFile::~PackageFile()
+{
+}
-
-
+int PackageFile::write_frame_done(int64_t position)
+{
+ return package_renderer->set_video_map(position, BRender::RENDERED);
+}
// Used by RenderFarm and in the future, Render, to do packages.
else
strncpy(asset->path, package->path, sizeof(asset->path));
- file = new File;
+ file = new PackageFile(this);
file->set_processors(preferences->processors);
result = file->open_file(preferences, asset, 0, 1);
if( video_write_position >= video_write_length ) {
result = file->write_video_buffer(video_write_position);
-// Update the brender map after writing the files.
- if( package->use_brender ) {
- for( int i = 0; i < video_write_position && !result; i++ ) {
- result = set_video_map(video_position + 1 - video_write_position + i,
- BRender::RENDERED);
- }
- }
video_write_position = 0;
}
}
delete compressed_output;
if( video_write_position )
file->write_video_buffer(video_write_position);
- if( package->use_brender ) {
- for( int i = 0; i < video_write_position && !error; i++ ) {
- error = set_video_map(video_position - video_write_position + i,
- BRender::RENDERED);
- }
- }
video_write_position = 0;
if( !error ) file->stop_video_thread();
if( mwindow ) {
#include "cache.inc"
#include "edit.inc"
#include "edl.inc"
-#include "file.inc"
+#include "file.h"
#include "maxchannels.h"
#include "mwindow.inc"
+#include "packagerenderer.inc"
#include "playabletracks.inc"
#include "playbackconfig.inc"
#include "pluginserver.inc"
int audio_do;
};
+class PackageFile : public File
+{
+public:
+ PackageFile(PackageRenderer *package_renderer);
+ ~PackageFile();
+ int write_frame_done(int64_t position);
+
+ PackageRenderer *package_renderer;
+};
int64_t audio_position;
int64_t audio_preroll;
int64_t audio_read_length;
- File *file;
+ PackageFile *file;
// This is 1 if an error is encountered.
int result;
VFrame ***video_output;
#ifndef PACKAGERENDERER_INC
#define PACKAGERENDERER_INC
-
-
-class PackageRenderer;
class RenderPackage;
-
+class PackageFile;
+class PackageRenderer;
#endif
#include "file.h"
#include "language.h"
#include "theme.h"
+#include "transportque.inc"
#include "units.h"
#include <string.h>