libmp3splt
src/utils.c
Go to the documentation of this file.
00001 /**********************************************************
00002  *
00003  * libmp3splt -- library based on mp3splt,
00004  *               for mp3/ogg splitting without decoding
00005  *
00006  * Copyright (c) 2002-2005 M. Trotta - <mtrotta@users.sourceforge.net>
00007  * Copyright (c) 2005-2011 Alexandru Munteanu - io_fx@yahoo.fr
00008  *
00009  * http://mp3splt.sourceforge.net
00010  *
00011  *********************************************************/
00012 
00013 /**********************************************************
00014  *
00015  * This program is free software; you can redistribute it and/or
00016  * modify it under the terms of the GNU General Public License
00017  * as published by the Free Software Foundation; either version 2
00018  * of the License, or (at your option) any later version.
00019  *
00020  * This program is distributed in the hope that it will be useful,
00021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  * GNU General Public License for more details.
00024  *
00025  * You should have received a copy of the GNU General Public License
00026  * along with this program; if not, write to the Free Software
00027  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00028  * 02111-1307,
00029  * USA.
00030  *
00031  *********************************************************/
00032 
00033 #include "splt.h"
00034 
00046 int splt_u_finish_tags_and_put_output_format_filename(splt_state *state, int current_split)
00047 {
00048   int err = splt_tu_set_tags_in_tags(state, current_split);
00049   if (err < 0)
00050   {
00051     return err;
00052   }
00053 
00054   return splt_of_put_output_format_filename(state, current_split);
00055 }
00056 
00058 void splt_u_print_overlap_time(splt_state *state)
00059 {
00060   long overlap_time = splt_o_get_long_option(state, SPLT_OPT_OVERLAP_TIME);
00061   if (overlap_time <= 0)
00062   {
00063     return;
00064   }
00065 
00066   long mins = -1;
00067   long secs = -1;
00068   long hundr = -1;
00069   splt_co_get_mins_secs_hundr(overlap_time, &mins, &secs, &hundr);
00070   splt_c_put_info_message_to_client(state, 
00071       _(" info: overlapping split files with %ld.%ld.%ld\n"),
00072       mins, secs, hundr);
00073 }
00074 
00083 short splt_u_fend_sec_is_bigger_than_total_time(splt_state *state, double fend_sec)
00084 {
00085   double total_time = splt_t_get_total_time_as_double_secs(state);
00086 
00087   if (total_time - 0.01 > 0)
00088   {
00089     if (fend_sec >= total_time - 0.01)
00090     {
00091       return SPLT_TRUE;
00092     }
00093   }
00094   else
00095   {
00096     //we might not have total time for non seekable
00097     if (splt_o_get_int_option(state, SPLT_OPT_INPUT_NOT_SEEKABLE))
00098     {
00099       int current_split = splt_t_get_current_split(state);
00100       if (splt_sp_splitpoint_exists(state, current_split + 1))
00101       {
00102         int err = SPLT_OK;
00103         long split_end = splt_sp_get_splitpoint_value(state, current_split+1, &err);
00104         if ((err >= 0) && (split_end == LONG_MAX))
00105         {
00106           return SPLT_TRUE;
00107         }
00108       }
00109     }
00110   }
00111 
00112   return SPLT_FALSE;
00113 }
00114