1
mirror of https://github.com/mpv-player/mpv synced 2025-01-13 00:06:25 +01:00

new mpeg muxer compatible with dvd/[s]vcd; small changes in the muxer layer (sanity checks in the muxer_init functions)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14754 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2005-02-21 21:45:49 +00:00
parent 4dc848b803
commit 10069de306
6 changed files with 2364 additions and 352 deletions

View File

@ -72,6 +72,7 @@ extern m_option_t x264encopts_conf[];
#endif
extern m_option_t nuvopts_conf[];
extern m_option_t mpegopts_conf[];
m_option_t ovc_conf[]={
{"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_COPY, NULL},
@ -269,6 +270,7 @@ m_option_t mencoder_opts[]={
#endif
{"nuvopts", nuvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
{"mpegopts", mpegopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#define MAIN_CONF
#include "cfg-common.h"

View File

@ -12,6 +12,11 @@
#include "ms_hdr.h"
#include "muxer.h"
#include "stream.h"
#include "demuxer.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "stheader.h"
muxer_t *muxer_new_muxer(int type,FILE *f){
muxer_t* muxer=malloc(sizeof(muxer_t));
@ -19,14 +24,17 @@ muxer_t *muxer_new_muxer(int type,FILE *f){
muxer->file = f;
switch (type) {
case MUXER_TYPE_MPEG:
muxer_init_muxer_mpeg(muxer);
if(! muxer_init_muxer_mpeg(muxer))
return NULL;
break;
case MUXER_TYPE_RAWVIDEO:
muxer_init_muxer_rawvideo(muxer);
if(! muxer_init_muxer_rawvideo(muxer))
return NULL;
break;
case MUXER_TYPE_AVI:
default:
muxer_init_muxer_avi(muxer);
if(! muxer_init_muxer_avi(muxer))
return NULL;
}
return muxer;
}

View File

@ -8,7 +8,6 @@
#define MUXER_TYPE_MPEG 1
#define MUXER_TYPE_RAWVIDEO 2
#define MUXER_MPEG_BLOCKSIZE 2048 // 2048 or 2324 - ?
typedef struct {
// muxer data:
@ -24,7 +23,9 @@ typedef struct {
unsigned int buffer_len;
// mpeg block buffer:
unsigned char *b_buffer;
unsigned int b_buffer_ptr;
unsigned int b_buffer_size; //size of b_buffer
unsigned int b_buffer_ptr; //index to next data to write
unsigned int b_buffer_len; //len of next data to write
// source stream:
void* source; // sh_audio or sh_video
int codec; // codec used for encoding. 0 means copy
@ -58,23 +59,27 @@ typedef struct muxer_t{
int idx_size;
// streams:
int num_videos; // for MPEG recalculations
int num_audios;
unsigned int sysrate; // max rate in bytes/s
//int num_streams;
muxer_stream_t* def_v; // default video stream (for general headers)
muxer_stream_t* streams[MUXER_MAX_STREAMS];
void (*fix_stream_parameters)(muxer_stream_t *);
void (*cont_write_chunk)(muxer_stream_t *,size_t,unsigned int);
void (*cont_write_header)(struct muxer_t *);
void (*cont_write_index)(struct muxer_t *);
muxer_stream_t* (*cont_new_stream)(struct muxer_t *,int);
FILE* file;
void *priv;
} muxer_t;
muxer_t *muxer_new_muxer(int type,FILE *);
#define muxer_new_stream(muxer,a) muxer->cont_new_stream(muxer,a)
#define muxer_stream_fix_parameters(muxer, a) muxer->fix_stream_parameters(a)
#define muxer_write_chunk(a,b,c) a->muxer->cont_write_chunk(a,b,c)
#define muxer_write_header(muxer) muxer->cont_write_header(muxer)
#define muxer_write_index(muxer) muxer->cont_write_index(muxer)
void muxer_init_muxer_avi(muxer_t *);
void muxer_init_muxer_mpeg(muxer_t *);
void muxer_init_muxer_rawvideo(muxer_t *);
int muxer_init_muxer_avi(muxer_t *);
int muxer_init_muxer_mpeg(muxer_t *);
int muxer_init_muxer_rawvideo(muxer_t *);

View File

@ -660,9 +660,10 @@ static void avifile_write_index(muxer_t *muxer){
}
}
void muxer_init_muxer_avi(muxer_t *muxer){
int muxer_init_muxer_avi(muxer_t *muxer){
muxer->cont_new_stream = &avifile_new_stream;
muxer->cont_write_chunk = &avifile_write_chunk;
muxer->cont_write_header = &avifile_write_header;
muxer->cont_write_index = &avifile_write_index;
return 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -90,9 +90,10 @@ static void rawvideofile_write_index(muxer_t *muxer){
return;
}
void muxer_init_muxer_rawvideo(muxer_t *muxer){
int muxer_init_muxer_rawvideo(muxer_t *muxer){
muxer->cont_new_stream = &rawvideofile_new_stream;
muxer->cont_write_chunk = &rawvideofile_write_chunk;
muxer->cont_write_header = &rawvideofile_write_header;
muxer->cont_write_index = &rawvideofile_write_index;
return 1;
}