Mercurial > mplayer.hg
comparison stream/http.c @ 25970:c6ec51cc3b13
Move printing of Icy-Metadata into an extra function
author | reimar |
---|---|
date | Fri, 15 Feb 2008 20:31:10 +0000 |
parents | 84eb56d278b2 |
children | 64b1e4ea04fc |
comparison
equal
deleted
inserted
replaced
25969:84eb56d278b2 | 25970:c6ec51cc3b13 |
---|---|
714 outLen++; | 714 outLen++; |
715 } | 715 } |
716 } | 716 } |
717 } | 717 } |
718 | 718 |
719 static void print_icy_metadata(HTTP_header_t *http_hdr) { | |
720 const char *field_data; | |
721 // note: I skip icy-notice1 and 2, as they contain html <BR> | |
722 // and are IMHO useless info ::atmos | |
723 if( (field_data = http_get_field(http_hdr, "icy-name")) != NULL ) | |
724 mp_msg(MSGT_NETWORK,MSGL_INFO,"Name : %s\n", field_data); | |
725 if( (field_data = http_get_field(http_hdr, "icy-genre")) != NULL ) | |
726 mp_msg(MSGT_NETWORK,MSGL_INFO,"Genre : %s\n", field_data); | |
727 if( (field_data = http_get_field(http_hdr, "icy-url")) != NULL ) | |
728 mp_msg(MSGT_NETWORK,MSGL_INFO,"Website: %s\n", field_data); | |
729 // XXX: does this really mean public server? ::atmos | |
730 if( (field_data = http_get_field(http_hdr, "icy-pub")) != NULL ) | |
731 mp_msg(MSGT_NETWORK,MSGL_INFO,"Public : %s\n", atoi(field_data)?"yes":"no"); | |
732 if( (field_data = http_get_field(http_hdr, "icy-br")) != NULL ) | |
733 mp_msg(MSGT_NETWORK,MSGL_INFO,"Bitrate: %skbit/s\n", field_data); | |
734 } | |
735 | |
719 //! If this function succeeds you must closesocket stream->fd | 736 //! If this function succeeds you must closesocket stream->fd |
720 static int http_streaming_start(stream_t *stream, int* file_format) { | 737 static int http_streaming_start(stream_t *stream, int* file_format) { |
721 HTTP_header_t *http_hdr = NULL; | 738 HTTP_header_t *http_hdr = NULL; |
722 unsigned int i; | 739 unsigned int i; |
723 int fd = stream->fd; | 740 int fd = stream->fd; |
759 if( !strcasecmp(http_hdr->protocol, "ICY") || | 776 if( !strcasecmp(http_hdr->protocol, "ICY") || |
760 http_get_field(http_hdr, "Icy-MetaInt") ) { | 777 http_get_field(http_hdr, "Icy-MetaInt") ) { |
761 switch( http_hdr->status_code ) { | 778 switch( http_hdr->status_code ) { |
762 case 200: { // OK | 779 case 200: { // OK |
763 char *field_data; | 780 char *field_data; |
764 // note: I skip icy-notice1 and 2, as they contain html <BR> | 781 print_icy_metadata(http_hdr); |
765 // and are IMHO useless info ::atmos | |
766 if( (field_data = http_get_field(http_hdr, "icy-name")) != NULL ) | |
767 mp_msg(MSGT_NETWORK,MSGL_INFO,"Name : %s\n", field_data); | |
768 if( (field_data = http_get_field(http_hdr, "icy-genre")) != NULL ) | |
769 mp_msg(MSGT_NETWORK,MSGL_INFO,"Genre : %s\n", field_data); | |
770 if( (field_data = http_get_field(http_hdr, "icy-url")) != NULL ) | |
771 mp_msg(MSGT_NETWORK,MSGL_INFO,"Website: %s\n", field_data); | |
772 // XXX: does this really mean public server? ::atmos | |
773 if( (field_data = http_get_field(http_hdr, "icy-pub")) != NULL ) | |
774 mp_msg(MSGT_NETWORK,MSGL_INFO,"Public : %s\n", atoi(field_data)?"yes":"no"); | |
775 if( (field_data = http_get_field(http_hdr, "icy-br")) != NULL ) | |
776 mp_msg(MSGT_NETWORK,MSGL_INFO,"Bitrate: %skbit/s\n", field_data); | |
777 | |
778 // If content-type == video/nsv we most likely have a winamp video stream | 782 // If content-type == video/nsv we most likely have a winamp video stream |
779 // otherwise it should be mp3. if there are more types consider adding mime type | 783 // otherwise it should be mp3. if there are more types consider adding mime type |
780 // handling like later | 784 // handling like later |
781 if ( (field_data = http_get_field(http_hdr, "content-type")) != NULL && (!strcmp(field_data, "video/nsv") || !strcmp(field_data, "misc/ultravox"))) | 785 if ( (field_data = http_get_field(http_hdr, "content-type")) != NULL && (!strcmp(field_data, "video/nsv") || !strcmp(field_data, "misc/ultravox"))) |
782 *file_format = DEMUXER_TYPE_NSV; | 786 *file_format = DEMUXER_TYPE_NSV; |