[FFmpeg-devel] [PATCH] reformat rtsp.c
Diego Biurrun
diego
Tue Jan 5 11:49:34 CET 2010
On Mon, Jan 04, 2010 at 07:12:17PM -0500, Ronald S. Bultje wrote:
>
> $subj, requested by Diego.
Hey, I just complained that the code was ugly..
Have you given uncrustify a shot?
> How do I format this? The following looks logical, but is ugly:
>
> switch (x) {
> case x: {
> int bla;
> }
> }
No opinion from me, ask indent.
> --- libavformat/rtsp.c (revision 21020)
> +++ libavformat/rtsp.c (working copy)
> @@ -91,9 +91,11 @@
>
> -/* parse the rtpmap description: <codec_name>/<clock_rate>[/<other
> - params>] */
> +/** parse the rtpmap description: <codec_name>/<clock_rate>[/<other
> + * params>] */
The doxygen conversion looks unrelated. There is more below.
> @@ -101,23 +103,24 @@
> } else {
> - /* We are in a standard case ( from http://www.iana.org/assignments/rtp-parameters) */
> + /* We are in a standard case
> + * ( from http://www.iana.org/assignments/rtp-parameters). */
(from
> @@ -126,33 +129,37 @@
> if (c && c->name)
> c_name = c->name;
> else
> - c_name = (char *)NULL;
> + c_name = NULL;
That looks unrelated as well.
> @@ -227,22 +234,29 @@
>
> } else if (av_strstart(p, "rtpmap:", &p) && s->nb_streams > 0) {
> /* NOTE: rtpmap is only supported AFTER the 'm=' tag */
> get_word(buf1, sizeof(buf1), &p);
> payload_type = atoi(buf1);
> st = s->streams[s->nb_streams - 1];
> rtsp_st = st->priv_data;
> - sdp_parse_rtpmap(st->codec, rtsp_st, payload_type, p);
> + sdp_parse_rtpmap(s, st->codec, rtsp_st, payload_type, p);
Why did you insert 's' in there?
> rtsp_st = st->priv_data;
> if (rtsp_st->sdp_payload_type == payload_type) {
> - if(rtsp_st->dynamic_handler && rtsp_st->dynamic_handler->parse_sdp_a_line) {
> - if(!rtsp_st->dynamic_handler->parse_sdp_a_line(s, i, rtsp_st->dynamic_protocol_context, buf)) {
> - sdp_parse_fmtp(st, p);
> - }
> - } else {
> + if (!(rtsp_st->dynamic_handler &&
> + rtsp_st->dynamic_handler->parse_sdp_a_line &&
> + rtsp_st->dynamic_handler->parse_sdp_a_line(s,
> + i, rtsp_st->dynamic_protocol_context, buf)))
That does not look like reformatting and is probably one of the cases
where long lines keep things more readable.
> @@ -1006,20 +1027,22 @@
> /* first try in specified port range */
> if (RTSP_RTP_PORT_MIN != 0) {
> while(j <= RTSP_RTP_PORT_MAX) {
while (
> -/* then try on any port
> -** if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
> -** err = AVERROR_INVALIDDATA;
> -** goto fail;
> -** }
> -*/
> +#if 0
> + /* then try on any port */
> + if (url_open(&rtsp_st->rtp_handle, "rtp://", URL_RDONLY) < 0) {
> + err = AVERROR_INVALIDDATA;
> + goto fail;
> + }
> +#endif
Maybe just remove such cruft?
Diego
More information about the ffmpeg-devel
mailing list