Burn project in C/GTK

I was tired of looking for a burn-program that works and is lightweight. So I decided to create my own program, it only depends of cdrkit/dvd+rw-tools/gtk2.
It works, but i have a problem with the GTK interface. In the "dvd" function i want to popup before every "system" start, but all messages popups when "dvd" function has finished.
I know that probably this isnt the best way to do it, but the "system" calls and the "forks" works.
If anyone knows how i can start every message in the correct time...
Here is the code:
DVD function:
static void dvd( GtkWidget *widget, gpointer data )
int result=0;
char* mes;
if (!fork())
mes = "Making image...";
message(mes);
system("mkisofs -R -J -T -o /home/alex/burn.iso /home/alex/tmp/*");
if (!fork())
mes = "Deleting temporaly files...";
message(mes);
system("rm -R /home/alex/tmp");
if (!fork())
mes = "Burning DVD...";
message(mes);
system("dvdrecord -v dev=/dev/hdb speed=8 -sao -eject -data /home/alex/burn.iso");
if (!fork())
mes = "Process completed.";
message(mes);
system("rm /home/alex/burn.iso");
wait (&result);
wait (&result);
wait (&result);
wait (&result);
Message function:
void message (gchar *message) {
GtkWidget *dialog, *label;
dialog = gtk_dialog_new_with_buttons ("Message",NULL,GTK_DIALOG_DESTROY_WITH_PARENT, NULL, GTK_RESPONSE_NONE, NULL);
label = gtk_label_new (message);
g_signal_connect_swapped (dialog,"response", G_CALLBACK (gtk_widget_destroy),dialog);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), label);
gtk_widget_show_all (dialog);
Thanks.
PD: One comment, if it works i will change it for a label. Now i post a popup because it explains good my problem.
Last edited by icrave (2007-11-16 18:36:57)

hmm i'll give a shot at a response here, i probably shouldn't though as i have little experience using threads and absolutely none using fork.
what i'm going to suggest is based off of what i've read from the faq and api documentation over at gtk.org (presuming i understood what i read correctly..). i have no idea if there are better ways to do this kind of stuff nor am i sure if the example code that is provided below will even work properly but after running a quick test it at least _seems_ to work.  i'm hoping someone with more experience using threads can read over it, verify, and correct anything that's wrong.
why not thread dvd() and have it communicate to the gtk main thread rather than forking? this probably is a cleaner approach and it's not too difficult to do. now if you don't care if the dialog box message() creates appears _exactly_ before your system() calls this will be easier as you can just add message() to the gtk main thread via g_idle_add() and then do the system() call.  otherwise you'll have to make dvd() wait for a signal which the dialog box can send to it once it's displayed, which you can do using a GMutex and a GCond.  so if you don't care about exact timing just ignore the stuff with the GMutex and GCond in the following example
declare the following variables in the scope of both dvd() and message()
GCond *data_cond = NULL;
GMutex *data_mutex = NULL;
gint iSignal = 0;
in your main function add the following
int main(int argc, char *argv[])
/* add these two function before gtk_init */
g_thread_init(NULL);
gdk_threads_init();
gtk_init(&argc,&argv);
/* call a function to create the mutex and condition or do it here */
data_cond = g_cond_new();
data_mutex = g_mutex_new();
/* add gdk_threads enter and leave around gtk_main */
gdk_threads_enter();
gtk_main();
gdk_threads_leave();
have the function in the gtk_main thread that calls dvd() thread it
void on_some_button_click(GtkWidget *widget, gpointer data)
GError *error = NULL;
if(!g_thread_create(dvd,NULL,FALSE,&error))
p_printerr("Failed to create thread: %s\n",error->message);
/* exit or something here */
in dvd do the following each time you want to display a dialog box.
static gboolean dvd()
g_mutex_lock(data_mutex);
/* clear signal flag for dialog box to set */
iSignal = 0;
/* create message box in gtk main thread */
g_idle_add(message,"your message here");
/* wait for signal from dialog box */
while(iSignal == 0)
g_cond_wait(data_cond,data_mutex);
g_mutex_unlock(data_mutex);
/* do your system call here, the dialog box has already been displayed at this point */
system("command");
make sure message returns FALSE!
gboolean message(gchar *message)
/* connect a function to the show signal that will signal back to the dvd() thread */
g_signal_connect(G_OBJECT(dialog),"show",G_CALLBACK(signal_dvd_function),NULL);
gtk_widget_show_all(dialog);
return FALSE;
add the show function for the dialog window which signals dvd() that it has been displayed
void signal_thread_test(GtkWidget *widget, gpointer data)
g_mutex_lock(data_mutex);
iSignal = 1;
g_cond_signal(data_cond);
g_mutex_unlock(data_mutex);
that should do it, you also probably should make sure that if the dvd thread is running that it can't be called again, which you could do by adding another variable like the iSignal above using the same mutex to access it to see if it's running or not, or use the glib atomic operations to do this.
also don't forget to add gthread-2.0 to the arguments given to pkg-config when compiling

