位置: 编程技术 - 正文

VLC Android录制视频(vlc录制没反应)

编辑:rootadmin

推荐整理分享VLC Android录制视频(vlc录制没反应),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:vlc mediaplayer怎么录制,vlc录制文件保存在哪,vlc录制没反应,vlc mediaplayer怎么录制,vlc如何录像,vlc如何录像,vlc视频录制,vlc视频录制,内容如对您有帮助,希望把文章链接给更多的朋友!

android的编译及截图,录制视频等功能》里,我找到了用vlc实现Android版本截图的功能,但是录制视频的功能是不正确的。 其录制视频的方法,对vlc底层的开始录制和结束录制,都不能很好的控制。 鉴于此,我们对vlc代码进行修改,编译。 参见 view plaincopy diff –git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h index 2cfedbf..aea — a/include/vlc/libvlc_events.h +++ b/include/vlc/libvlc_events.h @@ -,6 +,8 @@ enum libvlc_event_e { libvlc_MediaPlayerSnapshotTaken, libvlc_MediaPlayerLengthChanged, libvlc_MediaPlayerVout, + libvlc_MediaPlayerRecordableChanged, + libvlc_MediaPlayerRecordingFinished,

@@ -,6 +, @@ typedef struct libvlc_event_t } media_player_pausable_changed; struct { + int new_recordable; + } media_player_recordable_changed; + struct + { + char *psz_filename; + } media_player_recording_finished; + struct + { int new_count; } media_player_vout;

diff –git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h index aefef..8ddef — a/include/vlc/libvlc_media_player.h +++ b/include/vlc/libvlc_media_player.h @@ -,6 +, @@ LIBVLC_API int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int_t i_de

