# HG changeset patch # User William Pitcock # Date 1240829143 18000 # Node ID 1f13c07c4d806a70ae945a3ba2216b91dd5a70bb # Parent 1637a04513dd47d04ea0356a66ae47ff2bb24b99 aac: report stream bitrate if available diff -r 1637a04513dd -r 1f13c07c4d80 src/aac/libmp4.c --- a/src/aac/libmp4.c Mon Apr 27 05:43:28 2009 -0500 +++ b/src/aac/libmp4.c Mon Apr 27 05:45:43 2009 -0500 @@ -654,6 +654,7 @@ gchar *ttemp = NULL, *stemp = NULL; gchar *temp = g_strdup(filename); gchar *xmmstitle = NULL; + gint bitrate; gboolean remote = aud_str_has_prefix_nocase(filename, "http:") || aud_str_has_prefix_nocase(filename, "https:"); @@ -696,6 +697,15 @@ else xmmstitle = g_strdup(g_basename(temp)); + ttemp = aud_vfs_get_metadata(file, "content-bitrate"); + if (ttemp != NULL && *ttemp != '0') + { + bitrate = atoi(ttemp); + g_free(ttemp); + } + else + bitrate = -1; + bufferconsumed = aac_probe(streambuffer, buffervalid); if(bufferconsumed) { buffervalid -= bufferconsumed; @@ -724,7 +734,7 @@ return; } - playback->set_params(playback, xmmstitle, -1, -1, samplerate, channels); + playback->set_params(playback, xmmstitle, -1, bitrate, samplerate, channels); playback->output->flush(0); while(buffer_playing && buffervalid > 0 && streambuffer != NULL) @@ -762,7 +772,7 @@ ostmp = stemp; - playback->set_params(playback, xmmstitle, -1, -1, samplerate, channels); + playback->set_params(playback, xmmstitle, -1, bitrate, samplerate, channels); } }