Similar Messages

  • Problems while trying to burn project

    Good morning
    i'm trying to burn project with idvd from ilife 11.
    every time the process stuck at the final stage (i think) -
    i get "multiplexing and burning" message, below that "done"' is written,
    and below that - "rime remaining: about one minute". that message is here for the past 12 hours.
    the dvd itself didn't start the burning at all (i tried several times, with several different dvd's)
    please help
    Thanks
    Ran

    Why would we start different threads if we are all experiencing the same issue?? Isn't that the point of a thread... I might be new to this forum but not new to forums at all. They are collaborative efforts. I and we appreciate your help but were not going to follow 6 different threads for the what appears to be the same issue. If one of us rectify the issue, others will try the same. If it doesn't work then the thread could progress in that issue or start a new one.
    As it states in my signature or info section (what ever you call it over here) I have a late model 2007 17" MacBook Pro3.1 with a 2.6GHz Core 2 Duo, 4GB of Ram and an Intel 160GB Solid State hard drive which has 60GB of free space. Im also running OSX 10.6.5, I just ran a software update and everything is up to date. Disk utility reports a healthy disk, verified and no errors.
    I can burn CDs and backup DVDs from iTunes. I WAS able to burn DVDs from iDVD before I upgraded to iLife'11. Nothing else was running while i was doing this. I've tried on different types and brands of media with no success. Every time it gets hung up at the same spot and spits out the disk which is unreadable.
    I CAN create a disk image (just did) and its sitting on my desktop. Inserted blank DVD+R, opened it up in finder, dragged and dropped the .img into it, burnt and verified.

  • Need help burning project to DVD

    Can anyone help me burn a PRE project to a DVD in .VOB (NTSC) format so it can be read by any DVD player connected to a TV, not a computer.  I know how it is supposed to be done in Premier Elements because I did it with small sample files, but whenever I try with a larger project, PRE always crashes during the encoding process..  First I will give the particulars of my system, then of my project, then of the trouble shooting I already tried, finally my experiences
    System:
         Intel Pentium "E2200" dual core processor @ 2.2 GHZ speed
         3 GB RAM
         Windows 32bit Vista Home Premium with SP2 installed
         1/4 TB hard drive with 100MB free and 0% fragmented
          Intel G31/33 graphics processor
    Projects:  
         14 MB slide show consting of 5 MB JPEG files with audio or text captions and unedited  MPG4 files of 480x720 pixels imported from Samsung camcorder set at recording quality of 5 MB/sec.
         10 MB movie created in instant DVD by dragging above JPEG and MPG4 files from album
         Neither have additional narration or music tracks        
         Both the above about 25 minutes on the timeline
    Troubleshooting already tried:
         Burning project to folder instead of to DVD
         Exporting files to PC in MPG2 and AVI format
         Rendering the file (not all at once, but in separate work areas at a time)
         Burned to both -RW and -R DVD's
         Deselecting the "Fit contents to available space" quality option in the burn menu and manually selecting a bitrate speed of 3 MB/sec
         Repeating the above in selective start of windows with all start programs and non-Microsoft processes disabled
         Repeating the above for both Slide show and movie projects
    Results:
         The encoding process never completes, but it abends at different stages in different trials--never the same point.  Sometimes it crashes at less than 20% complete; sometimes it makes it to 96% complete, then stops responding.  Sometimes it generates a crash report, and sometimes it just stops responding, so I have  to open task manager to end the program.   Sometimes I get a message that PRE is dangerously low on system memory.  I just close the window and procede, because I am watching physical memory usage in Task Manager while PRE is encoding and it is consistantly about 60%.  CPU usage often peaks at 100%, but not for more than 60 secs at a time.  When the system crashed, it generated an error message in the administrative events log sometimes reading: "The entry <name of project file> in the hash map cannot be updated"; event ID 3013, which Microsoft found no help for.  When it simply stops responding, it leaves no error message in the system log until I close the program.
         I don't think I have a system error, because my system sussessfully burned two minute test projects, and don't have a project error, because I could render the timeline.  What is going on here?
         B.T.W, some people I talked to about this problem who make their living in photos and electronics suggest I buy a camcorder which records in MPEG2 format, then simply burn the MPEG2 files to DVD without re-encoding, insert the DVD into any player connected to a TV, and play.  I don't think this advice is correct.   Opinions?

    Hello, freethedata. This is the Photoshop Elements forum. Premiere Elements has its own forum, here:
    http://forums.adobe.com/community/premiere/premiere_elements
    and you'll get more help with video questions there. Good luck!

  • If there ever was a NEW update for iMovie, will iMovie have the ability to burn projects onto a Blu-Ray disc so that customers don't have to pay for additional software like Final Cut Pro or Roxio Toast Titanium/Pro?

    It would be helpful for those who are familier with iMovie to use Blu-Ray discs for burning and playing back their iMovie projects in HD. However, iMovie '11 doesn't have that special feature yet. I hear that 'Final Cut Pro X,' 'Roxio Toast 11 Titanium' and 'Roxio Toast 11 Pro' can copy projects like iMovie onto Blu-Ray, but it would take long periods of time to do that. Professional software, like FCP X and Toast, can be pricey.
    I'm hoping that iMovie '11 will burn projects onto Blu-Ray, but will that ever come true?

    Will iBlu-Ray be an upgrade? OR and update of iDVD?
    If it's an upgrade, then that means you'd still pay for it from the Mac App Store. I wish it would only cost between $20-40.
    If it's a free update of iDVD, but with the new name, that would be better than to go out and pay for things!!!
    However, external Blu-ray recorders would still be required if you were going to burn an iMovie project onto a blu-ray disc.
    Is there a way to put in a request for 'iBlu-Ray?'

  • Want to burn project to disc but can't

    I am trying to save some video clips in imovie for a back up and have just 29:30:25 duration total. But when I click on "burn project to disc" I get a message that (The project won't currently fit onto a disc. But if you empty iMovie HD’s Trash, it may.)
    Well the trash is empty everywhere as far as I can tell and the message doesn't change. The disc I want to use is a dvd-r has 120 min and 4.7 gb. HELP?

    I am trying to save some video clips…
    for convenience, get in any PCshop a firewire-connected harddrive…
    launch Disk Utility (in your apps folder), format drive to MacOsExtended/hfs…
    then copy your project within minutes by simply drag'n drop from one drive to another…
    (I have 4 hds just for my little homemovies... )

  • With fcp can you render/burn project to dvd?

    Can Final Cut Pro render/Burn project to a DVD?

    FCPX has a basic Export to DVD feature which will finally burn a disk.
    'basic' because it has no fancy design nor menu options such as iDVD, DVDSP or Encore etc.-

  • IiMovie 5 won't burn Project files, only completed movie.

    Using iMovie 5.0.2 (111)
    CD/DVD drive will burn DVD movie from iDVD , no probs, but of course this is the finished movie which cannot be re-edited.
    Will not copy to DVD the project as files that can be re-edited in future. So DVD burner ( HI-dt-st-DVDRAM GSA-H44N) works fine apart from this.
    Selecting 'Burn project to Disc' from iMovie menu is followed by 'Saving Project File' and then 'No Disc Burning Drive Found. If you have an Apple-supported disc burner, please check your connections and try again' but iMovie knows it's there because it will burn completed movie via iDVD! Confused!
    Any help to save files as project greatly appreciated, thanks.

    Do you not get this dialogue box?
    This feature creates a duplicate of your project onto a CD or DVD ROM. It does not create a video DVD for playing in a DVD player. Do you want to continue?
    It would have to be very short iMovie project (which run at 15GB per hour) to fit on a CD or even a DVD.
    Better to store the project on an external hard disk, which of course must be connected by firewire.

  • How can I add extra footage to a burned project?

    I burned an imovie project through idvd and deleted the project on my hard drive. I figured since I had it on a dvd I could load it back on my computer and add stuff in the future. When I loaded it back all I saw was two folders, audio ts and video ts. How can I get my imovie project loaded back up so I can add more stuff, and burn a new copy. I am going to be making lots of projects in the future and I dont want to have to store everything on my hard drive. What do I do?
    Thanks,
    Doug

    Yes you can. (1) Go to the file menu while in Imovie. (2) select share, (3) select video camera, (4) use the interface to add seconds of black tape before and after your film as desired, (5) as the warning says be sure to have blank tape and your camera in VTR code. (6) press share and voila your camera should record your movie. Now you can store it and even add others if you have room. If your going to add others I suggest you add 8 seconds or more of black to the end. So, when you record your next movie you won't overlap and ruin your master. Enjoy.

  • Internal dvd drive no longer plays idvd burned projects

    My internal dvd drive has been acting strange lately. It will play mass produced dvds but does not play my idvd projects, which it used to do. Anyone know if cleaning will help? If so, can you recommend a cleaner for an imac dvd drive?
    If cleaning won't help, am I better off going to apple and having it replaced, or simply buying a compatible external drive? If an external, any recommendations?
    Thanks!

    You can use any proprietary lens cleaner for a DVD/CD player, except the ones using a liquid.
    When you have cleaned the Superdrive, do a bit of maintenance:
    Repairing permissions is important, and should always be carried out both before and after any software installation or update.
    Go to Disk Utility (this is in your Utilities Folder in your Application folder) and click on the icon of your hard disk (not the one with all the numbers).
    In First Aid, click on Repair Permissions.
    This only takes a minute or two in Tiger, but much longer in Leopard.
    Background information here:
    http://docs.info.apple.com/article.html?artnum=25751
    and here:
    http://docs.info.apple.com/article.html?artnum=302672
    An article on troubleshooting Permissions can be found here:
    http://support.apple.com/kb/HT2963
    By the way, you can ignore any messages about SUID or ACL file permissions, as explained here:
    http://support.apple.com/kb/TS1448?viewlocale=en_US
    If you were having any serious problems with your Mac you might as well complete the exercise by repairing your hard disk as well. You cannot do this from the same start-up disk. Reboot from your install disk (holding down the C key). Once it opens, select your language, and then go to Disk Utility from the Utilities menu. Select your hard disk as before and click Repair.
    Once that is complete reboot again from your usual start-up disk.
    More useful reading here:
    Resolve startup issues and perform disk maintenance with Disk Utility and fsck
    http://support.apple.com/kb/TS1417?viewlocale=en_US
    For a full description of how to resolve Disk, Permission and Cache Corruption, you should read this FAQ from the X Lab:
    http://www.thexlab.com/faqs/repairprocess.html
    Then reboot your Mac and try burning a DVD again.

  • So slow rendering & burning project to a DVD

    I understand some of the themes are quite complex... but 5 h and above to do the job ..errrrrr !
    What is are the limitting factors ?
    a) iDVD ( software )
    b) my hard disk ( btw: enough free space )
    c) my processor clock speed
    d) my RAM
    e) The OS ( latest version )
    What can I do to accelerate the workflow ?
    tks!

    Faster processors and more RAM can help, and you need the HD space on your boot drive for iDVD's scratch space. And some simple stuff can help too:
    - don't ask iMac to multi-task (it's a big job, let him stay focused).
    - get him prepared for heavy lifting (I use MacJanitor and then Repair Permissions routinely).
    - don't let him take a nap (set your energy saver kick to Never).
    With my G4/400, I'd finish a project at night and let burn while I slept (ie, the unwatched pot boiled faster).
    John

  • Downloaded latest update, now I cannot burn projects to dvd's!!! I would have never updated if I knew I would loose that capability.

    I have a MacBook Pro  10.9.3 version.(Imovie version10.0.3)  I just upgraded my computer now I cannot save my project to a dvd.  I have spent hours trying to finda a way. I have read that others are having this same problem.  I have tried to follow what they suggest only to find that when I go to the file my files do not use the same wording.  That is why I as putting the kind of computer I have in this message in case that makes a difference.  For the record I do have Idvd, but it will not open my project.  It only opens those I already have completed.  Can ANYONE help me.

    I am having the same problem...but in my case I am trying to create an avchc dvd  (a high definition format play able in Blu-ray players using standard dvds). (Still struggling in fact...)
    If  you want to create a simple dvd of the MPEG-4 "project" you created in imovie.....have you tried letting "finder" burn the DVD for you?
    Go to: finder/go/computer/mac hard drive/users/macbook/movies in movie library......when you find your library (your path may be different than above)....highlight it, double click it, click "show package contents".....find your project...double click it....select "burn to disc".
    Good luck. Its not as simple as it apparently was before Apple discontinued idvd
    Best wishes
    Larry B.

  • Burning project in iDVD

    I have created a project in iMovie 09 using still photos, audio from iTunes and fades etc from iMovie.
    I have published it in Browser and sent it to iDVD I created a them from the Themes list. The map shows the grey panel, the theme and the project. When I play it in review it is as it should be and it all works. The map shows one of the panels in blue, which I can move to the other panels if I wish. When I burn the project it appears without the audio or with just the theme. I have not tried to burn after highlighting the project .... I am running out of discs. Help

    Hi
    When I burn the project it appears without the audio or with just the theme.
    Usually due to a Copy protection in iTunes.
    Do - in iTunes Copy out Your audio to an Audio-CD .aiff (not .mp3)
    Then use this audio in Your iMovie project.
    I copy CD to a folder on hard disk - so that iMovie doesn't lose track of it when CD is ejected.
    iMovie doesn't make a copy of it's own to it's projects only points at where audio file is stored.
    Yours Bengt W

  • How do you burn project as Disk Utility?

    I have been getting an error message #6 (0x29,0x00) on every project I try to burn to my external LaCie burner. I have burned several projects on it before. I have been doing all the things that the pros on this site say to do,delete idvdplist, clear caches,set iDVD preferences, and I saved project as a disk image, and tried to burn the project IMG as a disk utility, but I kept getting this: a stop sign, and it said: The device failed to respond properly, unable to recover or retry. What should I do next?
    Thanks for the advice.

    tried to burn the project IMG as a disk utility,
    You do mean burn with disk utility, right?
    What brand and type DVD are you using?

  • ? Export and burn project in .avi format

    How do you export a FCP project to disc so that it is just an .avi file. My video clip needs to be uploaded to a website and the site requires an .avi file. I tried emporting it as an .avi file from FCP but after I burned it in DVDSP it comes up as audio TS and video TS. Any help would be much appreciated.
    Thanks,
    Glenn

    There may be other ways but I export things as Animation or Intermediate and then just throw them into VisualHub for web conversions like that. It may be good enough for you, I'm not sure.
    If I'm understanding you correctly you need to dump it onto a Data DVD for delivery? Toast will do that or burning a disc from the Finder.
    Message was edited by: W. Raider

  • Can't burn project to DVD from Premiere Pro CS5.5

    Hello to all the experts out there!
    We have been having ongoing issues attempting to burn our finalised project in Premiere Pro CS5.5.
    We have tried many of the suggestions found in the forum, including changing file names, checking for gaps in the timeline, changing DVD discs, exporting as an MPEG file (always says unknown error), sending to Encore via Dynamic Link (goes 3/4 way through transcoding and freezes every time), installing Roxio updates etc etc.
    We still can't get the project to burn to disc and I am not sure where to go with it next.
    Its a 34 minute project, and have been able to export up to 24 mins of it, so I suspect there is a problem with something in the end of the timeline but just can't work it out.
    Does anyone have any tips, pleaseeeee!???
    Cheers,
    Georgi

    >and .jpg files
    Photo Scaling for Video http://forums.adobe.com/thread/450798
    -Too Large May = Crash http://forums.adobe.com/thread/879967
    As well as the below, right click the Encore icon and select Run as Administrator, which is NOT the same thing as running the computer with the Administrator account, and which fixes several "odd" problems... To create a two layer DVD (or a BluRay?), you MUST have Encore set to use the Run as Administrator option
    Run as Administrator http://forums.adobe.com/thread/771202
    Odd Errors http://forums.adobe.com/thread/670174
    Long File Names or odd characters cause problems
    Read http://forums.adobe.com/thread/588273
    And #4 http://forums.adobe.com/thread/666558
    And This Message Thread http://forums.adobe.com/thread/665641
    CS3 (maybe later?) Two Layer Problem http://kb2.adobe.com/cps/407/kb407236.html
    Encore "No Drive" Error http://forums.adobe.com/thread/569230
    Things and Software to AVOID when authoring/burning a DVD
    Start --> http://forums.adobe.com/thread/608660
    #2 has WHY Explained http://forums.adobe.com/thread/607390
    Plus http://forums.adobe.com/thread/562941
    Create an ISO (Encore) or folder on your hard drive (Encore or Premiere Elements) and then use the FREE http://www.imgburn.com/index.php?act=download to write files or folders or ISO to disc (send the author a PayPal donation if you like his program)

