[FFmpeg-devel] [PATCH] Remove static ByteIOContexts

Björn Axelsson bjorn.axelsson
Tue Nov 6 15:42:22 CET 2007


To facilitate future extensions of ByteIOContext without breaking the
ABI Michael suggested[1] changing
AVFormatContext{
    ByteIOContext pb;
to
AVFormatContext{
    ByteIOContext *pb;

This is my attempt at doing that. 

Basically url_fopen(), url_fdopen(), url_open_buf and url_open_dyn_*()
are all changed to take a ByteIOContext ** pointer which is used to
return a newly allocated ByteIOContext in. This is consistent with how
url_open() works with URLContexts.

I believe this patch will break compability with most applications,
since AVFormatContext.pb must be checked for NULL before accessed (if a
format with AVFMT_NOFILE is used). Both ffmpeg and ffplay needed
additional checks for this. Of course, any application using the changed
url_* functions will also need some minor changes.

I'm not 100% sure about changing the API for the dynbuffer stuff, but I
included it anyway for consistency and to ensure future binary
compability. Most formats using those functions never checked for
failure which is possible in low mem situations. I added some failure
checks to the affected formats, but that is still somewhat incomplete. I
can polish that a bit further if this change is blessed by the
maintainers.

The complete patch series passes "make test". It doesn't pass "make
test-server", but neither does a clean svn build for me. 

Patch order, and suggested commit messages:

 1. bioc_api_1.diff
    Dynamically allocate AVFormatContext::ByteIOContext
 2. bioc_formats_1.diff
    Update libavformats for dynamic ByteIOContexts
 3. bioc_utils.diff
    Update utils.c for dynamic ByteIOContexts
 4. bioc_utils_guards.diff
    Handle NULL ByteIOContext pointers.
 5. bioc_utils_guards_reindent.diff
    Reindent from previous patch
 6. bioc_ffplay.diff
    Update ffplay for dynamic ByteIOContexts
 7. bioc_ffplay_reindent.diff
    Reindent from previous patch
 8. bioc_ffmpeg.diff
    Update ffmpeg for dynamic ByteIOContexts
 9. bioc_ffmpeg_reindent.diff
    Reindent from previous patch
10. bioc_ffserver.diff
    Update ffserver for dynamic ByteIOContexts
11. bioc_dynbuf_api.diff
    Let url_open_buf() and url_open_dyn_*() allocate ByteIOContexts
12. bioc_dynbuf_formats.diff
    Update libavformats for url_open_buf() and url_open_dyn_*() changes
13. bioc_dynbuf_ffserver.diff
    Update ffserver for url_open_buf() and url_open_dyn_*() changes

[1]:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-October/037140.html

-- 
Bj?rn Axelsson                    Phone: +46-(0)90-18 98 97
Intinor AB                          Fax: +46-(0)920-757 10
www.intinor.se
Interactive Television & Digital Media Distribution
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_api_1.diff
Type: text/x-patch
Size: 3072 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_formats_1.diff
Type: text/x-patch
Size: 157745 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_utils.diff
Type: text/x-patch
Size: 6114 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_utils_guards.diff
Type: text/x-patch
Size: 2545 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_utils_guards_reindent.diff
Type: text/x-patch
Size: 873 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_ffplay.diff
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_ffplay_reindent.diff
Type: text/x-patch
Size: 550 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_ffmpeg.diff
Type: text/x-patch
Size: 1270 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_ffmpeg_reindent.diff
Type: text/x-patch
Size: 643 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_ffserver.diff
Type: text/x-patch
Size: 753 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_dynbuf_api.diff
Type: text/x-patch
Size: 3770 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_dynbuf_formats.diff
Type: text/x-patch
Size: 7592 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0011.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bioc_dynbuf_ffserver.diff
Type: text/x-patch
Size: 4220 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071106/3090da7e/attachment-0012.bin>



More information about the ffmpeg-devel mailing list