History

doc/examples/demuxing_decoding: Drop old api mode, because the code fails to build otherwise

Michael Niedermayer committed 11 years ago

Commit a753e6c1 parent 998fa4f1 file · +4 −14Browse files

Unified · Split

doc/examples/demuxing_decoding.c+4−14
@@ -60,12 +60,11 @@ static int audio_frame_count = 0; · 59 unmodified lines
6060 * appropriate to your needs. Look for the use of api_mode in this example to
6161 * see what are the differences of API usage between them */
6262 enum {
63− API_MODE_OLD = 0, /* old method, deprecated */
6463 API_MODE_NEW_API_REF_COUNT = 1, /* new method, using the frame reference counting */
6564 API_MODE_NEW_API_NO_REF_COUNT = 2, /* new method, without reference counting */
6665 };
6766
68−static int api_mode = API_MODE_OLD;
67+static int api_mode = API_MODE_NEW_API_NO_REF_COUNT;
6968
7069 static int decode_packet(int *got_frame, int cached)
7170 {
@@ -243,8 +242,7 @@ int main (int argc, char **argv) · 171 unmodified lines
243242 }
244243 if (argc == 5) {
245244 const char *mode = argv[1] + strlen("-refcount=");
246− if (!strcmp(mode, "old")) api_mode = API_MODE_OLD;
247− else if (!strcmp(mode, "new_norefcount")) api_mode = API_MODE_NEW_API_NO_REF_COUNT;
245+ if (!strcmp(mode, "new_norefcount")) api_mode = API_MODE_NEW_API_NO_REF_COUNT;
248246 else if (!strcmp(mode, "new_refcount")) api_mode = API_MODE_NEW_API_REF_COUNT;
249247 else {
250248 fprintf(stderr, "unknow mode '%s'\n", mode);
@@ -315,12 +313,7 @@ int main (int argc, char **argv) · 64 unmodified lines
315313 goto end;
316314 }
317315
318− /* When using the new API, you need to use the libavutil/frame.h API, while
319− * the classic frame management is available in libavcodec */
320− if (api_mode == API_MODE_OLD)
321− frame = avcodec_alloc_frame();
322− else
323− frame = av_frame_alloc();
316+ frame = av_frame_alloc();
324317 if (!frame) {
325318 fprintf(stderr, "Could not allocate frame\n");
326319 ret = AVERROR(ENOMEM);
@@ -397,10 +390,7 @@ end: · 70 unmodified lines
397390 fclose(video_dst_file);
398391 if (audio_dst_file)
399392 fclose(audio_dst_file);
400− if (api_mode == API_MODE_OLD)
401− avcodec_free_frame(&frame);
402− else
403− av_frame_free(&frame);
393+ av_frame_free(&frame);
404394 av_free(video_dst_data[0]);
405395
406396 return ret < 0;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t