Maybe you are looking for

  • Remote Desktop doesn't work with local printer

    I am having trouble using a locally networked printer when I use Remote Desktop to connect to a Vista machine.  Under the local resources tab for RD, I have checked printers.  The only thing I can figure is that my printer is networked locally, not c

  • I can't open files in the Downloads menu (accidental duplicate, please ignore)

    <pre><i>Locking duplicate thread. Please continue here: [[/questions/977970]] </i></pre> Every time I download a file (either open or save), it never opens automatically, and I can't open it by clicking the entry in the Downloads menu/panel. I am abl

  • Alert!  Newbie question

    I am going to be uploading streaming flv video from a home server. I need to know: Is xserve the way to go? I'd like to avoid a host server...any other mac-compatible servers that anyone has had good luck with?? I don't want progressive video uploads

  • Using icloud drive as a media storage site

    i use both Adobe lightroom and iphoto ( now photos) for my pictures. Thus they comprise the bulk of my hard drive storage use. I am wondering if I can just store these in the icloud drive and erase them from my hard drive to free up space. I also hav

  • K330 "Performan​ce Switch" -- Does it actually do anything?

    I bought a new K330 (7727-3FU) that has the 3 mode performance switch on the front. What is the deal with this thing, is it just for looks? I've monitored CPU-Z/GPU-Z and run a myriad of benchmarks (Sandra, x264 HD encoding, PCMark) and the performan