diff --git a/transcode.c b/transcode.c index 24770b576a5a16b5bef92e3ad6d0ec172ad7a79b..07143a31c6ae75a755f25abf160337742ccac987 100644 --- a/transcode.c +++ b/transcode.c @@ -248,7 +248,7 @@ void connect_pads(AVFilterInOut **ins, AVFilterInOut **outs) int main(int argc, char *argv[]) { int err, i, progress, _progress; - char *p, *input, *output, *inpath, *outpath, *tmppath; + char *p, *input, *output, *inpath, *outpath, *tmppath, *oldsrcpath; AVFormatContext *demux, *mux; AVCodecContext **decs, **encs; AVFilterContext **srcs, **sinks; @@ -276,7 +276,11 @@ int main(int argc, char *argv[]) output = jlookup(argv[4], "output"); outpath = buildpath(getenv(WORKER_RELEASED), jstr(jlookup(output, "path"), 0)); tmppath = mprintf("%s/.tmp-%i", getenv(WORKER_TMP), jobid); - overwrite_check(outpath, inpath, jstr(jlookup(input, "hash"), "")); + if (oldsrcpath = jstr(jlookup(argv[4], "srcpath"), 0)) + oldsrcpath = buildpath(getenv(WORKER_RAW), oldsrcpath); + else + oldsrcpath = "/var/empty/nosource"; + overwrite_check(outpath, oldsrcpath, jstr(jlookup(argv[4], "srchash"), "")); demux = 0; opts = 0; @@ -361,7 +365,7 @@ int main(int argc, char *argv[]) avio_closep(&mux->pb); if (!filesize(tmppath)) job_failed("Sanity check failed: Output file is empty"); - overwrite_check(outpath, 0, 0); + overwrite_check(outpath, oldsrcpath, jstr(jlookup(argv[4], "srchash"), "")); if (rename(tmppath, outpath)) job_failed("Overwriting output file \"%s\" failed: %s", outpath, strerror(errno)); unlink(tmppath);