Add 'Range' field to HTTP header when playing GrooveShark streaming URL

This commit is contained in:
Arnaud Bienner 2011-09-19 23:52:21 +02:00
parent bc3f56ae0e
commit d380c2e49d
1 changed files with 11 additions and 0 deletions

View File

@ -645,6 +645,17 @@ void GstEnginePipeline::SourceSetupCallback(GstURIDecodeBin* bin, GParamSpec *ps
// here, when this callback is called.
g_object_set(element, "device", instance->source_device().toLocal8Bit().constData(), NULL);
}
if (element &&
g_object_class_find_property(G_OBJECT_GET_CLASS(element), "extra-headers") &&
instance->url().host().contains("grooveshark")) {
// GrooveShark streaming servers will answer with a 400 error 'Bad request'
// if we don't specify 'Range' field in HTTP header.
// Maybe it could be usefull in some other cases, but for now, I prefer to
// keep this grooveshark specific.
GstStructure* headers;
headers = gst_structure_new("extra-headers", "Range", G_TYPE_STRING, "bytes=0-", NULL);
g_object_set(element, "extra-headers", headers, NULL);
}
}
void GstEnginePipeline::TransitionToNext() {