
/*
 * See the files COPYING and README for copyright information and how to reach 
 * the author.
 *
 *  $Id: pipe.h,v 1.1.1.1 2004/11/19 16:45:31 lordjaxom Exp $
 */

#ifndef VDR_BURN_PIPE_H
#define VDR_BURN_PIPE_H

#include "common.h"
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <vdr/tools.h>

class cBurnPipe
{
  private:
    char mBuffer[KILOBYTE(32)];
    int mUsed;
    int mInput;
    pid_t mPid;
    char *mDir;

  protected:
    bool GetLineFromBuffer(char *&Line);

  public:
    static void DefaultProc(void *Data);

    cBurnPipe(void);
    ~cBurnPipe();

    void SetWorkdir(const char *Dir)
    {
        free(mDir);
        mDir = strdup(Dir);
    }

    bool Launch(const char *Command);
    bool Launch(BurnProc Procedure, void *Data);
    bool GetLine(char *&Line);
    bool Exit(bool Wait);
};

#endif // VDR_BURN_PIPE_H
