mirror of https://git.ffmpeg.org/ffmpeg.git
Take ff_write_chained in use in the mov rtp hinter and in the rtsp muxer
Originally committed as revision 23208 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
9a76125069
commit
648e41b342
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "movenc.h"
|
#include "movenc.h"
|
||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
|
int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +431,6 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
|
||||||
int size;
|
int size;
|
||||||
ByteIOContext *hintbuf = NULL;
|
ByteIOContext *hintbuf = NULL;
|
||||||
AVPacket hint_pkt;
|
AVPacket hint_pkt;
|
||||||
AVPacket local_pkt;
|
|
||||||
int ret = 0, count;
|
int ret = 0, count;
|
||||||
|
|
||||||
if (!rtp_ctx)
|
if (!rtp_ctx)
|
||||||
|
@ -441,15 +441,7 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
|
||||||
sample_queue_push(&trk->sample_queue, pkt, sample);
|
sample_queue_push(&trk->sample_queue, pkt, sample);
|
||||||
|
|
||||||
/* Feed the packet to the RTP muxer */
|
/* Feed the packet to the RTP muxer */
|
||||||
local_pkt = *pkt;
|
ff_write_chained(rtp_ctx, 0, pkt, s);
|
||||||
local_pkt.stream_index = 0;
|
|
||||||
local_pkt.pts = av_rescale_q(pkt->pts,
|
|
||||||
s->streams[pkt->stream_index]->time_base,
|
|
||||||
rtp_ctx->streams[0]->time_base);
|
|
||||||
local_pkt.dts = av_rescale_q(pkt->dts,
|
|
||||||
s->streams[pkt->stream_index]->time_base,
|
|
||||||
rtp_ctx->streams[0]->time_base);
|
|
||||||
av_write_frame(rtp_ctx, &local_pkt);
|
|
||||||
|
|
||||||
/* Fetch the output from the RTP muxer, open a new output buffer
|
/* Fetch the output from the RTP muxer, open a new output buffer
|
||||||
* for next time. */
|
* for next time. */
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "rtsp.h"
|
#include "rtsp.h"
|
||||||
|
#include "internal.h"
|
||||||
#include <libavutil/intreadwrite.h>
|
#include <libavutil/intreadwrite.h>
|
||||||
|
|
||||||
static int rtsp_write_record(AVFormatContext *s)
|
static int rtsp_write_record(AVFormatContext *s)
|
||||||
|
@ -104,7 +105,6 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
int n, tcp_fd;
|
int n, tcp_fd;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
AVFormatContext *rtpctx;
|
AVFormatContext *rtpctx;
|
||||||
AVPacket local_pkt;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
tcp_fd = url_get_file_handle(rt->rtsp_hd);
|
tcp_fd = url_get_file_handle(rt->rtsp_hd);
|
||||||
|
@ -140,12 +140,8 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||||
rtsp_st = rt->rtsp_streams[pkt->stream_index];
|
rtsp_st = rt->rtsp_streams[pkt->stream_index];
|
||||||
rtpctx = rtsp_st->transport_priv;
|
rtpctx = rtsp_st->transport_priv;
|
||||||
|
|
||||||
/* Use a local packet for writing to the chained muxer, otherwise
|
ret = ff_write_chained(rtpctx, 0, pkt, s);
|
||||||
* the internal stream_index = 0 becomes visible to the muxer user. */
|
/* ff_write_chained does all the RTP packetization. If using TCP as
|
||||||
local_pkt = *pkt;
|
|
||||||
local_pkt.stream_index = 0;
|
|
||||||
ret = av_write_frame(rtpctx, &local_pkt);
|
|
||||||
/* av_write_frame does all the RTP packetization. If using TCP as
|
|
||||||
* transport, rtpctx->pb is only a dyn_packet_buf that queues up the
|
* transport, rtpctx->pb is only a dyn_packet_buf that queues up the
|
||||||
* packets, so we need to send them out on the TCP connection separately.
|
* packets, so we need to send them out on the TCP connection separately.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue