示例#1
1
void show_protocols(void)
{
    void *opaque = NULL;
    const char *name;

    printf("Supported file protocols:\n"
           "Input:\n");
    while ((name = avio_enum_protocols(&opaque, 0)))
        printf("%s\n", name);
    printf("Output:\n");
    while ((name = avio_enum_protocols(&opaque, 1)))
        printf("%s\n", name);
}
示例#2
0
static int is_avio_supported_protocol(xine_t *xine, const char *mrl)
{
  char *mrl_protocol = strdup(mrl);
  char *pt = strchr(mrl_protocol, ':');
  int   result = 0;

  if (pt) {
    const char *protocol;
    void       *iter;

    *pt = 0;

    for (iter = NULL; NULL != (protocol = avio_enum_protocols(&iter, 0)); ) {
      if (!strcmp(mrl_protocol, protocol)) {
        xprintf (xine, XINE_VERBOSITY_LOG, LOG_MODULE": using avio protocol '%s' for '%s'\n", protocol, mrl);
        result = 1;
      }
    }
  }

  if (!result) {
    xprintf (xine, XINE_VERBOSITY_LOG, LOG_MODULE": no avio protocol for '%s'\n", mrl);
  }

  free(mrl_protocol);
  return result;
}
示例#3
0
文件: avio.c 项目: andoma/libav
const char *avio_enum_protocols(void **opaque, int output)
{
    URLProtocol **p = opaque;
    *p = *p ? (*p)->next : first_protocol;
    if (!*p) return NULL;
    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
        return (*p)->name;
    return avio_enum_protocols(opaque, output);
}
示例#4
0
文件: avio.c 项目: 0x0B501E7E/ffmpeg
const char *avio_enum_protocols(void **opaque, int output)
{
    URLProtocol **p = (URLProtocol **)opaque;
    *p = ffurl_protocol_next(*p);
    if (!*p) return NULL;
    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
        return (*p)->name;
    return avio_enum_protocols(opaque, output);
}
示例#5
0
const char *avio_enum_protocols(void **opaque, int output)
{
    URLProtocol *p;
    *opaque = ffurl_protocol_next(*opaque);
    if (!(p = *opaque)) return NULL;
    if ((output && p->url_write) || (!output && p->url_read))
        return p->name;
    return avio_enum_protocols(opaque, output);
}
示例#6
0
const char *avio_enum_protocols(void **opaque, int output)
{
    URLProtocol *p = *opaque;
    p = p ? p->next : first_protocol;
    if (!p) return NULL;
    if ((output && p->url_write) || (!output && p->url_read))
        return p->name;
    return avio_enum_protocols(opaque, output);
}
示例#7
0
static inline bool
input_ffmpeg_supported(void)
{
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53,0,0)
	void *opaque = NULL;
	return avio_enum_protocols(&opaque, 0) != NULL;
#else
	return av_protocol_next(NULL) != NULL;
#endif
}
/**
 * com.leixiaohua1020.sffmpegandroidhelloworld.MainActivity.urlprotocolinfo()
 * Protocol Support Information
 */
