Re: [Mplayerplug-in-devel] mplayerplug-in Save movie feature
Brought to you by:
kdekorte
From: Kevin D. <kde...@ya...> - 2004-07-06 23:01:01
|
Kareem, I have just commited a fix (hopefully) to CVS, give it a couple of hours to appear in anonymous CVS. I don't have my disk setup the way you do, so it is not easy to test, but hopefully this will fix it. Kevin Here is the patch RCS file: /cvsroot/mplayerplug-in/mplayerplug-in/Source/plugin-ui.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** plugin-ui.cpp 18 Jun 2004 20:00:39 -0000 1.88 --- plugin-ui.cpp 6 Jul 2004 22:56:56 -0000 1.89 *************** *** 242,246 **** if (0) { ! printf("Widget: %i\n", (int)w); printf("Message: %s\n", message); } --- 242,246 ---- if (0) { ! printf("Widget: %i\n", (int) w); printf("Message: %s\n", message); } *************** *** 1345,1350 **** --- 1345,1356 ---- char *filename; char newname[1024]; + char mmsplaylist[1024]; + FILE *playlist; + FILE *fin, *fout; + char buffer[1000]; + int count; Node *n, *lastplayed; + if (instance->mInitialized == FALSE) return; *************** *** 1370,1380 **** snprintf(newname, 1024, "%s/%s", instance->download_dir, filename); ! rename(lastplayed->fname, newname); ! snprintf(lastplayed->fname, 1024, "%s/%s", ! instance->download_dir, filename); ! lastplayed->remove = 0; } NPN_MemFree(filename); } } pthread_mutex_unlock(&(instance->playlist_mutex)); --- 1376,1409 ---- snprintf(newname, 1024, "%s/%s", instance->download_dir, filename); ! if (rename(lastplayed->fname, newname) == 0) { ! snprintf(lastplayed->fname, 1024, "%s/%s", ! instance->download_dir, filename); ! lastplayed->remove = 0; ! } else { ! // rename filed (probably cross partitions), copy the file ! fin = fopen(lastplayed->fname, "rb"); ! fout = fopen(newname, "wb"); ! if (fin != NULL && fout != NULL) { ! while (!feof(fin)) { ! count = fread(buffer, 1, 1000, fin); ! fwrite(buffer, 1, count, fout); ! } ! fclose(fout); ! fclose(fin); ! } ! } ! } NPN_MemFree(filename); } + if (lastplayed->mmsstream) { + snprintf(mmsplaylist, sizeof(mmsplaylist), + "%s/playlist", instance->download_dir); + playlist = fopen(mmsplaylist, "a"); + if (playlist != NULL) { + fprintf(playlist, "%s\n", instance->list->url); + fclose(playlist); + } + } } pthread_mutex_unlock(&(instance->playlist_mutex)); On Tuesday 06 July 2004 04:07 pm, Kevin DeKorte wrote: > Kareem, > > You are correct rename does not work across partitions. I guess I'll have > to look into a more complete solution to this. > > Kevin > > On Tuesday 06 July 2004 04:03 pm, Kareem Dana wrote: > > Kevin, > > > > I debugged the saving issue a bit. It seems the rename() call is > > returning an error everytime I try to save. I added some debugging > > output to menuitem_save_callback() right after the rename() call: > > > > error = rename(lastplayed->fname, newname); > > if (DEBUG > 1) { > > printf("lastplayed->fname: %s\n", lastplayed->fname); > > printf("newname: %s\n", newname); > > printf("error: %d\n", error); > > printf("errno: %d\n", errno); > > printf("desc: %s\n", strerror(errno)); > > } > > > > In my debug log I get the following: > > > > lastplayed->fname: /tmp/mplayReeWDr > > newname: /home/kcd/tmp//garden_state-web_m320.mov > > error: -1 > > errno: 18 > > desc: Invalid cross-device link > > > > errno 18 is indeed EXDEV invalid cross-device link. > > > > Is this a problem of rename() not being able to work across partitions? > > My /tmp is on /dev/sda1 and my /home/kcd/tmp is on /dev/sda6. > > > > I am on kernel 2.6.6 and glibc 2.3.4, if perhaps my version of rename() > > is operating differently than yours. Is there another mechanism to move > > or copy a file that we could try? > > > > I noted in my previous emails that the "Save as.. " feature was always > > grayed out and I couldn't click it. Well, once it had finished > > downloading if I restarted playback, the menu item became active. I am > > not too concerned about that. It is more the rename() problem now. > > > > Thanks, > > Kareem > > > > > > ------------------------------------------------------- > > This SF.Net email sponsored by Black Hat Briefings & Training. > > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > > digital self defense, top technical experts, no vendor pitches, > > unmatched networking opportunities. Visit www.blackhat.com > > _______________________________________________ > > Mplayerplug-in-devel mailing list > > Mpl...@li... > > https://lists.sourceforge.net/lists/listinfo/mplayerplug-in-devel > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Mplayerplug-in-devel mailing list > Mpl...@li... > https://lists.sourceforge.net/lists/listinfo/mplayerplug-in-devel |