API custom request headers

Showing 1-8 of 8 messages
API custom request headers 毕莱 4/8/13 6:04 AM
Hi,

I have some findings on custom headers for API.

For example, I passed in following custom headers with url "http://19.1.1.1/a.m3u8":
String[] headers = { "User-Agent", "My MX Player/1.0" };

The first quest was sent as expected:

GET /a.m3u8 HTTP/1.1
Accept: */*
Connection: close
Host: 19.1.1.1
User-Agent: My MX Player/1.0


But the subsequence requests ignored the custom headers:

GET A.ts?start=0&end=10&seg_no=0 HTTP/1.1
User-Agent: Lavf54.63.102
Accept: */*
Connection: close
Host: 19.1.1.1

The player was working in s/w decoding mode.

Is it possible to make the subsequence requests keep sending custom headers?

Thanks.
Re: API custom request headers 毕莱 4/8/13 6:26 AM
Here are some information in /ffmpeg_source__1_7_14/ffmpeg/doc/protocols.texi:

@item headers
Set custom HTTP headers, can override built in default headers. The value must be a string encoding the headers.

@item user-agent
Override User-Agent header. If not specified the protocol will use a string describing the libavformat build.


Who should keep setting the custom headers for both m3u8 and all video links in m3u8, MX Player or ffmpeg?
Re: API custom request headers Technical Support 4/9/13 9:26 AM
Hi,

That's ffmpeg because ffmpeg treats .m3u8 playlist as a single video file.
So MX Player even does not know what video link is in .m3u8 file.


Thanks
Re: API custom request headers 毕莱 4/9/13 11:20 AM
Thanks for your reply.

I was looking into hls.c which requests and processes m3u8, and http.c which send requests for http stream content. I found there are are many code lines and efforts working on user-agent. 
I have to file a bug for issue to ffmpeg team to get these existing code lines and efforts working eventually with this typical user scenario, otherwise what's the point for them?


在 2013年4月10日星期三UTC+8上午12时26分36秒,Technical Support写道:
Re: API custom request headers Technical Support 4/9/13 11:27 AM
Hi,

I think a sample .m3u8 file/url and a scenario for reproducing this issue will be enough to write a bug report.

Thanks
Re: API custom request headers 毕莱 4/9/13 12:19 PM
The issue was reopened at https://ffmpeg.org/trac/ffmpeg/ticket/1291.

I had some new thoughts. 

In hls.c, it handles specific user-agent and cookies, but on other custom headers found. 
According to MX Player API document, there is no specific user-agent field, or cookie fields to input, but there is header array instead.

My question is, does MX Player pass-in the User-Agent string by ffmpeg specific User-Agent parameter?  I'm afraid the ticket information I filled in was not complete. And cookies...


在 2013年4月10日星期三UTC+8上午2时27分05秒,Technical Support写道:
Re: API custom request headers Technical Support 4/11/13 1:23 AM
Hi,

Yes, MX Player pass all headers to single "headers" field.
hls.c should recognize "user-agent" from "headers" field because http protocol does and according to http.c, headers on "headers" field is preferred than value of "user-agent" field.
Also see definitely of "headers" option from http.c;
{"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { 0 }, 0, 0, D|E },
But hls.c does not read "headers" field at all.

Thanks
Re: API custom request headers Technical Support 4/20/13 4:29 AM
Hi,

A workaround added for this issue. Please try test build: https://sites.google.com/site/mxvpen/translation/test-build

Thanks

On Wednesday, April 10, 2013 4:19:58 AM UTC+9, bla...@gmail.com wrote: