Mercurial > audlegacy-plugins
changeset 693:a7ba9d27c7b5 trunk
[svn] - shoutcast title streaming. sucks, could probably be improved upon, but
will do for now.
author | nenolod |
---|---|
date | Tue, 20 Feb 2007 07:18:47 -0800 |
parents | a77e766e332d |
children | a429ce72d20e |
files | ChangeLog src/aac/src/libmp4.c |
diffstat | 2 files changed, 59 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Feb 20 07:00:10 2007 -0800 +++ b/ChangeLog Tue Feb 20 07:18:47 2007 -0800 @@ -1,3 +1,12 @@ +2007-02-20 15:00:10 +0000 William Pitcock <nenolod@sacredspiral.co.uk> + revision [1470] + - fix another potential synchronization problem + - be more efficient wrt fds + + trunk/src/aac/src/libmp4.c | 18 ++++++------------ + 1 file changed, 6 insertions(+), 12 deletions(-) + + 2007-02-20 14:38:03 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [1468] - oh yes, commit mplayer patches as well
--- a/src/aac/src/libmp4.c Tue Feb 20 07:00:10 2007 -0800 +++ b/src/aac/src/libmp4.c Tue Feb 20 07:18:47 2007 -0800 @@ -220,7 +220,9 @@ static int aac_probe(unsigned char *buffer, int len) { int i = 0, pos = 0; +#ifdef DEBUG g_print("\nAAC_PROBE: %d bytes\n", len); +#endif while(i <= len-4) { if( ((buffer[i] == 0xff) && ((buffer[i+1] & 0xf6) == 0xf0)) || @@ -229,11 +231,15 @@ pos = i; break; } +#ifdef DEBUG g_print("AUDIO PAYLOAD: %x %x %x %x\n", buffer[i], buffer[i+1], buffer[i+2], buffer[i+3]); +#endif i++; } +#ifdef DEBUG g_print("\nAAC_PROBE: ret %d\n", pos); +#endif return pos; } @@ -648,6 +654,7 @@ guchar channels; gulong buffervalid = 0; TitleInput* input; + gchar *ttemp = NULL, *stemp = NULL; gchar *temp = g_strdup(filename); gchar *ext = strrchr(temp, '.'); gchar *xmmstitle = NULL; @@ -687,7 +694,16 @@ vfs_fread(buffer, 1, size, file); buffervalid = vfs_fread(buffer, 1, BUFFER_SIZE, file); } - xmmstitle = g_strdup(g_basename(temp)); + + ttemp = vfs_get_metadata(file, "stream-name"); + + if (ttemp != NULL) + { + xmmstitle = g_strdup(ttemp); + g_free(ttemp); + } + else + xmmstitle = g_strdup(g_basename(temp)); bufferconsumed = aac_probe(buffer, buffervalid); if(bufferconsumed) { @@ -703,7 +719,9 @@ buffervalid, &samplerate, &channels); +#ifdef DEBUG g_print("samplerate: %d, channels: %d\n", samplerate, channels); +#endif if(playback->output->open_audio(FMT_S16_NE,samplerate,channels) == FALSE){ g_print("AAC: Output Error\n"); g_free(buffer); buffer=0; @@ -730,6 +748,34 @@ buffervalid += vfs_fread(&buffer[buffervalid], 1, BUFFER_SIZE-buffervalid, file); bufferconsumed = 0; + + ttemp = vfs_get_metadata(file, "stream-name"); + + if (ttemp != NULL) + stemp = vfs_get_metadata(file, "track-name"); + + if (stemp != NULL) + { + static gchar *ostmp = NULL; + + if (ostmp == NULL || g_ascii_strcasecmp(stemp, ostmp)) + { + if (xmmstitle != NULL) + g_free(xmmstitle); + + xmmstitle = g_strdup_printf("%s (%s)", stemp, ttemp); + + if (ostmp != NULL) + g_free(ostmp); + + ostmp = stemp; + + mp4_ip.set_info(xmmstitle, -1, -1, samplerate, channels); + } + } + + g_free(ttemp); + ttemp = NULL; } sample_buffer = faacDecDecode(decoder, &finfo, buffer, buffervalid); @@ -754,9 +800,12 @@ } if((samplesdecoded <= 0) && !sample_buffer){ +#ifdef DEBUG g_print("AAC: decoded %d samples!\n", samplesdecoded); +#endif continue; } + produce_audio(playback->output->written_time(), FMT_S16_LE, channels, samplesdecoded<<1, sample_buffer, &buffer_playing);