mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avio: make url_open_dyn_packet_buf internal.
It doesn't look fit to be a part of the public API. Adding a temporary hack to ffserver to be able to use it, should be cleaned up when somebody is up for it.
This commit is contained in:
parent
6dc7d80de7
commit
403ee835e7
@ -33,6 +33,8 @@
|
||||
#include "libavformat/os_support.h"
|
||||
#include "libavformat/rtpdec.h"
|
||||
#include "libavformat/rtsp.h"
|
||||
// XXX for ffio_open_dyn_packet_buffer, to be removed
|
||||
#include "libavformat/avio_internal.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "libavutil/random_seed.h"
|
||||
@ -2389,7 +2391,7 @@ static int http_prepare_data(HTTPContext *c)
|
||||
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
|
||||
else
|
||||
max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
|
||||
ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
|
||||
ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
|
||||
} else {
|
||||
ret = avio_open_dyn_buf(&ctx->pb);
|
||||
}
|
||||
@ -3444,7 +3446,7 @@ static int rtp_new_av_stream(HTTPContext *c,
|
||||
c->stream->filename, stream_index, c->protocol);
|
||||
|
||||
/* normally, no packets should be output here, but the packet size may be checked */
|
||||
if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
|
||||
if (ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
|
||||
/* XXX: close stream */
|
||||
goto fail;
|
||||
}
|
||||
|
@ -448,6 +448,7 @@ attribute_deprecated int url_fprintf(AVIOContext *s, const char *fmt, ...);
|
||||
#endif
|
||||
attribute_deprecated void put_flush_packet(AVIOContext *s);
|
||||
attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
|
||||
attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
|
||||
attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
|
||||
/**
|
||||
* @}
|
||||
@ -684,22 +685,10 @@ attribute_deprecated int url_close_buf(AVIOContext *s);
|
||||
*/
|
||||
int avio_open_dyn_buf(AVIOContext **s);
|
||||
|
||||
/**
|
||||
* Open a write only packetized memory stream with a maximum packet
|
||||
* size of 'max_packet_size'. The stream is stored in a memory buffer
|
||||
* with a big endian 4 byte header giving the packet size in bytes.
|
||||
*
|
||||
* @param s new IO context
|
||||
* @param max_packet_size maximum packet size (must be > 0)
|
||||
* @return zero if no error.
|
||||
*/
|
||||
int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
|
||||
|
||||
/**
|
||||
* Return the written size and a pointer to the buffer. The buffer
|
||||
* must be freed with av_free(). If the buffer is opened with
|
||||
* avio_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
|
||||
* added; if opened with url_open_dyn_packet_buf, no padding is added.
|
||||
* must be freed with av_free().
|
||||
* Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer.
|
||||
*
|
||||
* @param s IO context
|
||||
* @param pbuffer pointer to a byte buffer
|
||||
|
@ -81,4 +81,15 @@ unsigned long ffio_get_checksum(AVIOContext *s);
|
||||
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
|
||||
unsigned int len);
|
||||
|
||||
/**
|
||||
* Open a write only packetized memory stream with a maximum packet
|
||||
* size of 'max_packet_size'. The stream is stored in a memory buffer
|
||||
* with a big endian 4 byte header giving the packet size in bytes.
|
||||
*
|
||||
* @param s new IO context
|
||||
* @param max_packet_size maximum packet size (must be > 0)
|
||||
* @return zero if no error.
|
||||
*/
|
||||
int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
|
||||
|
||||
#endif // AVFORMAT_AVIO_INTERNAL_H
|
||||
|
@ -423,6 +423,10 @@ int url_open_dyn_buf(AVIOContext **s)
|
||||
{
|
||||
return avio_open_dyn_buf(s);
|
||||
}
|
||||
int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
|
||||
{
|
||||
return ffio_open_dyn_packet_buf(s, max_packet_size);
|
||||
}
|
||||
int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
|
||||
{
|
||||
return avio_close_dyn_buf(s, pbuffer);
|
||||
@ -1160,7 +1164,7 @@ int avio_open_dyn_buf(AVIOContext **s)
|
||||
return url_open_dyn_buf_internal(s, 0);
|
||||
}
|
||||
|
||||
int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
|
||||
int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
|
||||
{
|
||||
if (max_packet_size <= 0)
|
||||
return -1;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "internal.h"
|
||||
#include "rtpenc_chain.h"
|
||||
#include "avio_internal.h"
|
||||
|
||||
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
|
||||
{
|
||||
@ -409,7 +410,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
|
||||
/* Fetch the output from the RTP muxer, open a new output buffer
|
||||
* for next time. */
|
||||
size = avio_close_dyn_buf(rtp_ctx->pb, &buf);
|
||||
if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb,
|
||||
if ((ret = ffio_open_dyn_packet_buf(&rtp_ctx->pb,
|
||||
RTP_MAX_PACKET_SIZE)) < 0)
|
||||
goto done;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
buffer to 'rtp_write_packet' contains all the packets for ONE
|
||||
frame. Each packet should have a four byte header containing
|
||||
the length in big endian format (same trick as
|
||||
'url_open_dyn_packet_buf')
|
||||
'ffio_open_dyn_packet_buf')
|
||||
*/
|
||||
|
||||
static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = {
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "avformat.h"
|
||||
#include "rtpenc_chain.h"
|
||||
#include "avio_internal.h"
|
||||
|
||||
AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
|
||||
URLContext *handle, int packet_size)
|
||||
@ -55,7 +56,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
|
||||
if (handle) {
|
||||
url_fdopen(&rtpctx->pb, handle);
|
||||
} else
|
||||
url_open_dyn_packet_buf(&rtpctx->pb, packet_size);
|
||||
ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
|
||||
ret = av_write_header(rtpctx);
|
||||
|
||||
if (ret) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "os_support.h"
|
||||
#include "rtsp.h"
|
||||
#include "internal.h"
|
||||
#include "avio_internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/avstring.h"
|
||||
|
||||
@ -142,7 +143,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
|
||||
int id;
|
||||
/* The interleaving header is exactly 4 bytes, which happens to be
|
||||
* the same size as the packet length header from
|
||||
* url_open_dyn_packet_buf. So by writing the interleaving header
|
||||
* ffio_open_dyn_packet_buf. So by writing the interleaving header
|
||||
* over these bytes, we get a consecutive interleaved packet
|
||||
* that can be written in one call. */
|
||||
interleaved_packet = interleave_header = ptr;
|
||||
@ -162,7 +163,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
|
||||
size -= packet_len;
|
||||
}
|
||||
av_free(buf);
|
||||
url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
|
||||
ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user