/* @} audio /

+/** + * Can the media player record the current media? + * + * Media must be buffering or playing before it can be recorded. + * + * The media player event manager will emit a libvlc_MediaPlayerRecordableChanged event + * when the recordable state changes after starting media playback. The event data will + * describe the new recordable state, so invocation of this API method is not strictly + * necessary to determine when recording can be started. + * + * A libvlc_MediaPlayerRecordableChanged event will not be emitted if the media is + * stopped (notified by a libvlc_MediaPlayerStoppedEvent) or finishes normally (notified + * by a libvlc_MediaPlayerFinished event). + * + * A calling application should therefore register an event callback for those events + * so that it may query the new recordable state and manage recording at the appropriate + * time. + * + * param p_mi media player + * return true if the media player can record, false if it can not + * version LibVLC 2.1.0 or later + */ +LIBVLC_API bool libvlc_media_player_is_recordable( libvlc_media_player_t *p_mi ); + +/** + * Is the current media being recorded? + * + * param p_mi media player + * return true if recording, false if not + * version LibVLC 2.1.0 or later + */ +LIBVLC_API bool libvlc_media_player_is_recording( libvlc_media_player_t *p_mi ); + +/** + * Start recording the current media. + * + * Media must be buffering or playing before it can be recorded. A calling application + * can begin recording immediately on receipt of a libvlc_MediaPlayerRecordableChanged + * event sent via the media player event manager (if recording is possible for the + * currently playing media), and any time thereafter until the media stops. + * + * Media will be saved to the file path denoted by the psz_filename parameter if it is + * supplied. Any such supplied filename should not include a file extension as the + * correct file extension will automatically be appended when the file is created. This + * filename may denote a full path name, but each directory in the path must already + * exist or recording will silently fail. If the calling application chooses to specify + * the filename then it is the responsibility of that application to take account of + * this and itself make sure any needed directories are created. + * + * Alternatively, a calling application need not supply a filename and so instead let + * vlc automatically generate a unique filename. This will cause vlc to create a new + * file in the appropriate media directory for the user - for example “~/Videos”. The + * actual filename used will be sent in an event when the recording is complete. + * + * When recording has finished and the new file has been completely saved, a + * libvlc_MediaPlayerRecordingFinished event will be sent via the media player event + * manager. The event data will contain the filename of the newly recorded file - this + * will either be the filename as specified by the calling application or a filename + * generated by vlc if the application did not supply a filename. In either case, this + * filename will include the automatically appended file extension. + * + * The saved media file will not be immediately available or visible until recording + * has completely finished and the libvlc_MediaPlayerRecordingFinished event has been + * received, or the media has stopped or finished normally. + * + * Recording can be stopped and started on-the-fly once the recordable state is set; + * each time recording is stopped and restarted a new file will be created so a calling + * application should take care to provide unique filenames, or defer to vlc to create + * unique filenames. + * + * Recording will be stopped when the media stops playing, and must be explicitly + * started again to restart recording, i.e. the recording state is not automatically + * preserved when playing media subsequently. + * + * Media player functionailty such as next/previous chapter, set time or position and + * so on are ineffective when recording is enabled. However, pausing the media is + * possible and will pause the recording; unpausing the media will resume playback and + * recording. + * + * Recording of the primary media or sub-items is possible. + * + * param p_mi media player + * param psz_filename name of the file to save the media to, not including any file extension, + * or NULL if vlc should generate the filename automatically + * return 0 if recording was started, -1 on error + * version LibVLC 2.1.0 or later + */ +LIBVLC_API int libvlc_media_player_record_start( libvlc_media_player_t *p_mi, const char *psz_filename ); + +/** + * Stop recording the current media. + * + * This method requests that the recording stop, and will return immediately. Recording + * will not stop immediately. + * + * When the recording actually stops some short time later and the new file has + * finished being written, a libvlc_MediaPlayerRecordingFinished event will be sent via + * the media player event manager. The newly recorded file will not be visible or + * available until after this event has been sent. + * + * The event data will contain the full name of the file that was created. The filename + * will either be that as was specified by the calling application on invoking + * libvlc_media_player_record_start(), or the filename that vlc automatically generated + * if the calling application did not supply its own filename. In either case the + * filename will contain the automatically appended file extension. + * + * There is no need to invoke this method to stop the recording if the media is stopped + * or finishes playing normally. + * + * param p_mi media player + * return 0 if recording was stopped, -1 on error + * version LibVLC 2.1.0 or later + */ +LIBVLC_API int libvlc_media_player_record_stop( libvlc_media_player_t *p_mi ); + /* @} media_player /

# ifdef __cplusplus diff –git a/lib/event.c b/lib/event.c index caa..7ef4abd — a/lib/event.c +++ b/lib/event.c @@ -,6 +,8 @@ static const event_name_t event_list[] = { DEF(MediaPlayerSnapshotTaken) DEF(MediaPlayerLengthChanged) DEF(MediaPlayerVout) + DEF(MediaPlayerRecordableChanged) + DEF(MediaPlayerRecordingFinished)

diff –git a/lib/libvlc.sym b/lib/libvlc.sym index dad5c..3ffef — a/lib/libvlc.sym +++ b/lib/libvlc.sym @@ -,6 +,8 @@ libvlc_media_player_get_title libvlc_media_player_get_title_count libvlc_media_player_get_xwindow libvlc_media_player_has_vout +libvlc_media_player_is_recordable +libvlc_media_player_is_recording libvlc_media_player_is_seekable libvlc_media_player_is_playing libvlc_media_player_new @@ -,6 +,8 @@ libvlc_media_player_set_pause libvlc_media_player_pause libvlc_media_player_play libvlc_media_player_previous_chapter +libvlc_media_player_record_start +libvlc_media_player_record_stop libvlc_media_player_release libvlc_media_player_retain libvlc_media_player_set_agl diff –git a/lib/media_player.c b/lib/media_player.c index ab8c7.. — a/lib/media_player.c +++ b/lib/media_player.c @@ -,6 +, @@ input_pausable_changed( vlc_object_t * p_this, char const * psz_cmd, vlc_value_t oldval, vlc_value_t newval, void * p_userdata ); static int +input_recordable_changed( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, + void *p_userdata ); +static int input_event_changed( vlc_object_t * p_this, char const * psz_cmd, vlc_value_t oldval, vlc_value_t newval, void * p_userdata ); @@ -,6 +, @@ static int snapshot_was_taken( vlc_object_t *p_this, char const *psz_cmd, vlc_value_t oldval, vlc_value_t newval, void *p_data );

+static int +file_recording_finished( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, void *p_data ); + static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi );

/* @@ -,6 +,8 @@ static void release_input_thread( libvlc_media_player_t *p_mi, bool b_input_abor input_seekable_changed, p_mi ); var_DelCallback( p_input_thread, “can-pause”, input_pausable_changed, p_mi ); + var_DelCallback( p_input_thread, “can-record”, + input_recordable_changed, p_mi ); var_DelCallback( p_input_thread, “intf-event”, input_event_changed, p_mi );

@@ -,6 +, @@ input_pausable_changed( vlc_object_t * p_this, char const * psz_cmd, }

static int +input_recordable_changed( vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, + void *p_userdata ) +{ + VLC_UNUSED(p_this); + VLC_UNUSED(psz_cmd); + VLC_UNUSED(oldval); + + libvlc_media_player_t *p_mi = p_userdata; + libvlc_event_t event; + + event.type = libvlc_MediaPlayerRecordableChanged; + event.u.media_player_recordable_changed.new_recordable = newval.b_bool; + + libvlc_event_send( p_mi->p_event_manager, &event ); + return VLC_SUCCESS; +} + +static int input_event_changed( vlc_object_t * p_this, char const * psz_cmd, vlc_value_t oldval, vlc_value_t newval, void * p_userdata ) @@ -,6 +, @@ static int snapshot_was_taken(vlc_object_t *p_this, char const *psz_cmd, return VLC_SUCCESS; }

+static int file_recording_finished(vlc_object_t *p_this, char const *psz_cmd, + vlc_value_t oldval, vlc_value_t newval, void *p_data ) +{ + VLC_UNUSED(p_this); + VLC_UNUSED(psz_cmd); + VLC_UNUSED(oldval); + + libvlc_media_player_t *p_mi = p_data; + libvlc_event_t event; + + event.type = libvlc_MediaPlayerRecordingFinished; + event.u.media_player_recording_finished.psz_filename = newval.psz_string; + + libvlc_event_send(p_mi->p_event_manager, &event); + return VLC_SUCCESS; +} + static input_thread_t *find_input (vlc_object_t *obj) { libvlc_media_player_t mp = (libvlc_media_player_t )obj; @@ -,6 +, @@ libvlc_media_player_new( libvlc_instance_t *instance ) var_Create (mp, “amem-set-volume”, VLC_VAR_ADDRESS); var_Create (mp, “amem-format”, VLC_VAR_STRING | VLC_VAR_DOINHERIT); var_Create (mp, “amem-rate”, VLC_VAR_INTEGER | VLC_VAR_DOINHERIT); + + var_Create (mp, “recording-finished”, VLC_VAR_STRING); + var_AddCallback (mp, “recording-finished”, file_recording_finished, mp); + var_Create (mp, “amem-channels”, VLC_VAR_INTEGER | VLC_VAR_DOINHERIT);

@@ -,6 +,9 @@ libvlc_media_player_new( libvlc_instance_t *instance ) register_event(mp, TitleChanged); register_event(mp, PausableChanged);

register_event(mp, RecordableChanged); register_event(mp, RecordingFinished);

register_event(mp, Vout);

VLC Android录制视频(vlc录制没反应)

/* Snapshot initialization */ @@ -,6 +,8 @@ static void libvlc_media_player_destroy( libvlc_media_player_t *p_mi ) var_DelCallback( p_mi->p_libvlc, “snapshot-file”, snapshot_was_taken, p_mi );

