[Mplayer-cvslog] CVS: main/libmpdemux demux_fli.c,NONE,1.1 Makefile,1.10,1.11 demuxer.c,1.50,1.51 demuxer.h,1.21,1.22
Mike Melanson
melanson at mplayer.dev.hu
Sun Nov 25 00:58:15 CET 2001
- Previous message: [Mplayer-cvslog] CVS: main msvidc.c,1.2,1.3
- Next message: [Mplayer-cvslog] CVS: main help_mp-cz.h,1.3,1.4 help_mp-de.h,1.14,1.15 help_mp-dk.h,1.1,1.2 help_mp-en.h,1.12,1.13 help_mp-es.h,1.1,1.2 help_mp-fr.h,1.4,1.5 help_mp-hu.h,1.17,1.18 help_mp-nl.h,1.3,1.4 help_mp-no.h,1.1,1.2 help_mp-pl.h,1.13,1.14 help_mp-ro.h,1.1,1.2 help_mp-ru.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv19860/libmpdemux
Modified Files:
Makefile demuxer.c demuxer.h
Added Files:
demux_fli.c
Log Message:
mostly complete support for loading and decoding FLI/FLC animations
--- NEW FILE ---
/*
FLI file parser for the MPlayer program
by Mike Melanson
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "stream.h"
#include "demuxer.h"
#include "stheader.h"
typedef struct _fli_frames_t {
int num_frames;
int current_frame;
off_t *filepos;
unsigned int *frame_size;
} fli_frames_t;
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
int demux_fli_fill_buffer(demuxer_t *demuxer){
fli_frames_t *frames = (fli_frames_t *)demuxer->priv;
// see if the end has been reached
if (frames->current_frame == frames->num_frames)
return 0;
// fetch the frame from the file
// first, position the file properly since ds_read_packet() doesn't
// seem to do it, even though it takes a file offset as a parameter
stream_seek(demuxer->stream, frames->filepos[frames->current_frame]);
ds_read_packet(demuxer->video,
demuxer->stream,
frames->frame_size[frames->current_frame],
0, /* not sure what pts is for */
frames->filepos[frames->current_frame],
0 /* what flags? */
);
// get the next frame ready
frames->current_frame++;
return 1;
}
demuxer_t* demux_open_fli(demuxer_t* demuxer){
sh_video_t *sh_video = NULL;
fli_frames_t *frames = (fli_frames_t *)malloc(sizeof(fli_frames_t));
int frame_number;
// go back to the beginning
stream_reset(demuxer->stream);
stream_seek(demuxer->stream, 0);
demuxer->movi_start = 128;
demuxer->movi_end = stream_read_dword_le(demuxer->stream);
// skip the magic number
stream_skip(demuxer->stream, 2);
// fetch the number of frames
frames->num_frames = stream_read_word_le(demuxer->stream);
frames->current_frame = 0;
// allocate enough entries for the indices
frames->filepos = (off_t *)malloc(frames->num_frames * sizeof(off_t));
frames->frame_size = (int *)malloc(frames->num_frames * sizeof(int));
// create a new video stream header
sh_video = new_sh_video(demuxer, 0);
// make sure the demuxer knows about the new video stream header
// (even though new_sh_video() ought to take care of it)
demuxer->video->sh = sh_video;
// make sure that the video demuxer stream header knows about its
// parent video demuxer stream (this is getting wacky), or else
// video_read_properties() will choke
sh_video->ds = demuxer->video;
// custom fourcc for internal MPlayer use
sh_video->format = mmioFOURCC('F', 'L', 'I', 'C');
sh_video->disp_w = stream_read_word_le(demuxer->stream);
sh_video->disp_h = stream_read_word_le(demuxer->stream);
// skip the video depth and flags
stream_skip(demuxer->stream, 4);
// get the speed
sh_video->fps = 1000 / stream_read_word_le(demuxer->stream);
sh_video->frametime = 1/sh_video->fps;
// build the frame index
stream_seek(demuxer->stream, demuxer->movi_start);
frame_number = 0;
while ((!stream_eof(demuxer->stream)) && (frame_number < frames->num_frames))
{
frames->filepos[frame_number] = stream_tell(demuxer->stream);
frames->frame_size[frame_number] = stream_read_dword_le(demuxer->stream);
stream_skip(demuxer->stream, frames->frame_size[frame_number] - 4);
frame_number++;
}
demuxer->priv = frames;
return demuxer;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/Makefile,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Makefile 17 Nov 2001 00:23:03 -0000 1.10
+++ Makefile 24 Nov 2001 23:58:12 -0000 1.11
@@ -3,7 +3,7 @@
include ../config.mak
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c demux_mpg.c demux_viv.c demuxer.c dvdauth.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c frequencies.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c demux_mpg.c demux_viv.c demuxer.c dvdauth.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c frequencies.c demux_fli.c
ifeq ($(STREAMING),yes)
SRCS += asf_streaming.c url.c http.c network.c
endif
Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- demuxer.c 23 Nov 2001 18:51:32 -0000 1.50
+++ demuxer.c 24 Nov 2001 23:58:12 -0000 1.51
@@ -149,6 +149,7 @@
// return value:
// 0 = EOF or no stream found or invalid type
// 1 = successfully read a packet
+int demux_fli_fill_buffer(demuxer_t *demux);
int demux_mpg_es_fill_buffer(demuxer_t *demux);
int demux_mpg_fill_buffer(demuxer_t *demux);
int demux_avi_fill_buffer(demuxer_t *demux);
@@ -170,6 +171,7 @@
// Note: parameter 'ds' can be NULL!
// printf("demux->type=%d\n",demux->type);
switch(demux->type){
+ case DEMUXER_TYPE_FLI: return demux_fli_fill_buffer(demux);
case DEMUXER_TYPE_MPEG_ES: return demux_mpg_es_fill_buffer(demux);
case DEMUXER_TYPE_MPEG_PS: return demux_mpg_fill_buffer(demux);
case DEMUXER_TYPE_AVI: return demux_avi_fill_buffer(demux);
@@ -354,6 +356,7 @@
demuxer_t* demux_open_avi(demuxer_t* demuxer);
int mov_check_file(demuxer_t* demuxer);
int mov_read_header(demuxer_t* demuxer);
+int demux_open_fli(demuxer_t* demuxer);
extern int vivo_check_file(demuxer_t *demuxer);
extern void demux_open_vivo(demuxer_t *demuxer);
@@ -381,6 +384,20 @@
file_format=DEMUXER_TYPE_TV;
}
#endif
+//=============== Try to open as FLI file: =================
+if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_FLI){
+ demuxer=new_demuxer(stream,DEMUXER_TYPE_FLI,audio_id,video_id,dvdsub_id);
+ {
+ int size=stream_read_dword_le(demuxer->stream);
+ int id=stream_read_word_le(demuxer->stream);
+ // chech for the FLI file magic number
+ if((id==0xAF11) || (id==0xAF12)){
+ mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_DetectedFLIfile);
+ file_format=DEMUXER_TYPE_FLI;
+ }
+ }
+}
+
//=============== Try to open as AVI file: =================
if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_AVI){
demuxer=new_demuxer(stream,DEMUXER_TYPE_AVI,audio_id,video_id,dvdsub_id);
@@ -481,6 +498,10 @@
demuxer->file_format=file_format;
switch(file_format){
+ case DEMUXER_TYPE_FLI: {
+ if (!demux_open_fli(demuxer)) return NULL;
+ break;
+ }
case DEMUXER_TYPE_MOV: {
if(!mov_read_header(demuxer)) return NULL;
// sh_video=d_video->sh;if(sh_video) sh_video->ds=d_video;
Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- demuxer.h 22 Nov 2001 15:39:53 -0000 1.21
+++ demuxer.h 24 Nov 2001 23:58:12 -0000 1.22
@@ -12,6 +12,7 @@
#define DEMUXER_TYPE_MOV 7
#define DEMUXER_TYPE_VIVO 8
#define DEMUXER_TYPE_TV 9
+#define DEMUXER_TYPE_FLI 10
#define DEMUXER_TIME_NONE 0
#define DEMUXER_TIME_PTS 1
- Previous message: [Mplayer-cvslog] CVS: main msvidc.c,1.2,1.3
- Next message: [Mplayer-cvslog] CVS: main help_mp-cz.h,1.3,1.4 help_mp-de.h,1.14,1.15 help_mp-dk.h,1.1,1.2 help_mp-en.h,1.12,1.13 help_mp-es.h,1.1,1.2 help_mp-fr.h,1.4,1.5 help_mp-hu.h,1.17,1.18 help_mp-nl.h,1.3,1.4 help_mp-no.h,1.1,1.2 help_mp-pl.h,1.13,1.14 help_mp-ro.h,1.1,1.2 help_mp-ru.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the MPlayer-cvslog
mailing list