[Ffmpeg-devel] [PATCH] http_seek feature added

Michael Niedermayer michaelni
Tue Jul 18 19:57:23 CEST 2006


Hi

On Tue, Jul 18, 2006 at 03:38:00PM +0000, I. Po wrote:
> Hi, all.
> 
> I don't see any reason, which disallow me to type in shell command like
> ffmpeg -ss 00:01:00 -i http://some.host/some.file ... ,
> except http_seek are not implemented in http.c file.
> A made some changes in this file, so now you are free to run
> processing of remote streams with arbitrary start point.
> 
> Note: I implemented not all of seek functionality, but only needed for
> processing like described above. It means:
> - SEEK_SET mode fully implemented
> - SEEK_END partial implemented only with pos == -1. In this case I
> just returning file_size-1, but don't do anything else.
> - SEEK_CUR mode not implemented
> - no stress-testing been made

> Index: libavformat/http.c
> ===================================================================
> --- libavformat/http.c	(revision 5781)
> +++ libavformat/http.c	(working copy)
> @@ -44,81 +44,42 @@
>      int line_count;
>      int http_code;
>      char location[URL_SIZE];
> +    char *uri;
> +    int flags;
> +    offset_t len;
> +    int opening;
>  } HTTPContext;
>  
>  static int http_connect(URLContext *h, const char *path, const char *hoststr,
> -                        const char *auth);
> +                        const char *auth, const offset_t pos);
>  static int http_write(URLContext *h, uint8_t *buf, int size);
>  static char *b64_encode(const unsigned char *src );
> +static int http_connect_loop(URLContext *h, const offset_t pos);
>  

why not move http_connect_loop before http_open so this wont be needed?

[...]

>  
> -
>      /* send http header */

cosmetic change


>      post = h->flags & URL_WRONLY;
>  
> +    if (pos)
> +    {
> +        snprintf(range_buf, sizeof(range_buf), "Range: bytes=%"PRId64"-\r\n", pos);
> +    }
> +    else
> +    {
> +        range_buf[0] = '\0';
> +    }
> +

please use the same style of {} placement as the rest of the file you
change


[...]
> +	}

tabs are forbidden

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list