基于mplayer的简易影音播放器

这篇博客介绍了如何利用mplayer的slave模式创建一个简单的影音播放器,支持快进、快退、暂停、退出等操作。通过在终端中输入命令,可以控制mplayer进行播放、音量调节和切换上下曲目等功能。
摘要由CSDN通过智能技术生成

快进/快退/暂停/退出/播放/播放上一个/播放下一个/音量变大/音量变小/静音....
        
        mplayer开源的多媒体播放器。
            
        mplayer另外的一种工作模式:从(slave)模式
        
        在slave模式下,mplayer为后台运行其它程序,不再截获键盘事件,mplayer
        会从标准输入读取一个换行符分隔开的命令。
                    
    mplayer所支持的命令可以通过:
        mplayer -input cmdlist

a.头文件部分

#ifndef __HEAD_H__
#define __HEAD_H__


#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>
#include <semaphore.h>

#endif
#include "head.h"

//Mplayer_Exitw为1表示退出当前歌曲的播放,为0表示不退出
int Mplayer_Exit = 0;

//如果为1表示自动模式,为0表示手动模式
int sta = 0;

//Quit为1表示退出整个进程,为0表示不退出
int Quit = 0;

//MP4的保存路径
#define MP4_PATH "/mnt/hgfs/code"

//有名管道的路径
#define FIFONAME "/home/china/test.fifo"

//文件的类型
typedef enum File_Type
{
	FILE_MP3,FILE_MP4,FILE_C,FILE_H,FILE_CPP,FILE_BMP,FILE_JPG,UNKOWN_TYPE = 1000
}FILE_TYPE;

//文件名最大的长度
#define MAX_LEN  256

typede
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值