[過去ログ] DVD再生ソフトウェア (983レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
470: 02/08/20 16:30 ID:C1Epl3BU(1/7) AAS
>>468
-aspect 16:9 -zoom

471: 02/08/20 19:30 ID:C1Epl3BU(2/7) AAS
mencoder に vorbis 吐かせられるように hack しようとして力つきますた。
誰か続きやりませんか?

Index: cfg-mencoder.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mencoder.h,v
retrieving revision 1.49
diff -r1.49 cfg-mencoder.h
85a86,90
> #ifdef HAVE_VORBIS
> {"vorbis", &out_audio_codec, CONF_TYPE_FLAG, 0, 0, ACODEC_VORBIS, NULL},
> #else
> {"vorbis", "MPlayer was compiled without vorbis support!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
> #endif
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.147
diff -r1.147 mencoder.c
0a1
> #define HAVE_VORBIS 1
13c14,15
< #define ACODEC_NULL 3
---
> #define ACODEC_VORBIS 3
> #define ACODEC_NULL 4
55a58,62
> #ifdef HAVE_VORBIS
> #undef CDECL
> #include <vorbis/vorbisenc.h>
> #endif /* HAVE_VORBIS */
>
189a197,218
> #ifdef HAVE_VORBIS
> typedef struct oggvorbis_struct_st {
> ogg_stream_state os; /* take physical pages, weld into a logical
> stream of packets */
> ogg_page og; /* one Ogg bitstream page. Vorbis packets are inside */
> ogg_packet op; /* one raw packet of data for decode */
>
> vorbis_info vi; /* struct that stores all the static vorbis bitstream
> settings */
> vorbis_comment vc; /* struct that stores all the bitstream user comments */
> vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
> vorbis_block vb; /* local working space for packet->PCM decode */
> ogg_packet header;
> ogg_packet header_comm;
> ogg_packet header_code;
> int eos, buf_len;
> int first;
> char *buf;
> } oggvorbis_struct_t;
> struct oggvorbis_struct_st *ov;
> #endif
>

472: 02/08/20 19:32 ID:C1Epl3BU(3/7) AAS
768a798,864
> case ACODEC_VORBIS:
> printf("Vorbis audio (testing) selected\n");
> ov = (struct oggvorbis_struct_st*)malloc(sizeof(struct oggvorbis_struct_st));
>
> ov->eos = 0, ov->buf_len = 0;
> ov->first = 1;
>
> ov->buf = (char *)malloc(32768);
>
> vorbis_info_init(&ov->vi);
> vorbis_encode_init_vbr(&ov->vi,sh_audio->channels,
> sh_audio->samplerate,.5);
>
> /* add a comment */
> vorbis_comment_init(&ov->vc);
> vorbis_comment_add_tag(&ov->vc,"ENCODER","encoder_example.c");
>
> /* set up the analysis state and auxiliary encoding storage */
> vorbis_analysis_init(&ov->vd, &ov->vi);
> vorbis_block_init(&ov->vd, &ov->vb);
>
> /* set up our packet->stream encoder */
> /* pick a random serial number; that way we can more likely build
> chained streams just by concatenation */
> srand(time(NULL));
> ogg_stream_init(&ov->os,rand());
>
> /* Vorbis streams begin with three headers; the initial header (with
> most of the codec setup parameters) which is mandated by the Ogg
> bitstream spec. The second header holds any comment fields. The
> third header holds the bitstream codebook. We merely need to
> make the headers, then pass them to libvorbis one at a time;
> libvorbis handles the additional Ogg bitstream constraints */
>
> vorbis_analysis_headerout(&ov->vd, &ov->vc, &ov->header, &ov->header_comm,
> &ov->header_code);
> /* automatically placed in its own page */
> ogg_stream_packetin(&ov->os, &ov->header);
> ogg_stream_packetin(&ov->os, &ov->header_comm);
> ogg_stream_packetin(&ov->os, &ov->header_code);
>
> while(!ov->eos){
> int ov_count = 0;
> int result=ogg_stream_flush(&ov->os,&ov->og);
> if(result==0) break;
> // fwrite(og.header,1,og.header_len,stdout);
> memcpy(ov->buf+ov->buf_len, ov->og.header, ov->og.header_len);
> ov->buf_len += ov->og.header_len;
> // fwrite(og.body,1,og.body_len,stdout);
> memcpy(ov->buf+ov->buf_len, ov->og.body, ov->og.body_len);
> ov->buf_len += ov->og.body_len;
> }

473: 02/08/20 19:33 ID:C1Epl3BU(4/7) AAS
> printf("mux_a->wf->cbSize = %d\n",ov->buf_len);
> mux_a->h.dwSampleSize=0; // VBR
> mux_a->h.dwRate=force_srate?force_srate:sh_audio->samplerate;
> mux_a->h.dwScale=1; /* fixme */
> mux_a->wf=malloc(sizeof(WAVEFORMATEX) + ov->buf_len);
> mux_a->wf->wFormatTag=0xFFFE; // vorbis
> mux_a->wf->nChannels= sh_audio->channels;
> mux_a->wf->nSamplesPerSec=force_srate?force_srate:sh_audio->samplerate; /*fixme */
> mux_a->wf->nAvgBytesPerSec=192000/8; // FIXME!
> mux_a->wf->nBlockAlign=mux_a->h.dwSampleSize; /* fixme */
> mux_a->wf->wBitsPerSample=0; //16;
> mux_a->wf->cbSize=ov->buf_len; // must be fixed after init
> memcpy((char *)mux_a->wf+sizeof(WAVEFORMATEX), (char *)ov->buf, ov->buf_len);
> // free(ov->buf);
> break;
939a1040,1096
> #ifdef HAVE_VORBIS
> case ACODEC_VORBIS:
> //printf("buf:%d(%d)\n", sh_audio->a_buffer_len,sh_audio->a_buffer_size);
> len = 0;
> if (ov->first) {
> memcpy((void *)mux_a->buffer+mux_a->buffer_len, (void *)ov->buf, ov->buf_len);
> len = ov->buf_len;
> ov->first = 0;
>
> }
>

474: 02/08/20 19:34 ID:C1Epl3BU(5/7) AAS
> /* while(mux_a->buffer_len<4 && !ov->eos) */{
> #define OV_READ 1024
> signed char tmp[OV_READ];
> int ov_i, tmplen;
> float **buffer;
>
> tmplen = dec_audio(sh_audio,tmp,OV_READ);
>
> if(tmplen<=0) break; // eof
> /* data to encode */
> /* expose the buffer to submit data */
> buffer=vorbis_analysis_buffer(&ov->vd,OV_READ);
>
> /* tell the library how much we actually submitted */
> ov_i = tmplen / 4;
> vorbis_analysis_wrote(&ov->vd, ov_i);
>
> while(vorbis_analysis_blockout(&ov->vd,&ov->vb)==1){
> vorbis_analysis(&ov->vb,NULL);
> vorbis_bitrate_addblock(&ov->vb);
>
> while(vorbis_bitrate_flushpacket(&ov->vd,&ov->op)){
> ogg_stream_packetin(&ov->os,&ov->op);
>
> while(!ov->eos){
> int result=ogg_stream_pageout(&ov->os,&ov->og);
> int wrotelen;
> if(result==0)break;
> // fwrite(og.header,1,og.header_len,stdout);
> memcpy((void *)mux_a->buffer+mux_a->buffer_len, (void *)ov->og.header, ov->og.header_len);
> mux_a->buffer_len += ov->og.header_len;
> // fwrite(og.body,1,og.body_len,stdout);
> memcpy((void *)mux_a->buffer+mux_a->buffer_len, (void *)ov->og.body, ov->og.body_len);
> mux_a->buffer_len += ov->og.body_len;
> len = ov->og.header_len + ov->og.body_len;
>
> if(ogg_page_eos(&ov->og))ov->eos=1;
> }
> }
> }
> if(len<0) break; // error
> }
> //printf("len:%d, buf:%d(%d)\n",
> // len, sh_audio->a_buffer_len, sh_audio->a_buffer_size);
> break;
> #endif

475: 02/08/20 19:35 ID:C1Epl3BU(6/7) AAS
1201a1359,1376
> }
> #endif
> #ifdef HAVE_VORBIS
> if(sh_audio && mux_a->codec==ACODEC_VORBIS) {
> /* clean up and exit. vorbis_info_clear() must be called last */
> ogg_stream_clear(&ov->os);
> vorbis_block_clear(&ov->vb);
> vorbis_dsp_clear(&ov->vd);
> vorbis_comment_clear(&ov->vc);
> vorbis_info_clear(&ov->vi);
>
> mux_a->h.dwSampleSize=1;
> mux_a->h.dwLength=mux_a->size;
> mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec;
> mux_a->h.dwScale=1;
> mux_a->wf->nBlockAlign=1;
> printf("\n\nvorbis audio: %d bytes/sec, %d bytes/block\n",
> mux_a->h.dwRate,(mux_a->size+(mux_a->h.dwLength>>1))/mux_a->h.dwLength);

476: 02/08/20 19:35 ID:C1Epl3BU(7/7) AAS
今の段階では、うまくヘッダを吐けてないらしいです。
スーパーハカーの方の出現をお待ちしてます。
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.024s