var_DelCallback( p_mi, “recording-finished”, file_recording_finished, p_mi );

/* No need for lock_input() because no other threads knows us anymore */ if( p_mi->input.p_thread ) release_input_thread(p_mi, true); @@ -, +, @@ int libvlc_media_player_play( libvlc_media_player_t *p_mi )

var_AddCallback( p_input_thread, “can-seek”, input_seekable_changed, p_mi ); var_AddCallback( p_input_thread, “can-pause”, input_pausable_changed, p_mi );

var_AddCallback( p_input_thread, “can-record”, input_recordable_changed, p_mi ); var_AddCallback( p_input_thread, “intf-event”, input_event_changed, p_mi );

if( input_Start( p_input_thread ) ) { unlock_input(p_mi); var_DelCallback( p_input_thread, “intf-event”, input_event_changed, p_mi );

var_DelCallback( p_input_thread, “can-record”, input_recordable_changed, p_mi ); var_DelCallback( p_input_thread, “can-pause”, input_pausable_changed, p_mi ); var_DelCallback( p_input_thread, “can-seek”, input_seekable_changed, p_mi ); vlc_object_release( p_input_thread ); @@ -,3 +, @@ void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi ) vlc_object_release( p_input_thread ); } } +bool libvlc_media_player_is_recordable( libvlc_media_player_t *p_mi ) +{ input_thread_t *p_input_thread; bool b_can_record; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return false; b_can_record = var_GetBool( p_input_thread, “can-record” ); vlc_object_release( p_input_thread ); return b_can_record; +} +bool libvlc_media_player_is_recording( libvlc_media_player_t *p_mi ) +{ input_thread_t *p_input_thread; bool b_record; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return false; b_record = var_GetBool( p_input_thread, “record” ); vlc_object_release( p_input_thread ); return b_record; +} +int libvlc_media_player_record_start( libvlc_media_player_t p_mi, const char psz_filename ) +{ input_thread_t *p_input_thread; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return -1; var_SetString( p_input_thread, “input-record-path”, psz_filename ); var_SetBool( p_input_thread, “record”, true ); vlc_object_release( p_input_thread ); return 0; +} +int libvlc_media_player_record_stop( libvlc_media_player_t *p_mi ) +{ input_thread_t *p_input_thread; p_input_thread = libvlc_get_input_thread( p_mi ); if( !p_input_thread ) return -1; var_SetBool( p_input_thread, “record”, false ); vlc_object_release( p_input_thread ); return 0; +} diff –git a/modules/stream_out/record.c b/modules/stream_out/record.c index de6de..ddfea — a/modules/stream_out/record.c +++ b/modules/stream_out/record.c @@ -,6 +,8 @@ struct sout_stream_sys_t int i_id; sout_stream_id_t **id; mtime_t i_dts_start; char *psz_record_file; };

