* vout_beos.cpp: beos video output display method
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
- * $Id: VideoOutput.cpp,v 1.11 2003/02/01 12:01:11 stippi Exp $
+ * $Id: VideoOutput.cpp,v 1.12 2003/02/09 17:10:52 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#include <Application.h>
#include <BitmapStream.h>
#include <Bitmap.h>
+#include <Directory.h>
#include <DirectWindow.h>
#include <File.h>
#include <InterfaceKit.h>
dst += dstBpr;
src += srcBpr;
}
- _SaveScreenShot( temp,
- strdup( DEFAULT_SCREEN_SHOT_PATH ),
- DEFAULT_SCREEN_SHOT_FORMAT );
+ char* path = config_GetPsz( p_vout, "beos-screenshot-path" );
+ if ( !path )
+ path = strdup( DEFAULT_SCREEN_SHOT_PATH );
+ int32 format = config_GetInt( p_vout, "beos-screenshot-format" );
+ _SaveScreenShot( temp, path, format );
}
else
{
// taken the next screen shot already!)
// make sure we have a unique name for the screen shot
BString path( info->path );
+ // create the folder if it doesn't exist
+ BString folder( info->path );
+ int32 pos = folder.FindLast("/");
+ if ( pos > 0 )
+ {
+ pos++; // leave the last '/' in the string
+ if ( pos == path.Length() )
+ path << "vlc screenshot";
+ else
+ {
+ int32 removeChars = folder.Length() - pos;
+ folder.Remove( pos, removeChars );
+ }
+ create_directory( folder.String(), 0777 );
+ }
BEntry entry( path.String() );
int32 appendedNumber = 0;
if ( entry.Exists() && !entry.IsSymLink() )
bool foundUniqueName = false;
appendedNumber = 1;
while ( !foundUniqueName ) {
- BString newName( info->path );
+ BString newName( path.String() );
newName << " " << appendedNumber;
BEntry possiblyClobberedEntry( newName.String() );
if ( possiblyClobberedEntry.Exists()
// make colorspace converted copy of bitmap
BBitmap* converted = new BBitmap( BRect( 0.0, 0.0, info->width, info->height ),
B_RGB32 );
-// if ( converted->IsValid() )
-// memset( converted->Bits(), 0, converted->BitsLength() );
status_t status = convert_bitmap( info->bitmap, converted );
if ( status == B_OK )
{
if ( info )
{
delete info->bitmap;
- delete[] info->path;
+ free( info->path );
}
delete info;
return B_OK;