int libvhls_mod_init(const struct ammodule_t* module, int flags) { LOGI("libvhls module init\n"); av_register_protocol(&vhls_protocol); av_register_protocol(&vrwc_protocol);//add for verimatrix drm link return 0; }
/** * ffmpeg_init * Initializes for libavformat. * * Returns * Function returns nothing. */ void ffmpeg_init() { MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO, "%s: ffmpeg LIBAVCODEC_BUILD %d" " LIBAVFORMAT_BUILD %d", LIBAVCODEC_BUILD, LIBAVFORMAT_BUILD); av_register_all(); #if LIBAVCODEC_BUILD > 4680 av_log_set_callback((void *)ffmpeg_avcodec_log); av_log_set_level(AV_LOG_ERROR); #endif #if defined FF_API_NEW_AVIO #else /* * Copy the functions to use for the append file protocol from the standard * file protocol. */ mpeg1_file_protocol.url_read = file_protocol.url_read; mpeg1_file_protocol.url_write = file_protocol.url_write; mpeg1_file_protocol.url_seek = file_protocol.url_seek; mpeg1_file_protocol.url_close = file_protocol.url_close; /* Register the append file protocol. */ #ifdef have_av_register_protocol2 av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol)); #elif defined have_av_register_protocol av_register_protocol(&mpeg1_file_protocol); #else # warning av_register_protocolXXX missing #endif #endif // FF_API_NEW_AVIO }
int register_ffmpeg_evbuffer_url_protocol(void) { int ret; ret = av_register_protocol(&evbuffer_protocol); return ret; }
int libcurl_mod_init(const struct ammodule_t* module, int flags) { CLOGI("libcurl module init\n"); char * ver = NULL; ver = curl_version(); CLOGI("curl version : [%s]", ver); curl_global_init(CURL_GLOBAL_ALL); av_register_protocol(&ff_curl_protocol); return 0; }
int register_list_demux_all(void) { static int registered_all=0; if(registered_all) return; registered_all++; extern struct list_demux m3u_demux; av_register_protocol(&file_list_protocol); register_list_demux(&m3u_demux); return 0; }
void SWDecoder::setupCodec() { int res = 0; av_register_all(); memset(&mProto, 0, sizeof(mProto)); mProto.name = "dvrdecode"; mProto.url_open = ffmpeg_open; mProto.url_read = ffmpeg_read; mProto.url_close = ffmpeg_close; res = av_register_protocol(&mProto); if(res) { std::cerr << boost::format("Error registering ffmpeg protocol:%s") % strerror(errno) << std::endl; } }
//static int AmlogicPlayerStreamSource::init(void) { static URLProtocol androidstreamsource_protocol; static int inited = 0; URLProtocol *prot = &androidstreamsource_protocol; if (inited > 0) { return 0; } inited++; prot->name = "IStreamSource"; prot->url_open = (int (*)(URLContext *, const char *, int))amopen; prot->url_read = (int (*)(URLContext *, unsigned char *, int))amread; prot->url_write = (int (*)(URLContext *, unsigned char *, int))amwrite; prot->url_seek = (int64_t (*)(URLContext *, int64_t , int))amseek; prot->url_close = (int (*)(URLContext *))amclose; prot->url_get_file_handle = (int (*)(URLContext *))get_file_handle; av_register_protocol(prot); return 0; }
/* ffmpeg_init initializes for libavformat. */ void ffmpeg_init() { motion_log(LOG_INFO, 0, "ffmpeg LIBAVCODEC_BUILD %d LIBAVFORMAT_BUILD %d", LIBAVCODEC_BUILD, LIBAVFORMAT_BUILD); av_register_all(); #if LIBAVCODEC_BUILD > 4680 av_log_set_callback( (void *)ffmpeg_avcodec_log ); #endif /* Copy the functions to use for the append file protocol from the standard * file protocol. */ mpeg1_file_protocol.url_read = file_protocol.url_read; mpeg1_file_protocol.url_write = file_protocol.url_write; mpeg1_file_protocol.url_seek = file_protocol.url_seek; mpeg1_file_protocol.url_close = file_protocol.url_close; /* Register the append file protocol. */ #if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8) av_register_protocol(&mpeg1_file_protocol); #else register_protocol(&mpeg1_file_protocol); #endif }
int register_protocol(URLProtocol *protocol) { return av_register_protocol(protocol); }
/* * Class: com_farcore_playerservice_MediaPlayer * Method: addMediaSource * Signature: (Ljava/lang/String;III)I */ JNIEXPORT jint JNICALL Java_com_farcore_playerservice_AmPlayer_setMediaFd (JNIEnv *env, jobject obj, jobject fileDescriptor,jint isloop, jint pMode,jint st,jlong offset, jlong length){ int pid = -1; char * file=NULL; jclass clazz = (*env)->GetObjectClass(env, obj); gMplayerClazz =(*env)->NewGlobalRef(env,clazz); if(gMplayerClazz){ ALOGI("get mediaplayer class"); }else{ ALOGE("can't get mediaplayer class"); return -100; } gPostMid = (*env)->GetStaticMethodID(env, gMplayerClazz, "onUpdateState", "(IIIIIII)V"); if(gPostMid){ ALOGI("get update state object id"); }else{ ALOGE("failed to get update object id"); return -101; } URLProtocol *prot=&android_protocol; prot->name="android"; prot->url_open=(int (*)(URLContext *, const char *, int ))vp_open; prot->url_read=(int (*)(URLContext *, unsigned char *, int))vp_read; prot->url_write=(int (*)(URLContext *, unsigned char *, int))vp_write; prot->url_seek=(int64_t (*)(URLContext *, int64_t , int))vp_seek; prot->url_close=(int (*)(URLContext *))vp_close; prot->url_get_file_handle = (int (*)(URLContext *))vp_get_file_handle; av_register_protocol(prot); if (fileDescriptor == NULL) { return -1; } int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); if(fd<0 || offset<0) return -1; file=(char *)malloc(128); if(file==NULL) return -1; mAmlogicFile.oldfd=fd; mAmlogicFile.fd = dup(fd); mAmlogicFile.fd_valid=1; mAmlogicFile.mOffset=offset; mAmlogicFile.mLength=length; _plCtrl.t_pos=-1;/*don't seek to 0*/ //mPlay_ctl.t_pos=0;/*don't seek to 0*/ sprintf(file,"android:AmlogicPlayer=[%x:%x],AmlogicPlayer_fd=[%x:%x]", NULL,NULL, (unsigned int)&mAmlogicFile,(~(unsigned int)&mAmlogicFile)); if(_plCtrl.file_name != NULL){ free(_plCtrl.file_name); } memset((void*)&_plCtrl,0,sizeof(play_control_t)); player_register_update_callback(&_plCtrl.callback_fn,&update_player_info,PLAYER_INFO_POP_INTERVAL); //_plCtrl.file_name = strndup(pname,FILENAME_LENGTH_MAX); mAmlogicFile.datasource=file; _plCtrl.file_name=(char*)mAmlogicFile.datasource; _plCtrl.video_index = -1;//MUST _plCtrl.audio_index = -1;//MUST _plCtrl.hassub = 1; //enable subtitle if(pMode == 1){ _plCtrl.nosound = 1; SYS_set_tsync_enable(0);//if no sound,can set to be 0 ALOGI("disable sound"); }else if(pMode ==2){ _plCtrl.novideo = 1; ALOGI("disable video"); } if(st>0){ ALOGI("play start position:%d",st); _plCtrl.t_pos = st; } SYS_set_tsync_enable(1);//if no sound,can set to be 0 if(isloop>0){ _plCtrl.loop_mode =1; ALOGI("set loop mode"); } _plCtrl.need_start = 1; ALOGI("set a media file to play,but need start it using start interface"); pid=player_start(&_plCtrl,0); if(pid<0) { ALOGI("player start failed!error=%d\n",pid); return -1; } //(*env)->ReleaseStringUTFChars(env,url, pname); return pid; }
int libvhls_mod_init(const struct ammodule_t* module, int flags) { LOGI("libvhls module init\n"); av_register_protocol(&vhls_protocol); return 0; }