static void OutputStart( sout_stream_t *p_stream ); @@ -,6 +,8 @@ static int Open( vlc_object_t *p_this ) p_sys->i_dts_start = 0; TAB_INIT( p_sys->i_id, p_sys->id );

p_sys->psz_record_file = NULL;

return VLC_SUCCESS; }

@@ -,6 +, @@ static void Close( vlc_object_t * p_this ) if( p_sys->p_out ) sout_StreamChainDelete( p_sys->p_out, p_sys->p_out );

if( p_sys->psz_record_file ) { for( vlc_object_t *p_mp = p_stream->p_parent; p_mp; p_mp = p_mp->p_parent ) { if( var_Type( p_mp, “recording-finished” ) ) { var_SetString( p_mp, “recording-finished”, p_sys->psz_record_file ); break; } } free( p_sys->psz_record_file ); }

TAB_CLEAN( p_sys->i_id, p_sys->id ); free( p_sys->psz_prefix ); free( p_sys ); @@ -,7 +, @@ static int OutputNew( sout_stream_t *p_stream, }

if( psz_file && psz_extension )

{ p_sys->psz_record_file = strdup( psz_file ); var_SetString( p_stream->p_libvlc, “record-file”, psz_file );

}

free( psz_file ); free( psz_output ); diff –git a/src/input/var.c b/src/input/var.c index fe2..fb9 — a/src/input/var.c +++ b/src/input/var.c @@ -,6 +,9 @@ void input_ControlVarInit ( input_thread_t *p_input ) text.psz_string = _(“Subtitles Track”); var_Change( p_input, “spu-es”, VLC_VAR_SETTEXT, &text, NULL );

/* ES Out */

var_Create( p_input, “input-record-path”, VLC_VAR_STRING | VLC_VAR_DOINHERIT ); /* Special read only objects variables for intf */ var_Create( p_input, “bookmarks”, VLC_VAR_STRING | VLC_VAR_DOINHERIT );

再此基础上,添加jni的接口,编译,然后给java应用层调用,就可以实现Android版的vlc录制视频了。 上一篇Git 常用命令导图 下一篇vlc_android中获取视频播放状态 顶 2 踩

