dshow_read_close(AVFormatContext *s)
{
struct dshow_ctx *ctx = s->priv_data;
- AVPacketList *pktl;
+ PacketList *pktl;
if (ctx->control) {
IMediaControl_Stop(ctx->control);
}
if (ctx->capture_pin[VideoDevice])
- libAVPin_Release(ctx->capture_pin[VideoDevice]);
+ ff_dshow_pin_Release(ctx->capture_pin[VideoDevice]);
if (ctx->capture_pin[AudioDevice])
- libAVPin_Release(ctx->capture_pin[AudioDevice]);
+ ff_dshow_pin_Release(ctx->capture_pin[AudioDevice]);
if (ctx->capture_filter[VideoDevice])
- libAVFilter_Release(ctx->capture_filter[VideoDevice]);
+ ff_dshow_filter_Release(ctx->capture_filter[VideoDevice]);
if (ctx->capture_filter[AudioDevice])
- libAVFilter_Release(ctx->capture_filter[AudioDevice]);
+ ff_dshow_filter_Release(ctx->capture_filter[AudioDevice]);
if (ctx->device_pin[VideoDevice])
IPin_Release(ctx->device_pin[VideoDevice]);
pktl = ctx->pktl;
while (pktl) {
- AVPacketList *next = pktl->next;
+ PacketList *next = pktl->next;
av_packet_unref(&pktl->pkt);
av_free(pktl);
pktl = next;
{
AVFormatContext *s = priv_data;
struct dshow_ctx *ctx = s->priv_data;
- AVPacketList **ppktl, *pktl_next;
+ PacketList **ppktl, *pktl_next;
// dump_videohdr(s, vdhdr);
if(shall_we_drop(s, index, devtype))
goto fail;
- pktl_next = av_mallocz(sizeof(AVPacketList));
+ pktl_next = av_mallocz(sizeof(PacketList));
if(!pktl_next)
goto fail;
goto fail1;
}
*device_unique_name = unique_name;
+ unique_name = NULL;
// success, loop will end now
}
} else {
av_log(avctx, AV_LOG_INFO, " \"%s\"\n", friendly_name);
av_log(avctx, AV_LOG_INFO, " Alternative name \"%s\"\n", unique_name);
- av_free(unique_name);
}
fail1:
IMalloc_Free(co_malloc, olestr);
if (bind_ctx)
IBindCtx_Release(bind_ctx);
- av_free(friendly_name);
+ av_freep(&friendly_name);
+ av_freep(&unique_name);
if (bag)
IPropertyBag_Release(bag);
IMoniker_Release(m);
* Pops up a user dialog allowing them to adjust properties for the given filter, if possible.
*/
void
-dshow_show_filter_properties(IBaseFilter *device_filter, AVFormatContext *avctx) {
+ff_dshow_show_filter_properties(IBaseFilter *device_filter, AVFormatContext *avctx) {
ISpecifyPropertyPages *property_pages = NULL;
IUnknown *device_filter_iunknown = NULL;
HRESULT hr;
int should_show_properties = (devtype == VideoDevice) ? ctx->show_video_device_dialog : ctx->show_audio_device_dialog;
if (should_show_properties)
- dshow_show_filter_properties(device_filter, avctx);
+ ff_dshow_show_filter_properties(device_filter, avctx);
r = IBaseFilter_EnumPins(device_filter, &pins);
if (r != S_OK) {
char *device_filter_unique_name = NULL;
IGraphBuilder *graph = ctx->graph;
IPin *device_pin = NULL;
- libAVPin *capture_pin = NULL;
- libAVFilter *capture_filter = NULL;
+ DShowPin *capture_pin = NULL;
+ DShowFilter *capture_filter = NULL;
ICaptureGraphBuilder2 *graph_builder2 = NULL;
int ret = AVERROR(EIO);
int r;
ctx->device_pin[devtype] = device_pin;
- capture_filter = libAVFilter_Create(avctx, callback, devtype);
+ capture_filter = ff_dshow_filter_Create(avctx, callback, devtype);
if (!capture_filter) {
av_log(avctx, AV_LOG_ERROR, "Could not create grabber filter.\n");
goto error;
goto error;
}
- libAVPin_AddRef(capture_filter->pin);
+ ff_dshow_pin_AddRef(capture_filter->pin);
capture_pin = capture_filter->pin;
ctx->capture_pin[devtype] = capture_pin;
goto error;
}
- r = dshow_try_setup_crossbar_options(graph_builder2, device_filter, devtype, avctx);
+ r = ff_dshow_try_setup_crossbar_options(graph_builder2, device_filter, devtype, avctx);
if (r != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not setup CrossBar\n");
AVStream *st;
int ret = AVERROR(EIO);
+ type.pbFormat = NULL;
+
st = avformat_new_stream(avctx, NULL);
if (!st) {
ret = AVERROR(ENOMEM);
ctx->capture_filter[devtype]->stream_index = st->index;
- libAVPin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
+ ff_dshow_pin_ConnectionMediaType(ctx->capture_pin[devtype], &type);
par = st->codecpar;
if (devtype == VideoDevice) {
if (par->codec_id == AV_CODEC_ID_NONE) {
av_log(avctx, AV_LOG_ERROR, "Unknown compression type. "
"Please report type 0x%X.\n", (int) bih->biCompression);
- return AVERROR_PATCHWELCOME;
+ ret = AVERROR_PATCHWELCOME;
+ goto error;
}
par->bits_per_coded_sample = bih->biBitCount;
} else {
par->codec_id = AV_CODEC_ID_RAWVIDEO;
if (bih->biCompression == BI_RGB || bih->biCompression == BI_BITFIELDS) {
par->bits_per_coded_sample = bih->biBitCount;
- par->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
- if (par->extradata) {
- par->extradata_size = 9;
- memcpy(par->extradata, "BottomUp", 9);
+ if (par->height < 0) {
+ par->height *= -1;
+ } else {
+ par->extradata = av_malloc(9 + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (par->extradata) {
+ par->extradata_size = 9;
+ memcpy(par->extradata, "BottomUp", 9);
+ }
}
}
}
ret = 0;
error:
+ if (type.pbFormat)
+ CoTaskMemFree(type.pbFormat);
return ret;
}
static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct dshow_ctx *ctx = s->priv_data;
- AVPacketList *pktl = NULL;
+ PacketList *pktl = NULL;
while (!ctx->eof && !pktl) {
WaitForSingleObject(ctx->mutex, INFINITE);