[Libav-user] What to replace ffurl_register_protocol with?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Libav-user] What to replace ffurl_register_protocol with?

Mahboud Zabetian
Hi.  I have old code that calls ffurl_register_protocol(), and linked with FFMPEG 3.0.2.

I'm upgrading to FFMPEG 3.3. It looks like ffurl_register_protocol()n has been deprecated, although there is not a whole lot of mention of what replaced it. Google finds only few mentions, such as this one, where someone is trying to export ffurl_register_protocol() to continue using it.

Any advice how I should proceed? How can I replace ffurl_register_protocol()? Or do I look to export it in the latest FFMPEG?

Thanks!


_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What to replace ffurl_register_protocol with?

Carl Eugen Hoyos-2
2017-10-03 22:39 GMT+02:00 Mahboud Zabetian <[hidden email]>:
> Hi.  I have old code that calls ffurl_register_protocol(), and linked with
> FFMPEG 3.0.2.

I don't think ffurl_register_protocol() was ever part of an installed
header, the name also indicates it was never meant to be
exported.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What to replace ffurl_register_protocol with?

Hendrik Leppkes
In reply to this post by Mahboud Zabetian
On Tue, Oct 3, 2017 at 10:39 PM, Mahboud Zabetian <[hidden email]> wrote:

> Hi.  I have old code that calls ffurl_register_protocol(), and linked with
> FFMPEG 3.0.2.
>
> I'm upgrading to FFMPEG 3.3. It looks like ffurl_register_protocol()n has
> been deprecated, although there is not a whole lot of mention of what
> replaced it. Google finds only few mentions, such as this one, where someone
> is trying to export ffurl_register_protocol() to continue using it.
>
> Any advice how I should proceed? How can I replace
> ffurl_register_protocol()? Or do I look to export it in the latest FFMPEG?
>

Use a custom avio context with read/write callbacks. Registering
protocols externally is not supported, and the ffurl function was
always an internal function that was errorneously available in a few
versions.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What to replace ffurl_register_protocol with?

Mahboud Zabetian
Thank you both!
On Tue, Oct 3, 2017 at 3:55 PM Hendrik Leppkes <[hidden email]> wrote:
On Tue, Oct 3, 2017 at 10:39 PM, Mahboud Zabetian <[hidden email]> wrote:
> Hi.  I have old code that calls ffurl_register_protocol(), and linked with
> FFMPEG 3.0.2.
>
> I'm upgrading to FFMPEG 3.3. It looks like ffurl_register_protocol()n has
> been deprecated, although there is not a whole lot of mention of what
> replaced it. Google finds only few mentions, such as this one, where someone
> is trying to export ffurl_register_protocol() to continue using it.
>
> Any advice how I should proceed? How can I replace
> ffurl_register_protocol()? Or do I look to export it in the latest FFMPEG?
>

Use a custom avio context with read/write callbacks. Registering
protocols externally is not supported, and the ffurl function was
always an internal function that was errorneously available in a few
versions.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: What to replace ffurl_register_protocol with?

Mahboud Zabetian
To create a custom AVIOContext, I looked at:

AVIOContext *avio_alloc_context(

                  unsigned char *buffer,

                  int buffer_size,

                  int write_flag,

                  void *opaque,

                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int64_t (*seek)(void *opaque, int64_t offset, int whence));

There are a bunch of parameters that I don't have access to such as buffer, buffer_size.  Also I don't see any handlers for open and close.

Is there a better way to map ffurl_register_protocol parameters to a context?


What I am trying to replace is:

cache1_protocol.name = CACHE1_PROTO;

cache1_protocol.url_open = cache1_open;

cache1_protocol.url_open2 = 0;

cache1_protocol.url_read = cache1_read;

cache1_protocol.url_write = cache1_write;

cache1_protocol.url_seek = cache1_seek;

cache1_protocol.url_close = cache1_close;

ffurl_register_protocol(&cache1_protocol);

Thanks!


On Tue, Oct 3, 2017 at 7:16 PM Mahboud Zabetian <[hidden email]> wrote:
Thank you both!
On Tue, Oct 3, 2017 at 3:55 PM Hendrik Leppkes <[hidden email]> wrote:
On Tue, Oct 3, 2017 at 10:39 PM, Mahboud Zabetian <[hidden email]> wrote:
> Hi.  I have old code that calls ffurl_register_protocol(), and linked with
> FFMPEG 3.0.2.
>
> I'm upgrading to FFMPEG 3.3. It looks like ffurl_register_protocol()n has
> been deprecated, although there is not a whole lot of mention of what
> replaced it. Google finds only few mentions, such as this one, where someone
> is trying to export ffurl_register_protocol() to continue using it.
>
> Any advice how I should proceed? How can I replace
> ffurl_register_protocol()? Or do I look to export it in the latest FFMPEG?
>

Use a custom avio context with read/write callbacks. Registering
protocols externally is not supported, and the ffurl function was
always an internal function that was errorneously available in a few
versions.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

[Libav-user] libavformat/protocol_list.c ?

Mahboud Zabetian
Hi.  Can someone tell me how the file 

libavformat/protocol_list.c

is created?  I assume it is made on the fly.

thank you!


On Wed, Oct 4, 2017 at 1:29 PM Mahboud Zabetian <[hidden email]> wrote:
To create a custom AVIOContext, I looked at:

