view libmpdemux/muxer_rawaudio.c @ 19422:718624aec009

r19361: Reintroduce an ugly variant of the -gui/-nogui options. r19348: Add matroska chapter seeking capability. r19286: clarification on -mpegopts :vaspect r19285: New sentences should start on a new line. r19281: don't use vaspect on mpeg1 video streams r19274: Move the section describing the per movie config files up, so it doesn't get seperated from the rest of the config file doc by the config file example r19241: missed some escaping r19240: use DOCS writing standards for default values (asked by diego) r19233: english manpage for pvr:// input r19231: updated en/fr manpages for ao_ivtv r19228: removed default outfile for -ao mpegpes r19206: Improve ao_mpegpes description. r19191: description of the arnd scale video filter parameter r19190: new -ao mpegpes options r19181: - Add missing "00" in -af pan usage line. - Change -af pan usage and description to use a capital 'L' to make the letter easily distinguishable from a '1'. r19161: cosmetics/punctuation/spelling r19149: updated english man page with vo_ivtv description
author kraymer
date Thu, 17 Aug 2006 21:57:01 +0000
parents fa17424b4c7b
children ca9da45d13e9
line wrap: on
line source

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>

#include "help_mp.h"
#include "mp_msg.h"

#include "aviheader.h"
#include "ms_hdr.h"

#include "muxer.h"

static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
    muxer_stream_t* s;
    if (!muxer) return NULL;
    if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
        mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
        return NULL;
    }
    s=malloc(sizeof(muxer_stream_t));
    memset(s,0,sizeof(muxer_stream_t));
    if(!s) return NULL; // no mem!?
    muxer->streams[muxer->avih.dwStreams]=s;
    s->type=type;
    s->id=muxer->avih.dwStreams;
    s->timer=0.0;
    s->size=0;
    s->muxer=muxer;
    switch(type){
    case MUXER_TYPE_AUDIO:
        s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
        s->h.fccType=streamtypeAUDIO;
        muxer->avih.dwStreams++;
        break;
    case MUXER_TYPE_VIDEO:
        mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
        s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
        s->h.fccType=streamtypeAUDIO;
        break;
    default:
        mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
        return NULL;
    }
    return s;
}

static void rawaudiofile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags, double dts, double pts){
    muxer_t *muxer=s->muxer;

    // write out the chunk:
    if (s->type==MUXER_TYPE_AUDIO)
        fwrite(s->buffer,len,1,muxer->file);
}

static void rawaudiofile_write_header(muxer_t *muxer){
    return;
}

static void rawaudiofile_write_index(muxer_t *muxer){
    return;
}

int muxer_init_muxer_rawaudio(muxer_t *muxer){
    muxer->cont_new_stream = &rawaudiofile_new_stream;
    muxer->cont_write_chunk = &rawaudiofile_write_chunk;
    muxer->cont_write_header = &rawaudiofile_write_header;
    muxer->cont_write_index = &rawaudiofile_write_index;
    return 1;
}