Files
veejay/sandbox/veejay-current/gveejay-reloaded/utils.c
Niels Elburg 90197d342b move stuff
git-svn-id: svn://code.dyne.org/veejay/trunk@1132 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
2008-11-01 03:31:40 +00:00

69 lines
1.8 KiB
C

/* Gveejay Reloaded - graphical interface for VeeJay
* (C) 2002-2005 Niels Elburg <nelburg@looze.net>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <config.h>
#include <stdio.h>
#include <mjpegtools/mpegconsts.h>
#include <mjpegtools/mpegtimecode.h>
#include <libvjmem/vjmem.h>
#include <string.h>
int status_to_arr( char *status, int *array )
{
int n = sscanf(status, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d",
array + 0,
array + 1,
array + 2,
array + 3,
array + 4,
array + 5,
array + 6,
array + 7,
array + 8,
array + 9,
array + 10,
array + 11,
array + 12,
array + 13,
array + 14,
array + 15,
array + 16,
array + 17,
array + 18,
array + 19,
array + 20,
array + 21 );
return n;
}
char *format_time(int pos, float fps)
{
MPEG_timecode_t tc;
veejay_memset(&tc, 0,sizeof(MPEG_timecode_t));
char *tmp = (char*) vj_malloc( 20 );
y4m_ratio_t ratio = mpeg_conform_framerate( fps );
int n = mpeg_framerate_code( ratio );
mpeg_timecode(&tc, pos, n, fps );
snprintf(tmp, 20, "%2d:%2.2d:%2.2d:%2.2d",
tc.h, tc.m, tc.s, tc.f );
return tmp;
}