AVIOContext *avio_alloc_context(

                  unsigned char *buffer,

                  int buffer_size,

                  int write_flag,

                  void *opaque,

                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),

                  int64_t (*seek)(void *opaque, int64_t offset, int whence));

There are a bunch of parameters that I don't have access to such as buffer, buffer_size.  Also I don't see any handlers for open and close.

Is there a better way to map ffurl_register_protocol parameters to a context?


What I am trying to replace is:

cache1_protocol.name = CACHE1_PROTO;

cache1_protocol.url_open = cache1_open;

cache1_protocol.url_open2 = 0;

cache1_protocol.url_read = cache1_read;

cache1_protocol.url_write = cache1_write;

cache1_protocol.url_seek = cache1_seek;

cache1_protocol.url_close = cache1_close;

ffurl_register_protocol(&cache1_protocol);

Thanks!



On Tue, Oct 3, 2017 at 7:16 PM Mahboud Zabetian <[hidden email]> wrote:
Thank you both!
On Tue, Oct 3, 2017 at 3:55 PM Hendrik Leppkes <[hidden email]> wrote:
On Tue, Oct 3, 2017 at 10:39 PM, Mahboud Zabetian <[hidden email]> wrote:
> Hi.  I have old code that calls ffurl_register_protocol(), and linked with
> FFMPEG 3.0.2.
>
> I'm upgrading to FFMPEG 3.3. It looks like ffurl_register_protocol()n has
> been deprecated, although there is not a whole lot of mention of what
> replaced it. Google finds only few mentions, such as this one, where someone
> is trying to export ffurl_register_protocol() to continue using it.
>
> Any advice how I should proceed? How can I replace
> ffurl_register_protocol()? Or do I look to export it in the latest FFMPEG?
>

Use a custom avio context with read/write callbacks. Registering
protocols externally is not supported, and the ffurl function was
always an internal function that was errorneously available in a few
versions.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: libavformat/protocol_list.c ?

Carl Eugen Hoyos-2
2017-11-01 1:21 GMT+01:00 Mahboud Zabetian <[hidden email]>:
> Hi.  Can someone tell me how the file
>
> libavformat/protocol_list.c
>
> is created?  I assume it is made on the fly.

The configure script creates it.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: libavformat/protocol_list.c ?

Mahboud Zabetian
Ah, thank you.  I was hoping this would show me how I could register my own protocols.  Our software used to ffurl_register_protocol 5 protocols.  Now that we are upgrading to a later version of ffmpeg, I have to figure out how to register those protocols in a different way. 

I've been told the correct way is to do a avio_alloc_context, but that doesn't take all the function pointers I need to pass in such as open and close.

Any thoughts?  Thanks!

mahboud
On Tue, Oct 31, 2017 at 5:33 PM Carl Eugen Hoyos <[hidden email]> wrote:
2017-11-01 1:21 GMT+01:00 Mahboud Zabetian <[hidden email]>:
> Hi.  Can someone tell me how the file
>
> libavformat/protocol_list.c
>
> is created?  I assume it is made on the fly.

The configure script creates it.

Carl Eugen
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: libavformat/protocol_list.c ?

Hendrik Leppkes
On Wed, Nov 1, 2017 at 9:33 AM, Mahboud Zabetian <[hidden email]> wrote:

> Ah, thank you.  I was hoping this would show me how I could register my own
> protocols.  Our software used to ffurl_register_protocol 5 protocols.  Now
> that we are upgrading to a later version of ffmpeg, I have to figure out how
> to register those protocols in a different way.
>
> I've been told the correct way is to do a avio_alloc_context, but that
> doesn't take all the function pointers I need to pass in such as open and
> close.
>
> Any thoughts?  Thanks!
>

Registering custom protocols is not supported, and functions prefixed
with ff* are in a private namespace, so using such functions was
always "wrong".

On that note, you don't really need open and close callbacks, because
it is assumed that when you call avio_alloc_context the resource was
already opened (so you just call open before), and once you close the
AVFormatContext, you should close the resource afterwards yourself.
It gives you full control over resource management this way.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: libavformat/protocol_list.c ?

Mahboud Zabetian
Very helpful, thank you.

I'm updating old code that uses ffurl_register_protocol - I think it might be 5 years old.  I'm replacing ffmpeg 3.03 with 3.4.  I'm very much hoping that I won't run into any other major changes, since that will probably mean some regression.  Any tips and pointers would be much appreciated.


On Wed, Nov 1, 2017 at 1:46 AM Hendrik Leppkes <[hidden email]> wrote:
On Wed, Nov 1, 2017 at 9:33 AM, Mahboud Zabetian <[hidden email]> wrote:
> Ah, thank you.  I was hoping this would show me how I could register my own
> protocols.  Our software used to ffurl_register_protocol 5 protocols.  Now
> that we are upgrading to a later version of ffmpeg, I have to figure out how
> to register those protocols in a different way.
>
> I've been told the correct way is to do a avio_alloc_context, but that
> doesn't take all the function pointers I need to pass in such as open and
> close.
>
> Any thoughts?  Thanks!
>

Registering custom protocols is not supported, and functions prefixed
with ff* are in a private namespace, so using such functions was
always "wrong".

On that note, you don't really need open and close callbacks, because
it is assumed that when you call avio_alloc_context the resource was
already opened (so you just call open before), and once you close the
AVFormatContext, you should close the resource afterwards yourself.
It gives you full control over resource management this way.

- Hendrik
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user