| OLD | NEW |
| 1 /* | 1 /* |
| 2 * MPEG1/2 muxer | 2 * MPEG1/2 muxer |
| 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard | 3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 uint8_t *buf= pkt->data; | 1155 uint8_t *buf= pkt->data; |
| 1156 AVStream *st = ctx->streams[stream_index]; | 1156 AVStream *st = ctx->streams[stream_index]; |
| 1157 StreamInfo *stream = st->priv_data; | 1157 StreamInfo *stream = st->priv_data; |
| 1158 int64_t pts, dts; | 1158 int64_t pts, dts; |
| 1159 PacketDesc *pkt_desc; | 1159 PacketDesc *pkt_desc; |
| 1160 const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE); | 1160 const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE); |
| 1161 const int is_iframe = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->f
lags & AV_PKT_FLAG_KEY); | 1161 const int is_iframe = st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (pkt->f
lags & AV_PKT_FLAG_KEY); |
| 1162 | 1162 |
| 1163 pts= pkt->pts; | 1163 pts= pkt->pts; |
| 1164 dts= pkt->dts; | 1164 dts= pkt->dts; |
| 1165 if(!s->last_scr) | |
| 1166 s->last_scr= dts; | |
| 1167 | 1165 |
| 1168 if(pts != AV_NOPTS_VALUE) pts += preload; | 1166 if(pts != AV_NOPTS_VALUE) pts += 2*preload; |
| 1169 if(dts != AV_NOPTS_VALUE) dts += preload; | 1167 if(dts != AV_NOPTS_VALUE){ |
| 1168 if(!s->last_scr) |
| 1169 s->last_scr= dts + preload; |
| 1170 dts += 2*preload; |
| 1171 } |
| 1170 | 1172 |
| 1171 //av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/9
0000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); | 1173 //av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/9
0000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE); |
| 1172 if (!stream->premux_packet) | 1174 if (!stream->premux_packet) |
| 1173 stream->next_packet = &stream->premux_packet; | 1175 stream->next_packet = &stream->premux_packet; |
| 1174 *stream->next_packet= | 1176 *stream->next_packet= |
| 1175 pkt_desc= av_mallocz(sizeof(PacketDesc)); | 1177 pkt_desc= av_mallocz(sizeof(PacketDesc)); |
| 1176 pkt_desc->pts= pts; | 1178 pkt_desc->pts= pts; |
| 1177 pkt_desc->dts= dts; | 1179 pkt_desc->dts= dts; |
| 1178 pkt_desc->unwritten_size= | 1180 pkt_desc->unwritten_size= |
| 1179 pkt_desc->size= size; | 1181 pkt_desc->size= size; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 "video/mpeg", | 1299 "video/mpeg", |
| 1298 "dvd", | 1300 "dvd", |
| 1299 sizeof(MpegMuxContext), | 1301 sizeof(MpegMuxContext), |
| 1300 CODEC_ID_MP2, | 1302 CODEC_ID_MP2, |
| 1301 CODEC_ID_MPEG2VIDEO, | 1303 CODEC_ID_MPEG2VIDEO, |
| 1302 mpeg_mux_init, | 1304 mpeg_mux_init, |
| 1303 mpeg_mux_write_packet, | 1305 mpeg_mux_write_packet, |
| 1304 mpeg_mux_end, | 1306 mpeg_mux_end, |
| 1305 }; | 1307 }; |
| 1306 #endif | 1308 #endif |
| OLD | NEW |