~ubuntu-branches/ubuntu/feisty/avidemux/feisty

« back to all changes in this revision

Viewing changes to avidemux/ADM_lavformat/mpeg.c

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-05-25 13:02:29 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050525130229-jw94cav0yhmg7vjw
Tags: 1:2.0.40-0.0
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 */
19
19
#include "avformat.h"
20
 
//MEANX #include "bitstream.h"
 
20
#include "bitstream.h"
21
21
 
22
22
#define MAX_PAYLOAD_SIZE 4096
23
23
//#define DEBUG_SEEK
1031
1031
    int best_i= -1;
1032
1032
    int best_score= INT_MIN;
1033
1033
    int ignore_constraints=0;
1034
 
    int data_present;
1035
1034
    int64_t scr= s->last_scr;
1036
1035
    PacketDesc *timestamp_packet;
1037
1036
    const int64_t max_delay= av_rescale(ctx->max_delay, 90000, AV_TIME_BASE);
1038
1037
 
1039
1038
retry:
1040
 
    data_present=0;
1041
1039
    for(i=0; i<ctx->nb_streams; i++){
1042
1040
        AVStream *st = ctx->streams[i];
1043
1041
        StreamInfo *stream = st->priv_data;
1051
1049
        if(avail_data==0)
1052
1050
            continue;
1053
1051
        assert(avail_data>0);
1054
 
        data_present++;
 
1052
 
1055
1053
        if(space < s->packet_size && !ignore_constraints)
1056
1054
            continue;
1057
1055
            
1075
1073
            if(pkt_desc && pkt_desc->dts < best_dts)
1076
1074
                best_dts= pkt_desc->dts;
1077
1075
        }
1078
 
        if(!data_present && flush) return 0; // Meanx : avoid being stuck in there
1079
1076
 
1080
1077
#if 0
1081
1078
        av_log(ctx, AV_LOG_DEBUG, "bumping scr, scr:%f, dts:%f\n", 
1164
1161
 
1165
1162
    if(pts != AV_NOPTS_VALUE) pts += preload;
1166
1163
    if(dts != AV_NOPTS_VALUE) dts += preload;
1167
 
        //printf("st:%d Pts:%lld Dts:%lld \n",pkt->stream_index, pkt->pts,pkt->dts);
1168
1164
 
1169
1165
//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
1170
1166
    *stream->next_packet=
1178
1174
    stream->next_packet= &pkt_desc->next;
1179
1175
 
1180
1176
    fifo_realloc(&stream->fifo, fifo_size(&stream->fifo, NULL) + size + 1);
1181
 
 
 
1177
 
1182
1178
    if (s->is_dvd){
1183
1179
        if (is_iframe) {
1184
1180
            stream->fifo_iframe_ptr = stream->fifo.wptr;
1672
1668
};
1673
1669
 
1674
1670
#endif //CONFIG_ENCODERS
1675
 
 
 
1671
extern AVOutputFormat mpegts_mux;
1676
1672
AVInputFormat mpegps_demux = {
1677
1673
    "mpeg",
1678
1674
    "MPEG PS format",
1688
1684
int mpegps_init(void)
1689
1685
{
1690
1686
 //meanx
1691
 
       register_protocol(&file_protocol);
 
1687
        register_protocol(&file_protocol);
 
1688
 
1692
1689
#ifdef CONFIG_ENCODERS
1693
1690
    av_register_output_format(&mpeg1system_mux);
1694
1691
    av_register_output_format(&mpeg1vcd_mux);
1695
1692
    av_register_output_format(&mpeg2vob_mux);
1696
1693
    av_register_output_format(&mpeg2svcd_mux);
1697
1694
    av_register_output_format(&mpeg2dvd_mux);
 
1695
    
1698
1696
#endif //CONFIG_ENCODERS
 
1697
    av_register_output_format(&mpegts_mux);
1699
1698
    av_register_input_format(&mpegps_demux);
1700
1699
    return 0;
1701
1700
}