mirror of https://github.com/FFmpeg/FFmpeg.git
Generic retime functionality is replaced by a few lines of code directly in the muxers which used it, which seems a lot easier to understand and this way the retiming is not dependant of the input durations. Also remove retimeinterleave, since it is not used by anything anymore. Signed-off-by: Marton Balint <cus@passwd.hu>pull/338/head
parent
c5324d92c5
commit
8360fd2610
5 changed files with 25 additions and 116 deletions
@ -1,51 +0,0 @@ |
||||
/*
|
||||
* Retime Interleaving functions |
||||
* |
||||
* Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com> |
||||
* |
||||
* This file is part of FFmpeg. |
||||
* |
||||
* FFmpeg is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU Lesser General Public |
||||
* License as published by the Free Software Foundation; either |
||||
* version 2.1 of the License, or (at your option) any later version. |
||||
* |
||||
* FFmpeg is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
* Lesser General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Lesser General Public |
||||
* License along with FFmpeg; if not, write to the Free Software |
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
*/ |
||||
|
||||
#include "libavutil/mathematics.h" |
||||
#include "avformat.h" |
||||
#include "retimeinterleave.h" |
||||
#include "internal.h" |
||||
|
||||
void ff_retime_interleave_init(RetimeInterleaveContext *aic, AVRational time_base) |
||||
{ |
||||
aic->time_base = time_base; |
||||
} |
||||
|
||||
int ff_retime_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, |
||||
int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), |
||||
int (*compare_ts)(AVFormatContext *, const AVPacket *, const AVPacket *)) |
||||
{ |
||||
int ret; |
||||
|
||||
if (pkt) { |
||||
AVStream *st = s->streams[pkt->stream_index]; |
||||
RetimeInterleaveContext *aic = st->priv_data; |
||||
pkt->duration = av_rescale_q(pkt->duration, st->time_base, aic->time_base); |
||||
// rewrite pts and dts to be decoded time line position
|
||||
pkt->pts = pkt->dts = aic->dts; |
||||
aic->dts += pkt->duration; |
||||
if ((ret = ff_interleave_add_packet(s, pkt, compare_ts)) < 0) |
||||
return ret; |
||||
} |
||||
|
||||
return get_packet(s, out, NULL, flush); |
||||
} |
@ -1,51 +0,0 @@ |
||||
/*
|
||||
* audio interleaving prototypes and declarations |
||||
* |
||||
* Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com> |
||||
* |
||||
* This file is part of FFmpeg. |
||||
* |
||||
* FFmpeg is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU Lesser General Public |
||||
* License as published by the Free Software Foundation; either |
||||
* version 2.1 of the License, or (at your option) any later version. |
||||
* |
||||
* FFmpeg is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||||
* Lesser General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Lesser General Public |
||||
* License along with FFmpeg; if not, write to the Free Software |
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||||
*/ |
||||
|
||||
#ifndef AVFORMAT_RETIMEINTERLEAVE_H |
||||
#define AVFORMAT_RETIMEINTERLEAVE_H |
||||
|
||||
#include "avformat.h" |
||||
|
||||
typedef struct RetimeInterleaveContext { |
||||
uint64_t dts; ///< current dts
|
||||
AVRational time_base; ///< time base of output packets
|
||||
} RetimeInterleaveContext; |
||||
|
||||
/**
|
||||
* Init the retime interleave context |
||||
*/ |
||||
void ff_retime_interleave_init(RetimeInterleaveContext *aic, AVRational time_base); |
||||
|
||||
/**
|
||||
* Retime packets per RetimeInterleaveContext->time_base and interleave them |
||||
* correctly. |
||||
* The first element of AVStream->priv_data must be RetimeInterleaveContext |
||||
* when using this function. |
||||
* |
||||
* @param get_packet function will output a packet when streams are correctly interleaved. |
||||
* @param compare_ts function will compare AVPackets and decide interleaving order. |
||||
*/ |
||||
int ff_retime_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, |
||||
int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), |
||||
int (*compare_ts)(AVFormatContext *, const AVPacket *, const AVPacket *)); |
||||
|
||||
#endif /* AVFORMAT_AUDIOINTERLEAVE_H */ |
Loading…
Reference in new issue