| @@ -378,14 +378,6 @@ static int mpeg_mux_init(AVFormatContext *ctx) | |||||
| av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); | av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); | ||||
| stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default | stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default | ||||
| } | } | ||||
| #if 0 | |||||
| /* see VCD standard, p. IV-7*/ | |||||
| stream->max_buffer_size = 46 * 1024; | |||||
| else | |||||
| /* This value HAS to be used for SVCD (see SVCD standard, p. 26 V.2.3.2). | |||||
| Right now it is also used for everything else.*/ | |||||
| stream->max_buffer_size = 230 * 1024; | |||||
| #endif | |||||
| s->video_bound++; | s->video_bound++; | ||||
| break; | break; | ||||
| case AVMEDIA_TYPE_SUBTITLE: | case AVMEDIA_TYPE_SUBTITLE: | ||||
| @@ -531,92 +523,6 @@ static int get_vcd_padding_size(AVFormatContext *ctx, int64_t pts) | |||||
| } | } | ||||
| #if 0 /* unused, remove? */ | |||||
| /* return the exact available payload size for the next packet for | |||||
| stream 'stream_index'. 'pts' and 'dts' are only used to know if | |||||
| timestamps are needed in the packet header. */ | |||||
| static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, | |||||
| int64_t pts, int64_t dts) | |||||
| { | |||||
| MpegMuxContext *s = ctx->priv_data; | |||||
| int buf_index; | |||||
| StreamInfo *stream; | |||||
| stream = ctx->streams[stream_index]->priv_data; | |||||
| buf_index = 0; | |||||
| if (((s->packet_number % s->pack_header_freq) == 0)) { | |||||
| /* pack header size */ | |||||
| if (s->is_mpeg2) | |||||
| buf_index += 14; | |||||
| else | |||||
| buf_index += 12; | |||||
| if (s->is_vcd) { | |||||
| /* there is exactly one system header for each stream in a VCD MPEG, | |||||
| One in the very first video packet and one in the very first | |||||
| audio packet (see VCD standard p. IV-7 and IV-8).*/ | |||||
| if (stream->packet_number==0) | |||||
| /* The system headers refer only to the stream they occur in, | |||||
| so they have a constant size.*/ | |||||
| buf_index += 15; | |||||
| } else { | |||||
| if ((s->packet_number % s->system_header_freq) == 0) | |||||
| buf_index += s->system_header_size; | |||||
| } | |||||
| } | |||||
| if ((s->is_vcd && stream->packet_number==0) | |||||
| || (s->is_svcd && s->packet_number==0)) | |||||
| /* the first pack of each stream contains only the pack header, | |||||
| the system header and some padding (see VCD standard p. IV-6) | |||||
| Add the padding size, so that the actual payload becomes 0.*/ | |||||
| buf_index += s->packet_size - buf_index; | |||||
| else { | |||||
| /* packet header size */ | |||||
| buf_index += 6; | |||||
| if (s->is_mpeg2) { | |||||
| buf_index += 3; | |||||
| if (stream->packet_number==0) | |||||
| buf_index += 3; /* PES extension */ | |||||
| buf_index += 1; /* obligatory stuffing byte */ | |||||
| } | |||||
| if (pts != AV_NOPTS_VALUE) { | |||||
| if (dts != pts) | |||||
| buf_index += 5 + 5; | |||||
| else | |||||
| buf_index += 5; | |||||
| } else { | |||||
| if (!s->is_mpeg2) | |||||
| buf_index++; | |||||
| } | |||||
| if (stream->id < 0xc0) { | |||||
| /* AC-3/LPCM private data header */ | |||||
| buf_index += 4; | |||||
| if (stream->id >= 0xa0) { | |||||
| int n; | |||||
| buf_index += 3; | |||||
| /* NOTE: we round the payload size to an integer number of | |||||
| LPCM samples */ | |||||
| n = (s->packet_size - buf_index) % stream->lpcm_align; | |||||
| if (n) | |||||
| buf_index += (stream->lpcm_align - n); | |||||
| } | |||||
| } | |||||
| if (s->is_vcd && (stream->id & 0xe0) == AUDIO_ID) | |||||
| /* The VCD standard demands that 20 zero bytes follow | |||||
| each audio packet (see standard p. IV-8).*/ | |||||
| buf_index+=20; | |||||
| } | |||||
| return s->packet_size - buf_index; | |||||
| } | |||||
| #endif | |||||
| /* Write an MPEG padding packet header. */ | /* Write an MPEG padding packet header. */ | ||||
| static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) | static void put_padding_packet(AVFormatContext *ctx, AVIOContext *pb,int packet_bytes) | ||||
| { | { | ||||
| @@ -982,28 +888,6 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) | |||||
| s->packet_number++; | s->packet_number++; | ||||
| } | } | ||||
| #if 0 /* unused, remove? */ | |||||
| static int64_t get_vcd_scr(AVFormatContext *ctx,int stream_index,int64_t pts) | |||||
| { | |||||
| MpegMuxContext *s = ctx->priv_data; | |||||
| int64_t scr; | |||||
| /* Since the data delivery rate is constant, SCR is computed | |||||
| using the formula C + i * 1200 where C is the start constant | |||||
| and i is the pack index. | |||||
| It is recommended that SCR 0 is at the beginning of the VCD front | |||||
| margin (a sequence of empty Form 2 sectors on the CD). | |||||
| It is recommended that the front margin is 30 sectors long, so | |||||
| we use C = 30*1200 = 36000 | |||||
| (Note that even if the front margin is not 30 sectors the file | |||||
| will still be correct according to the standard. It just won't have | |||||
| the "recommended" value).*/ | |||||
| scr = 36000 + s->packet_number * 1200; | |||||
| return scr; | |||||
| } | |||||
| #endif | |||||
| static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){ | static int remove_decoded_packets(AVFormatContext *ctx, int64_t scr){ | ||||
| // MpegMuxContext *s = ctx->priv_data; | // MpegMuxContext *s = ctx->priv_data; | ||||
| int i; | int i; | ||||