Changeset 269 for trunk

Show
Ignore:
Timestamp:
12/01/08 21:24:29 (3 years ago)
Author:
ath
Message:

Merge a first version of FmInputBuffer? and make it the default.

Location:
trunk/fm_server
Files:
16 modified

Legend:

Unmodified
Added
Removed
  • trunk/fm_server/configure

    r267 r269  
    2618826188 
    2618926189 
    26190 ac_config_files="$ac_config_files Makefile po/Makefile.in src/Makefile src/fm_input_gst/Makefile src/fm_effect_rubber/Makefile src/fm_song_db/Makefile test/Makefile" 
     26190ac_config_files="$ac_config_files Makefile po/Makefile.in src/Makefile src/fm_input_buffer/Makefile src/fm_input_gst/Makefile src/fm_effect_rubber/Makefile src/fm_song_db/Makefile test/Makefile" 
    2619126191 
    2619226192cat >confcache <<\_ACEOF 
     
    2681526815    "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; 
    2681626816    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; 
     26817    "src/fm_input_buffer/Makefile") CONFIG_FILES="$CONFIG_FILES src/fm_input_buffer/Makefile" ;; 
    2681726818    "src/fm_input_gst/Makefile") CONFIG_FILES="$CONFIG_FILES src/fm_input_gst/Makefile" ;; 
    2681826819    "src/fm_effect_rubber/Makefile") CONFIG_FILES="$CONFIG_FILES src/fm_effect_rubber/Makefile" ;; 
  • trunk/fm_server/configure.ac

    r267 r269  
    204204                 po/Makefile.in 
    205205                 src/Makefile 
     206                 src/fm_input_buffer/Makefile 
    206207                 src/fm_input_gst/Makefile 
    207208                 src/fm_effect_rubber/Makefile 
  • trunk/fm_server/src/Makefile.am

    r234 r269  
    1 SUBDIRS = fm_input_gst fm_effect_rubber fm_song_db 
     1SUBDIRS = fm_input_buffer fm_input_gst fm_effect_rubber fm_song_db 
    22 
    33 
     
    5555        $(GLIB_LIBS) \ 
    5656        $(RGC_SERVER_LIBS) \ 
     57        fm_input_buffer/libfm_input_buffer.la \ 
    5758        fm_input_gst/libfm_input_gst.la \ 
    5859        fm_effect_rubber/libfm_effect_rubber.la \ 
  • trunk/fm_server/src/Makefile.in

    r257 r269  
    121121fm_server_OBJECTS = $(am_fm_server_OBJECTS) 
    122122fm_server_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ 
     123        fm_input_buffer/libfm_input_buffer.la \ 
    123124        fm_input_gst/libfm_input_gst.la \ 
    124125        fm_effect_rubber/libfm_effect_rubber.la \ 
     
    317318top_builddir = @top_builddir@ 
    318319top_srcdir = @top_srcdir@ 
    319 SUBDIRS = fm_input_gst fm_effect_rubber fm_song_db 
     320SUBDIRS = fm_input_buffer fm_input_gst fm_effect_rubber fm_song_db 
    320321AM_CPPFLAGS = $(GLIB_CFLAGS) \ 
    321322        $(RGC_SERVER_CFLAGS) 
     
    360361fm_server_INCLUDES =  
    361362fm_server_LDADD = $(GLIB_LIBS) $(RGC_SERVER_LIBS) \ 
     363        fm_input_buffer/libfm_input_buffer.la \ 
    362364        fm_input_gst/libfm_input_gst.la \ 
    363365        fm_effect_rubber/libfm_effect_rubber.la \ 
  • trunk/fm_server/src/fm_input.c

    r232 r269  
    3838        PROP_STATE, 
    3939        PROP_POSITION 
     40}; 
     41 
     42const char *state_names[] = { 
     43        "NULL", 
     44        "STOP", 
     45        "PAUSE", 
     46        "PLAY", 
     47        "INVALID" 
    4048}; 
    4149 
     
    132140        element->src_ports = g_list_append (element->src_ports, src_port); 
    133141         
    134         input->state = FM_INPUT_STOP; 
     142        input->state = FM_INPUT_NULL; 
    135143        input->position = 0; 
    136144        input->length = 0; 
     
    199207        g_value_destroy (val); 
    200208} 
     209 
     210 
     211const char* 
     212fm_input_get_state_name                 (FmInputState   state) 
     213{ 
     214        g_return_val_if_fail (state <= FM_INPUT_INVALID, NULL); 
     215 
     216        return state_names[state]; 
     217} 
  • trunk/fm_server/src/fm_input.h

    r48 r269  
    4141 
    4242enum _FmInputState { 
     43        FM_INPUT_NULL = 0, 
    4344        FM_INPUT_STOP, 
    4445        FM_INPUT_PAUSE, 
    4546        FM_INPUT_PLAY, 
    46         FM_N_STATES 
     47        FM_INPUT_INVALID 
    4748}; 
    4849 
     
    9495fm_input_state_changed                  (FmInput        *input); 
    9596 
     97const char* 
     98fm_input_get_state_name                 (FmInputState   state); 
     99 
    96100G_END_DECLS 
  • trunk/fm_server/src/fm_input_cdj.c

    r267 r269  
    2828#include "fm_input.h" 
    2929#include "fm_effect.h" 
    30 #include "fm_input_gst/jack_ringbuffer.h" 
     30 
     31#include "fm_input_buffer/gstfmsink.h" 
     32#include "fm_input_buffer/vm_buffer.h" 
     33#include "fm_input_buffer/fm_gst.h" 
     34#include "fm_input_buffer/fm_input_buffer.h" 
     35/*#include "fm_input_gst/jack_ringbuffer.h" 
    3136#include "fm_input_gst/fm_input_gst_common.h" 
    32 #include "fm_input_gst/fm_input_gst.h" 
     37#include "fm_input_gst/fm_input_gst.h"*/ 
     38 
    3339#include "fm_effect_rubber/fm_effect_rubber.h" 
    3440#include "fm_output.h" 
     
    197203{ 
    198204        static gint serial = 0; 
    199         input_cdj->input = fm_input_gst_new (); 
     205        input_cdj->input = fm_input_buffer_new (); 
    200206        g_object_set_data (G_OBJECT (input_cdj->input), "name", g_strdup_printf ("input%d", serial)); 
    201207 
     
    411417#ifdef USE_PITCH 
    412418static void 
    413 fm_input_cdj_update_bpm                 (FmInputCDJ     *input_cdj) 
     419fm_input_cdj_update_bpm                 (FmInputCDJ     *cdj) 
    414420{ 
    415421        /*gdouble bpm; 
     
    426432 
    427433static void 
    428 fm_input_cdj_load_file                  (FmInputCDJ     *input_cdj, 
     434fm_input_cdj_load_file                  (FmInputCDJ     *cdj, 
    429435                                         const gchar    *filename) 
    430436{ 
    431437        g_print("loading %s\n", filename); 
     438 
     439        FmInputState state = fm_input_get_state (FM_INPUT (cdj->input)); 
     440 
     441        if (state > FM_INPUT_STOP) 
     442                fm_input_set_state (FM_INPUT (cdj->input), FM_INPUT_STOP); 
     443 
     444        fm_input_set_state (FM_INPUT (cdj->input), FM_INPUT_NULL); 
     445 
    432446        GValue *fn = g_value_init_string(filename); 
    433         g_object_set_property (G_OBJECT(input_cdj->input), "filename", fn); 
     447        g_object_set_property (G_OBJECT(cdj->input), "filename", fn); 
    434448        g_value_destroy(fn); 
    435449 
    436         input_cdj->beat_info = fm_song_db_get_beatinfo (global_song_db, filename); 
    437  
    438         if (!input_cdj->beat_info) { 
     450        fm_input_set_state (FM_INPUT (cdj->input), FM_INPUT_STOP); 
     451 
     452        if (cdj->state == FM_CDJ_PAUSE) 
     453                fm_input_set_state (FM_INPUT (cdj->input), FM_INPUT_PAUSE); 
     454 
     455        if (cdj->state == FM_CDJ_PLAY) 
     456                fm_input_set_state (FM_INPUT (cdj->input), FM_INPUT_PLAY); 
     457 
     458        cdj->beat_info = fm_song_db_get_beatinfo (global_song_db, filename); 
     459 
     460        if (!cdj->beat_info) { 
    439461                g_print ("Song \"%s\" isn't in the song database\n", filename); 
    440462                return; 
    441463        } 
    442464 
    443         if (!input_cdj->beat_info->beatsections) { 
     465        if (!cdj->beat_info->beatsections) { 
    444466                g_print ("Song \"%s\" doesn't have beat information\n", filename); 
    445467                return; 
    446468        } 
    447469 
    448         fm_sync_dump_beatsections (input_cdj->beat_info); 
     470        fm_sync_dump_beatsections (cdj->beat_info); 
    449471        /*FmBeatSection *beat_section = beat_info->beatsections->data; 
    450472        input_cdj->beat_section = beat_section; 
     
    517539 
    518540        gint64 offset = value * NSECS_FOR_UNIT; 
    519         fm_input_gst_seek_relative (input_cdj->input, offset); 
     541        fm_input_buffer_seek_relative (input_cdj->input, offset); 
    520542} 
    521543 
     
    525547                                        gdouble         pos) 
    526548{ 
    527         fm_input_gst_seek_direct (input_cdj->input, pos); 
    528 } 
     549        fm_input_buffer_seek_direct (input_cdj->input, pos); 
     550} 
  • trunk/fm_server/src/fm_input_cdj.h

    r246 r269  
    3535        FmInputCDJCueState cue_state; 
    3636         
    37         FmInputGst      *input; 
     37        FmInputBuffer   *input; 
    3838        FmEffectRubber  *rate; 
    3939 
  • trunk/fm_server/src/fm_input_gst/fm_input_gst.c

    r262 r269  
    806806                seek_target = 0; 
    807807 
    808 /*      if ((seek_target == 0) && (input_gst->read_track->start_at > 0)) 
    809                 seek_target =input_gst->read_track->start_at;*/ 
    810  
    811808        input_gst->seek_at_ns = seek_target; 
    812809} 
  • trunk/fm_server/src/fm_output_alsa.c

    r263 r269  
    307307        } 
    308308         
    309 //      g_print ("ALSA sample rate: %d\n", output->sample_rate); 
     309        g_print ("ALSA sample rate: %d\n", output->sample_rate); 
    310310 
    311311        guint n_channels = FM_CHANNELS_STEREO; 
  • trunk/fm_server/src/fm_pipeline.c

    r232 r269  
    141141        g_print ("new pipeline created\n"); 
    142142 
     143        /* !!!!!!!!!!!!!!!!!!!! */ 
    143144        /* Start with a reasonable default, the output element will alter this if it needs to */ 
    144         pipeline->sample_rate = 48000; 
     145        /*pipeline->sample_rate = 48000;*/ 
     146        pipeline->sample_rate = -1; 
    145147 
    146148        pipeline->sync_info = fm_sync_new (); 
  • trunk/fm_server/src/fm_utils.c

    r263 r269  
    4343                                         guint          prio) 
    4444{ 
     45#if USE_RT_PRIO 
    4546#ifdef HAVE_SCHED_SETSCHEDULER 
    4647 
     
    5758                return TRUE; 
    5859        } 
    59                  
     60#else 
     61        return FALSE; 
     62#endif 
    6063#else 
    6164        return FALSE; 
  • trunk/fm_server/src/fm_utils.h

    r194 r269  
    2121 * 
    2222 */ 
     23  
     24  
     25#define USE_RT_PRIO     FALSE 
    2326 
    2427 
     
    5861void 
    5962fm_sem_destroy                          (FmSemaphore    *sem); 
     63 
     64 
     65 
     66#define FM_MIN(x, y) (x) < (y) ? (x) : (y) 
  • trunk/fm_server/src/main.c

    r239 r269  
    6060void fm_effect_pan_class_register (void); 
    6161void fm_input_gst_class_register (void); 
     62void fm_input_buffer_class_register (void); 
    6263void fm_input_cdj_class_register (void); 
    6364void fm_mixer_class_register (void); 
     
    127128        fm_effect_rate_class_register (); 
    128129        fm_effect_rubber_class_register (); 
    129         fm_input_gst_class_register (); 
     130//      fm_input_gst_class_register (); 
     131        fm_input_buffer_class_register (); 
    130132        fm_input_cdj_class_register (); 
    131133        fm_mixer_class_register (); 
  • trunk/fm_server/test/Makefile.am

    r224 r269  
    77 
    88 
    9 bin_PROGRAMS = test_simple test_play_file test_beat_master 
     9bin_PROGRAMS = test_simple test_play_file test_beat_master test_buffer 
    1010 
    1111 
     
    1818test_beat_master_SOURCES = \ 
    1919        test_beat_master.c 
     20 
     21test_buffer_SOURCES = \ 
     22        test_buffer.c 
  • trunk/fm_server/test/Makefile.in

    r257 r269  
    3434host_triplet = @host@ 
    3535bin_PROGRAMS = test_simple$(EXEEXT) test_play_file$(EXEEXT) \ 
    36         test_beat_master$(EXEEXT) 
     36        test_beat_master$(EXEEXT) test_buffer$(EXEEXT) 
    3737subdir = test 
    3838DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 
     
    5858test_beat_master_DEPENDENCIES = $(am__DEPENDENCIES_1) \ 
    5959        $(am__DEPENDENCIES_1) 
     60am_test_buffer_OBJECTS = test_buffer.$(OBJEXT) 
     61test_buffer_OBJECTS = $(am_test_buffer_OBJECTS) 
     62test_buffer_LDADD = $(LDADD) 
     63test_buffer_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) 
    6064am_test_play_file_OBJECTS = test_play_file.$(OBJEXT) 
    6165test_play_file_OBJECTS = $(am_test_play_file_OBJECTS) 
     
    7983        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ 
    8084        $(LDFLAGS) -o $@ 
    81 SOURCES = $(test_beat_master_SOURCES) $(test_play_file_SOURCES) \ 
    82         $(test_simple_SOURCES) 
    83 DIST_SOURCES = $(test_beat_master_SOURCES) $(test_play_file_SOURCES) \ 
    84         $(test_simple_SOURCES) 
     85SOURCES = $(test_beat_master_SOURCES) $(test_buffer_SOURCES) \ 
     86        $(test_play_file_SOURCES) $(test_simple_SOURCES) 
     87DIST_SOURCES = $(test_beat_master_SOURCES) $(test_buffer_SOURCES) \ 
     88        $(test_play_file_SOURCES) $(test_simple_SOURCES) 
    8589ETAGS = etags 
    8690CTAGS = ctags 
     
    258262        test_beat_master.c 
    259263 
     264test_buffer_SOURCES = \ 
     265        test_buffer.c 
     266 
    260267all: all-am 
    261268 
     
    322329        @rm -f test_beat_master$(EXEEXT) 
    323330        $(LINK) $(test_beat_master_OBJECTS) $(test_beat_master_LDADD) $(LIBS) 
     331test_buffer$(EXEEXT): $(test_buffer_OBJECTS) $(test_buffer_DEPENDENCIES)  
     332        @rm -f test_buffer$(EXEEXT) 
     333        $(LINK) $(test_buffer_OBJECTS) $(test_buffer_LDADD) $(LIBS) 
    324334test_play_file$(EXEEXT): $(test_play_file_OBJECTS) $(test_play_file_DEPENDENCIES)  
    325335        @rm -f test_play_file$(EXEEXT) 
     
    336346 
    337347@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_beat_master.Po@am__quote@ 
     348@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_buffer.Po@am__quote@ 
    338349@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_play_file.Po@am__quote@ 
    339350@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_simple.Po@am__quote@