Skip to content

Commit a338c36

Browse files
committed
[module-ffmpeg] A completely redesigned video player.
Uses all possible DMA, hardware YUV converter, hardware native sound, special file system and memory optimizations.
1 parent 77688ce commit a338c36

File tree

12 files changed

+2239
-1805
lines changed

12 files changed

+2239
-1805
lines changed

include/ffmpeg.h

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* \file ffmpeg.h
3+
* \brief DreamShell FFmpeg module
4+
* \date 2025
5+
* \author SWAT www.dc-swat.ru
6+
*/
7+
8+
#ifndef __DS_FFMPEG_H
9+
#define __DS_FFMPEG_H
10+
11+
#include <arch/types.h>
12+
#include <stdint.h>
13+
14+
#ifdef __cplusplus
15+
extern "C" {
16+
#endif
17+
18+
typedef struct ffplay_params {
19+
int x;
20+
int y;
21+
int width;
22+
int height;
23+
float scale;
24+
int fullscreen;
25+
26+
int loop;
27+
int verbose;
28+
const char *force_format;
29+
int show_stat;
30+
void (*update_callback)(int64_t current_pos, int64_t total_duration);
31+
} ffplay_params_t;
32+
33+
typedef struct ffplay_info {
34+
int64_t duration;
35+
const char *format;
36+
const char *video_codec;
37+
const char *audio_codec;
38+
int width;
39+
int height;
40+
float fps;
41+
int video_bitrate;
42+
int audio_bitrate;
43+
int audio_channels;
44+
} ffplay_info_t;
45+
46+
/*
47+
Starts video playback.
48+
*/
49+
int ffplay(const char *filename, ffplay_params_t *params);
50+
51+
/*
52+
Stops the currently playing video.
53+
*/
54+
void ffplay_shutdown();
55+
56+
/*
57+
Toggles pause for the currently playing video.
58+
*/
59+
void ffplay_toggle_pause();
60+
61+
/*
62+
Seek to the specified position in milliseconds.
63+
*/
64+
int ffplay_seek(int64_t pos_ms);
65+
66+
/*
67+
Get information about the currently playing video.
68+
Returns: 0 on success, -1 if not playing.
69+
*/
70+
int ffplay_info(ffplay_info_t *info);
71+
72+
/*
73+
Get current playback position in milliseconds.
74+
Returns: current position in ms, or -1 if not playing.
75+
*/
76+
int64_t ffplay_get_pos();
77+
78+
/*
79+
Checks if a video is currently paused.
80+
Returns: 1 if paused, 0 otherwise.
81+
*/
82+
int ffplay_is_paused();
83+
84+
/*
85+
Checks if a video is currently playing (even if paused).
86+
Returns: 1 if playing, 0 otherwise.
87+
*/
88+
int ffplay_is_playing();
89+
90+
#ifdef __cplusplus
91+
}
92+
#endif
93+
94+
#endif /* __DS_FFMPEG_H */

modules/ffmpeg/Makefile

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,43 @@
11
#
22
# ffmpeg module for DreamShell
3-
# Copyright (C)2011-2024 SWAT
3+
# Copyright (C)2011-2025 SWAT
44
# http://www.dc-swat.ru
55
#
66

77
TARGET_NAME = ffmpeg
8-
OBJS = module.o player.o aica.o mpg123.o oggvorbis.o #xvid.o
9-
DBG_LIBS = -lds -lbzip2 -loggvorbis -lmpg123 #-lxvidcore
10-
LIBS = -lavcodec -lavformat -lavutil #-lswscale
8+
OBJS = module.o player.o pcm.o
9+
DBG_LIBS = -lds
10+
LIBS = -lavcodec -lavformat -lavutil
1111
EXPORTS_FILE = exports.txt
12+
# EXPORTS_FILE = exports_ffmpeg.txt
1213
GCC_LIB =
14+
FFMPEG_PATH = ffmpeg-0.6.3
15+
# FFMPEG_PATH = FFmpeg
1316

14-
VER_MAJOR = 0
15-
VER_MINOR = 6
16-
VER_MICRO = 3
17+
VER_MAJOR = 2
18+
VER_MINOR = 0
19+
VER_MICRO = 0
1720

18-
KOS_CFLAGS += -I./include
21+
KOS_CFLAGS += -I./include -O3
1922
KOS_LIB_PATHS += -L./lib
2023

21-
all: rm-elf ffmpeg-0.6.3/config.h include/libavcodec/avcodec.h
24+
all: rm-elf $(FFMPEG_PATH)/config.h include/libavcodec/avcodec.h
2225

2326
include ../../sdk/Makefile.loadable
2427

25-
ffmpeg-0.6.3/config.h:
26-
-mv $(KOS_PORTS)/lib/libogg.a $(KOS_PORTS)/lib/libogg-kos.a
27-
-mv $(KOS_PORTS)/lib/libvorbis.a $(KOS_PORTS)/lib/libvorbis-kos.a
28+
$(FFMPEG_PATH)/config.h:
2829
./config.sh
30+
# git clone --depth 1 --branch release/2.2 https://github.com/FFmpeg/FFmpeg.git
2931

3032
include/libavcodec/avcodec.h:
31-
@-mv $(KOS_PORTS)/lib/libogg.a $(KOS_PORTS)/lib/libogg-kos.a
32-
@-mv $(KOS_PORTS)/lib/libvorbis.a $(KOS_PORTS)/lib/libvorbis-kos.a
33-
cd ./ffmpeg-0.6.3 && make install
34-
-mv $(KOS_PORTS)/lib/libogg-kos.a $(KOS_PORTS)/lib/libogg.a
35-
-mv $(KOS_PORTS)/lib/libvorbis-kos.a $(KOS_PORTS)/lib/libvorbis.a
33+
cd ./$(FFMPEG_PATH) && make install
3634

3735
clean: rm-elf
3836
-rm -f $(OBJS)
39-
cd ./ffmpeg-0.6.3 && make clean
37+
cd ./$(FFMPEG_PATH) && make clean
4038
-rm -R ./include
4139
-rm -R ./lib
42-
-rm -f ./ffmpeg-0.6.3/config.h
40+
-rm -f ./$(FFMPEG_PATH)/config.h
4341

4442
rm-elf:
4543
-rm -f $(TARGET) || true

modules/ffmpeg/aica.c

Lines changed: 0 additions & 212 deletions
This file was deleted.

modules/ffmpeg/aica.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)