Unity3D游戏开发之跑酷游戏项目讲解 一、游戏策划游戏采用2D界面,角色从左到右奔跑,在路段中随机生成障碍物和金币,玩家需要使用跳跃功能躲开障碍物,在游戏中玩家收集的金币数目

android学习笔记 -- Activity生命周期 一个Activity在启动的时候会执行onCreate()-onStart()-onResume(),在结束(或离开)的时候会执行onPause()-onStop()-onDestroy(),这就是一个Activity的生命周期。因此要

OKHttp源码解析-ConnectionPool对Connection重用机制&Http/Https/SPDY协议选择 原文搬迁至个人站点:

标签: vlc录制没反应

本文链接地址:https://www.jiuchutong.com/biancheng/376555.html 转载请保留说明!

上一篇:翻译androidDoc之4:Develop_Getting started_Building a Simple User Interface(android auto翻译)

下一篇:Unity3D游戏开发之跑酷游戏项目讲解(Unity3D游戏开发引擎)

  • 当月不发工资会影响社保吗
  • 一般纳税人企业所得税是多少
  • 宁波财税网会计招聘
  • 材料入库的会计分录材料采购损失
  • 小规模纳税人企业购进货物和接受应税劳务时
  • 专利银行卡汇款流程
  • 创立一个公司,公司的运营理念
  • 环保设备折旧年限和残值率
  • 开票没有网络可以开票吗
  • 旅游开发公司有什么职位
  • 公司代扣代缴的个人所得税怎么做账
  • 外币资本金使用范围
  • 股权转让时其他股东不配合怎么转让
  • 受托委托加工物资成本包括什么
  • 税务局返还的代征代扣要交增值税吗
  • 学校发票抬头类型填企业还是非企业
  • 外管证开了未用怎么办
  • 营改增后小规模都是三个点吗
  • 年终奖的税收筹措是什么
  • 宣传费开票属于什么费用
  • 在建工程印花税计税依据
  • 个人向公司借贷需要交税吗
  • 维修税控设备分录
  • 高温津贴的发放
  • 收的的挂靠费一般是几个点
  • 代扣代缴增值税可以抵扣进项税?
  • 微型小型车
  • 合同付款会计分录
  • win10鼠标在哪
  • 除了电脑杀毒软件还有啥
  • 如何获取文件夹下所有文件
  • macos big sur卡在
  • 账务处理程序有什么
  • 银行存款收款凭证属于什么凭证
  • 碧峰峡熊猫基地门票
  • iis 7下安装laravel 5.4环境的方法教程
  • php数组的概念是什么
  • 特斯拉适用于什么车型
  • 电子税务局附加税退税在哪看
  • 工会经费的来源包括
  • 电梯安装行业分类
  • 其他综合收益在报表中的位置
  • 什么是进项税转出成本
  • 印花税计算公式
  • php首页
  • PHPCMS num 参数是什么意思?
  • mongodb安装包下载
  • 残保金相关内容有哪些
  • 行政事业单位福利费开支范围文件
  • mysql操作步骤
  • 所得税 补税
  • 合伙制律师事务所和个人律师事务所
  • 小微企业全年营业额不能超过多少
  • 短期理财会计处理
  • 计量差错引起的原材料盘亏
  • 资本公积的核算维度是什么
  • 票据行为的构成要件
  • 售后维修费会计分录
  • 小企业核算方式选独立核算
  • 应收应付可以相互冲销吗
  • windows桌面快捷方式怎么创建
  • win10新预览版
  • 解决mac上不能写字的办法
  • remind32.exe - remind32是什么进程 有什么用
  • mac快捷功能
  • 锁屏壁纸设置后不显示怎么办
  • linux learn
  • android游戏开发框架
  • Cocos2dx3.2 CrazyTetris 单线裁剪 对于判断消除的思考(一)
  • bat定义函数
  • vue3官方文档
  • jQuery webuploader分片上传大文件
  • Android studio第一行报错
  • 安卓手机管家怎么关闭
  • jqueryw3c
  • 冲红和红冲的区别
  • 特定公共服务是什么意思
  • 内蒙古国税网上办税厅
  • 小企业会计准则会计科目表
  • 税控发票打印发票流程
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设