JNIEXPORT jstring Java_com_leixiaohua1020_sffmpegandroidhelloworld_MainActivity_urlprotocolinfo(JNIEnv *env, jobject obj){
	
	char info[40000]={0};
	av_register_all();

	struct URLProtocol *pup = NULL;
	//Input
	struct URLProtocol **p_temp = &pup;
	avio_enum_protocols((void **)p_temp, 0);
	while ((*p_temp) != NULL){
		sprintf(info, "%s[In ][%10s]\n", info, avio_enum_protocols((void **)p_temp, 0));
	}
	pup = NULL;
	//Output
	avio_enum_protocols((void **)p_temp, 1);
	while ((*p_temp) != NULL){
		sprintf(info, "%s[Out][%10s]\n", info, avio_enum_protocols((void **)p_temp, 1));
	}

	//LOGE("%s", info);
	return (*env)->NewStringUTF(env, info);
}
示例#9
0
文件: AVMuxer.cpp 项目: glwu/QtAV
// TODO: move to QtAV::supportedFormats(bool out). custom protols?
const QStringList &AVMuxer::supportedProtocols()
{
    static bool called = false;
    static QStringList protocols;
    if (called)
        return protocols;
    called = true;
    if (!protocols.isEmpty())
        return protocols;
#if QTAV_HAVE(AVDEVICE)
    protocols << "avdevice";
#endif
    av_register_all(); // MUST register all input/output formats
    void* opq = 0;
    const char* protocol = avio_enum_protocols(&opq, 1);
    while (protocol) {
        // static string, no deep copy needed. but QByteArray::fromRawData(data,size) assumes data is not null terminated and we must give a size
        protocols.append(protocol);
        protocol = avio_enum_protocols(&opq, 1);
    }
    return protocols;
}
示例#10
0
文件: protocols.c 项目: AVLeo/libav
const char *avio_enum_protocols(void **opaque, int output)
{
    const URLProtocol **p = *opaque;

    p = p ? p + 1 : url_protocols;
    *opaque = p;
    if (!*p) {
        *opaque = NULL;
        return NULL;
    }
    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
        return (*p)->name;
    return avio_enum_protocols(opaque, output);
}
示例#11
0
void *init_avio_input_plugin (xine_t *xine, void *data) {
  input_class_t  *this;
  const char     *protocol;
  void           *iter;

  for (iter = NULL; NULL != (protocol = avio_enum_protocols(&iter, 0)); ) {
    xprintf (xine, XINE_VERBOSITY_DEBUG, LOG_MODULE": found avio protocol '%s'\n", protocol);
  }

  this = calloc(1, sizeof(input_class_t));

  pthread_once( &once_control, init_once_routine );

  this->get_instance      = input_avio_get_instance;
  this->description       = N_("libavio input plugin");
  this->identifier        = INPUT_AVIO_ID;
  this->get_dir           = NULL;
  this->get_autoplay_list = NULL;
  this->dispose           = default_input_class_dispose;
  this->eject_media       = NULL;

  return this;
}
示例#12
0
void SysinfoDlg::GetSysinfo(){


//取得系统支持的格式信息(协议,封装格式,编码器)

	av_register_all();
	//初始化
	si.first_c=NULL;
	si.first_if=NULL;
	si.first_up=NULL;

	URLProtocol **pup=&(si.first_up);
	avio_enum_protocols((void **)pup,0);
	int up_index=0;
	while((*pup)!=NULL){
		CString f_index,name,isread,iswrite,priv_data_size;
		int nIndex=0;
		
#ifdef _UNICODE
		name.Format(_T("%S"),(*pup)->name);
#else
		//大%S在unicode工程下,后面的参数作为ansi看待
		name.Format(_T("%s"),(*pup)->name);
#endif
		priv_data_size.Format(_T("%d"),(*pup)->priv_data_size);
		f_index.Format(_T("%d"),up_index);
		//获取当前记录条数
		nIndex=sysinfosubup.m_sysinfoup.GetItemCount();
		//“行”数据结构
		LV_ITEM lvitem;
		lvitem.mask=LVIF_TEXT;
		lvitem.iItem=nIndex;
		lvitem.iSubItem=0;
		//注:vframe_index不可以直接赋值!
		//务必使用f_index执行Format!再赋值!
		lvitem.pszText=f_index.GetBuffer();
		//lvitem.pszText=(LPWSTR)(LPCTSTR)f_index;
		//------------------------
		sysinfosubup.m_sysinfoup.InsertItem(&lvitem);
		sysinfosubup.m_sysinfoup.SetItemText(nIndex,1,name);
		//下一个
		avio_enum_protocols((void **)pup,0);
		up_index++;
	}




	si.first_if= av_iformat_next(NULL);
	si.first_c=av_codec_next(NULL);

	AVInputFormat *if_temp=si.first_if;
	AVCodec *c_temp=si.first_c;
	//InputFormat
	int if_index=0;
	while(if_temp!=NULL){
		CString f_index,name,long_name,extensions,priv_data_size;
		int nIndex=0;
#ifdef _UNICODE
		name.Format(_T("%S"),if_temp->name);
		long_name.Format(_T("%S"),if_temp->long_name);
		extensions.Format(_T("%S"),if_temp->extensions);
#else
		name.Format(_T("%s"),if_temp->name);
		long_name.Format(_T("%s"),if_temp->long_name);
		extensions.Format(_T("%s"),if_temp->extensions);
#endif
		priv_data_size.Format(_T("%d"),if_temp->priv_data_size);
		f_index.Format(_T("%d"),if_index);
		//获取当前记录条数
		nIndex=sysinfosubif.m_sysinfoif.GetItemCount();
		//“行”数据结构
		LV_ITEM lvitem;
		lvitem.mask=LVIF_TEXT;
		lvitem.iItem=nIndex;
		lvitem.iSubItem=0;
		//注:vframe_index不可以直接赋值!
		//务必使用f_index执行Format!再赋值!
		lvitem.pszText=f_index.GetBuffer();
		//------------------------
		sysinfosubif.m_sysinfoif.InsertItem(&lvitem);
		sysinfosubif.m_sysinfoif.SetItemText(nIndex,1,name);
		sysinfosubif.m_sysinfoif.SetItemText(nIndex,2,long_name);
		sysinfosubif.m_sysinfoif.SetItemText(nIndex,3,extensions);
		sysinfosubif.m_sysinfoif.SetItemText(nIndex,4,priv_data_size);
		if_temp=if_temp->next;
		if_index++;
	}
	//Codec
	int c_index=0;
	while(c_temp!=NULL){
		CString f_index,name,long_name,priv_data_size,capabilities,
			supported_framerates,pix_fmts,supported_samplerates,sample_fmts,channel_layouts;
		int nIndex=0;

#ifdef _UNICODE
		name.Format(_T("%S"),c_temp->name);
		long_name.Format(_T("%S"),c_temp->long_name);
#else
		name.Format(_T("%s"),c_temp->name);
		long_name.Format(_T("%s"),c_temp->long_name);
#endif
		priv_data_size.Format(_T("%d"),c_temp->priv_data_size);
		f_index.Format(_T("%d"),c_index);
		//“行”数据结构
		LV_ITEM lvitem;
		lvitem.mask=LVIF_TEXT;
		lvitem.iSubItem=0;

		switch(c_temp->type){
		case AVMEDIA_TYPE_VIDEO:

			if(c_temp->supported_framerates==NULL){
				supported_framerates.Format(_T("Any"));
			}else{
				float sf_cal=0.0;
				sf_cal=(c_temp->supported_framerates->num)/(c_temp->supported_framerates->den);
				supported_framerates.Format(_T("%f"),sf_cal);
			}

			if(c_temp->pix_fmts==NULL){
				pix_fmts.Format(_T("Unknown"));
			}else{
				const enum AVPixelFormat *pf_temp=c_temp->pix_fmts;
				while(*pf_temp!=-1){
					pix_fmts.AppendFormat(_T("%d;"),*pf_temp);
					pf_temp++;
				}
			}

			//获取当前记录条数
			nIndex=sysinfosubvc.m_sysinfovc.GetItemCount();
			lvitem.iItem=nIndex;

			lvitem.pszText=f_index.GetBuffer();
			//------------------------
			sysinfosubvc.m_sysinfovc.InsertItem(&lvitem);
			sysinfosubvc.m_sysinfovc.SetItemText(nIndex,1,name);
			sysinfosubvc.m_sysinfovc.SetItemText(nIndex,2,long_name);
			sysinfosubvc.m_sysinfovc.SetItemText(nIndex,3,supported_framerates);
			sysinfosubvc.m_sysinfovc.SetItemText(nIndex,4,pix_fmts);
			sysinfosubvc.m_sysinfovc.SetItemText(nIndex,5,priv_data_size);

			break;
		case AVMEDIA_TYPE_AUDIO:

			if(c_temp->supported_samplerates==NULL){
				supported_samplerates.Format(_T("Unknown"));
			}else{
				const int *sr_temp=c_temp->supported_samplerates;
				while(*sr_temp!=0){
					supported_samplerates.AppendFormat(_T("%d;"),*sr_temp);
					sr_temp++;
				}
			}
			if(c_temp->sample_fmts==NULL){
				pix_fmts.Format(_T("Any"));
			}else{
				const enum AVSampleFormat *sf_temp=c_temp->sample_fmts;
				while(*sf_temp!=-1){
					sample_fmts.AppendFormat(_T("%d;"),*sf_temp);
					sf_temp++;
				}
			}

			//获取当前记录条数
			nIndex=sysinfosubac.m_sysinfoac.GetItemCount();
			lvitem.iItem=nIndex;

			lvitem.pszText=f_index.GetBuffer();
			//------------------------
			sysinfosubac.m_sysinfoac.InsertItem(&lvitem);
			sysinfosubac.m_sysinfoac.SetItemText(nIndex,1,name);
			sysinfosubac.m_sysinfoac.SetItemText(nIndex,2,long_name);
			sysinfosubac.m_sysinfoac.SetItemText(nIndex,3,supported_samplerates);
			sysinfosubac.m_sysinfoac.SetItemText(nIndex,4,sample_fmts);
			sysinfosubac.m_sysinfoac.SetItemText(nIndex,5,priv_data_size);
			break;
		default:
			//获取当前记录条数
			nIndex=sysinfosuboc.m_sysinfooc.GetItemCount();
			lvitem.iItem=nIndex;

			lvitem.pszText=f_index.GetBuffer();
			//------------------------
			sysinfosuboc.m_sysinfooc.InsertItem(&lvitem);
			sysinfosuboc.m_sysinfooc.SetItemText(nIndex,1,name);
			sysinfosuboc.m_sysinfooc.SetItemText(nIndex,2,long_name);
			sysinfosuboc.m_sysinfooc.SetItemText(nIndex,3,priv_data_size);
			break;
		}
		c_temp=c_temp->next;
		c_index++;
	}



}